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

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

Merge "Modify theme color applied log" into main

parents b7823df3 936a02ec
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -17,14 +17,13 @@ package com.android.customization.module.logging

import android.stats.style.StyleEnums
import androidx.annotation.IntDef
import com.android.customization.model.color.ColorOption
import com.android.customization.model.grid.GridOption
import com.android.wallpaper.module.logging.UserEventLogger

/** Extension of [UserEventLogger] that adds ThemePicker specific events. */
interface ThemesUserEventLogger : UserEventLogger {

    fun logThemeColorApplied(colorOption: ColorOption)
    fun logThemeColorApplied(@ColorSource source: Int, variant: Int, seedColor: Int)

    fun logGridApplied(grid: GridOption)

@@ -42,6 +41,15 @@ interface ThemesUserEventLogger : UserEventLogger {

    fun logDarkThemeApplied(useDarkTheme: Boolean)

    @IntDef(
        StyleEnums.COLOR_SOURCE_UNSPECIFIED,
        StyleEnums.COLOR_SOURCE_HOME_SCREEN_WALLPAPER,
        StyleEnums.COLOR_SOURCE_LOCK_SCREEN_WALLPAPER,
        StyleEnums.COLOR_SOURCE_PRESET_COLOR,
    )
    @Retention(AnnotationRetention.SOURCE)
    annotation class ColorSource

    @IntDef(
        StyleEnums.CLOCK_SIZE_UNSPECIFIED,
        StyleEnums.CLOCK_SIZE_DYNAMIC,
+9 −4
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ import android.app.WallpaperManager
import android.content.Intent
import android.stats.style.StyleEnums
import android.text.TextUtils
import com.android.customization.model.color.ColorOption
import com.android.customization.model.grid.GridOption
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.wallpaper.module.WallpaperPersister.DEST_BOTH
import com.android.wallpaper.module.WallpaperPersister.DEST_HOME_SCREEN
@@ -115,10 +115,15 @@ class ThemesUserEventLoggerImpl(private val preferences: WallpaperPreferences) :
        SysUiStatsLogger(StyleEnums.WALLPAPER_EXPLORE).log()
    }

    override fun logThemeColorApplied(colorOption: ColorOption) {
    override fun logThemeColorApplied(
        @ColorSource source: Int,
        variant: Int,
        seedColor: Int,
    ) {
        SysUiStatsLogger(StyleEnums.THEME_COLOR_APPLIED)
            .setColorPreference(colorOption.index)
            .setColorVariant(colorOption.style.ordinal + 1)
            .setColorSource(source)
            .setColorVariant(variant)
            .setSeedColor(seedColor)
            .log()
    }

+2 −2
Original line number Diff line number Diff line
@@ -15,14 +15,14 @@
 */
package com.android.customization.module.logging

import com.android.customization.model.color.ColorOption
import com.android.customization.model.grid.GridOption
import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource
import com.android.wallpaper.module.logging.TestUserEventLogger

/** Test implementation of [ThemesUserEventLogger]. */
class TestThemesUserEventLogger : TestUserEventLogger(), ThemesUserEventLogger {

    override fun logThemeColorApplied(colorOption: ColorOption) {}
    override fun logThemeColorApplied(@ColorSource source: Int, variant: Int, seedColor: Int) {}

    override fun logGridApplied(grid: GridOption) {}