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

Commit b22518ef authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13972532 from 94aab86d to 25Q4-release

Change-Id: I7ac2a2d443f20b8c3c7e541047a946090abbb441
parents 3629d56c 94aab86d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@
 */
package com.android.customization.module.logging

import com.android.customization.module.logging.ThemesUserEventLogger.AppIconStyle
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
+1 −1
Original line number Diff line number Diff line
@@ -25,11 +25,11 @@ import android.stats.style.StyleEnums.LOCATION_PREFERENCE_UNSPECIFIED
import android.stats.style.StyleEnums.SCREEN_UNSPECIFIED
import android.stats.style.StyleEnums.SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED
import android.stats.style.StyleEnums.WALLPAPER_DESTINATION_UNSPECIFIED
import com.android.customization.module.logging.ThemesUserEventLogger.AppIconStyle
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
+10 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ interface ThemesUserEventLogger : UserEventLogger {

    fun logThemedIconApplied(useThemeIcon: Boolean)

    fun logIconStyleApplied(iconStyle: Int)

    fun logLockScreenNotificationApplied(showLockScreenNotifications: Boolean)

    fun logShortcutApplied(shortcut: String, shortcutSlotId: String)
@@ -64,6 +66,14 @@ interface ThemesUserEventLogger : UserEventLogger {
    @Retention(AnnotationRetention.SOURCE)
    annotation class ClockSize

    @IntDef(
        StyleEnums.APP_ICON_STYLE_UNSPECIFIED,
        StyleEnums.APP_ICON_STYLE_THEMED,
        StyleEnums.APP_ICON_STYLE_EXTENDIBLE_THEME,
    )
    @Retention(AnnotationRetention.SOURCE)
    annotation class AppIconStyle

    companion object {
        const val NULL_SEED_COLOR = 0
    }
+14 −12
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@ package com.android.customization.module.logging

import android.app.WallpaperManager
import android.content.Intent
import android.stats.style.StyleEnums.APP_ICON_STYLE_THEMED
import android.stats.style.StyleEnums.APP_ICON_STYLE_UNSPECIFIED
import android.stats.style.StyleEnums.APP_LAUNCHED
import android.stats.style.StyleEnums.CLOCK_APPLIED
import android.stats.style.StyleEnums.CLOCK_COLOR_APPLIED
@@ -68,6 +66,7 @@ import com.android.customization.model.color.ColorCustomizationManager
import com.android.customization.model.grid.GridOptionModel
import com.android.customization.model.grid.ShapeGridManager
import com.android.customization.model.grid.ShapeOptionModel
import com.android.customization.module.logging.ThemesUserEventLogger.AppIconStyle
import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize
import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource
import com.android.customization.picker.clock.data.repository.ClockPickerRepository
@@ -91,6 +90,7 @@ import com.android.wallpaper.util.LaunchSourceUtils
import io.grpc.Status
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeoutOrNull

@@ -124,7 +124,7 @@ constructor(
            .setColorVariant(colorManager.currentStyleForLogging)
            .setSeedColor(colorManager.currentSeedColorForLogging)
            .setShapePackageHash(shapeGridManager.getSelectedShapeIdHash())
            .setAppIconStyle(iconStyleRepository.getAppIconStyle())
            .setAppIconStyle(iconStyleRepository.getIconStyleForLogging())
            .setLauncherGrid(shapeGridManager.getSelectedGridInt())
            .setClockPackageHash(selectedClockLoggingData.clockIdHash)
            .setClockSeedColor(selectedClockLoggingData.clockSeedColor)
@@ -269,6 +269,14 @@ constructor(
            .log()
    }

    override fun logIconStyleApplied(@AppIconStyle iconStyle: Int) {
        sysUiStatsLoggerFactory
            .get(THEMED_ICON_APPLIED)
            .setAppSessionId(appSessionId.getId())
            .setAppIconStyle(iconStyle)
            .log()
    }

    override fun logLockScreenNotificationApplied(showLockScreenNotifications: Boolean) {
        sysUiStatsLoggerFactory
            .get(LOCK_SCREEN_NOTIFICATION_APPLIED)
@@ -436,24 +444,18 @@ constructor(
        return selectedGrid?.getLauncherGridInt() ?: 0
    }

    private suspend fun IconStyleRepository.getAppIconStyle(): Int {
        val isThemedIconActivated =
            withTimeoutOrNull(TIMEOUT_MILLIS) { isThemedIconActivated.first() } ?: false
        return if (isThemedIconActivated) APP_ICON_STYLE_THEMED else APP_ICON_STYLE_UNSPECIFIED
    }

    private suspend fun ClockPickerRepository.getSelectedClockLoggingData():
        SelectedClockLoggingData {
        val selectedClock =
            try {
                withTimeoutOrNull(TIMEOUT_MILLIS) { selectedClock.first() }
                withTimeoutOrNull(TIMEOUT) { selectedClock.first() }
            } catch (e: Exception) {
                Log.e(TAG, "Fail to get selected clock. Skip logging selected clock.", e)
                null
            }
        val selectedClockSize =
            try {
                withTimeoutOrNull(TIMEOUT_MILLIS) { selectedClockSize.first() }
                withTimeoutOrNull(TIMEOUT) { selectedClockSize.first() }
            } catch (e: Exception) {
                Log.e(TAG, "Fail to get selected clock size. Skip logging selected clock size.", e)
                null
@@ -490,6 +492,6 @@ constructor(

    companion object {
        private const val TAG = "ThemesUserEventLoggerImpl"
        private const val TIMEOUT_MILLIS = 5000L
        val TIMEOUT = 5000.milliseconds
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -42,4 +42,6 @@ interface IconStyleRepository {
     * @return True if the icon style was set successfully and data was updated, false otherwise.
     */
    suspend fun setIconStyle(iconStyle: IconStyle): Boolean

    suspend fun getIconStyleForLogging(): Int
}
Loading