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

Commit 0bcc2ee3 authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Support logging effect ID has for lock wallpaper (2/3)" into main

parents 877d6e0d c9696a03
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ class SysUiStatsLogger(val action: Int) {
    private var toggleOn = false
    private var shortcut = ""
    private var shortcutSlotId = ""
    private var lockEffectIdHash = 0

    fun setColorPackageHash(colorPackageHash: Int) = apply {
        this.colorPackageHash = colorPackageHash
@@ -151,6 +152,10 @@ class SysUiStatsLogger(val action: Int) {

    fun setShortcutSlotId(shortcutSlotId: String) = apply { this.shortcutSlotId = shortcutSlotId }

    fun setLockEffectIdHash(lockEffectIdHash: Int) = apply {
        this.lockEffectIdHash = lockEffectIdHash
    }

    fun log() {
        SysUiStatsLog.write(
            STYLE_UI_CHANGED,
@@ -185,6 +190,7 @@ class SysUiStatsLogger(val action: Int) {
            toggleOn,
            shortcut,
            shortcutSlotId,
            lockEffectIdHash,
        )
    }
}
+9 −2
Original line number Diff line number Diff line
@@ -75,9 +75,10 @@ constructor(
        SysUiStatsLogger(SNAPSHOT)
            .setWallpaperCategoryHash(preferences.getHomeCategoryHash())
            .setWallpaperIdHash(preferences.getHomeWallpaperIdHash())
            .setEffectIdHash(preferences.getHomeWallpaperEffectsIdHash())
            .setLockWallpaperCategoryHash(preferences.getLockCategoryHash())
            .setLockWallpaperIdHash(preferences.getLockWallpaperIdHash())
            .setEffectIdHash(preferences.getHomeWallpaperEffectsIdHash())
            .setLockEffectIdHash(preferences.getLockWallpaperEffectsIdHash())
            .setColorSource(colorManager.currentColorSourceForLogging)
            .setColorVariant(colorManager.currentStyleForLogging)
            .setSeedColor(colorManager.currentSeedColorForLogging)
@@ -110,9 +111,10 @@ constructor(
            .setAppSessionId(appSessionId.getId())
            .setWallpaperCategoryHash(if (isHomeWallpaperSet) categoryHash else 0)
            .setWallpaperIdHash(if (isHomeWallpaperSet) wallpaperIdHash else 0)
            .setEffectIdHash(if (isHomeWallpaperSet) getIdHashCode(effects) else 0)
            .setLockWallpaperCategoryHash(if (isLockWallpaperSet) categoryHash else 0)
            .setLockWallpaperIdHash(if (isLockWallpaperSet) wallpaperIdHash else 0)
            .setEffectIdHash(getIdHashCode(effects))
            .setLockEffectIdHash(if (isLockWallpaperSet) getIdHashCode(effects) else 0)
            .setSetWallpaperEntryPoint(setWallpaperEntryPoint)
            .setWallpaperDestination(destination)
            .log()
@@ -293,6 +295,11 @@ constructor(
        return getIdHashCode(getHomeWallpaperEffects())
    }

    /** If not set, the output hash is 0. */
    private fun WallpaperPreferences.getLockWallpaperEffectsIdHash(): Int {
        return getIdHashCode(getLockWallpaperEffects())
    }

    private fun getIdHashCode(id: String?): Int {
        return id?.hashCode() ?: 0
    }