Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b468d25 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Log grid size change

Test: manually make sure that the correct path is fired
Fixes: 173481818
Change-Id: I7dc2143eb9c0527287398590d46fc2408bc47e44
parent 54834b09
Loading
Loading
Loading
Loading
+31 −4
Original line number Original line Diff line number Diff line
@@ -16,7 +16,13 @@


package com.android.quickstep.logging;
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.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_DISABLED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED;
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;
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.AutoInstallsLayout;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
@@ -69,7 +74,7 @@ public class SettingsChangeLogger implements
        mLoggablePrefs = loadPrefKeys(context);
        mLoggablePrefs = loadPrefKeys(context);
        mNavMode = SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this);
        mNavMode = SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this);


        Utilities.getPrefs(context).registerOnSharedPreferenceChangeListener(this);
        getPrefs(context).registerOnSharedPreferenceChangeListener(this);
        getDevicePrefs(context).registerOnSharedPreferenceChangeListener(this);
        getDevicePrefs(context).registerOnSharedPreferenceChangeListener(this);


        SecureSettingsObserver dotsObserver =
        SecureSettingsObserver dotsObserver =
@@ -125,7 +130,8 @@ public class SettingsChangeLogger implements


    @Override
    @Override
    public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    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();
            dispatchUserEvent();
        }
        }
    }
    }
@@ -142,7 +148,28 @@ public class SettingsChangeLogger implements
                ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED
                ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED
                : LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED);
                : 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(() ->
        mLoggablePrefs.forEach((key, lp) -> logger.log(() ->
                prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
                prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
    }
    }
+12 −0
Original line number Original line Diff line number Diff line
@@ -332,6 +332,18 @@ public class StatsLogManager implements ResourceBasedOverride {


        @UiEvent(doc = "Notification dismissed by swiping right.")
        @UiEvent(doc = "Notification dismissed by swiping right.")
        LAUNCHER_NOTIFICATION_DISMISSED(652),
        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
        // ADD MORE