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

Commit f1af599d authored by George Lin's avatar George Lin
Browse files

Add fields to StyleUiChanged spec (3/3)

Test: Unit test
Bug: 409336077
Flag: com.android.systemui.shared.new_customization_picker_ui
Change-Id: If0e2b056409dfba15bb77cbd15a7f74086adb410
parent cd6bb0d8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.customization.module.logging

import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize
import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource
import com.android.wallpaper.module.logging.UserEventLogger.AppIconStyle
import com.android.wallpaper.module.logging.UserEventLogger.CustomizationPickerScreen
import com.android.wallpaper.module.logging.UserEventLogger.DatePreference
import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus
@@ -103,5 +104,9 @@ interface SysUiStatsLogger {
        @CustomizationPickerScreen customizationPickerScreen: Int
    ): SysUiStatsLogger

    fun setAppIconStyle(@AppIconStyle appIconStyle: Int): SysUiStatsLogger

    fun setUseClockCustomization(useClockCustomization: Boolean): SysUiStatsLogger

    fun log()
}
+15 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.customization.module.logging

import android.stats.style.StyleEnums.APP_ICON_STYLE_UNSPECIFIED
import android.stats.style.StyleEnums.CLOCK_SIZE_UNSPECIFIED
import android.stats.style.StyleEnums.COLOR_SOURCE_UNSPECIFIED
import android.stats.style.StyleEnums.DATE_PREFERENCE_UNSPECIFIED
@@ -28,6 +29,7 @@ import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize
import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource
import com.android.systemui.shared.system.SysUiStatsLog
import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED
import com.android.wallpaper.module.logging.UserEventLogger.AppIconStyle
import com.android.wallpaper.module.logging.UserEventLogger.CustomizationPickerScreen
import com.android.wallpaper.module.logging.UserEventLogger.DatePreference
import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus
@@ -72,6 +74,8 @@ class SysUiStatsLoggerImpl(val action: Int) : SysUiStatsLogger {
    private var lockEffectIdHash = 0
    private var clockSeedColor = 0
    @CustomizationPickerScreen private var customizationPickerScreen = SCREEN_UNSPECIFIED
    @AppIconStyle private var appIconStyle = APP_ICON_STYLE_UNSPECIFIED
    private var useClockCustomization = false

    override fun setColorPackageHash(colorPackageHash: Int) = apply {
        this.colorPackageHash = colorPackageHash
@@ -191,6 +195,15 @@ class SysUiStatsLoggerImpl(val action: Int) : SysUiStatsLogger {
        @CustomizationPickerScreen customizationPickerScreen: Int
    ) = apply { this.customizationPickerScreen = customizationPickerScreen }

    override fun setAppIconStyle(@AppIconStyle appIconStyle: Int): SysUiStatsLogger = apply {
        this.appIconStyle = appIconStyle
    }

    override fun setUseClockCustomization(useClockCustomization: Boolean): SysUiStatsLogger =
        apply {
            this.useClockCustomization = useClockCustomization
        }

    override fun log() {
        SysUiStatsLog.write(
            STYLE_UI_CHANGED,
@@ -228,6 +241,8 @@ class SysUiStatsLoggerImpl(val action: Int) : SysUiStatsLogger {
            lockEffectIdHash,
            clockSeedColor,
            customizationPickerScreen,
            appIconStyle,
            useClockCustomization,
        )
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.customization.module.logging

import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize
import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource
import com.android.wallpaper.module.logging.UserEventLogger.AppIconStyle
import com.android.wallpaper.module.logging.UserEventLogger.CustomizationPickerScreen
import com.android.wallpaper.module.logging.UserEventLogger.DatePreference
import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus
@@ -60,6 +61,8 @@ class FakeSysUiStatsLogger(val action: Int) : SysUiStatsLogger {
    var lockEffectIdHash: Int? = null
    var clockSeedColor: Int? = null
    @CustomizationPickerScreen var customizationPickerScreen: Int? = null
    @AppIconStyle var appIconStyle: Int? = null
    var useClockCustomization: Boolean? = null

    // --- Property to track if log() was called ---
    var logCalled: Boolean = false
@@ -204,6 +207,15 @@ class FakeSysUiStatsLogger(val action: Int) : SysUiStatsLogger {
        @CustomizationPickerScreen customizationPickerScreen: Int
    ): SysUiStatsLogger = apply { this.customizationPickerScreen = customizationPickerScreen }

    override fun setAppIconStyle(@AppIconStyle appIconStyle: Int): SysUiStatsLogger = apply {
        this.appIconStyle = appIconStyle
    }

    override fun setUseClockCustomization(useClockCustomization: Boolean): SysUiStatsLogger =
        apply {
            this.useClockCustomization = useClockCustomization
        }

    override fun log() {
        this.logCalled = true
    }