Snap for 11463929 from d3693424f5 to 24Q3-release

Change-Id: I07a1360a506dc1383ac1443a210154aa43acebe5
This commit is contained in:
Android Build Coastguard Worker
2024-02-17 02:21:28 +00:00
22 changed files with 132 additions and 32 deletions
@@ -176,6 +176,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
/**
* Should be called from onResume() and onPause(), and animates the Taskbar accordingly.
*/
@Override
public void onLauncherVisibilityChanged(boolean isVisible) {
onLauncherVisibilityChanged(isVisible, false /* fromInit */);
}
@@ -53,6 +53,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
private boolean mHasSprungOnceThisGesture;
private @Nullable ValueAnimator mSpringBounce;
private boolean mGestureInProgress;
private boolean mGestureEnded;
private boolean mAnimationToHomeRunning;
@@ -155,7 +156,12 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
/**
* Returns an animation to reset the taskbar translation to {@code 0}.
*/
public ObjectAnimator createAnimToResetTranslation(long duration) {
public ValueAnimator createAnimToResetTranslation(long duration) {
if (mGestureInProgress) {
// Return an empty animator as the translation will reset itself after gesture ends.
return ValueAnimator.ofFloat(0).setDuration(duration);
}
ObjectAnimator animator = mTranslationYForSwipe.animateToValue(0);
animator.setInterpolator(Interpolators.LINEAR);
animator.setDuration(duration);
@@ -192,6 +198,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
mAnimationToHomeRunning = false;
cancelSpringIfExists();
reset();
mGestureInProgress = true;
}
/**
* Called when there is movement to move the taskbar.
@@ -215,6 +222,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
mGestureEnded = true;
startSpring();
}
mGestureInProgress = false;
}
}
@@ -358,4 +358,13 @@ public class TaskbarUIController {
/** Adjusts the hotseat for the bubble bar. */
public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) {}
/**
* Adjusts the taskbar based on the visibility of the launcher.
* @param isVisible True if launcher is visible, false otherwise.
*/
public void onLauncherVisibilityChanged(boolean isVisible) {
mControllers.taskbarStashController.updateStateForFlag(FLAG_IN_APP, !isVisible);
mControllers.taskbarStashController.applyState();
}
}
@@ -23,6 +23,9 @@ import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.View;
import com.android.internal.jank.Cuj;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
/**
* Callbacks for {@link TaskbarView} to interact with its controller.
*/
@@ -45,6 +48,8 @@ public class TaskbarViewCallbacks {
public View.OnClickListener getAllAppsButtonClickListener() {
return v -> {
InteractionJankMonitorWrapper.begin(v, Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS,
/* tag= */ "TASKBAR_BUTTON");
mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP);
mControllers.taskbarAllAppsController.toggle();
};
@@ -20,6 +20,7 @@ import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
import androidx.annotation.Nullable;
import com.android.internal.jank.Cuj;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.allapps.AllAppsTransitionListener;
import com.android.launcher3.anim.PendingAnimation;
@@ -31,6 +32,7 @@ import com.android.launcher3.taskbar.TaskbarStashController;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.launcher3.util.DisplayController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import java.util.Optional;
@@ -136,6 +138,9 @@ final class TaskbarAllAppsViewController {
&& mAppsView.getSearchUiManager().getEditText() != null) {
mAppsView.getSearchUiManager().getEditText().requestFocus();
}
if (toAllApps) {
InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS);
}
}
/** Invoked on back press, returning {@code true} if the search session handled it. */
@@ -218,9 +218,13 @@ public class OverviewCommandHelper {
return true;
}
}
if (cmd.type == TYPE_KEYBOARD_INPUT && allowQuickSwitch) {
uiController.openQuickSwitchView();
return true;
if (cmd.type == TYPE_KEYBOARD_INPUT) {
if (allowQuickSwitch) {
uiController.openQuickSwitchView();
return true;
} else {
mKeyboardTaskFocusIndex = 0;
}
}
if (cmd.type == TYPE_HOME) {
ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)");
@@ -82,13 +82,13 @@ import com.android.systemui.unfold.progress.IUnfoldTransitionListener;
import com.android.wm.shell.back.IBackAnimation;
import com.android.wm.shell.bubbles.IBubbles;
import com.android.wm.shell.bubbles.IBubblesListener;
import com.android.wm.shell.common.pip.IPip;
import com.android.wm.shell.common.pip.IPipAnimationListener;
import com.android.wm.shell.common.split.SplitScreenConstants.PersistentSnapPosition;
import com.android.wm.shell.desktopmode.IDesktopMode;
import com.android.wm.shell.desktopmode.IDesktopTaskListener;
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;
import com.android.wm.shell.recents.IRecentTasks;
import com.android.wm.shell.recents.IRecentTasksListener;
import com.android.wm.shell.splitscreen.ISplitScreen;
@@ -68,6 +68,7 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
import com.android.quickstep.util.MultiValueUpdateListener;
@@ -643,6 +644,21 @@ public final class TaskViewUtils {
recentsView.post(() -> {
stateManager.moveToRestState();
stateManager.reapplyState();
// We may have notified launcher is not visible so that taskbar can
// stash immediately. Now that the animation is over, we can update
// that launcher is still visible.
TaskbarUIController controller = recentsView.getSizeStrategy()
.getTaskbarController();
if (controller != null) {
boolean launcherVisible = true;
for (RemoteAnimationTarget target : appTargets) {
launcherVisible &= target.isTranslucent;
}
if (launcherVisible) {
controller.onLauncherVisibilityChanged(true);
}
}
});
});
}
@@ -47,6 +47,7 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNF
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNLOCK_ANIMATION_CONTROLLER;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.wm.shell.Flags.enableBubblesLongPressNavHandle;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BUBBLES;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_DESKTOP_MODE;
@@ -134,10 +135,10 @@ import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationContro
import com.android.systemui.unfold.progress.IUnfoldAnimation;
import com.android.wm.shell.back.IBackAnimation;
import com.android.wm.shell.bubbles.IBubbles;
import com.android.wm.shell.common.pip.IPip;
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;
import com.android.wm.shell.splitscreen.ISplitScreen;
import com.android.wm.shell.startingsurface.IStartingWindow;
@@ -1006,6 +1007,17 @@ public class TouchInteractionService extends Service {
mOverviewCommandHelper);
}
}
if (enableBubblesLongPressNavHandle()) {
// Create bubbles input consumer before NavHandleLongPressInputConsumer.
// This allows for nav handle to fall back to bubbles.
if (mDeviceState.isBubblesExpanded()) {
reasonString = newCompoundString(reasonPrefix)
.append(SUBSTRING_PREFIX)
.append("bubbles expanded, trying to use default input consumer");
// Bubbles can handle home gesture itself.
base = getDefaultInputConsumer(reasonString);
}
}
NavHandle navHandle = tac != null ? tac.getNavHandle()
: SystemUiProxy.INSTANCE.get(this);
@@ -1023,12 +1035,15 @@ public class TouchInteractionService extends Service {
mDeviceState, navHandle);
}
if (mDeviceState.isBubblesExpanded()) {
reasonString = newCompoundString(reasonPrefix)
.append(SUBSTRING_PREFIX)
.append("bubbles expanded, trying to use default input consumer");
// Bubbles can handle home gesture itself.
base = getDefaultInputConsumer(reasonString);
if (!enableBubblesLongPressNavHandle()) {
// Continue overriding nav handle input consumer with bubbles
if (mDeviceState.isBubblesExpanded()) {
reasonString = newCompoundString(reasonPrefix)
.append(SUBSTRING_PREFIX)
.append("bubbles expanded, trying to use default input consumer");
// Bubbles can handle home gesture itself.
base = getDefaultInputConsumer(reasonString);
}
}
if (mDeviceState.isSystemUiDialogShowing()) {
@@ -214,7 +214,7 @@ import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.wm.shell.pip.IPipAnimationListener;
import com.android.wm.shell.common.pip.IPipAnimationListener;
import java.util.ArrayList;
import java.util.Arrays;
@@ -171,17 +171,19 @@ class NavButtonLayoutFactoryTest {
assert(layoutter is PhoneSeascapeNavLayoutter)
}
@Test(expected = IllegalStateException::class)
fun noValidLayoutForPhoneGestureNav() {
@Test
fun getTaskbarPhoneGestureNavLayoutter() {
assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
getLayoutter(
isKidsMode = false,
isInSetup = false,
isThreeButtonNav = false,
phoneMode = true,
surfaceRotation = surfaceRotation
)
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
getLayoutter(
isKidsMode = false,
isInSetup = false,
isThreeButtonNav = false,
phoneMode = true,
surfaceRotation = surfaceRotation
)
assert(layoutter is PhoneGestureLayoutter)
}
private fun setDeviceProfileLandscape() {
@@ -252,6 +252,7 @@ public class FallbackRecentsTest {
// b/143488140
//@NavigationModeSwitch
@Test
@ScreenRecordRule.ScreenRecord // b/321775748
public void testOverview() {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
@@ -304,6 +304,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
@Test
@NavigationModeSwitch
@PortraitLandscape
@ScreenRecord // b/313464374
public void testQuickSwitchFromApp() throws Exception {
startTestActivity(2);
startTestActivity(3);
@@ -16,6 +16,8 @@
package com.android.launcher3;
import static com.android.launcher3.testing.shared.TestProtocol.ACTIVITY_NOT_RESUMED_AFTER_BACK;
import static com.android.launcher3.testing.shared.TestProtocol.sDebugTracing;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK;
@@ -308,6 +310,9 @@ public abstract class BaseActivity extends Activity implements ActivityContext {
* Sets the activity to appear as paused.
*/
public void setPaused() {
if (sDebugTracing) {
Log.d(ACTIVITY_NOT_RESUMED_AFTER_BACK, "Activity setPaused: " + this, new Throwable());
}
removeActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_DEFERRED_RESUMED);
}
@@ -315,6 +320,7 @@ public abstract class BaseActivity extends Activity implements ActivityContext {
* Sets the activity to appear as resumed.
*/
public void setResumed() {
if (sDebugTracing) Log.d(ACTIVITY_NOT_RESUMED_AFTER_BACK, "Activity setResumed: " + this);
addActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_USER_ACTIVE);
removeActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
}
@@ -31,6 +31,7 @@ import static com.android.launcher3.uioverrides.flags.FlagsFactory.getDebugFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getReleaseFlag;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
import android.content.res.Resources;
import android.view.ViewConfiguration;
import androidx.annotation.VisibleForTesting;
@@ -222,7 +223,19 @@ public final class FeatureFlags {
TEAMFOOD, "Sends a notification whenever launcher encounters an uncaught exception.");
public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION =
enableTaskbarNavbarUnification();
enableTaskbarNavbarUnification() && !isPhone();
private static boolean isPhone() {
final boolean isPhone;
int foldedDeviceStatesId = Resources.getSystem().getIdentifier(
"config_foldedDeviceStates", "array", "android");
if (foldedDeviceStatesId != 0) {
isPhone = Resources.getSystem().getIntArray(foldedDeviceStatesId).length == 0;
} else {
isPhone = true;
}
return isPhone;
}
// Aconfig migration complete for ENABLE_TASKBAR_NO_RECREATION.
public static final BooleanFlag ENABLE_TASKBAR_NO_RECREATION = getDebugFlag(299193589,
@@ -18,7 +18,6 @@ package com.android.launcher3.model;
import static android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID;
import static com.android.launcher3.Flags.enableSupportForArchiving;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
@@ -45,6 +44,7 @@ import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
@@ -300,7 +300,8 @@ public class ItemInstallQueue {
} else {
lai = laiList.get(0);
si.intent = makeLaunchIntent(lai);
if (enableSupportForArchiving() && lai.getActivityInfo().isArchived) {
if (Utilities.enableSupportForArchiving()
&& lai.getActivityInfo().isArchived) {
si.runtimeStatusFlags |= FLAG_ARCHIVED;
}
}
@@ -17,6 +17,7 @@ package com.android.launcher3.testing;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.config.FeatureFlags.enableSplitContextually;
import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD;
@@ -182,6 +183,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTablet);
return response;
case TestProtocol.REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION:
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
ENABLE_TASKBAR_NAVBAR_UNIFICATION);
return response;
case TestProtocol.REQUEST_NUM_ALL_APPS_COLUMNS:
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
mDeviceProfile.numShownAllAppsColumns);
@@ -16,8 +16,6 @@
package com.android.launcher3.util;
import static com.android.launcher3.Flags.enableSupportForArchiving;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -276,6 +274,6 @@ public class PackageManagerHelper {
@SuppressWarnings("NewApi")
private boolean isPackageInstalledOrArchived(ApplicationInfo info) {
return (info.flags & ApplicationInfo.FLAG_INSTALLED) != 0 || (
enableSupportForArchiving() && info.isArchived);
Utilities.enableSupportForArchiving() && info.isArchived);
}
}
+1 -1
View File
@@ -46,6 +46,6 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="com.android.launcher3.tests" />
<option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<option name="instrumentation-arg" key="waitForActivitiesToComplete" value="false" />
<option name="hidden-api-checks" value="false" />
</test>
</configuration>
@@ -119,6 +119,8 @@ public final class TestProtocol {
public static final String REQUEST_CLEAR_DATA = "clear-data";
public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names";
public static final String REQUEST_IS_TABLET = "is-tablet";
public static final String REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION =
"enable-taskbar-navbar-unification";
public static final String REQUEST_NUM_ALL_APPS_COLUMNS = "num-all-apps-columns";
public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
public static final String REQUEST_CELL_LAYOUT_BOARDER_HEIGHT = "cell-layout-boarder-height";
@@ -169,6 +171,7 @@ public final class TestProtocol {
public static final String ICON_MISSING = "b/282963545";
public static final String OVERVIEW_OVER_HOME = "b/279059025";
public static final String UIOBJECT_STALE_ELEMENT = "b/319501259";
public static final String ACTIVITY_NOT_RESUMED_AFTER_BACK = "b/322823209";
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
@@ -405,6 +405,11 @@ public final class LauncherInstrumentation {
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
public boolean isTaskbarNavbarUnificationEnabled() {
return getTestInfo(TestProtocol.REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
public boolean isTwoPanels() {
return getTestInfo(TestProtocol.REQUEST_IS_TWO_PANELS)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
@@ -845,7 +850,8 @@ public final class LauncherInstrumentation {
}
private String getNavigationButtonResPackage() {
return isTablet() ? getLauncherPackageName() : SYSTEMUI_PACKAGE;
return isTablet() || isTaskbarNavbarUnificationEnabled()
? getLauncherPackageName() : SYSTEMUI_PACKAGE;
}
UiObject2 verifyContainerType(ContainerType containerType) {
@@ -25,7 +25,6 @@ import static org.junit.Assume.assumeTrue;
import android.content.Intent;
import android.platform.test.annotations.PlatinumTest;
import android.platform.test.rule.ScreenRecordRule;
import androidx.test.filters.FlakyTest;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -35,6 +34,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.tapl.AllApps;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.rule.ScreenRecordRule;
import org.junit.Before;
import org.junit.Test;