Merge "Cleanup logs" into main
diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java
index 6279f63..28d4bf8 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java
@@ -57,6 +57,7 @@
public static final String NAMESPACE_LAUNCHER = "launcher";
private static final List<DebugFlag> sDebugFlags = new ArrayList<>();
+ private static final List<IntFlag> sIntFlags = new ArrayList<>();
private static SharedPreferences sSharedPreferences;
static final BooleanFlag TEAMFOOD_FLAG = getReleaseFlag(
@@ -132,7 +133,14 @@
public static IntFlag getIntFlag(
int bugId, String key, int defaultValueInCode, String description) {
INSTANCE.mKeySet.add(key);
- return new IntFlag(DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode));
+ int defaultValue = DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode);
+ if (IS_DEBUG_DEVICE) {
+ IntDeviceFlag flag = new IntDeviceFlag(key, defaultValue, defaultValueInCode);
+ sIntFlags.add(flag);
+ return flag;
+ } else {
+ return new IntFlag(defaultValue);
+ }
}
static List<DebugFlag> getDebugFlags() {
@@ -163,13 +171,20 @@
return;
}
pw.println("DeviceFlags:");
+ pw.println(" BooleanFlags:");
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {
if (flag instanceof DeviceFlag) {
- pw.println(" " + flag);
+ pw.println(" " + flag);
}
}
}
+ pw.println(" IntFlags:");
+ synchronized (sIntFlags) {
+ for (IntFlag flag : sIntFlags) {
+ pw.println(" " + flag);
+ }
+ }
pw.println("DebugFlags:");
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {
diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java b/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java
new file mode 100644
index 0000000..4f3b0ae
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.uioverrides.flags;
+
+import com.android.launcher3.config.FeatureFlags.IntFlag;
+
+public class IntDeviceFlag extends IntFlag {
+ public final String key;
+ private final int mDefaultValueInCode;
+
+ public IntDeviceFlag(String key, int currentValue, int defaultValueInCode) {
+ super(currentValue);
+ this.key = key;
+ mDefaultValueInCode = defaultValueInCode;
+ }
+
+ @Override
+ public String toString() {
+ return key + ": mCurrentValue=" + get() + ", defaultValueInCode=" + mDefaultValueInCode;
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index f801b3b..221ce48 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -106,10 +106,10 @@
});
return response;
- case TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD: {
+ case TestProtocol.REQUEST_STASHED_TASKBAR_HEIGHT: {
final Resources resources = mContext.getResources();
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- resources.getDimensionPixelSize(R.dimen.taskbar_from_nav_threshold));
+ resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size));
return response;
}
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 8d26fd4..db5ad82 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -23,9 +23,9 @@
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
+import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.NavigationMode.NO_BUTTON;
import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS;
-import static com.android.launcher3.util.NavigationMode.TWO_BUTTONS;
import static com.android.launcher3.util.SettingsCache.ONE_HANDED_ENABLED;
import static com.android.launcher3.util.SettingsCache.ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
@@ -55,8 +55,11 @@
import android.os.RemoteException;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.util.Log;
+import android.view.ISystemGestureExclusionListener;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
+import android.view.WindowManagerGlobal;
import androidx.annotation.BinderThread;
import androidx.annotation.NonNull;
@@ -74,7 +77,6 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
-import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -86,6 +88,8 @@
*/
public class RecentsAnimationDeviceState implements DisplayInfoChangeListener {
+ private static final String TAG = "RecentsAnimationDeviceState";
+
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
// TODO: Move to quickstep contract
@@ -95,6 +99,23 @@
private final Context mContext;
private final DisplayController mDisplayController;
private final int mDisplayId;
+
+ private final ISystemGestureExclusionListener mGestureExclusionListener =
+ new ISystemGestureExclusionListener.Stub() {
+ @BinderThread
+ @Override
+ public void onSystemGestureExclusionChanged(int displayId,
+ Region systemGestureExclusionRegion, Region unrestrictedOrNull) {
+ if (displayId != mDisplayId) {
+ return;
+ }
+ // Assignments are atomic, it should be safe on binder thread. Also we don't
+ // think systemGestureExclusionRegion can be null but just in case, don't let
+ // mExclusionRegion be null.
+ mExclusionRegion = systemGestureExclusionRegion != null
+ ? systemGestureExclusionRegion : new Region();
+ }
+ };
private final RotationTouchHelper mRotationTouchHelper;
private final TaskStackChangeListener mPipListener;
// Cache for better performance since it doesn't change at runtime.
@@ -118,7 +139,7 @@
private int mGestureBlockingTaskId = -1;
private @NonNull Region mExclusionRegion = new Region();
- private SystemGestureExclusionListenerCompat mExclusionListener;
+ private boolean mExclusionListenerRegistered;
public RecentsAnimationDeviceState(Context context) {
this(context, false);
@@ -142,19 +163,7 @@
}
// Register for exclusion updates
- mExclusionListener = new SystemGestureExclusionListenerCompat(mDisplayId) {
- @Override
- @BinderThread
- public void onExclusionChanged(Region region) {
- if (region == null) {
- // Don't think this is possible but just in case, don't let it be null.
- region = new Region();
- }
- // Assignments are atomic, it should be safe on binder thread
- mExclusionRegion = region;
- }
- };
- runOnDestroy(mExclusionListener::unregister);
+ runOnDestroy(() -> unregisterExclusionListener());
// Register for display changes changes
mDisplayController.addChangeListener(this);
@@ -247,13 +256,54 @@
mNavBarPosition = new NavBarPosition(mMode, info);
if (mMode == NO_BUTTON) {
- mExclusionListener.register();
+ registerExclusionListener();
} else {
- mExclusionListener.unregister();
+ unregisterExclusionListener();
}
}
}
+ /**
+ * Registers {@link mGestureExclusionListener} for getting exclusion rect changes. Note that we
+ * make binder call on {@link UI_HELPER_EXECUTOR} to avoid jank.
+ */
+ public void registerExclusionListener() {
+ UI_HELPER_EXECUTOR.execute(() -> {
+ if (mExclusionListenerRegistered) {
+ return;
+ }
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .registerSystemGestureExclusionListener(
+ mGestureExclusionListener, mDisplayId);
+ mExclusionListenerRegistered = true;
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to register window manager callbacks", e);
+ }
+ });
+ }
+
+ /**
+ * Unregisters {@link mGestureExclusionListener} if previously registered. We make binder call
+ * on same {@link UI_HELPER_EXECUTOR} as in {@link #registerExclusionListener()} so that
+ * read/write {@link mExclusionListenerRegistered} field is thread safe.
+ */
+ public void unregisterExclusionListener() {
+ UI_HELPER_EXECUTOR.execute(() -> {
+ if (!mExclusionListenerRegistered) {
+ return;
+ }
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .unregisterSystemGestureExclusionListener(
+ mGestureExclusionListener, mDisplayId);
+ mExclusionListenerRegistered = false;
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to unregister window manager callbacks", e);
+ }
+ });
+ }
+
public void onOneHandedModeChanged(int newGesturalHeight) {
mRotationTouchHelper.setGesturalHeight(newGesturalHeight);
}
@@ -280,13 +330,6 @@
}
/**
- * @return whether the current nav mode is 2-button-based.
- */
- public boolean isTwoButtonNavMode() {
- return mMode == TWO_BUTTONS;
- }
-
- /**
* @return whether the current nav mode is button-based.
*/
public boolean isButtonNavMode() {
@@ -391,13 +434,6 @@
}
/**
- * @return whether notification panel is expanded
- */
- public boolean isNotificationPanelExpanded() {
- return (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) != 0;
- }
-
- /**
* @return whether the global actions dialog is showing
*/
public boolean isSystemUiDialogShowing() {
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index db9d308..00d8008 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -400,6 +400,17 @@
}
@Override
+ public void animateNavBarLongPress(boolean isTouchDown, long durationMs) {
+ if (mSystemUiProxy != null) {
+ try {
+ mSystemUiProxy.animateNavBarLongPress(isTouchDown, durationMs);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed call animateNavBarLongPress", e);
+ }
+ }
+ }
+
+ @Override
public void notifyAccessibilityButtonClicked(int displayId) {
if (mSystemUiProxy != null) {
try {
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
index 32f7bd5..07c85bb 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java
@@ -38,7 +38,6 @@
private final NavHandleLongPressHandler mNavHandleLongPressHandler;
private final float mNavHandleWidth;
private final float mScreenWidth;
- private final ViewConfiguration mViewConfiguration;
private final Runnable mTriggerLongPress = this::triggerLongPress;
private final float mTouchSlopSquared;
@@ -49,7 +48,6 @@
public NavHandleLongPressInputConsumer(Context context, InputConsumer delegate,
InputMonitorCompat inputMonitor, RecentsAnimationDeviceState deviceState) {
super(delegate, inputMonitor);
- mViewConfiguration = ViewConfiguration.get(context);
mNavHandleWidth = context.getResources().getDimensionPixelSize(
R.dimen.navigation_home_handle_width);
mScreenWidth = DisplayController.INSTANCE.get(context).getInfo().currentSize.x;
@@ -69,6 +67,18 @@
@Override
public void onMotionEvent(MotionEvent ev) {
+ if (mDelegate.allowInterceptByParent()) {
+ handleMotionEvent(ev);
+ } else if (MAIN_EXECUTOR.getHandler().hasCallbacks(mTriggerLongPress)) {
+ cancelLongPress();
+ }
+
+ if (mState != STATE_ACTIVE) {
+ mDelegate.onMotionEvent(ev);
+ }
+ }
+
+ private void handleMotionEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN -> {
if (mCurrentDownEvent != null) {
@@ -103,10 +113,6 @@
MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress);
MAIN_EXECUTOR.getHandler().post(mTriggerLongPress);
}
-
- if (mState != STATE_ACTIVE) {
- mDelegate.onMotionEvent(ev);
- }
}
private void triggerLongPress() {
diff --git a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java
index 67af7ec..ba9ae67 100644
--- a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java
@@ -31,7 +31,6 @@
import com.android.launcher3.util.TestUtil;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Assume;
import java.util.List;
@@ -87,11 +86,6 @@
taskbarIconNames, hotseatIconNames);
}
- if (!isTaskbarInTransientMode(mTargetContext)) {
- Assert.assertEquals("Persistent taskbar should fill screen width",
- taskbar.getVisibleBounds().width(), mLauncher.getRealDisplaySize().x);
- }
-
return taskbar;
}
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 16235e0..12568ea 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -162,6 +162,7 @@
@Before
public void setUp() {
mLauncher.onTestStart();
+ AbstractLauncherUiTest.waitForSetupWizardDismissal();
AbstractLauncherUiTest.verifyKeyguardInvisible();
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
index c9e536a..9a2826d 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
@@ -20,10 +20,9 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
-import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,10 +32,17 @@
@Test
@TaskbarModeSwitch(mode = PERSISTENT)
- @PortraitLandscape
- @NavigationModeSwitch
- public void testTaskbarFillsWidth() {
- // Width check is performed inside TAPL whenever getTaskbar() is called.
- getTaskbar();
+ public void testHideShowTaskbar() {
+ getTaskbar().hide();
+ mLauncher.getLaunchedAppState().showTaskbar();
+ }
+
+ @Test
+ @TaskbarModeSwitch(mode = PERSISTENT)
+ @Ignore // b/301575789
+ public void testHideTaskbarPersistsOnRecreate() {
+ getTaskbar().hide();
+ mLauncher.recreateTaskbar();
+ mLauncher.getLaunchedAppState().assertTaskbarHidden();
}
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 1aee794..4075c55 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -16,6 +16,7 @@
package com.android.quickstep;
+import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT;
import static org.junit.Assert.assertEquals;
@@ -297,7 +298,7 @@
@Test
@ScreenRecord // b/242163205
@PlatinumTest(focusArea = "launcher")
- @TaskbarModeSwitch
+ @TaskbarModeSwitch(mode = PERSISTENT)
public void testQuickSwitchToPreviousAppForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
startTestActivity(2);
@@ -306,28 +307,18 @@
// Set ignoreTaskbarVisibility to true to verify the task bar visibility explicitly.
mLauncher.setIgnoreTaskbarVisibility(true);
- try {
- // Expect task bar invisible when the launched app was the IME activity.
- LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
- launchedAppState.assertTaskbarHidden();
+ // Expect task bar invisible when the launched app was the IME activity.
+ LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.assertTaskbarHidden();
- // Quick-switch to the test app with swiping to right.
- quickSwitchToPreviousAppAndAssert(true /* toRight */);
+ // Quick-switch to the test app with swiping to right.
+ quickSwitchToPreviousAppAndAssert(true /* toRight */);
- assertTestActivityIsRunning(2,
- "The first app we should have quick switched to is not running");
- launchedAppState = getAndAssertLaunchedApp();
- boolean isTransientTaskbar = mLauncher.isTransientTaskbar();
- if (isTransientTaskbar) {
- launchedAppState.assertTaskbarHidden();
- } else {
- // Expect taskbar visible when the launched app was the test activity.
- launchedAppState.assertTaskbarVisible();
- }
- } finally {
- // Reset ignoreTaskbarVisibility to ensure other tests still verify it.
- mLauncher.setIgnoreTaskbarVisibility(false);
- }
+ assertTestActivityIsRunning(2,
+ "The first app we should have quick switched to is not running");
+ // Expect task bar visible when the launched app was the test activity.
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.assertTaskbarVisible();
}
@Test
@@ -345,7 +336,6 @@
@Test
@PortraitLandscape
@NavigationModeSwitch
- @PlatinumTest(focusArea = "launcher")
public void testPressBack() throws Exception {
InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
READ_DEVICE_CONFIG_PERMISSION);
@@ -363,7 +353,7 @@
@Test
@PortraitLandscape
- @TaskbarModeSwitch()
+ @TaskbarModeSwitch(mode = PERSISTENT)
@PlatinumTest(focusArea = "launcher")
@ScreenRecord
public void testOverviewForTablet() throws Exception {
@@ -458,7 +448,6 @@
@Test
@PortraitLandscape
- @TaskbarModeSwitch
public void testTaskbarDeadzonesForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
@@ -471,29 +460,15 @@
launcher -> assertTrue("Should have at least 3 tasks",
getTaskCount(launcher) >= 3));
- if (mLauncher.isTransientTaskbar()) {
- // On transient taskbar, it should dismiss when tapping outside taskbar bounds.
- overview.touchTaskbarBottomCorner(/* tapRight= */ false);
- assertTrue("Launcher internal state should be Normal",
- isInState(() -> LauncherState.NORMAL));
+ // On persistent taskbar, it should not dismiss when tapping the taskbar
+ overview.touchTaskbarBottomCorner(/* tapRight= */ false);
+ assertTrue("Launcher internal state should be Overview",
+ isInState(() -> LauncherState.OVERVIEW));
- overview = mLauncher.getWorkspace().switchToOverview();
-
- // On transient taskbar, it should dismiss when tapping outside taskbar bounds.
- overview.touchTaskbarBottomCorner(/* tapRight= */ true);
- assertTrue("Launcher internal state should be Normal",
- isInState(() -> LauncherState.NORMAL));
- } else {
- // On persistent taskbar, it should not dismiss when tapping the taskbar
- overview.touchTaskbarBottomCorner(/* tapRight= */ false);
- assertTrue("Launcher internal state should be Overview",
- isInState(() -> LauncherState.OVERVIEW));
-
- // On persistent taskbar, it should not dismiss when tapping the taskbar
- overview.touchTaskbarBottomCorner(/* tapRight= */ true);
- assertTrue("Launcher internal state should be Overview",
- isInState(() -> LauncherState.OVERVIEW));
- }
+ // On persistent taskbar, it should not dismiss when tapping the taskbar
+ overview.touchTaskbarBottomCorner(/* tapRight= */ true);
+ assertTrue("Launcher internal state should be Overview",
+ isInState(() -> LauncherState.OVERVIEW));
}
@Test
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
index 7109bbf..db23cc0 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
@@ -24,7 +24,6 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.Test;
@@ -65,12 +64,4 @@
getTaskbar().getAppIcon(TEST_APP_NAME).launch(TEST_APP_PACKAGE);
mLauncher.getLaunchedAppState().clickStashedTaskbarToGoHome();
}
-
- @Test
- @TaskbarModeSwitch(mode = TRANSIENT)
- @PortraitLandscape
- public void testSwipeToStashAndUnstash() {
- getTaskbar().swipeDownToStash();
- mLauncher.getLaunchedAppState().swipeUpToUnstashTaskbar();
- }
}
diff --git a/res/values-kn/strings.xml b/res/values-kn/strings.xml
index 39f1477..138e1b3 100644
--- a/res/values-kn/strings.xml
+++ b/res/values-kn/strings.xml
@@ -133,7 +133,7 @@
<string name="widgets_list_closed" msgid="6141506579418771922">"ವಿಜೆಟ್ ಪಟ್ಟಿಯನ್ನು ಮುಚ್ಚಲಾಗಿದೆ"</string>
<string name="action_add_to_workspace" msgid="215894119683164916">"ಹೋಮ್ ಸ್ಕ್ರೀನ್ಗೆ ಸೇರಿಸಿ"</string>
<string name="action_move_here" msgid="2170188780612570250">"ಐಟಂ ಇಲ್ಲಿಗೆ ಸರಿಸಿ"</string>
- <string name="item_added_to_workspace" msgid="4211073925752213539">"ಮುಖಪುಟ ಪರದೆಗೆ ಐಟಂ ಸೇರಿಸಲಾಗಿದೆ"</string>
+ <string name="item_added_to_workspace" msgid="4211073925752213539">"ಹೋಮ್ ಸ್ಕ್ರೀನ್ಗೆ ಐಟಂ ಸೇರಿಸಲಾಗಿದೆ"</string>
<string name="item_removed" msgid="851119963877842327">"ಐಟಂ ತೆಗೆದುಹಾಕಲಾಗಿದೆ"</string>
<string name="undo" msgid="4151576204245173321">"ರದ್ದುಮಾಡಿ"</string>
<string name="action_move" msgid="4339390619886385032">"ಐಟಂ ಸರಿಸಿ"</string>
diff --git a/src/com/android/launcher3/LauncherPrefs.kt b/src/com/android/launcher3/LauncherPrefs.kt
index 4f8caab..aa06089 100644
--- a/src/com/android/launcher3/LauncherPrefs.kt
+++ b/src/com/android/launcher3/LauncherPrefs.kt
@@ -334,21 +334,21 @@
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT =
nonRestorableItem(
"pref_long_press_nav_handle_haptic_hint_end_scale_percent",
- 50,
+ 100,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT =
nonRestorableItem(
"pref_long_press_nav_handle_haptic_hint_scale_exponent",
- 2,
+ 1,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS =
nonRestorableItem(
"pref_long_press_nav_handle_haptic_hint_iterations",
- 40,
+ 50,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index c783ee1..73861c1 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -119,6 +119,10 @@
getReleaseFlag(301680992, "CUSTOM_LPNH_THRESHOLDS", DISABLED,
"Add dev options to customize the LPNH trigger slop and milliseconds");
+ public static final BooleanFlag ANIMATE_LPNH =
+ getReleaseFlag(308693847, "ANIMATE_LPNH", TEAMFOOD,
+ "Animates navbar when long pressing");
+
public static final IntFlag LPNH_SLOP_PERCENTAGE =
getIntFlag(301680992, "LPNH_SLOP_PERCENTAGE", 100,
"Controls touch slop percentage for lpnh");
@@ -271,7 +275,7 @@
"Enables long pressing on the bottom bar nav handle to trigger events.");
public static final BooleanFlag ENABLE_SEARCH_HAPTIC_HINT =
- getReleaseFlag(303023676, "ENABLE_SEARCH_HAPTIC_HINT", TEAMFOOD,
+ getReleaseFlag(303023676, "ENABLE_SEARCH_HAPTIC_HINT", ENABLED,
"Enables haptic hint when long pressing on the bottom bar nav handle.");
// TODO(Block 17): Clean up flags
diff --git a/src/com/android/launcher3/graphics/GridCustomizationsProvider.java b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
index 18200f6..69fa673 100644
--- a/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
+++ b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
@@ -169,6 +169,9 @@
LauncherPrefs.get(getContext())
.put(THEMED_ICONS, values.getAsBoolean(BOOLEAN_VALUE));
getContext().getContentResolver().notifyChange(uri, null);
+ mActivePreviews.values().forEach(observer ->
+ observer.renderer.refreshIcons()
+ );
return 1;
}
default:
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 3330448..346f644 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -35,9 +35,12 @@
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.ContextWrapper;
+import android.content.pm.LauncherActivityInfo;
+import android.content.pm.LauncherApps;
import android.content.res.TypedArray;
import android.graphics.PointF;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
@@ -76,6 +79,7 @@
import com.android.launcher3.celllayout.CellPosMapper;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.FolderIcon;
+import com.android.launcher3.icons.IconProvider;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
@@ -83,6 +87,7 @@
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.InstallSessionHelper;
@@ -188,6 +193,8 @@
private final SparseIntArray mWallpaperColorResources;
private final SparseArray<Size> mLauncherWidgetSpanInfo;
+ private final Map<BubbleTextView, WorkspaceItemInfo> mIcons = new HashMap<>();
+
public LauncherPreviewRenderer(Context context,
InvariantDeviceProfile idp,
WallpaperColors wallpaperColorsOverride,
@@ -366,11 +373,43 @@
return CellPosMapper.DEFAULT;
}
+ /**
+ * Refreshes icon to update based on resource changes.
+ */
+ public void refreshIcons() {
+ mUiHandler.post(() -> {
+ IconProvider iconProvider = null;
+ int iconDpi = -1;
+ for (Map.Entry<BubbleTextView, WorkspaceItemInfo> entry : mIcons.entrySet()) {
+ BubbleTextView icon = entry.getKey();
+ ItemInfoWithIcon info = entry.getValue();
+ // get monochrome themed icon if it was not initially cached
+ if (info.bitmap.getMono() == null) {
+ if (iconProvider == null || iconDpi == -1) {
+ LauncherAppState appState = LauncherAppState.getInstance(mContext);
+ iconProvider = appState.getIconProvider();
+ iconDpi = appState.getInvariantDeviceProfile().fillResIconDpi;
+ }
+ LauncherActivityInfo activityInfo = mContext.getSystemService(
+ LauncherApps.class)
+ .resolveActivity(info.getIntent(), info.user);
+ Drawable iconDrawable = iconProvider.getIcon(activityInfo, iconDpi);
+ LauncherIcons iconFactory = LauncherIcons.obtain(mContext);
+ info.bitmap = iconFactory.createBadgedIconBitmap(iconDrawable);
+ }
+ // update icon based on whether themed icon is enabled
+ icon.reapplyItemInfo(info);
+ }
+ }
+ );
+ }
+
private void inflateAndAddIcon(WorkspaceItemInfo info) {
CellLayout screen = mWorkspaceScreens.get(info.screenId);
BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
R.layout.app_icon, screen, false);
icon.applyFromWorkspaceItem(info);
+ mIcons.put(icon, info);
addInScreenFromBind(icon, info);
}
@@ -477,6 +516,8 @@
currentWorkspaceItems, otherWorkspaceItems);
filterCurrentWorkspaceItems(currentScreenIds, dataModel.appWidgets, currentAppWidgets,
otherAppWidgets);
+
+ mIcons.clear();
for (ItemInfo itemInfo : currentWorkspaceItems) {
switch (itemInfo.itemType) {
case Favorites.ITEM_TYPE_APPLICATION:
diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java
index 683354b..1bac765 100644
--- a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java
+++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java
@@ -201,6 +201,13 @@
}
}
+ /**
+ * Refreshes icon to update based on resource changes.
+ */
+ public void refreshIcons() {
+ mRenderer.refreshIcons();
+ }
+
/***
* Generates a new context overriding the theme color and the display size without affecting the
* main application context
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index d9641ad..0438e57 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -47,7 +47,6 @@
import com.android.launcher3.testing.shared.HotseatCellCenterRequest;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.testing.shared.WorkspaceCellCenterRequest;
-import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ResourceBasedOverride;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
@@ -171,11 +170,6 @@
mDeviceProfile.numShownAllAppsColumns);
return response;
- case TestProtocol.REQUEST_IS_TRANSIENT_TASKBAR:
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- DisplayController.isTransientTaskbar(mContext));
- return response;
-
case TestProtocol.REQUEST_IS_TWO_PANELS:
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
FOLDABLE_SINGLE_PAGE.get() ? false : mDeviceProfile.isTwoPanels);
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 788f9cf..26ab5b4 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -71,7 +71,7 @@
private static final String TAG = "DisplayController";
private static final boolean DEBUG = false;
- private static boolean sTransientTaskbarStatusForTests = true;
+ private static boolean sTransientTaskbarStatusForTests;
// TODO(b/254119092) remove all logs with this tag
public static final String TASKBAR_NOT_DESTROYED_TAG = "b/254119092";
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index a1cd697..e4df413 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -41,7 +41,6 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Utilities;
-import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.TouchController;
@@ -560,8 +559,7 @@
DeviceProfile dp = mActivity.getDeviceProfile();
if (dp.isTaskbarPresent) {
// Ignore taskbar gesture insets to avoid interfering with TouchControllers.
- gestureInsetBottom = ResourceUtils.getNavbarSize(
- ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources());
+ gestureInsetBottom = Math.max(0, gestureInsetBottom - dp.taskbarHeight);
}
mSystemGestureRegion.set(
Math.max(gestureInsets.left, imeInset.left),
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index fd8a95a..3e80e6b 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -93,9 +93,8 @@
public static final String REQUEST_DISABLE_BLOCK_TIMEOUT = "disable-block-timeout";
public static final String REQUEST_ENABLE_TRANSIENT_TASKBAR = "enable-transient-taskbar";
public static final String REQUEST_DISABLE_TRANSIENT_TASKBAR = "disable-transient-taskbar";
- public static final String REQUEST_IS_TRANSIENT_TASKBAR = "is-transient-taskbar";
public static final String REQUEST_UNSTASH_TASKBAR_IF_STASHED = "unstash-taskbar-if-stashed";
- public static final String REQUEST_TASKBAR_FROM_NAV_THRESHOLD = "taskbar-from-nav-threshold";
+ public static final String REQUEST_STASHED_TASKBAR_HEIGHT = "stashed-taskbar-height";
public static final String REQUEST_STASHED_TASKBAR_SCALE = "taskbar-stash-handle-scale";
public static final String REQUEST_RECREATE_TASKBAR = "recreate-taskbar";
public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 4184868..abb0db5 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -187,7 +187,7 @@
Utilities.enableRunningInTestHarnessForTests();
mLauncher.setSystemHealthSupplier(startTime -> TestCommandReceiver.callCommand(
TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE, startTime.toString())
- .getString("result"));
+ .getString("result"));
mLauncher.setOnSettledStateAction(
containerType -> executeOnLauncher(
launcher ->
@@ -248,6 +248,7 @@
public void setUp() throws Exception {
mLauncher.onTestStart();
+ waitForSetupWizardDismissal();
if (TestStabilityRule.isPresubmit()) {
aggressivelyUnlockSysUi();
} else {
@@ -308,6 +309,33 @@
Log.d(TAG, "Keyguard is not visible");
}
+ // b/309008042
+ private static boolean sFirstTimeWaitingForWizard = true;
+
+ static {
+ waitForSetupWizardDismissal();
+ }
+
+ /** Waits for setup wizard to go away. */
+ public static void waitForSetupWizardDismissal() {
+ if (sFirstTimeWaitingForWizard && TestStabilityRule.isPresubmit()) {
+ try {
+ UiDevice.getInstance(getInstrumentation()).executeShellCommand(
+ "am force-stop com.google.android.setupwizard");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ final boolean wizardDismissed = TestHelpers.wait(
+ Until.gone(By.pkg("com.google.android.setupwizard").depth(0)),
+ sFirstTimeWaitingForWizard ? 120000 : 0);
+ sFirstTimeWaitingForWizard = false;
+ // b/309496273
+// Assert.assertTrue("Setup wizard is still visible",
+// wizardDismissed);
+ }
+
public static void verifyKeyguardInvisible() {
final boolean keyguardAlreadyVisible = sSeenKeyguard;
@@ -422,6 +450,7 @@
// flakiness.
protected void waitForLauncherCondition(
String message, Function<Launcher, Boolean> condition, long timeout) {
+ waitForSetupWizardDismissal();
verifyKeyguardInvisible();
if (!TestHelpers.isInLauncherProcess()) return;
Wait.atMost(message, () -> getFromLauncher(condition), timeout, mLauncher);
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 0a51fbd..770fe14 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -183,14 +183,7 @@
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
Taskbar taskbar = new Taskbar(mLauncher);
taskbar.touchBottomCorner(tapRight);
- if (mLauncher.isTransientTaskbar()) {
- // Tapping outside Transient Taskbar returns to Workspace, wait for that state.
- new Workspace(mLauncher);
- } else {
- // Should stay in Overview.
- verifyActiveContainer();
- verifyActionsViewVisibility();
- }
+ verifyActiveContainer();
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index 6d58a35..efeb5f6 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -20,11 +20,12 @@
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 static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_TASKBAR_SCALE;
-import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD;
-import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD;
import android.graphics.Point;
import android.graphics.Rect;
@@ -83,6 +84,8 @@
public Taskbar getTaskbar() {
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to get the taskbar")) {
+ mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
+
return new Taskbar(mLauncher);
}
}
@@ -110,32 +113,37 @@
/**
* Returns the Taskbar in a visible state.
*
- * The taskbar must already be hidden and in transient mode when calling this method.
+ * The taskbar must already be hidden when calling this method.
*/
- public Taskbar swipeUpToUnstashTaskbar() {
- mLauncher.assertTrue("Taskbar is not transient, swipe up not supported",
- mLauncher.isTransientTaskbar());
-
+ public Taskbar showTaskbar() {
+ mLauncher.getTestInfo(REQUEST_ENABLE_MANUAL_TASKBAR_STASHING);
mLauncher.getTestInfo(REQUEST_ENABLE_BLOCK_TIMEOUT);
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
- "want to swipe up to unstash the taskbar")) {
+ "want to show the taskbar")) {
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
- int taskbarFromNavThreshold = mLauncher.getTestInfo(REQUEST_TASKBAR_FROM_NAV_THRESHOLD)
- .getInt(TEST_INFO_RESPONSE_FIELD);
- int startX = mLauncher.getRealDisplaySize().x / 2;
- int startY = mLauncher.getRealDisplaySize().y - 1;
- int endX = startX;
- int endY = startY - taskbarFromNavThreshold;
+ final long downTime = SystemClock.uptimeMillis();
+ final int unstashTargetY = mLauncher.getRealDisplaySize().y
+ - (mLauncher.getTestInfo(REQUEST_STASHED_TASKBAR_HEIGHT)
+ .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD) / 2);
+ final Point unstashTarget = new Point(
+ mLauncher.getRealDisplaySize().x / 2, unstashTargetY);
- mLauncher.linearGesture(startX, startY, endX, endY, 10, /* slowDown= */ true,
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, unstashTarget,
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
- LauncherInstrumentation.log("swipeUpToUnstashTaskbar: sent linear swipe up gesture");
+ LauncherInstrumentation.log("showTaskbar: sent down");
- return new Taskbar(mLauncher);
+ try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
+ mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, unstashTarget,
+ LauncherInstrumentation.GestureScope.EXPECT_PILFER);
+
+ return new Taskbar(mLauncher);
+ }
} finally {
+ mLauncher.getTestInfo(REQUEST_DISABLE_MANUAL_TASKBAR_STASHING);
mLauncher.getTestInfo(REQUEST_DISABLE_BLOCK_TIMEOUT);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 68e85ca..17169b3 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -799,7 +799,12 @@
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+
+ if (is3PLauncher() && isTablet()) {
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
+ } else {
+ waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ }
return waitForLauncherObject(WORKSPACE_RES_ID);
}
@@ -809,7 +814,12 @@
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+
+ if (is3PLauncher() && isTablet()) {
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
+ } else {
+ waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ }
return waitForLauncherObject(WIDGETS_RES_ID);
}
@@ -830,7 +840,7 @@
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- if (is3PLauncher() && isTablet() && !isTransientTaskbar()) {
+ if (is3PLauncher() && isTablet()) {
waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
@@ -843,7 +853,7 @@
waitUntilLauncherObjectGone(APPS_RES_ID);
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
- if (isTablet() && !is3PLauncher()) {
+ if (isTablet()) {
waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
@@ -880,11 +890,7 @@
}
if (isTablet()) {
- // Only check that Persistent Taskbar is visible, since Transient Taskbar
- // may or may not be visible by design.
- if (!isTransientTaskbar()) {
- waitForSystemLauncherObject(TASKBAR_RES_ID);
- }
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
}
@@ -958,7 +964,7 @@
/**
* Using swiping up gesture to dismiss closable floating views, such as Menu or Folder Content.
*/
- private void swipeUpToCloseFloatingView() {
+ private void swipeUpToCloseFloatingView(boolean gestureStartFromLauncher) {
final Point displaySize = getRealDisplaySize();
final Optional<String> floatingRes = getFloatingResId();
@@ -967,11 +973,16 @@
return;
}
+ GestureScope gestureScope = gestureStartFromLauncher
+ // Without the navigation bar layer, the gesture scope on tablets remains inside the
+ // launcher process.
+ ? (isTablet() ? GestureScope.DONT_EXPECT_PILFER : GestureScope.EXPECT_PILFER)
+ : GestureScope.EXPECT_PILFER;
linearGesture(
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME,
- false, GestureScope.EXPECT_PILFER);
+ false, gestureScope);
try (LauncherInstrumentation.Closable c1 = addContextLayer(
String.format("Swiped up from floating view %s to home", floatingRes.get()))) {
@@ -1039,8 +1050,11 @@
final Point displaySize = getRealDisplaySize();
+ boolean gestureStartFromLauncher =
+ isTablet() ? !isLauncher3() : isLauncherVisible();
+
// CLose floating views before going back to home.
- swipeUpToCloseFloatingView();
+ swipeUpToCloseFloatingView(gestureStartFromLauncher);
if (hasLauncherObject(WORKSPACE_RES_ID)) {
log(action = "already at home");
@@ -1970,8 +1984,7 @@
}
}
- /** Returns the bounds of the display as a Point where x is width and y is height. */
- public Point getRealDisplaySize() {
+ Point getRealDisplaySize() {
final Rect displayBounds = getContext().getSystemService(WindowManager.class)
.getMaximumWindowMetrics()
.getBounds();
@@ -2033,11 +2046,6 @@
: TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT);
}
- public boolean isTransientTaskbar() {
- return getTestInfo(TestProtocol.REQUEST_IS_TRANSIENT_TASKBAR)
- .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
- }
-
/** Enables transient taskbar for testing purposes only. */
public void enableTransientTaskbar(boolean enable) {
getTestInfo(enable
diff --git a/tests/tapl/com/android/launcher3/tapl/Taskbar.java b/tests/tapl/com/android/launcher3/tapl/Taskbar.java
index f92ad9d..da26694 100644
--- a/tests/tapl/com/android/launcher3/tapl/Taskbar.java
+++ b/tests/tapl/com/android/launcher3/tapl/Taskbar.java
@@ -18,6 +18,8 @@
import static android.view.KeyEvent.KEYCODE_META_RIGHT;
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 android.graphics.Point;
import android.graphics.Rect;
@@ -43,10 +45,6 @@
Taskbar(LauncherInstrumentation launcher) {
mLauncher = launcher;
- try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "expect new taskbar to be visible")) {
- mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
- }
}
/**
@@ -63,32 +61,33 @@
}
/**
- * Stashes this taskbar.
- * <p>
- * The taskbar must already be unstashed and in transient mode when calling this method.
+ * Hides this taskbar.
+ *
+ * The taskbar must already be visible when calling this method.
*/
- public void swipeDownToStash() {
- mLauncher.assertTrue("Taskbar is not transient, swipe down not supported",
- mLauncher.isTransientTaskbar());
+ public void hide() {
+ mLauncher.getTestInfo(REQUEST_ENABLE_MANUAL_TASKBAR_STASHING);
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to hide the taskbar");
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
- Rect taskbarBounds = getVisibleBounds();
- int startX = taskbarBounds.centerX();
- int startY = taskbarBounds.centerY();
- int endX = startX;
- int endY = mLauncher.getRealDisplaySize().y - 1;
+ final long downTime = SystemClock.uptimeMillis();
+ Point stashTarget = new Point(
+ mLauncher.getRealDisplaySize().x - 1, mLauncher.getRealDisplaySize().y - 1);
- mLauncher.linearGesture(startX, startY, endX, endY, 10, false,
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, stashTarget,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
- LauncherInstrumentation.log("swipeDownToStash: sent linear swipe down gesture");
- try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
- "expect transient taskbar to be hidden after swipe down")) {
+ LauncherInstrumentation.log("hideTaskbar: sent down");
+
+ try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, stashTarget,
+ LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
+ } finally {
+ mLauncher.getTestInfo(REQUEST_DISABLE_MANUAL_TASKBAR_STASHING);
}
}
@@ -146,7 +145,7 @@
return By.clazz(TextView.class).text("");
}
- public Rect getVisibleBounds() {
+ private Rect getVisibleBounds() {
return mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID).getVisibleBounds();
}