mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Merge "Wait for shell drop target to be ready for handling drags in tests" into udc-dev am: 52cc03e42c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22935091 Change-Id: Ic7bf8ce725106c269b96cc6963cac22084898df9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -149,6 +149,11 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
case TestProtocol.REQUEST_DISABLE_TRANSIENT_TASKBAR:
|
||||
enableTransientTaskbar(false);
|
||||
return response;
|
||||
|
||||
case TestProtocol.REQUEST_SHELL_DRAG_READY:
|
||||
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
|
||||
SystemUiProxy.INSTANCE.get(mContext).isDragAndDropReady());
|
||||
return response;
|
||||
}
|
||||
|
||||
return super.call(method, arg, extras);
|
||||
|
||||
@@ -70,6 +70,7 @@ import com.android.systemui.unfold.progress.IUnfoldAnimation;
|
||||
import com.android.systemui.unfold.progress.IUnfoldTransitionListener;
|
||||
import com.android.wm.shell.back.IBackAnimation;
|
||||
import com.android.wm.shell.desktopmode.IDesktopMode;
|
||||
import com.android.wm.shell.draganddrop.IDragAndDrop;
|
||||
import com.android.wm.shell.onehanded.IOneHanded;
|
||||
import com.android.wm.shell.pip.IPip;
|
||||
import com.android.wm.shell.pip.IPipAnimationListener;
|
||||
@@ -128,6 +129,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
private IBinder mOriginalTransactionToken = null;
|
||||
private IOnBackInvokedCallback mBackToLauncherCallback;
|
||||
private IRemoteAnimationRunner mBackToLauncherRunner;
|
||||
private IDragAndDrop mDragAndDrop;
|
||||
|
||||
// Used to dedupe calls to SystemUI
|
||||
private int mLastShelfHeight;
|
||||
@@ -203,7 +205,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
IStartingWindow startingWindow, IRecentTasks recentTasks,
|
||||
ISysuiUnlockAnimationController sysuiUnlockAnimationController,
|
||||
IBackAnimation backAnimation, IDesktopMode desktopMode,
|
||||
IUnfoldAnimation unfoldAnimation) {
|
||||
IUnfoldAnimation unfoldAnimation, IDragAndDrop dragAndDrop) {
|
||||
unlinkToDeath();
|
||||
mSystemUiProxy = proxy;
|
||||
mPip = pip;
|
||||
@@ -216,6 +218,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
mBackAnimation = backAnimation;
|
||||
mDesktopMode = desktopMode;
|
||||
mUnfoldAnimation = unfoldAnimation;
|
||||
mDragAndDrop = dragAndDrop;
|
||||
linkToDeath();
|
||||
// re-attach the listeners once missing due to setProxy has not been initialized yet.
|
||||
setPipAnimationListener(mPipAnimationListener);
|
||||
@@ -230,7 +233,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
}
|
||||
|
||||
public void clearProxy() {
|
||||
setProxy(null, null, null, null, null, null, null, null, null, null, null);
|
||||
setProxy(null, null, null, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
// TODO(141886704): Find a way to remove this
|
||||
@@ -1099,6 +1102,11 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
Log.e(TAG, "Failed call setUnfoldAnimationListener", e);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Recents
|
||||
//
|
||||
|
||||
/**
|
||||
* Starts the recents activity. The caller should manage the thread on which this is called.
|
||||
*/
|
||||
@@ -1131,10 +1139,30 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
try {
|
||||
mRecentTasks.startRecentsTransition(mRecentsPendingIntent, intent, optsBundle,
|
||||
mContext.getIApplicationThread(), runner);
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error starting recents via shell", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Drag and drop
|
||||
//
|
||||
|
||||
/**
|
||||
* For testing purposes. Returns `true` only if the shell drop target has shown and
|
||||
* drawn and is ready to handle drag events and the subsequent drop.
|
||||
*/
|
||||
public boolean isDragAndDropReady() {
|
||||
if (mDragAndDrop == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return mDragAndDrop.isReadyToHandleDrag();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error querying drag state", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_DESKTOP_MODE;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_DRAG_AND_DROP;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_ONE_HANDED;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_PIP;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_RECENT_TASKS;
|
||||
@@ -125,6 +126,7 @@ import com.android.systemui.shared.tracing.ProtoTraceable;
|
||||
import com.android.systemui.unfold.progress.IUnfoldAnimation;
|
||||
import com.android.wm.shell.back.IBackAnimation;
|
||||
import com.android.wm.shell.desktopmode.IDesktopMode;
|
||||
import com.android.wm.shell.draganddrop.IDragAndDrop;
|
||||
import com.android.wm.shell.onehanded.IOneHanded;
|
||||
import com.android.wm.shell.pip.IPip;
|
||||
import com.android.wm.shell.recents.IRecentTasks;
|
||||
@@ -185,11 +187,13 @@ public class TouchInteractionService extends Service
|
||||
bundle.getBinder(KEY_EXTRA_SHELL_DESKTOP_MODE));
|
||||
IUnfoldAnimation unfoldTransition = IUnfoldAnimation.Stub.asInterface(
|
||||
bundle.getBinder(KEY_EXTRA_UNFOLD_ANIMATION_FORWARDER));
|
||||
IDragAndDrop dragAndDrop = IDragAndDrop.Stub.asInterface(
|
||||
bundle.getBinder(KEY_EXTRA_SHELL_DRAG_AND_DROP));
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy, pip,
|
||||
splitscreen, onehanded, shellTransitions, startingWindow,
|
||||
recentTasks, launcherUnlockAnimationController, backAnimation, desktopMode,
|
||||
unfoldTransition);
|
||||
unfoldTransition, dragAndDrop);
|
||||
TouchInteractionService.this.initInputMonitor("TISBinder#onInitialize()");
|
||||
preloadOverview(true /* fromInit */);
|
||||
});
|
||||
|
||||
@@ -111,6 +111,7 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_IS_TABLET = "is-tablet";
|
||||
public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
|
||||
public static final String REQUEST_START_DRAG_THRESHOLD = "start-drag-threshold";
|
||||
public static final String REQUEST_SHELL_DRAG_READY = "shell-drag-ready";
|
||||
public static final String REQUEST_GET_ACTIVITIES_CREATED_COUNT =
|
||||
"get-activities-created-count";
|
||||
public static final String REQUEST_GET_ACTIVITIES = "get-activities";
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.DEFAULT_POLL_INTERVAL;
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID;
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_MANUAL_TASKBAR_STASHING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_BLOCK_TIMEOUT;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_MANUAL_TASKBAR_STASHING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_SHELL_DRAG_READY;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_TASKBAR_HEIGHT;
|
||||
|
||||
import android.graphics.Point;
|
||||
@@ -146,6 +149,12 @@ public final class LaunchedAppState extends Background {
|
||||
|
||||
try (LauncherInstrumentation.Closable c2 = launcher.addContextLayer(
|
||||
"started item drag")) {
|
||||
launcher.assertTrue("Shell drag not marked as ready", launcher.waitAndGet(() -> {
|
||||
LauncherInstrumentation.log("Checking shell drag ready");
|
||||
return launcher.getTestInfo(REQUEST_SHELL_DRAG_READY)
|
||||
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, false);
|
||||
}, WAIT_TIME_MS, DEFAULT_POLL_INTERVAL));
|
||||
|
||||
launcher.movePointer(
|
||||
dragStart,
|
||||
endPoint,
|
||||
|
||||
Reference in New Issue
Block a user