summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mateusz Cicheński <mateuszc@google.com> 2023-04-17 22:07:47 +0000
committer Mateusz Cicheński <mateuszc@google.com> 2023-04-17 22:11:19 +0000
commit428e04bb424818be0fab86c6af92fd2e0abecd05 (patch)
tree8c7b4ff9eaf851e532e29c540ae1fbb14f479c48
parent48e1f12c185310a716a287721f0f86b23d23478b (diff)
If leash is null it's not a valid state to remove PiP
Due to potential race condition if an app crashes during the dismiss PiP gesture, it is possible that the leash will be reset in onTaskVanished before the removePip function gets invoked. In such state it's no longer valid to try to dismiss PiP, since it's already gone. Bug: 269113067 Test: n/a, following bug report stack trace for root cause Change-Id: I985ee12f54d8fb2ab005197427a522d871692d1a
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
index 24dee5fe5e79..0418b48068dc 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
@@ -619,11 +619,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
* Removes PiP immediately.
*/
public void removePip() {
- if (!mPipTransitionState.isInPip() || mToken == null) {
+ if (!mPipTransitionState.isInPip() || mToken == null || mLeash == null) {
ProtoLog.wtf(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
"%s: Not allowed to removePip in current state"
- + " mState=%d mToken=%s", TAG, mPipTransitionState.getTransitionState(),
- mToken);
+ + " mState=%d mToken=%s mLeash=%s", TAG,
+ mPipTransitionState.getTransitionState(), mToken, mLeash);
return;
}