mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Merge "Unstash taskbar when transitioning to fallback overview." into tm-qpr-dev am: 98f400397b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20187724 Change-Id: I83f29014f6bd50a3bcb3fc2ebf964163438bbcbb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import static com.android.launcher3.taskbar.TaskbarStashController.TASKBAR_STASH
|
||||
|
||||
import android.animation.Animator;
|
||||
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.quickstep.RecentsActivity;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
@@ -70,12 +71,14 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
|
||||
* Currently this animation just force stashes the taskbar in Overview.
|
||||
*/
|
||||
public Animator createAnimToRecentsState(RecentsState toState, long duration) {
|
||||
boolean forceStashed = toState.hasOverviewActions();
|
||||
boolean useStashedLauncherState = toState.hasOverviewActions();
|
||||
boolean stashedLauncherState =
|
||||
useStashedLauncherState && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
|
||||
TaskbarStashController controller = mControllers.taskbarStashController;
|
||||
// Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected.
|
||||
// For all other states, just use the current stashed-in-app setting (e.g. if long clicked).
|
||||
controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, forceStashed);
|
||||
controller.updateStateForFlag(FLAG_IN_APP, !forceStashed);
|
||||
controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState);
|
||||
controller.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState);
|
||||
return controller.applyStateWithoutStart(duration);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
|
||||
"want to switch from background to overview")) {
|
||||
verifyActiveContainer();
|
||||
goToOverviewUnchecked();
|
||||
return mLauncher.isFallbackOverview()
|
||||
return mLauncher.is3PLauncher()
|
||||
? new BaseOverview(mLauncher) : new Overview(mLauncher);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class LaunchedAppState extends Background {
|
||||
public Taskbar getTaskbar() {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to get the taskbar")) {
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
return new Taskbar(mLauncher);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public final class LaunchedAppState extends Background {
|
||||
public void assertTaskbarHidden() {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"waiting for taskbar to be hidden")) {
|
||||
mLauncher.waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class LaunchedAppState extends Background {
|
||||
public void assertTaskbarVisible() {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"waiting for taskbar to be visible")) {
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,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_RES_ID);
|
||||
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
|
||||
final long downTime = SystemClock.uptimeMillis();
|
||||
final int unstashTargetY = mLauncher.getRealDisplaySize().y
|
||||
@@ -109,7 +109,7 @@ public final class LaunchedAppState extends Background {
|
||||
LauncherInstrumentation.log("showTaskbar: sent down");
|
||||
|
||||
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, unstashTarget,
|
||||
LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
|
||||
|
||||
|
||||
@@ -561,7 +561,7 @@ public final class LauncherInstrumentation {
|
||||
private String getVisibleStateMessage() {
|
||||
if (hasLauncherObject(CONTEXT_MENU_RES_ID)) return "Context Menu";
|
||||
if (hasLauncherObject(WIDGETS_RES_ID)) return "Widgets";
|
||||
if (hasLauncherObject(OVERVIEW_RES_ID)) return "Overview";
|
||||
if (hasSystemLauncherObject(OVERVIEW_RES_ID)) return "Overview";
|
||||
if (hasLauncherObject(WORKSPACE_RES_ID)) return "Workspace";
|
||||
if (hasLauncherObject(APPS_RES_ID)) return "AllApps";
|
||||
return "LaunchedApp (" + getVisiblePackages() + ")";
|
||||
@@ -773,73 +773,89 @@ public final class LauncherInstrumentation {
|
||||
switch (containerType) {
|
||||
case WORKSPACE: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
if (is3PLauncher() && isTablet()) {
|
||||
waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
} else {
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
|
||||
return waitForLauncherObject(WORKSPACE_RES_ID);
|
||||
}
|
||||
case WIDGETS: {
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
if (is3PLauncher() && isTablet()) {
|
||||
waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
} else {
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
|
||||
return waitForLauncherObject(WIDGETS_RES_ID);
|
||||
}
|
||||
case TASKBAR_ALL_APPS:
|
||||
case HOME_ALL_APPS: {
|
||||
case TASKBAR_ALL_APPS: {
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(APPS_RES_ID);
|
||||
}
|
||||
case OVERVIEW: {
|
||||
case HOME_ALL_APPS: {
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
if (is3PLauncher() && isTablet()) {
|
||||
waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
} else {
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
|
||||
return waitForLauncherObject(APPS_RES_ID);
|
||||
}
|
||||
case OVERVIEW:
|
||||
case FALLBACK_OVERVIEW: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(OVERVIEW_RES_ID);
|
||||
return waitForSystemLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case SPLIT_SCREEN_SELECT: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
|
||||
waitForLauncherObject(SPLIT_PLACEHOLDER_RES_ID);
|
||||
return waitForLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case FALLBACK_OVERVIEW: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForFallbackLauncherObject(OVERVIEW_RES_ID);
|
||||
waitForSystemLauncherObject(SPLIT_PLACEHOLDER_RES_ID);
|
||||
return waitForSystemLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case LAUNCHED_APP: {
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
if (mIgnoreTaskbarVisibility) {
|
||||
return null;
|
||||
}
|
||||
if (isTablet() && !isFallbackOverview()) {
|
||||
waitForLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
if (isTablet()) {
|
||||
waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
} else {
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -974,14 +990,9 @@ public final class LauncherInstrumentation {
|
||||
checkForAnomaly(false, true);
|
||||
|
||||
final Point displaySize = getRealDisplaySize();
|
||||
// The swipe up to home gesture starts from inside the launcher when the user is
|
||||
// already home. Otherwise, the gesture can start inside the launcher process if the
|
||||
// taskbar is visible.
|
||||
boolean gestureStartFromLauncher = isTablet()
|
||||
? !isLauncher3()
|
||||
|| hasLauncherObject(WORKSPACE_RES_ID)
|
||||
|| hasLauncherObject(TASKBAR_RES_ID)
|
||||
: isLauncherVisible();
|
||||
|
||||
boolean gestureStartFromLauncher =
|
||||
isTablet() ? !isLauncher3() : isLauncherVisible();
|
||||
|
||||
// CLose floating views before going back to home.
|
||||
swipeUpToCloseFloatingView(gestureStartFromLauncher);
|
||||
@@ -1014,7 +1025,7 @@ public final class LauncherInstrumentation {
|
||||
NORMAL_STATE_ORDINAL,
|
||||
!hasLauncherObject(WORKSPACE_RES_ID)
|
||||
&& (hasLauncherObject(APPS_RES_ID)
|
||||
|| hasLauncherObject(OVERVIEW_RES_ID)),
|
||||
|| hasSystemLauncherObject(OVERVIEW_RES_ID)),
|
||||
action);
|
||||
}
|
||||
try (LauncherInstrumentation.Closable c1 = addContextLayer(
|
||||
@@ -1070,7 +1081,8 @@ public final class LauncherInstrumentation {
|
||||
|
||||
boolean isLauncherContainerVisible() {
|
||||
final String[] containerResources = {WORKSPACE_RES_ID, OVERVIEW_RES_ID, APPS_RES_ID};
|
||||
return Arrays.stream(containerResources).anyMatch(r -> hasLauncherObject(r));
|
||||
return Arrays.stream(containerResources).anyMatch(
|
||||
r -> r.equals(OVERVIEW_RES_ID) ? hasSystemLauncherObject(r) : hasLauncherObject(r));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1153,6 +1165,14 @@ public final class LauncherInstrumentation {
|
||||
waitUntilGoneBySelector(getOverviewObjectSelector(resId));
|
||||
}
|
||||
|
||||
void waitUntilSystemLauncherObjectGone(String resId) {
|
||||
if (is3PLauncher()) {
|
||||
waitUntilOverviewObjectGone(resId);
|
||||
} else {
|
||||
waitUntilLauncherObjectGone(resId);
|
||||
}
|
||||
}
|
||||
|
||||
void waitUntilLauncherObjectGone(BySelector selector) {
|
||||
waitUntilGoneBySelector(makeLauncherSelector(selector));
|
||||
}
|
||||
@@ -1283,6 +1303,11 @@ public final class LauncherInstrumentation {
|
||||
return mDevice.hasObject(getLauncherObjectSelector(resId));
|
||||
}
|
||||
|
||||
private boolean hasSystemLauncherObject(String resId) {
|
||||
return mDevice.hasObject(is3PLauncher() ? getOverviewObjectSelector(resId)
|
||||
: getLauncherObjectSelector(resId));
|
||||
}
|
||||
|
||||
boolean hasLauncherObject(BySelector selector) {
|
||||
return mDevice.hasObject(makeLauncherSelector(selector));
|
||||
}
|
||||
@@ -1301,6 +1326,12 @@ public final class LauncherInstrumentation {
|
||||
return waitForObjectBySelector(getLauncherObjectSelector(resName));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 waitForSystemLauncherObject(String resName) {
|
||||
return is3PLauncher() ? waitForOverviewObject(resName)
|
||||
: waitForLauncherObject(resName);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 waitForLauncherObject(BySelector selector) {
|
||||
return waitForObjectBySelector(makeLauncherSelector(selector));
|
||||
@@ -1311,11 +1342,6 @@ public final class LauncherInstrumentation {
|
||||
return tryWaitForObjectBySelector(makeLauncherSelector(selector), timeout);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 waitForFallbackLauncherObject(String resName) {
|
||||
return waitForObjectBySelector(getOverviewObjectSelector(resName));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 waitForAndroidObject(String resId) {
|
||||
final UiObject2 object = TestHelpers.wait(
|
||||
@@ -1353,7 +1379,7 @@ public final class LauncherInstrumentation {
|
||||
return mDevice.getLauncherPackageName();
|
||||
}
|
||||
|
||||
boolean isFallbackOverview() {
|
||||
boolean is3PLauncher() {
|
||||
return !getOverviewPackageName().equals(getLauncherPackageName());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,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_RES_ID),
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID),
|
||||
AppIcon.getAppIconSelector(appName, mLauncher)));
|
||||
}
|
||||
}
|
||||
@@ -68,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_RES_ID);
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
final long downTime = SystemClock.uptimeMillis();
|
||||
Point stashTarget = new Point(
|
||||
@@ -79,7 +79,7 @@ public final class Taskbar {
|
||||
LauncherInstrumentation.log("hideTaskbar: sent down");
|
||||
|
||||
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
|
||||
mLauncher.waitUntilLauncherObjectGone("taskbar_view");
|
||||
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, stashTarget,
|
||||
LauncherInstrumentation.GestureScope.INSIDE);
|
||||
}
|
||||
@@ -97,7 +97,8 @@ public final class Taskbar {
|
||||
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
|
||||
|
||||
mLauncher.clickLauncherObject(mLauncher.waitForObjectInContainer(
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID), getAllAppsButtonSelector()));
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID),
|
||||
getAllAppsButtonSelector()));
|
||||
|
||||
return new AllAppsFromTaskbar(mLauncher);
|
||||
}
|
||||
@@ -108,7 +109,7 @@ public final class Taskbar {
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to get all taskbar icons")) {
|
||||
return mLauncher.waitForObjectsInContainer(
|
||||
mLauncher.waitForLauncherObject(TASKBAR_RES_ID),
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID),
|
||||
AppIcon.getAnyAppIconSelector())
|
||||
.stream()
|
||||
.map(UiObject2::getText)
|
||||
|
||||
Reference in New Issue
Block a user