summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Massimo Carli <mcarli@google.com> 2023-03-25 08:49:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-03-25 08:49:14 +0000
commit8d71de9f69349ffc9f1c14ffc44fecacad69eb97 (patch)
tree29a6d00b59967fa873c7821c9dbf8f09e867a281
parentedc5058b911a57c7be083937f05f94e22bc23e48 (diff)
parent05ca90eb353ec3a4adf5ccc53639e1e330699f66 (diff)
Merge "Don't force double-tap education on unfold" into tm-qpr-dev
-rw-r--r--core/java/android/app/TaskInfo.java13
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java10
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java28
-rw-r--r--services/core/java/com/android/server/wm/LetterboxUiController.java12
-rw-r--r--services/core/java/com/android/server/wm/Task.java1
5 files changed, 25 insertions, 39 deletions
diff --git a/core/java/android/app/TaskInfo.java b/core/java/android/app/TaskInfo.java
index 23f2bdb7fa54..1551ce9a9191 100644
--- a/core/java/android/app/TaskInfo.java
+++ b/core/java/android/app/TaskInfo.java
@@ -242,6 +242,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.
* @hide
@@ -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
@@ -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
@@ -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();
@@ -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);
@@ -675,6 +683,7 @@ public class TaskInfo {
+ " topActivityEligibleForLetterboxEducation= "
+ topActivityEligibleForLetterboxEducation
+ " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled
+ + " isFromDoubleTap= " + isFromLetterboxDoubleTap
+ " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition
+ " topActivityLetterboxHorizontalPosition= "
+ topActivityLetterboxHorizontalPosition
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java
index 6223efa831b1..f1b098ef27c7 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/ReachabilityEduWindowManager.java
@@ -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
@@ -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
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java
index 91e1e199719c..359ef979a310 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/ReachabilityEduWindowManagerTest.java
@@ -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;
@@ -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;
@@ -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(
@@ -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,
@@ -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) {
diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java
index 8075692e63af..da4d3cb79002 100644
--- a/services/core/java/com/android/server/wm/LetterboxUiController.java
+++ b/services/core/java/com/android/server/wm/LetterboxUiController.java
@@ -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
@@ -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();
@@ -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();
}
@@ -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();
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index aed876d4a5b3..f5c44d94160b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -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();