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

Commit 94eafc17 authored by George Lin's avatar George Lin
Browse files

Move the logging files to the right package (1/2)

Test: Build success
Bug: 299659307
Change-Id: I27357d5fdfa0a1589a9fe411217e0e9469b863a6
parent bbb0a85b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ import com.android.customization.model.themedicon.ThemedIconSwitchProvider
import com.android.customization.model.themedicon.data.repository.ThemeIconRepository
import com.android.customization.model.themedicon.domain.interactor.ThemedIconInteractor
import com.android.customization.model.themedicon.domain.interactor.ThemedIconSnapshotRestorer
import com.android.customization.module.logging.StatsLogUserEventLogger
import com.android.customization.module.logging.ThemesUserEventLogger
import com.android.customization.module.logging.ThemesUserEventLoggerImpl
import com.android.customization.picker.clock.data.repository.ClockPickerRepositoryImpl
import com.android.customization.picker.clock.data.repository.ClockRegistryProvider
import com.android.customization.picker.clock.domain.interactor.ClockPickerInteractor
@@ -169,7 +169,7 @@ internal constructor(
    @Synchronized
    override fun getUserEventLogger(context: Context): ThemesUserEventLogger {
        return userEventLogger as? ThemesUserEventLogger
            ?: StatsLogUserEventLogger(getPreferences(context.applicationContext)).also {
            ?: ThemesUserEventLoggerImpl(getPreferences(context.applicationContext)).also {
                userEventLogger = it
            }
    }
+20 −36
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.customization.module
package com.android.customization.module.logging

import com.android.systemui.shared.system.SysUiStatsLog
import com.android.systemui.shared.system.SysUiStatsLog.STYLE_UICHANGED__CLOCK_SIZE__CLOCK_SIZE_UNSPECIFIED
@@ -38,9 +38,11 @@ class SysUiStatsLogger(val action: Int) {
    private var wallpaperCategoryHash = 0
    private var wallpaperIdHash = 0
    private var colorPreference = 0
    private var locationPreference = STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_PREFERENCE_UNSPECIFIED
    private var locationPreference =
        STYLE_UICHANGED__LOCATION_PREFERENCE__LOCATION_PREFERENCE_UNSPECIFIED
    private var datePreference = STYLE_UICHANGED__DATE_PREFERENCE__DATE_PREFERENCE_UNSPECIFIED
    private var launchedPreference = STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_PREFERENCE_UNSPECIFIED
    private var launchedPreference =
        STYLE_UICHANGED__LAUNCHED_PREFERENCE__LAUNCHED_PREFERENCE_UNSPECIFIED
    private var effectPreference = STYLE_UICHANGED__EFFECT_PREFERENCE__EFFECT_PREFERENCE_UNSPECIFIED
    private var effectIdHash = 0
    private var lockWallpaperCategoryHash = 0
@@ -52,8 +54,10 @@ class SysUiStatsLogger(val action: Int) {
    private var timeElapsedMillis = 0L
    private var effectResultCode = -1
    private var sessionId = 0
    private var setWallpaperEntryPoint = STYLE_UICHANGED__SET_WALLPAPER_ENTRY_POINT__SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED
    private var wallpaperDestination = STYLE_UICHANGED__WALLPAPER_DESTINATION__WALLPAPER_DESTINATION_UNSPECIFIED
    private var setWallpaperEntryPoint =
        STYLE_UICHANGED__SET_WALLPAPER_ENTRY_POINT__SET_WALLPAPER_ENTRY_POINT_UNSPECIFIED
    private var wallpaperDestination =
        STYLE_UICHANGED__WALLPAPER_DESTINATION__WALLPAPER_DESTINATION_UNSPECIFIED
    private var colorSource = STYLE_UICHANGED__COLOR_SOURCE__COLOR_SOURCE_UNSPECIFIED
    private var seedColor = 0
    private var clockSize = STYLE_UICHANGED__CLOCK_SIZE__CLOCK_SIZE_UNSPECIFIED
@@ -65,9 +69,7 @@ class SysUiStatsLogger(val action: Int) {
        this.colorPackageHash = colorPackageHash
    }

    fun setFontPackageHash(fontPackageHash: Int) = apply {
        this.fontPackageHash = fontPackageHash
    }
    fun setFontPackageHash(fontPackageHash: Int) = apply { this.fontPackageHash = fontPackageHash }

    fun setShapePackageHash(shapePackageHash: Int) = apply {
        this.shapePackageHash = shapePackageHash
@@ -83,13 +85,9 @@ class SysUiStatsLogger(val action: Int) {
        this.wallpaperCategoryHash = wallpaperCategoryHash
    }

    fun setWallpaperIdHash(wallpaperIdHash: Int) = apply {
        this.wallpaperIdHash = wallpaperIdHash
    }
    fun setWallpaperIdHash(wallpaperIdHash: Int) = apply { this.wallpaperIdHash = wallpaperIdHash }

    fun setColorPreference(colorPreference: Int) = apply {
        this.colorPreference = colorPreference
    }
    fun setColorPreference(colorPreference: Int) = apply { this.colorPreference = colorPreference }

    fun setLocationPreference(locationPreference: Int) = apply {
        this.locationPreference = locationPreference
@@ -135,9 +133,7 @@ class SysUiStatsLogger(val action: Int) {
        this.effectResultCode = effectResultCode
    }

    fun setSessionId(sessionId: Int) = apply {
        this.sessionId = sessionId
    }
    fun setSessionId(sessionId: Int) = apply { this.sessionId = sessionId }

    fun setSetWallpaperEntryPoint(@SetWallpaperEntryPoint setWallpaperEntryPoint: Int) = apply {
        this.setWallpaperEntryPoint = setWallpaperEntryPoint
@@ -147,29 +143,17 @@ class SysUiStatsLogger(val action: Int) {
        this.wallpaperDestination = wallpaperDestination
    }

    fun setColorSource(colorSource: Int) = apply {
        this.colorSource = colorSource
    }
    fun setColorSource(colorSource: Int) = apply { this.colorSource = colorSource }

    fun setSeedColor(seedColor: Int) = apply {
        this.seedColor = seedColor
    }
    fun setSeedColor(seedColor: Int) = apply { this.seedColor = seedColor }

    fun setClockSize(clockSize: Int) = apply {
        this.clockSize = clockSize
    }
    fun setClockSize(clockSize: Int) = apply { this.clockSize = clockSize }

    fun setToggleOn(toggleOn: Boolean) = apply {
        this.toggleOn = toggleOn
    }
    fun setToggleOn(toggleOn: Boolean) = apply { this.toggleOn = toggleOn }

    fun setShortcut(shortcut: String) = apply {
        this.shortcut = shortcut
    }
    fun setShortcut(shortcut: String) = apply { this.shortcut = shortcut }

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

    fun log() {
        SysUiStatsLog.write(
+2 −4
Original line number Diff line number Diff line
@@ -21,22 +21,20 @@ 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.SysUiStatsLogger
import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize
import com.android.systemui.shared.system.SysUiStatsLog
import com.android.wallpaper.module.WallpaperPersister.DEST_BOTH
import com.android.wallpaper.module.WallpaperPersister.DEST_HOME_SCREEN
import com.android.wallpaper.module.WallpaperPersister.DEST_LOCK_SCREEN
import com.android.wallpaper.module.WallpaperPreferences
import com.android.wallpaper.module.logging.NoOpUserEventLogger
import com.android.wallpaper.module.logging.UserEventLogger.EffectStatus
import com.android.wallpaper.module.logging.UserEventLogger.SetWallpaperEntryPoint
import com.android.wallpaper.module.logging.UserEventLogger.WallpaperDestination
import com.android.wallpaper.util.LaunchSourceUtils

/** StatsLog-backed implementation of [ThemesUserEventLogger]. */
class StatsLogUserEventLogger(private val preferences: WallpaperPreferences) :
    NoOpUserEventLogger(), ThemesUserEventLogger {
class ThemesUserEventLoggerImpl(private val preferences: WallpaperPreferences) :
    ThemesUserEventLogger {

    override fun logSnapshot() {
        SysUiStatsLogger(StyleEnums.SNAPSHOT)
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ android_library {

    defaults: ["ThemePicker_common_defaults"],
    srcs: [
        "src/com/android/customization/testing/**/*.java",
        "src/com/android/customization/testing/**/*.kt",
        "src/**/*.java",
        "src/**/*.kt",
    ],
    static_libs: [
        "WallpaperPicker2TestLib",
+2 −3
Original line number Diff line number Diff line
@@ -13,12 +13,11 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.customization.testing
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
import com.android.wallpaper.testing.TestUserEventLogger
import com.android.wallpaper.module.logging.TestUserEventLogger

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