Loading core/java/android/app/TaskInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -241,6 +241,12 @@ public class TaskInfo { */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the update comes from a letterbox double-tap action from the user or not. * @hide */ public boolean isFromLetterboxDoubleTap; /** * If {@link isLetterboxDoubleTapEnabled} it contains the current letterbox vertical position or * {@link TaskInfo.PROPERTY_VALUE_UNSET} otherwise. Loading Loading @@ -488,7 +494,7 @@ public class TaskInfo { && isResizeable == that.isResizeable && supportsMultiWindow == that.supportsMultiWindow && displayAreaFeatureId == that.displayAreaFeatureId && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading Loading @@ -520,9 +526,9 @@ public class TaskInfo { return displayId == that.displayId && taskId == that.taskId && topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition Loading Loading @@ -583,6 +589,7 @@ public class TaskInfo { displayAreaFeatureId = source.readInt(); cameraCompatControlState = source.readInt(); isLetterboxDoubleTapEnabled = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); topActivityLetterboxWidth = source.readInt(); Loading Loading @@ -635,6 +642,7 @@ public class TaskInfo { dest.writeInt(displayAreaFeatureId); dest.writeInt(cameraCompatControlState); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); dest.writeInt(topActivityLetterboxWidth); Loading Loading @@ -675,6 +683,7 @@ public class TaskInfo { + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled + " isFromDoubleTap= " + isFromLetterboxDoubleTap + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java +3 −7 Original line number Diff line number Diff line Loading @@ -74,9 +74,7 @@ class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract { private boolean mForceUpdate = false; // We decided to force the visualization of the double-tap animated icons every time the user // double-taps. We detect a double-tap checking the previous and current state of // mLetterboxVerticalPosition and mLetterboxHorizontalPosition saving the result in this // variable. // double-taps. private boolean mHasUserDoubleTapped; // When the size of the letterboxed app changes and the icons are visible Loading Loading @@ -155,11 +153,9 @@ class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract { mLetterboxHorizontalPosition = taskInfo.topActivityLetterboxHorizontalPosition; mTopActivityLetterboxWidth = taskInfo.topActivityLetterboxWidth; mTopActivityLetterboxHeight = taskInfo.topActivityLetterboxHeight; mHasUserDoubleTapped = taskInfo.isFromLetterboxDoubleTap; mHasUserDoubleTapped = mLetterboxVerticalPosition != prevLetterboxVerticalPosition || prevLetterboxHorizontalPosition != mLetterboxHorizontalPosition; if (mHasUserDoubleTapped) { if (taskInfo.isFromLetterboxDoubleTap) { // In this case we disable the reachability for the following launch of // the current application. Anyway because a double tap event happened, // the reachability education is displayed Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java +0 −28 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.wm.shell.compatui; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.verify; import android.app.ActivityManager; import android.app.TaskInfo; Loading @@ -32,7 +31,6 @@ import com.android.wm.shell.TestShellExecutor; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.SyncTransactionQueue; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -71,10 +69,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { mExecutor = new TestShellExecutor(); } @After public void tearDown() { } @Test public void testCreateLayout_notEligible_doesNotCreateLayout() { final ReachabilityEduWindowManager windowManager = createReachabilityEduWindowManager( Loading @@ -85,20 +79,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { assertNull(windowManager.mLayout); } @Test public void testCreateLayout_letterboxPositionChanged_doubleTapIsDetected() { // Initial left position final TaskInfo initialTaskInfo = createTaskInfoForHorizontalTapping(USER_ID, 0, 1000); final ReachabilityEduWindowManager windowManager = createReachabilityEduWindowManager(initialTaskInfo); // Move to the right final TaskInfo newPositionTaskInfo = createTaskInfoForHorizontalTapping(USER_ID, 1, 1000); windowManager.updateCompatInfo(newPositionTaskInfo, mTaskListener, /* canShow */ true); verify(mCompatUIConfiguration).setDontShowReachabilityEducationAgain(newPositionTaskInfo); } private ReachabilityEduWindowManager createReachabilityEduWindowManager(TaskInfo taskInfo) { return new ReachabilityEduWindowManager(mContext, taskInfo, mSyncTransactionQueue, mCallback, mTaskListener, mDisplayLayout, Loading @@ -113,14 +93,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { /* topActivityLetterboxHeight */ -1); } private static TaskInfo createTaskInfoForHorizontalTapping(int userId, int topActivityLetterboxHorizontalPosition, int topActivityLetterboxWidth) { return createTaskInfo(userId, /* isLetterboxDoubleTapEnabled */ true, /* topActivityLetterboxVerticalPosition */ -1, topActivityLetterboxHorizontalPosition, topActivityLetterboxWidth, /* topActivityLetterboxHeight */ -1); } private static TaskInfo createTaskInfo(int userId, boolean isLetterboxDoubleTapEnabled, int topActivityLetterboxVerticalPosition, int topActivityLetterboxHorizontalPosition, int topActivityLetterboxWidth, int topActivityLetterboxHeight) { Loading services/core/java/com/android/server/wm/LetterboxUiController.java +10 −2 Original line number Diff line number Diff line Loading @@ -243,6 +243,8 @@ final class LetterboxUiController { private boolean mIsRelauchingAfterRequestedOrientationChanged; private boolean mDoubleTapEvent; LetterboxUiController(WindowManagerService wmService, ActivityRecord activityRecord) { mLetterboxConfiguration = wmService.mLetterboxConfiguration; // Given activityRecord may not be fully constructed since LetterboxUiController Loading Loading @@ -839,6 +841,12 @@ final class LetterboxUiController { } } boolean isFromDoubleTap() { final boolean isFromDoubleTap = mDoubleTapEvent; mDoubleTapEvent = false; return isFromDoubleTap; } SurfaceControl getLetterboxParentSurface() { if (mActivityRecord.isInLetterboxAnimation()) { return mActivityRecord.getTask().getSurfaceControl(); Loading Loading @@ -1045,7 +1053,7 @@ final class LetterboxUiController { : LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__LEFT_TO_CENTER; logLetterboxPositionChange(changeToLog); } mDoubleTapEvent = true; // TODO(197549949): Add animation for transition. mActivityRecord.recomputeConfiguration(); } Loading Loading @@ -1084,7 +1092,7 @@ final class LetterboxUiController { : LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__TOP_TO_CENTER; logLetterboxPositionChange(changeToLog); } mDoubleTapEvent = true; // TODO(197549949): Add animation for transition. mActivityRecord.recomputeConfiguration(); } Loading services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Diff line number Diff line Loading @@ -3485,6 +3485,7 @@ class Task extends TaskFragment { info.topActivityLetterboxHorizontalPosition = TaskInfo.PROPERTY_VALUE_UNSET; info.topActivityLetterboxWidth = TaskInfo.PROPERTY_VALUE_UNSET; info.topActivityLetterboxHeight = TaskInfo.PROPERTY_VALUE_UNSET; info.isFromLetterboxDoubleTap = top != null && top.mLetterboxUiController.isFromDoubleTap(); if (info.isLetterboxDoubleTapEnabled) { info.topActivityLetterboxWidth = top.getBounds().width(); info.topActivityLetterboxHeight = top.getBounds().height(); Loading Loading
core/java/android/app/TaskInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -241,6 +241,12 @@ public class TaskInfo { */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the update comes from a letterbox double-tap action from the user or not. * @hide */ public boolean isFromLetterboxDoubleTap; /** * If {@link isLetterboxDoubleTapEnabled} it contains the current letterbox vertical position or * {@link TaskInfo.PROPERTY_VALUE_UNSET} otherwise. Loading Loading @@ -488,7 +494,7 @@ public class TaskInfo { && isResizeable == that.isResizeable && supportsMultiWindow == that.supportsMultiWindow && displayAreaFeatureId == that.displayAreaFeatureId && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading Loading @@ -520,9 +526,9 @@ public class TaskInfo { return displayId == that.displayId && taskId == that.taskId && topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxHorizontalPosition == that.topActivityLetterboxHorizontalPosition Loading Loading @@ -583,6 +589,7 @@ public class TaskInfo { displayAreaFeatureId = source.readInt(); cameraCompatControlState = source.readInt(); isLetterboxDoubleTapEnabled = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); topActivityLetterboxWidth = source.readInt(); Loading Loading @@ -635,6 +642,7 @@ public class TaskInfo { dest.writeInt(displayAreaFeatureId); dest.writeInt(cameraCompatControlState); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); dest.writeInt(topActivityLetterboxWidth); Loading Loading @@ -675,6 +683,7 @@ public class TaskInfo { + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled + " isFromDoubleTap= " + isFromLetterboxDoubleTap + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java +3 −7 Original line number Diff line number Diff line Loading @@ -74,9 +74,7 @@ class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract { private boolean mForceUpdate = false; // We decided to force the visualization of the double-tap animated icons every time the user // double-taps. We detect a double-tap checking the previous and current state of // mLetterboxVerticalPosition and mLetterboxHorizontalPosition saving the result in this // variable. // double-taps. private boolean mHasUserDoubleTapped; // When the size of the letterboxed app changes and the icons are visible Loading Loading @@ -155,11 +153,9 @@ class ReachabilityEduWindowManager extends CompatUIWindowManagerAbstract { mLetterboxHorizontalPosition = taskInfo.topActivityLetterboxHorizontalPosition; mTopActivityLetterboxWidth = taskInfo.topActivityLetterboxWidth; mTopActivityLetterboxHeight = taskInfo.topActivityLetterboxHeight; mHasUserDoubleTapped = taskInfo.isFromLetterboxDoubleTap; mHasUserDoubleTapped = mLetterboxVerticalPosition != prevLetterboxVerticalPosition || prevLetterboxHorizontalPosition != mLetterboxHorizontalPosition; if (mHasUserDoubleTapped) { if (taskInfo.isFromLetterboxDoubleTap) { // In this case we disable the reachability for the following launch of // the current application. Anyway because a double tap event happened, // the reachability education is displayed Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java +0 −28 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.wm.shell.compatui; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.verify; import android.app.ActivityManager; import android.app.TaskInfo; Loading @@ -32,7 +31,6 @@ import com.android.wm.shell.TestShellExecutor; import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.SyncTransactionQueue; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -71,10 +69,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { mExecutor = new TestShellExecutor(); } @After public void tearDown() { } @Test public void testCreateLayout_notEligible_doesNotCreateLayout() { final ReachabilityEduWindowManager windowManager = createReachabilityEduWindowManager( Loading @@ -85,20 +79,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { assertNull(windowManager.mLayout); } @Test public void testCreateLayout_letterboxPositionChanged_doubleTapIsDetected() { // Initial left position final TaskInfo initialTaskInfo = createTaskInfoForHorizontalTapping(USER_ID, 0, 1000); final ReachabilityEduWindowManager windowManager = createReachabilityEduWindowManager(initialTaskInfo); // Move to the right final TaskInfo newPositionTaskInfo = createTaskInfoForHorizontalTapping(USER_ID, 1, 1000); windowManager.updateCompatInfo(newPositionTaskInfo, mTaskListener, /* canShow */ true); verify(mCompatUIConfiguration).setDontShowReachabilityEducationAgain(newPositionTaskInfo); } private ReachabilityEduWindowManager createReachabilityEduWindowManager(TaskInfo taskInfo) { return new ReachabilityEduWindowManager(mContext, taskInfo, mSyncTransactionQueue, mCallback, mTaskListener, mDisplayLayout, Loading @@ -113,14 +93,6 @@ public class ReachabilityEduWindowManagerTest extends ShellTestCase { /* topActivityLetterboxHeight */ -1); } private static TaskInfo createTaskInfoForHorizontalTapping(int userId, int topActivityLetterboxHorizontalPosition, int topActivityLetterboxWidth) { return createTaskInfo(userId, /* isLetterboxDoubleTapEnabled */ true, /* topActivityLetterboxVerticalPosition */ -1, topActivityLetterboxHorizontalPosition, topActivityLetterboxWidth, /* topActivityLetterboxHeight */ -1); } private static TaskInfo createTaskInfo(int userId, boolean isLetterboxDoubleTapEnabled, int topActivityLetterboxVerticalPosition, int topActivityLetterboxHorizontalPosition, int topActivityLetterboxWidth, int topActivityLetterboxHeight) { Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +10 −2 Original line number Diff line number Diff line Loading @@ -243,6 +243,8 @@ final class LetterboxUiController { private boolean mIsRelauchingAfterRequestedOrientationChanged; private boolean mDoubleTapEvent; LetterboxUiController(WindowManagerService wmService, ActivityRecord activityRecord) { mLetterboxConfiguration = wmService.mLetterboxConfiguration; // Given activityRecord may not be fully constructed since LetterboxUiController Loading Loading @@ -839,6 +841,12 @@ final class LetterboxUiController { } } boolean isFromDoubleTap() { final boolean isFromDoubleTap = mDoubleTapEvent; mDoubleTapEvent = false; return isFromDoubleTap; } SurfaceControl getLetterboxParentSurface() { if (mActivityRecord.isInLetterboxAnimation()) { return mActivityRecord.getTask().getSurfaceControl(); Loading Loading @@ -1045,7 +1053,7 @@ final class LetterboxUiController { : LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__LEFT_TO_CENTER; logLetterboxPositionChange(changeToLog); } mDoubleTapEvent = true; // TODO(197549949): Add animation for transition. mActivityRecord.recomputeConfiguration(); } Loading Loading @@ -1084,7 +1092,7 @@ final class LetterboxUiController { : LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__TOP_TO_CENTER; logLetterboxPositionChange(changeToLog); } mDoubleTapEvent = true; // TODO(197549949): Add animation for transition. mActivityRecord.recomputeConfiguration(); } Loading
services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Diff line number Diff line Loading @@ -3485,6 +3485,7 @@ class Task extends TaskFragment { info.topActivityLetterboxHorizontalPosition = TaskInfo.PROPERTY_VALUE_UNSET; info.topActivityLetterboxWidth = TaskInfo.PROPERTY_VALUE_UNSET; info.topActivityLetterboxHeight = TaskInfo.PROPERTY_VALUE_UNSET; info.isFromLetterboxDoubleTap = top != null && top.mLetterboxUiController.isFromDoubleTap(); if (info.isLetterboxDoubleTapEnabled) { info.topActivityLetterboxWidth = top.getBounds().width(); info.topActivityLetterboxHeight = top.getBounds().height(); Loading