Log grid size change

Test: manually make sure that the correct path is fired
Fixes: 173481818
Change-Id: I7dc2143eb9c0527287398590d46fc2408bc47e44
This commit is contained in:
Tracy Zhou
2020-11-18 15:02:08 -08:00
parent 54834b0909
commit 5b468d252f
2 changed files with 43 additions and 4 deletions

View File

@@ -16,7 +16,13 @@
package com.android.quickstep.logging;
import static com.android.launcher3.InvariantDeviceProfile.KEY_MIGRATION_SRC_HOTSEAT_COUNT;
import static com.android.launcher3.Utilities.getDevicePrefs;
import static com.android.launcher3.Utilities.getPrefs;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_2;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_3;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_4;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_5;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_DOT_DISABLED;
@@ -34,7 +40,6 @@ import android.util.Xml;
import com.android.launcher3.AutoInstallsLayout;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
@@ -69,7 +74,7 @@ public class SettingsChangeLogger implements
mLoggablePrefs = loadPrefKeys(context);
mNavMode = SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this);
Utilities.getPrefs(context).registerOnSharedPreferenceChangeListener(this);
getPrefs(context).registerOnSharedPreferenceChangeListener(this);
getDevicePrefs(context).registerOnSharedPreferenceChangeListener(this);
SecureSettingsObserver dotsObserver =
@@ -125,7 +130,8 @@ public class SettingsChangeLogger implements
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (LAST_PREDICTION_ENABLED_STATE.equals(key) || mLoggablePrefs.containsKey(key)) {
if (LAST_PREDICTION_ENABLED_STATE.equals(key) || KEY_MIGRATION_SRC_HOTSEAT_COUNT.equals(key)
|| mLoggablePrefs.containsKey(key)) {
dispatchUserEvent();
}
}
@@ -142,7 +148,28 @@ public class SettingsChangeLogger implements
? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED
: LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED);
SharedPreferences prefs = Utilities.getPrefs(mContext);
SharedPreferences prefs = getPrefs(mContext);
StatsLogManager.LauncherEvent gridSizeChangedEvent = null;
switch (prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, -1)) {
case 5:
gridSizeChangedEvent = LAUNCHER_GRID_SIZE_5;
break;
case 4:
gridSizeChangedEvent = LAUNCHER_GRID_SIZE_4;
break;
case 3:
gridSizeChangedEvent = LAUNCHER_GRID_SIZE_3;
break;
case 2:
gridSizeChangedEvent = LAUNCHER_GRID_SIZE_2;
break;
default:
// Ignore illegal input.
break;
}
if (gridSizeChangedEvent != null) {
logger.log(gridSizeChangedEvent);
}
mLoggablePrefs.forEach((key, lp) -> logger.log(() ->
prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
}

View File

@@ -332,6 +332,18 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "Notification dismissed by swiping right.")
LAUNCHER_NOTIFICATION_DISMISSED(652),
@UiEvent(doc = "Current grid size is changed to 5.")
LAUNCHER_GRID_SIZE_5(662),
@UiEvent(doc = "Current grid size is changed to 4.")
LAUNCHER_GRID_SIZE_4(663),
@UiEvent(doc = "Current grid size is changed to 3.")
LAUNCHER_GRID_SIZE_3(664),
@UiEvent(doc = "Current grid size is changed to 2.")
LAUNCHER_GRID_SIZE_2(665),
;
// ADD MORE