Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockDesign.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,7 @@ data class ClockDesign( val thumbnail: String? = null, val thumbnail: String? = null, val large: ClockFace? = null, val large: ClockFace? = null, val small: ClockFace? = null, val small: ClockFace? = null, val colorPalette: MonetStyle? = null, @MonetStyle.Type val colorPalette: Int? = null, ) ) /** Describes a clock using layers */ /** Describes a clock using layers */ Loading packages/SystemUI/multivalentTests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -434,13 +434,13 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { @Test @Test public void onSettingChanged_honorThemeStyle() { public void onSettingChanged_honorThemeStyle() { when(mDeviceProvisionedController.isUserSetup(anyInt())).thenReturn(true); when(mDeviceProvisionedController.isUserSetup(anyInt())).thenReturn(true); List<Style> validStyles = Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, Style.TONAL_SPOT, @Style.Type List<Integer> validStyles = Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT); Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT); for (Style style : validStyles) { for (@Style.Type int style : validStyles) { reset(mSecureSettings); reset(mSecureSettings); String jsonString = "{\"android.theme.customization.system_palette\":\"A16B00\"," String jsonString = "{\"android.theme.customization.system_palette\":\"A16B00\"," + "\"android.theme.customization.theme_style\":\"" + style.name() + "\"}"; + "\"android.theme.customization.theme_style\":\"" + Style.name(style) + "\"}"; when(mSecureSettings.getStringForUser( when(mSecureSettings.getStringForUser( eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), anyInt())) eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), anyInt())) Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -188,7 +188,8 @@ constructor( private val shortcutsBindings = mutableSetOf<KeyguardQuickAffordanceViewBinder.Binding>() private val shortcutsBindings = mutableSetOf<KeyguardQuickAffordanceViewBinder.Binding>() private val coroutineScope: CoroutineScope private val coroutineScope: CoroutineScope private var themeStyle: Style? = null @Style.Type private var themeStyle: Int? = null init { init { coroutineScope = coroutineScope = Loading Loading @@ -660,6 +661,7 @@ constructor( // Seed color null means users do not override any color on the clock. The default // Seed color null means users do not override any color on the clock. The default // color will need to use wallpaper's extracted color and consider if the // color will need to use wallpaper's extracted color and consider if the // wallpaper's color is dark or light. // wallpaper's color is dark or light. @Style.Type val style = themeStyle ?: fetchThemeStyleFromSetting().also { themeStyle = it } val style = themeStyle ?: fetchThemeStyleFromSetting().also { themeStyle = it } val wallpaperColorScheme = ColorScheme(colors, false, style) val wallpaperColorScheme = ColorScheme(colors, false, style) val lightClockColor = wallpaperColorScheme.accent1.s100 val lightClockColor = wallpaperColorScheme.accent1.s100 Loading Loading @@ -712,7 +714,8 @@ constructor( } } } } private suspend fun fetchThemeStyleFromSetting(): Style { @Style.Type private suspend fun fetchThemeStyleFromSetting(): Int { val overlayPackageJson = val overlayPackageJson = withContext(backgroundDispatcher) { withContext(backgroundDispatcher) { secureSettings.getString(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES) secureSettings.getString(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES) Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/util/MediaArtworkHelper.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,11 @@ object MediaArtworkHelper { } } /** Returns [ColorScheme] of media app given its [icon]. */ /** Returns [ColorScheme] of media app given its [icon]. */ fun getColorScheme(icon: Drawable, tag: String, style: Style = Style.TONAL_SPOT): ColorScheme? { fun getColorScheme( icon: Drawable, tag: String, @Style.Type style: Int = Style.TONAL_SPOT, ): ColorScheme? { return try { return try { ColorScheme(WallpaperColors.fromDrawable(icon), true, style) ColorScheme(WallpaperColors.fromDrawable(icon), true, style) } catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) { Loading packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -149,7 +149,8 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { private double mContrast = 0.0; private double mContrast = 0.0; // Theme variant: Vibrant, Tonal, Expressive, etc // Theme variant: Vibrant, Tonal, Expressive, etc @VisibleForTesting @VisibleForTesting protected Style mThemeStyle = Style.TONAL_SPOT; @Style.Type protected int mThemeStyle = Style.TONAL_SPOT; // Accent colors overlay // Accent colors overlay private FabricatedOverlay mSecondaryOverlay; private FabricatedOverlay mSecondaryOverlay; // Neutral system colors overlay // Neutral system colors overlay Loading Loading @@ -826,15 +827,16 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { } } private Style fetchThemeStyleFromSetting() { @Style.Type private int fetchThemeStyleFromSetting() { // Allow-list of Style objects that can be created from a setting string, i.e. can be // Allow-list of Style objects that can be created from a setting string, i.e. can be // used as a system-wide theme. // used as a system-wide theme. // - Content intentionally excluded, intended for media player, not system-wide // - Content intentionally excluded, intended for media player, not system-wide List<Style> validStyles = new ArrayList<>(Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, @Style.Type List<Integer> validStyles = new ArrayList<>(Arrays.asList(Style.EXPRESSIVE, Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT, Style.SPRITZ, Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT, Style.MONOCHROMATIC)); Style.MONOCHROMATIC)); Style style = mThemeStyle; @Style.Type int style = mThemeStyle; final String overlayPackageJson = mSecureSettings.getStringForUser( final String overlayPackageJson = mSecureSettings.getStringForUser( Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, mUserTracker.getUserId()); mUserTracker.getUserId()); Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockDesign.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,7 @@ data class ClockDesign( val thumbnail: String? = null, val thumbnail: String? = null, val large: ClockFace? = null, val large: ClockFace? = null, val small: ClockFace? = null, val small: ClockFace? = null, val colorPalette: MonetStyle? = null, @MonetStyle.Type val colorPalette: Int? = null, ) ) /** Describes a clock using layers */ /** Describes a clock using layers */ Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -434,13 +434,13 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { @Test @Test public void onSettingChanged_honorThemeStyle() { public void onSettingChanged_honorThemeStyle() { when(mDeviceProvisionedController.isUserSetup(anyInt())).thenReturn(true); when(mDeviceProvisionedController.isUserSetup(anyInt())).thenReturn(true); List<Style> validStyles = Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, Style.TONAL_SPOT, @Style.Type List<Integer> validStyles = Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT); Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT); for (Style style : validStyles) { for (@Style.Type int style : validStyles) { reset(mSecureSettings); reset(mSecureSettings); String jsonString = "{\"android.theme.customization.system_palette\":\"A16B00\"," String jsonString = "{\"android.theme.customization.system_palette\":\"A16B00\"," + "\"android.theme.customization.theme_style\":\"" + style.name() + "\"}"; + "\"android.theme.customization.theme_style\":\"" + Style.name(style) + "\"}"; when(mSecureSettings.getStringForUser( when(mSecureSettings.getStringForUser( eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), anyInt())) eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), anyInt())) Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -188,7 +188,8 @@ constructor( private val shortcutsBindings = mutableSetOf<KeyguardQuickAffordanceViewBinder.Binding>() private val shortcutsBindings = mutableSetOf<KeyguardQuickAffordanceViewBinder.Binding>() private val coroutineScope: CoroutineScope private val coroutineScope: CoroutineScope private var themeStyle: Style? = null @Style.Type private var themeStyle: Int? = null init { init { coroutineScope = coroutineScope = Loading Loading @@ -660,6 +661,7 @@ constructor( // Seed color null means users do not override any color on the clock. The default // Seed color null means users do not override any color on the clock. The default // color will need to use wallpaper's extracted color and consider if the // color will need to use wallpaper's extracted color and consider if the // wallpaper's color is dark or light. // wallpaper's color is dark or light. @Style.Type val style = themeStyle ?: fetchThemeStyleFromSetting().also { themeStyle = it } val style = themeStyle ?: fetchThemeStyleFromSetting().also { themeStyle = it } val wallpaperColorScheme = ColorScheme(colors, false, style) val wallpaperColorScheme = ColorScheme(colors, false, style) val lightClockColor = wallpaperColorScheme.accent1.s100 val lightClockColor = wallpaperColorScheme.accent1.s100 Loading Loading @@ -712,7 +714,8 @@ constructor( } } } } private suspend fun fetchThemeStyleFromSetting(): Style { @Style.Type private suspend fun fetchThemeStyleFromSetting(): Int { val overlayPackageJson = val overlayPackageJson = withContext(backgroundDispatcher) { withContext(backgroundDispatcher) { secureSettings.getString(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES) secureSettings.getString(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES) Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/util/MediaArtworkHelper.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,11 @@ object MediaArtworkHelper { } } /** Returns [ColorScheme] of media app given its [icon]. */ /** Returns [ColorScheme] of media app given its [icon]. */ fun getColorScheme(icon: Drawable, tag: String, style: Style = Style.TONAL_SPOT): ColorScheme? { fun getColorScheme( icon: Drawable, tag: String, @Style.Type style: Int = Style.TONAL_SPOT, ): ColorScheme? { return try { return try { ColorScheme(WallpaperColors.fromDrawable(icon), true, style) ColorScheme(WallpaperColors.fromDrawable(icon), true, style) } catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) { Loading
packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -149,7 +149,8 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { private double mContrast = 0.0; private double mContrast = 0.0; // Theme variant: Vibrant, Tonal, Expressive, etc // Theme variant: Vibrant, Tonal, Expressive, etc @VisibleForTesting @VisibleForTesting protected Style mThemeStyle = Style.TONAL_SPOT; @Style.Type protected int mThemeStyle = Style.TONAL_SPOT; // Accent colors overlay // Accent colors overlay private FabricatedOverlay mSecondaryOverlay; private FabricatedOverlay mSecondaryOverlay; // Neutral system colors overlay // Neutral system colors overlay Loading Loading @@ -826,15 +827,16 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { } } private Style fetchThemeStyleFromSetting() { @Style.Type private int fetchThemeStyleFromSetting() { // Allow-list of Style objects that can be created from a setting string, i.e. can be // Allow-list of Style objects that can be created from a setting string, i.e. can be // used as a system-wide theme. // used as a system-wide theme. // - Content intentionally excluded, intended for media player, not system-wide // - Content intentionally excluded, intended for media player, not system-wide List<Style> validStyles = new ArrayList<>(Arrays.asList(Style.EXPRESSIVE, Style.SPRITZ, @Style.Type List<Integer> validStyles = new ArrayList<>(Arrays.asList(Style.EXPRESSIVE, Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT, Style.SPRITZ, Style.TONAL_SPOT, Style.FRUIT_SALAD, Style.RAINBOW, Style.VIBRANT, Style.MONOCHROMATIC)); Style.MONOCHROMATIC)); Style style = mThemeStyle; @Style.Type int style = mThemeStyle; final String overlayPackageJson = mSecureSettings.getStringForUser( final String overlayPackageJson = mSecureSettings.getStringForUser( Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, mUserTracker.getUserId()); mUserTracker.getUserId()); Loading