diff options
| author | 2024-03-08 15:35:41 -0500 | |
|---|---|---|
| committer | 2024-03-14 13:54:35 +0000 | |
| commit | 76c0e7946a2ed4bd8956da72c18afd0cae972a8d (patch) | |
| tree | 685eb2f935b2df10dcb5b72c562342e135bc4a30 | |
| parent | 139426f7e53c5efecbe992c06656a9f1ed790d34 (diff) | |
Move isPanelExpanded to PanelExpansionInteractor
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Test: Updated and ran affected test
Bug: 303267342
Change-Id: I715c988a7d36cc91b73a70fb75b9c16601957993
9 files changed, 46 insertions, 42 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index da49201db808..c6716e44899f 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -54,7 +54,7 @@ import com.android.systemui.recents.Recents; import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; -import com.android.systemui.shade.ShadeViewController; +import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.StatusBarWindowCallback; @@ -190,7 +190,7 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con private final NotificationShadeWindowController mNotificationShadeController; private final KeyguardStateController mKeyguardStateController; private final ShadeController mShadeController; - private final Lazy<ShadeViewController> mShadeViewController; + private final Lazy<PanelExpansionInteractor> mPanelExpansionInteractor; private final StatusBarWindowCallback mNotificationShadeCallback; private boolean mDismissNotificationShadeActionRegistered; @@ -200,14 +200,14 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con NotificationShadeWindowController notificationShadeController, KeyguardStateController keyguardStateController, ShadeController shadeController, - Lazy<ShadeViewController> shadeViewController, + Lazy<PanelExpansionInteractor> panelExpansionInteractor, Optional<Recents> recentsOptional, DisplayTracker displayTracker) { mContext = context; mUserTracker = userTracker; mKeyguardStateController = keyguardStateController; mShadeController = shadeController; - mShadeViewController = shadeViewController; + mPanelExpansionInteractor = panelExpansionInteractor; mRecentsOptional = recentsOptional; mDisplayTracker = displayTracker; mReceiver = new SystemActionsBroadcastReceiver(); @@ -330,7 +330,7 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con private void registerOrUnregisterDismissNotificationShadeAction() { Assert.isMainThread(); - if (mShadeViewController.get().isPanelExpanded() + if (mPanelExpansionInteractor.get().isPanelExpanded() && !mKeyguardStateController.isShowing()) { if (!mDismissNotificationShadeActionRegistered) { mA11yManager.registerSystemAction( diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt index 8197b660c2fc..db06c6b25500 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt @@ -31,12 +31,6 @@ import java.util.function.Consumer * @see NotificationPanelViewController */ interface ShadeViewController { - /** - * Returns whether the shade height is greater than zero or the shade is expecting a synthesized - * down event. - */ - val isPanelExpanded: Boolean - /** Returns whether the shade is tracking touches for expand/collapse of the shade or QS. */ val isTracking: Boolean diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractor.kt index 79ffe06f7923..60cb06142a4f 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractor.kt @@ -43,6 +43,12 @@ interface PanelExpansionInteractor { @Deprecated("Use SceneInteractor.currentScene instead.") val legacyPanelExpansion: Flow<Float> /** + * Returns whether the shade height is greater than zero or the shade is expecting a synthesized + * down event. + */ + @Deprecated("Use ShadeInteractor.isAnyExpanded instead.") val isPanelExpanded: Boolean + + /** * This method should not be used anymore, you should probably use [.isShadeFullyOpen] instead. * It was overused as indicating if shade is open or we're on keyguard/AOD. Moving forward we * should be explicit about the what state we're checking. diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImpl.kt index 3ad2b5607b9b..387767795127 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/PanelExpansionInteractorImpl.kt @@ -111,4 +111,6 @@ constructor( private fun SceneKey.isExpandable(): Boolean { return this == Scenes.Shade || this == Scenes.QuickSettings } + + override val isPanelExpanded = shadeInteractor.isAnyExpanded.value } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java index 1faca0081155..1906b7c6bb01 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java @@ -59,7 +59,6 @@ import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor; import com.android.systemui.statusbar.CommandQueue; -import com.android.systemui.statusbar.disableflags.DisableFlagsLogger; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.HeadsUpManager; @@ -97,7 +96,6 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba private final StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager; private final PowerManager mPowerManager; private final Optional<Vibrator> mVibratorOptional; - private final DisableFlagsLogger mDisableFlagsLogger; private final int mDisplayId; private final UserTracker mUserTracker; private final boolean mVibrateOnOpening; @@ -137,7 +135,6 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager, PowerManager powerManager, Optional<Vibrator> vibratorOptional, - DisableFlagsLogger disableFlagsLogger, @DisplayId int displayId, Lazy<CameraLauncher> cameraLauncherLazy, UserTracker userTracker, @@ -165,7 +162,6 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba mStatusBarHideIconsForBouncerManager = statusBarHideIconsForBouncerManager; mPowerManager = powerManager; mVibratorOptional = vibratorOptional; - mDisableFlagsLogger = disableFlagsLogger; mDisplayId = displayId; mCameraLauncherLazy = cameraLauncherLazy; mUserTracker = userTracker; @@ -489,7 +485,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba @Override public void togglePanel() { - if (mShadeViewController.isPanelExpanded()) { + if (mPanelExpansionInteractor.isPanelExpanded()) { mShadeController.animateCollapseShade(); } else { mShadeController.animateExpandShade(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt index 88374d61d240..67d2299a9a3d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt @@ -12,16 +12,19 @@ import android.view.Display import android.view.Surface import android.view.View import android.view.WindowManager.fixScale +import com.android.app.animation.Interpolators +import com.android.app.tracing.namedRunnable import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD import com.android.systemui.DejankUtils -import com.android.app.animation.Interpolators +import com.android.systemui.Flags.lightRevealMigration import com.android.systemui.Flags.migrateClocksToBlueprint import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.shade.ShadeViewController +import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor import com.android.systemui.statusbar.CircleReveal import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.NotificationShadeWindowController @@ -32,9 +35,8 @@ import com.android.systemui.statusbar.notification.PropertyAnimator import com.android.systemui.statusbar.notification.stack.AnimationProperties import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.policy.KeyguardStateController -import com.android.systemui.Flags.lightRevealMigration -import com.android.app.tracing.namedRunnable import com.android.systemui.util.settings.GlobalSettings +import dagger.Lazy import javax.inject.Inject /** @@ -60,14 +62,15 @@ class UnlockedScreenOffAnimationController @Inject constructor( private val context: Context, private val wakefulnessLifecycle: WakefulnessLifecycle, private val statusBarStateControllerImpl: StatusBarStateControllerImpl, - private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>, + private val keyguardViewMediatorLazy: Lazy<KeyguardViewMediator>, private val keyguardStateController: KeyguardStateController, - private val dozeParameters: dagger.Lazy<DozeParameters>, + private val dozeParameters: Lazy<DozeParameters>, private val globalSettings: GlobalSettings, - private val notifShadeWindowControllerLazy: dagger.Lazy<NotificationShadeWindowController>, + private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>, private val interactionJankMonitor: InteractionJankMonitor, private val powerManager: PowerManager, - private val handler: Handler = Handler() + private val panelExpansionInteractorLazy: Lazy<PanelExpansionInteractor>, + private val handler: Handler = Handler(), ) : WakefulnessLifecycle.Observer, ScreenOffAnimation { private lateinit var centralSurfaces: CentralSurfaces private lateinit var shadeViewController: ShadeViewController @@ -346,7 +349,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( // already expanded and showing notifications/QS, the animation looks really messy. For now, // disable it if the notification panel is expanded. if ((!this::centralSurfaces.isInitialized || - shadeViewController.isPanelExpanded) && + panelExpansionInteractorLazy.get().isPanelExpanded) && // Status bar might be expanded because we have started // playing the animation already !isAnimationPlaying() diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java index b478d5cc9d50..c67429492180 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java @@ -17,6 +17,7 @@ package com.android.systemui.accessibility; import static com.google.common.truth.Truth.assertThat; + import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doAnswer; @@ -38,7 +39,7 @@ import com.android.systemui.recents.Recents; import com.android.systemui.settings.FakeDisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; -import com.android.systemui.shade.ShadeViewController; +import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -65,7 +66,7 @@ public class SystemActionsTest extends SysuiTestCase { @Mock private ShadeController mShadeController; @Mock - private ShadeViewController mShadeViewController; + private PanelExpansionInteractor mPanelExpansionInteractor; @Mock private Optional<Recents> mRecentsOptional; @Mock @@ -87,7 +88,7 @@ public class SystemActionsTest extends SysuiTestCase { mNotificationShadeController, mKeyguardStateController, mShadeController, - () -> mShadeViewController, + () -> mPanelExpansionInteractor, mRecentsOptional, mDisplayTracker); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java index dcbb93aa496b..d5c40538586e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java @@ -49,9 +49,8 @@ import com.android.systemui.shade.CameraLauncher; import com.android.systemui.shade.QuickSettingsController; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeViewController; -import com.android.systemui.shade.domain.interactor.PanelExpansionInteractorImpl; +import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor; import com.android.systemui.statusbar.CommandQueue; -import com.android.systemui.statusbar.disableflags.DisableFlagsLogger; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.HeadsUpManager; @@ -79,7 +78,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { @Mock private CommandQueue mCommandQueue; @Mock private QuickSettingsController mQuickSettingsController; @Mock private ShadeViewController mShadeViewController; - @Mock private PanelExpansionInteractorImpl mPanelExpansionInteractor; + @Mock private PanelExpansionInteractor mPanelExpansionInteractor; @Mock private RemoteInputQuickSettingsDisabler mRemoteInputQuickSettingsDisabler; private final MetricsLogger mMetricsLogger = new FakeMetricsLogger(); @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor; @@ -129,7 +128,6 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { mStatusBarHideIconsForBouncerManager, mPowerManager, Optional.of(mVibrator), - new DisableFlagsLogger(), DEFAULT_DISPLAY, mCameraLauncherLazy, mUserTracker, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt index 57a89b29b77c..de1891355f29 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt @@ -27,6 +27,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.shade.ShadeViewController +import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.StatusBarStateControllerImpl @@ -67,6 +68,8 @@ class UnlockedScreenOffAnimationControllerTest : SysuiTestCase() { @Mock private lateinit var shadeViewController: ShadeViewController @Mock + private lateinit var panelExpansionInteractor: PanelExpansionInteractor + @Mock private lateinit var notifShadeWindowController: NotificationShadeWindowController @Mock private lateinit var lightRevealScrim: LightRevealScrim @@ -87,17 +90,18 @@ class UnlockedScreenOffAnimationControllerTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) controller = UnlockedScreenOffAnimationController( - context, - wakefulnessLifecycle, - statusBarStateController, - { keyguardViewMediator }, - keyguardStateController, - { dozeParameters }, - globalSettings, - { notifShadeWindowController }, - interactionJankMonitor, - powerManager, - handler = handler + context, + wakefulnessLifecycle, + statusBarStateController, + { keyguardViewMediator }, + keyguardStateController, + { dozeParameters }, + globalSettings, + { notifShadeWindowController }, + interactionJankMonitor, + powerManager, + { panelExpansionInteractor }, + handler, ) controller.initialize(centralSurfaces, shadeViewController, lightRevealScrim) } |