Close the shade when launch animation is cancelled.
This CL makes sure that we close the shade when a launch animation is cancelled. It also combines what we do when a launch animation won't run (i.e. it is cancelled, aborted or timed out). Bug: 184457208 Test: Manual Change-Id: Id9b26e65e455e5b806a223575c31a9401cf91052
This commit is contained in:
@@ -191,23 +191,11 @@ class ActivityLaunchAnimator(context: Context) {
|
||||
fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {}
|
||||
|
||||
/**
|
||||
* The animation was cancelled remotely. Note that [onLaunchAnimationEnd] will still be
|
||||
* called after this if the animation was already started, i.e. if [onLaunchAnimationStart]
|
||||
* was called before the cancellation.
|
||||
* The animation was cancelled. Note that [onLaunchAnimationEnd] will still be called after
|
||||
* this if the animation was already started, i.e. if [onLaunchAnimationStart] was called
|
||||
* before the cancellation.
|
||||
*/
|
||||
fun onLaunchAnimationCancelled() {}
|
||||
|
||||
/**
|
||||
* The remote animation was not started within the expected time. It timed out and will
|
||||
* never [start][onLaunchAnimationStart].
|
||||
*/
|
||||
fun onLaunchAnimationTimedOut() {}
|
||||
|
||||
/**
|
||||
* The animation was aborted because the opening window was not found. It will never
|
||||
* [start][onLaunchAnimationStart].
|
||||
*/
|
||||
fun onLaunchAnimationAborted() {}
|
||||
}
|
||||
|
||||
/** The state of an expandable view during an [ActivityLaunchAnimator] animation. */
|
||||
@@ -332,7 +320,7 @@ class ActivityLaunchAnimator(context: Context) {
|
||||
if (window == null) {
|
||||
removeTimeout()
|
||||
invokeCallback(iCallback)
|
||||
controller.onLaunchAnimationAborted()
|
||||
controller.onLaunchAnimationCancelled()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -486,7 +474,7 @@ class ActivityLaunchAnimator(context: Context) {
|
||||
}
|
||||
|
||||
timedOut = true
|
||||
controller.onLaunchAnimationTimedOut()
|
||||
controller.onLaunchAnimationCancelled()
|
||||
}
|
||||
|
||||
override fun onAnimationCancelled() {
|
||||
|
||||
@@ -84,14 +84,6 @@ class NotificationLaunchAnimatorController(
|
||||
notificationShadeWindowViewController.setExpandAnimationRunning(false)
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationTimedOut() {
|
||||
notificationShadeWindowViewController.setExpandAnimationRunning(false)
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationAborted() {
|
||||
notificationShadeWindowViewController.setExpandAnimationRunning(false)
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
|
||||
notification.isExpandAnimationRunning = true
|
||||
notificationListContainer.setExpandingNotification(notification)
|
||||
|
||||
@@ -21,7 +21,6 @@ import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
|
||||
import static android.app.StatusBarManager.WindowType;
|
||||
import static android.app.StatusBarManager.WindowVisibleState;
|
||||
import static android.app.StatusBarManager.windowStateToString;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
|
||||
import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;
|
||||
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||
import static android.view.InsetsState.containsType;
|
||||
@@ -2016,9 +2015,12 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
/** A launch animation was cancelled. */
|
||||
//TODO: These can / should probably be moved to NotificationPresenter or ShadeController
|
||||
public void onLaunchAnimationCancelled() {
|
||||
if (!mPresenter.isCollapsing()) {
|
||||
public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
|
||||
if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
|
||||
&& isLaunchForActivity) {
|
||||
onClosingFinished();
|
||||
} else {
|
||||
mShadeController.collapsePanel(true /* animate */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2032,16 +2034,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
/** A launch animation timed out. */
|
||||
public void onLaunchAnimationTimedOut(boolean isLaunchForActivity) {
|
||||
if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
|
||||
&& isLaunchForActivity) {
|
||||
onClosingFinished();
|
||||
} else {
|
||||
mShadeController.collapsePanel(true /* animate */);
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether we should animate an activity launch. */
|
||||
public boolean areLaunchAnimationsEnabled() {
|
||||
// TODO(b/184121838): Support lock screen launch animations.
|
||||
|
||||
@@ -43,16 +43,6 @@ class StatusBarLaunchAnimatorController(
|
||||
|
||||
override fun onLaunchAnimationCancelled() {
|
||||
delegate.onLaunchAnimationCancelled()
|
||||
statusBar.onLaunchAnimationCancelled()
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationTimedOut() {
|
||||
delegate.onLaunchAnimationTimedOut()
|
||||
statusBar.onLaunchAnimationTimedOut(isLaunchForActivity)
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationAborted() {
|
||||
delegate.onLaunchAnimationAborted()
|
||||
statusBar.collapsePanelOnMainThread()
|
||||
statusBar.onLaunchAnimationCancelled(isLaunchForActivity)
|
||||
}
|
||||
}
|
||||
@@ -106,12 +106,12 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun abortsIfNoOpeningWindowIsFound() {
|
||||
fun cancelsIfNoOpeningWindowIsFound() {
|
||||
val runner = activityLaunchAnimator.createRunner(controller)
|
||||
runner.onAnimationStart(0, emptyArray(), emptyArray(), emptyArray(), iCallback)
|
||||
|
||||
waitForIdleSync()
|
||||
verify(controller).onLaunchAnimationAborted()
|
||||
verify(controller).onLaunchAnimationCancelled()
|
||||
verify(controller, never()).onLaunchAnimationStart(anyBoolean())
|
||||
}
|
||||
|
||||
@@ -177,12 +177,4 @@ private class TestLaunchAnimatorController(
|
||||
override fun onLaunchAnimationCancelled() {
|
||||
assertOnMainThread()
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationTimedOut() {
|
||||
assertOnMainThread()
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationAborted() {
|
||||
assertOnMainThread()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user