summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java23
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java5
2 files changed, 25 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
index 59c841f63498..97bf8f7bf459 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
@@ -173,6 +173,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
ProtoLog.i(WM_SHELL_BACK_PREVIEW, "Navigation window gone.");
setTriggerBack(false);
resetTouchTracker();
+ // Don't wait for animation start
+ mShellExecutor.removeCallbacks(mAnimationTimeoutRunnable);
});
}
});
@@ -954,7 +956,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
ProtoLog.e(WM_SHELL_BACK_PREVIEW, "Lack of navigation info to start animation.");
return;
}
- if (mApps == null) {
+ if (!validateAnimationTargets(mApps)) {
ProtoLog.w(WM_SHELL_BACK_PREVIEW, "Not starting animation due to mApps being null.");
return;
}
@@ -985,6 +987,21 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
}
}
+ /**
+ * Validate animation targets.
+ */
+ static boolean validateAnimationTargets(RemoteAnimationTarget[] apps) {
+ if (apps == null || apps.length == 0) {
+ return false;
+ }
+ for (int i = apps.length - 1; i >= 0; --i) {
+ if (!apps[i].leash.isValid()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private void createAdapter() {
IBackAnimationRunner runner =
new IBackAnimationRunner.Stub() {
@@ -997,6 +1014,10 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
mShellExecutor.execute(
() -> {
endLatencyTracking();
+ if (!validateAnimationTargets(apps)) {
+ Log.e(TAG, "Invalid animation targets!");
+ return;
+ }
mBackAnimationFinishedCallback = finishedCallback;
mApps = apps;
startSystemAnimation();
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
index d839eae27171..2ff1ddd8c0c8 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
@@ -69,7 +69,6 @@ import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.sysui.ShellSharedConstants;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -182,7 +181,9 @@ public class BackAnimationControllerTest extends ShellTestCase {
}
RemoteAnimationTarget createAnimationTarget() {
- SurfaceControl topWindowLeash = new SurfaceControl();
+ SurfaceControl topWindowLeash = new SurfaceControl.Builder()
+ .setName("FakeLeash")
+ .build();
return new RemoteAnimationTarget(-1, RemoteAnimationTarget.MODE_CLOSING, topWindowLeash,
false, new Rect(), new Rect(), -1,
new Point(0, 0), new Rect(), new Rect(), new WindowConfiguration(),