From 7d4384eb3f3dff342afcbd86da18edf8be5c7ab9 Mon Sep 17 00:00:00 2001 From: "Cassie(Yitong) Wang" Date: Thu, 12 Jan 2023 18:10:52 +0000 Subject: [PATCH] Make class open for inherit As discussed with Cassie, I'm cherry picking this CL in master to tm-qpr-dev to mitigate a merge conflicts in a CL of mine and also to prevent the two branches from diverging. Bug: 261483935 Test: Manual Change-Id: Ia29ad9684e5128c715b6e7948b7edec64d95f575 (cherry picked from commit f944cef6134109db6abc875a6ec9c0b4fce20018) Merged-In: Ia29ad9684e5128c715b6e7948b7edec64d95f575 --- .../events/SystemStatusAnimationScheduler.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt index 1e7fc93cb9fac..197cf5608cf58 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt @@ -54,7 +54,7 @@ import javax.inject.Inject * their respective views based on the progress of the animator. Interpolation differences TBD */ @SysUISingleton -class SystemStatusAnimationScheduler @Inject constructor( +open class SystemStatusAnimationScheduler @Inject constructor( private val coordinator: SystemEventCoordinator, private val chipAnimationController: SystemEventChipAnimationController, private val statusBarWindowController: StatusBarWindowController, @@ -66,7 +66,7 @@ class SystemStatusAnimationScheduler @Inject constructor( companion object { private const val PROPERTY_ENABLE_IMMERSIVE_INDICATOR = "enable_immersive_indicator" } - private fun isImmersiveIndicatorEnabled(): Boolean { + public fun isImmersiveIndicatorEnabled(): Boolean { return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, PROPERTY_ENABLE_IMMERSIVE_INDICATOR, true) } @@ -76,18 +76,22 @@ class SystemStatusAnimationScheduler @Inject constructor( /** True if the persistent privacy dot should be active */ var hasPersistentDot = false - private set + protected set private var scheduledEvent: StatusEvent? = null private var cancelExecutionRunnable: Runnable? = null private val listeners = mutableSetOf() + fun getListeners(): MutableSet { + return listeners + } + init { coordinator.attachScheduler(this) dumpManager.registerDumpable(TAG, this) } - fun onStatusEvent(event: StatusEvent) { + open fun onStatusEvent(event: StatusEvent) { // Ignore any updates until the system is up and running if (isTooEarly() || !isImmersiveIndicatorEnabled()) { return @@ -139,7 +143,7 @@ class SystemStatusAnimationScheduler @Inject constructor( } } - private fun isTooEarly(): Boolean { + public fun isTooEarly(): Boolean { return systemClock.uptimeMillis() - Process.getStartUptimeMillis() < MIN_UPTIME }