diff --git a/data/etc/core.protolog.pb b/data/etc/core.protolog.pb index 0415e44af72a6e2197c9f6fd54cabd6392d795df..02c8099f04705f7484dfff5628737cb5c92b82c0 100644 Binary files a/data/etc/core.protolog.pb and b/data/etc/core.protolog.pb differ diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index 0231d3abd19e8ad1e404ed198032f766ada498e4..a5bc2ea4b493ab78b6f526f9a255b120cc5506a7 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 f3f4def924b572f06e02694e9c1f53dad8aa3dd5..5218c772be60b4b4a961aef258e79fbecb997a5d 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_DOCUMENT; 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.ParceledListSlice; 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.IntArray; 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 @@ class RecentTasks { 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 @@ class RecentTasks { 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 @@ class RecentTasks { 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 @@ class RecentTasks { 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); } }