Add metrics logging for selected icon shape
Bug: 400696362 Test: N/A Flag: com.android.launcher3.enable_launcher_icon_shapes Change-Id: Ibe85fad20ec35bc49dc8e76e3dbf402d31810d21
This commit is contained in:
@@ -19,15 +19,26 @@ package com.android.quickstep.logging;
|
||||
import static com.android.launcher3.LauncherPrefs.getDevicePrefs;
|
||||
import static com.android.launcher3.LauncherPrefs.getPrefs;
|
||||
import static com.android.launcher3.graphics.ThemeManager.KEY_THEMED_ICONS;
|
||||
import static com.android.launcher3.graphics.ThemeManager.PREF_ICON_SHAPE;
|
||||
import static com.android.launcher3.graphics.ThemeManager.THEMED_ICONS;
|
||||
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_ICON_SHAPE_ARCH;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ICON_SHAPE_CIRCLE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ICON_SHAPE_FOUR_SIDED_COOKIE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ICON_SHAPE_SEVEN_SIDED_COOKIE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ICON_SHAPE_SQUARE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_DOT_DISABLED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_DOT_ENABLED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_THEMED_ICON_DISABLED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_THEMED_ICON_ENABLED;
|
||||
import static com.android.launcher3.model.DeviceGridState.KEY_WORKSPACE_SIZE;
|
||||
import static com.android.launcher3.model.PredictionUpdateTask.LAST_PREDICTION_ENABLED;
|
||||
import static com.android.launcher3.shapes.ShapesProvider.ARCH_KEY;
|
||||
import static com.android.launcher3.shapes.ShapesProvider.CIRCLE_KEY;
|
||||
import static com.android.launcher3.shapes.ShapesProvider.FOUR_SIDED_COOKIE_KEY;
|
||||
import static com.android.launcher3.shapes.ShapesProvider.SEVEN_SIDED_COOKIE_KEY;
|
||||
import static com.android.launcher3.shapes.ShapesProvider.SQUARE_KEY;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
|
||||
import static com.android.launcher3.util.SettingsCache.NOTIFICATION_BADGING_URI;
|
||||
|
||||
@@ -41,12 +52,14 @@ import android.util.Xml;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
|
||||
import com.android.launcher3.model.DeviceGridState;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
@@ -86,8 +99,8 @@ public class SettingsChangeLogger implements
|
||||
private final StatsLogManager mStatsLogManager;
|
||||
|
||||
private NavigationMode mNavMode;
|
||||
private StatsLogManager.LauncherEvent mNotificationDotsEvent;
|
||||
private StatsLogManager.LauncherEvent mHomeScreenSuggestionEvent;
|
||||
private LauncherEvent mNotificationDotsEvent;
|
||||
private LauncherEvent mHomeScreenSuggestionEvent;
|
||||
|
||||
private final SettingsCache.OnChangeListener mListener = this::onNotificationDotsChanged;
|
||||
|
||||
@@ -168,7 +181,7 @@ public class SettingsChangeLogger implements
|
||||
}
|
||||
|
||||
private void onNotificationDotsChanged(boolean isDotsEnabled) {
|
||||
StatsLogManager.LauncherEvent mEvent =
|
||||
LauncherEvent mEvent =
|
||||
isDotsEnabled ? LAUNCHER_NOTIFICATION_DOT_ENABLED
|
||||
: LAUNCHER_NOTIFICATION_DOT_DISABLED;
|
||||
|
||||
@@ -219,6 +232,19 @@ public class SettingsChangeLogger implements
|
||||
? LAUNCHER_THEMED_ICON_ENABLED
|
||||
: LAUNCHER_THEMED_ICON_DISABLED);
|
||||
|
||||
if (Flags.enableLauncherIconShapes()) {
|
||||
Optional.ofNullable(
|
||||
switch (LauncherPrefs.get(mContext).get(PREF_ICON_SHAPE)) {
|
||||
case CIRCLE_KEY -> LAUNCHER_ICON_SHAPE_CIRCLE;
|
||||
case SQUARE_KEY -> LAUNCHER_ICON_SHAPE_SQUARE;
|
||||
case FOUR_SIDED_COOKIE_KEY -> LAUNCHER_ICON_SHAPE_FOUR_SIDED_COOKIE;
|
||||
case SEVEN_SIDED_COOKIE_KEY -> LAUNCHER_ICON_SHAPE_SEVEN_SIDED_COOKIE;
|
||||
case ARCH_KEY -> LAUNCHER_ICON_SHAPE_ARCH;
|
||||
default -> null;
|
||||
}
|
||||
).ifPresent(logger::log);
|
||||
}
|
||||
|
||||
mLoggablePrefs.forEach((key, lp) -> logger.log(() ->
|
||||
prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
|
||||
}
|
||||
|
||||
@@ -460,6 +460,21 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
@UiEvent(doc = "Current grid size is changed to 6x5")
|
||||
LAUNCHER_GRID_SIZE_6_BY_5(2188),
|
||||
|
||||
@UiEvent(doc = "App icon shape changed to Circle")
|
||||
LAUNCHER_ICON_SHAPE_CIRCLE(2229),
|
||||
|
||||
@UiEvent(doc = "App icon shape changed to Square")
|
||||
LAUNCHER_ICON_SHAPE_SQUARE(2230),
|
||||
|
||||
@UiEvent(doc = "App icon shape changed to 4-sided Cookie")
|
||||
LAUNCHER_ICON_SHAPE_FOUR_SIDED_COOKIE(2231),
|
||||
|
||||
@UiEvent(doc = "App icon shape changed to 7-sided Cookie")
|
||||
LAUNCHER_ICON_SHAPE_SEVEN_SIDED_COOKIE(2232),
|
||||
|
||||
@UiEvent(doc = "App icon shape changed to Arch")
|
||||
LAUNCHER_ICON_SHAPE_ARCH(2233),
|
||||
|
||||
@UiEvent(doc = "Launcher entered into AllApps state.")
|
||||
LAUNCHER_ALLAPPS_ENTRY(692),
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.launcher3.shapes
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.launcher3.Flags as LauncherFlags
|
||||
import com.android.systemui.shared.Flags
|
||||
|
||||
@@ -38,11 +37,11 @@ object ShapesProvider {
|
||||
"M35.209 4.878C36.326 3.895 36.884 3.404 37.397 3.006 44.82 -2.742 55.18 -2.742 62.603 3.006 63.116 3.404 63.674 3.895 64.791 4.878 65.164 5.207 65.351 5.371 65.539 5.529 68.167 7.734 71.303 9.248 74.663 9.932 74.902 9.981 75.147 10.025 75.637 10.113 77.1 10.375 77.831 10.506 78.461 10.66 87.573 12.893 94.032 21.011 94.176 30.412 94.186 31.062 94.151 31.805 94.08 33.293 94.057 33.791 94.045 34.04 94.039 34.285 93.958 37.72 94.732 41.121 96.293 44.18 96.404 44.399 96.522 44.618 96.759 45.056 97.467 46.366 97.821 47.021 98.093 47.611 102.032 56.143 99.727 66.266 92.484 72.24 91.983 72.653 91.381 73.089 90.177 73.961 89.774 74.254 89.572 74.4 89.377 74.548 86.647 76.626 84.477 79.353 83.063 82.483 82.962 82.707 82.865 82.936 82.671 83.395 82.091 84.766 81.8 85.451 81.51 86.033 77.31 94.44 67.977 98.945 58.801 96.994 58.166 96.859 57.451 96.659 56.019 96.259 55.54 96.125 55.3 96.058 55.063 95.998 51.74 95.154 48.26 95.154 44.937 95.998 44.699 96.058 44.46 96.125 43.981 96.259 42.549 96.659 41.834 96.859 41.199 96.994 32.023 98.945 22.69 94.44 18.49 86.033 18.2 85.451 17.909 84.766 17.329 83.395 17.135 82.936 17.038 82.707 16.937 82.483 15.523 79.353 13.353 76.626 10.623 74.548 10.428 74.4 10.226 74.254 9.823 73.961 8.619 73.089 8.017 72.653 7.516 72.24 .273 66.266 -2.032 56.143 1.907 47.611 2.179 47.021 2.533 46.366 3.241 45.056 3.478 44.618 3.596 44.399 3.707 44.18 5.268 41.121 6.042 37.72 5.961 34.285 5.955 34.04 5.943 33.791 5.92 33.293 5.849 31.805 5.814 31.062 5.824 30.412 5.968 21.011 12.427 12.893 21.539 10.66 22.169 10.506 22.9 10.375 24.363 10.113 24.853 10.025 25.098 9.981 25.337 9.932 28.697 9.248 31.833 7.734 34.461 5.529 34.649 5.371 34.836 5.207 35.209 4.878Z"
|
||||
private const val ARCH_PATH =
|
||||
"M50 0C77.614 0 100 22.386 100 50C100 85.471 100 86.476 99.9 87.321 99.116 93.916 93.916 99.116 87.321 99.9 86.476 100 85.471 100 83.46 100H16.54C14.529 100 13.524 100 12.679 99.9 6.084 99.116 .884 93.916 .1 87.321 0 86.476 0 85.471 0 83.46L0 50C0 22.386 22.386 0 50 0Z"
|
||||
@VisibleForTesting const val CIRCLE_KEY = "circle"
|
||||
@VisibleForTesting const val SQUARE_KEY = "square"
|
||||
@VisibleForTesting const val FOUR_SIDED_COOKIE_KEY = "four_sided_cookie"
|
||||
@VisibleForTesting const val SEVEN_SIDED_COOKIE_KEY = "seven_sided_cookie"
|
||||
@VisibleForTesting const val ARCH_KEY = "arch"
|
||||
const val CIRCLE_KEY = "circle"
|
||||
const val SQUARE_KEY = "square"
|
||||
const val FOUR_SIDED_COOKIE_KEY = "four_sided_cookie"
|
||||
const val SEVEN_SIDED_COOKIE_KEY = "seven_sided_cookie"
|
||||
const val ARCH_KEY = "arch"
|
||||
|
||||
val iconShapes =
|
||||
if (Flags.newCustomizationPickerUi() && LauncherFlags.enableLauncherIconShapes()) {
|
||||
|
||||
Reference in New Issue
Block a user