Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2159 from MozillaReality/telemetry_updates
Browse files Browse the repository at this point in the history
Fix the open windows weighted mean calculation
  • Loading branch information
daoshengmu authored Nov 18, 2019
2 parents 19c4722 + 834e34a commit 64da0a2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public static void openWindowsEvent(int from, int to, boolean isPrivate) {
Log.d(LOGTAG, "\tTWO: " + openWindowsTime[WindowPlacement.LEFT.getValue()]);
Log.d(LOGTAG, "\tTHREE: " + openWindowsTime[WindowPlacement.RIGHT.getValue()]);

Log.d(LOGTAG, "Open Private Windows Count:");
Log.d(LOGTAG, "Open Windows Count:");
Log.d(LOGTAG, "\tFRONT: " + openWindows[WindowPlacement.FRONT.getValue()]);
Log.d(LOGTAG, "\tLEFT: " + openWindows[WindowPlacement.LEFT.getValue()]);
Log.d(LOGTAG, "\tRIGHT: " + openWindows[WindowPlacement.RIGHT.getValue()]);
Expand Down Expand Up @@ -595,6 +595,26 @@ private static void queueActiveWindowPctEvent() {
}
}

public static void resetOpenedWindowsCount(int number, boolean isPrivate) {
if (isPrivate) {
for (int i=0; i<openPrivateWindows.length; i++) {
openPrivateWindows[i] = 0;
}
if (number > 0) {
openPrivateWindows[number-1] = 1;
}

} else {
for (int i=0; i<openWindows.length; i++) {
openWindows[i] = 0;
}

if (number > 0) {
openWindows[number-1] = 1;
}
}
}

private static void queueOpenWindowsAvgEvent() {
float weight = 0;
float weightSum = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ public void onResume() {
for (WindowWidget window: mPrivateWindows) {
window.onResume();
}

TelemetryWrapper.resetOpenedWindowsCount(mRegularWindows.size(), false);
TelemetryWrapper.resetOpenedWindowsCount(mPrivateWindows.size(), true);
}

public void onDestroy() {
Expand Down

0 comments on commit 64da0a2

Please sign in to comment.