Don't check for correct windowing mode when exiting drag resize.
Tasks can get re-parented to a non split screen stack before
notifyAppTransitionDone is called. When notifyAppTransitionDone is
called later on, it will try to update the task that was previously in a
split screen stack, by updating the drag resizing flag. However, that
flag cannot be updated since the task is no longer in a split screen
stack. This will cause a system crash.
There's no need to check the windowing mode when exiting drag resize
since there's no harm in leaving drag resize when not in split screen.
Change-Id: Ibf7e531ac5adc6c37e77e15f5d61ffb4de286998
Fixes: 111521606
Test: Steps in bug
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 71f34c9..eb419c9 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -22,10 +22,8 @@
import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.content.res.Configuration.EMPTY;
+
import static com.android.server.EventLogTags.WM_TASK_REMOVED;
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
-import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
-import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.TaskProto.APP_WINDOW_TOKENS;
import static com.android.server.wm.TaskProto.BOUNDS;
import static com.android.server.wm.TaskProto.DEFER_REMOVAL;
@@ -33,6 +31,9 @@
import static com.android.server.wm.TaskProto.ID;
import static com.android.server.wm.TaskProto.TEMP_INSET_BOUNDS;
import static com.android.server.wm.TaskProto.WINDOW_CONTAINER;
+import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
+import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
+import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import android.annotation.CallSuper;
import android.app.ActivityManager.TaskDescription;
@@ -43,8 +44,8 @@
import android.util.Slog;
import android.util.proto.ProtoOutputStream;
import android.view.Surface;
-
import android.view.SurfaceControl;
+
import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter;
@@ -472,7 +473,8 @@
void setDragResizing(boolean dragResizing, int dragResizeMode) {
if (mDragResizing != dragResizing) {
- if (!DragResizeMode.isModeAllowedForStack(mStack, dragResizeMode)) {
+ // No need to check if the mode is allowed if it's leaving dragResize
+ if (dragResizing && !DragResizeMode.isModeAllowedForStack(mStack, dragResizeMode)) {
throw new IllegalArgumentException("Drag resize mode not allow for stack stackId="
+ mStack.mStackId + " dragResizeMode=" + dragResizeMode);
}