Merge "Only reset the frozen recents list if touching outside of the mandatory system gesture region" into 24D1-dev
diff --git a/data/etc/core.protolog.pb b/data/etc/core.protolog.pb
index 0415e44..02c8099 100644
--- a/data/etc/core.protolog.pb
+++ b/data/etc/core.protolog.pb
Binary files differ
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json
index 0231d3a..a5bc2ea 100644
--- a/data/etc/services.core.protolog.json
+++ b/data/etc/services.core.protolog.json
@@ -2065,6 +2065,24 @@
"group": "WM_DEBUG_WINDOW_TRANSITIONS",
"at": "com\/android\/server\/wm\/PhysicalDisplaySwitchTransitionLauncher.java"
},
+ "-1640401313436844534": {
+ "message": "Resetting frozen recents task list reason=app touch win=%s x=%d y=%d insetFrame=%s",
+ "level": "INFO",
+ "group": "WM_DEBUG_TASKS",
+ "at": "com\/android\/server\/wm\/RecentTasks.java"
+ },
+ "-8803811426486764449": {
+ "message": "Setting frozen recents task list",
+ "level": "INFO",
+ "group": "WM_DEBUG_TASKS",
+ "at": "com\/android\/server\/wm\/RecentTasks.java"
+ },
+ "4040735335719974079": {
+ "message": "Resetting frozen recents task list reason=timeout",
+ "level": "INFO",
+ "group": "WM_DEBUG_TASKS",
+ "at": "com\/android\/server\/wm\/RecentTasks.java"
+ },
"3308140128142966415": {
"message": "remove RecentTask %s when finishing user %d",
"level": "INFO",
diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java
index f3f4def..5218c77 100644
--- a/services/core/java/com/android/server/wm/RecentTasks.java
+++ b/services/core/java/com/android/server/wm/RecentTasks.java
@@ -33,6 +33,7 @@
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.os.Process.SYSTEM_UID;
import static android.view.MotionEvent.CLASSIFICATION_MULTI_FINGER_SWIPE;
+import static android.view.WindowInsets.Type.mandatorySystemGestures;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
@@ -60,6 +61,8 @@
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.graphics.Insets;
+import android.graphics.Rect;
import android.os.Environment;
import android.os.IBinder;
import android.os.RemoteException;
@@ -72,7 +75,9 @@
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
+import android.view.InsetsState;
import android.view.MotionEvent;
+import android.view.WindowInsets;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import com.android.internal.annotations.VisibleForTesting;
@@ -209,6 +214,7 @@
private final HashMap<ComponentName, ActivityInfo> mTmpAvailActCache = new HashMap<>();
private final HashMap<String, ApplicationInfo> mTmpAvailAppCache = new HashMap<>();
private final SparseBooleanArray mTmpQuietProfileUserIds = new SparseBooleanArray();
+ private final Rect mTmpRect = new Rect();
// TODO(b/127498985): This is currently a rough heuristic for interaction inside an app
private final PointerEventListener mListener = new PointerEventListener() {
@@ -230,12 +236,27 @@
if (win == null) {
return;
}
+
+ // Verify the touch is within the mandatory system gesture inset bounds of the
+ // window, use the raw insets state to ignore window z-order
+ final InsetsState insetsState = dc.getInsetsStateController()
+ .getRawInsetsState();
+ mTmpRect.set(win.getFrame());
+ mTmpRect.inset(insetsState.calculateInsets(win.getFrame(),
+ mandatorySystemGestures(), false /* ignoreVisibility */));
+ if (!mTmpRect.contains(x, y)) {
+ return;
+ }
+
// Unfreeze the task list once we touch down in a task
final boolean isAppWindowTouch = FIRST_APPLICATION_WINDOW <= win.mAttrs.type
&& win.mAttrs.type <= LAST_APPLICATION_WINDOW;
if (isAppWindowTouch) {
final Task stack = mService.getTopDisplayFocusedRootTask();
final Task topTask = stack != null ? stack.getTopMostTask() : null;
+ ProtoLog.i(WM_DEBUG_TASKS, "Resetting frozen recents task list"
+ + " reason=app touch win=%s x=%d y=%d insetFrame=%s", win, x, y,
+ mTmpRect);
resetFreezeTaskListReordering(topTask);
}
}
@@ -302,6 +323,8 @@
mFreezeTaskListReordering = true;
}
+ ProtoLog.i(WM_DEBUG_TASKS, "Setting frozen recents task list");
+
// Always update the reordering time when this is called to ensure that the timeout
// is reset
mService.mH.removeCallbacks(mResetFreezeTaskListOnTimeoutRunnable);
@@ -345,6 +368,7 @@
final Task focusedStack = mService.getTopDisplayFocusedRootTask();
final Task topTask = focusedStack != null ? focusedStack.getTopMostTask() : null;
final Task reorderToEndTask = topTask != null && topTask.hasChild() ? topTask : null;
+ ProtoLog.i(WM_DEBUG_TASKS, "Resetting frozen recents task list reason=timeout");
resetFreezeTaskListReordering(reorderToEndTask);
}
}