diff options
7 files changed, 30 insertions, 82 deletions
diff --git a/packages/SystemUI/aconfig/predictive_back.aconfig b/packages/SystemUI/aconfig/predictive_back.aconfig index 05b0d3857e9b..ee918c275b7b 100644 --- a/packages/SystemUI/aconfig/predictive_back.aconfig +++ b/packages/SystemUI/aconfig/predictive_back.aconfig @@ -7,10 +7,3 @@ flag { description: "Enable Shade Animations" bug: "327732946" } - -flag { - name: "predictive_back_animate_dialogs" - namespace: "systemui" - description: "Enable Predictive Back Animation for SysUI dialogs" - bug: "327721544" -} diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/AnimationFeatureFlags.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/AnimationFeatureFlags.kt deleted file mode 100644 index 1c9dabbb0e07..000000000000 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/AnimationFeatureFlags.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.android.systemui.animation - -interface AnimationFeatureFlags { - val isPredictiveBackQsDialogAnim: Boolean - get() = false -} diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt index 907c39d842ce..c88c4ebb1a8d 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogTransitionAnimator.kt @@ -59,13 +59,8 @@ constructor( private val mainExecutor: Executor, private val callback: Callback, private val interactionJankMonitor: InteractionJankMonitor, - private val featureFlags: AnimationFeatureFlags, private val transitionAnimator: TransitionAnimator = - TransitionAnimator( - mainExecutor, - TIMINGS, - INTERPOLATORS, - ), + TransitionAnimator(mainExecutor, TIMINGS, INTERPOLATORS), private val isForTesting: Boolean = false, ) { private companion object { @@ -219,7 +214,7 @@ constructor( dialog: Dialog, view: View, cuj: DialogCuj? = null, - animateBackgroundBoundsChange: Boolean = false + animateBackgroundBoundsChange: Boolean = false, ) { val controller = Controller.fromView(view, cuj) if (controller == null) { @@ -245,7 +240,7 @@ constructor( fun show( dialog: Dialog, controller: Controller, - animateBackgroundBoundsChange: Boolean = false + animateBackgroundBoundsChange: Boolean = false, ) { if (Looper.myLooper() != Looper.getMainLooper()) { throw IllegalStateException( @@ -263,15 +258,14 @@ constructor( val controller = animatedParent?.dialogContentWithBackground?.let { Controller.fromView(it, controller.cuj) - } - ?: controller + } ?: controller // Make sure we don't run the launch animation from the same source twice at the same time. if (openedDialogs.any { it.controller.sourceIdentity == controller.sourceIdentity }) { Log.e( TAG, "Not running dialog launch animation from source as it is already expanded into a" + - " dialog" + " dialog", ) dialog.show() return @@ -288,7 +282,6 @@ constructor( animateBackgroundBoundsChange = animateBackgroundBoundsChange, parentAnimatedDialog = animatedParent, forceDisableSynchronization = isForTesting, - featureFlags = featureFlags, ) openedDialogs.add(animatedDialog) @@ -305,7 +298,7 @@ constructor( dialog: Dialog, animateFrom: Dialog, cuj: DialogCuj? = null, - animateBackgroundBoundsChange: Boolean = false + animateBackgroundBoundsChange: Boolean = false, ) { val view = openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground @@ -313,7 +306,7 @@ constructor( Log.w( TAG, "Showing dialog $dialog normally as the dialog it is shown from was not shown " + - "using DialogTransitionAnimator" + "using DialogTransitionAnimator", ) dialog.show() return @@ -323,7 +316,7 @@ constructor( dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange, - cuj = cuj + cuj = cuj, ) } @@ -346,8 +339,7 @@ constructor( val animatedDialog = openedDialogs.firstOrNull { it.dialog.window?.decorView?.viewRootImpl == view.viewRootImpl - } - ?: return null + } ?: return null return createActivityTransitionController(animatedDialog, cujType) } @@ -373,7 +365,7 @@ constructor( private fun createActivityTransitionController( animatedDialog: AnimatedDialog, - cujType: Int? = null + cujType: Int? = null, ): ActivityTransitionAnimator.Controller? { // At this point, we know that the intent of the caller is to dismiss the dialog to show // an app, so we disable the exit animation into the source because we will never want to @@ -440,7 +432,7 @@ constructor( } private fun disableDialogDismiss() { - dialog.setDismissOverride { /* Do nothing */} + dialog.setDismissOverride { /* Do nothing */ } } private fun enableDialogDismiss() { @@ -530,7 +522,6 @@ private class AnimatedDialog( * Whether synchronization should be disabled, which can be useful if we are running in a test. */ private val forceDisableSynchronization: Boolean, - private val featureFlags: AnimationFeatureFlags, ) { /** * The DecorView of this dialog window. @@ -643,8 +634,7 @@ private class AnimatedDialog( originalDialogBackgroundColor = GhostedViewTransitionAnimatorController.findGradientDrawable(background) ?.color - ?.defaultColor - ?: Color.BLACK + ?.defaultColor ?: Color.BLACK // Make the background view invisible until we start the animation. We use the transition // visibility like GhostView does so that we don't mess up with the accessibility tree (see @@ -700,7 +690,7 @@ private class AnimatedDialog( oldLeft: Int, oldTop: Int, oldRight: Int, - oldBottom: Int + oldBottom: Int, ) { dialogContentWithBackground.removeOnLayoutChangeListener(this) @@ -717,9 +707,7 @@ private class AnimatedDialog( // the dialog. dialog.setDismissOverride(this::onDialogDismissed) - if (featureFlags.isPredictiveBackQsDialogAnim) { - dialog.registerAnimationOnBackInvoked(targetView = dialogContentWithBackground) - } + dialog.registerAnimationOnBackInvoked(targetView = dialogContentWithBackground) // Show the dialog. dialog.show() @@ -815,7 +803,7 @@ private class AnimatedDialog( if (hasInstrumentedJank) { interactionJankMonitor.end(controller.cuj!!.cujType) } - } + }, ) } @@ -888,14 +876,14 @@ private class AnimatedDialog( onAnimationFinished(true /* instantDismiss */) onDialogDismissed(this@AnimatedDialog) } - } + }, ) } private fun startAnimation( isLaunching: Boolean, onLaunchAnimationStart: () -> Unit = {}, - onLaunchAnimationEnd: () -> Unit = {} + onLaunchAnimationEnd: () -> Unit = {}, ) { // Create 2 controllers to animate both the dialog and the source. val startController = @@ -969,7 +957,7 @@ private class AnimatedDialog( override fun onTransitionAnimationProgress( state: TransitionAnimator.State, progress: Float, - linearProgress: Float + linearProgress: Float, ) { startController.onTransitionAnimationProgress(state, progress, linearProgress) @@ -1026,7 +1014,7 @@ private class AnimatedDialog( oldLeft: Int, oldTop: Int, oldRight: Int, - oldBottom: Int + oldBottom: Int, ) { // Don't animate if bounds didn't actually change. if (left == oldLeft && top == oldTop && right == oldRight && bottom == oldBottom) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java index 0652a835cb7c..650fa7ce46de 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java @@ -31,7 +31,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; -import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.platform.test.ravenwood.RavenwoodRule; @@ -41,7 +40,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.systemui.Dependency; -import com.android.systemui.Flags; import com.android.systemui.SysuiTestCase; import com.android.systemui.animation.DialogTransitionAnimator; import com.android.systemui.animation.back.BackAnimationSpec; @@ -137,7 +135,6 @@ public class SystemUIDialogTest extends SysuiTestCase { } @Test - @RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_DIALOGS) public void usePredictiveBackAnimFlag() { final SystemUIDialog dialog = new SystemUIDialog(mContext); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java index 254b792f8152..d327fc23fd06 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.dagger; -import static com.android.systemui.Flags.predictiveBackAnimateDialogs; - import android.content.Context; import android.os.Handler; import android.os.RemoteException; @@ -28,7 +26,6 @@ import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.CoreStartable; import com.android.systemui.animation.ActivityTransitionAnimator; -import com.android.systemui.animation.AnimationFeatureFlags; import com.android.systemui.animation.DialogTransitionAnimator; import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.dagger.SysUISingleton; @@ -226,8 +223,7 @@ public interface CentralSurfacesDependenciesModule { IDreamManager dreamManager, KeyguardStateController keyguardStateController, Lazy<AlternateBouncerInteractor> alternateBouncerInteractor, - InteractionJankMonitor interactionJankMonitor, - AnimationFeatureFlags animationFeatureFlags) { + InteractionJankMonitor interactionJankMonitor) { DialogTransitionAnimator.Callback callback = new DialogTransitionAnimator.Callback() { @Override public boolean isDreaming() { @@ -249,19 +245,6 @@ public interface CentralSurfacesDependenciesModule { return alternateBouncerInteractor.get().canShowAlternateBouncerForFingerprint(); } }; - return new DialogTransitionAnimator( - mainExecutor, callback, interactionJankMonitor, animationFeatureFlags); - } - - /** */ - @Provides - @SysUISingleton - static AnimationFeatureFlags provideAnimationFeatureFlags() { - return new AnimationFeatureFlags() { - @Override - public boolean isPredictiveBackQsDialogAnim() { - return predictiveBackAnimateDialogs(); - } - }; + return new DialogTransitionAnimator(mainExecutor, callback, interactionJankMonitor); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index 03324d2a3e6a..c47ed1722bb4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.phone; -import static com.android.systemui.Flags.predictiveBackAnimateDialogs; - import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; @@ -285,15 +283,13 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh for (int i = 0; i < mOnCreateRunnables.size(); i++) { mOnCreateRunnables.get(i).run(); } - if (predictiveBackAnimateDialogs()) { - View targetView = getWindow().getDecorView(); - DialogKt.registerAnimationOnBackInvoked( - /* dialog = */ this, - /* targetView = */ targetView, - /* backAnimationSpec= */mDelegate.getBackAnimationSpec( - () -> targetView.getResources().getDisplayMetrics()) - ); - } + View targetView = getWindow().getDecorView(); + DialogKt.registerAnimationOnBackInvoked( + /* dialog = */ this, + /* targetView = */ targetView, + /* backAnimationSpec= */mDelegate.getBackAnimationSpec( + () -> targetView.getResources().getDisplayMetrics()) + ); } private void updateWindowSize() { diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/animation/FakeDialogTransitionAnimator.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/animation/FakeDialogTransitionAnimator.kt index 17093291e8b0..2a1877adc172 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/animation/FakeDialogTransitionAnimator.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/animation/FakeDialogTransitionAnimator.kt @@ -24,7 +24,6 @@ fun fakeDialogTransitionAnimator( @Main mainExecutor: Executor, isUnlocked: Boolean = true, isShowingAlternateAuthOnUnlock: Boolean = false, - isPredictiveBackQsDialogAnim: Boolean = false, interactionJankMonitor: InteractionJankMonitor, ): DialogTransitionAnimator { return DialogTransitionAnimator( @@ -35,10 +34,6 @@ fun fakeDialogTransitionAnimator( isShowingAlternateAuthOnUnlock = isShowingAlternateAuthOnUnlock, ), interactionJankMonitor = interactionJankMonitor, - featureFlags = - object : AnimationFeatureFlags { - override val isPredictiveBackQsDialogAnim = isPredictiveBackQsDialogAnim - }, transitionAnimator = fakeTransitionAnimator(mainExecutor), isForTesting = true, ) @@ -50,6 +45,8 @@ private class FakeCallback( private val isShowingAlternateAuthOnUnlock: Boolean = false, ) : DialogTransitionAnimator.Callback { override fun isDreaming(): Boolean = isDreaming + override fun isUnlocked(): Boolean = isUnlocked + override fun isShowingAlternateAuthOnUnlock() = isShowingAlternateAuthOnUnlock } |