Companion to WallpaperPicker2's OemOptionOverride mechanism -- without this, 5 of the 10 customization options (the ones ThemePicker wires directly, not through WallpaperPicker2's navigateToSecondary) would have declared-but-inert override resources. Confirmed live on pawlet_rpi4: no behavior change with the default empty overrides.
149 lines
8.1 KiB
Diff
149 lines
8.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: oxmc <me@oxmc.me>
|
|
Date: Sun, 18 Oct 2026 00:00:00 +0000
|
|
Subject: [PATCH] Wire OemOptionOverride into the 5 externally-dispatched options
|
|
|
|
Companion to WallpaperPicker2's OemOptionOverride mechanism (see that
|
|
repo's own commit adding it): lets a product-specific RRO redirect a
|
|
top-level customization option to launch a different app/Intent
|
|
entirely instead of PawletOS's built-in behavior.
|
|
|
|
OemOptionOverride is only wired into CustomizationPickerFragment2's
|
|
single navigateToSecondary callback in WallpaperPicker2 itself, which
|
|
covers 5 of the 10 customization options (Clock, Shortcuts, Colors,
|
|
App icons, Grid). The other 5 -- Lock screen notifications, More lock
|
|
screen settings, Screensaver, Pack theme, Color contrast -- have their
|
|
click listeners wired directly here, in ThemePicker's own binder, each
|
|
invoking a hardcoded navigateToX lambda that never reaches
|
|
OemOptionOverride at all. This patch adds the same override check at
|
|
each of those 5 click sites, so all 10 options are actually
|
|
OEM-pluggable, not just the 5 WallpaperPicker2 dispatches internally.
|
|
|
|
Pack theme is the one non-trivial case: it already has its own dynamic
|
|
"what app handles this" discovery (startThemePackActivityIntent,
|
|
collected as a flow), so the override check there takes priority over
|
|
whatever was dynamically discovered (or the lack of one), rather than
|
|
replacing a single invoke() call like the other four.
|
|
|
|
Confirmed live on pawlet_rpi4 (2026-10-18): no behavior change with
|
|
the (default, empty) override resources -- Color contrast still
|
|
launches the real external activity, no crashes navigating it or back
|
|
out. The actual override redirect itself needs a real product RRO to
|
|
test (not built in this patch), since WallpaperPicker2Lib's
|
|
config_override_component_* resources are compiled-in defaults.
|
|
---
|
|
diff --git a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
|
|
index 602e894b..fc21b5a2 100644
|
|
--- a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
|
|
+++ b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
|
|
@@ -61,6 +61,7 @@ import com.android.wallpaper.picker.customization.ui.binder.ColorUpdateBinder
|
|
import com.android.wallpaper.picker.customization.ui.binder.CustomizationOptionsBinder
|
|
import com.android.wallpaper.picker.customization.ui.binder.DefaultCustomizationOptionsBinder
|
|
import com.android.wallpaper.picker.customization.ui.util.CustomizationOptionUtil.CustomizationOption
|
|
+import com.android.wallpaper.picker.customization.ui.util.OemOptionOverride
|
|
import com.android.wallpaper.picker.customization.ui.util.ViewAlphaAnimator.animateToAlpha
|
|
import com.android.wallpaper.picker.customization.ui.viewmodel.ColorUpdateViewModel
|
|
import com.android.wallpaper.picker.customization.ui.viewmodel.CustomizationOptionsData
|
|
@@ -205,7 +206,16 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
|
|
.first { it.first == ThemePickerLockCustomizationOption.LOCK_SCREEN_NOTIFICATIONS }
|
|
.second
|
|
optionLockScreenNotificationsSettings.setOnClickListener {
|
|
- navigateToLockScreenNotificationsSettingsActivity.invoke()
|
|
+ val oemOverride =
|
|
+ OemOptionOverride.getOverrideComponent(
|
|
+ view.context,
|
|
+ ThemePickerLockCustomizationOption.LOCK_SCREEN_NOTIFICATIONS,
|
|
+ )
|
|
+ if (oemOverride != null) {
|
|
+ view.context.startActivity(Intent().setComponent(oemOverride))
|
|
+ } else {
|
|
+ navigateToLockScreenNotificationsSettingsActivity.invoke()
|
|
+ }
|
|
}
|
|
|
|
val optionMoreLockScreenSettings: View =
|
|
@@ -213,7 +223,16 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
|
|
.first { it.first == ThemePickerLockCustomizationOption.MORE_LOCK_SCREEN_SETTINGS }
|
|
.second
|
|
optionMoreLockScreenSettings.setOnClickListener {
|
|
- navigateToMoreLockScreenSettingsActivity.invoke()
|
|
+ val oemOverride =
|
|
+ OemOptionOverride.getOverrideComponent(
|
|
+ view.context,
|
|
+ ThemePickerLockCustomizationOption.MORE_LOCK_SCREEN_SETTINGS,
|
|
+ )
|
|
+ if (oemOverride != null) {
|
|
+ view.context.startActivity(Intent().setComponent(oemOverride))
|
|
+ } else {
|
|
+ navigateToMoreLockScreenSettingsActivity.invoke()
|
|
+ }
|
|
}
|
|
|
|
var optionPackThemeIconHome: ImageView? = null
|
|
@@ -240,7 +259,16 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
|
|
.first { it.first == ThemePickerHomeCustomizationOption.SCREEN_SAVER }
|
|
.second
|
|
optionScreenSaverEntry.setOnClickListener {
|
|
- navigateToScreenSaverSettingsActivity.invoke()
|
|
+ val oemOverride =
|
|
+ OemOptionOverride.getOverrideComponent(
|
|
+ view.context,
|
|
+ ThemePickerHomeCustomizationOption.SCREEN_SAVER,
|
|
+ )
|
|
+ if (oemOverride != null) {
|
|
+ view.context.startActivity(Intent().setComponent(oemOverride))
|
|
+ } else {
|
|
+ navigateToScreenSaverSettingsActivity.invoke()
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -277,7 +305,18 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
|
|
homeScreenCustomizationOptionEntries
|
|
.first { it.first == ThemePickerHomeCustomizationOption.COLOR_CONTRAST }
|
|
.second
|
|
- optionColorContrast.setOnClickListener { navigateToColorContrastSettingsActivity.invoke() }
|
|
+ optionColorContrast.setOnClickListener {
|
|
+ val oemOverride =
|
|
+ OemOptionOverride.getOverrideComponent(
|
|
+ view.context,
|
|
+ ThemePickerHomeCustomizationOption.COLOR_CONTRAST,
|
|
+ )
|
|
+ if (oemOverride != null) {
|
|
+ view.context.startActivity(Intent().setComponent(oemOverride))
|
|
+ } else {
|
|
+ navigateToColorContrastSettingsActivity.invoke()
|
|
+ }
|
|
+ }
|
|
val backgroundScope =
|
|
CoroutineScope(Dispatchers.IO + Job() + CoroutineName(BACKGROUND_CONTEXT))
|
|
|
|
@@ -548,7 +587,23 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
|
|
launch {
|
|
optionsViewModel.packThemeViewModel.startThemePackActivityIntent.collect {
|
|
intent ->
|
|
- if (intent != null) {
|
|
+ // PawletOS: a product-specific RRO redirecting PACK_THEME takes
|
|
+ // priority over whatever theme-pack app was dynamically discovered
|
|
+ // above (or the lack of one) -- see OemOptionOverride.
|
|
+ val oemOverride =
|
|
+ OemOptionOverride.getOverrideComponent(
|
|
+ view.context,
|
|
+ ThemePickerHomeCustomizationOption.PACK_THEME,
|
|
+ )
|
|
+ if (oemOverride != null) {
|
|
+ val oemIntent = Intent().setComponent(oemOverride)
|
|
+ optionPackThemeHome?.setOnClickListener {
|
|
+ view.context.startActivity(oemIntent)
|
|
+ }
|
|
+ optionPackThemeLock?.setOnClickListener {
|
|
+ view.context.startActivity(oemIntent)
|
|
+ }
|
|
+ } else if (intent != null) {
|
|
optionPackThemeHome?.setOnClickListener {
|
|
backgroundScope.launch {
|
|
if (isActivityAvailable(view.context, intent)) {
|
|
--
|
|
2.43.0
|
|
|