Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b4a52fc authored by George Lin's avatar George Lin
Browse files

Set wallpaper log (1/3)

Prepare set wallpaper log

Test: Manually tested the log is correct. See Bug.
Bug: 299659307
Change-Id: I14655730d2771bf728b30bb9cf60f5799beec18e
parent 5c0fd84d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
    }

+17 −2
Original line number Diff line number Diff line
@@ -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()
    }