Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbcd9525 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only reset the frozen recents list if touching outside of the mandatory...

Merge "Only reset the frozen recents list if touching outside of the mandatory system gesture region" into 24D1-dev
parents 32b90af0 0756665a
Loading
Loading
Loading
Loading
+112 B (52.9 KiB)

File changed.

No diff preview for this file type.

+18 −0
Original line number Diff line number Diff line
@@ -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",
+24 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }