Merge "Resize icon and text size for AllApps when it doesn't fit the cell" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index be4426d..0ef4541 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -23,6 +23,7 @@
import static com.android.launcher3.LauncherAnimUtils.ROTATION_DRAWABLE_PERCENT;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX;
import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y;
@@ -734,7 +735,7 @@
// TODO(b/244231596) we're getting the incorrect kidsMode value in small-screen
boolean isInKidsMode = mContext.isNavBarKidsModeActive();
- if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) {
+ if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
NavButtonLayoutter navButtonLayoutter =
NavButtonLayoutFactory.Companion.getUiLayoutter(
dp, mNavButtonsView, mImeSwitcherButton,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 6ee151b..db1ea42 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -30,12 +30,12 @@
import static com.android.launcher3.Flags.enableCursorHoverStates;
import static com.android.launcher3.Utilities.calculateTextHeight;
import static com.android.launcher3.Utilities.isRunningInTestHarness;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN;
-import static com.android.launcher3.taskbar.TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW;
import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName;
import static com.android.launcher3.util.VibratorWrapper.EFFECT_CLICK;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
@@ -354,7 +354,7 @@
sharedState.systemBarAttrsBehavior);
onNavButtonsDarkIntensityChanged(sharedState.navButtonsDarkIntensity);
- if (FLAG_HIDE_NAVBAR_WINDOW) {
+ if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
// W/ the flag not set this entire class gets re-created, which resets the value of
// mIsDestroyed. We re-use the class for small-screen, so we explicitly have to mark
// this class as non-destroyed
@@ -454,7 +454,7 @@
*/
private WindowManager.LayoutParams createAllWindowParams() {
final int windowType =
- FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL;
+ ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL;
WindowManager.LayoutParams windowLayoutParams =
createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE);
boolean isPhoneNavMode = TaskbarManager.isPhoneButtonNavMode(this);
@@ -719,7 +719,7 @@
mIsDestroyed = true;
setUIController(TaskbarUIController.DEFAULT);
mControllers.onDestroy();
- if (!enableTaskbarNoRecreate() && !FLAG_HIDE_NAVBAR_WINDOW) {
+ if (!enableTaskbarNoRecreate() && !ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
mWindowManager.removeViewImmediate(mDragLayer);
mAddedWindow = false;
}
@@ -860,7 +860,7 @@
public int getDefaultTaskbarWindowHeight() {
Resources resources = getResources();
- if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) {
+ if (ENABLE_TASKBAR_NAVBAR_UNIFICATION && mDeviceProfile.isPhone) {
return isThreeButtonNav() ?
resources.getDimensionPixelSize(R.dimen.taskbar_size) :
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
index 1eb8d53..a24cf4b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
@@ -18,6 +18,8 @@
import static android.view.KeyEvent.ACTION_UP;
import static android.view.KeyEvent.KEYCODE_BACK;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
+
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RectF;
@@ -126,7 +128,7 @@
}
protected void onDestroy() {
- onDestroy(!TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW);
+ onDestroy(!ENABLE_TASKBAR_NAVBAR_UNIFICATION);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 0b52195..1a34b7a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -41,6 +41,7 @@
import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.launcher3.anim.AlphaUpdateListener
+import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION
import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.launcher3.util.DisplayController
@@ -253,7 +254,7 @@
visInsetsSizeForTappableElement
),
)
- if ((context.isGestureNav || TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ if ((context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION)
&& provider.type == tappableElement()) {
provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement
} else if (provider.type != systemGestures()) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index 9bb7e67..c0b07e7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -23,6 +23,7 @@
import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
@@ -41,7 +42,6 @@
import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Handler;
-import android.os.SystemProperties;
import android.os.Trace;
import android.provider.Settings;
import android.util.Log;
@@ -71,6 +71,7 @@
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
+import com.android.wm.shell.Flags;
import java.io.PrintWriter;
import java.util.StringJoiner;
@@ -98,9 +99,6 @@
| ActivityInfo.CONFIG_SCREEN_LAYOUT
| ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
- public static final boolean FLAG_HIDE_NAVBAR_WINDOW =
- SystemProperties.getBoolean("persist.wm.debug.hide_navbar_window", false);
-
private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor(
Settings.Secure.USER_SETUP_COMPLETE);
@@ -198,7 +196,8 @@
Display display =
service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY);
mContext = service.createWindowContext(display,
- FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL, null);
+ ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL,
+ null);
if (enableTaskbarNoRecreate()) {
mWindowManager = mContext.getSystemService(WindowManager.class);
mTaskbarRootLayout = new FrameLayout(mContext) {
@@ -250,7 +249,7 @@
destroyExistingTaskbar();
} else {
if (dp != null && isTaskbarPresent(dp)) {
- if (FLAG_HIDE_NAVBAR_WINDOW) {
+ if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
// Re-initialize for screen size change? Should this be done
// by looking at screen-size change flag in configDiff in the
// block above?
@@ -295,7 +294,7 @@
debugWhyTaskbarNotDestroyed("destroyExistingTaskbar: " + mTaskbarActivityContext);
if (mTaskbarActivityContext != null) {
mTaskbarActivityContext.onDestroy();
- if (!FLAG_HIDE_NAVBAR_WINDOW || enableTaskbarNoRecreate()) {
+ if (!ENABLE_TASKBAR_NAVBAR_UNIFICATION || enableTaskbarNoRecreate()) {
mTaskbarActivityContext = null;
}
}
@@ -427,7 +426,7 @@
boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp);
debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled
+ " [dp != null (i.e. mUserUnlocked)]=" + (dp != null)
- + " FLAG_HIDE_NAVBAR_WINDOW=" + FLAG_HIDE_NAVBAR_WINDOW
+ + " FLAG_HIDE_NAVBAR_WINDOW=" + ENABLE_TASKBAR_NAVBAR_UNIFICATION
+ " dp.isTaskbarPresent=" + (dp == null ? "null" : dp.isTaskbarPresent));
if (!isTaskbarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
@@ -493,7 +492,7 @@
* and we are using a single window for taskbar and navbar.
*/
public static boolean isPhoneMode(DeviceProfile deviceProfile) {
- return TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW && deviceProfile.isPhone;
+ return ENABLE_TASKBAR_NAVBAR_UNIFICATION && deviceProfile.isPhone;
}
/**
@@ -505,7 +504,7 @@
}
private boolean isTaskbarPresent(DeviceProfile deviceProfile) {
- return FLAG_HIDE_NAVBAR_WINDOW || deviceProfile.isTaskbarPresent;
+ return ENABLE_TASKBAR_NAVBAR_UNIFICATION || deviceProfile.isTaskbarPresent;
}
public void onRotationProposal(int rotation, boolean isValid) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 78d5bd3..8f43a2f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -25,6 +25,7 @@
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.anim.AnimatedFloat.VALUE;
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP;
import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT;
@@ -214,7 +215,7 @@
mActivity.addOnDeviceProfileChangeListener(mDeviceProfileChangeListener);
- if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) {
+ if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
// This gets modified in NavbarButtonsViewController, but the initial value it reads
// may be incorrect since it's state gets destroyed on taskbar recreate, so reset here
mTaskbarIconAlpha.get(ALPHA_INDEX_SMALL_SCREEN)
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index b06a978..9ee9d85 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -20,6 +20,7 @@
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
import static android.widget.Toast.LENGTH_SHORT;
+
import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE;
import static com.android.app.animation.Interpolators.DECELERATE;
import static com.android.app.animation.Interpolators.OVERSHOOT_1_2;
@@ -351,7 +352,7 @@
return ROTATION_0;
}
return mRecentsView.getPagedViewOrientedState().getRecentsActivityRotation();
- }, inputConsumer, /* callback = */ () -> {
+ }, inputConsumer, /* onTouchDownCallback = */ () -> {
endRunningWindowAnim(mGestureState.getEndTarget() == HOME /* cancel */);
endLauncherTransitionController();
}, new InputProxyHandlerFactory(mActivityInterface, mGestureState));
@@ -1943,7 +1944,7 @@
mCurrentShift.cancelAnimation();
// Cleanup when switching handlers
- mInputConsumerProxy.unregisterCallback();
+ mInputConsumerProxy.unregisterOnTouchDownCallback();
mActivityInitListener.unregister();
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
mActivityRestartListener);
@@ -1955,7 +1956,7 @@
mInputConsumerProxy.destroy();
mTaskAnimationManager.setLiveTileCleanUpHandler(null);
}
- mInputConsumerProxy.unregisterCallback();
+ mInputConsumerProxy.unregisterOnTouchDownCallback();
endRunningWindowAnim(false /* cancel */);
if (mGestureEndCallback != null) {
diff --git a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
index d102502..a36f501 100644
--- a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
@@ -19,6 +19,7 @@
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Color;
+import android.graphics.Insets;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
@@ -26,6 +27,7 @@
import android.view.Display;
import android.view.View;
import android.view.Window;
+import android.view.WindowInsets;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -41,6 +43,7 @@
import com.android.quickstep.interaction.TutorialController.TutorialType;
import com.android.quickstep.util.TISBindHelper;
+import java.util.ArrayList;
import java.util.Arrays;
/** Shows the gesture interactive sandbox in full screen mode. */
@@ -101,8 +104,11 @@
correctUserOrientation();
}
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
+
+ initWindowInsets();
}
+
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
@@ -113,6 +119,42 @@
}
}
+ private void initWindowInsets() {
+ View root = findViewById(android.R.id.content);
+ root.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ updateExclusionRects(root);
+ }
+ });
+
+ // Return CONSUMED if you don't want want the window insets to keep being
+ // passed down to descendant views.
+ root.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
+ @Override
+ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
+ return WindowInsets.CONSUMED;
+ }
+ });
+ }
+
+ private void updateExclusionRects(View rootView) {
+ Insets gestureInsets = rootView.getRootWindowInsets()
+ .getInsets(WindowInsets.Type.systemGestures());
+ ArrayList<Rect> exclusionRects = new ArrayList<>();
+ // Add rect for left
+ exclusionRects.add(new Rect(0, 0, gestureInsets.left, rootView.getHeight()));
+ // Add rect for right
+ exclusionRects.add(new Rect(
+ rootView.getWidth() - gestureInsets.right,
+ 0,
+ rootView.getWidth(),
+ rootView.getHeight()
+ ));
+ rootView.setSystemGestureExclusionRects(exclusionRects);
+ }
+
/**
* Gesture animations are only in landscape for large screens and portrait for mobile. This
* method enforces the following flows:
diff --git a/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java b/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
index 91b53c7..cb44a1a 100644
--- a/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
+++ b/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
@@ -25,6 +25,8 @@
import android.view.KeyEvent;
import android.view.MotionEvent;
+import androidx.annotation.Nullable;
+
import com.android.quickstep.InputConsumer;
import com.android.quickstep.SimpleOrientationTouchTransformer;
import com.android.systemui.shared.system.InputConsumerController;
@@ -42,7 +44,10 @@
private final Context mContext;
private final Supplier<Integer> mRotationSupplier;
private final InputConsumerController mInputConsumerController;
- private Runnable mCallback;
+
+ /** Called if a new InputConsumer is created via touch down event. */
+ private @Nullable Runnable mOnTouchDownCallback;
+
private Supplier<InputConsumer> mConsumerSupplier;
// The consumer is created lazily on demand.
@@ -54,11 +59,11 @@
public InputConsumerProxy(Context context, Supplier<Integer> rotationSupplier,
InputConsumerController inputConsumerController,
- Runnable callback, Supplier<InputConsumer> consumerSupplier) {
+ Runnable onTouchDownCallback, Supplier<InputConsumer> consumerSupplier) {
mContext = context;
mRotationSupplier = rotationSupplier;
mInputConsumerController = inputConsumerController;
- mCallback = callback;
+ mOnTouchDownCallback = onTouchDownCallback;
mConsumerSupplier = consumerSupplier;
}
@@ -82,7 +87,7 @@
onInputConsumerMotionEvent(event);
}
} else if (ev instanceof KeyEvent) {
- initInputConsumerIfNeeded();
+ initInputConsumerIfNeeded(/* isFromTouchDown= */ false);
mInputConsumer.onKeyEvent((KeyEvent) ev);
return true;
}
@@ -105,7 +110,7 @@
if (action == ACTION_DOWN) {
mTouchInProgress = true;
- initInputConsumerIfNeeded();
+ initInputConsumerIfNeeded(/* isFromTouchDown= */ true);
} else if (action == ACTION_CANCEL || action == ACTION_UP) {
// Finish any pending actions
mTouchInProgress = false;
@@ -123,7 +128,7 @@
}
private void onInputConsumerHoverEvent(MotionEvent ev) {
- initInputConsumerIfNeeded();
+ initInputConsumerIfNeeded(/* isFromTouchDown= */ false);
if (mInputConsumer != null) {
SimpleOrientationTouchTransformer.INSTANCE.get(mContext).transform(ev,
mRotationSupplier.get());
@@ -141,14 +146,15 @@
mInputConsumerController.setInputListener(null);
}
- public void unregisterCallback() {
- mCallback = null;
+ /** Sets mOnToudhCownCallback = null. */
+ public void unregisterOnTouchDownCallback() {
+ mOnTouchDownCallback = null;
}
- private void initInputConsumerIfNeeded() {
+ private void initInputConsumerIfNeeded(boolean isFromTouchDown) {
if (mInputConsumer == null) {
- if (mCallback != null) {
- mCallback.run();
+ if (isFromTouchDown && mOnTouchDownCallback != null) {
+ mOnTouchDownCallback.run();
}
mInputConsumer = mConsumerSupplier.get();
mConsumerSupplier = null;
diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
index fce38e1..fe6ce46 100644
--- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
@@ -159,8 +159,8 @@
// to other classes like PipTaskOrganizer / RecentsAnimationController to complete
// the cleanup.
mPipContentOverlay = new PipContentOverlay.PipAppIconOverlay(view.getContext(),
- mAppBounds, new IconProvider(context).getIcon(mActivityInfo),
- appIconSizePx);
+ mAppBounds, mDestinationBounds,
+ new IconProvider(context).getIcon(mActivityInfo), appIconSizePx);
final SurfaceControl.Transaction tx = new SurfaceControl.Transaction();
mPipContentOverlay.attach(tx, mLeash);
} else {
diff --git a/quickstep/src/com/android/quickstep/util/TransformParams.java b/quickstep/src/com/android/quickstep/util/TransformParams.java
index ca680db..ebcef30 100644
--- a/quickstep/src/com/android/quickstep/util/TransformParams.java
+++ b/quickstep/src/com/android/quickstep/util/TransformParams.java
@@ -16,13 +16,10 @@
package com.android.quickstep.util;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
-import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import android.util.FloatProperty;
import android.view.RemoteAnimationTarget;
-import com.android.app.animation.Interpolators;
-import com.android.launcher3.Utilities;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
@@ -152,19 +149,7 @@
if (activityType == ACTIVITY_TYPE_HOME) {
mHomeBuilderProxy.onBuildTargetParams(builder, app, this);
} else {
- // Fade out translucent overlay.
- // TODO(b/303351074): use app.isNotInRecents directly once it is fixed.
- boolean isNotInRecents = app.taskInfo != null
- && (app.taskInfo.baseIntent.getFlags()
- & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
- if (app.isTranslucent && isNotInRecents) {
- float progress = Utilities.boundToRange(getProgress(), 0, 1);
- builder.setAlpha(1 - Interpolators.DECELERATE_QUINT
- .getInterpolation(progress));
- } else {
- builder.setAlpha(getTargetAlpha());
- }
-
+ builder.setAlpha(getTargetAlpha());
proxy.onBuildTargetParams(builder, app, this);
}
} else {
diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
index 37fcf43..9c7f014 100644
--- a/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
+++ b/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
@@ -12,6 +12,7 @@
import androidx.test.runner.AndroidJUnit4
import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
+import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION
import com.android.launcher3.taskbar.TaskbarManager
import com.android.systemui.shared.rotation.RotationButton
import java.lang.IllegalStateException
@@ -59,7 +60,7 @@
@Test
fun getKidsLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = true
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
getLayoutter(
@@ -74,7 +75,7 @@
@Test
fun getSetupLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = true
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
getLayoutter(
@@ -89,7 +90,7 @@
@Test
fun getTaskbarNavLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = true
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
getLayoutter(
@@ -104,7 +105,7 @@
@Test(expected = IllegalStateException::class)
fun noValidLayoutForLargeScreenTaskbarNotPresent() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
getLayoutter(
isKidsMode = false,
@@ -117,7 +118,7 @@
@Test
fun getTaskbarPortraitLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
getLayoutter(
@@ -132,7 +133,7 @@
@Test
fun getTaskbarLandscapeLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
setDeviceProfileLandscape()
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
@@ -148,7 +149,7 @@
@Test
fun getTaskbarSeascapeLayoutter() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
setDeviceProfileLandscape()
val layoutter: NavButtonLayoutFactory.NavButtonLayoutter =
@@ -164,7 +165,7 @@
@Test(expected = IllegalStateException::class)
fun noValidLayoutForPhoneGestureNav() {
- assumeTrue(TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
+ assumeTrue(ENABLE_TASKBAR_NAVBAR_UNIFICATION)
mockDeviceProfile.isTaskbarPresent = false
getLayoutter(
isKidsMode = false,
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 12568ea..281516c 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -163,7 +163,7 @@
public void setUp() {
mLauncher.onTestStart();
AbstractLauncherUiTest.waitForSetupWizardDismissal();
- AbstractLauncherUiTest.verifyKeyguardInvisible();
+ AbstractLauncherUiTest.onTestStart();
}
@After
diff --git a/quickstep/tests/src/com/android/quickstep/TaplOverviewIconTest.java b/quickstep/tests/src/com/android/quickstep/TaplOverviewIconTest.java
index f51f286..c4c95bc 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplOverviewIconTest.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplOverviewIconTest.java
@@ -16,6 +16,8 @@
package com.android.quickstep;
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -25,6 +27,7 @@
import com.android.launcher3.tapl.OverviewTaskMenu;
import com.android.launcher3.ui.AbstractLauncherUiTest;
+import com.android.launcher3.util.rule.TestStabilityRule;
import org.junit.Before;
import org.junit.Test;
@@ -72,6 +75,7 @@
}
@Test
+ @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/288939273
public void testSplitTaskTapBothIconMenus() {
createAndLaunchASplitPair();
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 4075c55..0966350 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -16,6 +16,8 @@
package com.android.quickstep;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT;
@@ -46,6 +48,7 @@
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
+import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import com.android.quickstep.views.RecentsView;
@@ -355,7 +358,7 @@
@PortraitLandscape
@TaskbarModeSwitch(mode = PERSISTENT)
@PlatinumTest(focusArea = "launcher")
- @ScreenRecord
+ @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/309820115
public void testOverviewForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 81c2337..c0a1e0a 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -284,7 +284,8 @@
<dimen name="pre_drag_view_scale">6dp</dimen>
<!-- an icon with shortcuts must be dragged this far before the container is removed. -->
<dimen name="deep_shortcuts_start_drag_threshold">16dp</dimen>
- <dimen name="deep_shortcut_icon_size">32dp</dimen>
+ <!-- Possibly related to b/235886078, icon needs to be scaled up to match expected visual size of 32 dp -->
+ <dimen name="deep_shortcut_icon_size">35dp</dimen>
<dimen name="popup_margin">2dp</dimen>
<dimen name="popup_single_item_radius">100dp</dimen>
<dimen name="popup_smaller_radius">4dp</dimen>
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 73861c1..1c52a2f 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -23,6 +23,7 @@
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getDebugFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getIntFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getReleaseFlag;
+import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
import android.view.ViewConfiguration;
@@ -217,12 +218,19 @@
public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(270395798,
"ENABLE_TRANSIENT_TASKBAR", ENABLED, "Enables transient taskbar.");
+ public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION =
+ enableTaskbarNavbarUnification();
+
// Aconfig migration complete for ENABLE_TASKBAR_NO_RECREATION.
public static final BooleanFlag ENABLE_TASKBAR_NO_RECREATION = getDebugFlag(299193589,
"ENABLE_TASKBAR_NO_RECREATION", DISABLED,
"Enables taskbar with no recreation from lifecycle changes of TaskbarActivityContext.");
public static boolean enableTaskbarNoRecreate() {
- return ENABLE_TASKBAR_NO_RECREATION.get() || Flags.enableTaskbarNoRecreate();
+ return ENABLE_TASKBAR_NO_RECREATION.get() || Flags.enableTaskbarNoRecreate()
+ // Task bar pinning and task bar nav bar unification are both dependent on
+ // ENABLE_TASKBAR_NO_RECREATION. We want to turn ENABLE_TASKBAR_NO_RECREATION on
+ // when either of the dependent features is turned on.
+ || ENABLE_TASKBAR_PINNING.get() || ENABLE_TASKBAR_NAVBAR_UNIFICATION;
}
// TODO(Block 16): Clean up flags
diff --git a/src/com/android/launcher3/folder/PreviewItemManager.java b/src/com/android/launcher3/folder/PreviewItemManager.java
index 2e5f2e5..b39e968e 100644
--- a/src/com/android/launcher3/folder/PreviewItemManager.java
+++ b/src/com/android/launcher3/folder/PreviewItemManager.java
@@ -43,6 +43,7 @@
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
import java.util.ArrayList;
@@ -434,7 +435,8 @@
drawable.setLevel(item.getProgressLevel());
p.drawable = drawable;
} else {
- p.drawable = item.newIcon(mContext, FLAG_THEMED);
+ p.drawable = item.newIcon(mContext,
+ Themes.isThemedIconEnabled(mContext) ? FLAG_THEMED : 0);
}
p.drawable.setBounds(0, 0, mIconSize, mIconSize);
p.item = item;
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 685e4f1..e3314d4 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -127,6 +127,7 @@
protected final float mElevation;
+ // Tag for Views that have children that will need to be iterated to add styling.
private final String mIterateChildrenTag;
protected final int[] mColorIds;
@@ -244,7 +245,7 @@
for (int i = 0; i < count; i++) {
View view = viewGroup.getChildAt(i);
if (view.getVisibility() == VISIBLE) {
- if (lastView != null) {
+ if (lastView != null && (isShortcutContainer(lastView))) {
MarginLayoutParams mlp = (MarginLayoutParams) lastView.getLayoutParams();
mlp.bottomMargin = mChildContainerMargin;
}
diff --git a/src/com/android/launcher3/testing/TestLogging.java b/src/com/android/launcher3/testing/TestLogging.java
index 70691f8..60d0e95 100644
--- a/src/com/android/launcher3/testing/TestLogging.java
+++ b/src/com/android/launcher3/testing/TestLogging.java
@@ -76,7 +76,7 @@
// be more useful.
// That's why we pass false as the value for the 'reportToTapl' parameter.
recordEventSlow(sequence, message + ": " + event, false);
- registerEventNotFromTest(event);
+ if (action != MotionEvent.ACTION_CANCEL) registerEventNotFromTest(event);
}
}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index cf59085..cbc85b6 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -149,6 +149,13 @@
public void assignMarginsAndBackgrounds(ViewGroup viewGroup) {
assignMarginsAndBackgrounds(viewGroup,
getColorStateList(getContext(), mColorIds[0]).getDefaultColor());
+ // last shortcut doesn't need bottom margin
+ final int count = viewGroup.getChildCount() - 1;
+ for (int i = 0; i < count; i++) {
+ // These are shortcuts and not shortcut containers, but they still need bottom margin
+ MarginLayoutParams mlp = (MarginLayoutParams) viewGroup.getChildAt(i).getLayoutParams();
+ mlp.bottomMargin = mChildContainerMargin;
+ }
}
public static <T extends Context & ActivityContext> OptionsPopupView<T> show(
diff --git a/tests/Launcher3Tests.xml b/tests/Launcher3Tests.xml
index 3fff622..0aed1e1 100644
--- a/tests/Launcher3Tests.xml
+++ b/tests/Launcher3Tests.xml
@@ -46,5 +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" />
</test>
</configuration>
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 9bfafcf..8847b8b 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -45,6 +45,7 @@
import android.system.OsConstants;
import android.util.Log;
+import androidx.annotation.NonNull;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
@@ -108,7 +109,7 @@
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
protected LooperExecutor mMainThreadExecutor = MAIN_EXECUTOR;
- protected final UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
+ protected final UiDevice mDevice = getUiDevice();
protected final LauncherInstrumentation mLauncher = new LauncherInstrumentation();
protected Context mTargetContext;
protected String mTargetPackage;
@@ -160,7 +161,7 @@
if (TestHelpers.isInLauncherProcess()) {
Debug.dumpHprofData(fileName);
} else {
- final UiDevice device = UiDevice.getInstance(getInstrumentation());
+ final UiDevice device = getUiDevice();
device.executeShellCommand(
"am dumpheap " + device.getLauncherPackageName() + " " + fileName);
}
@@ -249,11 +250,6 @@
mLauncher.onTestStart();
waitForSetupWizardDismissal();
- if (TestStabilityRule.isPresubmit()) {
- aggressivelyUnlockSysUi();
- } else {
- verifyKeyguardInvisible();
- }
final String launcherPackageName = mDevice.getLauncherPackageName();
try {
@@ -285,23 +281,38 @@
}
}
- verifyKeyguardInvisible();
+ onTestStart();
}
- private boolean hasSystemUiObject(String resId) {
- return mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, resId));
+ /** Method that should be called when a test starts. */
+ public static void onTestStart() {
+ if (TestStabilityRule.isPresubmit()) {
+ aggressivelyUnlockSysUi();
+ } else {
+ verifyKeyguardInvisible();
+ }
}
- // Seeing if this will decrease: b/303755862
- void aggressivelyUnlockSysUi() {
+ private static boolean hasSystemUiObject(String resId) {
+ return getUiDevice().hasObject(
+ By.res(SYSTEMUI_PACKAGE, resId));
+ }
+
+ @NonNull
+ private static UiDevice getUiDevice() {
+ return UiDevice.getInstance(getInstrumentation());
+ }
+
+ private static void aggressivelyUnlockSysUi() {
+ final UiDevice device = getUiDevice();
for (int i = 0; i < 10 && hasSystemUiObject("keyguard_status_view"); ++i) {
Log.d(TAG, "Before attempting to unlock the phone");
try {
- mDevice.executeShellCommand("input keyevent 82");
+ device.executeShellCommand("input keyevent 82");
} catch (IOException e) {
throw new RuntimeException(e);
}
- mDevice.waitForIdle();
+ device.waitForIdle();
}
Assert.assertTrue("Keyguard still visible",
TestHelpers.wait(
@@ -321,9 +332,11 @@
// TODO(309471958) Productize killing/dismissal of setup wizard.
/** Waits for setup wizard to go away. */
public static void waitForSetupWizardDismissal() {
- if (sFirstTimeWaitingForWizard && TestStabilityRule.isPresubmit()) {
+ if (!TestStabilityRule.isPresubmit()) return;
+
+ if (sFirstTimeWaitingForWizard) {
try {
- UiDevice.getInstance(getInstrumentation()).executeShellCommand(
+ getUiDevice().executeShellCommand(
"am force-stop com.google.android.setupwizard");
} catch (IOException e) {
throw new RuntimeException(e);
@@ -334,12 +347,10 @@
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);
+ Assert.assertTrue("Setup wizard is still visible", wizardDismissed);
}
- public static void verifyKeyguardInvisible() {
+ private static void verifyKeyguardInvisible() {
final boolean keyguardAlreadyVisible = sSeenKeyguard;
sSeenKeyguard = sSeenKeyguard
diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
index 62d70ad..10b428a 100644
--- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
+++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
@@ -59,8 +59,9 @@
throw new AssertionError(
"Launcher received events not sent by the test. This may mean "
+ "that the touch screen of the lab device has sent false"
- + " events. See the logcat for TaplEvents tag and look "
- + "for events with deviceId != -1");
+ + " events. See the logcat for "
+ + "TaplEvents|LauncherEvents|TaplTarget tag and look for "
+ + "events with deviceId != -1");
}
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 17169b3..e30885b 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -564,6 +564,9 @@
if (hasSystemLauncherObject(OVERVIEW_RES_ID)) return "Overview";
if (hasLauncherObject(WORKSPACE_RES_ID)) return "Workspace";
if (hasLauncherObject(APPS_RES_ID)) return "AllApps";
+ if (mDevice.hasObject(By.pkg(getLauncherPackageName()).depth(0))) {
+ return "<Launcher in invalid state>";
+ }
return "LaunchedApp (" + getVisiblePackages() + ")";
}
@@ -2063,6 +2066,7 @@
}
// TODO(b/270393900): Remove with ENABLE_ALL_APPS_SEARCH_IN_TASKBAR flag cleanup.
+
/** Refreshes the known overview target in TIS. */
public void refreshOverviewTarget() {
getTestInfo(TestProtocol.REQUEST_REFRESH_OVERVIEW_TARGET);