1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.customization.module.logging 17 18 import android.stats.style.StyleEnums 19 import com.android.customization.model.grid.GridOption 20 import com.android.customization.module.logging.ThemesUserEventLogger.ClockSize 21 import com.android.customization.module.logging.ThemesUserEventLogger.ColorSource 22 import com.android.wallpaper.module.logging.TestUserEventLogger 23 import javax.inject.Inject 24 import javax.inject.Singleton 25 26 /** Test implementation of [ThemesUserEventLogger]. */ 27 @Singleton 28 class TestThemesUserEventLogger @Inject constructor() : 29 TestUserEventLogger(), ThemesUserEventLogger { 30 @ClockSize private var clockSize: Int = StyleEnums.CLOCK_SIZE_UNSPECIFIED 31 @ColorSource 32 var themeColorSource: Int = StyleEnums.COLOR_SOURCE_UNSPECIFIED 33 private set 34 35 var themeColorStyle: Int = -1 36 private set 37 38 var themeSeedColor: Int = -1 39 private set 40 41 var shortcutLogs: List<Pair<String, String>> = emptyList() 42 43 var useDarkTheme: Boolean = false 44 private set 45 46 var useThemedIcon: Boolean = false 47 private set 48 logThemeColorAppliednull49 override fun logThemeColorApplied(@ColorSource source: Int, style: Int, seedColor: Int) { 50 this.themeColorSource = source 51 this.themeColorStyle = style 52 this.themeSeedColor = seedColor 53 } 54 logGridAppliednull55 override fun logGridApplied(grid: GridOption) {} 56 logClockAppliednull57 override fun logClockApplied(clockId: String) {} 58 logClockColorAppliednull59 override fun logClockColorApplied(seedColor: Int) {} 60 logClockSizeAppliednull61 override fun logClockSizeApplied(@ClockSize clockSize: Int) { 62 this.clockSize = clockSize 63 } 64 logThemedIconAppliednull65 override fun logThemedIconApplied(useThemeIcon: Boolean) { 66 this.useThemedIcon = useThemeIcon 67 } 68 logLockScreenNotificationAppliednull69 override fun logLockScreenNotificationApplied(showLockScreenNotifications: Boolean) {} 70 logShortcutAppliednull71 override fun logShortcutApplied(shortcut: String, shortcutSlotId: String) { 72 shortcutLogs = shortcutLogs.toMutableList().apply { add(shortcut to shortcutSlotId) } 73 } 74 logDarkThemeAppliednull75 override fun logDarkThemeApplied(useDarkTheme: Boolean) { 76 this.useDarkTheme = useDarkTheme 77 } 78 79 @ClockSize getLoggedClockSizenull80 fun getLoggedClockSize(): Int { 81 return clockSize 82 } 83 } 84