Merge "Add flags for new home gardening mode" into tm-qpr-dev
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index fb78ef7..765d36c 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -268,6 +268,7 @@
<dimen name="taskbar_stashed_handle_height">4dp</dimen>
<dimen name="taskbar_edu_wave_anim_trans_y">25dp</dimen>
<dimen name="taskbar_edu_wave_anim_trans_y_return_overshoot">4dp</dimen>
+ <dimen name="taskbar_edu_horizontal_margin">112dp</dimen>
<dimen name="taskbar_nav_buttons_width_kids">88dp</dimen>
<dimen name="taskbar_nav_buttons_height_kids">40dp</dimen>
<dimen name="taskbar_nav_buttons_corner_radius_kids">40dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
index a219ac6..5178968 100644
--- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
@@ -38,6 +38,7 @@
import com.android.launcher3.QuickstepTransitionManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.model.data.ItemInfo;
@@ -116,7 +117,8 @@
@Override
protected boolean isTaskbarTouchable() {
- return !mTaskbarLauncherStateController.isAnimatingToLauncher();
+ return !(mTaskbarLauncherStateController.isAnimatingToLauncher()
+ && mTaskbarLauncherStateController.goingToAlignedLauncherState());
}
public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) {
@@ -291,9 +293,14 @@
@Override
public void setSystemGestureInProgress(boolean inProgress) {
super.setSystemGestureInProgress(inProgress);
- // Launcher's ScrimView will draw the background throughout the gesture. But once the
- // gesture ends, start drawing taskbar's background again since launcher might stop drawing.
- forceHideBackground(inProgress);
+ // TODO(b/250645563): Don't show round corners when leaving in-app state, and remove
+ // forceHideBackground call entirely.
+ if (!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
+ // Launcher's ScrimView will draw the background throughout the gesture. But once the
+ // gesture ends, start drawing taskbar's background again since launcher might stop
+ // drawing.
+ forceHideBackground(inProgress);
+ }
}
/**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 2b80b75..707023b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -165,6 +165,7 @@
* Cleans up all controllers.
*/
public void onDestroy() {
+ mAreAllControllersInitialized = false;
mSharedState = null;
navbarButtonsViewController.onDestroy();
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
index 454a2a4..95b93fe 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
@@ -220,5 +220,9 @@
v -> mTaskbarEduView.snapToPage(currentPage + 1));
}
}
+
+ int getIconLayoutBoundsWidth() {
+ return mControllers.taskbarViewController.getIconLayoutBounds().width();
+ }
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java
index 89d67be..c0cbbd6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java
@@ -39,6 +39,9 @@
private final Rect mInsets = new Rect();
+ // Initialized in init.
+ private TaskbarEduController.TaskbarEduCallbacks mTaskbarEduCallbacks;
+
private Button mStartButton;
private Button mEndButton;
private TaskbarEduPagedView mPagedView;
@@ -56,6 +59,7 @@
if (mPagedView != null) {
mPagedView.setControllerCallbacks(callbacks);
}
+ mTaskbarEduCallbacks = callbacks;
}
@Override
@@ -101,6 +105,22 @@
Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING, 0);
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ int contentWidth = Math.min(getContentAreaWidth(), getMeasuredWidth());
+ contentWidth = Math.max(contentWidth, mTaskbarEduCallbacks.getIconLayoutBoundsWidth());
+ int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY);
+
+ mContent.measure(contentAreaWidthSpec, MeasureSpec.UNSPECIFIED);
+ }
+
+ private int getContentAreaWidth() {
+ return mTaskbarEduCallbacks.getIconLayoutBoundsWidth()
+ + getResources().getDimensionPixelSize(R.dimen.taskbar_edu_horizontal_margin) * 2;
+ }
+
/** Show the Education flow. */
public void show() {
attachToContainer();
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 7b2b7ec..079e8a1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -44,7 +44,7 @@
/** The bottom insets taskbar provides to the IME when IME is visible. */
val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize(
KtR.dimen.taskbar_ime_size)
- private val contentRegion: Region = Region()
+ private val touchableRegion: Region = Region()
private val deviceProfileChangeListener = { _: DeviceProfile ->
onTaskbarWindowHeightOrInsetsChanged()
}
@@ -77,10 +77,11 @@
}
fun onTaskbarWindowHeightOrInsetsChanged() {
- var contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
- contentRegion.set(0, windowLayoutParams.height - contentHeight,
+ val touchableHeight = controllers.taskbarStashController.touchableHeight
+ touchableRegion.set(0, windowLayoutParams.height - touchableHeight,
context.deviceProfile.widthPx, windowLayoutParams.height)
- var tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
+ val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
+ val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
for (provider in windowLayoutParams.providedInsets) {
if (provider.type == ITYPE_EXTRA_NAVIGATION_BAR) {
provider.insetsSize = Insets.of(0, 0, 0, contentHeight)
@@ -154,7 +155,7 @@
if (context.isTaskbarWindowFullscreen) {
TOUCHABLE_INSETS_FRAME
} else {
- insetsInfo.touchableRegion.set(contentRegion)
+ insetsInfo.touchableRegion.set(touchableRegion)
TOUCHABLE_INSETS_REGION
}
)
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 4b0adb1..b9bcf1b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -67,7 +67,7 @@
public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 4; // setup wizard and AllSetActivity
public static final int FLAG_STASHED_IN_APP_IME = 1 << 5; // IME is visible
public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 6;
- public static final int FLAG_STASHED_IN_APP_ALL_APPS = 1 << 7; // All apps is visible.
+ public static final int FLAG_STASHED_IN_TASKBAR_ALL_APPS = 1 << 7; // All apps is visible.
public static final int FLAG_IN_SETUP = 1 << 8; // In the Setup Wizard
public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 9; // phone screen gesture nav, stashed
@@ -77,8 +77,8 @@
// If we're in an app and any of these flags are enabled, taskbar should be stashed.
private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
| FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP
- | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_APP_ALL_APPS |
- FLAG_STASHED_SMALL_SCREEN;
+ | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_TASKBAR_ALL_APPS
+ | FLAG_STASHED_SMALL_SCREEN;
private static final int FLAGS_STASHED_IN_APP_IGNORING_IME =
FLAGS_STASHED_IN_APP & ~FLAG_STASHED_IN_APP_IME;
@@ -88,7 +88,7 @@
// Currently any flag that causes us to stash in an app is included, except for IME or All Apps
// since those cover the underlying app anyway and thus the app shouldn't change insets.
private static final int FLAGS_REPORT_STASHED_INSETS_TO_APP = FLAGS_STASHED_IN_APP
- & ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_APP_ALL_APPS;
+ & ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_TASKBAR_ALL_APPS;
/**
* How long to stash/unstash when manually invoked via long press.
@@ -168,9 +168,11 @@
boolean inApp = hasAnyFlag(flags, FLAGS_IN_APP);
boolean stashedInApp = hasAnyFlag(flags, FLAGS_STASHED_IN_APP);
boolean stashedLauncherState = hasAnyFlag(flags, FLAG_IN_STASHED_LAUNCHER_STATE);
+ boolean stashedInTaskbarAllApps =
+ hasAnyFlag(flags, FLAG_STASHED_IN_TASKBAR_ALL_APPS);
boolean stashedForSmallScreen = hasAnyFlag(flags, FLAG_STASHED_SMALL_SCREEN);
return (inApp && stashedInApp) || (!inApp && stashedLauncherState)
- || stashedForSmallScreen;
+ || stashedInTaskbarAllApps || stashedForSmallScreen;
});
public TaskbarStashController(TaskbarActivityContext activity) {
@@ -317,6 +319,13 @@
}
/**
+ * Returns the height that taskbar will be touchable.
+ */
+ public int getTouchableHeight() {
+ return mIsStashed ? mStashedHeight : mUnstashedHeight;
+ }
+
+ /**
* Returns the height that taskbar will inset when inside apps.
* @see WindowInsets.Type#navigationBars()
* @see WindowInsets.Type#systemBars()
@@ -659,7 +668,7 @@
return;
}
- updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, false);
+ updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
if (applyState) {
applyState(ALL_APPS.getTransitionDuration(
mControllers.taskbarActivityContext, false /* isToState */));
@@ -779,7 +788,7 @@
appendFlag(str, flags, FLAG_STASHED_IN_APP_SETUP, "FLAG_STASHED_IN_APP_SETUP");
appendFlag(str, flags, FLAG_STASHED_IN_APP_IME, "FLAG_STASHED_IN_APP_IME");
appendFlag(str, flags, FLAG_IN_STASHED_LAUNCHER_STATE, "FLAG_IN_STASHED_LAUNCHER_STATE");
- appendFlag(str, flags, FLAG_STASHED_IN_APP_ALL_APPS, "FLAG_STASHED_IN_APP_ALL_APPS");
+ appendFlag(str, flags, FLAG_STASHED_IN_TASKBAR_ALL_APPS, "FLAG_STASHED_IN_APP_ALL_APPS");
appendFlag(str, flags, FLAG_IN_SETUP, "FLAG_IN_SETUP");
return str.toString();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java
index b0d3528..128fa5e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java
@@ -16,7 +16,7 @@
package com.android.launcher3.taskbar.allapps;
import static com.android.launcher3.LauncherState.ALL_APPS;
-import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_ALL_APPS;
+import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS;
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
import com.android.launcher3.AbstractFloatingView;
@@ -84,7 +84,7 @@
}
private void setUpTaskbarStashing() {
- mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, true);
+ mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true);
mTaskbarStashController.applyState(
ALL_APPS.getTransitionDuration(mContext, true /* isToState */));
mNavbarButtonsViewController.setSlideInViewVisible(true);
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 910b99b..3fe2e59 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -31,11 +31,13 @@
import android.annotation.TargetApi;
import android.os.Build;
import android.util.FloatProperty;
+import android.util.Log;
import android.util.Pair;
import androidx.annotation.NonNull;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
@@ -88,6 +90,13 @@
// While animating into recents, update the visible task data as needed
builder.addOnFrameCallback(() -> mRecentsView.loadVisibleTaskData(FLAG_UPDATE_ALL));
mRecentsView.updateEmptyMessage();
+ // TODO(b/238461210): Remove logging once root cause of flake detected.
+ if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ Log.d("b/238461210", "RecentsView#setStateWithAnimationInternal getCurrentPage(): "
+ + mRecentsView.getCurrentPage()
+ + ", getScrollForPage(getCurrentPage())): "
+ + mRecentsView.getScrollForPage(mRecentsView.getCurrentPage()));
+ }
} else {
builder.addListener(
AnimatorListeners.forSuccessCallback(mRecentsView::resetTaskVisuals));
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 6f07568..d075750 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -26,6 +26,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.util.LayoutUtils;
@@ -104,7 +105,12 @@
@Override
public boolean isTaskbarStashed(Launcher launcher) {
- return true;
+ return !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
+ }
+
+ @Override
+ public boolean isTaskbarAlignedWithHotseat(Launcher launcher) {
+ return !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get();
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
index da07edf..5eeeb36 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
@@ -113,19 +113,19 @@
config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME);
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, EMPHASIZED_DECELERATE);
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, FINAL_FRAME);
+
+ // Scroll RecentsView to page 0 as it goes offscreen, if necessary.
+ int numPagesToScroll = overview.getNextPage() - DEFAULT_PAGE;
+ long scrollDuration = Math.min(MAX_PAGE_SCROLL_DURATION,
+ numPagesToScroll * PER_PAGE_SCROLL_DURATION);
+ config.duration = Math.max(config.duration, scrollDuration);
+ overview.snapToPage(DEFAULT_PAGE, Math.toIntExact(config.duration));
} else {
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL_DEACCEL);
config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
}
- // Scroll RecentsView to page 0 as it goes offscreen, if necessary.
- int numPagesToScroll = overview.getNextPage() - DEFAULT_PAGE;
- long scrollDuration = Math.min(MAX_PAGE_SCROLL_DURATION,
- numPagesToScroll * PER_PAGE_SCROLL_DURATION);
- config.duration = Math.max(config.duration, scrollDuration);
- overview.snapToPage(DEFAULT_PAGE, Math.toIntExact(config.duration));
-
Workspace<?> workspace = mActivity.getWorkspace();
// Start from a higher workspace scale, but only if we're invisible so we don't jump.
boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 35d7394..129b88e 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -548,15 +548,43 @@
}
/** Start multiple tasks in split-screen simultaneously. */
- public void startTasks(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions,
- @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
+ public void startTasks(int taskId1, Bundle options1, int taskId2, Bundle options2,
+ @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
- mSplitScreen.startTasks(mainTaskId, mainOptions, sideTaskId, sideOptions,
- sidePosition, splitRatio, remoteTransition.getTransition(), instanceId);
+ mSplitScreen.startTasks(taskId1, options1, taskId2, options2, splitPosition,
+ splitRatio, remoteTransition.getTransition(), instanceId);
} catch (RemoteException e) {
- Log.w(TAG, "Failed call startTask");
+ Log.w(TAG, "Failed call startTasks");
+ }
+ }
+ }
+
+ public void startIntentAndTask(PendingIntent pendingIntent, Intent fillInIntent,
+ Bundle options1, int taskId, Bundle options2,
+ @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
+ RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
+ if (mSystemUiProxy != null) {
+ try {
+ mSplitScreen.startIntentAndTask(pendingIntent, fillInIntent, options1,
+ taskId, options2, splitPosition, splitRatio,
+ remoteTransition.getTransition(), instanceId);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed call startIntentAndTask");
+ }
+ }
+ }
+
+ public void startShortcutAndTask(ShortcutInfo shortcutInfo, Bundle options1, int taskId,
+ Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
+ float splitRatio, RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
+ if (mSystemUiProxy != null) {
+ try {
+ mSplitScreen.startShortcutAndTask(shortcutInfo, options1, taskId, options2,
+ splitPosition, splitRatio, remoteTransition.getTransition(), instanceId);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed call startShortcutAndTask");
}
}
}
@@ -564,13 +592,13 @@
/**
* Start multiple tasks in split-screen simultaneously.
*/
- public void startTasksWithLegacyTransition(int mainTaskId, Bundle mainOptions, int sideTaskId,
- Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition,
+ public void startTasksWithLegacyTransition(int taskId1, Bundle options1, int taskId2,
+ Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
- mSplitScreen.startTasksWithLegacyTransition(mainTaskId, mainOptions, sideTaskId,
- sideOptions, sidePosition, splitRatio, adapter, instanceId);
+ mSplitScreen.startTasksWithLegacyTransition(taskId1, options1, taskId2, options2,
+ splitPosition, splitRatio, adapter, instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startTasksWithLegacyTransition");
}
@@ -578,28 +606,26 @@
}
public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent,
- Intent fillInIntent, int taskId, Bundle mainOptions, Bundle sideOptions,
- @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
+ Intent fillInIntent, Bundle options1, int taskId, Bundle options2,
+ @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
RemoteAnimationAdapter adapter, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent,
- taskId, mainOptions, sideOptions, sidePosition, splitRatio, adapter,
- instanceId);
+ options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startIntentAndTaskWithLegacyTransition");
}
}
}
- public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo, int taskId,
- Bundle mainOptions, Bundle sideOptions,
- @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
- RemoteAnimationAdapter adapter, InstanceId instanceId) {
+ public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo, Bundle options1,
+ int taskId, Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
+ float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
if (mSystemUiProxy != null) {
try {
- mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId,
- mainOptions, sideOptions, sidePosition, splitRatio, adapter, instanceId);
+ mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, options1,
+ taskId, options2, splitPosition, splitRatio, adapter, instanceId);
} catch (RemoteException e) {
Log.w(TAG, "Failed call startShortcutAndTaskWithLegacyTransition");
}
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index e7173f5..7d3d8a2 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -15,7 +15,6 @@
*/
package com.android.quickstep;
-import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -425,8 +424,10 @@
TransitionInfo.Change splitRoot2 = null;
for (int i = 0; i < transitionInfo.getChanges().size(); ++i) {
final TransitionInfo.Change change = transitionInfo.getChanges().get(i);
- final int taskId = change.getTaskInfo() != null ? change.getTaskInfo().taskId : -1;
+ if (change.getTaskInfo() == null) continue;
+ final int taskId = change.getTaskInfo().taskId;
final int mode = change.getMode();
+
// Find the target tasks' root tasks since those are the split stages that need to
// be animated (the tasks themselves are children and thus inherit animation).
if (taskId == initialTaskId || taskId == secondTaskId) {
@@ -439,7 +440,7 @@
+ "root of " + taskId + " is already visible or has broken hierarchy.");
}
}
- if (taskId == initialTaskId && initialTaskId != INVALID_TASK_ID) {
+ if (taskId == initialTaskId) {
splitRoot1 = transitionInfo.getChange(change.getParent());
}
if (taskId == secondTaskId) {
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 4476dcb..1452c8f 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -25,19 +25,19 @@
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_DOWN;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_UP;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_RECENT_TASKS;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_BACK_ANIMATION;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_DESKTOP_MODE;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_FLOATING_TASKS;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_ONE_HANDED;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_PIP;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_SHELL_TRANSITIONS;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_SPLIT_SCREEN;
-import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_STARTING_WINDOW;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
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_TRACING_ENABLED;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_DESKTOP_MODE;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_FLOATING_TASKS;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_ONE_HANDED;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_PIP;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_RECENT_TASKS;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_SHELL_TRANSITIONS;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_SPLIT_SCREEN;
+import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_STARTING_WINDOW;
import android.annotation.TargetApi;
import android.app.PendingIntent;
@@ -182,7 +182,7 @@
ISysuiUnlockAnimationController.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_UNLOCK_ANIMATION_CONTROLLER));
IRecentTasks recentTasks = IRecentTasks.Stub.asInterface(
- bundle.getBinder(KEY_EXTRA_RECENT_TASKS));
+ bundle.getBinder(KEY_EXTRA_SHELL_RECENT_TASKS));
IBackAnimation backAnimation = IBackAnimation.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_SHELL_BACK_ANIMATION));
IDesktopMode desktopMode = IDesktopMode.Stub.asInterface(
diff --git a/quickstep/src/com/android/quickstep/util/PhoneSplitToConfirmTimings.java b/quickstep/src/com/android/quickstep/util/PhoneSplitToConfirmTimings.java
index 9e7351a..3d9e09e 100644
--- a/quickstep/src/com/android/quickstep/util/PhoneSplitToConfirmTimings.java
+++ b/quickstep/src/com/android/quickstep/util/PhoneSplitToConfirmTimings.java
@@ -16,10 +16,6 @@
package com.android.quickstep.util;
-import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
-
-import android.view.animation.Interpolator;
-
/**
* Timings for the OverviewSplitSelect > confirmed animation on phones.
*/
@@ -33,8 +29,4 @@
public int getStagedRectSlideEnd() { return 333; }
public int getDuration() { return PHONE_CONFIRM_DURATION; }
- public Interpolator getStagedRectXInterpolator() { return EMPHASIZED; }
- public Interpolator getStagedRectYInterpolator() { return EMPHASIZED; }
- public Interpolator getStagedRectScaleXInterpolator() { return EMPHASIZED; }
- public Interpolator getStagedRectScaleYInterpolator() { return EMPHASIZED; }
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index efbe783..f07f990 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -22,8 +22,6 @@
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO;
-import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
-import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import android.annotation.NonNull;
import android.app.ActivityOptions;
@@ -216,22 +214,36 @@
@Nullable InstanceId shellInstanceId) {
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN, "launchSplitTasks");
- // Assume initial task is for top/left part of screen
- final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT
- ? new int[]{taskId1, taskId2}
- : new int[]{taskId2, taskId1};
+ final ActivityOptions options1 = ActivityOptions.makeBasic();
+ if (freezeTaskList) {
+ options1.setFreezeRecentTasksReordering();
+ }
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
- RemoteSplitLaunchTransitionRunner animationRunner =
+ final RemoteSplitLaunchTransitionRunner animationRunner =
new RemoteSplitLaunchTransitionRunner(taskId1, taskPendingIntent, taskId2,
callback);
- mSystemUiProxy.startTasks(taskIds[0], null /* mainOptions */, taskIds[1],
- null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, splitRatio,
- new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR,
- ActivityThread.currentActivityThread().getApplicationThread()),
- shellInstanceId);
- // TODO(b/237635859): handle intent/shortcut + task with shell transition
+ final RemoteTransitionCompat remoteTransition = new RemoteTransitionCompat(
+ animationRunner, MAIN_EXECUTOR,
+ ActivityThread.currentActivityThread().getApplicationThread());
+ if (taskPendingIntent == null) {
+ mSystemUiProxy.startTasks(taskId1, options1.toBundle(), taskId2,
+ null /* options2 */, stagePosition, splitRatio, remoteTransition,
+ shellInstanceId);
+ } else {
+ final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent,
+ taskPendingIntent.getCreatorUserHandle());
+ if (shortcutInfo != null) {
+ mSystemUiProxy.startShortcutAndTask(shortcutInfo,
+ options1.toBundle(), taskId2, null /* options2 */, stagePosition,
+ splitRatio, remoteTransition, shellInstanceId);
+ } else {
+ mSystemUiProxy.startIntentAndTask(taskPendingIntent,
+ fillInIntent, options1.toBundle(), taskId2, null /* options2 */,
+ stagePosition, splitRatio, remoteTransition, shellInstanceId);
+ }
+ }
} else {
- RemoteSplitLaunchAnimationRunner animationRunner =
+ final RemoteSplitLaunchAnimationRunner animationRunner =
new RemoteSplitLaunchAnimationRunner(taskId1, taskPendingIntent, taskId2,
callback);
final RemoteAnimationAdapter adapter = new RemoteAnimationAdapter(
@@ -239,24 +251,20 @@
300, 150,
ActivityThread.currentActivityThread().getApplicationThread());
- ActivityOptions mainOpts = ActivityOptions.makeBasic();
- if (freezeTaskList) {
- mainOpts.setFreezeRecentTasksReordering();
- }
if (taskPendingIntent == null) {
- mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(),
- taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
- splitRatio, adapter, shellInstanceId);
+ mSystemUiProxy.startTasksWithLegacyTransition(taskId1, options1.toBundle(),
+ taskId2, null /* options2 */, stagePosition, splitRatio, adapter,
+ shellInstanceId);
} else {
final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent,
taskPendingIntent.getCreatorUserHandle());
if (shortcutInfo != null) {
- mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId2,
- mainOpts.toBundle(), null /* sideOptions */, stagePosition, splitRatio,
- adapter, shellInstanceId);
+ mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo,
+ options1.toBundle(), taskId2, null /* options2 */, stagePosition,
+ splitRatio, adapter, shellInstanceId);
} else {
mSystemUiProxy.startIntentAndTaskWithLegacyTransition(taskPendingIntent,
- fillInIntent, taskId2, mainOpts.toBundle(), null /* sideOptions */,
+ fillInIntent, options1.toBundle(), taskId2, null /* options2 */,
stagePosition, splitRatio, adapter, shellInstanceId);
}
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java
index 3026e98..f5b00cf 100644
--- a/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java
+++ b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java
@@ -16,6 +16,8 @@
package com.android.quickstep.util;
+import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
+
import android.view.animation.Interpolator;
/**
@@ -33,12 +35,12 @@
// Common timings
public int getInstructionsFadeStart() { return 0; }
public int getInstructionsFadeEnd() { return 67; }
+ public Interpolator getStagedRectXInterpolator() { return EMPHASIZED; }
+ public Interpolator getStagedRectYInterpolator() { return EMPHASIZED; }
+ public Interpolator getStagedRectScaleXInterpolator() { return EMPHASIZED; }
+ public Interpolator getStagedRectScaleYInterpolator() { return EMPHASIZED; }
abstract public int getDuration();
- abstract public Interpolator getStagedRectXInterpolator();
- abstract public Interpolator getStagedRectYInterpolator();
- abstract public Interpolator getStagedRectScaleXInterpolator();
- abstract public Interpolator getStagedRectScaleYInterpolator();
public float getInstructionsFadeStartOffset() {
return (float) getInstructionsFadeStart() / getDuration();
diff --git a/quickstep/src/com/android/quickstep/util/TabletSplitToConfirmTimings.java b/quickstep/src/com/android/quickstep/util/TabletSplitToConfirmTimings.java
index 3ea8466..580cc99 100644
--- a/quickstep/src/com/android/quickstep/util/TabletSplitToConfirmTimings.java
+++ b/quickstep/src/com/android/quickstep/util/TabletSplitToConfirmTimings.java
@@ -16,10 +16,6 @@
package com.android.quickstep.util;
-import static com.android.launcher3.anim.Interpolators.LINEAR;
-
-import android.view.animation.Interpolator;
-
/**
* Timings for the OverviewSplitSelect > confirmed animation on tablets.
*/
@@ -33,8 +29,4 @@
public int getStagedRectSlideEnd() { return 383; }
public int getDuration() { return TABLET_CONFIRM_DURATION; }
- public Interpolator getStagedRectXInterpolator() { return LINEAR; }
- public Interpolator getStagedRectYInterpolator() { return LINEAR; }
- public Interpolator getStagedRectScaleXInterpolator() { return LINEAR; }
- public Interpolator getStagedRectScaleYInterpolator() { return LINEAR; }
}
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index 4cdf557..c03aa3f 100644
--- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -46,9 +46,9 @@
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.TaskAnimationManager;
-import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.shared.recents.model.ThumbnailData;
+import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder;
@@ -317,9 +317,9 @@
// mIsRecentsRtl is the inverse of TaskView RTL.
boolean isRtlEnabled = !mIsRecentsRtl;
mPositionHelper.updateThumbnailMatrix(
- mThumbnailPosition, mThumbnailData,
- mTaskRect.width(), mTaskRect.height(),
- mDp, mOrientationState.getRecentsActivityRotation(), isRtlEnabled);
+ mThumbnailPosition, mThumbnailData, mTaskRect.width(), mTaskRect.height(),
+ mDp.widthPx, mDp.taskbarSize, mDp.isTablet,
+ mOrientationState.getRecentsActivityRotation(), isRtlEnabled);
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
if (DEBUG) {
Log.d(TAG, " taskRect: " + mTaskRect);
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 08a17c4..abace7c 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -82,10 +82,11 @@
private static final int INDEX_HIDDEN_FLAGS_ALPHA = 3;
private static final int INDEX_SHARE_TARGET_ALPHA = 4;
- public @interface SplitButtonDisabledFlags { }
-
+ public @interface SplitButtonHiddenFlags { }
public static final int FLAG_IS_NOT_TABLET = 1 << 0;
- public static final int FLAG_SINGLE_TASK = 1 << 1;
+
+ public @interface SplitButtonDisabledFlags { }
+ public static final int FLAG_SINGLE_TASK = 1 << 0;
private MultiValueAlpha mMultiValueAlpha;
private Button mSplitButton;
@@ -96,6 +97,9 @@
@ActionsDisabledFlags
protected int mDisabledFlags;
+ @SplitButtonHiddenFlags
+ private int mSplitButtonHiddenFlags;
+
@SplitButtonDisabledFlags
private int mSplitButtonDisabledFlags;
@@ -191,20 +195,40 @@
}
boolean isEnabled = (mDisabledFlags & ~DISABLED_ROTATED) == 0;
LayoutUtils.setViewEnabled(this, isEnabled);
+ updateSplitButtonEnabledState();
}
/**
- * Updates the proper flags to indicate whether the "Split screen" button should be enabled.
+ * Updates the proper flags to indicate whether the "Split screen" button should be hidden.
*
- * @param flag The flag to update.
- * @param enable Whether to enable the disable flag: True will cause view to be disabled.
+ * @param flag The flag to update.
+ * @param enable Whether to enable the hidden flag: True will cause view to be hidden.
*/
- public void updateSplitButtonFlags(@SplitButtonDisabledFlags int flag, boolean enable) {
+ public void updateSplitButtonHiddenFlags(@SplitButtonHiddenFlags int flag, boolean enable) {
+ if (enable) {
+ mSplitButtonHiddenFlags |= flag;
+ } else {
+ mSplitButtonHiddenFlags &= ~flag;
+ }
+ if (mSplitButton == null) return;
+ boolean shouldBeVisible = mSplitButtonHiddenFlags == 0;
+ mSplitButton.setVisibility(shouldBeVisible ? VISIBLE : GONE);
+ findViewById(R.id.action_split_space).setVisibility(shouldBeVisible ? VISIBLE : GONE);
+ }
+
+ /**
+ * Updates the proper flags to indicate whether the "Split screen" button should be disabled.
+ *
+ * @param flag The flag to update.
+ * @param enable Whether to enable the disable flag: True will cause view to be disabled.
+ */
+ public void updateSplitButtonDisabledFlags(@SplitButtonDisabledFlags int flag, boolean enable) {
if (enable) {
mSplitButtonDisabledFlags |= flag;
} else {
mSplitButtonDisabledFlags &= ~flag;
}
+ updateSplitButtonEnabledState();
}
public AlphaProperty getContentAlpha() {
@@ -289,16 +313,16 @@
}
/**
- * Shows/hides the "Split" button based on the status of mHiddenFlags.
+ * Enables/disables the "Split" button based on the status of mSplitButtonDisabledFlags and
+ * mDisabledFlags.
*/
- public void updateSplitButtonVisibility() {
+ private void updateSplitButtonEnabledState() {
if (mSplitButton == null) {
return;
}
- boolean shouldBeVisible = mSplitButtonDisabledFlags == 0
- // and neither of these flags are active
- && (mHiddenFlags & (HIDDEN_SPLIT_SCREEN | HIDDEN_SPLIT_SELECT_ACTIVE)) == 0;
- mSplitButton.setVisibility(shouldBeVisible ? VISIBLE : GONE);
- findViewById(R.id.action_split_space).setVisibility(shouldBeVisible ? VISIBLE : GONE);
+ boolean isParentEnabled = (mDisabledFlags & ~DISABLED_ROTATED) == 0;
+ boolean shouldBeEnabled = mSplitButtonDisabledFlags == 0 && isParentEnabled;
+ mSplitButton.setEnabled(shouldBeEnabled);
}
+
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index d9a4be8..0e0acf0 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1505,6 +1505,13 @@
// Restore mCurrentPage but don't call setCurrentPage() as that clobbers the scroll.
mCurrentPage = previousCurrentPage;
} else {
+ // TODO(b/238461210): Remove logging once root cause of flake detected.
+ if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ Log.d("b/238461210", "RecentsView#applyLoadPlan() -> !settlingOnNewTask -> "
+ + "previousCurrentPage: " + previousCurrentPage
+ + ", getScrollForPage(previousCurrentPage): "
+ + getScrollForPage(previousCurrentPage));
+ }
setCurrentPage(previousCurrentPage);
}
@@ -1878,6 +1885,8 @@
mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, alphaValue);
mActionsViewAlphaAnimatorFinalValue = alphaValue;
mActionsViewAlphaAnimator.setDuration(duration);
+ // Set autocancel to prevent race-conditiony setting of alpha from other animations
+ mActionsViewAlphaAnimator.setAutoCancel(true);
mActionsViewAlphaAnimator.start();
}
@@ -3455,10 +3464,9 @@
boolean isCurrentSplit = getCurrentPageTaskView() instanceof GroupedTaskView;
mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SCREEN, isCurrentSplit);
mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SELECT_ACTIVE, isSplitSelectionActive());
- mActionsView.updateSplitButtonFlags(FLAG_IS_NOT_TABLET,
+ mActionsView.updateSplitButtonHiddenFlags(FLAG_IS_NOT_TABLET,
!mActivity.getDeviceProfile().isTablet);
- mActionsView.updateSplitButtonFlags(FLAG_SINGLE_TASK, getTaskViewCount() <= 1);
- mActionsView.updateSplitButtonVisibility();
+ mActionsView.updateSplitButtonDisabledFlags(FLAG_SINGLE_TASK, getTaskViewCount() <= 1);
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 43d38a7..04a0af1 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -16,10 +16,12 @@
package com.android.quickstep.views;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
+import static com.android.systemui.shared.recents.utilities.PreviewPositionHelper.MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT;
+import static com.android.systemui.shared.recents.utilities.Utilities.isRelativePercentDifferenceGreaterThan;
+
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
@@ -39,7 +41,6 @@
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.Property;
-import android.view.Surface;
import android.view.View;
import android.widget.ImageView;
@@ -58,6 +59,7 @@
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
+import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
/**
* A task in the Recents view.
@@ -65,7 +67,6 @@
public class TaskThumbnailView extends View {
private static final MainThreadInitializedObject<FullscreenDrawParams> TEMP_PARAMS =
new MainThreadInitializedObject<>(FullscreenDrawParams::new);
- private static final float MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT = 0.1f;
public static final Property<TaskThumbnailView, Float> DIM_ALPHA =
new FloatProperty<TaskThumbnailView>("dimAlpha") {
@@ -417,7 +418,7 @@
float thumbnailDataAspect =
mThumbnailData.thumbnail.getWidth() / (float) mThumbnailData.thumbnail.getHeight();
- return Utilities.isRelativePercentDifferenceGreaterThan(thumbnailViewAspect,
+ return isRelativePercentDifferenceGreaterThan(thumbnailViewAspect,
thumbnailDataAspect, MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT);
}
@@ -441,8 +442,8 @@
*/
private void refreshOverlay() {
if (mOverlayEnabled) {
- getTaskOverlay().initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
- mPreviewPositionHelper.mIsOrientationChanged);
+ getTaskOverlay().initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.getMatrix(),
+ mPreviewPositionHelper.isOrientationChanged());
} else {
getTaskOverlay().reset();
}
@@ -463,18 +464,19 @@
}
private void updateThumbnailMatrix() {
- mPreviewPositionHelper.mIsOrientationChanged = false;
+ mPreviewPositionHelper.setOrientationChanged(false);
if (mBitmapShader != null && mThumbnailData != null) {
mPreviewRect.set(0, 0, mThumbnailData.thumbnail.getWidth(),
mThumbnailData.thumbnail.getHeight());
int currentRotation = getTaskView().getRecentsView().getPagedViewOrientedState()
.getRecentsActivityRotation();
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+ DeviceProfile dp = mActivity.getDeviceProfile();
mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
- getMeasuredWidth(), getMeasuredHeight(), mActivity.getDeviceProfile(),
- currentRotation, isRtl);
+ getMeasuredWidth(), getMeasuredHeight(), dp.widthPx, dp.taskbarSize,
+ dp.isTablet, currentRotation, isRtl);
- mBitmapShader.setLocalMatrix(mPreviewPositionHelper.mMatrix);
+ mBitmapShader.setLocalMatrix(mPreviewPositionHelper.getMatrix());
mPaint.setShader(mBitmapShader);
}
getTaskView().updateCurrentFullscreenParams(mPreviewPositionHelper);
@@ -514,199 +516,4 @@
}
return mThumbnailData.isRealSnapshot && !mTask.isLocked;
}
-
- /**
- * Utility class to position the thumbnail in the TaskView
- */
- public static class PreviewPositionHelper {
-
- private static final RectF EMPTY_RECT_F = new RectF();
-
- // Contains the portion of the thumbnail that is unclipped when fullscreen progress = 1.
- private final RectF mClippedInsets = new RectF();
- private final Matrix mMatrix = new Matrix();
- private boolean mIsOrientationChanged;
-
- public Matrix getMatrix() {
- return mMatrix;
- }
-
- /**
- * Updates the matrix based on the provided parameters
- */
- public void updateThumbnailMatrix(Rect thumbnailBounds, ThumbnailData thumbnailData,
- int canvasWidth, int canvasHeight, DeviceProfile dp, int currentRotation,
- boolean isRtl) {
- boolean isRotated = false;
- boolean isOrientationDifferent;
-
- int thumbnailRotation = thumbnailData.rotation;
- int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
- RectF thumbnailClipHint = new RectF();
- float canvasScreenRatio = canvasWidth / (float) dp.widthPx;
- float scaledTaskbarSize = dp.taskbarSize * canvasScreenRatio;
- thumbnailClipHint.bottom = dp.isTablet ? scaledTaskbarSize : 0;
-
- float scale = thumbnailData.scale;
- final float thumbnailScale;
-
- // Landscape vs portrait change.
- // Note: Disable rotation in grid layout.
- boolean windowingModeSupportsRotation =
- thumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN && !dp.isTablet;
- isOrientationDifferent = isOrientationChange(deltaRotate)
- && windowingModeSupportsRotation;
- if (canvasWidth == 0 || canvasHeight == 0 || scale == 0) {
- // If we haven't measured , skip the thumbnail drawing and only draw the background
- // color
- thumbnailScale = 0f;
- } else {
- // Rotate the screenshot if not in multi-window mode
- isRotated = deltaRotate > 0 && windowingModeSupportsRotation;
-
- float surfaceWidth = thumbnailBounds.width() / scale;
- float surfaceHeight = thumbnailBounds.height() / scale;
- float availableWidth = surfaceWidth
- - (thumbnailClipHint.left + thumbnailClipHint.right);
- float availableHeight = surfaceHeight
- - (thumbnailClipHint.top + thumbnailClipHint.bottom);
-
- float canvasAspect = canvasWidth / (float) canvasHeight;
- float availableAspect = isRotated
- ? availableHeight / availableWidth
- : availableWidth / availableHeight;
- boolean isAspectLargelyDifferent =
- Utilities.isRelativePercentDifferenceGreaterThan(canvasAspect,
- availableAspect, MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT);
- if (isRotated && isAspectLargelyDifferent) {
- // Do not rotate thumbnail if it would not improve fit
- isRotated = false;
- isOrientationDifferent = false;
- }
-
- if (isAspectLargelyDifferent) {
- // Crop letterbox insets if insets isn't already clipped
- thumbnailClipHint.left = thumbnailData.letterboxInsets.left;
- thumbnailClipHint.right = thumbnailData.letterboxInsets.right;
- thumbnailClipHint.top = thumbnailData.letterboxInsets.top;
- thumbnailClipHint.bottom = thumbnailData.letterboxInsets.bottom;
- availableWidth = surfaceWidth
- - (thumbnailClipHint.left + thumbnailClipHint.right);
- availableHeight = surfaceHeight
- - (thumbnailClipHint.top + thumbnailClipHint.bottom);
- }
-
- final float targetW, targetH;
- if (isOrientationDifferent) {
- targetW = canvasHeight;
- targetH = canvasWidth;
- } else {
- targetW = canvasWidth;
- targetH = canvasHeight;
- }
- float targetAspect = targetW / targetH;
-
- // Update the clipHint such that
- // > the final clipped position has same aspect ratio as requested by canvas
- // > first fit the width and crop the extra height
- // > if that will leave empty space, fit the height and crop the width instead
- float croppedWidth = availableWidth;
- float croppedHeight = croppedWidth / targetAspect;
- if (croppedHeight > availableHeight) {
- croppedHeight = availableHeight;
- if (croppedHeight < targetH) {
- croppedHeight = Math.min(targetH, surfaceHeight);
- }
- croppedWidth = croppedHeight * targetAspect;
-
- // One last check in case the task aspect radio messed up something
- if (croppedWidth > surfaceWidth) {
- croppedWidth = surfaceWidth;
- croppedHeight = croppedWidth / targetAspect;
- }
- }
-
- // Update the clip hints. Align to 0,0, crop the remaining.
- if (isRtl) {
- thumbnailClipHint.left += availableWidth - croppedWidth;
- if (thumbnailClipHint.right < 0) {
- thumbnailClipHint.left += thumbnailClipHint.right;
- thumbnailClipHint.right = 0;
- }
- } else {
- thumbnailClipHint.right += availableWidth - croppedWidth;
- if (thumbnailClipHint.left < 0) {
- thumbnailClipHint.right += thumbnailClipHint.left;
- thumbnailClipHint.left = 0;
- }
- }
- thumbnailClipHint.bottom += availableHeight - croppedHeight;
- if (thumbnailClipHint.top < 0) {
- thumbnailClipHint.bottom += thumbnailClipHint.top;
- thumbnailClipHint.top = 0;
- } else if (thumbnailClipHint.bottom < 0) {
- thumbnailClipHint.top += thumbnailClipHint.bottom;
- thumbnailClipHint.bottom = 0;
- }
-
- thumbnailScale = targetW / (croppedWidth * scale);
- }
-
- if (!isRotated) {
- mMatrix.setTranslate(
- -thumbnailClipHint.left * scale,
- -thumbnailClipHint.top * scale);
- } else {
- setThumbnailRotation(deltaRotate, thumbnailBounds);
- }
-
- mClippedInsets.set(0, 0, 0, scaledTaskbarSize);
-
- mMatrix.postScale(thumbnailScale, thumbnailScale);
- mIsOrientationChanged = isOrientationDifferent;
- }
-
- private int getRotationDelta(int oldRotation, int newRotation) {
- int delta = newRotation - oldRotation;
- if (delta < 0) delta += 4;
- return delta;
- }
-
- /**
- * @param deltaRotation the number of 90 degree turns from the current orientation
- * @return {@code true} if the change in rotation results in a shift from landscape to
- * portrait or vice versa, {@code false} otherwise
- */
- private boolean isOrientationChange(int deltaRotation) {
- return deltaRotation == Surface.ROTATION_90 || deltaRotation == Surface.ROTATION_270;
- }
-
- private void setThumbnailRotation(int deltaRotate, Rect thumbnailPosition) {
- float translateX = 0;
- float translateY = 0;
-
- mMatrix.setRotate(90 * deltaRotate);
- switch (deltaRotate) { /* Counter-clockwise */
- case Surface.ROTATION_90:
- translateX = thumbnailPosition.height();
- break;
- case Surface.ROTATION_270:
- translateY = thumbnailPosition.width();
- break;
- case Surface.ROTATION_180:
- translateX = thumbnailPosition.width();
- translateY = thumbnailPosition.height();
- break;
- }
- mMatrix.postTranslate(translateX, translateY);
- }
-
- /**
- * Insets to used for clipping the thumbnail (in case it is drawing outside its own space)
- */
- public RectF getInsetsToDrawInFullscreen(DeviceProfile dp) {
- return dp.isTaskbarPresent && !dp.isTaskbarPresentInApps
- ? mClippedInsets : EMPTY_RECT_F;
- }
- }
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 07d8989..0125775 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -98,9 +98,9 @@
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.TaskCornerRadius;
import com.android.quickstep.util.TransformParams;
-import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
+import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -121,6 +121,8 @@
private static final String TAG = TaskView.class.getSimpleName();
private static final boolean DEBUG = false;
+ private static final RectF EMPTY_RECT_F = new RectF();
+
public static final int FLAG_UPDATE_ICON = 1;
public static final int FLAG_UPDATE_THUMBNAIL = FLAG_UPDATE_ICON << 1;
@@ -1572,7 +1574,7 @@
*/
public void setProgress(float fullscreenProgress, float parentScale, float taskViewScale,
int previewWidth, DeviceProfile dp, PreviewPositionHelper pph) {
- RectF insets = pph.getInsetsToDrawInFullscreen(dp);
+ RectF insets = getInsetsToDrawInFullscreen(pph, dp);
float currentInsetsLeft = insets.left * fullscreenProgress;
float currentInsetsTop = insets.top * fullscreenProgress;
@@ -1591,6 +1593,14 @@
mScale = previewWidth / (previewWidth + currentInsetsLeft + currentInsetsRight);
}
}
+
+ /**
+ * Insets to used for clipping the thumbnail (in case it is drawing outside its own space)
+ */
+ private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph, DeviceProfile dp) {
+ return dp.isTaskbarPresent && !dp.isTaskbarPresentInApps
+ ? pph.getClippedInsets() : EMPTY_RECT_F;
+ }
}
public class TaskIdAttributeContainer {
diff --git a/quickstep/tests/src/com/android/quickstep/TaskThumbnailViewTest.kt b/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
similarity index 64%
rename from quickstep/tests/src/com/android/quickstep/TaskThumbnailViewTest.kt
rename to quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
index cf3c8c9..4785350 100644
--- a/quickstep/tests/src/com/android/quickstep/TaskThumbnailViewTest.kt
+++ b/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
@@ -20,26 +20,34 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.launcher3.DeviceProfileBaseTest
-import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper
+import com.android.quickstep.views.TaskView.FullscreenDrawParams
import com.android.systemui.shared.recents.model.ThumbnailData
+import com.android.systemui.shared.recents.utilities.PreviewPositionHelper
import com.google.common.truth.Truth.assertThat
+import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
/**
- * Test for TaskThumbnailView class.
+ * Test for FullscreenDrawParams class.
*/
@SmallTest
@RunWith(AndroidJUnit4::class)
-class TaskThumbnailViewTest : DeviceProfileBaseTest() {
+class FullscreenDrawParamsTest : DeviceProfileBaseTest() {
private var mThumbnailData: ThumbnailData = mock(ThumbnailData::class.java)
private val mPreviewPositionHelper = PreviewPositionHelper()
+ private lateinit var params: FullscreenDrawParams
+
+ @Before
+ fun setup() {
+ params = FullscreenDrawParams(context)
+ }
@Test
- fun getInsetsToDrawInFullscreen_clipTaskbarSizeFromBottomForTablets() {
+ fun setFullProgress_currentDrawnInsets_clipTaskbarSizeFromBottomForTablets() {
initializeVarsForTablet()
val dp = newDP()
val previewRect = Rect(0, 0, 100, 100)
@@ -49,15 +57,18 @@
val isRtl = false
mPreviewPositionHelper.updateThumbnailMatrix(previewRect, mThumbnailData, canvasWidth,
- canvasHeight, dp, currentRotation, isRtl)
+ canvasHeight, dp.widthPx, dp.taskbarSize, dp.isTablet, currentRotation,
+ isRtl)
+ params.setProgress(/* fullscreenProgress= */ 1.0f, /* parentScale= */ 1.0f,
+ /* taskViewScale= */ 1.0f, /* previewWidth= */ 0, dp, mPreviewPositionHelper)
val expectedClippedInsets = RectF(0f, 0f, 0f, dp.taskbarSize / 2f)
- assertThat(mPreviewPositionHelper.getInsetsToDrawInFullscreen(dp))
+ assertThat(params.mCurrentDrawnInsets)
.isEqualTo(expectedClippedInsets)
}
@Test
- fun getInsetsToDrawInFullscreen_doNotClipTaskbarSizeFromBottomForPhones() {
+ fun setFullProgress_currentDrawnInsets_doNotClipTaskbarSizeFromBottomForPhones() {
initializeVarsForPhone()
val dp = newDP()
val previewRect = Rect(0, 0, 100, 100)
@@ -67,10 +78,13 @@
val isRtl = false
mPreviewPositionHelper.updateThumbnailMatrix(previewRect, mThumbnailData, canvasWidth,
- canvasHeight, dp, currentRotation, isRtl)
+ canvasHeight, dp.widthPx, dp.taskbarSize, dp.isTablet, currentRotation,
+ isRtl)
+ params.setProgress(/* fullscreenProgress= */ 1.0f, /* parentScale= */ 1.0f,
+ /* taskViewScale= */ 1.0f, /* previewWidth= */ 0, dp, mPreviewPositionHelper)
val expectedClippedInsets = RectF(0f, 0f, 0f, 0f)
- assertThat(mPreviewPositionHelper.getInsetsToDrawInFullscreen(dp))
+ assertThat(params.mCurrentDrawnInsets)
.isEqualTo(expectedClippedInsets)
}
}
\ No newline at end of file
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 42e9be3..cc561c6 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -309,6 +309,28 @@
launchedAppState.switchToOverview();
}
+ @Test
+ @ScreenRecord // b/242163205
+ public void testQuickSwitchToPreviousAppForTablet() throws Exception {
+ assumeTrue(mLauncher.isTablet());
+ startTestActivity(2);
+ startImeTestActivity();
+
+ // Set ignoreTaskbarVisibility to true to verify the task bar visibility explicitly.
+ mLauncher.setIgnoreTaskbarVisibility(true);
+
+ // 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.
+ launchedAppState.quickSwitchToPreviousApp();
+
+ // Expect task bar visible when the launched app was the test activity.
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.assertTaskbarVisible();
+ }
+
private boolean isTestActivityRunning(int activityNumber) {
return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName())
.text("TestActivity" + activityNumber)),
diff --git a/res/values-as/strings.xml b/res/values-as/strings.xml
index eee5ae2..0a4943e 100644
--- a/res/values-as/strings.xml
+++ b/res/values-as/strings.xml
@@ -109,7 +109,7 @@
<string name="notification_dots_title" msgid="9062440428204120317">"জাননী বিন্দু"</string>
<string name="notification_dots_desc_on" msgid="1679848116452218908">"অন আছে"</string>
<string name="notification_dots_desc_off" msgid="1760796511504341095">"অফ আছে"</string>
- <string name="title_missing_notification_access" msgid="7503287056163941064">"জাননী চাবলৈ অনুমতিৰ প্ৰয়োজন"</string>
+ <string name="title_missing_notification_access" msgid="7503287056163941064">"জাননীৰ এক্সেছৰ প্ৰয়োজন"</string>
<string name="msg_missing_notification_access" msgid="281113995110910548">"জাননী সম্পৰ্কীয় বিন্দুবোৰ দেখুৱাবলৈ <xliff:g id="NAME">%1$s</xliff:g>ৰ বাবে এপৰ জাননীসমূহ অন কৰক"</string>
<string name="title_change_settings" msgid="1376365968844349552">"ছেটিং সলনি কৰক"</string>
<string name="notification_dots_service_title" msgid="4284221181793592871">"জাননী বিন্দু দেখুৱাওক"</string>
diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml
index e70466f..605278f 100644
--- a/res/values-te/strings.xml
+++ b/res/values-te/strings.xml
@@ -58,7 +58,7 @@
<string name="widget_reconfigure_button_content_description" msgid="8811472721881205250">"విడ్జెట్ సెట్టింగ్లను మార్చండి"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"యాప్ల కోసం సెర్చ్ చేయండి"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"అప్లికేషన్లను లోడ్ చేస్తోంది…"</string>
- <string name="all_apps_no_search_results" msgid="3200346862396363786">"\"<xliff:g id="QUERY">%1$s</xliff:g>\"కి సరిపోలే అప్లికేషన్లేవీ కనుగొనబడలేదు"</string>
+ <string name="all_apps_no_search_results" msgid="3200346862396363786">"\"<xliff:g id="QUERY">%1$s</xliff:g>\"కి మ్యాచ్ అయ్యే అప్లికేషన్లేవీ కనుగొనబడలేదు"</string>
<string name="label_application" msgid="8531721983832654978">"యాప్"</string>
<string name="all_apps_label" msgid="5015784846527570951">"అన్ని యాప్లు"</string>
<string name="notifications_header" msgid="1404149926117359025">"నోటిఫికేషన్లు"</string>
@@ -146,12 +146,12 @@
<string name="create_folder_with" msgid="4050141361160214248">"ఈ పేరుతో ఫోల్డర్ను క్రియేట్ చేయండి: <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="folder_created" msgid="6409794597405184510">"ఫోల్డర్ క్రియేట్ చేయబడింది"</string>
<string name="action_move_to_workspace" msgid="39528912300293768">"మొదటి స్క్రీన్కు తరలించండి"</string>
- <string name="action_resize" msgid="1802976324781771067">"పరిమాణం మార్చు"</string>
+ <string name="action_resize" msgid="1802976324781771067">"సైజ్ మార్చు"</string>
<string name="action_increase_width" msgid="8773715375078513326">"వెడల్పును పెంచు"</string>
<string name="action_increase_height" msgid="459390020612501122">"ఎత్తును పెంచు"</string>
<string name="action_decrease_width" msgid="1374549771083094654">"వెడల్పును తగ్గించు"</string>
<string name="action_decrease_height" msgid="282377193880900022">"ఎత్తును తగ్గించు"</string>
- <string name="widget_resized" msgid="9130327887929620">"విడ్జెట్ పరిమాణం వెడల్పు <xliff:g id="NUMBER_0">%1$s</xliff:g>కి, ఎత్తు <xliff:g id="NUMBER_1">%2$s</xliff:g>కి మార్చబడింది"</string>
+ <string name="widget_resized" msgid="9130327887929620">"విడ్జెట్ సైజ్ వెడల్పు <xliff:g id="NUMBER_0">%1$s</xliff:g>కి, ఎత్తు <xliff:g id="NUMBER_1">%2$s</xliff:g>కి మార్చబడింది"</string>
<string name="action_deep_shortcut" msgid="2864038805849372848">"షార్ట్కట్స్"</string>
<string name="shortcuts_menu_with_notifications_description" msgid="2676582286544232849">"షార్ట్కట్లు మరియు నోటిఫికేషన్లు"</string>
<string name="action_dismiss_notification" msgid="5909461085055959187">"తీసివేయండి"</string>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 4cad919..9a1bba9 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -43,6 +43,7 @@
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.model.data.ItemInfo;
@@ -1276,7 +1277,10 @@
return ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY();
}
- return isTaskbarPresent ? stashedTaskbarSize : mInsets.bottom;
+ if (isTaskbarPresent) {
+ return FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get() ? taskbarSize : stashedTaskbarSize;
+ }
+ return mInsets.bottom;
}
/** Gets the space that the overview actions will take, including bottom margin. */
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a6831aa..447745e 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1579,6 +1579,14 @@
return mOldConfig.orientation;
}
+ /**
+ * Whether keyboard sync is enabled for transitions between Home and All Apps.
+ * TODO(b/251387263): move this method inside an All Apps specific config class.
+ */
+ public boolean isKeyboardSyncEnabled() {
+ return false;
+ }
+
@Override
protected void onNewIntent(Intent intent) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
@@ -2742,6 +2750,8 @@
getViewCache().setCacheSize(R.layout.folder_page, 2);
TraceHelper.INSTANCE.endSection(traceToken);
+
+ mWorkspace.removeExtraEmptyScreen(true);
}
private boolean canAnimatePageChange() {
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index a20ff8c..58e85fe 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -85,6 +85,7 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
+import java.util.stream.Collectors;
public class LauncherProvider extends ContentProvider {
private static final String TAG = "LauncherProvider";
@@ -944,16 +945,28 @@
final IntSet validWidgets = IntSet.wrap(LauncherDbUtils.queryIntArray(false, db,
Favorites.TABLE_NAME, Favorites.APPWIDGET_ID,
"itemType=" + Favorites.ITEM_TYPE_APPWIDGET, null, null));
+ boolean isAnyWidgetRemoved = false;
for (int widgetId : allWidgets) {
if (!validWidgets.contains(widgetId)) {
try {
FileLog.d(TAG, "Deleting invalid widget " + widgetId);
host.deleteAppWidgetId(widgetId);
+ isAnyWidgetRemoved = true;
} catch (RuntimeException e) {
// Ignore
}
}
}
+ if (isAnyWidgetRemoved) {
+ final String allWidgetsIds = Arrays.stream(allWidgets).mapToObj(String::valueOf)
+ .collect(Collectors.joining(",", "[", "]"));
+ final String validWidgetsIds = Arrays.stream(
+ validWidgets.getArray().toArray()).mapToObj(String::valueOf)
+ .collect(Collectors.joining(",", "[", "]"));
+ FileLog.d(TAG, "One or more widgets was removed. db_path=" + db.getPath()
+ + " allWidgetsIds=" + allWidgetsIds
+ + ", validWidgetsIds=" + validWidgetsIds);
+ }
}
/**
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 68c54c7..377843c 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -772,6 +772,13 @@
}
if (mScroller.isFinished() && pageScrollChanged) {
+ // TODO(b/238461210): Remove logging once root cause of flake detected.
+ if (Utilities.IS_RUNNING_IN_TEST_HARNESS && !(this instanceof Workspace)) {
+ Log.d("b/238461210", this.getClass().getSimpleName() + "#onLayout() -> "
+ + "if(mScroller.isFinished() && pageScrollChanged) -> getNextPage(): "
+ + getNextPage() + ", getScrollForPage(getNextPage()): "
+ + getScrollForPage(getNextPage()));
+ }
setCurrentPage(getNextPage());
}
onPageScrollsInitialized();
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 616b08a..f70511a 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -819,16 +819,6 @@
}
/**
- * Compares the ratio of two quantities and returns whether that ratio is greater than the
- * provided bound. Order of quantities does not matter. Bound should be a decimal representation
- * of a percentage.
- */
- public static boolean isRelativePercentDifferenceGreaterThan(float first, float second,
- float bound) {
- return (Math.abs(first - second) / Math.abs((first + second) / 2.0f)) > bound;
- }
-
- /**
* Rotates `inOutBounds` by `delta` 90-degree increments. Rotation is visually CCW. Parent
* sizes represent the "space" that will rotate carrying inOutBounds along with it to determine
* the final bounds.
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 872c4fd..001b494 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -39,7 +39,6 @@
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.MultiPropertyFactory;
@@ -229,7 +228,7 @@
StateAnimationConfig config, PendingAnimation builder) {
if (mLauncher.isInState(ALL_APPS) && !ALL_APPS.equals(toState)) {
// For atomic animations, we close the keyboard immediately.
- if (!config.userControlled && !FeatureFlags.ENABLE_KEYBOARD_TRANSITION_SYNC.get()) {
+ if (!config.userControlled && !mLauncher.isKeyboardSyncEnabled()) {
mLauncher.getAppsView().getSearchUiManager().getEditText().hideKeyboard();
}
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index f082542..7f6247e 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -532,9 +532,11 @@
if (isSearching()) {
getSearchRecyclerView().setVisibility(VISIBLE);
getAppsRecyclerViewContainer().setVisibility(GONE);
+ mHeader.setVisibility(GONE);
} else {
getSearchRecyclerView().setVisibility(GONE);
getAppsRecyclerViewContainer().setVisibility(VISIBLE);
+ mHeader.setVisibility(VISIBLE);
}
if (mHeader.isSetUp()) {
mHeader.setActiveRV(getCurrentPage());
@@ -797,6 +799,17 @@
return mActivityContext.getDeviceProfile().isTablet ? mBottomSheetBackground : this;
}
+ /**
+ * Sets whether the view or its children should react to the window inset.
+ * Used for when exiting all apps -> workspace and determines if window inset
+ * should be applied.. ex) the work mode switch.
+ */
+ public void setApplyWindowInset(boolean shouldApplyWindowInset) {
+ if (mWorkManager.getWorkModeSwitch() != null) {
+ mWorkManager.getWorkModeSwitch().setApplyWindowInset(shouldApplyWindowInset);
+ }
+ }
+
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
public class AdapterHolder {
public static final int MAIN = 0;
diff --git a/src/com/android/launcher3/allapps/SearchTransitionController.java b/src/com/android/launcher3/allapps/SearchTransitionController.java
index a1f5bc6..bde4fa6 100644
--- a/src/com/android/launcher3/allapps/SearchTransitionController.java
+++ b/src/com/android/launcher3/allapps/SearchTransitionController.java
@@ -20,6 +20,7 @@
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
@@ -38,6 +39,7 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.model.data.ItemInfo;
/** Coordinates the transition between Search and A-Z in All Apps. */
public class SearchTransitionController {
@@ -124,6 +126,7 @@
mSearchToAzAnimator.addListener(forSuccessCallback(onEndRunnable));
mAllAppsContainerView.getFloatingHeaderView().setFloatingRowsCollapsed(true);
+ mAllAppsContainerView.getFloatingHeaderView().setVisibility(VISIBLE);
mAllAppsContainerView.getAppsRecyclerViewContainer().setVisibility(VISIBLE);
getSearchRecyclerView().setVisibility(VISIBLE);
getSearchRecyclerView().setChildAttachedConsumer(this::onSearchChildAttached);
@@ -186,7 +189,9 @@
top = searchResultView.getTop();
}
- if (searchResultView instanceof BubbleTextView) {
+ if (searchResultView instanceof BubbleTextView
+ && searchResultView.getTag() instanceof ItemInfo
+ && ((ItemInfo) searchResultView.getTag()).itemType == ITEM_TYPE_APPLICATION) {
// The first app icon will set appRowHeight, which will also contribute to
// totalHeight. Additional app icons should remove the appRowHeight to remain in
// the same row as the first app.
@@ -196,6 +201,8 @@
totalHeight += appRowHeight;
}
// Don't scale/fade app row.
+ searchResultView.setScaleY(1);
+ searchResultView.setAlpha(1);
continue;
}
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index 15fb77c..0a938b2 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -52,6 +52,7 @@
private int mFlags;
private boolean mWorkEnabled;
private boolean mOnWorkTab;
+ private boolean mApplyWindowInset;
public WorkModeSwitch(Context context) {
this(context, null, 0);
@@ -168,7 +169,7 @@
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
- if (!Utilities.ATLEAST_R) {
+ if (!Utilities.ATLEAST_R || !mApplyWindowInset) {
return insets;
}
if (insets.isVisible(WindowInsets.Type.ime())) {
@@ -197,4 +198,8 @@
private void removeFlag(int flag) {
mFlags &= ~flag;
}
+
+ public void setApplyWindowInset(boolean applyWindowInset){
+ mApplyWindowInset = applyWindowInset;
+ }
}
diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
index 886460e..4c461aa 100644
--- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
@@ -84,7 +84,10 @@
mTextConversions = extractTextConversions(s);
}
- private static String[] extractTextConversions(CharSequence text) {
+ /**
+ * Extract text conversions from composing text and send them for search.
+ */
+ public static String[] extractTextConversions(CharSequence text) {
if (text instanceof SpannableStringBuilder) {
SpannableStringBuilder spanned = (SpannableStringBuilder) text;
SuggestionSpan[] suggestionSpans =
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 5ba268e..5ee5558 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -92,6 +92,10 @@
getDebugFlag("ENABLE_FLOATING_SEARCH_BAR", false,
"Keep All Apps search bar at the bottom (but above keyboard if open)");
+ public static final BooleanFlag ENABLE_QUICK_LAUNCH_V2 = new DeviceFlag(
+ "ENABLE_QUICK_LAUNCH_V2", false, "Use quick launch v2 "
+ + "behavior. Quick search and quick launch v1 would be unavailable if this is enabled");
+
public static final BooleanFlag ENABLE_HIDE_HEADER = new DeviceFlag("ENABLE_HIDE_HEADER",
true, "Hide header on keyboard before typing in all apps");
@@ -236,6 +240,10 @@
"ENABLE_ALL_APPS_ONE_SEARCH_IN_TASKBAR", false,
"Enables One Search box in Taskbar All Apps.");
+ public static final BooleanFlag ENABLE_TASKBAR_IN_OVERVIEW = getDebugFlag(
+ "ENABLE_TASKBAR_IN_OVERVIEW", false,
+ "Enables accessing the system Taskbar in overview.");
+
public static final BooleanFlag ENABLE_SPLIT_FROM_WORKSPACE = getDebugFlag(
"ENABLE_SPLIT_FROM_WORKSPACE", true,
"Enable initiating split screen from workspace.");
@@ -247,11 +255,6 @@
public static final BooleanFlag ENABLE_ONE_SEARCH_MOTION = new DeviceFlag(
"ENABLE_ONE_SEARCH_MOTION", true, "Enables animations in OneSearch.");
- public static final BooleanFlag ENABLE_KEYBOARD_TRANSITION_SYNC = new DeviceFlag(
- "ENABLE_KEYBOARD_TRANSITION_SYNC", IS_STUDIO_BUILD,
- "Enable option to synchronize the keyboard open and close animations when transitioning"
- + " between home and all apps");
-
public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = new DeviceFlag(
"ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", true,
"Enable option to show keyboard when going to all-apps");
diff --git a/src/com/android/launcher3/dragndrop/SpringLoadedDragController.java b/src/com/android/launcher3/dragndrop/SpringLoadedDragController.java
index fb8a1bc..08e50dd 100644
--- a/src/com/android/launcher3/dragndrop/SpringLoadedDragController.java
+++ b/src/com/android/launcher3/dragndrop/SpringLoadedDragController.java
@@ -20,12 +20,14 @@
import com.android.launcher3.CellLayout;
import com.android.launcher3.Launcher;
import com.android.launcher3.OnAlarmListener;
+import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
public class SpringLoadedDragController implements OnAlarmListener {
// how long the user must hover over a mini-screen before it unshrinks
- final long ENTER_SPRING_LOAD_HOVER_TIME = 500;
- final long ENTER_SPRING_LOAD_CANCEL_HOVER_TIME = 950;
+ private static final long ENTER_SPRING_LOAD_HOVER_TIME = 500;
+ private static final long ENTER_SPRING_LOAD_HOVER_TIME_IN_TEST = 1500;
+ private static final long ENTER_SPRING_LOAD_CANCEL_HOVER_TIME = 950;
Alarm mAlarm;
@@ -39,6 +41,13 @@
mAlarm.setOnAlarmListener(this);
}
+ private long getEnterSpringLoadHoverTime() {
+ // Some TAPL tests are flaky on Cuttlefish with a low waiting time
+ return Utilities.IS_RUNNING_IN_TEST_HARNESS
+ ? ENTER_SPRING_LOAD_HOVER_TIME_IN_TEST
+ : ENTER_SPRING_LOAD_HOVER_TIME;
+ }
+
public void cancel() {
mAlarm.cancelAlarm();
}
@@ -46,8 +55,8 @@
// Set a new alarm to expire for the screen that we are hovering over now
public void setAlarm(CellLayout cl) {
mAlarm.cancelAlarm();
- mAlarm.setAlarm((cl == null) ? ENTER_SPRING_LOAD_CANCEL_HOVER_TIME :
- ENTER_SPRING_LOAD_HOVER_TIME);
+ mAlarm.setAlarm((cl == null) ? ENTER_SPRING_LOAD_CANCEL_HOVER_TIME
+ : getEnterSpringLoadHoverTime());
mScreen = cl;
}
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 9afca4f..ceebc2e 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -504,9 +504,9 @@
DeviceProfile dp, boolean isRtl) {
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
- int dividerBar = splitBoundsConfig.appsStackedVertically
- ? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight)
- : (int) (splitBoundsConfig.dividerWidthPercent * parentWidth);
+ int dividerBar = Math.round(totalThumbnailHeight * (splitBoundsConfig.appsStackedVertically
+ ? splitBoundsConfig.dividerHeightPercent
+ : splitBoundsConfig.dividerWidthPercent));
int primarySnapshotHeight;
int primarySnapshotWidth;
int secondarySnapshotHeight;
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index bc1b634..a9ae7dc 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -630,9 +630,9 @@
DeviceProfile dp, boolean isRtl) {
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
- int dividerBar = splitBoundsConfig.appsStackedVertically
- ? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight)
- : (int) (splitBoundsConfig.dividerWidthPercent * parentWidth);
+ int dividerBar = Math.round(splitBoundsConfig.appsStackedVertically
+ ? splitBoundsConfig.dividerHeightPercent * totalThumbnailHeight
+ : splitBoundsConfig.dividerWidthPercent * totalThumbnailHeight);
int primarySnapshotHeight;
int primarySnapshotWidth;
int secondarySnapshotHeight;
@@ -662,6 +662,16 @@
secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar;
int translationY = primarySnapshotHeight + spaceAboveSnapshot + dividerBar;
secondarySnapshot.setTranslationY(translationY);
+
+ FrameLayout.LayoutParams primaryParams =
+ (FrameLayout.LayoutParams) primarySnapshot.getLayoutParams();
+ FrameLayout.LayoutParams secondaryParams =
+ (FrameLayout.LayoutParams) secondarySnapshot.getLayoutParams();
+ secondaryParams.topMargin = 0;
+ primaryParams.topMargin = spaceAboveSnapshot;
+
+ // Reset unused translations
+ primarySnapshot.setTranslationY(0);
secondarySnapshot.setTranslationX(0);
primarySnapshot.setTranslationX(0);
}
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index 55bb5e8..a616a8b 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -121,9 +121,9 @@
// the screen. This is to preserve consistency when the user rotates: From the user's POV,
// the primary should always be on the left.
if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
- outRect.top += (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent));
+ outRect.top += (int) (outRect.height() * ((1 - topLeftTaskPercent)));
} else {
- outRect.bottom = outRect.top + (int) (outRect.height() * topLeftTaskPercent);
+ outRect.bottom -= (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent));
}
}
@@ -266,6 +266,49 @@
secondaryIconView.setLayoutParams(secondaryIconParams);
}
+ @Override
+ public void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot,
+ int parentWidth, int parentHeight, SplitBounds splitBoundsConfig, DeviceProfile dp,
+ boolean isRtl) {
+ FrameLayout.LayoutParams primaryParams =
+ (FrameLayout.LayoutParams) primarySnapshot.getLayoutParams();
+ FrameLayout.LayoutParams secondaryParams =
+ (FrameLayout.LayoutParams) secondarySnapshot.getLayoutParams();
+
+ // Swap the margins that are set in TaskView#setRecentsOrientedState()
+ secondaryParams.topMargin = dp.overviewTaskThumbnailTopMarginPx;
+ primaryParams.topMargin = 0;
+
+ // Measure and layout the thumbnails bottom up, since the primary is on the visual left
+ // (portrait bottom) and secondary is on the right (portrait top)
+ int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
+ int totalThumbnailHeight = parentHeight - spaceAboveSnapshot;
+ int dividerBar = Math.round(totalThumbnailHeight * (splitBoundsConfig.appsStackedVertically
+ ? splitBoundsConfig.dividerHeightPercent
+ : splitBoundsConfig.dividerWidthPercent));
+ int primarySnapshotHeight;
+ int primarySnapshotWidth;
+ int secondarySnapshotHeight;
+ int secondarySnapshotWidth;
+
+ float taskPercent = splitBoundsConfig.appsStackedVertically ?
+ splitBoundsConfig.topTaskPercent : splitBoundsConfig.leftTaskPercent;
+ primarySnapshotWidth = parentWidth;
+ primarySnapshotHeight = (int) (totalThumbnailHeight * (taskPercent));
+
+ secondarySnapshotWidth = parentWidth;
+ secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar;
+ secondarySnapshot.setTranslationY(0);
+ primarySnapshot.setTranslationY(secondarySnapshotHeight + spaceAboveSnapshot + dividerBar);
+ primarySnapshot.measure(
+ View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY),
+ View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY));
+ secondarySnapshot.measure(
+ View.MeasureSpec.makeMeasureSpec(secondarySnapshotWidth, View.MeasureSpec.EXACTLY),
+ View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight,
+ View.MeasureSpec.EXACTLY));
+ }
+
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */
@Override
diff --git a/src/com/android/launcher3/util/LogConfig.java b/src/com/android/launcher3/util/LogConfig.java
index ee1d1ff..5abf95c 100644
--- a/src/com/android/launcher3/util/LogConfig.java
+++ b/src/com/android/launcher3/util/LogConfig.java
@@ -50,4 +50,9 @@
* When turned on, we enable web suggest appSearch related logging.
*/
public static final String WEB_APP_SEARCH_LOGGING = "WebAppSearchLogging";
+
+ /**
+ * When turned on, we enable quick launch v2 related logging.
+ */
+ public static final String QUICK_LAUNCH_V2 = "QuickLaunchV2";
}
diff --git a/tests/Android.bp b/tests/Android.bp
index 1584308..39bd307 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -60,6 +60,7 @@
"src/com/android/launcher3/testcomponent/CustomShortcutConfigActivity.java",
"src/com/android/launcher3/testcomponent/TestCommandReceiver.java",
"src/com/android/launcher3/testcomponent/TestLauncherActivity.java",
+ "src/com/android/launcher3/testcomponent/ImeTestActivity.java",
],
}
diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml
index 9cc3aed..ae1060e 100644
--- a/tests/AndroidManifest-common.xml
+++ b/tests/AndroidManifest-common.xml
@@ -277,6 +277,16 @@
</intent-filter>
</activity-alias>
+ <activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
+ android:label="ImeTestActivity"
+ android:icon="@drawable/test_theme_icon"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
<!-- [b/197780098] Disable eager initialization of Jetpack libraries. -->
<provider
android:name="androidx.startup.InitializationProvider"
diff --git a/tests/src/com/android/launcher3/celllayout/testcases/MoveOutReorderCase.java b/tests/src/com/android/launcher3/celllayout/testcases/MoveOutReorderCase.java
index a222d3d..047d342 100644
--- a/tests/src/com/android/launcher3/celllayout/testcases/MoveOutReorderCase.java
+++ b/tests/src/com/android/launcher3/celllayout/testcases/MoveOutReorderCase.java
@@ -63,25 +63,7 @@
MOVE_TO_6x5,
END_BOARD_STR_6x5);
- /** 4x4 Test
- **/
- private static final String START_BOARD_STR_4x4 = ""
- + "xxxx\n"
- + "34-m\n"
- + "3511\n"
- + "3211";
- private static final Point MOVE_TO_4x4 = new Point(1, 2);
- private static final String END_BOARD_STR_4x4 = ""
- + "xxxx\n"
- + "345-\n"
- + "3m11\n"
- + "3211";
- private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
- MOVE_TO_4x4,
- END_BOARD_STR_4x4);
-
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5,
- new Point(6, 5), TEST_CASE_6x5,
- new Point(4, 4), TEST_CASE_4x4);
+ new Point(6, 5), TEST_CASE_6x5);
}
diff --git a/tests/src/com/android/launcher3/celllayout/testcases/PushReorderCase.java b/tests/src/com/android/launcher3/celllayout/testcases/PushReorderCase.java
index e16ff42..38c9aee 100644
--- a/tests/src/com/android/launcher3/celllayout/testcases/PushReorderCase.java
+++ b/tests/src/com/android/launcher3/celllayout/testcases/PushReorderCase.java
@@ -64,25 +64,7 @@
MOVE_TO_6x5,
END_BOARD_STR_6x5);
- /** 4x4 Test
- **/
- private static final String START_BOARD_STR_4x4 = ""
- + "xxxx\n"
- + "222m\n"
- + "-111\n"
- + "----";
- private static final Point MOVE_TO_4x4 = new Point(2, 1);
- private static final String END_BOARD_STR_4x4 = ""
- + "xxxx\n"
- + "--m-\n"
- + "222-\n"
- + "-111";
- private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
- MOVE_TO_4x4,
- END_BOARD_STR_4x4);
-
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
Map.of(new Point(5, 5), TEST_CASE_5x5,
- new Point(6, 5), TEST_CASE_6x5,
- new Point(4, 4), TEST_CASE_4x4);
+ new Point(6, 5), TEST_CASE_6x5);
}
diff --git a/tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java b/tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java
index 9c6d102..d3ce67c 100644
--- a/tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java
+++ b/tests/src/com/android/launcher3/testcomponent/BaseTestingActivity.java
@@ -24,7 +24,9 @@
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
+import android.view.WindowInsets;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
@@ -81,6 +83,20 @@
mView.addView(button, lp);
}
+ protected void addEditor(String initText, String hint, boolean requestIme) {
+ EditText editText = new EditText(this);
+ editText.setHint(hint);
+ editText.setText(initText);
+
+ LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ lp.bottomMargin = mMargin;
+ mView.addView(editText, lp);
+ if (requestIme) {
+ editText.requestFocus();
+ mView.getWindowInsetsController().show(WindowInsets.Type.ime());
+ }
+ }
+
@Override
protected void onResume() {
super.onResume();
diff --git a/tests/src/com/android/launcher3/testcomponent/ImeTestActivity.java b/tests/src/com/android/launcher3/testcomponent/ImeTestActivity.java
new file mode 100644
index 0000000..43952d5
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/ImeTestActivity.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2022 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.testcomponent;
+
+import android.os.Bundle;
+
+public class ImeTestActivity extends OtherBaseTestingActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Requests to focus an editor and show IME for test.
+ addEditor("Focused editor for test", "Focused editor for test", true);
+ }
+}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 2d519d9..70d122b 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -479,6 +479,16 @@
false /* newTask */);
}
+ public static void startImeTestActivity() {
+ final String packageName = getAppPackageName();
+ final Intent intent = getInstrumentation().getContext().getPackageManager().
+ getLaunchIntentForPackage(packageName);
+ intent.setComponent(new ComponentName(packageName,
+ "com.android.launcher3.testcomponent.ImeTestActivity"));
+ startIntent(intent, By.pkg(packageName).text("ImeTestActivity"),
+ false /* newTask */);
+ }
+
private static void startIntent(Intent intent, BySelector selector, boolean newTask) {
intent.addCategory(Intent.CATEGORY_LAUNCHER);
if (newTask) {
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index eb8d055..15705e7 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -206,21 +206,30 @@
MotionEvent.ACTION_UP, end, gestureScope);
}
+ /**
+ * Quick switching to the app with swiping to right.
+ */
@NonNull
public LaunchedAppState quickSwitchToPreviousApp() {
- boolean toRight = true;
- quickSwitch(toRight);
+ quickSwitch(true /* toRight */);
return new LaunchedAppState(mLauncher);
}
+ /**
+ * Quick switching to the app with swiping to left.
+ */
@NonNull
public LaunchedAppState quickSwitchToPreviousAppSwipeLeft() {
- boolean toRight = false;
- quickSwitch(toRight);
+ quickSwitch(false /* toRight */);
return new LaunchedAppState(mLauncher);
}
- @NonNull
+ /**
+ * Making swipe gesture to quick-switch app tasks.
+ *
+ * @param toRight {@code true} means swiping right, {@code false} means swiping left.
+ * @throws {@link AssertionError} when failing to verify the visible UI in the container.
+ */
private void quickSwitch(boolean toRight) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index a17651b..4b02ecc 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -72,6 +72,16 @@
}
/**
+ * Waits for the taskbar to be visible, or fails.
+ */
+ public void assertTaskbarVisible() {
+ try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
+ "waiting for taskbar to be visible")) {
+ mLauncher.waitForLauncherObject(TASKBAR_RES_ID);
+ }
+ }
+
+ /**
* Returns the Taskbar in a visible state.
*
* The taskbar must already be hidden when calling this method.
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 3986df6..3545c27 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -185,13 +185,14 @@
private final Deque<String> mDiagnosticContext = new LinkedList<>();
private Function<Long, String> mSystemHealthSupplier;
+ private boolean mIgnoreTaskbarVisibility = false;
+
private Consumer<ContainerType> mOnSettledStateAction;
private LogEventChecker mEventChecker;
private boolean mCheckEventsForSuccessfulGestures = false;
private Runnable mOnLauncherCrashed;
-
private static Pattern getTouchEventPattern(String prefix, String action) {
// The pattern includes checks that we don't get a multi-touch events or other surprises.
return Pattern.compile(
@@ -680,6 +681,18 @@
}
}
+ /**
+ * Whether to ignore verifying the task bar visibility during instrumenting.
+ *
+ * @param ignoreTaskbarVisibility {@code true} will ignore the instrumentation implicitly
+ * verifying the task bar visibility with
+ * {@link VisibleContainer#verifyActiveContainer}.
+ * {@code false} otherwise.
+ */
+ public void setIgnoreTaskbarVisibility(boolean ignoreTaskbarVisibility) {
+ mIgnoreTaskbarVisibility = ignoreTaskbarVisibility;
+ }
+
public void setExpectedRotation(int expectedRotation) {
mExpectedRotation = expectedRotation;
}
@@ -798,6 +811,9 @@
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
+ if (mIgnoreTaskbarVisibility) {
+ return null;
+ }
if (isTablet() && !isFallbackOverview()) {
waitForLauncherObject(TASKBAR_RES_ID);
} else {