Loading src/com/android/customization/module/logging/AppSessionId.kt +4 −38 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -15,43 +15,9 @@ */ package com.android.customization.module.logging import android.util.Log import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import javax.inject.Inject import javax.inject.Singleton interface AppSessionId { @Singleton class AppSessionId @Inject constructor() { fun createNewId(): AppSessionId private var idSequence: InstanceIdSequence? = null private var sessionId: InstanceId? = null fun createNewId(): AppSessionId { sessionId = newInstanceId() return this } fun getId(): Int { val id = sessionId ?: newInstanceId().also { Log.w( TAG, "Session ID should not be null. We should always call createNewId() before calling getId()." ) sessionId = it } return id.hashCode() } private fun newInstanceId(): InstanceId = (idSequence ?: InstanceIdSequence(INSTANCE_ID_MAX).also { idSequence = it }).newInstanceId() companion object { private const val TAG = "AppSessionId" // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values private const val INSTANCE_ID_MAX = 1 shl 20 } fun getId(): Int } src/com/android/customization/module/logging/AppSessionIdImpl.kt 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging import android.util.Log import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import javax.inject.Inject import javax.inject.Singleton @Singleton class AppSessionIdImpl @Inject constructor() : AppSessionId { private var idSequence: InstanceIdSequence? = null private var sessionId: InstanceId? = null override fun createNewId(): AppSessionId { sessionId = newInstanceId() return this } override fun getId(): Int { val id = sessionId ?: newInstanceId().also { Log.w( TAG, "Session ID should not be null. We should always call createNewId() before calling getId().", ) sessionId = it } return id.hashCode() } private fun newInstanceId(): InstanceId = (idSequence ?: InstanceIdSequence(INSTANCE_ID_MAX).also { idSequence = it }).newInstanceId() companion object { private const val TAG = "AppSessionId" // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values private const val INSTANCE_ID_MAX = 1 shl 20 } } src/com/android/customization/module/logging/SysUiStatsLogger.kt +87 −176 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -15,182 +15,93 @@ */ package com.android.customization.module.logging import android.stats.style.StyleEnums.CLOCK_SIZE_UNSPECIFIED import android.stats.style.StyleEnums.COLOR_SOURCE_UNSPECIFIED import android.stats.style.StyleEnums.DATE_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.LAUNCHED_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.LOCATION_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED import android.stats.style.StyleEnums.WALLPAPER_DESTINATION_UNSPECIFIED import com.android.systemui.shared.system.SysUiStatsLog import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource import com.android.wallpaper.module.logging.UserEventLogger.CustomizationPickerScreen import com.android.wallpaper.module.logging.UserEventLogger.DatePreference import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus import com.android.wallpaper.module.logging.UserEventLogger.LaunchedPreference import com.android.wallpaper.module.logging.UserEventLogger.LocationPreference import com.android.wallpaper.module.logging.UserEventLogger.SetWallpaperEntryPoint import com.android.wallpaper.module.logging.UserEventLogger.WallpaperDestination /** The builder for [SysUiStatsLog]. */ class SysUiStatsLogger(val action: Int) { private var colorPackageHash = 0 private var fontPackageHash = 0 private var shapePackageHash = 0 private var clockPackageHash = 0 private var launcherGrid = 0 private var wallpaperCategoryHash = 0 private var wallpaperIdHash = 0 private var colorPreference = 0 private var locationPreference = LOCATION_PREFERENCE_UNSPECIFIED private var datePreference = DATE_PREFERENCE_UNSPECIFIED private var launchedPreference = LAUNCHED_PREFERENCE_UNSPECIFIED private var effectPreference = EFFECT_PREFERENCE_UNSPECIFIED private var effectIdHash = 0 private var lockWallpaperCategoryHash = 0 private var lockWallpaperIdHash = 0 private var firstLaunchDateSinceSetup = 0 private var firstWallpaperApplyDateSinceSetup = 0 private var appLaunchCount = 0 private var colorVariant = 0 private var timeElapsedMillis = 0L private var effectResultCode = -1 private var appSessionId = 0 private var setWallpaperEntryPoint = SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED private var wallpaperDestination = WALLPAPER_DESTINATION_UNSPECIFIED private var colorSource = COLOR_SOURCE_UNSPECIFIED private var seedColor = 0 private var clockSize = CLOCK_SIZE_UNSPECIFIED private var toggleOn = false private var shortcut = "" private var shortcutSlotId = "" private var lockEffectIdHash = 0 fun setColorPackageHash(colorPackageHash: Int) = apply { this.colorPackageHash = colorPackageHash } /** * Interface defining the contract for logging Style UI changes via SysUiStatsLog. This follows a * builder pattern. */ interface SysUiStatsLogger { fun setFontPackageHash(fontPackageHash: Int) = apply { this.fontPackageHash = fontPackageHash } fun setColorPackageHash(colorPackageHash: Int): SysUiStatsLogger fun setShapePackageHash(shapePackageHash: Int) = apply { this.shapePackageHash = shapePackageHash } fun setFontPackageHash(fontPackageHash: Int): SysUiStatsLogger fun setClockPackageHash(clockPackageHash: Int) = apply { this.clockPackageHash = clockPackageHash } fun setShapePackageHash(shapePackageHash: Int): SysUiStatsLogger fun setLauncherGrid(launcherGrid: Int) = apply { this.launcherGrid = launcherGrid } fun setClockPackageHash(clockPackageHash: Int): SysUiStatsLogger fun setWallpaperCategoryHash(wallpaperCategoryHash: Int) = apply { this.wallpaperCategoryHash = wallpaperCategoryHash } fun setLauncherGrid(launcherGrid: Int): SysUiStatsLogger fun setWallpaperIdHash(wallpaperIdHash: Int) = apply { this.wallpaperIdHash = wallpaperIdHash } fun setWallpaperCategoryHash(wallpaperCategoryHash: Int): SysUiStatsLogger fun setColorPreference(colorPreference: Int) = apply { this.colorPreference = colorPreference } fun setWallpaperIdHash(wallpaperIdHash: Int): SysUiStatsLogger fun setLocationPreference(locationPreference: Int) = apply { this.locationPreference = locationPreference } fun setColorPreference(colorPreference: Int): SysUiStatsLogger fun setDatePreference(datePreference: Int) = apply { this.datePreference = datePreference } fun setLocationPreference(@LocationPreference locationPreference: Int): SysUiStatsLogger fun setLaunchedPreference(launchedPreference: Int) = apply { this.launchedPreference = launchedPreference } fun setDatePreference(@DatePreference datePreference: Int): SysUiStatsLogger fun setEffectPreference(effectPreference: Int) = apply { this.effectPreference = effectPreference } fun setLaunchedPreference(@LaunchedPreference launchedPreference: Int): SysUiStatsLogger fun setEffectIdHash(effectIdHash: Int) = apply { this.effectIdHash = effectIdHash } fun setEffectPreference(@EffectStatus effectPreference: Int): SysUiStatsLogger fun setLockWallpaperCategoryHash(lockWallpaperCategoryHash: Int) = apply { this.lockWallpaperCategoryHash = lockWallpaperCategoryHash } fun setEffectIdHash(effectIdHash: Int): SysUiStatsLogger fun setLockWallpaperIdHash(lockWallpaperIdHash: Int) = apply { this.lockWallpaperIdHash = lockWallpaperIdHash } fun setLockWallpaperCategoryHash(lockWallpaperCategoryHash: Int): SysUiStatsLogger fun setFirstLaunchDateSinceSetup(firstLaunchDateSinceSetup: Int) = apply { this.firstLaunchDateSinceSetup = firstLaunchDateSinceSetup } fun setLockWallpaperIdHash(lockWallpaperIdHash: Int): SysUiStatsLogger fun setFirstWallpaperApplyDateSinceSetup(firstWallpaperApplyDateSinceSetup: Int) = apply { this.firstWallpaperApplyDateSinceSetup = firstWallpaperApplyDateSinceSetup } fun setFirstLaunchDateSinceSetup(firstLaunchDateSinceSetup: Int): SysUiStatsLogger fun setAppLaunchCount(appLaunchCount: Int) = apply { this.appLaunchCount = appLaunchCount } fun setFirstWallpaperApplyDateSinceSetup( firstWallpaperApplyDateSinceSetup: Int ): SysUiStatsLogger fun setColorVariant(colorVariant: Int) = apply { this.colorVariant = colorVariant } fun setAppLaunchCount(appLaunchCount: Int): SysUiStatsLogger fun setTimeElapsed(timeElapsedMillis: Long) = apply { this.timeElapsedMillis = timeElapsedMillis } fun setColorVariant(colorVariant: Int): SysUiStatsLogger fun setEffectResultCode(effectResultCode: Int) = apply { this.effectResultCode = effectResultCode } fun setTimeElapsed(timeElapsedMillis: Long): SysUiStatsLogger fun setAppSessionId(sessionId: Int) = apply { this.appSessionId = sessionId } fun setEffectResultCode(effectResultCode: Int): SysUiStatsLogger fun setSetWallpaperEntryPoint(@SetWallpaperEntryPoint setWallpaperEntryPoint: Int) = apply { this.setWallpaperEntryPoint = setWallpaperEntryPoint } fun setAppSessionId(sessionId: Int): SysUiStatsLogger fun setWallpaperDestination(wallpaperDestination: Int) = apply { this.wallpaperDestination = wallpaperDestination } fun setSetWallpaperEntryPoint( @SetWallpaperEntryPoint setWallpaperEntryPoint: Int ): SysUiStatsLogger fun setColorSource(colorSource: Int) = apply { this.colorSource = colorSource } fun setWallpaperDestination(@WallpaperDestination wallpaperDestination: Int): SysUiStatsLogger fun setSeedColor(seedColor: Int) = apply { this.seedColor = seedColor } fun setColorSource(@ColorSource colorSource: Int): SysUiStatsLogger fun setClockSize(clockSize: Int) = apply { this.clockSize = clockSize } fun setSeedColor(seedColor: Int): SysUiStatsLogger fun setToggleOn(toggleOn: Boolean) = apply { this.toggleOn = toggleOn } fun setClockSize(@ClockSize clockSize: Int): SysUiStatsLogger fun setShortcut(shortcut: String) = apply { this.shortcut = shortcut } fun setToggleOn(toggleOn: Boolean): SysUiStatsLogger fun setShortcutSlotId(shortcutSlotId: String) = apply { this.shortcutSlotId = shortcutSlotId } fun setShortcut(shortcut: String): SysUiStatsLogger fun setLockEffectIdHash(lockEffectIdHash: Int) = apply { this.lockEffectIdHash = lockEffectIdHash } fun setShortcutSlotId(shortcutSlotId: String): SysUiStatsLogger fun log() { SysUiStatsLog.write( STYLE_UI_CHANGED, action, colorPackageHash, fontPackageHash, shapePackageHash, clockPackageHash, launcherGrid, wallpaperCategoryHash, wallpaperIdHash, colorPreference, locationPreference, datePreference, launchedPreference, effectPreference, effectIdHash, lockWallpaperCategoryHash, lockWallpaperIdHash, firstLaunchDateSinceSetup, firstWallpaperApplyDateSinceSetup, appLaunchCount, colorVariant, timeElapsedMillis, effectResultCode, appSessionId, setWallpaperEntryPoint, wallpaperDestination, colorSource, seedColor, clockSize, toggleOn, shortcut, shortcutSlotId, lockEffectIdHash, ) } fun setLockEffectIdHash(lockEffectIdHash: Int): SysUiStatsLogger fun setClockSeedColor(clockSeedColor: Int): SysUiStatsLogger fun setCustomizationPickerScreen( @CustomizationPickerScreen customizationPickerScreen: Int ): SysUiStatsLogger fun log() } src/com/android/customization/module/logging/SysUiStatsLoggerFactory.kt 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging interface SysUiStatsLoggerFactory { fun get(action: Int): SysUiStatsLogger } src/com/android/customization/module/logging/SysUiStatsLoggerFactoryImpl.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging import javax.inject.Inject import javax.inject.Singleton @Singleton class SysUiStatsLoggerFactoryImpl @Inject constructor() : SysUiStatsLoggerFactory { override fun get(action: Int): SysUiStatsLogger { return SysUiStatsLoggerImpl(action) } } Loading
src/com/android/customization/module/logging/AppSessionId.kt +4 −38 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -15,43 +15,9 @@ */ package com.android.customization.module.logging import android.util.Log import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import javax.inject.Inject import javax.inject.Singleton interface AppSessionId { @Singleton class AppSessionId @Inject constructor() { fun createNewId(): AppSessionId private var idSequence: InstanceIdSequence? = null private var sessionId: InstanceId? = null fun createNewId(): AppSessionId { sessionId = newInstanceId() return this } fun getId(): Int { val id = sessionId ?: newInstanceId().also { Log.w( TAG, "Session ID should not be null. We should always call createNewId() before calling getId()." ) sessionId = it } return id.hashCode() } private fun newInstanceId(): InstanceId = (idSequence ?: InstanceIdSequence(INSTANCE_ID_MAX).also { idSequence = it }).newInstanceId() companion object { private const val TAG = "AppSessionId" // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values private const val INSTANCE_ID_MAX = 1 shl 20 } fun getId(): Int }
src/com/android/customization/module/logging/AppSessionIdImpl.kt 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging import android.util.Log import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceIdSequence import javax.inject.Inject import javax.inject.Singleton @Singleton class AppSessionIdImpl @Inject constructor() : AppSessionId { private var idSequence: InstanceIdSequence? = null private var sessionId: InstanceId? = null override fun createNewId(): AppSessionId { sessionId = newInstanceId() return this } override fun getId(): Int { val id = sessionId ?: newInstanceId().also { Log.w( TAG, "Session ID should not be null. We should always call createNewId() before calling getId().", ) sessionId = it } return id.hashCode() } private fun newInstanceId(): InstanceId = (idSequence ?: InstanceIdSequence(INSTANCE_ID_MAX).also { idSequence = it }).newInstanceId() companion object { private const val TAG = "AppSessionId" // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values private const val INSTANCE_ID_MAX = 1 shl 20 } }
src/com/android/customization/module/logging/SysUiStatsLogger.kt +87 −176 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -15,182 +15,93 @@ */ package com.android.customization.module.logging import android.stats.style.StyleEnums.CLOCK_SIZE_UNSPECIFIED import android.stats.style.StyleEnums.COLOR_SOURCE_UNSPECIFIED import android.stats.style.StyleEnums.DATE_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.EFFECT_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.LAUNCHED_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.LOCATION_PREFERENCE_UNSPECIFIED import android.stats.style.StyleEnums.SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED import android.stats.style.StyleEnums.WALLPAPER_DESTINATION_UNSPECIFIED import com.android.systemui.shared.system.SysUiStatsLog import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UI_CHANGED import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource import com.android.wallpaper.module.logging.UserEventLogger.CustomizationPickerScreen import com.android.wallpaper.module.logging.UserEventLogger.DatePreference import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus import com.android.wallpaper.module.logging.UserEventLogger.LaunchedPreference import com.android.wallpaper.module.logging.UserEventLogger.LocationPreference import com.android.wallpaper.module.logging.UserEventLogger.SetWallpaperEntryPoint import com.android.wallpaper.module.logging.UserEventLogger.WallpaperDestination /** The builder for [SysUiStatsLog]. */ class SysUiStatsLogger(val action: Int) { private var colorPackageHash = 0 private var fontPackageHash = 0 private var shapePackageHash = 0 private var clockPackageHash = 0 private var launcherGrid = 0 private var wallpaperCategoryHash = 0 private var wallpaperIdHash = 0 private var colorPreference = 0 private var locationPreference = LOCATION_PREFERENCE_UNSPECIFIED private var datePreference = DATE_PREFERENCE_UNSPECIFIED private var launchedPreference = LAUNCHED_PREFERENCE_UNSPECIFIED private var effectPreference = EFFECT_PREFERENCE_UNSPECIFIED private var effectIdHash = 0 private var lockWallpaperCategoryHash = 0 private var lockWallpaperIdHash = 0 private var firstLaunchDateSinceSetup = 0 private var firstWallpaperApplyDateSinceSetup = 0 private var appLaunchCount = 0 private var colorVariant = 0 private var timeElapsedMillis = 0L private var effectResultCode = -1 private var appSessionId = 0 private var setWallpaperEntryPoint = SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED private var wallpaperDestination = WALLPAPER_DESTINATION_UNSPECIFIED private var colorSource = COLOR_SOURCE_UNSPECIFIED private var seedColor = 0 private var clockSize = CLOCK_SIZE_UNSPECIFIED private var toggleOn = false private var shortcut = "" private var shortcutSlotId = "" private var lockEffectIdHash = 0 fun setColorPackageHash(colorPackageHash: Int) = apply { this.colorPackageHash = colorPackageHash } /** * Interface defining the contract for logging Style UI changes via SysUiStatsLog. This follows a * builder pattern. */ interface SysUiStatsLogger { fun setFontPackageHash(fontPackageHash: Int) = apply { this.fontPackageHash = fontPackageHash } fun setColorPackageHash(colorPackageHash: Int): SysUiStatsLogger fun setShapePackageHash(shapePackageHash: Int) = apply { this.shapePackageHash = shapePackageHash } fun setFontPackageHash(fontPackageHash: Int): SysUiStatsLogger fun setClockPackageHash(clockPackageHash: Int) = apply { this.clockPackageHash = clockPackageHash } fun setShapePackageHash(shapePackageHash: Int): SysUiStatsLogger fun setLauncherGrid(launcherGrid: Int) = apply { this.launcherGrid = launcherGrid } fun setClockPackageHash(clockPackageHash: Int): SysUiStatsLogger fun setWallpaperCategoryHash(wallpaperCategoryHash: Int) = apply { this.wallpaperCategoryHash = wallpaperCategoryHash } fun setLauncherGrid(launcherGrid: Int): SysUiStatsLogger fun setWallpaperIdHash(wallpaperIdHash: Int) = apply { this.wallpaperIdHash = wallpaperIdHash } fun setWallpaperCategoryHash(wallpaperCategoryHash: Int): SysUiStatsLogger fun setColorPreference(colorPreference: Int) = apply { this.colorPreference = colorPreference } fun setWallpaperIdHash(wallpaperIdHash: Int): SysUiStatsLogger fun setLocationPreference(locationPreference: Int) = apply { this.locationPreference = locationPreference } fun setColorPreference(colorPreference: Int): SysUiStatsLogger fun setDatePreference(datePreference: Int) = apply { this.datePreference = datePreference } fun setLocationPreference(@LocationPreference locationPreference: Int): SysUiStatsLogger fun setLaunchedPreference(launchedPreference: Int) = apply { this.launchedPreference = launchedPreference } fun setDatePreference(@DatePreference datePreference: Int): SysUiStatsLogger fun setEffectPreference(effectPreference: Int) = apply { this.effectPreference = effectPreference } fun setLaunchedPreference(@LaunchedPreference launchedPreference: Int): SysUiStatsLogger fun setEffectIdHash(effectIdHash: Int) = apply { this.effectIdHash = effectIdHash } fun setEffectPreference(@EffectStatus effectPreference: Int): SysUiStatsLogger fun setLockWallpaperCategoryHash(lockWallpaperCategoryHash: Int) = apply { this.lockWallpaperCategoryHash = lockWallpaperCategoryHash } fun setEffectIdHash(effectIdHash: Int): SysUiStatsLogger fun setLockWallpaperIdHash(lockWallpaperIdHash: Int) = apply { this.lockWallpaperIdHash = lockWallpaperIdHash } fun setLockWallpaperCategoryHash(lockWallpaperCategoryHash: Int): SysUiStatsLogger fun setFirstLaunchDateSinceSetup(firstLaunchDateSinceSetup: Int) = apply { this.firstLaunchDateSinceSetup = firstLaunchDateSinceSetup } fun setLockWallpaperIdHash(lockWallpaperIdHash: Int): SysUiStatsLogger fun setFirstWallpaperApplyDateSinceSetup(firstWallpaperApplyDateSinceSetup: Int) = apply { this.firstWallpaperApplyDateSinceSetup = firstWallpaperApplyDateSinceSetup } fun setFirstLaunchDateSinceSetup(firstLaunchDateSinceSetup: Int): SysUiStatsLogger fun setAppLaunchCount(appLaunchCount: Int) = apply { this.appLaunchCount = appLaunchCount } fun setFirstWallpaperApplyDateSinceSetup( firstWallpaperApplyDateSinceSetup: Int ): SysUiStatsLogger fun setColorVariant(colorVariant: Int) = apply { this.colorVariant = colorVariant } fun setAppLaunchCount(appLaunchCount: Int): SysUiStatsLogger fun setTimeElapsed(timeElapsedMillis: Long) = apply { this.timeElapsedMillis = timeElapsedMillis } fun setColorVariant(colorVariant: Int): SysUiStatsLogger fun setEffectResultCode(effectResultCode: Int) = apply { this.effectResultCode = effectResultCode } fun setTimeElapsed(timeElapsedMillis: Long): SysUiStatsLogger fun setAppSessionId(sessionId: Int) = apply { this.appSessionId = sessionId } fun setEffectResultCode(effectResultCode: Int): SysUiStatsLogger fun setSetWallpaperEntryPoint(@SetWallpaperEntryPoint setWallpaperEntryPoint: Int) = apply { this.setWallpaperEntryPoint = setWallpaperEntryPoint } fun setAppSessionId(sessionId: Int): SysUiStatsLogger fun setWallpaperDestination(wallpaperDestination: Int) = apply { this.wallpaperDestination = wallpaperDestination } fun setSetWallpaperEntryPoint( @SetWallpaperEntryPoint setWallpaperEntryPoint: Int ): SysUiStatsLogger fun setColorSource(colorSource: Int) = apply { this.colorSource = colorSource } fun setWallpaperDestination(@WallpaperDestination wallpaperDestination: Int): SysUiStatsLogger fun setSeedColor(seedColor: Int) = apply { this.seedColor = seedColor } fun setColorSource(@ColorSource colorSource: Int): SysUiStatsLogger fun setClockSize(clockSize: Int) = apply { this.clockSize = clockSize } fun setSeedColor(seedColor: Int): SysUiStatsLogger fun setToggleOn(toggleOn: Boolean) = apply { this.toggleOn = toggleOn } fun setClockSize(@ClockSize clockSize: Int): SysUiStatsLogger fun setShortcut(shortcut: String) = apply { this.shortcut = shortcut } fun setToggleOn(toggleOn: Boolean): SysUiStatsLogger fun setShortcutSlotId(shortcutSlotId: String) = apply { this.shortcutSlotId = shortcutSlotId } fun setShortcut(shortcut: String): SysUiStatsLogger fun setLockEffectIdHash(lockEffectIdHash: Int) = apply { this.lockEffectIdHash = lockEffectIdHash } fun setShortcutSlotId(shortcutSlotId: String): SysUiStatsLogger fun log() { SysUiStatsLog.write( STYLE_UI_CHANGED, action, colorPackageHash, fontPackageHash, shapePackageHash, clockPackageHash, launcherGrid, wallpaperCategoryHash, wallpaperIdHash, colorPreference, locationPreference, datePreference, launchedPreference, effectPreference, effectIdHash, lockWallpaperCategoryHash, lockWallpaperIdHash, firstLaunchDateSinceSetup, firstWallpaperApplyDateSinceSetup, appLaunchCount, colorVariant, timeElapsedMillis, effectResultCode, appSessionId, setWallpaperEntryPoint, wallpaperDestination, colorSource, seedColor, clockSize, toggleOn, shortcut, shortcutSlotId, lockEffectIdHash, ) } fun setLockEffectIdHash(lockEffectIdHash: Int): SysUiStatsLogger fun setClockSeedColor(clockSeedColor: Int): SysUiStatsLogger fun setCustomizationPickerScreen( @CustomizationPickerScreen customizationPickerScreen: Int ): SysUiStatsLogger fun log() }
src/com/android/customization/module/logging/SysUiStatsLoggerFactory.kt 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging interface SysUiStatsLoggerFactory { fun get(action: Int): SysUiStatsLogger }
src/com/android/customization/module/logging/SysUiStatsLoggerFactoryImpl.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.module.logging import javax.inject.Inject import javax.inject.Singleton @Singleton class SysUiStatsLoggerFactoryImpl @Inject constructor() : SysUiStatsLoggerFactory { override fun get(action: Int): SysUiStatsLogger { return SysUiStatsLoggerImpl(action) } }