Loading services/core/java/com/android/server/wm/RecentTasks.java +21 −6 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ 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; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_TASKS; import static com.android.server.wm.ActivityRecord.State.RESUMED; Loading Loading @@ -78,6 +80,7 @@ import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.InsetsState; import android.view.MotionEvent; import android.view.WindowManager; import android.view.WindowManagerPolicyConstants.PointerEventListener; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -248,15 +251,13 @@ class RecentTasks { 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) { // Unfreeze the task list if the user is interacting with a valid window if (shouldUnfreezeOnInteractionInWindow(win.mAttrs.type)) { 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); + " win=%s type=%d x=%d y=%d insetFrame=%s", win, win.mAttrs.type, x, y, mTmpRect); resetFreezeTaskListReordering(topTask); } } Loading Loading @@ -1903,6 +1904,20 @@ class RecentTasks { return false; } /** * Returns whether user interaction in a window of the given type should unfreeze the recents * list. */ @VisibleForTesting static boolean shouldUnfreezeOnInteractionInWindow( @WindowManager.LayoutParams.WindowType int type) { final boolean isAppWindowTouch = FIRST_APPLICATION_WINDOW <= type && type <= LAST_APPLICATION_WINDOW; final boolean isImeWindowTouch = type == TYPE_INPUT_METHOD || type == TYPE_INPUT_METHOD_DIALOG; return isAppWindowTouch || isImeWindowTouch; } void dump(PrintWriter pw, boolean dumpAll, String dumpPackage) { pw.println("ACTIVITY MANAGER RECENT TASKS (dumpsys activity recents)"); pw.println("mRecentsUid=" + mRecentsUid); Loading services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,11 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.os.Process.NOBODY_UID; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; Loading Loading @@ -1084,6 +1089,17 @@ public class RecentTasksTest extends WindowTestsBase { mTasks.get(0)); } @Test public void testUnfreezeTaskListOrder_windowTypes() { for (int i = FIRST_APPLICATION_WINDOW; i <= LAST_APPLICATION_WINDOW; i++) { assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(i)).isTrue(); } assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(TYPE_INPUT_METHOD)).isTrue(); assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(TYPE_INPUT_METHOD_DIALOG)) .isTrue(); assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(FIRST_SYSTEM_WINDOW)).isFalse(); } @Test public void testBackStackTasks_expectNoTrim() { mRecentTasks.setParameters(-1 /* min */, 1 /* max */, -1 /* ms */); Loading Loading
services/core/java/com/android/server/wm/RecentTasks.java +21 −6 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ 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; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_TASKS; import static com.android.server.wm.ActivityRecord.State.RESUMED; Loading Loading @@ -78,6 +80,7 @@ import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.InsetsState; import android.view.MotionEvent; import android.view.WindowManager; import android.view.WindowManagerPolicyConstants.PointerEventListener; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -248,15 +251,13 @@ class RecentTasks { 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) { // Unfreeze the task list if the user is interacting with a valid window if (shouldUnfreezeOnInteractionInWindow(win.mAttrs.type)) { 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); + " win=%s type=%d x=%d y=%d insetFrame=%s", win, win.mAttrs.type, x, y, mTmpRect); resetFreezeTaskListReordering(topTask); } } Loading Loading @@ -1903,6 +1904,20 @@ class RecentTasks { return false; } /** * Returns whether user interaction in a window of the given type should unfreeze the recents * list. */ @VisibleForTesting static boolean shouldUnfreezeOnInteractionInWindow( @WindowManager.LayoutParams.WindowType int type) { final boolean isAppWindowTouch = FIRST_APPLICATION_WINDOW <= type && type <= LAST_APPLICATION_WINDOW; final boolean isImeWindowTouch = type == TYPE_INPUT_METHOD || type == TYPE_INPUT_METHOD_DIALOG; return isAppWindowTouch || isImeWindowTouch; } void dump(PrintWriter pw, boolean dumpAll, String dumpPackage) { pw.println("ACTIVITY MANAGER RECENT TASKS (dumpsys activity recents)"); pw.println("mRecentsUid=" + mRecentsUid); Loading
services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,11 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.os.Process.NOBODY_UID; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; Loading Loading @@ -1084,6 +1089,17 @@ public class RecentTasksTest extends WindowTestsBase { mTasks.get(0)); } @Test public void testUnfreezeTaskListOrder_windowTypes() { for (int i = FIRST_APPLICATION_WINDOW; i <= LAST_APPLICATION_WINDOW; i++) { assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(i)).isTrue(); } assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(TYPE_INPUT_METHOD)).isTrue(); assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(TYPE_INPUT_METHOD_DIALOG)) .isTrue(); assertThat(RecentTasks.shouldUnfreezeOnInteractionInWindow(FIRST_SYSTEM_WINDOW)).isFalse(); } @Test public void testBackStackTasks_expectNoTrim() { mRecentTasks.setParameters(-1 /* min */, 1 /* max */, -1 /* ms */); Loading