Merge "Close the shade when launch animation is cancelled." into sc-dev

This commit is contained in:
Jordan Demeulenaere
2021-04-27 11:42:27 +00:00
committed by Android (Google) Code Review
5 changed files with 13 additions and 58 deletions

View File

@@ -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() {

View File

@@ -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)

View File

@@ -2015,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 */);
}
}
@@ -2031,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.

View File

@@ -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)
}
}

View File

@@ -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()
}
}