Loading src/com/android/customization/module/StatsLogUserEventLogger.java +90 −77 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__ import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_SETTINGS_SEARCH; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_SUW; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_TIPS; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SETTINGS_SEARCH; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SOURCE_DEEP_LINK; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SOURCE_LAUNCHER; Loading @@ -49,7 +48,6 @@ import com.android.customization.model.clock.Clockface; import com.android.customization.model.color.ColorOption; import com.android.customization.model.grid.GridOption; import com.android.customization.model.theme.ThemeBundle; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.wallpaper.module.Injector; import com.android.wallpaper.module.InjectorProvider; import com.android.wallpaper.module.NoOpUserEventLogger; Loading Loading @@ -78,60 +76,67 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them @Override public void logAppLaunched(Intent launchSource) { SysUiStatsLog.write(STYLE_UI_CHANGED, STYLE_UICHANGED__ACTION__APP_LAUNCHED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, getAppLaunchSource(launchSource), 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(STYLE_UICHANGED__ACTION__APP_LAUNCHED) .setLaunchedPreference(getAppLaunchSource(launchSource)) .log(); } @Override public void logResumed(boolean provisioned, boolean wallpaper) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONRESUME, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.ONRESUME) .log(); } @Override public void logStopped() { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONSTOP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.ONSTOP) .log(); } @Override public void logActionClicked(String collectionId, int actionLabelResId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_EXPLORE) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logIndividualWallpaperSelected(String collectionId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logCategorySelected(String collectionId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_OPEN_CATEGORY, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_OPEN_CATEGORY) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logLiveWallpaperInfoSelected(String collectionId, @Nullable String wallpaperId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.LIVE_WALLPAPER_INFO_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.LIVE_WALLPAPER_INFO_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .log(); } @Override public void logLiveWallpaperCustomizeSelected(String collectionId, @Nullable String wallpaperId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.LIVE_WALLPAPER_CUSTOMIZE_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger().setAction(StyleEnums.LIVE_WALLPAPER_CUSTOMIZE_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .log(); } @Override Loading @@ -146,35 +151,36 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them String lockWallpaperId = isLockWallpaperSet ? mPreferences.getLockWallpaperRemoteId() : homeWallpaperId; SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.SNAPSHOT, 0, 0, 0, 0, 0, getIdHashCode(homeCollectionId), getIdHashCode(homeWallpaperId), 0, 0, 0, 0, 0, 0, getIdHashCode(lockCollectionId), getIdHashCode(lockWallpaperId), mPreferences.getFirstLaunchDateSinceSetup(), mPreferences.getFirstWallpaperApplyDateSinceSetup(), mPreferences.getAppLaunchCount(), 0); new SysUiStatsLogger().setAction(StyleEnums.SNAPSHOT) .setWallpaperCategoryHash(getIdHashCode(homeCollectionId)) .setWallpaperIdHash(getIdHashCode(homeWallpaperId)) .setLockWallpaperCategoryHash(getIdHashCode(lockCollectionId)) .setLockWallpaperIdHash(getIdHashCode(lockWallpaperId)) .setFirstLaunchDateSinceSetup(mPreferences.getFirstLaunchDateSinceSetup()) .setFirstWallpaperApplyDateSinceSetup( mPreferences.getFirstWallpaperApplyDateSinceSetup()) .setAppLaunchCount(mPreferences.getAppLaunchCount()) .log(); } @Override public void logWallpaperSet(String collectionId, @Nullable String wallpaperId, @Nullable String effects) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_APPLIED, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, effects != null ? effects.hashCode() : 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_APPLIED) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .setEffectIdHash(getIdHashCode(effects)) .log(); } @Override public void logEffectApply(String effect, @EffectStatus int status) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EFFECT_APPLIED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status, effect != null ? effect.hashCode() : 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_EFFECT_APPLIED) .setEffectPreference(status) .setEffectIdHash(getIdHashCode(effect)) .log(); } @Nullable Loading @@ -185,60 +191,67 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them @Override public void logThemeSelected(ThemeBundle theme, boolean isCustomTheme) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)), Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)), Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setColorPackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR))) .setFontPackageHash(Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_FONT))) .setShapePackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE))) .log(); } @Override public void logThemeApplied(ThemeBundle theme, boolean isCustomTheme) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)), Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)), Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setColorPackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR))) .setFontPackageHash(Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_FONT))) .setShapePackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE))) .log(); } @Override public void logColorApplied(int action, ColorOption colorOption) { SysUiStatsLog.write(STYLE_UI_CHANGED, action, 0, 0, 0, 0, 0, 0, 0, colorOption.getIndex(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, colorOption.getStyle().ordinal() + 1); new SysUiStatsLogger() .setAction(action) .setColorPreference(colorOption.getIndex()) .setColorVariant(colorOption.getStyle().ordinal() + 1) .log(); } @Override public void logClockSelected(Clockface clock) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, 0, 0, 0, Objects.hashCode(clock.getId()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setClockPackageHash(Objects.hashCode(clock.getId())) .log(); } @Override public void logClockApplied(Clockface clock) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, 0, 0, 0, Objects.hashCode(clock.getId()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setClockPackageHash(Objects.hashCode(clock.getId())) .log(); } @Override public void logGridSelected(GridOption grid) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, 0, 0, 0, 0, grid.cols, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setLauncherGrid(grid.cols) .log(); } @Override public void logGridApplied(GridOption grid) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, 0, 0, 0, 0, grid.cols, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setLauncherGrid(grid.cols) .log(); } private int getAppLaunchSource(Intent launchSource) { Loading src/com/android/customization/module/SysUiStatsLogger.kt 0 → 100644 +136 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module import android.stats.style.StyleEnums import com.android.systemui.shared.system.SysUiStatsLog import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED /** * The builder for [SysUiStatsLog]. */ class SysUiStatsLogger { private var atom = STYLE_UI_CHANGED private var action = StyleEnums.DEFAULT_ACTION private var colorPackageHash = 0 private var fontPackageHash = 0 private var shapePackageHash = 0 private var clockPackageHash = 0 private var launcherGrid = 0 private var wallpaperCategoryHash = 0 private var wallpaperIdHash = 0 private var colorPreference = 0 private var locationPreference = StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED private var datePreference = StyleEnums.DATE_PREFERENCE_UNSPECIFIED private var launchedPreference = StyleEnums.LAUNCHED_PREFERENCE_UNSPECIFIED private var effectPreference = StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED private var effectIdHash = 0 private var lockWallpaperCategoryHash = 0 private var lockWallpaperIdHash = 0 private var firstLaunchDateSinceSetup = 0 private var firstWallpaperApplyDateSinceSetup = 0 private var appLaunchCount = 0 private var colorVariant = 0 fun setAction(action: Int) = apply { this.action = action } fun setColorPackageHash(color_package_hash: Int) = apply { this.colorPackageHash = color_package_hash } fun setFontPackageHash(font_package_hash: Int) = apply { this.fontPackageHash = font_package_hash } fun setShapePackageHash(shape_package_hash: Int) = apply { this.shapePackageHash = shape_package_hash } fun setClockPackageHash(clock_package_hash: Int) = apply { this.clockPackageHash = clock_package_hash } fun setLauncherGrid(launcher_grid: Int) = apply { this.launcherGrid = launcher_grid } fun setWallpaperCategoryHash(wallpaper_category_hash: Int) = apply { this.wallpaperCategoryHash = wallpaper_category_hash } fun setWallpaperIdHash(wallpaper_id_hash: Int) = apply { this.wallpaperIdHash = wallpaper_id_hash } fun setColorPreference(color_preference: Int) = apply { this.colorPreference = color_preference } fun setLocationPreference(location_preference: Int) = apply { this.locationPreference = location_preference } fun setDatePreference(date_preference: Int) = apply { this.datePreference = date_preference } fun setLaunchedPreference(launched_preference: Int) = apply { this.launchedPreference = launched_preference } fun setEffectPreference(effect_preference: Int) = apply { this.effectPreference = effect_preference } fun setEffectIdHash(effect_id_hash: Int) = apply { this.effectIdHash = effect_id_hash } fun setLockWallpaperCategoryHash(lock_wallpaper_category_hash: Int) = apply { this.lockWallpaperCategoryHash = lock_wallpaper_category_hash } fun setLockWallpaperIdHash(lock_wallpaper_id_hash: Int) = apply { this.lockWallpaperIdHash = lock_wallpaper_id_hash } fun setFirstLaunchDateSinceSetup(first_launch_date_since_setup: Int) = apply { this.firstLaunchDateSinceSetup = first_launch_date_since_setup } fun setFirstWallpaperApplyDateSinceSetup(first_wallpaper_apply_date_since_setup: Int) = apply { this.firstWallpaperApplyDateSinceSetup = first_wallpaper_apply_date_since_setup } fun setAppLaunchCount(app_launch_count: Int) = apply { this.appLaunchCount = app_launch_count } fun setColorVariant(color_variant: Int) = apply { this.colorVariant = color_variant } fun log() { SysUiStatsLog.write( atom, action, colorPackageHash, fontPackageHash, shapePackageHash, clockPackageHash, launcherGrid, wallpaperCategoryHash, wallpaperIdHash, colorPreference, locationPreference, datePreference, launchedPreference, effectPreference, effectIdHash, lockWallpaperCategoryHash, lockWallpaperIdHash, firstLaunchDateSinceSetup, firstWallpaperApplyDateSinceSetup, appLaunchCount, colorVariant ) } } No newline at end of file Loading
src/com/android/customization/module/StatsLogUserEventLogger.java +90 −77 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__ import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_SETTINGS_SEARCH; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_SUW; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_TIPS; import static com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SETTINGS_SEARCH; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SOURCE_DEEP_LINK; import static com.android.wallpaper.util.LaunchSourceUtils.LAUNCH_SOURCE_LAUNCHER; Loading @@ -49,7 +48,6 @@ import com.android.customization.model.clock.Clockface; import com.android.customization.model.color.ColorOption; import com.android.customization.model.grid.GridOption; import com.android.customization.model.theme.ThemeBundle; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.wallpaper.module.Injector; import com.android.wallpaper.module.InjectorProvider; import com.android.wallpaper.module.NoOpUserEventLogger; Loading Loading @@ -78,60 +76,67 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them @Override public void logAppLaunched(Intent launchSource) { SysUiStatsLog.write(STYLE_UI_CHANGED, STYLE_UICHANGED__ACTION__APP_LAUNCHED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, getAppLaunchSource(launchSource), 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(STYLE_UICHANGED__ACTION__APP_LAUNCHED) .setLaunchedPreference(getAppLaunchSource(launchSource)) .log(); } @Override public void logResumed(boolean provisioned, boolean wallpaper) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONRESUME, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.ONRESUME) .log(); } @Override public void logStopped() { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.ONSTOP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.ONSTOP) .log(); } @Override public void logActionClicked(String collectionId, int actionLabelResId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_EXPLORE) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logIndividualWallpaperSelected(String collectionId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logCategorySelected(String collectionId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_OPEN_CATEGORY, 0, 0, 0, 0, 0, getIdHashCode(collectionId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_OPEN_CATEGORY) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .log(); } @Override public void logLiveWallpaperInfoSelected(String collectionId, @Nullable String wallpaperId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.LIVE_WALLPAPER_INFO_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.LIVE_WALLPAPER_INFO_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .log(); } @Override public void logLiveWallpaperCustomizeSelected(String collectionId, @Nullable String wallpaperId) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.LIVE_WALLPAPER_CUSTOMIZE_SELECT, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger().setAction(StyleEnums.LIVE_WALLPAPER_CUSTOMIZE_SELECT) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .log(); } @Override Loading @@ -146,35 +151,36 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them String lockWallpaperId = isLockWallpaperSet ? mPreferences.getLockWallpaperRemoteId() : homeWallpaperId; SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.SNAPSHOT, 0, 0, 0, 0, 0, getIdHashCode(homeCollectionId), getIdHashCode(homeWallpaperId), 0, 0, 0, 0, 0, 0, getIdHashCode(lockCollectionId), getIdHashCode(lockWallpaperId), mPreferences.getFirstLaunchDateSinceSetup(), mPreferences.getFirstWallpaperApplyDateSinceSetup(), mPreferences.getAppLaunchCount(), 0); new SysUiStatsLogger().setAction(StyleEnums.SNAPSHOT) .setWallpaperCategoryHash(getIdHashCode(homeCollectionId)) .setWallpaperIdHash(getIdHashCode(homeWallpaperId)) .setLockWallpaperCategoryHash(getIdHashCode(lockCollectionId)) .setLockWallpaperIdHash(getIdHashCode(lockWallpaperId)) .setFirstLaunchDateSinceSetup(mPreferences.getFirstLaunchDateSinceSetup()) .setFirstWallpaperApplyDateSinceSetup( mPreferences.getFirstWallpaperApplyDateSinceSetup()) .setAppLaunchCount(mPreferences.getAppLaunchCount()) .log(); } @Override public void logWallpaperSet(String collectionId, @Nullable String wallpaperId, @Nullable String effects) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_APPLIED, 0, 0, 0, 0, 0, getIdHashCode(collectionId), getIdHashCode(wallpaperId), 0, 0, 0, 0, 0, effects != null ? effects.hashCode() : 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_APPLIED) .setWallpaperCategoryHash(getIdHashCode(collectionId)) .setWallpaperIdHash(getIdHashCode(wallpaperId)) .setEffectIdHash(getIdHashCode(effects)) .log(); } @Override public void logEffectApply(String effect, @EffectStatus int status) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.WALLPAPER_EFFECT_APPLIED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status, effect != null ? effect.hashCode() : 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.WALLPAPER_EFFECT_APPLIED) .setEffectPreference(status) .setEffectIdHash(getIdHashCode(effect)) .log(); } @Nullable Loading @@ -185,60 +191,67 @@ public class StatsLogUserEventLogger extends NoOpUserEventLogger implements Them @Override public void logThemeSelected(ThemeBundle theme, boolean isCustomTheme) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)), Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)), Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setColorPackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR))) .setFontPackageHash(Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_FONT))) .setShapePackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE))) .log(); } @Override public void logThemeApplied(ThemeBundle theme, boolean isCustomTheme) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR)), Objects.hashCode(getThemePackage(theme,OVERLAY_CATEGORY_FONT)), Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setColorPackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_COLOR))) .setFontPackageHash(Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_FONT))) .setShapePackageHash( Objects.hashCode(getThemePackage(theme, OVERLAY_CATEGORY_SHAPE))) .log(); } @Override public void logColorApplied(int action, ColorOption colorOption) { SysUiStatsLog.write(STYLE_UI_CHANGED, action, 0, 0, 0, 0, 0, 0, 0, colorOption.getIndex(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, colorOption.getStyle().ordinal() + 1); new SysUiStatsLogger() .setAction(action) .setColorPreference(colorOption.getIndex()) .setColorVariant(colorOption.getStyle().ordinal() + 1) .log(); } @Override public void logClockSelected(Clockface clock) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, 0, 0, 0, Objects.hashCode(clock.getId()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setClockPackageHash(Objects.hashCode(clock.getId())) .log(); } @Override public void logClockApplied(Clockface clock) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, 0, 0, 0, Objects.hashCode(clock.getId()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setClockPackageHash(Objects.hashCode(clock.getId())) .log(); } @Override public void logGridSelected(GridOption grid) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_SELECT, 0, 0, 0, 0, grid.cols, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_SELECT) .setLauncherGrid(grid.cols) .log(); } @Override public void logGridApplied(GridOption grid) { SysUiStatsLog.write(STYLE_UI_CHANGED, StyleEnums.PICKER_APPLIED, 0, 0, 0, 0, grid.cols, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); new SysUiStatsLogger() .setAction(StyleEnums.PICKER_APPLIED) .setLauncherGrid(grid.cols) .log(); } private int getAppLaunchSource(Intent launchSource) { Loading
src/com/android/customization/module/SysUiStatsLogger.kt 0 → 100644 +136 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module import android.stats.style.StyleEnums import com.android.systemui.shared.system.SysUiStatsLog import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED /** * The builder for [SysUiStatsLog]. */ class SysUiStatsLogger { private var atom = STYLE_UI_CHANGED private var action = StyleEnums.DEFAULT_ACTION private var colorPackageHash = 0 private var fontPackageHash = 0 private var shapePackageHash = 0 private var clockPackageHash = 0 private var launcherGrid = 0 private var wallpaperCategoryHash = 0 private var wallpaperIdHash = 0 private var colorPreference = 0 private var locationPreference = StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED private var datePreference = StyleEnums.DATE_PREFERENCE_UNSPECIFIED private var launchedPreference = StyleEnums.LAUNCHED_PREFERENCE_UNSPECIFIED private var effectPreference = StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED private var effectIdHash = 0 private var lockWallpaperCategoryHash = 0 private var lockWallpaperIdHash = 0 private var firstLaunchDateSinceSetup = 0 private var firstWallpaperApplyDateSinceSetup = 0 private var appLaunchCount = 0 private var colorVariant = 0 fun setAction(action: Int) = apply { this.action = action } fun setColorPackageHash(color_package_hash: Int) = apply { this.colorPackageHash = color_package_hash } fun setFontPackageHash(font_package_hash: Int) = apply { this.fontPackageHash = font_package_hash } fun setShapePackageHash(shape_package_hash: Int) = apply { this.shapePackageHash = shape_package_hash } fun setClockPackageHash(clock_package_hash: Int) = apply { this.clockPackageHash = clock_package_hash } fun setLauncherGrid(launcher_grid: Int) = apply { this.launcherGrid = launcher_grid } fun setWallpaperCategoryHash(wallpaper_category_hash: Int) = apply { this.wallpaperCategoryHash = wallpaper_category_hash } fun setWallpaperIdHash(wallpaper_id_hash: Int) = apply { this.wallpaperIdHash = wallpaper_id_hash } fun setColorPreference(color_preference: Int) = apply { this.colorPreference = color_preference } fun setLocationPreference(location_preference: Int) = apply { this.locationPreference = location_preference } fun setDatePreference(date_preference: Int) = apply { this.datePreference = date_preference } fun setLaunchedPreference(launched_preference: Int) = apply { this.launchedPreference = launched_preference } fun setEffectPreference(effect_preference: Int) = apply { this.effectPreference = effect_preference } fun setEffectIdHash(effect_id_hash: Int) = apply { this.effectIdHash = effect_id_hash } fun setLockWallpaperCategoryHash(lock_wallpaper_category_hash: Int) = apply { this.lockWallpaperCategoryHash = lock_wallpaper_category_hash } fun setLockWallpaperIdHash(lock_wallpaper_id_hash: Int) = apply { this.lockWallpaperIdHash = lock_wallpaper_id_hash } fun setFirstLaunchDateSinceSetup(first_launch_date_since_setup: Int) = apply { this.firstLaunchDateSinceSetup = first_launch_date_since_setup } fun setFirstWallpaperApplyDateSinceSetup(first_wallpaper_apply_date_since_setup: Int) = apply { this.firstWallpaperApplyDateSinceSetup = first_wallpaper_apply_date_since_setup } fun setAppLaunchCount(app_launch_count: Int) = apply { this.appLaunchCount = app_launch_count } fun setColorVariant(color_variant: Int) = apply { this.colorVariant = color_variant } fun log() { SysUiStatsLog.write( atom, action, colorPackageHash, fontPackageHash, shapePackageHash, clockPackageHash, launcherGrid, wallpaperCategoryHash, wallpaperIdHash, colorPreference, locationPreference, datePreference, launchedPreference, effectPreference, effectIdHash, lockWallpaperCategoryHash, lockWallpaperIdHash, firstLaunchDateSinceSetup, firstWallpaperApplyDateSinceSetup, appLaunchCount, colorVariant ) } } No newline at end of file