Add support to Tapl to recreateTaskbar
Also moved references of "tasbkar_view" to share TASKBAR_RES_ID constant Test: compiles; see follow up CLs Bug: 235986838 Change-Id: I69bcfa975550e567f3daa35af8a810546297d79c
This commit is contained in:
+5
@@ -81,6 +81,11 @@ public abstract class DebugQuickstepTestInformationHandler extends QuickstepTest
|
||||
return response;
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_RECREATE_TASKBAR:
|
||||
// Allow null-pointer to catch illegal states.
|
||||
runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbar());
|
||||
return response;
|
||||
|
||||
default:
|
||||
response = super.call(method, arg, extras);
|
||||
if (response != null) return response;
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.view.Display;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
@@ -277,7 +278,8 @@ public class TaskbarManager {
|
||||
* we fully want to destroy an existing taskbar and create a new one.
|
||||
* In other case (folding/unfolding) we don't need to remove and add window.
|
||||
*/
|
||||
private void recreateTaskbar() {
|
||||
@VisibleForTesting
|
||||
public void recreateTaskbar() {
|
||||
DeviceProfile dp = mUserUnlocked ?
|
||||
LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_DISABLE_MANUAL_TASKBAR_STASHING = "disable-taskbar-stashing";
|
||||
public static final String REQUEST_UNSTASH_TASKBAR_IF_STASHED = "unstash-taskbar-if-stashed";
|
||||
public static final String REQUEST_STASHED_TASKBAR_HEIGHT = "stashed-taskbar-height";
|
||||
public static final String REQUEST_RECREATE_TASKBAR = "recreate-taskbar";
|
||||
public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
|
||||
public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y";
|
||||
public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y";
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_MANUAL_TASKBAR_STASHING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_MANUAL_TASKBAR_STASHING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_TASKBAR_HEIGHT;
|
||||
@@ -54,12 +55,22 @@ public final class LaunchedAppState extends Background {
|
||||
public Taskbar getTaskbar() {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to get the taskbar")) {
|
||||
mLauncher.waitForLauncherObject("taskbar_view");
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
return new Taskbar(mLauncher);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the taskbar to be hidden, or fails.
|
||||
*/
|
||||
public void assertTaskbarHidden() {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"waiting for taskbar to be hidden")) {
|
||||
mLauncher.waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Taskbar in a visible state.
|
||||
*
|
||||
@@ -71,7 +82,7 @@ public final class LaunchedAppState extends Background {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"want to show the taskbar")) {
|
||||
mLauncher.waitUntilLauncherObjectGone("taskbar_view");
|
||||
mLauncher.waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
|
||||
final long downTime = SystemClock.uptimeMillis();
|
||||
final int unstashTargetY = mLauncher.getRealDisplaySize().y
|
||||
@@ -85,7 +96,7 @@ public final class LaunchedAppState extends Background {
|
||||
LauncherInstrumentation.log("showTaskbar: sent down");
|
||||
|
||||
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
|
||||
mLauncher.waitForLauncherObject("taskbar_view");
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, unstashTarget,
|
||||
LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public final class LauncherInstrumentation {
|
||||
private static final String OVERVIEW_RES_ID = "overview_panel";
|
||||
private static final String WIDGETS_RES_ID = "primary_widgets_list_view";
|
||||
private static final String CONTEXT_MENU_RES_ID = "popup_container";
|
||||
private static final String TASKBAR_RES_ID = "taskbar_view";
|
||||
static final String TASKBAR_RES_ID = "taskbar_view";
|
||||
private static final String SPLIT_PLACEHOLDER_RES_ID = "split_placeholder";
|
||||
public static final int WAIT_TIME_MS = 30000;
|
||||
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
|
||||
@@ -1755,6 +1755,15 @@ public final class LauncherInstrumentation {
|
||||
getTestInfo(TestProtocol.REQUEST_UNSTASH_TASKBAR_IF_STASHED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreates the taskbar (outside of tests this is done for certain configuration changes).
|
||||
* The expected behavior is that the taskbar retains its current state after being recreated.
|
||||
* For example, if taskbar is currently stashed, it should still be stashed after recreating.
|
||||
*/
|
||||
public void recreateTaskbar() {
|
||||
getTestInfo(TestProtocol.REQUEST_RECREATE_TASKBAR);
|
||||
}
|
||||
|
||||
public List<String> getHotseatIconNames() {
|
||||
return getTestInfo(TestProtocol.REQUEST_HOTSEAT_ICON_NAMES)
|
||||
.getStringArrayList(TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_MANUAL_TASKBAR_STASHING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_MANUAL_TASKBAR_STASHING;
|
||||
|
||||
@@ -51,7 +52,7 @@ public final class Taskbar {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to get a taskbar icon")) {
|
||||
return new TaskbarAppIcon(mLauncher, mLauncher.waitForObjectInContainer(
|
||||
mLauncher.waitForLauncherObject("taskbar_view"),
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID),
|
||||
AppIcon.getAppIconSelector(appName, mLauncher)));
|
||||
}
|
||||
}
|
||||
@@ -67,7 +68,7 @@ public final class Taskbar {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to hide the taskbar");
|
||||
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
|
||||
mLauncher.waitForLauncherObject("taskbar_view");
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
final long downTime = SystemClock.uptimeMillis();
|
||||
Point stashTarget = new Point(
|
||||
@@ -96,7 +97,7 @@ public final class Taskbar {
|
||||
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
|
||||
|
||||
mLauncher.clickLauncherObject(mLauncher.waitForObjectInContainer(
|
||||
mLauncher.waitForLauncherObject("taskbar_view"), getAllAppsButtonSelector()));
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID), getAllAppsButtonSelector()));
|
||||
|
||||
return new AllAppsFromTaskbar(mLauncher);
|
||||
}
|
||||
@@ -107,7 +108,7 @@ public final class Taskbar {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to get all taskbar icons")) {
|
||||
return mLauncher.waitForObjectsInContainer(
|
||||
mLauncher.waitForLauncherObject("taskbar_view"),
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID),
|
||||
AppIcon.getAnyAppIconSelector())
|
||||
.stream()
|
||||
.map(UiObject2::getText)
|
||||
|
||||
Reference in New Issue
Block a user