summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lin <giolin@google.com>2023-10-02 19:02:06 +0000
committerGeorge Lin <giolin@google.com>2023-10-04 14:09:57 +0000
commit2b4a52fcc5f5202cea62a69735c3106f8e1c1f0f (patch)
tree37176921c9a1d4f1f02ddaa06699126c9749877b
parent5c0fd84dd6a6ab7010ff93124dbe2865ff1ae001 (diff)
downloadThemePicker-2b4a52fcc5f5202cea62a69735c3106f8e1c1f0f.tar.gz
Set wallpaper log (1/3)
Prepare set wallpaper log Test: Manually tested the log is correct. See Bug. Bug: 299659307 Change-Id: I14655730d2771bf728b30bb9cf60f5799beec18e
-rw-r--r--src/com/android/customization/module/SysUiStatsLogger.kt3
-rw-r--r--src/com/android/customization/module/logging/StatsLogUserEventLogger.kt19
2 files changed, 19 insertions, 3 deletions
diff --git a/src/com/android/customization/module/SysUiStatsLogger.kt b/src/com/android/customization/module/SysUiStatsLogger.kt
index ee821eea..142bd22f 100644
--- a/src/com/android/customization/module/SysUiStatsLogger.kt
+++ b/src/com/android/customization/module/SysUiStatsLogger.kt
@@ -25,6 +25,7 @@ import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__LOCATIO
import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__SET_WALLPAPER_ENTRY_POINT__SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED
import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__WALLPAPER_DESTINATION__WALLPAPER_DESTINATION_UNSPECIFIED
import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED
+import com.android.wallpaper.module.logging.UserEventLogger.SetWallpaperEntryPoint
/** The builder for [SysUiStatsLog]. */
class SysUiStatsLogger(val action: Int) {
@@ -138,7 +139,7 @@ class SysUiStatsLogger(val action: Int) {
this.sessionId = sessionId
}
- fun setSetWallpaperEntryPoint(setWallpaperEntryPoint: Int) = apply {
+ fun setSetWallpaperEntryPoint(@SetWallpaperEntryPoint setWallpaperEntryPoint: Int) = apply {
this.setWallpaperEntryPoint = setWallpaperEntryPoint
}
diff --git a/src/com/android/customization/module/logging/StatsLogUserEventLogger.kt b/src/com/android/customization/module/logging/StatsLogUserEventLogger.kt
index d0d01561..90a1c6f2 100644
--- a/src/com/android/customization/module/logging/StatsLogUserEventLogger.kt
+++ b/src/com/android/customization/module/logging/StatsLogUserEventLogger.kt
@@ -23,9 +23,14 @@ import com.android.customization.model.color.ColorOption
import com.android.customization.model.grid.GridOption
import com.android.customization.module.SysUiStatsLogger
import com.android.systemui.shared.system.SysUiStatsLog
+import com.android.wallpaper.module.WallpaperPersister.DEST_BOTH
+import com.android.wallpaper.module.WallpaperPersister.DEST_HOME_SCREEN
+import com.android.wallpaper.module.WallpaperPersister.DEST_LOCK_SCREEN
import com.android.wallpaper.module.WallpaperPreferences
import com.android.wallpaper.module.logging.NoOpUserEventLogger
import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus
+import com.android.wallpaper.module.logging.UserEventLogger.SetWallpaperEntryPoint
+import com.android.wallpaper.module.logging.UserEventLogger.WallpaperDestination
import com.android.wallpaper.util.LaunchSourceUtils
/** StatsLog-backed implementation of [ThemesUserEventLogger]. */
@@ -58,11 +63,21 @@ class StatsLogUserEventLogger(private val preferences: WallpaperPreferences) :
collectionId: String?,
wallpaperId: String?,
effects: String?,
+ @SetWallpaperEntryPoint setWallpaperEntryPoint: Int,
+ @WallpaperDestination destination: Int,
) {
+ val categoryHash = getIdHashCode(collectionId)
+ val wallpaperIdHash = getIdHashCode(wallpaperId)
+ val isHomeWallpaperSet = destination == DEST_HOME_SCREEN || destination == DEST_BOTH
+ val isLockWallpaperSet = destination == DEST_LOCK_SCREEN || destination == DEST_BOTH
SysUiStatsLogger(StyleEnums.WALLPAPER_APPLIED)
- .setWallpaperCategoryHash(getIdHashCode(collectionId))
- .setWallpaperIdHash(getIdHashCode(wallpaperId))
+ .setWallpaperCategoryHash(if (isHomeWallpaperSet) categoryHash else 0)
+ .setWallpaperIdHash(if (isHomeWallpaperSet) wallpaperIdHash else 0)
+ .setLockWallpaperCategoryHash(if (isLockWallpaperSet) categoryHash else 0)
+ .setLockWallpaperIdHash(if (isLockWallpaperSet) wallpaperIdHash else 0)
.setEffectIdHash(getIdHashCode(effects))
+ .setSetWallpaperEntryPoint(setWallpaperEntryPoint)
+ .setWallpaperDestination(destination)
.log()
}