Search in sources :

Example 6 with StatsLogger

use of com.android.launcher3.logging.StatsLogManager.StatsLogger in project android_packages_apps_Launcher3 by crdroidandroid.

the class SettingsChangeLogger method dispatchUserEvent.

private void dispatchUserEvent() {
    StatsLogger logger = StatsLogManager.newInstance(mContext).logger().withInstanceId(new InstanceIdSequence().newInstanceId());
    logger.log(mNotificationDotsEnabled ? LAUNCHER_NOTIFICATION_DOT_ENABLED : LAUNCHER_NOTIFICATION_DOT_DISABLED);
    logger.log(mNavMode.launcherEvent);
    logger.log(getDevicePrefs(mContext).getBoolean(LAST_PREDICTION_ENABLED_STATE, true) ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED : LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED);
    SharedPreferences prefs = getPrefs(mContext);
    StatsLogManager.LauncherEvent gridSizeChangedEvent = null;
    // TODO(b/184981523): This doesn't work for 2-panel grid, which has 6 hotseat icons
    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);
    }
    if (FeatureFlags.ENABLE_THEMED_ICONS.get()) {
        logger.log(prefs.getBoolean(KEY_THEMED_ICONS, false) ? LAUNCHER_THEMED_ICON_ENABLED : LAUNCHER_THEMED_ICON_DISABLED);
    }
    mLoggablePrefs.forEach((key, lp) -> logger.log(() -> prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
}
Also used : StatsLogger(com.android.launcher3.logging.StatsLogManager.StatsLogger) InstanceIdSequence(com.android.launcher3.logging.InstanceIdSequence) SharedPreferences(android.content.SharedPreferences) StatsLogManager(com.android.launcher3.logging.StatsLogManager)

Aggregations

StatsLogger (com.android.launcher3.logging.StatsLogManager.StatsLogger)6 DeviceProfile (com.android.launcher3.DeviceProfile)2 DropTarget (com.android.launcher3.DropTarget)2 StatsLogManager (com.android.launcher3.logging.StatsLogManager)2 ItemInfo (com.android.launcher3.model.data.ItemInfo)2 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)2 SharedPreferences (android.content.SharedPreferences)1 View (android.view.View)1 CellLayout (com.android.launcher3.CellLayout)1 Launcher (com.android.launcher3.Launcher)1 DragController (com.android.launcher3.dragndrop.DragController)1 DragOptions (com.android.launcher3.dragndrop.DragOptions)1 ToState (com.android.launcher3.logger.LauncherAtom.ToState)1 InstanceIdSequence (com.android.launcher3.logging.InstanceIdSequence)1 FolderInfo (com.android.launcher3.model.data.FolderInfo)1 Optional (java.util.Optional)1 StringJoiner (java.util.StringJoiner)1