Account for magnetic detach when dismissing tasks in TAPL tests.
When the dismiss length is short, like in fixed landscape, we must account for a minimum distance to ensure dismissal Fix: 415773066 Test: TaplTestsQuickstep#testOverview Flag: EXEMPT Bugfix. Change-Id: I31a1a9e0bbd23145455df35937cf85ce8ac2c20f
This commit is contained in:
1 parent
2a6553ff9e
commit
015f0005b9
4 files changed
+26
-1
No files matched your search
@@ -219,6 +219,13 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
return getTISBinderUIProperty(Bundle::putInt, tisBinder ->
|
||||
tisBinder.getTaskbarManager().getPrimaryDisplayId());
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD: {
|
||||
final Resources resources = mContext.getResources();
|
||||
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
|
||||
resources.getDimensionPixelSize(R.dimen.task_dismiss_detach_threshold));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
return super.call(method, arg, extras);
|
||||
|
||||
@@ -186,6 +186,9 @@ public final class TestProtocol {
|
||||
|
||||
public static final String REQUEST_TASKBAR_PRIMARY_DISPLAY_ID = "taskbar-primary-display-id";
|
||||
|
||||
public static final String REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD =
|
||||
"dismiss-magnetic-detach-threshold";
|
||||
|
||||
/** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */
|
||||
public static void testLogD(String tag, String message) {
|
||||
if (!sDebugTracing) {
|
||||
|
||||
@@ -2713,4 +2713,10 @@ public final class LauncherInstrumentation {
|
||||
() -> "Didn't detect finishing wallpaper-open animation",
|
||||
actionName);
|
||||
}
|
||||
|
||||
/** Returns the magnetic detach threshold when dismissing a task view. */
|
||||
public int getMagneticDetachThreshold() {
|
||||
return getTestInfo(TestProtocol.REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD).getInt(
|
||||
TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
}
|
||||
@@ -185,8 +185,17 @@ public final class OverviewTask {
|
||||
final Rect taskBounds = mLauncher.getVisibleBounds(mTask);
|
||||
final int centerX = taskBounds.centerX();
|
||||
final int centerY = taskBounds.centerY();
|
||||
// Magnetic detach interpolates during the attached region with y = 0.3x. We must account
|
||||
// for this in the dismiss length to ensure the task is dragged far enough to dismiss.
|
||||
int magneticDetachLength = mLauncher.getMagneticDetachThreshold();
|
||||
int lengthTaskWillTravel =
|
||||
(int) ((magneticDetachLength * 0.3f) + (centerY - magneticDetachLength));
|
||||
int minimumDismissLength = taskBounds.bottom / 2;
|
||||
int extraDismissLength = Math.max(minimumDismissLength - lengthTaskWillTravel, 0);
|
||||
// Bound touch to a max of the bottom of the task, account for extra required dismiss length
|
||||
final int startY = Math.min(centerY + extraDismissLength, taskBounds.bottom);
|
||||
mLauncher.executeAndWaitForLauncherEvent(
|
||||
() -> mLauncher.linearGesture(centerX, centerY, centerX, 0, 10, false,
|
||||
() -> mLauncher.linearGesture(centerX, startY, centerX, 0, 10, false,
|
||||
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER),
|
||||
event -> TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE.equals(event.getClassName()),
|
||||
() -> "Didn't receive a dismiss animation ends message: " + centerX + ", "
|
||||
|
||||
Reference in new issue
Block a user