Set wallpaper log (1/3)
Prepare set wallpaper log
Test: Manually tested the log is correct. See Bug.
Bug: 299659307
Change-Id: I14655730d2771bf728b30bb9cf60f5799beec18e
diff --git a/src/com/android/customization/module/SysUiStatsLogger.kt b/src/com/android/customization/module/SysUiStatsLogger.kt
index ee821ee..142bd22 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__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 @@
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 d0d0156..90a1c6f 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.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 @@
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()
}