Merge changes from topic "toast-polish" into tm-mainline-prod
* changes:
[automerge] [Toast] Polish the layout of the QSB, tabs and header protection. 2p: a5e95419f5
[Toast] Polish the layout of the QSB, tabs and header protection.
diff --git a/Android.bp b/Android.bp
index 5a153a7..b3027bc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,6 +31,7 @@
"androidx.test.uiautomator_uiautomator",
"androidx.preference_preference",
"SystemUISharedLib",
+ "SystemUIAnimationLib",
],
srcs: [
"tests/tapl/**/*.java",
@@ -196,6 +197,7 @@
"lottie",
"SystemUISharedLib",
"SystemUI-statsd",
+ "SystemUIAnimationLib",
],
manifest: "quickstep/AndroidManifest.xml",
min_sdk_version: "current",
@@ -304,6 +306,7 @@
"SystemUISharedLib",
"Launcher3CommonDepsLib",
"QuickstepResLib",
+ "SystemUIAnimationLib",
],
manifest: "quickstep/AndroidManifest.xml",
platform_apis: true,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index ebe6a04..eed67b6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -29,13 +29,16 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseQuickstepLauncher;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.Utilities;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.views.RecentsView;
+import com.android.systemui.animation.ViewRootSync;
import com.android.systemui.shared.recents.model.ThumbnailData;
import java.util.HashMap;
@@ -76,6 +79,9 @@
private boolean mShouldDelayLauncherStateAnim;
+ // We skip any view synchronizations during init/destroy.
+ private boolean mCanSyncViews;
+
private final StateManager.StateListener<LauncherState> mStateListener =
new StateManager.StateListener<LauncherState>() {
@@ -102,6 +108,8 @@
};
public void init(TaskbarControllers controllers, BaseQuickstepLauncher launcher) {
+ mCanSyncViews = false;
+
mControllers = controllers;
mLauncher = launcher;
@@ -121,9 +129,13 @@
updateStateForFlag(FLAG_RESUMED, launcher.hasBeenResumed());
mLauncherState = launcher.getStateManager().getState();
applyState(0);
+
+ mCanSyncViews = true;
}
public void onDestroy() {
+ mCanSyncViews = false;
+
mIconAlignmentForResumedState.finishAnimation();
mIconAlignmentForGestureState.finishAnimation();
mIconAlignmentForLauncherState.finishAnimation();
@@ -131,6 +143,8 @@
mIconAlphaForHome.setConsumer(null);
mLauncher.getHotseat().setIconsAlpha(1f);
mLauncher.getStateManager().removeStateListener(mStateListener);
+
+ mCanSyncViews = true;
}
public Animator createAnimToLauncher(@NonNull LauncherState toState,
@@ -380,6 +394,27 @@
return;
}
float alignment = alignmentSupplier.get();
+ float currentValue = mIconAlphaForHome.getValue();
+ boolean taskbarWillBeVisible = alignment < 1;
+ boolean firstFrameVisChanged = (taskbarWillBeVisible && Float.compare(currentValue, 1) != 0)
+ || (!taskbarWillBeVisible && Float.compare(currentValue, 0) != 0);
+
+ // Sync the first frame where we swap taskbar and hotseat.
+ if (firstFrameVisChanged && mCanSyncViews && !Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ DeviceProfile dp = mLauncher.getDeviceProfile();
+
+ // Do all the heavy work before the sync.
+ mControllers.taskbarViewController.createIconAlignmentControllerIfNotExists(dp);
+
+ ViewRootSync.synchronizeNextDraw(mLauncher.getHotseat(),
+ mControllers.taskbarActivityContext.getDragLayer(),
+ () -> updateIconAlignment(alignment));
+ } else {
+ updateIconAlignment(alignment);
+ }
+ }
+
+ private void updateIconAlignment(float alignment) {
mControllers.taskbarViewController.setLauncherIconAlignment(
alignment, mLauncher.getDeviceProfile());
@@ -409,7 +444,8 @@
@Override
public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
- endGestureStateOverride(true);
+ boolean isInOverview = mLauncher.isInState(LauncherState.OVERVIEW);
+ endGestureStateOverride(!isInOverview);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 7abe6d4..3521ee3 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -28,10 +28,12 @@
import android.animation.AnimatorSet;
import android.annotation.Nullable;
import android.content.SharedPreferences;
+import android.util.Log;
import android.view.ViewConfiguration;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Utilities;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.SystemUiProxy;
@@ -566,6 +568,10 @@
* unstashed.
*/
public void updateStateForFlag(int flag, boolean enabled) {
+ if (flag == FLAG_IN_APP && TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format(
+ "setting flag FLAG_IN_APP to: %b", enabled), new Exception());
+ }
if (enabled) {
mState |= flag;
} else {
@@ -667,6 +673,14 @@
}
boolean isStashed = mStashCondition.test(flags);
if (mIsStashed != isStashed) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format(
+ "setState: mIsStashed=%b, isStashed=%b, duration=%d, start=:%b",
+ mIsStashed,
+ isStashed,
+ duration,
+ start));
+ }
mIsStashed = isStashed;
// This sets mAnimator.
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index f5c382d..e1ce898 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -200,15 +200,23 @@
}
/**
+ * Creates the icon alignment controller if it does not already exist.
+ * @param launcherDp Launcher device profile.
+ */
+ public void createIconAlignmentControllerIfNotExists(DeviceProfile launcherDp) {
+ if (mIconAlignControllerLazy == null) {
+ mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
+ }
+ }
+
+ /**
* Sets the taskbar icon alignment relative to Launcher hotseat icons
* @param alignmentRatio [0, 1]
* 0 => not aligned
* 1 => fully aligned
*/
public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) {
- if (mIconAlignControllerLazy == null) {
- mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
- }
+ createIconAlignmentControllerIfNotExists(launcherDp);
mIconAlignControllerLazy.setPlayFraction(alignmentRatio);
if (alignmentRatio <= 0 || alignmentRatio >= 1) {
// Cleanup lazy controller so that it is created again in next animation
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 9f35507..6e80402 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -583,7 +583,7 @@
} else {
runningTasks = new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()};
}
- mRecentsView.onGestureAnimationStart(runningTasks);
+ mRecentsView.onGestureAnimationStart(runningTasks, mDeviceState.getRotationTouchHelper());
}
private void launcherFrameDrawn() {
diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
index ed81d7e..9828467 100644
--- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -212,7 +212,8 @@
if (mRunningOverHome) {
if (DisplayController.getNavigationMode(mContext).hasGestures) {
mRecentsView.onGestureAnimationStartOnHome(
- new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()});
+ new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()},
+ mDeviceState.getRotationTouchHelper());
}
} else {
super.notifyGestureAnimationStartToRecents();
@@ -262,15 +263,13 @@
} else {
mHomeAlpha = new AnimatedFloat(this::updateHomeAlpha);
mHomeAlpha.value = 0;
- runActionOnRemoteHandles(remoteTargetHandle ->
- remoteTargetHandle.getTransformParams().setHomeBuilderProxy(
- FallbackHomeAnimationFactory.this
- ::updateHomeActivityTransformDuringHomeAnim));
+ mHomeAlphaParams.setHomeBuilderProxy(
+ this::updateHomeActivityTransformDuringHomeAnim);
}
mRecentsAlpha.value = 1;
runActionOnRemoteHandles(remoteTargetHandle ->
- remoteTargetHandle.getTransformParams().setHomeBuilderProxy(
+ remoteTargetHandle.getTransformParams().setBaseBuilderProxy(
FallbackHomeAnimationFactory.this
::updateRecentsActivityTransformDuringHomeAnim));
}
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
index e6f73dc..eda2c5a 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -42,6 +42,7 @@
import com.android.quickstep.FallbackActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.RecentsActivity;
+import com.android.quickstep.RotationTouchHelper;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.TaskViewSimulator;
@@ -86,11 +87,12 @@
* to the home task. This allows us to handle quick-switch similarly to a quick-switching
* from a foreground task.
*/
- public void onGestureAnimationStartOnHome(RunningTaskInfo[] homeTaskInfo) {
+ public void onGestureAnimationStartOnHome(RunningTaskInfo[] homeTaskInfo,
+ RotationTouchHelper rotationTouchHelper) {
// TODO(b/195607777) General fallback love, but this might be correct
// Home task should be defined as the front-most task info I think?
mHomeTaskInfo = homeTaskInfo[0];
- onGestureAnimationStart(homeTaskInfo);
+ onGestureAnimationStart(homeTaskInfo, rotationTouchHelper);
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 25f8f01..52aad27 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -154,6 +154,7 @@
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.RemoteTargetGluer;
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
+import com.android.quickstep.RotationTouchHelper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
@@ -2084,11 +2085,13 @@
/**
* Called when a gesture from an app is starting.
*/
- public void onGestureAnimationStart(RunningTaskInfo[] runningTaskInfo) {
+ public void onGestureAnimationStart(RunningTaskInfo[] runningTaskInfo,
+ RotationTouchHelper rotationTouchHelper) {
mGestureActive = true;
// This needs to be called before the other states are set since it can create the task view
if (mOrientationState.setGestureActive(true)) {
- updateOrientationHandler();
+ setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
+ rotationTouchHelper.getDisplayRotation());
}
showCurrentTask(runningTaskInfo);
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 399cd10..4d38822 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -32,7 +32,6 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.tapl.HomeAllApps;
import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.Overview;
@@ -45,7 +44,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -295,26 +293,16 @@
getAndAssertLaunchedApp();
}
- // TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
- // after the bug resolved.
- @Ignore("b/205027405")
@Test
@PortraitLandscape
- @ScreenRecord
+ @NavigationModeSwitch
public void testPressBack() throws Exception {
mLauncher.getWorkspace().switchToAllApps();
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
- HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
- allApps.freeze();
- try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
- } finally {
- allApps.unfreeze();
- }
- mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
+ startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b42a208..9a41070 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -61,6 +61,10 @@
<dimen name="drop_target_top_margin">36dp</dimen>
<dimen name="drop_target_bottom_margin">16dp</dimen>
+ <!-- Button drop target bar -->
+ <dimen name="button_drop_target_min_text_size">10sp</dimen>
+ <dimen name="button_drop_target_resize_text_increment">1sp</dimen>
+
<!-- App Widget resize frame -->
<dimen name="widget_handle_margin">13dp</dimen>
<dimen name="resize_frame_background_padding">24dp</dimen>
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index 69150c5..0b07c95 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -140,7 +140,7 @@
y = -getMeasuredHeight();
message.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
if (mToolTipLocation == TOOLTIP_LEFT) {
- x = - getMeasuredWidth() - message.getMeasuredWidth() / 2;
+ x = -getMeasuredWidth() - message.getMeasuredWidth() / 2;
} else {
x = getMeasuredWidth() / 2 + message.getMeasuredWidth() / 2;
}
@@ -324,6 +324,40 @@
hideTooltip();
}
+
+ /**
+ * Reduce the size of the text until it fits or reaches a minimum.
+ *
+ * The minimum size is defined by {@code R.dimen.button_drop_target_min_text_size} and
+ * it diminishes by intervals defined by
+ * {@code R.dimen.button_drop_target_resize_text_increment}
+ * This functionality is very similar to the option
+ * {@link TextView#setAutoSizeTextTypeWithDefaults(int)} but can't be used in this view because
+ * the layout width is {@code WRAP_CONTENT}.
+ *
+ * @param availableWidth Available width in the button to fit the text, used in
+ * {@code ButtonDropTarget#isTextTruncated(int)}
+ * @return The biggest text size in SP that makes the text fit or if the text can't fit returns
+ * the min available value
+ */
+ public float resizeTextToFit(int availableWidth) {
+ float minSize = Utilities.pxToSp(getResources()
+ .getDimensionPixelSize(R.dimen.button_drop_target_min_text_size));
+ float step = Utilities.pxToSp(getResources()
+ .getDimensionPixelSize(R.dimen.button_drop_target_resize_text_increment));
+ float textSize = Utilities.pxToSp(getTextSize());
+
+ while (textSize > minSize) {
+ if (isTextTruncated(availableWidth)) {
+ textSize -= step;
+ setTextSize(textSize);
+ } else {
+ return textSize;
+ }
+ }
+ return minSize;
+ }
+
public boolean isTextTruncated(int availableWidth) {
availableWidth -= (getPaddingLeft() + getPaddingRight() + mDrawable.getIntrinsicWidth()
+ getCompoundDrawablePadding());
diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java
index 73289fb..b94cdbf 100644
--- a/src/com/android/launcher3/DropTargetBar.java
+++ b/src/com/android/launcher3/DropTargetBar.java
@@ -140,9 +140,22 @@
if (visibleCount > 0) {
int availableWidth = width / visibleCount;
boolean textVisible = true;
- for (ButtonDropTarget buttons : mDropTargets) {
- if (buttons.getVisibility() != GONE) {
- textVisible = textVisible && !buttons.isTextTruncated(availableWidth);
+ boolean textResized = false;
+ float textSize = mDropTargets[0].getTextSize();
+ for (ButtonDropTarget button : mDropTargets) {
+ if (button.getVisibility() == GONE) {
+ continue;
+ }
+ if (button.isTextTruncated(availableWidth)) {
+ textSize = Math.min(textSize, button.resizeTextToFit(availableWidth));
+ textResized = true;
+ }
+ textVisible = textVisible && !button.isTextTruncated(availableWidth);
+ }
+
+ if (textResized) {
+ for (ButtonDropTarget button : mDropTargets) {
+ button.setTextSize(textSize);
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 2636d55..847a9bf 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1189,6 +1189,7 @@
mOverlayManager.onActivityResumed(this);
}
+ AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE);
TraceHelper.INSTANCE.endSection(traceToken);
}
@@ -1692,9 +1693,6 @@
outState.remove(RUNTIME_STATE_WIDGET_PANEL);
}
- // We close any open folders and shortcut containers that are not safe for rebind,
- // and we need to make sure this state is reflected.
- AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE);
finishAutoCancelActionMode();
if (mPendingRequestArgs != null) {
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 972a2e4..8192057 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -483,6 +483,11 @@
return res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
+ /** Converts a pixel value (px) to scale pixel value (SP) for the current device. */
+ public static float pxToSp(float size) {
+ return size / Resources.getSystem().getDisplayMetrics().scaledDensity;
+ }
+
public static float dpiFromPx(float size, int densityDpi) {
float densityRatio = (float) densityDpi / DisplayMetrics.DENSITY_DEFAULT;
return (size / densityRatio);
diff --git a/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java b/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
index 3e3f633..72956b0 100644
--- a/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
+++ b/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
@@ -62,8 +62,7 @@
R.layout.widget_shortcut_container,
mPopupContainerWithArrow));
}
- mPopupContainerWithArrow.initializeSystemShortcut(
- R.layout.system_shortcut,
+ mPopupContainerWithArrow.initializeWidgetShortcut(
mPopupContainerWithArrow.getWidgetContainer(),
widgetInfo);
} else {
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 7692bbf..bd3778a 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -90,6 +90,7 @@
private BubbleTextView mOriginalIcon;
private int mNumNotifications;
private NotificationContainer mNotificationContainer;
+ private int mContainerWidth;
private ViewGroup mWidgetContainer;
@@ -104,6 +105,7 @@
super(context, attrs, defStyleAttr);
mStartDragThreshold = getResources().getDimensionPixelSize(
R.dimen.deep_shortcuts_start_drag_threshold);
+ mContainerWidth = getResources().getDimensionPixelSize(R.dimen.bg_popup_item_width);
}
public PopupContainerWithArrow(Context context, AttributeSet attrs) {
@@ -246,14 +248,15 @@
mOriginalIcon = originalIcon;
boolean hasDeepShortcuts = shortcutCount > 0;
- int containerWidth = (int) getResources().getDimension(R.dimen.bg_popup_item_width);
+ mContainerWidth = getResources().getDimensionPixelSize(R.dimen.bg_popup_item_width);
// if there are deep shortcuts, we might want to increase the width of shortcuts to fit
// horizontally laid out system shortcuts.
if (hasDeepShortcuts) {
- containerWidth = (int) Math.max(containerWidth,
- systemShortcuts.size() * getResources().getDimension(
- R.dimen.system_shortcut_header_icon_touch_size));
+ mContainerWidth = Math.max(mContainerWidth,
+ systemShortcuts.size() * getResources()
+ .getDimensionPixelSize(R.dimen.system_shortcut_header_icon_touch_size)
+ );
}
// Add views
if (mNumNotifications > 0) {
@@ -277,7 +280,7 @@
for (int i = shortcutCount; i > 0; i--) {
DeepShortcutView v = inflateAndAdd(R.layout.deep_shortcut, mDeepShortcutContainer);
- v.getLayoutParams().width = containerWidth;
+ v.getLayoutParams().width = mContainerWidth;
mShortcuts.add(v);
}
updateHiddenShortcuts();
@@ -289,8 +292,7 @@
mWidgetContainer = inflateAndAdd(R.layout.widget_shortcut_container,
this);
}
- initializeSystemShortcut(R.layout.system_shortcut, mWidgetContainer,
- shortcut);
+ initializeWidgetShortcut(mWidgetContainer, shortcut);
}
}
mSystemShortcutContainer = inflateAndAdd(R.layout.system_shortcut_icons, this);
@@ -384,7 +386,12 @@
}
}
- protected void initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) {
+ protected void initializeWidgetShortcut(ViewGroup container, SystemShortcut info) {
+ View view = initializeSystemShortcut(R.layout.system_shortcut, container, info);
+ view.getLayoutParams().width = mContainerWidth;
+ }
+
+ protected View initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) {
View view = inflateAndAdd(
resId, container, getInsertIndexForSystemShortcut(container, info));
if (view instanceof DeepShortcutView) {
@@ -398,6 +405,7 @@
}
view.setTag(info);
view.setOnClickListener(info);
+ return view;
}
/**
diff --git a/src/com/android/launcher3/settings/NotificationDotsPreference.java b/src/com/android/launcher3/settings/NotificationDotsPreference.java
index f2a052d..1816e7b 100644
--- a/src/com/android/launcher3/settings/NotificationDotsPreference.java
+++ b/src/com/android/launcher3/settings/NotificationDotsPreference.java
@@ -90,7 +90,7 @@
Bundle extras = new Bundle();
extras.putString(EXTRA_FRAGMENT_ARG_KEY, "notification_badging");
- setIntent(new Intent("android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY")
+ setIntent(new Intent("android.settings.NOTIFICATION_SETTINGS")
.putExtra(EXTRA_SHOW_FRAGMENT_ARGS, extras));
}
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index faf5817..e8fd2ff 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -136,6 +136,6 @@
public static final String NO_DROP_TARGET = "b/195031154";
public static final String NULL_INT_SET = "b/200572078";
public static final String MISSING_PROMISE_ICON = "b/202985412";
-
public static final String BAD_STATE = "b/223498680";
+ public static final String TASKBAR_IN_APP_STATE = "b/227657604";
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 73e9823..f0bef24 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -24,6 +24,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import android.content.Intent;
import android.graphics.Point;
import androidx.test.filters.LargeTest;
@@ -50,7 +51,6 @@
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -391,7 +391,6 @@
folder.close();
}
- @Ignore("b/205027405")
@Test
@PortraitLandscape
public void testPressBack() throws Exception {
@@ -400,14 +399,7 @@
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
- HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
- allApps.freeze();
- try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
- } finally {
- allApps.unfreeze();
- }
- mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
+ startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 84ef149..950e72c 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -113,6 +113,7 @@
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
+ static final Pattern EVENT_TOUCH_CANCEL_TIS = getTouchEventPatternTIS("ACTION_CANCEL");
static final Pattern EVENT_KEY_BACK_DOWN = getKeyEventPattern("ACTION_DOWN", "KEYCODE_BACK");
static final Pattern EVENT_KEY_BACK_UP = getKeyEventPattern("ACTION_UP", "KEYCODE_BACK");
@@ -135,6 +136,8 @@
public enum GestureScope {
OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE,
INSIDE_TO_OUTSIDE_WITHOUT_PILFER,
+ INSIDE_TO_OUTSIDE_WITH_KEYCODE, // For gestures that will trigger a keycode from TIS.
+ OUTSIDE_WITH_KEYCODE,
}
// Base class for launcher containers.
@@ -967,9 +970,11 @@
if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
final Point displaySize = getRealDisplaySize();
final GestureScope gestureScope =
- launcherVisible ? GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER
- : GestureScope.OUTSIDE_WITHOUT_PILFER;
- linearGesture(0, displaySize.y / 2, displaySize.x / 2, displaySize.y / 2,
+ launcherVisible ? GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
+ : GestureScope.OUTSIDE_WITH_KEYCODE;
+ // TODO(b/225505986): change startY and endY back to displaySize.y / 2 once the
+ // issue is solved.
+ linearGesture(0, displaySize.y / 4, displaySize.x / 2, displaySize.y / 4,
10, false, gestureScope);
} else {
waitForNavigationUiObject("back").click();
@@ -1505,7 +1510,8 @@
switch (action) {
case MotionEvent.ACTION_DOWN:
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
- && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) {
+ && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
+ && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE) {
expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN);
}
if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) {
@@ -1520,14 +1526,18 @@
expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS);
}
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
- && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) {
+ && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
+ && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE) {
expectEvent(TestProtocol.SEQUENCE_MAIN,
gestureScope == GestureScope.INSIDE
|| gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER
? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL);
}
if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) {
- expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
+ expectEvent(TestProtocol.SEQUENCE_TIS,
+ gestureScope == GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
+ || gestureScope == GestureScope.OUTSIDE_WITH_KEYCODE
+ ? EVENT_TOUCH_CANCEL_TIS : EVENT_TOUCH_UP_TIS);
}
break;
}