Don't force double-tap education on unfold
The CL changes the way double-tap is detected for the compat ui update to avoid false detection due to unfolding. Fixes: 275054305 Test: manual Change-Id: Ic325a180bffef81262b281a7c3b306d45265776c
This commit is contained in:
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -242,6 +242,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
|
||||
@@ -834,6 +836,12 @@ final class LetterboxUiController {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFromDoubleTap() {
|
||||
final boolean isFromDoubleTap = mDoubleTapEvent;
|
||||
mDoubleTapEvent = false;
|
||||
return isFromDoubleTap;
|
||||
}
|
||||
|
||||
SurfaceControl getLetterboxParentSurface() {
|
||||
if (mActivityRecord.isInLetterboxAnimation()) {
|
||||
return mActivityRecord.getTask().getSurfaceControl();
|
||||
@@ -1011,7 +1019,7 @@ final class LetterboxUiController {
|
||||
: LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__LEFT_TO_CENTER;
|
||||
logLetterboxPositionChange(changeToLog);
|
||||
}
|
||||
|
||||
mDoubleTapEvent = true;
|
||||
// TODO(197549949): Add animation for transition.
|
||||
mActivityRecord.recomputeConfiguration();
|
||||
}
|
||||
@@ -1050,7 +1058,7 @@ final class LetterboxUiController {
|
||||
: LETTERBOX_POSITION_CHANGED__POSITION_CHANGE__TOP_TO_CENTER;
|
||||
logLetterboxPositionChange(changeToLog);
|
||||
}
|
||||
|
||||
mDoubleTapEvent = true;
|
||||
// TODO(197549949): Add animation for transition.
|
||||
mActivityRecord.recomputeConfiguration();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user