diff options
| author | 2023-09-21 18:53:25 +0000 | |
|---|---|---|
| committer | 2023-09-22 14:09:56 +0000 | |
| commit | aabd499a8719ea19238c048dab2df3f9590fd1d9 (patch) | |
| tree | ef6936f062218c790da7309ac39cd2622ee024fe | |
| parent | 0b49f269323f46ff5b220465eb51152a58a3ff81 (diff) | |
Attempt to reload providers when selected provider is available but unloaded
A more minor race may still be present, but this fix should
reduce incidence of the issue and be safer than reorganizing
the multithreading in verifyLoadedProviders. A subsequent
change will address that more directly.
Bug: 300671811
Test: Manually forced and checked race condition
Change-Id: I5258dddd50b9c89f28340254c53bc1839351e28e
| -rw-r--r-- | packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt | 9 | ||||
| -rw-r--r-- | packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt index fd4a723352e4..ecc0dbad70d0 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ClockRegistry.kt @@ -148,7 +148,7 @@ open class ClockRegistry( override fun onPluginAttached( manager: PluginLifecycleManager<ClockProviderPlugin> ): Boolean { - manager.isDebug = true + manager.isDebug = !keepAllLoaded if (keepAllLoaded) { // Always load new plugins if requested @@ -511,6 +511,12 @@ open class ClockRegistry( fun verifyLoadedProviders() { val shouldSchedule = isVerifying.compareAndSet(false, true) if (!shouldSchedule) { + logger.tryLog( + TAG, + LogLevel.VERBOSE, + {}, + { "verifyLoadedProviders: shouldSchedule=false" } + ) return } @@ -670,6 +676,7 @@ open class ClockRegistry( { str1 = clockId }, { "Clock $str1 not loaded; using default" } ) + verifyLoadedProviders() } else { logger.tryLog( TAG, diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java b/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java index 7719e95b9416..f9f2c63c0469 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstance.java @@ -73,7 +73,7 @@ public class PluginInstance<T extends Plugin> implements PluginLifecycleManager mComponentName = componentName; mPluginFactory = pluginFactory; mPlugin = plugin; - mTag = TAG + mComponentName.toShortString() + mTag = TAG + "[" + mComponentName.getShortClassName() + "]" + '@' + Integer.toHexString(hashCode()); if (mPlugin != null) { |