Merge "Reapply recents attached state in createActivityController()" into ub-launcher3-qt-dev
diff --git a/Android.bp b/Android.bp
index 5acec37..b80282e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -24,6 +24,7 @@
srcs: [
"tests/tapl/**/*.java",
"src/com/android/launcher3/util/SecureSettingsObserver.java",
+ "src/com/android/launcher3/ResourceUtils.java",
"src/com/android/launcher3/TestProtocol.java",
],
manifest: "tests/tapl/AndroidManifest.xml",
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 819e6bc..ef5bb26 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -154,13 +154,13 @@
<!--
The content provider for exposing various launcher grid options.
- TODO: Enable when all apps columns are correct
TODO: Add proper permissions
+ -->
<provider
android:name="com.android.launcher3.graphics.GridOptionsProvider"
android:authorities="${packageName}.grid_control"
+ android:enabled="false"
android:exported="true" />
- -->
<!--
The settings activity. To extend point settings_fragment_name to appropriate fragment class
diff --git a/go/quickstep/res/layout/task_item_view.xml b/go/quickstep/res/layout/task_item_view.xml
index 699178d..ab2cf28 100644
--- a/go/quickstep/res/layout/task_item_view.xml
+++ b/go/quickstep/res/layout/task_item_view.xml
@@ -18,7 +18,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/task_item_height"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:clipChildren="false">
<com.android.quickstep.views.TaskThumbnailIconView
android:id="@+id/task_icon_and_thumbnail"
android:layout_width="match_parent"
diff --git a/go/quickstep/res/values-sw480dp/dimens.xml b/go/quickstep/res/values-sw480dp/dimens.xml
index b48dafb..571b8a1 100644
--- a/go/quickstep/res/values-sw480dp/dimens.xml
+++ b/go/quickstep/res/values-sw480dp/dimens.xml
@@ -18,13 +18,13 @@
<dimen name="recents_list_width">480dp</dimen>
<dimen name="task_item_height">90dp</dimen>
- <dimen name="task_item_top_margin">16dp</dimen>
- <dimen name="task_thumbnail_icon_horiz_margin">20dp</dimen>
+ <dimen name="task_item_top_margin">24dp</dimen>
+ <dimen name="task_thumbnail_icon_horiz_margin">24dp</dimen>
<dimen name="task_thumbnail_corner_radius">4dp</dimen>
- <dimen name="clear_all_item_view_height">48dp</dimen>
+ <dimen name="clear_all_item_view_height">52dp</dimen>
<dimen name="clear_all_item_view_top_margin">28dp</dimen>
<dimen name="clear_all_item_view_bottom_margin">28dp</dimen>
- <dimen name="clear_all_button_width">140dp</dimen>
+ <dimen name="clear_all_button_width">160dp</dimen>
</resources>
\ No newline at end of file
diff --git a/go/quickstep/src/com/android/launcher3/GoLauncherAppTransitionManagerImpl.java b/go/quickstep/src/com/android/launcher3/GoLauncherAppTransitionManagerImpl.java
index d189c50..bcb1f5c 100644
--- a/go/quickstep/src/com/android/launcher3/GoLauncherAppTransitionManagerImpl.java
+++ b/go/quickstep/src/com/android/launcher3/GoLauncherAppTransitionManagerImpl.java
@@ -1,16 +1,20 @@
package com.android.launcher3;
+import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.quickstep.views.IconRecentsView.CONTENT_ALPHA;
+import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
-import android.app.ActivityOptions;
import android.content.Context;
+import android.os.Handler;
import android.view.View;
import com.android.quickstep.views.IconRecentsView;
+import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
/**
@@ -29,6 +33,12 @@
}
@Override
+ RemoteAnimationRunnerCompat getWallpaperOpenRunner(boolean fromUnlock) {
+ return new GoWallpaperOpenLauncherAnimationRunner(mHandler,
+ false /* startAtFrontOfQueue */, fromUnlock);
+ }
+
+ @Override
protected void composeRecentsLaunchAnimator(AnimatorSet anim, View v,
RemoteAnimationTargetCompat[] targets, boolean launcherClosing) {
// Stubbed. Recents launch animation will come from the recents view itself and will not
@@ -51,4 +61,34 @@
return mLauncher.getStateManager()::reapplyState;
}
+
+ /**
+ * Remote animation runner for animation from app to Launcher. For Go, when going to recents,
+ * we need to ensure that the recents view is ready for remote animation before starting.
+ */
+ private final class GoWallpaperOpenLauncherAnimationRunner extends
+ WallpaperOpenLauncherAnimationRunner {
+ public GoWallpaperOpenLauncherAnimationRunner(Handler handler, boolean startAtFrontOfQueue,
+ boolean fromUnlock) {
+ super(handler, startAtFrontOfQueue, fromUnlock);
+ }
+
+ @Override
+ public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
+ AnimationResult result) {
+ boolean isGoingToRecents =
+ taskIsATargetWithMode(targetCompats, mLauncher.getTaskId(), MODE_OPENING)
+ && (mLauncher.getStateManager().getState() == LauncherState.OVERVIEW);
+ if (isGoingToRecents) {
+ IconRecentsView recentsView = mLauncher.getOverviewPanel();
+ if (!recentsView.isReadyForRemoteAnim()) {
+ recentsView.setOnReadyForRemoteAnimCallback(() ->
+ postAsyncCallback(mHandler, () -> onCreateAnimation(targetCompats, result))
+ );
+ return;
+ }
+ }
+ super.onCreateAnimation(targetCompats, result);
+ }
+ }
}
diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index d9b9686..b5fefb4 100644
--- a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -21,10 +21,12 @@
import android.view.View;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeStatesTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController;
@@ -102,4 +104,8 @@
* @param launcher the launcher activity
*/
public static void onLauncherStateOrResumeChanged(Launcher launcher) {}
+
+ public static RotationMode getRotationMode(DeviceProfile dp) {
+ return RotationMode.NORMAL;
+ }
}
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index c228bb9..fe159b5 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -15,30 +15,27 @@
*/
package com.android.quickstep;
-import static com.android.launcher3.anim.Interpolators.ACCEL_2;
-import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
+import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
-import static com.android.quickstep.util.RemoteAnimationProvider.getLayer;
+import static com.android.quickstep.views.IconRecentsView.REMOTE_APP_TO_OVERVIEW_DURATION;
+import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
-import android.graphics.Matrix;
-import android.graphics.Rect;
+import android.app.ActivityOptions;
+import android.os.Handler;
import android.util.Log;
-import android.view.View;
-
-import androidx.annotation.NonNull;
import com.android.launcher3.BaseDraggingActivity;
-import com.android.quickstep.util.MultiValueUpdateListener;
+import com.android.launcher3.LauncherAnimationRunner;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.IconRecentsView;
+import com.android.systemui.shared.system.ActivityOptionsCompat;
+import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
-import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
-import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
/**
* Provider for the atomic remote window animation from the app to the overview.
@@ -47,14 +44,12 @@
*/
final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> implements
RemoteAnimationProvider {
-
- private static final long APP_TO_THUMBNAIL_FADE_DURATION = 50;
- private static final long APP_SCALE_DOWN_DURATION = 400;
private static final String TAG = "AppToOverviewAnimationProvider";
private final ActivityControlHelper<T> mHelper;
private final int mTargetTaskId;
private IconRecentsView mRecentsView;
+ private AppToOverviewAnimationListener mAnimationReadyListener;
AppToOverviewAnimationProvider(ActivityControlHelper<T> helper, int targetTaskId) {
mHelper = helper;
@@ -62,12 +57,24 @@
}
/**
+ * Set listener to various points in the animation preparing to animate.
+ *
+ * @param listener listener
+ */
+ void setAnimationListener(AppToOverviewAnimationListener listener) {
+ mAnimationReadyListener = listener;
+ }
+
+ /**
* Callback for when the activity is ready/initialized.
*
* @param activity the activity that is ready
* @param wasVisible true if it was visible before
*/
boolean onActivityReady(T activity, Boolean wasVisible) {
+ if (mAnimationReadyListener != null) {
+ mAnimationReadyListener.onActivityReady(activity);
+ }
ActivityControlHelper.AnimationFactory factory =
mHelper.prepareRecentsUI(activity, wasVisible,
false /* animate activity */, (controller) -> {
@@ -92,6 +99,9 @@
*/
@Override
public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targetCompats) {
+ if (mAnimationReadyListener != null) {
+ mAnimationReadyListener.onWindowAnimationCreated();
+ }
AnimatorSet anim = new AnimatorSet();
if (mRecentsView == null) {
if (Log.isLoggable(TAG, Log.WARN)) {
@@ -131,98 +141,36 @@
return anim;
}
- View thumbnailView = mRecentsView.getBottomThumbnailView();
- if (thumbnailView == null) {
- // This can be null if there were previously 0 tasks and the recycler view has not had
- // enough time to take in the data change, bind a new view, and lay out the new view.
- // TODO: Have a fallback to animate to
- if (Log.isLoggable(TAG, Log.WARN)) {
- Log.w(TAG, "No thumbnail view for running task. Using stub animation.");
- }
- anim.play(ValueAnimator.ofInt(0, 1).setDuration(getRecentsLaunchDuration()));
- return anim;
+ if (closingAppTarget.activityType == ACTIVITY_TYPE_HOME) {
+ mRecentsView.playRemoteHomeToRecentsAnimation(anim, closingAppTarget, recentsTarget);
+ } else {
+ mRecentsView.playRemoteAppToRecentsAnimation(anim, closingAppTarget, recentsTarget);
}
- playAppScaleDownAnim(anim, closingAppTarget, recentsTarget, thumbnailView);
-
return anim;
}
- /**
- * Animate a closing app to scale down to the location of the thumbnail view in recents.
- *
- * @param anim animator set
- * @param appTarget the app surface thats closing
- * @param recentsTarget the surface containing recents
- * @param thumbnailView the thumbnail view to animate to
- */
- private void playAppScaleDownAnim(@NonNull AnimatorSet anim,
- @NonNull RemoteAnimationTargetCompat appTarget,
- @NonNull RemoteAnimationTargetCompat recentsTarget, @NonNull View thumbnailView) {
-
- // Identify where the entering remote app should animate to.
- Rect endRect = new Rect();
- thumbnailView.getGlobalVisibleRect(endRect);
-
- Rect appBounds = appTarget.sourceContainerBounds;
-
- ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 1);
- valueAnimator.setDuration(APP_SCALE_DOWN_DURATION);
-
- SyncRtSurfaceTransactionApplierCompat surfaceApplier =
- new SyncRtSurfaceTransactionApplierCompat(thumbnailView);
-
- // Keep recents visible throughout the animation.
- SurfaceParams[] params = new SurfaceParams[2];
- // Closing app should stay on top.
- int boostedMode = MODE_CLOSING;
- params[0] = new SurfaceParams(recentsTarget.leash, 1f, null /* matrix */,
- null /* windowCrop */, getLayer(recentsTarget, boostedMode), 0 /* cornerRadius */);
-
- valueAnimator.addUpdateListener(new MultiValueUpdateListener() {
- private final FloatProp mScaleX;
- private final FloatProp mScaleY;
- private final FloatProp mTranslationX;
- private final FloatProp mTranslationY;
- private final FloatProp mAlpha;
-
- {
- // Scale down and move to view location.
- float endScaleX = ((float) endRect.width()) / appBounds.width();
- mScaleX = new FloatProp(1f, endScaleX, 0, APP_SCALE_DOWN_DURATION,
- ACCEL_DEACCEL);
- float endScaleY = ((float) endRect.height()) / appBounds.height();
- mScaleY = new FloatProp(1f, endScaleY, 0, APP_SCALE_DOWN_DURATION,
- ACCEL_DEACCEL);
- float endTranslationX = endRect.left -
- (appBounds.width() - thumbnailView.getWidth()) / 2.0f;
- mTranslationX = new FloatProp(0, endTranslationX, 0, APP_SCALE_DOWN_DURATION,
- ACCEL_DEACCEL);
- float endTranslationY = endRect.top -
- (appBounds.height() - thumbnailView.getHeight()) / 2.0f;
- mTranslationY = new FloatProp(0, endTranslationY, 0, APP_SCALE_DOWN_DURATION,
- ACCEL_DEACCEL);
-
- // Fade out quietly near the end to be replaced by the real view.
- mAlpha = new FloatProp(1.0f, 0,
- APP_SCALE_DOWN_DURATION - APP_TO_THUMBNAIL_FADE_DURATION,
- APP_TO_THUMBNAIL_FADE_DURATION, ACCEL_2);
- }
+ @Override
+ public ActivityOptions toActivityOptions(Handler handler, long duration) {
+ LauncherAnimationRunner runner = new LauncherAnimationRunner(handler,
+ false /* startAtFrontOfQueue */) {
@Override
- public void onUpdate(float percent) {
- Matrix m = new Matrix();
- m.setScale(mScaleX.value, mScaleY.value,
- appBounds.width() / 2.0f, appBounds.height() / 2.0f);
- m.postTranslate(mTranslationX.value, mTranslationY.value);
-
- params[1] = new SurfaceParams(appTarget.leash, mAlpha.value, m,
- null /* windowCrop */, getLayer(appTarget, boostedMode),
- 0 /* cornerRadius */);
- surfaceApplier.scheduleApply(params);
+ public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
+ AnimationResult result) {
+ IconRecentsView recentsView = mRecentsView;
+ if (!recentsView.isReadyForRemoteAnim()) {
+ recentsView.setOnReadyForRemoteAnimCallback(() -> postAsyncCallback(handler,
+ () -> onCreateAnimation(targetCompats, result))
+ );
+ return;
+ }
+ result.setAnimation(createWindowAnimation(targetCompats));
}
- });
- anim.play(valueAnimator);
+ };
+ return ActivityOptionsCompat.makeRemoteAnimation(
+ new RemoteAnimationAdapterCompat(runner, duration,
+ 0 /* statusBarTransitionDelay */));
}
/**
@@ -231,6 +179,23 @@
* @return duration of animation
*/
long getRecentsLaunchDuration() {
- return APP_SCALE_DOWN_DURATION;
+ return REMOTE_APP_TO_OVERVIEW_DURATION;
+ }
+
+ /**
+ * Listener for various points in the app to overview animation preparing to animate.
+ */
+ interface AppToOverviewAnimationListener {
+ /**
+ * Logic for when activity we're animating to is ready
+ *
+ * @param activity activity to animate to
+ */
+ void onActivityReady(BaseDraggingActivity activity);
+
+ /**
+ * Logic for when we've created the app to recents animation.
+ */
+ void onWindowAnimationCreated();
}
}
diff --git a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java
index 9282345..808cd72 100644
--- a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java
+++ b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java
@@ -180,6 +180,7 @@
@Override
public void onAnimationEnd(Animator animation) {
+ CONTENT_TRANSITION_PROGRESS.set(itemView, 1.0f);
dispatchChangeFinished(viewHolder, true /* oldItem */);
mRunningAnims.remove(anim);
dispatchFinishedWhenDone();
@@ -215,46 +216,43 @@
@Override
public void endAnimation(@NonNull ViewHolder item) {
for (int i = mPendingAnims.size() - 1; i >= 0; i--) {
- PendingAnimation pendAnim = mPendingAnims.get(i);
- if (pendAnim.viewHolder == item) {
- mPendingAnims.remove(i);
- switch (pendAnim.animType) {
- case ANIM_TYPE_REMOVE:
- dispatchRemoveFinished(item);
- break;
- case ANIM_TYPE_CHANGE:
- dispatchChangeFinished(item, true /* oldItem */);
- break;
- default:
- break;
- }
- }
+ endPendingAnimation(mPendingAnims.get(i));
+ mPendingAnims.remove(i);
}
dispatchFinishedWhenDone();
}
@Override
public void endAnimations() {
+ if (!isRunning()) {
+ return;
+ }
for (int i = mPendingAnims.size() - 1; i >= 0; i--) {
- PendingAnimation pendAnim = mPendingAnims.get(i);
- ViewHolder item = pendAnim.viewHolder;
- switch (pendAnim.animType) {
- case ANIM_TYPE_REMOVE:
- dispatchRemoveFinished(item);
- break;
- case ANIM_TYPE_CHANGE:
- dispatchChangeFinished(item, true /* oldItem */);
- break;
- default:
- break;
- }
+ endPendingAnimation(mPendingAnims.get(i));
mPendingAnims.remove(i);
}
- for (int i = 0; i < mRunningAnims.size(); i++) {
+ for (int i = mRunningAnims.size() - 1; i >= 0; i--) {
ObjectAnimator anim = mRunningAnims.get(i);
- anim.end();
+ // This calls the on end animation callback which will set values to their end target.
+ anim.cancel();
}
- dispatchAnimationsFinished();
+ dispatchFinishedWhenDone();
+ }
+
+ private void endPendingAnimation(PendingAnimation pendAnim) {
+ ViewHolder item = pendAnim.viewHolder;
+ switch (pendAnim.animType) {
+ case ANIM_TYPE_REMOVE:
+ item.itemView.setAlpha(1.0f);
+ dispatchRemoveFinished(item);
+ break;
+ case ANIM_TYPE_CHANGE:
+ CONTENT_TRANSITION_PROGRESS.set(item.itemView, 1.0f);
+ dispatchChangeFinished(item, true /* oldItem */);
+ break;
+ default:
+ break;
+ }
}
@Override
diff --git a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
index bba08a4..eb0c5b9 100644
--- a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -50,6 +50,7 @@
}
IconRecentsView rv = activity.getOverviewPanel();
+ rv.setUsingRemoteAnimation(true);
rv.setAlpha(0);
return new AnimationFactory() {
diff --git a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 40db7dd..d595007 100644
--- a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -40,6 +40,7 @@
boolean activityVisible, boolean animateActivity,
Consumer<AnimatorPlaybackController> callback) {
LauncherState fromState = activity.getStateManager().getState();
+ activity.<IconRecentsView>getOverviewPanel().setUsingRemoteAnimation(true);
//TODO: Implement this based off where the recents view needs to be for app => recents anim.
return new AnimationFactory() {
@Override
@@ -87,6 +88,7 @@
if (launcher == null) {
return false;
}
+ launcher.<IconRecentsView>getOverviewPanel().setUsingRemoteAnimation(false);
launcher.getUserEventDispatcher().logActionCommand(
LauncherLogProto.Action.Command.RECENTS_BUTTON,
getContainerType(),
diff --git a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index 379cc10..0fa3d86 100644
--- a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -18,7 +18,6 @@
import static com.android.systemui.shared.system.ActivityManagerWrapper
.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
-import android.animation.AnimatorSet;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
@@ -30,10 +29,10 @@
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.ActivityControlHelper.ActivityInitListener;
+import com.android.quickstep.AppToOverviewAnimationProvider.AppToOverviewAnimationListener;
import com.android.quickstep.views.IconRecentsView;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.LatencyTrackerCompat;
-import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
/**
* Helper class to handle various atomic commands for switching between Overview.
@@ -105,7 +104,6 @@
protected final ActivityControlHelper<T> mHelper;
private final long mCreateTime;
- private final AppToOverviewAnimationProvider<T> mAnimationProvider;
private final long mToggleClickedTime = SystemClock.uptimeMillis();
private boolean mUserEventLogged;
@@ -114,8 +112,6 @@
public RecentsActivityCommand() {
mHelper = mOverviewComponentObserver.getActivityControlHelper();
mCreateTime = SystemClock.elapsedRealtime();
- mAnimationProvider =
- new AppToOverviewAnimationProvider<>(mHelper, RecentsModel.getRunningTaskId());
// Preload the plan
mRecentsModel.getTasks(null);
@@ -136,11 +132,37 @@
return;
}
+ AppToOverviewAnimationProvider<T> provider =
+ new AppToOverviewAnimationProvider<>(mHelper, RecentsModel.getRunningTaskId());
+ provider.setAnimationListener(
+ new AppToOverviewAnimationListener() {
+ @Override
+ public void onActivityReady(BaseDraggingActivity activity) {
+ if (!mUserEventLogged) {
+ activity.getUserEventDispatcher().logActionCommand(
+ LauncherLogProto.Action.Command.RECENTS_BUTTON,
+ mHelper.getContainerType(),
+ LauncherLogProto.ContainerType.TASKSWITCHER);
+ mUserEventLogged = true;
+ }
+ }
+
+ @Override
+ public void onWindowAnimationCreated() {
+ if (LatencyTrackerCompat.isEnabled(mContext)) {
+ LatencyTrackerCompat.logToggleRecents(
+ (int) (SystemClock.uptimeMillis() - mToggleClickedTime));
+ }
+
+ mListener.unregister();
+ }
+ });
+
// Otherwise, start overview.
- mListener = mHelper.createActivityInitListener(this::onActivityReady);
+ mListener = mHelper.createActivityInitListener(provider::onActivityReady);
mListener.registerAndStartActivity(mOverviewComponentObserver.getOverviewIntent(),
- this::createWindowAnimation, mContext, mMainThreadExecutor.getHandler(),
- mAnimationProvider.getRecentsLaunchDuration());
+ provider, mContext, mMainThreadExecutor.getHandler(),
+ provider.getRecentsLaunchDuration());
}
protected boolean handleCommand(long elapsedTime) {
@@ -155,27 +177,5 @@
}
return false;
}
-
- private boolean onActivityReady(T activity, Boolean wasVisible) {
- if (!mUserEventLogged) {
- activity.getUserEventDispatcher().logActionCommand(
- LauncherLogProto.Action.Command.RECENTS_BUTTON,
- mHelper.getContainerType(),
- LauncherLogProto.ContainerType.TASKSWITCHER);
- mUserEventLogged = true;
- }
- return mAnimationProvider.onActivityReady(activity, wasVisible);
- }
-
- private AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targetCompats) {
- if (LatencyTrackerCompat.isEnabled(mContext)) {
- LatencyTrackerCompat.logToggleRecents(
- (int) (SystemClock.uptimeMillis() - mToggleClickedTime));
- }
-
- mListener.unregister();
-
- return mAnimationProvider.createWindowAnimation(targetCompats);
- }
}
}
diff --git a/go/quickstep/src/com/android/quickstep/RecentsActivity.java b/go/quickstep/src/com/android/quickstep/RecentsActivity.java
index 9fb8067..7f813ce 100644
--- a/go/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/go/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -42,7 +42,7 @@
@Override
protected void reapplyUi() {
- //TODO: Implement this depending on how insets will affect the view.
+ // No-op. Insets are automatically re-applied in the root view.
}
@Override
@@ -67,8 +67,8 @@
}
@Override
- protected void onStart() {
+ protected void onResume() {
mIconRecentsView.onBeginTransitionToOverview();
- super.onStart();
+ super.onResume();
}
}
diff --git a/go/quickstep/src/com/android/quickstep/TaskActionController.java b/go/quickstep/src/com/android/quickstep/TaskActionController.java
index 0e921c0..f49fa3e 100644
--- a/go/quickstep/src/com/android/quickstep/TaskActionController.java
+++ b/go/quickstep/src/com/android/quickstep/TaskActionController.java
@@ -16,14 +16,17 @@
package com.android.quickstep;
import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;
+import static com.android.quickstep.TaskUtils.getLaunchComponentKeyForTask;
import android.app.ActivityOptions;
import android.view.View;
import androidx.annotation.NonNull;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.quickstep.views.TaskItemView;
import com.android.systemui.shared.recents.model.Task;
+import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.system.ActivityManagerWrapper;
/**
@@ -34,10 +37,13 @@
private final TaskListLoader mLoader;
private final TaskAdapter mAdapter;
+ private final StatsLogManager mStatsLogManager;
- public TaskActionController(TaskListLoader loader, TaskAdapter adapter) {
+ public TaskActionController(TaskListLoader loader, TaskAdapter adapter,
+ StatsLogManager logManager) {
mLoader = loader;
mAdapter = adapter;
+ mStatsLogManager = logManager;
}
/**
@@ -56,10 +62,11 @@
int width = v.getMeasuredWidth();
int height = v.getMeasuredHeight();
+ TaskKey key = viewHolder.getTask().get().key;
ActivityOptions opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
- ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(
- viewHolder.getTask().get().key, opts, null /* resultCallback */,
- null /* resultCallbackHandler */);
+ ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(key, opts,
+ null /* resultCallback */, null /* resultCallbackHandler */);
+ mStatsLogManager.logTaskLaunch(null /* view */, getLaunchComponentKeyForTask(key));
}
/**
@@ -71,6 +78,7 @@
ActivityOptions opts = ActivityOptions.makeBasic();
ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(task.key, opts,
null /* resultCallback */, null /* resultCallbackHandler */);
+ mStatsLogManager.logTaskLaunch(null /* view */, getLaunchComponentKeyForTask(task.key));
}
/**
@@ -87,6 +95,7 @@
ActivityManagerWrapper.getInstance().removeTask(task.key.id);
mLoader.removeTask(task);
mAdapter.notifyItemRemoved(position);
+ // TODO(b/131840601): Add logging point for removal.
}
/**
diff --git a/go/quickstep/src/com/android/quickstep/fallback/GoRecentsActivityRootView.java b/go/quickstep/src/com/android/quickstep/fallback/GoRecentsActivityRootView.java
index c0ebcb5..b550011 100644
--- a/go/quickstep/src/com/android/quickstep/fallback/GoRecentsActivityRootView.java
+++ b/go/quickstep/src/com/android/quickstep/fallback/GoRecentsActivityRootView.java
@@ -16,7 +16,10 @@
package com.android.quickstep.fallback;
import android.content.Context;
+import android.graphics.Insets;
+import android.graphics.Rect;
import android.util.AttributeSet;
+import android.view.WindowInsets;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
@@ -30,5 +33,23 @@
super(context, attrs, 1 /* alphaChannelCount */);
// Go leaves touch control to the view itself.
mControllers = new TouchController[0];
+ setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | SYSTEM_UI_FLAG_LAYOUT_STABLE);
+ }
+
+ @Override
+ public void setInsets(Rect insets) {
+ if (insets.equals(mInsets)) {
+ return;
+ }
+ super.setInsets(insets);
+ }
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ Insets sysInsets = insets.getSystemWindowInsets();
+ setInsets(new Rect(sysInsets.left, sysInsets.top, sysInsets.right, sysInsets.bottom));
+ return insets.consumeSystemWindowInsets();
}
}
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 7225e57..87b4d4e 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -19,10 +19,14 @@
import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
+import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.quickstep.TaskAdapter.CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT;
import static com.android.quickstep.TaskAdapter.ITEM_TYPE_CLEAR_ALL;
import static com.android.quickstep.TaskAdapter.ITEM_TYPE_TASK;
+import static com.android.quickstep.TaskAdapter.MAX_TASKS_TO_DISPLAY;
import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;
+import static com.android.quickstep.util.RemoteAnimationProvider.getLayer;
+import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -32,7 +36,9 @@
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Matrix;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.ArraySet;
import android.util.AttributeSet;
@@ -40,10 +46,12 @@
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewTreeObserver;
+import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -64,7 +72,11 @@
import com.android.quickstep.TaskHolder;
import com.android.quickstep.TaskListLoader;
import com.android.quickstep.TaskSwipeCallback;
+import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.systemui.shared.recents.model.Task;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
+import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
import java.util.ArrayList;
import java.util.List;
@@ -102,6 +114,22 @@
private static final float ITEM_ANIMATE_OUT_TRANSLATION_X_RATIO = .25f;
private static final long CLEAR_ALL_FADE_DELAY = 120;
+ private static final long REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION = 300;
+ private static final long REMOTE_TO_RECENTS_VERTICAL_EASE_IN_DURATION = 400;
+ private static final long REMOTE_TO_RECENTS_ITEM_FADE_START_DELAY = 200;
+ private static final long REMOTE_TO_RECENTS_ITEM_FADE_DURATION = 217;
+ private static final long REMOTE_TO_RECENTS_ITEM_FADE_BETWEEN_DELAY = 33;
+
+ private static final PathInterpolator FAST_OUT_SLOW_IN_1 =
+ new PathInterpolator(.4f, 0f, 0f, 1f);
+ private static final PathInterpolator FAST_OUT_SLOW_IN_2 =
+ new PathInterpolator(.5f, 0f, 0f, 1f);
+ private static final LinearOutSlowInInterpolator OUT_SLOW_IN =
+ new LinearOutSlowInInterpolator();
+
+ public static final long REMOTE_APP_TO_OVERVIEW_DURATION =
+ REMOTE_TO_RECENTS_VERTICAL_EASE_IN_DURATION;
+
/**
* A ratio representing the view's relative placement within its padded space. For example, 0
* is top aligned and 0.5 is centered vertically.
@@ -125,6 +153,9 @@
private View mEmptyView;
private View mContentView;
private boolean mTransitionedFromApp;
+ private boolean mUsingRemoteAnimation;
+ private boolean mStartedEnterAnimation;
+ private boolean mShowStatusBarForegroundScrim;
private AnimatorSet mLayoutAnimation;
private final ArraySet<View> mLayingOutViews = new ArraySet<>();
private Rect mInsets;
@@ -154,7 +185,8 @@
mTaskLoader = new TaskListLoader(mContext);
mTaskAdapter = new TaskAdapter(mTaskLoader);
mTaskAdapter.setOnClearAllClickListener(view -> animateClearAllTasks());
- mTaskActionController = new TaskActionController(mTaskLoader, mTaskAdapter);
+ mTaskActionController = new TaskActionController(mTaskLoader, mTaskAdapter,
+ mActivity.getStatsLogManager());
mTaskAdapter.setActionController(mTaskActionController);
mTaskLayoutManager = new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */);
RecentsModel.INSTANCE.get(context).addThumbnailChangeListener(listener);
@@ -204,12 +236,8 @@
case ITEM_TYPE_CLEAR_ALL:
outRect.top = (int) res.getDimension(
R.dimen.clear_all_item_view_top_margin);
- int desiredBottomMargin = (int) res.getDimension(
+ outRect.bottom = (int) res.getDimension(
R.dimen.clear_all_item_view_bottom_margin);
- // Only add bottom margin if insets aren't enough.
- if (mInsets.bottom < desiredBottomMargin) {
- outRect.bottom = desiredBottomMargin - mInsets.bottom;
- }
break;
case ITEM_TYPE_TASK:
int desiredTopMargin = (int) res.getDimension(
@@ -270,13 +298,16 @@
* becomes visible.
*/
public void onBeginTransitionToOverview() {
+ mStartedEnterAnimation = false;
if (mContext.getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
// Scroll to bottom of task in landscape mode. This is a non-issue in portrait mode as
// all tasks should be visible to fill up the screen in portrait mode and the view will
// not be scrollable.
mTaskLayoutManager.scrollToPositionWithOffset(TASKS_START_POSITION, 0 /* offset */);
}
- scheduleFadeInLayoutAnimation();
+ if (!mUsingRemoteAnimation) {
+ scheduleFadeInLayoutAnimation();
+ }
// Load any task changes
if (!mTaskLoader.needsToLoad()) {
return;
@@ -292,16 +323,22 @@
+ "of items to animate to.");
}
// Possible that task list loads faster than adapter changes propagate to layout so
- // only start content fill animation if there aren't any pending adapter changes.
- if (!mTaskRecyclerView.hasPendingAdapterUpdates()) {
+ // only start content fill animation if there aren't any pending adapter changes and
+ // we've started the on enter layout animation.
+ boolean needsContentFillAnimation =
+ !mTaskRecyclerView.hasPendingAdapterUpdates() && mStartedEnterAnimation;
+ if (needsContentFillAnimation) {
// Set item animator for content filling animation. The item animator will switch
// back to the default on completion
mTaskRecyclerView.setItemAnimator(mLoadingContentItemAnimator);
+ mTaskAdapter.notifyItemRangeRemoved(TASKS_START_POSITION + numActualItems,
+ numEmptyItems - numActualItems);
+ mTaskAdapter.notifyItemRangeChanged(TASKS_START_POSITION, numActualItems,
+ CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT);
+ } else {
+ // Notify change without animating.
+ mTaskAdapter.notifyDataSetChanged();
}
- mTaskAdapter.notifyItemRangeRemoved(TASKS_START_POSITION + numActualItems,
- numEmptyItems - numActualItems);
- mTaskAdapter.notifyItemRangeChanged(TASKS_START_POSITION, numActualItems,
- CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT);
});
}
@@ -315,6 +352,17 @@
}
/**
+ * Set whether we're using a custom remote animation. If so, we will not do the default layout
+ * animation when entering recents and instead wait for the remote app surface to be ready to
+ * use.
+ *
+ * @param usingRemoteAnimation true if doing a remote animation, false o/w
+ */
+ public void setUsingRemoteAnimation(boolean usingRemoteAnimation) {
+ mUsingRemoteAnimation = usingRemoteAnimation;
+ }
+
+ /**
* Handles input from the overview button. Launch the most recent task unless we just came from
* the app. In that case, we launch the next most recent.
*/
@@ -360,22 +408,61 @@
* @param showStatusBarForegroundScrim true to show the scrim, false to hide
*/
public void setShowStatusBarForegroundScrim(boolean showStatusBarForegroundScrim) {
- boolean shouldShow = mInsets.top != 0 && showStatusBarForegroundScrim;
+ mShowStatusBarForegroundScrim = showStatusBarForegroundScrim;
+ if (mShowStatusBarForegroundScrim != showStatusBarForegroundScrim) {
+ updateStatusBarScrim();
+ }
+ }
+
+ private void updateStatusBarScrim() {
+ boolean shouldShow = mInsets.top != 0 && mShowStatusBarForegroundScrim;
mActivity.getDragLayer().setForeground(shouldShow ? mStatusBarForegroundScrim : null);
}
/**
- * Get the bottom most thumbnail view to animate to.
+ * Get the bottom most task view to animate to.
*
- * @return the thumbnail view if laid out
+ * @return the task view
*/
- public @Nullable View getBottomThumbnailView() {
- ArrayList<TaskItemView> taskViews = getTaskViews();
- if (taskViews.isEmpty()) {
- return null;
+ private @Nullable TaskItemView getBottomTaskView() {
+ int childCount = mTaskRecyclerView.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View view = mTaskRecyclerView.getChildAt(i);
+ if (mTaskRecyclerView.getChildViewHolder(view).getItemViewType() == ITEM_TYPE_TASK) {
+ return (TaskItemView) view;
+ }
}
- TaskItemView view = taskViews.get(0);
- return view.getThumbnailView();
+ return null;
+ }
+
+ /**
+ * Whether this view has processed all data changes and is ready to animate from the app to
+ * the overview.
+ *
+ * @return true if ready to animate app to overview, false otherwise
+ */
+ public boolean isReadyForRemoteAnim() {
+ return !mTaskRecyclerView.hasPendingAdapterUpdates();
+ }
+
+ /**
+ * Set a callback for whenever this view is ready to do a remote animation from the app to
+ * overview. See {@link #isReadyForRemoteAnim()}.
+ *
+ * @param callback callback to run when view is ready to animate
+ */
+ public void setOnReadyForRemoteAnimCallback(onReadyForRemoteAnimCallback callback) {
+ mTaskRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(
+ new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ if (isReadyForRemoteAnim()) {
+ callback.onReadyForRemoteAnim();
+ mTaskRecyclerView.getViewTreeObserver().
+ removeOnGlobalLayoutListener(this);
+ }
+ }
+ });
}
/**
@@ -549,6 +636,290 @@
}
});
mLayoutAnimation.start();
+ mStartedEnterAnimation = true;
+ }
+
+ /**
+ * Play remote app to recents animation when the app is the home activity. We use a simple
+ * cross-fade here. Note this is only used if the home activity is a separate app than the
+ * recents activity.
+ *
+ * @param anim animator set
+ * @param homeTarget the home surface thats closing
+ * @param recentsTarget the surface containing recents
+ */
+ public void playRemoteHomeToRecentsAnimation(@NonNull AnimatorSet anim,
+ @NonNull RemoteAnimationTargetCompat homeTarget,
+ @NonNull RemoteAnimationTargetCompat recentsTarget) {
+ SyncRtSurfaceTransactionApplierCompat surfaceApplier =
+ new SyncRtSurfaceTransactionApplierCompat(this);
+
+ SurfaceParams[] params = new SurfaceParams[2];
+ int boostedMode = MODE_CLOSING;
+
+ ValueAnimator remoteHomeAnim = ValueAnimator.ofFloat(0, 1);
+ remoteHomeAnim.setDuration(REMOTE_APP_TO_OVERVIEW_DURATION);
+
+ remoteHomeAnim.addUpdateListener(valueAnimator -> {
+ float val = (float) valueAnimator.getAnimatedValue();
+ float alpha;
+ RemoteAnimationTargetCompat visibleTarget;
+ RemoteAnimationTargetCompat invisibleTarget;
+ if (val < .5f) {
+ visibleTarget = homeTarget;
+ invisibleTarget = recentsTarget;
+ alpha = 1 - (val * 2);
+ } else {
+ visibleTarget = recentsTarget;
+ invisibleTarget = homeTarget;
+ alpha = (val - .5f) * 2;
+ }
+ params[0] = new SurfaceParams(visibleTarget.leash, alpha, null /* matrix */,
+ null /* windowCrop */, getLayer(visibleTarget, boostedMode),
+ 0 /* cornerRadius */);
+ params[1] = new SurfaceParams(invisibleTarget.leash, 0.0f, null /* matrix */,
+ null /* windowCrop */, getLayer(invisibleTarget, boostedMode),
+ 0 /* cornerRadius */);
+ surfaceApplier.scheduleApply(params);
+ });
+ anim.play(remoteHomeAnim);
+ animateFadeInLayoutAnimation();
+ }
+
+ /**
+ * Play remote animation from app to recents. This should scale the currently closing app down
+ * to the recents thumbnail.
+ *
+ * @param anim animator set
+ * @param appTarget the app surface thats closing
+ * @param recentsTarget the surface containing recents
+ */
+ public void playRemoteAppToRecentsAnimation(@NonNull AnimatorSet anim,
+ @NonNull RemoteAnimationTargetCompat appTarget,
+ @NonNull RemoteAnimationTargetCompat recentsTarget) {
+ TaskItemView bottomView = getBottomTaskView();
+ if (bottomView == null) {
+ // This can be null if there were previously 0 tasks and the recycler view has not had
+ // enough time to take in the data change, bind a new view, and lay out the new view.
+ // TODO: Have a fallback to animate to
+ anim.play(ValueAnimator.ofInt(0, 1).setDuration(REMOTE_APP_TO_OVERVIEW_DURATION));
+ return;
+ }
+ final Matrix appMatrix = new Matrix();
+ playRemoteTransYAnim(anim, appMatrix);
+ playRemoteAppScaleDownAnim(anim, appMatrix, appTarget, recentsTarget,
+ bottomView.getThumbnailView());
+ playRemoteTaskListFadeIn(anim, bottomView);
+ mStartedEnterAnimation = true;
+ }
+
+ /**
+ * Play translation Y animation for the remote app to recents animation. Animates over all task
+ * views as well as the closing app, easing them into their final vertical positions.
+ *
+ * @param anim animator set to play on
+ * @param appMatrix transformation matrix for the closing app surface
+ */
+ private void playRemoteTransYAnim(@NonNull AnimatorSet anim, @NonNull Matrix appMatrix) {
+ final ArrayList<TaskItemView> views = getTaskViews();
+
+ // Start Y translation from about halfway through the tasks list to the bottom thumbnail.
+ float taskHeight = getResources().getDimension(R.dimen.task_item_height);
+ float totalTransY = -(MAX_TASKS_TO_DISPLAY / 2.0f - 1) * taskHeight;
+ for (int i = 0, size = views.size(); i < size; i++) {
+ views.get(i).setTranslationY(totalTransY);
+ }
+
+ ValueAnimator transYAnim = ValueAnimator.ofFloat(totalTransY, 0);
+ transYAnim.setDuration(REMOTE_TO_RECENTS_VERTICAL_EASE_IN_DURATION);
+ transYAnim.setInterpolator(FAST_OUT_SLOW_IN_2);
+ transYAnim.addUpdateListener(valueAnimator -> {
+ float transY = (float) valueAnimator.getAnimatedValue();
+ for (int i = 0, size = views.size(); i < size; i++) {
+ views.get(i).setTranslationY(transY);
+ }
+ appMatrix.postTranslate(0, transY - totalTransY);
+ });
+ transYAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ for (int i = 0, size = views.size(); i < size; i++) {
+ views.get(i).setTranslationY(0);
+ }
+ }
+ });
+ anim.play(transYAnim);
+ }
+
+ /**
+ * Play the scale down animation for the remote app to recents animation where the app surface
+ * scales down to where the thumbnail is.
+ *
+ * @param anim animator set to play on
+ * @param appMatrix transformation matrix for the app surface
+ * @param appTarget closing app target
+ * @param recentsTarget opening recents target
+ * @param thumbnailView thumbnail view to animate to
+ */
+ private void playRemoteAppScaleDownAnim(@NonNull AnimatorSet anim, @NonNull Matrix appMatrix,
+ @NonNull RemoteAnimationTargetCompat appTarget,
+ @NonNull RemoteAnimationTargetCompat recentsTarget,
+ @NonNull View thumbnailView) {
+ // Identify where the entering remote app should animate to.
+ Rect endRect = new Rect();
+ thumbnailView.getGlobalVisibleRect(endRect);
+ Rect appBounds = appTarget.sourceContainerBounds;
+ RectF currentAppRect = new RectF();
+
+ SyncRtSurfaceTransactionApplierCompat surfaceApplier =
+ new SyncRtSurfaceTransactionApplierCompat(this);
+
+ // Keep recents visible throughout the animation.
+ SurfaceParams[] params = new SurfaceParams[2];
+ // Closing app should stay on top.
+ int boostedMode = MODE_CLOSING;
+ params[0] = new SurfaceParams(recentsTarget.leash, 1f, null /* matrix */,
+ null /* windowCrop */, getLayer(recentsTarget, boostedMode), 0 /* cornerRadius */);
+
+ ValueAnimator remoteAppAnim = ValueAnimator.ofInt(0, 1);
+ remoteAppAnim.setDuration(REMOTE_TO_RECENTS_VERTICAL_EASE_IN_DURATION);
+ remoteAppAnim.addUpdateListener(new MultiValueUpdateListener() {
+ private final FloatProp mScaleX;
+ private final FloatProp mScaleY;
+ private final FloatProp mTranslationX;
+ private final FloatProp mTranslationY;
+ private final FloatProp mAlpha;
+
+ {
+ // Scale down and move to view location.
+ float endScaleX = ((float) endRect.width()) / appBounds.width();
+ mScaleX = new FloatProp(1f, endScaleX, 0, REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION,
+ FAST_OUT_SLOW_IN_1);
+ float endScaleY = ((float) endRect.height()) / appBounds.height();
+ mScaleY = new FloatProp(1f, endScaleY, 0, REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION,
+ FAST_OUT_SLOW_IN_1);
+ float endTranslationX = endRect.left -
+ (appBounds.width() - thumbnailView.getWidth()) / 2.0f;
+ mTranslationX = new FloatProp(0, endTranslationX, 0,
+ REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION, FAST_OUT_SLOW_IN_1);
+ float endTranslationY = endRect.top -
+ (appBounds.height() - thumbnailView.getHeight()) / 2.0f;
+ mTranslationY = new FloatProp(0, endTranslationY, 0,
+ REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION, FAST_OUT_SLOW_IN_2);
+ mAlpha = new FloatProp(1.0f, 0, 0, REMOTE_TO_RECENTS_APP_SCALE_DOWN_DURATION,
+ ACCEL_2);
+ }
+
+ @Override
+ public void onUpdate(float percent) {
+ Matrix m = new Matrix();
+ m.preScale(mScaleX.value, mScaleY.value,
+ appBounds.width() / 2.0f, appBounds.height() / 2.0f);
+ m.postTranslate(mTranslationX.value, mTranslationY.value);
+ appMatrix.preConcat(m);
+ params[1] = new SurfaceParams(appTarget.leash, mAlpha.value, appMatrix,
+ null /* windowCrop */, getLayer(appTarget, boostedMode),
+ 0 /* cornerRadius */);
+ surfaceApplier.scheduleApply(params);
+
+ m.mapRect(currentAppRect, new RectF(appBounds));
+ setViewToRect(thumbnailView, new RectF(endRect), currentAppRect);
+ appMatrix.reset();
+ }
+ });
+ remoteAppAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ thumbnailView.setTranslationY(0);
+ thumbnailView.setTranslationX(0);
+ thumbnailView.setScaleX(1);
+ thumbnailView.setScaleY(1);
+ }
+ });
+ anim.play(remoteAppAnim);
+ }
+
+ /**
+ * Play task list fade in animation as part of remote app to recents animation. This animation
+ * ensures that the task views in the recents list fade in from bottom to top.
+ *
+ * @param anim animator set to play on
+ * @param appTaskView the task view associated with the remote app closing
+ */
+ private void playRemoteTaskListFadeIn(@NonNull AnimatorSet anim,
+ @NonNull TaskItemView appTaskView) {
+ long delay = REMOTE_TO_RECENTS_ITEM_FADE_START_DELAY;
+ int childCount = mTaskRecyclerView.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ ValueAnimator fadeAnim = ValueAnimator.ofFloat(0, 1.0f);
+ fadeAnim.setDuration(REMOTE_TO_RECENTS_ITEM_FADE_DURATION).setInterpolator(OUT_SLOW_IN);
+ fadeAnim.setStartDelay(delay);
+ View view = mTaskRecyclerView.getChildAt(i);
+ if (Objects.equals(view, appTaskView)) {
+ // Only animate icon and text for the view with snapshot animating in
+ final View icon = appTaskView.getIconView();
+ final View label = appTaskView.getLabelView();
+
+ icon.setAlpha(0.0f);
+ label.setAlpha(0.0f);
+
+ fadeAnim.addUpdateListener(alphaVal -> {
+ float val = alphaVal.getAnimatedFraction();
+
+ icon.setAlpha(val);
+ label.setAlpha(val);
+ });
+ fadeAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ icon.setAlpha(1.0f);
+ label.setAlpha(1.0f);
+ }
+ });
+ } else {
+ // Otherwise, fade in the entire view.
+ view.setAlpha(0.0f);
+ fadeAnim.addUpdateListener(alphaVal -> {
+ float val = alphaVal.getAnimatedFraction();
+ view.setAlpha(val);
+ });
+ fadeAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ view.setAlpha(1.0f);
+ }
+ });
+ }
+ anim.play(fadeAnim);
+
+ int itemType = mTaskRecyclerView.getChildViewHolder(view).getItemViewType();
+ if (itemType == ITEM_TYPE_CLEAR_ALL) {
+ // Don't add delay. Clear all should animate at same time as next view.
+ continue;
+ }
+ delay += REMOTE_TO_RECENTS_ITEM_FADE_BETWEEN_DELAY;
+ }
+ }
+
+ /**
+ * Set view properties so that the view fits to the target rect.
+ *
+ * @param view view to set
+ * @param origRect original rect that view was located
+ * @param targetRect rect to set to
+ */
+ private void setViewToRect(View view, RectF origRect, RectF targetRect) {
+ float dX = targetRect.left - origRect.left;
+ float dY = targetRect.top - origRect.top;
+ view.setTranslationX(dX);
+ view.setTranslationY(dY);
+
+ float scaleX = targetRect.width() / origRect.width();
+ float scaleY = targetRect.height() / origRect.height();
+ view.setPivotX(0);
+ view.setPivotY(0);
+ view.setScaleX(scaleX);
+ view.setScaleY(scaleY);
}
@Override
@@ -556,5 +927,16 @@
mInsets = insets;
mTaskRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
mTaskRecyclerView.invalidateItemDecorations();
+ if (mInsets.top != 0) {
+ updateStatusBarScrim();
+ }
+ }
+
+ /**
+ * Callback for when this view is ready for a remote animation from app to overview.
+ */
+ public interface onReadyForRemoteAnimCallback {
+
+ void onReadyForRemoteAnim();
}
}
diff --git a/go/quickstep/src/com/android/quickstep/views/TaskItemView.java b/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
index 6db8013..f184ad0 100644
--- a/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
+++ b/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
@@ -137,6 +137,14 @@
return mThumbnailView;
}
+ public View getIconView() {
+ return mIconView;
+ }
+
+ public View getLabelView() {
+ return mLabelView;
+ }
+
/**
* Start a new animation from the current task content to the specified new content. The caller
* is responsible for the actual animation control via the property
diff --git a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
index 6bc859a..af07aa3 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
@@ -23,8 +23,10 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.graphics.Point;
+import android.graphics.Path;
+import android.graphics.PathMeasure;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.util.Log;
import android.view.ViewDebug;
@@ -36,33 +38,51 @@
private static final String TAG = "DotRenderer";
// The dot size is defined as a percentage of the app icon size.
- private static final float SIZE_PERCENTAGE = 0.38f;
+ private static final float SIZE_PERCENTAGE = 0.228f;
- // Extra scale down of the dot
- private static final float DOT_SCALE = 0.6f;
-
- // Offset the dot slightly away from the icon if there's space.
- private static final float OFFSET_PERCENTAGE = 0.02f;
-
- private final float mDotCenterOffset;
- private final int mOffset;
private final float mCircleRadius;
private final Paint mCirclePaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG);
private final Bitmap mBackgroundWithShadow;
private final float mBitmapOffset;
- public DotRenderer(int iconSizePx) {
- mDotCenterOffset = SIZE_PERCENTAGE * iconSizePx;
- mOffset = (int) (OFFSET_PERCENTAGE * iconSizePx);
+ // Stores the center x and y position as a percentage (0 to 1) of the icon size
+ private final float[] mRightDotPosition;
+ private final float[] mLeftDotPosition;
- int size = (int) (DOT_SCALE * mDotCenterOffset);
+ public DotRenderer(int iconSizePx, Path iconShapePath, int pathSize) {
+ int size = Math.round(SIZE_PERCENTAGE * iconSizePx);
ShadowGenerator.Builder builder = new ShadowGenerator.Builder(Color.TRANSPARENT);
builder.ambientShadowAlpha = 88;
mBackgroundWithShadow = builder.setupBlurForSize(size).createPill(size, size);
mCircleRadius = builder.radius;
mBitmapOffset = -mBackgroundWithShadow.getHeight() * 0.5f; // Same as width.
+
+ // Find the points on the path that are closest to the top left and right corners.
+ mLeftDotPosition = getPathPoint(iconShapePath, pathSize, -1);
+ mRightDotPosition = getPathPoint(iconShapePath, pathSize, 1);
+ }
+
+ private static float[] getPathPoint(Path path, float size, float direction) {
+ float halfSize = size / 2;
+ // Small delta so that we don't get a zero size triangle
+ float delta = 1;
+
+ float x = halfSize + direction * halfSize;
+ Path trianglePath = new Path();
+ trianglePath.moveTo(halfSize, halfSize);
+ trianglePath.lineTo(x + delta * direction, 0);
+ trianglePath.lineTo(x, -delta);
+ trianglePath.close();
+
+ trianglePath.op(path, Path.Op.INTERSECT);
+ float[] pos = new float[2];
+ new PathMeasure(trianglePath, false).getPosTan(0, pos, null);
+
+ pos[0] = pos[0] / size;
+ pos[1] = pos[1] / size;
+ return pos;
}
/**
@@ -74,15 +94,21 @@
return;
}
canvas.save();
- // We draw the dot relative to its center.
- float dotCenterX = params.leftAlign
- ? params.iconBounds.left + mDotCenterOffset / 2
- : params.iconBounds.right - mDotCenterOffset / 2;
- float dotCenterY = params.iconBounds.top + mDotCenterOffset / 2;
- int offsetX = Math.min(mOffset, params.spaceForOffset.x);
- int offsetY = Math.min(mOffset, params.spaceForOffset.y);
- canvas.translate(dotCenterX + offsetX, dotCenterY - offsetY);
+ Rect iconBounds = params.iconBounds;
+ float[] dotPosition = params.leftAlign ? mLeftDotPosition : mRightDotPosition;
+ float dotCenterX = iconBounds.left + iconBounds.width() * dotPosition[0];
+ float dotCenterY = iconBounds.top + iconBounds.height() * dotPosition[1];
+
+ // Ensure dot fits entirely in canvas clip bounds.
+ Rect canvasBounds = canvas.getClipBounds();
+ float offsetX = params.leftAlign
+ ? Math.max(0, canvasBounds.left - (dotCenterX + mBitmapOffset))
+ : Math.min(0, canvasBounds.right - (dotCenterX - mBitmapOffset));
+ float offsetY = Math.max(0, canvasBounds.top - (dotCenterY + mBitmapOffset));
+
+ // We draw the dot relative to its center.
+ canvas.translate(dotCenterX + offsetX, dotCenterY + offsetY);
canvas.scale(params.scale, params.scale);
mCirclePaint.setColor(Color.BLACK);
@@ -102,9 +128,6 @@
/** The progress of the animation, from 0 to 1. */
@ViewDebug.ExportedProperty(category = "notification dot")
public float scale;
- /** Overrides internally calculated offset if specified value is smaller. */
- @ViewDebug.ExportedProperty(category = "notification dot")
- public Point spaceForOffset = new Point();
/** Whether the dot should align to the top left of the icon rather than the top right. */
@ViewDebug.ExportedProperty(category = "notification dot")
public boolean leftAlign;
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index 02c6b0f..49fd436 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -56,6 +56,7 @@
optional int32 predictedRank = 15;
optional TargetExtension extension = 16;
optional TipType tip_type = 17;
+ optional int32 search_query_length = 18;
}
// Used to define what type of item a Target would represent.
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index 97fc284..be275e0 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -85,6 +85,13 @@
android:name="com.android.launcher3.uioverrides.dynamicui.WallpaperManagerCompatVL$ColorExtractionService"
tools:node="remove" />
+ <activity
+ android:name="com.android.launcher3.proxy.ProxyActivityStarter"
+ android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
+ android:launchMode="singleTask"
+ android:clearTaskOnLaunch="true"
+ android:exported="false" />
+
</application>
</manifest>
diff --git a/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml b/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
new file mode 100644
index 0000000..be3f17a
--- /dev/null
+++ b/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
@@ -0,0 +1,7 @@
+<com.android.quickstep.hints.ProactiveHintsContainer
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|bottom"
+ android:gravity="center_horizontal">
+</com.android.quickstep.hints.ProactiveHintsContainer>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml
index 61c576e..b316edd 100644
--- a/quickstep/recents_ui_overrides/res/values/dimens.xml
+++ b/quickstep/recents_ui_overrides/res/values/dimens.xml
@@ -23,4 +23,8 @@
<!-- Minimum distance to swipe to trigger accessibility gesture -->
<dimen name="accessibility_gesture_min_swipe_distance">80dp</dimen>
+
+ <!-- Swipe up to home related -->
+ <dimen name="swipe_up_fling_min_visible_change">18dp</dimen>
+ <dimen name="swipe_up_y_overshoot">10dp</dimen>
</resources>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
index 948f39e..d3042cf 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
@@ -19,7 +19,6 @@
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.quickstep.logging.UserEventDispatcherExtension.ALL_APPS_PREDICTION_TIPS;
-import android.app.ActivityManager;
import android.content.Context;
import android.graphics.CornerPathEffect;
import android.graphics.Paint;
@@ -39,6 +38,7 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.compat.UserManagerCompat;
@@ -152,7 +152,7 @@
|| !launcher.isInState(ALL_APPS)
|| hasSeenAllAppsTip(launcher)
|| UserManagerCompat.getInstance(launcher).isDemoUser()
- || ActivityManager.isRunningInTestHarness()) {
+ || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
return false;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java
index 0b8c1c5..af67e1b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java
@@ -27,11 +27,13 @@
import android.content.ComponentName;
import android.content.Context;
import android.os.Build;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
import android.util.Log;
+import androidx.annotation.Nullable;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.model.AppLaunchTracker;
@@ -97,6 +99,7 @@
new AppPredictionContext.Builder(mContext)
.setUiSurface(client.id)
.setPredictedTargetCount(count)
+ .setExtras(getAppPredictionContextExtras(client))
.build());
predictor.registerPredictionUpdates(mContext.getMainExecutor(),
PredictionUiStateManager.INSTANCE.get(mContext).appPredictorCallback(client));
@@ -104,6 +107,15 @@
return predictor;
}
+ /**
+ * Override to add custom extras.
+ */
+ @WorkerThread
+ @Nullable
+ public Bundle getAppPredictionContextExtras(Client client){
+ return null;
+ }
+
@WorkerThread
private boolean handleMessage(Message msg) {
switch (msg.what) {
@@ -158,10 +170,10 @@
public void onStartShortcut(String packageName, String shortcutId, UserHandle user,
String container) {
// TODO: Use the full shortcut info
- AppTarget target = new AppTarget.Builder(new AppTargetId("shortcut:" + shortcutId))
- .setTarget(packageName, user)
- .setClassName(shortcutId)
- .build();
+ AppTarget target = new AppTarget
+ .Builder(new AppTargetId("shortcut:" + shortcutId), packageName, user)
+ .setClassName(shortcutId)
+ .build();
sendLaunch(target, container);
}
@@ -169,10 +181,10 @@
@UiThread
public void onStartApp(ComponentName cn, UserHandle user, String container) {
if (cn != null) {
- AppTarget target = new AppTarget.Builder(new AppTargetId("app:" + cn))
- .setTarget(cn.getPackageName(), user)
- .setClassName(cn.getClassName())
- .build();
+ AppTarget target = new AppTarget
+ .Builder(new AppTargetId("app:" + cn), cn.getPackageName(), user)
+ .setClassName(cn.getClassName())
+ .build();
sendLaunch(target, container);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
index 48a163d..6dad9af 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
@@ -67,8 +67,8 @@
// TODO (b/129421797): Update the client constants
public enum Client {
- HOME("GEL"),
- OVERVIEW("OVERVIEW_GEL");
+ HOME("home"),
+ OVERVIEW("overview");
public final String id;
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index 518a2a6..ebae1cd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -20,6 +20,11 @@
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.view.Gravity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
@@ -28,6 +33,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController;
@@ -36,6 +42,7 @@
import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.QuickSwitchTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController;
+import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.UiThreadHelper;
import com.android.launcher3.util.UiThreadHelper.AsyncCommand;
@@ -58,12 +65,83 @@
// Scale recents takes before animating in
private static final float RECENTS_PREPARE_SCALE = 1.33f;
+ public static RotationMode ROTATION_LANDSCAPE = new RotationMode(-90) {
+ @Override
+ public void mapRect(int left, int top, int right, int bottom, Rect out) {
+ out.left = top;
+ out.top = right;
+ out.right = bottom;
+ out.bottom = left;
+ }
+
+ @Override
+ public void mapInsets(Context context, Rect insets, Rect out) {
+ if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
+ out.set(insets);
+ } else {
+ out.top = Math.max(insets.top, insets.left);
+ out.bottom = insets.right;
+ out.left = insets.bottom;
+ out.right = 0;
+ }
+ }
+ };
+
+ public static RotationMode ROTATION_SEASCAPE = new RotationMode(90) {
+ @Override
+ public void mapRect(int left, int top, int right, int bottom, Rect out) {
+ out.left = bottom;
+ out.top = left;
+ out.right = top;
+ out.bottom = right;
+ }
+
+ @Override
+ public void mapInsets(Context context, Rect insets, Rect out) {
+ if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
+ out.set(insets);
+ } else {
+ out.top = Math.max(insets.top, insets.right);
+ out.bottom = insets.left;
+ out.right = insets.bottom;
+ out.left = 0;
+ }
+ }
+
+ @Override
+ public int toNaturalGravity(int absoluteGravity) {
+ int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
+ int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK;
+
+ if (horizontalGravity == Gravity.RIGHT) {
+ horizontalGravity = Gravity.LEFT;
+ } else if (horizontalGravity == Gravity.LEFT) {
+ horizontalGravity = Gravity.RIGHT;
+ }
+
+ if (verticalGravity == Gravity.TOP) {
+ verticalGravity = Gravity.BOTTOM;
+ } else if (verticalGravity == Gravity.BOTTOM) {
+ verticalGravity = Gravity.TOP;
+ }
+
+ return ((absoluteGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK)
+ & ~Gravity.VERTICAL_GRAVITY_MASK)
+ | horizontalGravity | verticalGravity;
+ }
+ };
+
+ public static RotationMode getRotationMode(DeviceProfile dp) {
+ return !dp.isVerticalBarLayout() ? RotationMode.NORMAL
+ : (dp.isSeascape() ? ROTATION_SEASCAPE : ROTATION_LANDSCAPE);
+ }
+
public static TouchController[] createTouchControllers(Launcher launcher) {
Mode mode = SysUINavigationMode.getMode(launcher);
ArrayList<TouchController> list = new ArrayList<>();
list.add(launcher.getDragController());
- if (mode == Mode.NO_BUTTON) {
+ if (mode == NO_BUTTON) {
list.add(new QuickSwitchTouchController(launcher));
list.add(new NavBarToHomeTouchController(launcher));
list.add(new FlingAndHoldTouchController(launcher));
@@ -71,6 +149,9 @@
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
list.add(new OverviewToAllAppsTouchController(launcher));
list.add(new LandscapeEdgeSwipeController(launcher));
+ if (mode.hasGestures) {
+ list.add(new TransposedQuickSwitchTouchController(launcher));
+ }
} else {
list.add(new PortraitStatesTouchController(launcher,
mode.hasGestures /* allowDragToOverview */));
@@ -106,7 +187,7 @@
* @param launcher the launcher activity
*/
public static void prepareToShowOverview(Launcher launcher) {
- if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) {
+ if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) {
// Overview lives on the side, so doesn't scale in from above.
return;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 11a1885..1d36d1a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.LauncherState.RECENTS_CLEAR_ALL_BUTTON;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
+import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
@@ -31,6 +32,7 @@
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.PropertySetter;
+import com.android.quickstep.hints.ProactiveHintsContainer;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.RecentsView;
@@ -53,8 +55,17 @@
if (state.overviewUi) {
mRecentsView.updateEmptyMessage();
mRecentsView.resetTaskVisuals();
+ mRecentsView.setHintVisibility(1f);
+ } else {
+ mRecentsView.setHintVisibility(0f);
+ ProactiveHintsContainer
+ proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
+ if (proactiveHintsContainer != null) {
+ proactiveHintsContainer.removeAllViews();
+ }
}
setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state.getVisibleElements(mLauncher));
+ mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress());
}
@Override
@@ -64,6 +75,14 @@
if (!toState.overviewUi) {
builder.addOnFinishRunnable(mRecentsView::resetTaskVisuals);
+ mRecentsView.setHintVisibility(0f);
+ builder.addOnFinishRunnable(() -> {
+ ProactiveHintsContainer
+ proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
+ if (proactiveHintsContainer != null) {
+ proactiveHintsContainer.removeAllViews();
+ }
+ });
}
if (toState.overviewUi) {
@@ -75,9 +94,13 @@
updateAnim.setDuration(config.duration);
builder.play(updateAnim);
mRecentsView.updateEmptyMessage();
+ builder.addOnFinishRunnable(() -> mRecentsView.setHintVisibility(1f));
}
- setAlphas(config.getPropertySetter(builder), toState.getVisibleElements(mLauncher));
+ PropertySetter propertySetter = config.getPropertySetter(builder);
+ setAlphas(propertySetter, toState.getVisibleElements(mLauncher));
+ float fullscreenProgress = toState.getOverviewFullscreenProgress();
+ propertySetter.setFloat(mRecentsView, FULLSCREEN_PROGRESS, fullscreenProgress, LINEAR);
}
private void setAlphas(PropertySetter propertySetter, int visibleElements) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 140e45c..f429ce5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -17,14 +17,13 @@
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-import android.os.RemoteException;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
-import com.android.quickstep.RecentsModel;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
+import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
-import com.android.systemui.shared.recents.ISystemUiProxy;
+import com.android.quickstep.views.TaskView;
/**
* State indicating that the Launcher is behind an app
@@ -35,7 +34,11 @@
FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
public BackgroundAppState(int id) {
- super(id, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
+ this(id, LauncherLogProto.ContainerType.TASKSWITCHER);
+ }
+
+ protected BackgroundAppState(int id, int logContainer) {
+ super(id, logContainer, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
}
@Override
@@ -55,23 +58,17 @@
public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
// Initialize the recents view scale to what it would be when starting swipe up
RecentsView recentsView = launcher.getOverviewPanel();
- recentsView.getTaskSize(sTempRect);
- int appWidth = launcher.getDragLayer().getWidth();
- if (recentsView.shouldUseMultiWindowTaskSizeStrategy()) {
- ISystemUiProxy sysUiProxy = RecentsModel.INSTANCE.get(launcher).getSystemUiProxy();
- if (sysUiProxy != null) {
- try {
- // Try to use the actual non-minimized app width (launcher will be resized to
- // the non-minimized bounds, which differs from the app width in landscape
- // multi-window mode
- appWidth = sysUiProxy.getNonMinimizedSplitScreenSecondaryBounds().width();
- } catch (RemoteException e) {
- // Ignore, fall back to just using the drag layer width
- }
- }
+ if (recentsView.getTaskViewCount() == 0) {
+ return super.getOverviewScaleAndTranslation(launcher);
}
- float scale = (float) appWidth / sTempRect.width();
- return new ScaleAndTranslation(scale, 0f, 0f);
+ TaskView dummyTask = recentsView.getTaskViewAt(recentsView.getCurrentPage());
+ return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask)
+ .getScaleAndTranslation();
+ }
+
+ @Override
+ public float getOverviewFullscreenProgress() {
+ return 1;
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
index fa07e27..ed511f5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
@@ -15,15 +15,9 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-
-import android.graphics.Rect;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
-import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.TaskThumbnailView;
import com.android.quickstep.views.TaskView;
/**
@@ -31,32 +25,10 @@
* quick switching from launcher; quick switching from an app uses WindowTransformSwipeHelper.
* @see com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget#NEW_TASK
*/
-public class QuickSwitchState extends OverviewState {
- private static final int STATE_FLAGS =
- FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
+public class QuickSwitchState extends BackgroundAppState {
public QuickSwitchState(int id) {
- super(id, LauncherLogProto.ContainerType.APP, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
- }
-
- @Override
- public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
- RecentsView recentsView = launcher.getOverviewPanel();
- if (recentsView.getTaskViewCount() == 0) {
- return super.getOverviewScaleAndTranslation(launcher);
- }
- // Compute scale and translation y such that the most recent task view fills the screen.
- TaskThumbnailView dummyThumbnail = recentsView.getTaskViewAt(0).getThumbnail();
- ClipAnimationHelper clipAnimationHelper = new ClipAnimationHelper(launcher);
- clipAnimationHelper.fromTaskThumbnailView(dummyThumbnail, recentsView);
- Rect targetRect = new Rect();
- recentsView.getTaskSize(targetRect);
- clipAnimationHelper.updateTargetRect(targetRect);
- float toScale = clipAnimationHelper.getSourceRect().width()
- / clipAnimationHelper.getTargetRect().width();
- float toTranslationY = clipAnimationHelper.getSourceRect().centerY()
- - clipAnimationHelper.getTargetRect().centerY();
- return new ScaleAndTranslation(toScale, 0, toTranslationY);
+ super(id, LauncherLogProto.ContainerType.APP);
}
@Override
@@ -68,11 +40,6 @@
}
@Override
- public float getVerticalProgress(Launcher launcher) {
- return BACKGROUND_APP.getVerticalProgress(launcher);
- }
-
- @Override
public int getVisibleElements(Launcher launcher) {
return NONE;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
index 6358109..7a6cd2d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
@@ -43,9 +43,11 @@
public class FlingAndHoldTouchController extends PortraitStatesTouchController {
private static final long PEEK_ANIM_DURATION = 100;
+ private static final float MAX_DISPLACEMENT_PERCENT = 0.75f;
private final MotionPauseDetector mMotionPauseDetector;
private final float mMotionPauseMinDisplacement;
+ private final float mMotionPauseMaxDisplacement;
private AnimatorSet mPeekAnim;
@@ -53,6 +55,7 @@
super(l, false /* allowDragToOverview */);
mMotionPauseDetector = new MotionPauseDetector(l);
mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop();
+ mMotionPauseMaxDisplacement = getShiftRange() * MAX_DISPLACEMENT_PERCENT;
}
@Override
@@ -101,7 +104,9 @@
@Override
public boolean onDrag(float displacement, MotionEvent event) {
- mMotionPauseDetector.setDisallowPause(-displacement < mMotionPauseMinDisplacement);
+ float upDisplacement = -displacement;
+ mMotionPauseDetector.setDisallowPause(upDisplacement < mMotionPauseMinDisplacement
+ || upDisplacement > mMotionPauseMaxDisplacement);
mMotionPauseDetector.addPosition(displacement, event.getEventTime());
return super.onDrag(displacement, event);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
index 82ab34b..73f328b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java
@@ -24,6 +24,7 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.Utilities;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.views.RecentsView;
@@ -52,7 +53,7 @@
// In all-apps only listen if the container cannot scroll itself
return mLauncher.getAppsView().shouldContainerScroll(ev);
} else if (mLauncher.isInState(NORMAL)) {
- return true;
+ return (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0;
} else if (mLauncher.isInState(OVERVIEW)) {
RecentsView rv = mLauncher.getOverviewPanel();
return ev.getY() > (rv.getBottom() - rv.getPaddingBottom());
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
index 81090c1..e1dd124 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
@@ -28,9 +28,13 @@
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
+import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import android.view.MotionEvent;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
@@ -45,8 +49,6 @@
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
-import androidx.annotation.Nullable;
-
/**
* Handles quick switching to a recent task from the home screen.
*/
@@ -55,7 +57,11 @@
private @Nullable TaskView mTaskToLaunch;
public QuickSwitchTouchController(Launcher launcher) {
- super(launcher, SwipeDetector.HORIZONTAL);
+ this(launcher, SwipeDetector.HORIZONTAL);
+ }
+
+ protected QuickSwitchTouchController(Launcher l, SwipeDetector.Direction dir) {
+ super(l, dir);
}
@Override
@@ -122,12 +128,16 @@
@Override
protected void updateProgress(float progress) {
super.updateProgress(progress);
- updateFullscreenProgress(progress);
+ updateFullscreenProgress(Utilities.boundToRange(progress, 0, 1));
}
private void updateFullscreenProgress(float progress) {
if (mTaskToLaunch != null) {
mTaskToLaunch.setFullscreenProgress(progress);
+ int sysuiFlags = progress > UPDATE_SYSUI_FLAGS_THRESHOLD
+ ? mTaskToLaunch.getThumbnail().getSysUiStatusNavFlags()
+ : 0;
+ mLauncher.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 8b4aa07..8e32bb3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -18,8 +18,8 @@
import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
-import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
+import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -231,7 +231,8 @@
} else {
mFlingBlockCheck.onEvent();
}
- mCurrentAnimation.setPlayFraction(totalDisplacement * mProgressMultiplier);
+ mCurrentAnimation.setPlayFraction(Utilities.boundToRange(
+ totalDisplacement * mProgressMultiplier, 0, 1));
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (mRecentsView.getCurrentPage() != 0 || isGoingUp) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java
new file mode 100644
index 0000000..f1e4041
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.uioverrides.touchcontrollers;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.touch.SwipeDetector;
+
+public class TransposedQuickSwitchTouchController extends QuickSwitchTouchController {
+
+ public TransposedQuickSwitchTouchController(Launcher launcher) {
+ super(launcher, SwipeDetector.VERTICAL);
+ }
+
+ @Override
+ protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
+ return super.getTargetState(fromState,
+ isDragTowardPositive ^ mLauncher.getDeviceProfile().isSeascape());
+ }
+
+ @Override
+ protected float initCurrentAnimation(int animComponents) {
+ float multiplier = super.initCurrentAnimation(animComponents);
+ return mLauncher.getDeviceProfile().isSeascape() ? multiplier : -multiplier;
+ }
+
+ @Override
+ protected float getShiftRange() {
+ return mLauncher.getDeviceProfile().heightPx / 2f;
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 6177493..90b5536 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -55,7 +55,6 @@
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.SysUINavigationMode.Mode;
-import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
@@ -118,16 +117,15 @@
}
final RectF iconLocation = new RectF();
boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow();
- final FloatingIconView floatingView = canUseWorkspaceView
- ? FloatingIconView.getFloatingIconView(activity, workspaceView,
- true /* hideOriginal */, iconLocation, false /* isOpening */, null /* recycle */)
+ FloatingIconView floatingIconView = canUseWorkspaceView
+ ? recentsView.getFloatingIconView(activity, workspaceView, iconLocation)
: null;
return new HomeAnimationFactory() {
@Nullable
@Override
public View getFloatingView() {
- return floatingView;
+ return floatingIconView;
}
@NonNull
@@ -273,12 +271,12 @@
endState.getVerticalProgress(activity));
anim.play(shiftAnim);
}
- playScaleDownAnim(anim, activity, endState);
+ playScaleDownAnim(anim, activity, fromState, endState);
anim.setDuration(transitionLength * 2);
- activity.getStateManager().setCurrentAnimation(anim);
AnimatorPlaybackController controller =
AnimatorPlaybackController.wrap(anim, transitionLength * 2);
+ activity.getStateManager().setCurrentUserControlledAnimation(controller);
// Since we are changing the start position of the UI, reapply the state, at the end
controller.setEndAction(() -> {
@@ -299,7 +297,7 @@
/**
* Scale down recents from the center task being full screen to being in overview.
*/
- private void playScaleDownAnim(AnimatorSet anim, Launcher launcher,
+ private void playScaleDownAnim(AnimatorSet anim, Launcher launcher, LauncherState fromState,
LauncherState endState) {
RecentsView recentsView = launcher.getOverviewPanel();
TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
@@ -307,34 +305,23 @@
return;
}
- // Setup the clip animation helper source/target rects in the final transformed state
- // of the recents view (a scale/translationY may be applied prior to this animation
- // starting to line up the side pages during swipe up)
- float prevRvScale = recentsView.getScaleX();
- float prevRvTransY = recentsView.getTranslationY();
- float targetRvScale = endState.getOverviewScaleAndTranslation(launcher).scale;
- SCALE_PROPERTY.set(recentsView, targetRvScale);
- recentsView.setTranslationY(0);
- ClipAnimationHelper clipHelper = new ClipAnimationHelper(launcher);
- float tmpCurveScale = v.getCurveScale();
- v.setCurveScale(1f);
- clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
- v.setCurveScale(tmpCurveScale);
- SCALE_PROPERTY.set(recentsView, prevRvScale);
- recentsView.setTranslationY(prevRvTransY);
+ LauncherState.ScaleAndTranslation fromScaleAndTranslation
+ = fromState.getOverviewScaleAndTranslation(launcher);
+ LauncherState.ScaleAndTranslation endScaleAndTranslation
+ = endState.getOverviewScaleAndTranslation(launcher);
+ float fromFullscreenProgress = fromState.getOverviewFullscreenProgress();
+ float endFullscreenProgress = endState.getOverviewFullscreenProgress();
- if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
- float fromScale = clipHelper.getSourceRect().width()
- / clipHelper.getTargetRect().width();
- float fromTranslationY = clipHelper.getSourceRect().centerY()
- - clipHelper.getTargetRect().centerY();
- Animator scale = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, fromScale, 1);
- Animator translateY = ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y,
- fromTranslationY, 0);
- scale.setInterpolator(LINEAR);
- translateY.setInterpolator(LINEAR);
- anim.playTogether(scale, translateY);
- }
+ Animator scale = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY,
+ fromScaleAndTranslation.scale, endScaleAndTranslation.scale);
+ Animator translateY = ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y,
+ fromScaleAndTranslation.translationY, endScaleAndTranslation.translationY);
+ Animator applyFullscreenProgress = ObjectAnimator.ofFloat(recentsView,
+ RecentsView.FULLSCREEN_PROGRESS, fromFullscreenProgress, endFullscreenProgress);
+ scale.setInterpolator(LINEAR);
+ translateY.setInterpolator(LINEAR);
+ applyFullscreenProgress.setInterpolator(LINEAR);
+ anim.playTogether(scale, translateY, applyFullscreenProgress);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
index 96d2dca..5eecf17 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
@@ -24,6 +24,7 @@
import android.view.MotionEvent;
import com.android.launcher3.util.Preconditions;
+import com.android.quickstep.inputconsumers.InputConsumer;
import com.android.quickstep.util.SwipeAnimationTargetSet;
import com.android.systemui.shared.system.InputConsumerController;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
index 194d073..5a039cd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/SwipeSharedState.java
@@ -22,6 +22,7 @@
import com.android.quickstep.util.RecentsAnimationListenerSet;
import com.android.quickstep.util.SwipeAnimationTargetSet;
import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener;
+import java.io.PrintWriter;
/**
* Utility class used to store state information shared across multiple transitions.
@@ -134,4 +135,13 @@
nextRunningTaskId = -1;
goingToLauncher = false;
}
+
+ public void dump(String prefix, PrintWriter pw) {
+ pw.println(prefix + "goingToLauncher=" + goingToLauncher);
+ pw.println(prefix + "canGestureBeContinued=" + canGestureBeContinued);
+ pw.println(prefix + "recentsAnimationFinishInterrupted=" + recentsAnimationFinishInterrupted);
+ pw.println(prefix + "nextRunningTaskId=" + nextRunningTaskId);
+ pw.println(prefix + "lastAnimationCancelled=" + mLastAnimationCancelled);
+ pw.println(prefix + "lastAnimationRunning=" + mLastAnimationRunning);
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
index e3dcadc..213c5d3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
@@ -16,6 +16,7 @@
package com.android.quickstep;
+import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;
import android.app.Activity;
@@ -116,21 +117,22 @@
mHandler = new Handler(Looper.getMainLooper());
}
- protected abstract boolean isAvailable(BaseDraggingActivity activity);
+ protected abstract boolean isAvailable(BaseDraggingActivity activity, int displayId);
protected abstract ActivityOptions makeLaunchOptions(Activity activity);
protected abstract boolean onActivityStarted(BaseDraggingActivity activity);
@Override
public View.OnClickListener getOnClickListener(
BaseDraggingActivity activity, TaskView taskView) {
- if (!isAvailable(activity)) {
- return null;
- }
final Task task = taskView.getTask();
final int taskId = task.key.id;
+ final int displayId = task.key.displayId;
if (!task.isDockable) {
return null;
}
+ if (!isAvailable(activity, displayId)) {
+ return null;
+ }
final RecentsView recentsView = activity.getOverviewPanel();
final TaskThumbnailView thumbnailView = taskView.getThumbnail();
@@ -218,9 +220,13 @@
}
@Override
- protected boolean isAvailable(BaseDraggingActivity activity) {
- // Don't show menu-item if already in multi-window
- return !activity.getDeviceProfile().isMultiWindowMode;
+ protected boolean isAvailable(BaseDraggingActivity activity, int displayId) {
+ // Don't show menu-item if already in multi-window and the task is from
+ // the secondary display.
+ // TODO(b/118266305): Temporarily disable splitscreen for secondary display while new
+ // implementation is enabled
+ return !activity.getDeviceProfile().isMultiWindowMode
+ && (displayId == -1 || displayId == DEFAULT_DISPLAY);
}
@Override
@@ -256,7 +262,7 @@
}
@Override
- protected boolean isAvailable(BaseDraggingActivity activity) {
+ protected boolean isAvailable(BaseDraggingActivity activity, int displayId) {
return ActivityManagerWrapper.getInstance().supportsFreeformMultiWindow(activity);
}
@@ -290,10 +296,6 @@
if (sysUiProxy == null) {
return null;
}
- if (SysUINavigationMode.getMode(activity) == SysUINavigationMode.Mode.NO_BUTTON) {
- // TODO(b/130225926): Temporarily disable pinning while gesture nav is enabled
- return null;
- }
if (!ActivityManagerWrapper.getInstance().isScreenPinningEnabled()) {
return null;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 61ae880..0fd74bb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -35,7 +35,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.Region;
@@ -58,6 +57,7 @@
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.logging.EventLogArray;
@@ -66,6 +66,13 @@
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
+import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
+import com.android.quickstep.inputconsumers.AssistantTouchConsumer;
+import com.android.quickstep.inputconsumers.DeviceLockedInputConsumer;
+import com.android.quickstep.inputconsumers.InputConsumer;
+import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;
+import com.android.quickstep.inputconsumers.OverviewInputConsumer;
+import com.android.quickstep.inputconsumers.ScreenPinnedInputConsumer;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -77,9 +84,32 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
/**
+ * Wrapper around a list for processing arguments.
+ */
+class ArgList extends LinkedList<String> {
+ public ArgList(List<String> l) {
+ super(l);
+ }
+
+ public String peekArg() {
+ return peekFirst();
+ }
+
+ public String nextArg() {
+ return pollFirst().toLowerCase();
+ }
+
+ public String nextArgExact() {
+ return pollFirst();
+ }
+}
+
+/**
* Service connected by system-UI for handling touch interaction.
*/
@TargetApi(Build.VERSION_CODES.Q)
@@ -90,9 +120,6 @@
public static final LooperExecutor BACKGROUND_EXECUTOR =
new LooperExecutor(UiThreadHelper.getBackgroundLooper());
- private static final String NAVBAR_VERTICAL_SIZE = "navigation_bar_frame_height";
- private static final String NAVBAR_HORIZONTAL_SIZE = "navigation_bar_width";
-
public static final EventLogArray TOUCH_INTERACTION_LOG =
new EventLogArray("touch_interaction_log", 40);
@@ -291,15 +318,7 @@
}
private int getNavbarSize(String resName) {
- int frameSize;
- Resources res = getResources();
- int frameSizeResID = res.getIdentifier(resName, "dimen", "android");
- if (frameSizeResID != 0) {
- frameSize = res.getDimensionPixelSize(frameSizeResID);
- } else {
- frameSize = Utilities.pxFromDp(48, res.getDisplayMetrics());
- }
- return frameSize;
+ return ResourceUtils.getNavbarSize(resName, getResources());
}
private void initTouchBounds() {
@@ -312,20 +331,21 @@
defaultDisplay.getRealSize(realSize);
mSwipeTouchRegion.set(0, 0, realSize.x, realSize.y);
if (mMode == Mode.NO_BUTTON) {
- mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - getNavbarSize(NAVBAR_VERTICAL_SIZE);
+ mSwipeTouchRegion.top = mSwipeTouchRegion.bottom - getNavbarSize(
+ ResourceUtils.NAVBAR_VERTICAL_SIZE);
} else {
switch (defaultDisplay.getRotation()) {
case Surface.ROTATION_90:
mSwipeTouchRegion.left = mSwipeTouchRegion.right
- - getNavbarSize(NAVBAR_HORIZONTAL_SIZE);
+ - getNavbarSize(ResourceUtils.NAVBAR_HORIZONTAL_SIZE);
break;
case Surface.ROTATION_270:
mSwipeTouchRegion.right = mSwipeTouchRegion.left
- + getNavbarSize(NAVBAR_HORIZONTAL_SIZE);
+ + getNavbarSize(ResourceUtils.NAVBAR_HORIZONTAL_SIZE);
break;
default:
mSwipeTouchRegion.top = mSwipeTouchRegion.bottom
- - getNavbarSize(NAVBAR_VERTICAL_SIZE);
+ - getNavbarSize(ResourceUtils.NAVBAR_VERTICAL_SIZE);
}
}
}
@@ -429,8 +449,7 @@
MotionEvent event = (MotionEvent) ev;
TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
if (event.getAction() == ACTION_DOWN) {
- if (isInValidSystemUiState()
- && mSwipeTouchRegion.contains(event.getX(), event.getY())) {
+ if (mSwipeTouchRegion.contains(event.getX(), event.getY())) {
boolean useSharedState = mConsumer.useSharedSwipeState();
mConsumer.onConsumerAboutToBeSwitched();
mConsumer = newConsumer(useSharedState, event);
@@ -443,15 +462,57 @@
mUncheckedConsumer.onMotionEvent(event);
}
- private boolean isInValidSystemUiState() {
+ private boolean validSystemUiFlags() {
return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
- && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0
- && !ActivityManagerWrapper.getInstance().isLockToAppActive();
+ && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
+ }
+
+ private boolean topTaskLocked() {
+ return ActivityManagerWrapper.getInstance().isLockToAppActive();
}
private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
- // TODO: this makes a binder call every touch down. we should move to a listener pattern.
- if (!mIsUserUnlocked || mKM.isDeviceLocked()) {
+ boolean topTaskLocked = topTaskLocked();
+ boolean isInValidSystemUiState = validSystemUiFlags() && !topTaskLocked;
+
+ if (!mIsUserUnlocked) {
+ if (isInValidSystemUiState) {
+ // This handles apps launched in direct boot mode (e.g. dialer) as well as apps
+ // launched while device is locked even after exiting direct boot mode (e.g. camera).
+ return new DeviceLockedInputConsumer(this);
+ } else {
+ return InputConsumer.NO_OP;
+ }
+ }
+
+ InputConsumer base = isInValidSystemUiState
+ ? newBaseConsumer(useSharedState, event) : InputConsumer.NO_OP;
+ if (mMode == Mode.NO_BUTTON) {
+ final ActivityControlHelper activityControl =
+ mOverviewComponentObserver.getActivityControlHelper();
+ if (mAssistantAvailable && !topTaskLocked
+ && AssistantTouchConsumer.withinTouchRegion(this, event)) {
+ base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base,
+ mInputMonitorCompat);
+ }
+
+ if (ActivityManagerWrapper.getInstance().isScreenPinningActive()) {
+ // Note: we only allow accessibility to wrap this, and it replaces the previous
+ // base input consumer (which should be NO_OP anyway since topTaskLocked == true).
+ base = new ScreenPinnedInputConsumer(this, mISystemUiProxy, activityControl);
+ }
+
+ if ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0) {
+ base = new AccessibilityInputConsumer(this, mISystemUiProxy,
+ (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0, base,
+ mInputMonitorCompat, mSwipeTouchRegion);
+ }
+ }
+ return base;
+ }
+
+ private InputConsumer newBaseConsumer(boolean useSharedState, MotionEvent event) {
+ if (mKM.isDeviceLocked()) {
// This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched
// while device is locked even after exiting direct boot mode (e.g. camera).
return new DeviceLockedInputConsumer(this);
@@ -465,42 +526,26 @@
final ActivityControlHelper activityControl =
mOverviewComponentObserver.getActivityControlHelper();
- InputConsumer base;
if (runningTaskInfo == null && !mSwipeSharedState.goingToLauncher
&& !mSwipeSharedState.recentsAnimationFinishInterrupted) {
- base = InputConsumer.NO_OP;
+ return InputConsumer.NO_OP;
} else if (mSwipeSharedState.recentsAnimationFinishInterrupted) {
// If the finish animation was interrupted, then continue using the other activity input
// consumer but with the next task as the running task
RunningTaskInfo info = new ActivityManager.RunningTaskInfo();
info.id = mSwipeSharedState.nextRunningTaskId;
- base = createOtherActivityInputConsumer(event, info);
+ return createOtherActivityInputConsumer(event, info);
} else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) {
- base = OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
+ return OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
activityControl.isInLiveTileMode()) {
- base = OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
+ return OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false);
} else if (mGestureBlockingActivity != null && runningTaskInfo != null
&& mGestureBlockingActivity.equals(runningTaskInfo.topActivity)) {
- base = InputConsumer.NO_OP;
+ return InputConsumer.NO_OP;
} else {
- base = createOtherActivityInputConsumer(event, runningTaskInfo);
+ return createOtherActivityInputConsumer(event, runningTaskInfo);
}
-
- if (mMode == Mode.NO_BUTTON) {
- if (mAssistantAvailable && AssistantTouchConsumer.withinTouchRegion(this, event)) {
- base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base,
- mInputMonitorCompat);
- }
-
- if ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0) {
- base = new AccessibilityInputConsumer(this, mISystemUiProxy,
- (mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0, base,
- mInputMonitorCompat);
- }
- }
-
- return base;
}
private OtherActivityInputConsumer createOtherActivityInputConsumer(MotionEvent event,
@@ -511,7 +556,7 @@
return new OtherActivityInputConsumer(this, runningTaskInfo, mRecentsModel,
mOverviewComponentObserver.getOverviewIntent(), activityControl,
shouldDefer, mOverviewCallbacks, mInputConsumer, this::onConsumerInactive,
- mSwipeSharedState, mInputMonitorCompat);
+ mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion);
}
/**
@@ -524,7 +569,55 @@
}
@Override
- protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- TOUCH_INTERACTION_LOG.dump("", pw);
+ protected void dump(FileDescriptor fd, PrintWriter pw, String[] rawArgs) {
+ if (rawArgs.length > 0 && Utilities.IS_DEBUG_DEVICE) {
+ ArgList args = new ArgList(Arrays.asList(rawArgs));
+ switch (args.nextArg()) {
+ case "cmd":
+ if (args.peekArg() == null) {
+ printAvailableCommands(pw);
+ } else {
+ onCommand(pw, args);
+ }
+ break;
+ }
+ } else {
+ // Dump everything
+ pw.println("TouchState:");
+ pw.println(" navMode=" + mMode);
+ pw.println(" validSystemUiFlags=" + validSystemUiFlags()
+ + " flags=" + mSystemUiStateFlags);
+ pw.println(" topTaskLocked=" + topTaskLocked());
+ pw.println(" isDeviceLocked=" + mKM.isDeviceLocked());
+ pw.println(" screenPinned=" +
+ ActivityManagerWrapper.getInstance().isScreenPinningActive());
+ pw.println(" assistantAvailable=" + mAssistantAvailable);
+ pw.println(" a11yClickable="
+ + ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0));
+ pw.println(" a11yLongClickable="
+ + ((mSystemUiStateFlags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0));
+ pw.println(" resumed="
+ + mOverviewComponentObserver.getActivityControlHelper().isResumed());
+ pw.println(" useSharedState=" + mConsumer.useSharedSwipeState());
+ if (mConsumer.useSharedSwipeState()) {
+ mSwipeSharedState.dump(" ", pw);
+ }
+ pw.println(" mConsumer=" + mConsumer.getName());
+ TOUCH_INTERACTION_LOG.dump("", pw);
+
+ }
+ }
+
+ private void printAvailableCommands(PrintWriter pw) {
+ pw.println("Available commands:");
+ pw.println(" clear-touch-log: Clears the touch interaction log");
+ }
+
+ private void onCommand(PrintWriter pw, ArgList args) {
+ switch (args.nextArg()) {
+ case "clear-touch-log":
+ TOUCH_INTERACTION_LOG.clear();
+ break;
+ }
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 936f0aa..0773904 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -27,6 +27,7 @@
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;
+import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState.HIDE;
import static com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState.PEEK;
@@ -66,6 +67,7 @@
import android.view.animation.Interpolator;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.android.launcher3.AbstractFloatingView;
@@ -90,6 +92,8 @@
import com.android.quickstep.ActivityControlHelper.AnimationFactory.ShelfAnimState;
import com.android.quickstep.ActivityControlHelper.HomeAnimationFactory;
import com.android.quickstep.SysUINavigationMode.Mode;
+import com.android.quickstep.inputconsumers.InputConsumer;
+import com.android.quickstep.inputconsumers.OverviewInputConsumer;
import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.RemoteAnimationTargetSet;
@@ -165,13 +169,14 @@
private static final int LAUNCHER_UI_STATES =
STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED;
- enum GestureEndTarget {
+ public enum GestureEndTarget {
HOME(1, STATE_SCALED_CONTROLLER_HOME, true, false, ContainerType.WORKSPACE, false),
RECENTS(1, STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT
| STATE_SCREENSHOT_VIEW_SHOWN, true, false, ContainerType.TASKSWITCHER, true),
- NEW_TASK(0, STATE_START_NEW_TASK, false, true, ContainerType.APP, true),
+ NEW_TASK(0, STATE_START_NEW_TASK | STATE_CAPTURE_SCREENSHOT, false, true,
+ ContainerType.APP, true),
LAST_TASK(0, STATE_RESUME_LAST_TASK, false, true, ContainerType.APP, false);
@@ -219,8 +224,8 @@
private final ClipAnimationHelper mClipAnimationHelper;
private final ClipAnimationHelper.TransformParams mTransformParams;
- protected Runnable mGestureEndCallback;
- protected GestureEndTarget mGestureEndTarget;
+ private Runnable mGestureEndCallback;
+ private GestureEndTarget mGestureEndTarget;
// Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise
private RunningWindowAnim mRunningWindowAnim;
private boolean mIsShelfPeeking;
@@ -272,7 +277,7 @@
private final long mTouchTimeMs;
private long mLauncherFrameDrawnTime;
- WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context,
+ public WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context,
long touchTimeMs, ActivityControlHelper<T> controller, boolean continuingLastGesture,
InputConsumerController inputConsumer) {
mContext = context;
@@ -315,7 +320,7 @@
mStateCallback.addCallback(STATE_RESUME_LAST_TASK | STATE_APP_CONTROLLER_RECEIVED,
this::resumeLastTask);
- mStateCallback.addCallback(STATE_START_NEW_TASK | STATE_APP_CONTROLLER_RECEIVED,
+ mStateCallback.addCallback(STATE_START_NEW_TASK | STATE_SCREENSHOT_CAPTURED,
this::startNewTask);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_APP_CONTROLLER_RECEIVED
@@ -499,6 +504,7 @@
private void setupRecentsViewUi() {
if (mContinuingLastGesture) {
+ updateSysUiFlags(mCurrentShift.value);
return;
}
mRecentsView.onGestureAnimationStart(mRunningTaskId);
@@ -654,8 +660,7 @@
mTransformParams.setProgress(shift).setOffsetX(offsetX).setOffsetScale(offsetScale);
mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet,
mTransformParams);
- mRecentsAnimationWrapper.setWindowThresholdCrossed(
- shift > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD);
+ updateSysUiFlags(shift);
}
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
@@ -673,15 +678,6 @@
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
}
- // Update insets of the non-running tasks, as we might switch to them.
- int runningTaskIndex = mRecentsView == null ? -1 : mRecentsView.getRunningTaskIndex();
- if (runningTaskIndex >= 0) {
- for (int i = 0; i < mRecentsView.getTaskViewCount(); i++) {
- if (i != runningTaskIndex || !mRecentsAnimationWrapper.hasTargets()) {
- mRecentsView.getTaskViewAt(i).setFullscreenProgress(1 - mCurrentShift.value);
- }
- }
- }
if (mLauncherTransitionController == null || mLauncherTransitionController
.getAnimationPlayer().isStarted()) {
@@ -700,6 +696,18 @@
? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart));
}
+ private void updateSysUiFlags(float windowProgress) {
+ if (mRecentsView != null) {
+ // We will handle the sysui flags based on the centermost task view.
+ mRecentsAnimationWrapper.setWindowThresholdCrossed(true);
+ int sysuiFlags = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD
+ ? 0
+ : mRecentsView.getTaskViewAt(mRecentsView.getPageNearestToCenterOfScreen())
+ .getThumbnail().getSysUiStatusNavFlags();
+ mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags);
+ }
+ }
+
@Override
public void onRecentsAnimationStart(SwipeAnimationTargetSet targetSet) {
DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext).getDeviceProfile(mContext);
@@ -1062,8 +1070,7 @@
final View floatingView = homeAnimationFactory.getFloatingView();
final boolean isFloatingIconView = floatingView instanceof FloatingIconView;
-
- RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect);
+ RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect, mActivity.getResources());
if (isFloatingIconView) {
FloatingIconView fiv = (FloatingIconView) floatingView;
anim.addAnimatorListener(fiv);
@@ -1080,17 +1087,19 @@
homeAnim.setPlayFraction(progress);
- float iconAlpha = Utilities.mapToRange(interpolatedProgress, 0,
- windowAlphaThreshold, 0f, 1f, Interpolators.LINEAR);
- mTransformParams.setCurrentRectAndTargetAlpha(currentRect, 1f - iconAlpha);
+ float windowAlpha = Utilities.mapToRange(interpolatedProgress, 0,
+ windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR);
+ mTransformParams.setProgress(progress)
+ .setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
false /* launcherOnTop */);
if (isFloatingIconView) {
- ((FloatingIconView) floatingView).update(currentRect, iconAlpha, progress,
+ ((FloatingIconView) floatingView).update(currentRect, 1f, progress,
windowAlphaThreshold, mClipAnimationHelper.getCurrentCornerRadius(), false);
}
+ updateSysUiFlags(Math.max(progress, mCurrentShift.value));
});
anim.addAnimatorListener(new AnimationSuccessListener() {
@Override
@@ -1112,6 +1121,13 @@
return anim;
}
+ /**
+ * @return The GestureEndTarget if the gesture has ended, else null.
+ */
+ public @Nullable GestureEndTarget getGestureEndTarget() {
+ return mGestureEndTarget;
+ }
+
@UiThread
private void resumeLastTask() {
mRecentsAnimationWrapper.finish(false /* toRecents */, null);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java
new file mode 100644
index 0000000..74a4851
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java
@@ -0,0 +1,55 @@
+package com.android.quickstep.hints;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.FloatProperty;
+import android.view.View;
+import android.widget.FrameLayout;
+
+public class ProactiveHintsContainer extends FrameLayout {
+
+ public static final FloatProperty<ProactiveHintsContainer> HINT_VISIBILITY =
+ new FloatProperty<ProactiveHintsContainer>("hint_visibility") {
+ @Override
+ public void setValue(ProactiveHintsContainer proactiveHintsContainer, float v) {
+ proactiveHintsContainer.setHintVisibility(v);
+ }
+
+ @Override
+ public Float get(ProactiveHintsContainer proactiveHintsContainer) {
+ return proactiveHintsContainer.mHintVisibility;
+ }
+ };
+
+ private float mHintVisibility;
+
+ public ProactiveHintsContainer(Context context) {
+ super(context);
+ }
+
+ public ProactiveHintsContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public void setView(View v) {
+ removeAllViews();
+ addView(v);
+ }
+
+ public void setHintVisibility(float v) {
+ if (v == 1) {
+ setVisibility(VISIBLE);
+ } else {
+ setVisibility(GONE);
+ }
+ mHintVisibility = v;
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AccessibilityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
similarity index 92%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AccessibilityInputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
index 8f8cd18..1f73a28 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AccessibilityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AccessibilityInputConsumer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
@@ -23,6 +23,7 @@
import static android.view.MotionEvent.ACTION_UP;
import android.content.Context;
+import android.graphics.RectF;
import android.os.RemoteException;
import android.util.Log;
import android.view.Display;
@@ -46,6 +47,7 @@
private final VelocityTracker mVelocityTracker;
private final MotionPauseDetector mMotionPauseDetector;
private final boolean mAllowLongClick;
+ private final RectF mSwipeTouchRegion;
private final float mMinGestureDistance;
private final float mMinFlingVelocity;
@@ -55,13 +57,15 @@
private float mTotalY;
public AccessibilityInputConsumer(Context context, ISystemUiProxy systemUiProxy,
- boolean allowLongClick, InputConsumer delegate, InputMonitorCompat inputMonitor) {
+ boolean allowLongClick, InputConsumer delegate, InputMonitorCompat inputMonitor,
+ RectF swipeTouchRegion) {
super(delegate, inputMonitor);
mSystemUiProxy = systemUiProxy;
mVelocityTracker = VelocityTracker.obtain();
mMinGestureDistance = context.getResources()
.getDimension(R.dimen.accessibility_gesture_min_swipe_distance);
mMinFlingVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
+ mSwipeTouchRegion = swipeTouchRegion;
mMotionPauseDetector = new MotionPauseDetector(context);
mAllowLongClick = allowLongClick;
@@ -98,10 +102,11 @@
}
case ACTION_POINTER_DOWN: {
if (mState == STATE_INACTIVE) {
- if (mDelegate.allowInterceptByParent()) {
+ int pointerIndex = ev.getActionIndex();
+ if (mSwipeTouchRegion.contains(ev.getX(pointerIndex), ev.getY(pointerIndex))
+ && mDelegate.allowInterceptByParent()) {
setActive(ev);
- int pointerIndex = ev.getActionIndex();
mActivePointerId = ev.getPointerId(pointerIndex);
mDownY = ev.getY(pointerIndex);
} else {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
similarity index 71%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
index 829e478..20ea3a1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
@@ -14,16 +14,18 @@
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
+import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPLEFT;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPRIGHT;
+import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.FLING;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE_NOOP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.NAVBAR;
@@ -43,6 +45,8 @@
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.UserEventDispatcher;
+import com.android.launcher3.touch.SwipeDetector;
+import com.android.quickstep.ActivityControlHelper;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.QuickStepContract;
@@ -50,12 +54,15 @@
/**
* Touch consumer for handling events to launch assistant from launcher
*/
-public class AssistantTouchConsumer extends DelegateInputConsumer {
+public class AssistantTouchConsumer extends DelegateInputConsumer
+ implements SwipeDetector.Listener {
+
private static final String TAG = "AssistantTouchConsumer";
private static final long RETRACT_ANIMATION_DURATION_MS = 300;
private static final String INVOCATION_TYPE_KEY = "invocation_type";
private static final int INVOCATION_TYPE_GESTURE = 1;
+ private static final int INVOCATION_TYPE_FLING = 6;
private final PointF mDownPos = new PointF();
private final PointF mLastPos = new PointF();
@@ -77,6 +84,7 @@
private final float mSlop;
private final ISystemUiProxy mSysUiProxy;
private final Context mContext;
+ private final SwipeDetector mSwipeDetector;
public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy,
ActivityControlHelper activityControlHelper, InputConsumer delegate,
@@ -90,6 +98,8 @@
mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold);
mSlop = QuickStepContract.getQuickStepDragSlopPx();
mActivityControlHelper = activityControlHelper;
+ mSwipeDetector = new SwipeDetector(mContext, this, SwipeDetector.VERTICAL);
+ mSwipeDetector.setDetectableScrollConditions(SwipeDetector.DIRECTION_POSITIVE, false);
}
@Override
@@ -100,6 +110,7 @@
@Override
public void onMotionEvent(MotionEvent ev) {
// TODO add logging
+ mSwipeDetector.onTouchEvent(ev);
switch (ev.getActionMasked()) {
case ACTION_DOWN: {
@@ -109,6 +120,12 @@
mTimeFraction = 0;
break;
}
+ case ACTION_POINTER_DOWN: {
+ if (mState != STATE_ACTIVE) {
+ mState = STATE_DELEGATE_ACTIVE;
+ break;
+ }
+ }
case ACTION_POINTER_UP: {
int ptrIdx = ev.getActionIndex();
int ptrId = ev.getPointerId(ptrIdx);
@@ -146,7 +163,7 @@
// Determine if angle is larger than threshold for assistant detection
float angle = (float) Math.toDegrees(
- Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x));
+ Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x));
mDirection = angle > 90 ? UPLEFT : UPRIGHT;
angle = angle > 90 ? 180 - angle : angle;
@@ -159,7 +176,7 @@
} else {
// Movement
mDistance = (float) Math.hypot(mLastPos.x - mStartDragPos.x,
- mLastPos.y - mStartDragPos.y);
+ mLastPos.y - mStartDragPos.y);
if (mDistance >= 0) {
final long diff = SystemClock.uptimeMillis() - mDragTime;
mTimeFraction = Math.min(diff * 1f / mTimeThreshold, 1);
@@ -172,18 +189,18 @@
case ACTION_UP:
if (mState != STATE_DELEGATE_ACTIVE && !mLaunchedAssistant) {
ValueAnimator animator = ValueAnimator.ofFloat(mLastProgress, 0)
- .setDuration(RETRACT_ANIMATION_DURATION_MS);
+ .setDuration(RETRACT_ANIMATION_DURATION_MS);
UserEventDispatcher.newInstance(mContext).logActionOnContainer(
- SWIPE_NOOP, mDirection, NAVBAR);
+ SWIPE_NOOP, mDirection, NAVBAR);
animator.addUpdateListener(valueAnimator -> {
- float progress = (float) valueAnimator.getAnimatedValue();
- try {
+ float progress = (float) valueAnimator.getAnimatedValue();
+ try {
- mSysUiProxy.onAssistantProgress(progress);
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to send SysUI start/send assistant progress: "
- + progress, e);
- }
+ mSysUiProxy.onAssistantProgress(progress);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to send SysUI start/send assistant progress: "
+ + progress, e);
+ }
});
animator.setInterpolator(Interpolators.DEACCEL_2);
animator.start();
@@ -200,38 +217,58 @@
private void updateAssistantProgress() {
if (!mLaunchedAssistant) {
- float progress = Math.min(mDistance * 1f / mDistThreshold, 1) * mTimeFraction;
- mLastProgress = progress;
- try {
- mSysUiProxy.onAssistantProgress(progress);
- if (mDistance >= mDistThreshold && mTimeFraction >= 1) {
- UserEventDispatcher.newInstance(mContext).logActionOnContainer(
- SWIPE, mDirection, NAVBAR);
- Bundle args = new Bundle();
- args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
-
- BaseDraggingActivity launcherActivity =
- mActivityControlHelper.getCreatedActivity();
- if (launcherActivity != null) {
- launcherActivity.getRootView().
- performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- }
-
- mSysUiProxy.startAssistant(args);
- mLaunchedAssistant = true;
- }
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to send SysUI start/send assistant progress: " + progress, e);
- }
+ mLastProgress = Math.min(mDistance * 1f / mDistThreshold, 1) * mTimeFraction;
+ updateAssistant(SWIPE);
}
}
- static boolean withinTouchRegion(Context context, MotionEvent ev) {
+ private void updateAssistant(int gestureType) {
+ try {
+ mSysUiProxy.onAssistantProgress(mLastProgress);
+ if (gestureType == FLING || (mDistance >= mDistThreshold && mTimeFraction >= 1)) {
+ UserEventDispatcher.newInstance(mContext)
+ .logActionOnContainer(gestureType, mDirection, NAVBAR);
+ Bundle args = new Bundle();
+ args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
+
+ BaseDraggingActivity launcherActivity = mActivityControlHelper.getCreatedActivity();
+ if (launcherActivity != null) {
+ launcherActivity.getRootView().performHapticFeedback(
+ 13, // HapticFeedbackConstants.GESTURE_END
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
+ }
+
+ mSysUiProxy.startAssistant(args);
+ mLaunchedAssistant = true;
+ }
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to send SysUI start/send assistant progress: " + mLastProgress, e);
+ }
+ }
+
+ public static boolean withinTouchRegion(Context context, MotionEvent ev) {
final Resources res = context.getResources();
final int width = res.getDisplayMetrics().widthPixels;
final int height = res.getDisplayMetrics().heightPixels;
final int size = res.getDimensionPixelSize(R.dimen.gestures_assistant_size);
return (ev.getX() > width - size || ev.getX() < size) && ev.getY() > height - size;
}
+
+ @Override
+ public void onDragStart(boolean start) {
+ // do nothing
+ }
+
+ @Override
+ public boolean onDrag(float displacement) {
+ return false;
+ }
+
+ @Override
+ public void onDragEnd(float velocity, boolean fling) {
+ if (fling && !mLaunchedAssistant) {
+ mLastProgress = 1;
+ updateAssistant(FLING);
+ }
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/DelegateInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/DelegateInputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
index d36162f..311ddd2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/DelegateInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
@@ -1,4 +1,4 @@
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import android.view.MotionEvent;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/DeviceLockedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/DeviceLockedInputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
index 7fd09f7..b1d175d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/DeviceLockedInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import android.content.Context;
import android.content.Intent;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/InputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
similarity index 73%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/InputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
index 37b7288..6e7cb8f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/InputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import android.annotation.TargetApi;
import android.os.Build;
@@ -30,6 +30,7 @@
int TYPE_ASSISTANT = 1 << 3;
int TYPE_DEVICE_LOCKED = 1 << 4;
int TYPE_ACCESSIBILITY = 1 << 5;
+ int TYPE_SCREEN_PINNED = 1 << 6;
InputConsumer NO_OP = () -> TYPE_NO_OP;
@@ -62,4 +63,23 @@
onKeyEvent((KeyEvent) ev);
}
}
+
+ default String getName() {
+ switch (getType()) {
+ case TYPE_OVERVIEW:
+ return "OVERVIEW";
+ case TYPE_OTHER_ACTIVITY:
+ return "OTHER_ACTIVITY";
+ case TYPE_ASSISTANT:
+ return "ASSISTANT";
+ case TYPE_DEVICE_LOCKED:
+ return "DEVICE_LOCKED";
+ case TYPE_ACCESSIBILITY:
+ return "ACCESSIBILITY";
+ case TYPE_SCREEN_PINNED:
+ return "SCREEN_PINNED";
+ default:
+ return "NO_OP";
+ }
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
similarity index 90%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index db377b0..eb5366c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -13,15 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
+import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.INVALID_POINTER_ID;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
+import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_LANDSCAPE;
+import static com.android.launcher3.uioverrides.RecentsUiFactory.ROTATION_SEASCAPE;
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
@@ -34,6 +37,7 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.graphics.PointF;
+import android.graphics.RectF;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
@@ -50,7 +54,13 @@
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
+import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.OverviewCallbacks;
+import com.android.quickstep.RecentsModel;
+import com.android.quickstep.SwipeSharedState;
+import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
+import com.android.quickstep.WindowTransformSwipeHandler;
import com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget;
import com.android.quickstep.util.CachedEventDispatcher;
import com.android.quickstep.util.MotionPauseDetector;
@@ -82,6 +92,7 @@
private final SwipeSharedState mSwipeSharedState;
private final InputMonitorCompat mInputMonitorCompat;
private final SysUINavigationMode.Mode mMode;
+ private final RectF mSwipeTouchRegion;
private final int mDisplayRotation;
@@ -119,7 +130,8 @@
boolean isDeferredDownTarget, OverviewCallbacks overviewCallbacks,
InputConsumerController inputConsumer,
Consumer<OtherActivityInputConsumer> onCompleteCallback,
- SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat) {
+ SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat,
+ RectF swipeTouchRegion) {
super(base);
mMainThreadHandler = new Handler(Looper.getMainLooper());
@@ -127,6 +139,7 @@
mRecentsModel = recentsModel;
mHomeIntent = homeIntent;
mMode = SysUINavigationMode.getMode(base);
+ mSwipeTouchRegion = swipeTouchRegion;
mMotionPauseDetector = new MotionPauseDetector(base);
mMotionPauseMinDisplacement = base.getResources().getDimension(
@@ -165,8 +178,8 @@
&& !mRecentsViewDispatcher.hasConsumer()) {
mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher(
isNavBarOnLeft()
- ? RotationMode.SEASCAPE
- : (isNavBarOnRight() ? RotationMode.LANDSCAPE : RotationMode.NORMAL)));
+ ? ROTATION_SEASCAPE
+ : (isNavBarOnRight() ? ROTATION_LANDSCAPE : RotationMode.NORMAL)));
}
int edgeFlags = ev.getEdgeFlags();
ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR);
@@ -196,6 +209,19 @@
RaceConditionTracker.onEvent(DOWN_EVT, EXIT);
break;
}
+ case ACTION_POINTER_DOWN: {
+ if (!mPassedTouchSlop) {
+ // Cancel interaction in case of multi-touch interaction
+ int ptrIdx = ev.getActionIndex();
+ if (!mSwipeTouchRegion.contains(ev.getX(ptrIdx), ev.getY(ptrIdx))) {
+ int action = ev.getAction();
+ ev.setAction(ACTION_CANCEL);
+ finishTouchTracking(ev);
+ ev.setAction(action);
+ }
+ }
+ break;
+ }
case ACTION_POINTER_UP: {
int ptrIdx = ev.getActionIndex();
int ptrId = ev.getPointerId(ptrIdx);
@@ -265,13 +291,8 @@
break;
}
case ACTION_CANCEL:
- // TODO: Should be different than ACTION_UP
case ACTION_UP: {
- RaceConditionTracker.onEvent(UP_EVT, ENTER);
- TraceHelper.endSection("TouchInt");
-
finishTouchTracking(ev);
- RaceConditionTracker.onEvent(UP_EVT, EXIT);
break;
}
}
@@ -334,6 +355,9 @@
* the animation can still be running.
*/
private void finishTouchTracking(MotionEvent ev) {
+ RaceConditionTracker.onEvent(UP_EVT, ENTER);
+ TraceHelper.endSection("TouchInt");
+
if (mPassedDragSlop && mInteractionHandler != null) {
if (ev.getActionMasked() == ACTION_CANCEL) {
mInteractionHandler.onGestureCancelled();
@@ -366,6 +390,7 @@
mVelocityTracker.recycle();
mVelocityTracker = null;
mMotionPauseDetector.clear();
+ RaceConditionTracker.onEvent(UP_EVT, EXIT);
}
@Override
@@ -376,7 +401,7 @@
// The consumer is being switched while we are active. Set up the shared state to be
// used by the next animation
removeListener();
- GestureEndTarget endTarget = mInteractionHandler.mGestureEndTarget;
+ GestureEndTarget endTarget = mInteractionHandler.getGestureEndTarget();
mSwipeSharedState.canGestureBeContinued = endTarget != null && endTarget.canBeContinued;
mSwipeSharedState.goingToLauncher = endTarget != null && endTarget.isLauncher;
if (mSwipeSharedState.canGestureBeContinued) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
similarity index 96%
rename from quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index bafc367..bab3c71 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.quickstep;
+package com.android.quickstep.inputconsumers;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.quickstep.TouchInteractionService.TOUCH_INTERACTION_LOG;
@@ -27,6 +27,8 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.BaseDragLayer;
+import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.OverviewCallbacks;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputMonitorCompat;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
new file mode 100644
index 0000000..a0e20f2
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/ScreenPinnedInputConsumer.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2019 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.quickstep.inputconsumers;
+
+import android.content.Context;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.HapticFeedbackConstants;
+import android.view.MotionEvent;
+
+import com.android.launcher3.BaseDraggingActivity;
+import com.android.launcher3.R;
+import com.android.quickstep.ActivityControlHelper;
+import com.android.quickstep.util.MotionPauseDetector;
+import com.android.systemui.shared.recents.ISystemUiProxy;
+
+/**
+ * An input consumer that detects swipe up and hold to exit screen pinning mode.
+ */
+public class ScreenPinnedInputConsumer implements InputConsumer {
+
+ private static final String TAG = "ScreenPinnedConsumer";
+
+ private final float mMotionPauseMinDisplacement;
+ private final MotionPauseDetector mMotionPauseDetector;
+
+ private float mTouchDownY;
+
+ public ScreenPinnedInputConsumer(Context context, ISystemUiProxy sysuiProxy,
+ ActivityControlHelper activityControl) {
+ mMotionPauseMinDisplacement = context.getResources().getDimension(
+ R.dimen.motion_pause_detector_min_displacement_from_app);
+ mMotionPauseDetector = new MotionPauseDetector(context, true /* makePauseHarderToTrigger*/);
+ mMotionPauseDetector.setOnMotionPauseListener(isPaused -> {
+ if (isPaused) {
+ try {
+ sysuiProxy.stopScreenPinning();
+ BaseDraggingActivity launcherActivity = activityControl.getCreatedActivity();
+ if (launcherActivity != null) {
+ launcherActivity.getRootView().performHapticFeedback(
+ HapticFeedbackConstants.LONG_PRESS,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
+ }
+ mMotionPauseDetector.clear();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to stop screen pinning ", e);
+ }
+ }
+ });
+ }
+
+ @Override
+ public int getType() {
+ return TYPE_SCREEN_PINNED;
+ }
+
+ @Override
+ public void onMotionEvent(MotionEvent ev) {
+ float y = ev.getY();
+ switch (ev.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTouchDownY = y;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ float displacement = mTouchDownY - y;
+ mMotionPauseDetector.setDisallowPause(displacement < mMotionPauseMinDisplacement);
+ mMotionPauseDetector.addPosition(y, ev.getEventTime());
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ case MotionEvent.ACTION_UP:
+ mMotionPauseDetector.clear();
+ break;
+ }
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index 3109921..c164a24 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -35,12 +35,14 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskThumbnailView;
+import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.utilities.RectFEvaluator;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -280,6 +282,28 @@
}
}
+ /**
+ * Compute scale and translation y such that the specified task view fills the screen.
+ */
+ public ClipAnimationHelper updateForFullscreenOverview(TaskView v) {
+ TaskThumbnailView thumbnailView = v.getThumbnail();
+ RecentsView recentsView = v.getRecentsView();
+ fromTaskThumbnailView(thumbnailView, recentsView);
+ Rect taskSize = new Rect();
+ recentsView.getTaskSize(taskSize);
+ updateTargetRect(taskSize);
+ return this;
+ }
+
+ /**
+ * @return The source rect's scale and translation relative to the target rect.
+ */
+ public LauncherState.ScaleAndTranslation getScaleAndTranslation() {
+ float scale = mSourceRect.width() / mTargetRect.width();
+ float translationY = mSourceRect.centerY() - mSourceRect.top - mTargetRect.centerY();
+ return new LauncherState.ScaleAndTranslation(scale, 0, translationY);
+ }
+
private void updateStackBoundsToMultiWindowTaskSize(BaseDraggingActivity activity) {
ISystemUiProxy sysUiProxy = RecentsModel.INSTANCE.get(activity).getSystemUiProxy();
if (sysUiProxy != null) {
@@ -315,35 +339,10 @@
mSourceStackBounds.offset(left, insets.top + fullDp.availableHeightPx - taskHeight);
}
- public void drawForProgress(TaskThumbnailView ttv, Canvas canvas, float progress) {
- RectF currentRect = mRectFEvaluator.evaluate(progress, mSourceRect, mTargetRect);
- canvas.translate(mSourceStackBounds.left - mHomeStackBounds.left,
- mSourceStackBounds.top - mHomeStackBounds.top);
- mTmpMatrix.setRectToRect(mTargetRect, currentRect, ScaleToFit.FILL);
-
- canvas.concat(mTmpMatrix);
- canvas.translate(mTargetRect.left, mTargetRect.top);
-
- float scale = mTargetRect.width() / mSourceRect.width();
- float insetProgress = (1 - progress);
- float windowCornerRadius = mUseRoundedCornersOnWindows
- ? mWindowCornerRadius : 0;
- ttv.drawOnCanvas(canvas,
- -mSourceWindowClipInsets.left * insetProgress,
- -mSourceWindowClipInsets.top * insetProgress,
- ttv.getMeasuredWidth() + mSourceWindowClipInsets.right * insetProgress,
- ttv.getMeasuredHeight() + mSourceWindowClipInsets.bottom * insetProgress,
- Utilities.mapRange(progress, windowCornerRadius * scale, ttv.getCornerRadius()));
- }
-
public RectF getTargetRect() {
return mTargetRect;
}
- public RectF getSourceRect() {
- return mSourceRect;
- }
-
public float getCurrentCornerRadius() {
return mCurrentCornerRadius;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
index 40b9c4d..3f4ad58 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
@@ -19,6 +19,7 @@
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
+import android.content.res.Resources;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.FloatProperty;
@@ -26,6 +27,7 @@
import androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener;
import androidx.dynamicanimation.animation.FloatPropertyCompat;
+import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.FlingSpringAnim;
@@ -33,6 +35,8 @@
import java.util.ArrayList;
import java.util.List;
+import static com.android.launcher3.anim.Interpolators.DEACCEL;
+
/**
* Applies spring forces to animate from a starting rect to a target rect,
* while providing update callbacks to the caller.
@@ -45,7 +49,7 @@
* can be done in parallel at a fixed duration. Update callbacks are sent based on the progress
* of this animation, while the end callback is sent after all animations finish.
*/
- private static final long RECT_SCALE_DURATION = 180;
+ private static final long RECT_SCALE_DURATION = 250;
private static final FloatPropertyCompat<RectFSpringAnim> RECT_CENTER_X =
new FloatPropertyCompat<RectFSpringAnim>("rectCenterXSpring") {
@@ -61,16 +65,16 @@
}
};
- private static final FloatPropertyCompat<RectFSpringAnim> RECT_CENTER_Y =
- new FloatPropertyCompat<RectFSpringAnim>("rectCenterYSpring") {
+ private static final FloatPropertyCompat<RectFSpringAnim> RECT_Y =
+ new FloatPropertyCompat<RectFSpringAnim>("rectYSpring") {
@Override
public float getValue(RectFSpringAnim anim) {
- return anim.mCurrentCenterY;
+ return anim.mCurrentY;
}
@Override
- public void setValue(RectFSpringAnim anim, float currentCenterY) {
- anim.mCurrentCenterY = currentCenterY;
+ public void setValue(RectFSpringAnim anim, float y) {
+ anim.mCurrentY = y;
anim.onUpdate();
}
};
@@ -96,7 +100,9 @@
private final List<Animator.AnimatorListener> mAnimatorListeners = new ArrayList<>();
private float mCurrentCenterX;
- private float mCurrentCenterY;
+ private float mCurrentY;
+ // If true, tracking the bottom of the rects, else tracking the top.
+ private boolean mTrackingBottomY;
private float mCurrentScaleProgress;
private FlingSpringAnim mRectXAnim;
private FlingSpringAnim mRectYAnim;
@@ -106,19 +112,32 @@
private boolean mRectYAnimEnded;
private boolean mRectScaleAnimEnded;
- public RectFSpringAnim(RectF startRect, RectF targetRect) {
+ private float mMinVisChange;
+ private float mYOvershoot;
+
+ public RectFSpringAnim(RectF startRect, RectF targetRect, Resources resources) {
mStartRect = startRect;
mTargetRect = targetRect;
mCurrentCenterX = mStartRect.centerX();
- mCurrentCenterY = mStartRect.centerY();
+
+ mTrackingBottomY = startRect.bottom < targetRect.bottom;
+ mCurrentY = mTrackingBottomY ? mStartRect.bottom : mStartRect.top;
+
+ mMinVisChange = resources.getDimensionPixelSize(R.dimen.swipe_up_fling_min_visible_change);
+ mYOvershoot = resources.getDimensionPixelSize(R.dimen.swipe_up_y_overshoot);
}
public void onTargetPositionChanged() {
if (mRectXAnim != null && mRectXAnim.getTargetPosition() != mTargetRect.centerX()) {
mRectXAnim.updatePosition(mCurrentCenterX, mTargetRect.centerX());
}
- if (mRectYAnim != null && mRectYAnim.getTargetPosition() != mTargetRect.centerY()) {
- mRectYAnim.updatePosition(mCurrentCenterY, mTargetRect.centerY());
+
+ if (mRectYAnim != null) {
+ if (mTrackingBottomY && mRectYAnim.getTargetPosition() != mTargetRect.bottom) {
+ mRectYAnim.updatePosition(mCurrentY, mTargetRect.bottom);
+ } else if (!mTrackingBottomY && mRectYAnim.getTargetPosition() != mTargetRect.top) {
+ mRectYAnim.updatePosition(mCurrentY, mTargetRect.top);
+ }
}
}
@@ -140,14 +159,28 @@
mRectYAnimEnded = true;
maybeOnEnd();
});
- mRectXAnim = new FlingSpringAnim(this, RECT_CENTER_X, mCurrentCenterX,
- mTargetRect.centerX(), velocityPxPerMs.x * 1000, onXEndListener);
- mRectYAnim = new FlingSpringAnim(this, RECT_CENTER_Y, mCurrentCenterY,
- mTargetRect.centerY(), velocityPxPerMs.y * 1000, onYEndListener);
+
+ float startX = mCurrentCenterX;
+ float endX = mTargetRect.centerX();
+ float minXValue = Math.min(startX, endX);
+ float maxXValue = Math.max(startX, endX);
+ mRectXAnim = new FlingSpringAnim(this, RECT_CENTER_X, startX, endX,
+ velocityPxPerMs.x * 1000, mMinVisChange, minXValue, maxXValue, 1f, onXEndListener);
+
+ float startVelocityY = velocityPxPerMs.y * 1000;
+ // Scale the Y velocity based on the initial velocity to tune the curves.
+ float springVelocityFactor = 0.1f + 0.9f * Math.abs(startVelocityY) / 20000.0f;
+ float startY = mCurrentY;
+ float endY = mTrackingBottomY ? mTargetRect.bottom : mTargetRect.top;
+ float minYValue = Math.min(startY, endY - mYOvershoot);
+ float maxYValue = Math.max(startY, endY);
+ mRectYAnim = new FlingSpringAnim(this, RECT_Y, startY, endY, startVelocityY,
+ mMinVisChange, minYValue, maxYValue, springVelocityFactor, onYEndListener);
mRectScaleAnim = ObjectAnimator.ofPropertyValuesHolder(this,
PropertyValuesHolder.ofFloat(RECT_SCALE_PROGRESS, 1))
.setDuration(RECT_SCALE_DURATION);
+ mRectScaleAnim.setInterpolator(DEACCEL);
mRectScaleAnim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
@@ -179,8 +212,13 @@
mTargetRect.width());
float currentHeight = Utilities.mapRange(mCurrentScaleProgress, mStartRect.height(),
mTargetRect.height());
- mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentCenterY - currentHeight / 2,
- mCurrentCenterX + currentWidth / 2, mCurrentCenterY + currentHeight / 2);
+ if (mTrackingBottomY) {
+ mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY - currentHeight,
+ mCurrentCenterX + currentWidth / 2, mCurrentY);
+ } else {
+ mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY,
+ mCurrentCenterX + currentWidth / 2, mCurrentY + currentHeight);
+ }
for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
onUpdateListener.onUpdate(mCurrentRect, mCurrentScaleProgress);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewDrawable.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewDrawable.java
deleted file mode 100644
index bb41e5d..0000000
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewDrawable.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2018 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.quickstep.util;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.PixelFormat;
-import android.graphics.drawable.Drawable;
-import android.util.FloatProperty;
-import android.view.View;
-
-import com.android.launcher3.BaseActivity;
-import com.android.launcher3.Utilities;
-import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.TaskThumbnailView;
-import com.android.quickstep.views.TaskView;
-
-public class TaskViewDrawable extends Drawable {
-
- public static final FloatProperty<TaskViewDrawable> PROGRESS =
- new FloatProperty<TaskViewDrawable>("progress") {
- @Override
- public void setValue(TaskViewDrawable taskViewDrawable, float v) {
- taskViewDrawable.setProgress(v);
- }
-
- @Override
- public Float get(TaskViewDrawable taskViewDrawable) {
- return taskViewDrawable.mProgress;
- }
- };
-
- /**
- * The progress at which we play the atomic icon scale animation.
- */
- private static final float ICON_SCALE_THRESHOLD = 0.95f;
-
- private final RecentsView mParent;
- private final View mIconView;
- private final float[] mIconPos;
- private final TaskView mTaskView;
-
- private final TaskThumbnailView mThumbnailView;
-
- private final ClipAnimationHelper mClipAnimationHelper;
-
- private float mProgress = 1;
- private boolean mPassedIconScaleThreshold;
- private ValueAnimator mIconScaleAnimator;
- private float mIconScale;
-
- public TaskViewDrawable(TaskView tv, RecentsView parent) {
- mParent = parent;
- mTaskView = tv;
- mIconView = tv.getIconView();
- mIconPos = new float[2];
- mIconScale = mIconView.getScaleX();
- Utilities.getDescendantCoordRelativeToAncestor(mIconView, parent, mIconPos, true);
-
- mThumbnailView = tv.getThumbnail();
- mClipAnimationHelper = new ClipAnimationHelper(parent.getContext());
- mClipAnimationHelper.fromTaskThumbnailView(mThumbnailView, parent);
- mClipAnimationHelper.prepareAnimation(
- BaseActivity.fromContext(tv.getContext()).getDeviceProfile(), true /* isOpening */);
- }
-
- public void setProgress(float progress) {
- mProgress = progress;
- mParent.invalidate();
- boolean passedIconScaleThreshold = progress <= ICON_SCALE_THRESHOLD;
- if (mPassedIconScaleThreshold != passedIconScaleThreshold) {
- mPassedIconScaleThreshold = passedIconScaleThreshold;
- animateIconScale(mPassedIconScaleThreshold ? 0 : 1);
- }
- }
-
- private void animateIconScale(float toScale) {
- if (mIconScaleAnimator != null) {
- mIconScaleAnimator.cancel();
- }
- mIconScaleAnimator = ValueAnimator.ofFloat(mIconScale, toScale);
- mIconScaleAnimator.addUpdateListener(valueAnimator -> {
- mIconScale = (float) valueAnimator.getAnimatedValue();
- if (mProgress > ICON_SCALE_THRESHOLD) {
- // Speed up the icon scale to ensure it is 1 when progress is 1.
- float iconProgress = (mProgress - ICON_SCALE_THRESHOLD) / (1 - ICON_SCALE_THRESHOLD);
- if (iconProgress > mIconScale) {
- mIconScale = iconProgress;
- }
- }
- invalidateSelf();
- });
- mIconScaleAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mIconScaleAnimator = null;
- }
- });
- mIconScaleAnimator.setDuration(TaskView.SCALE_ICON_DURATION);
- mIconScaleAnimator.start();
- }
-
- @Override
- public void draw(Canvas canvas) {
- canvas.save();
- canvas.translate(mParent.getScrollX(), mParent.getScrollY());
- mClipAnimationHelper.drawForProgress(mThumbnailView, canvas, mProgress);
- canvas.restore();
-
- canvas.save();
- canvas.translate(mIconPos[0], mIconPos[1]);
- canvas.scale(mIconScale, mIconScale, mIconView.getWidth() / 2, mIconView.getHeight() / 2);
- mIconView.draw(canvas);
- canvas.restore();
- }
-
- public ClipAnimationHelper getClipAnimationHelper() {
- return mClipAnimationHelper;
- }
-
- @Override
- public void setAlpha(int i) { }
-
- @Override
- public void setColorFilter(ColorFilter colorFilter) { }
-
- @Override
- public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
- }
-
- public TaskView getTaskView() {
- return mTaskView;
- }
-}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
index d6f2235..deedd21 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -30,10 +30,13 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -41,8 +44,11 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
+import com.android.launcher3.util.PendingAnimation;
+import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.views.ScrimView;
import com.android.quickstep.SysUINavigationMode;
+import com.android.quickstep.hints.ProactiveHintsContainer;
import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.ClipAnimationHelper.TransformParams;
import com.android.quickstep.util.LayoutUtils;
@@ -54,6 +60,8 @@
public class LauncherRecentsView extends RecentsView<Launcher> {
private final TransformParams mTransformParams = new TransformParams();
+ private final int mChipOverhang;
+ @Nullable private ProactiveHintsContainer mProactiveHintsContainer;
public LauncherRecentsView(Context context) {
this(context, null);
@@ -66,6 +74,16 @@
public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setContentAlpha(0);
+ mChipOverhang = (int) context.getResources().getDimension(R.dimen.chip_hint_overhang);
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ View hintContainer = mActivity.findViewById(R.id.hints);
+ mProactiveHintsContainer =
+ hintContainer instanceof ProactiveHintsContainer
+ ? (ProactiveHintsContainer) hintContainer : null;
}
@Override
@@ -84,6 +102,11 @@
}
}
+ @Nullable
+ public ProactiveHintsContainer getProactiveHintsContainer() {
+ return mProactiveHintsContainer;
+ }
+
@Override
public void draw(Canvas canvas) {
maybeDrawEmptyMessage(canvas);
@@ -137,6 +160,63 @@
@Override
protected void getTaskSize(DeviceProfile dp, Rect outRect) {
LayoutUtils.calculateLauncherTaskSize(getContext(), dp, outRect);
+ if (mProactiveHintsContainer != null) {
+ BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) mProactiveHintsContainer.getLayoutParams();
+ params.bottomMargin = getHeight() - outRect.bottom - mChipOverhang;
+ params.width = outRect.width();
+ }
+ }
+
+ @Override
+ public PendingAnimation createTaskLauncherAnimation(TaskView tv, long duration) {
+ PendingAnimation anim = super.createTaskLauncherAnimation(tv, duration);
+
+ if (mProactiveHintsContainer != null) {
+ anim.anim.play(ObjectAnimator.ofFloat(
+ mProactiveHintsContainer, ProactiveHintsContainer.HINT_VISIBILITY, 0));
+ }
+
+ return anim;
+ }
+
+ @Override
+ protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) {
+ if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
+ if (mRecentsAnimationWrapper.targetSet != null && tv.isRunningTask()) {
+ mTransformParams.setProgress(1 - progress)
+ .setSyncTransactionApplier(mSyncTransactionApplier)
+ .setForLiveTile(true);
+ mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet,
+ mTransformParams);
+ } else {
+ redrawLiveTile(true);
+ }
+ }
+ }
+
+ @Override
+ public PendingAnimation createTaskDismissAnimation(TaskView taskView, boolean animateTaskView,
+ boolean shouldRemoveTask, long duration) {
+ PendingAnimation anim = super.createTaskDismissAnimation(taskView, animateTaskView,
+ shouldRemoveTask, duration);
+
+ if (mProactiveHintsContainer != null) {
+ anim.anim.play(ObjectAnimator.ofFloat(
+ mProactiveHintsContainer, ProactiveHintsContainer.HINT_VISIBILITY, 0));
+ anim.addEndListener(onEndListener -> {
+ if (!onEndListener.isSuccess) {
+ mProactiveHintsContainer.setHintVisibility(1);
+ }
+ });
+ }
+
+ return anim;
+ }
+
+ public void setHintVisibility(float v) {
+ if (mProactiveHintsContainer != null) {
+ mProactiveHintsContainer.setHintVisibility(v);
+ }
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 525ead8..a835680 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
+import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
@@ -30,7 +31,6 @@
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
-import static com.android.quickstep.util.ClipAnimationHelper.TransformParams;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -75,7 +75,9 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils.ViewProgressProperty;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -91,13 +93,13 @@
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool;
+import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.RecentsAnimationWrapper;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RecentsModel.TaskThumbnailChangeListener;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.util.ClipAnimationHelper;
-import com.android.quickstep.util.TaskViewDrawable;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -140,6 +142,19 @@
}
};
+ public static final FloatProperty<RecentsView> FULLSCREEN_PROGRESS =
+ new FloatProperty<RecentsView>("fullscreenProgress") {
+ @Override
+ public void setValue(RecentsView recentsView, float v) {
+ recentsView.setFullscreenProgress(v);
+ }
+
+ @Override
+ public Float get(RecentsView recentsView) {
+ return recentsView.mFullscreenProgress;
+ }
+ };
+
protected RecentsAnimationWrapper mRecentsAnimationWrapper;
protected ClipAnimationHelper mClipAnimationHelper;
protected SyncRtSurfaceTransactionApplierCompat mSyncTransactionApplier;
@@ -163,6 +178,7 @@
private final ClearAllButton mClearAllButton;
private final Rect mClearAllButtonDeadZoneRect = new Rect();
private final Rect mTaskViewDeadZoneRect = new Rect();
+ protected final ClipAnimationHelper mTempClipAnimationHelper;
private final ScrollState mScrollState = new ScrollState();
// Keeps track of the previously known visible tasks for purposes of loading/unloading task data
@@ -274,6 +290,8 @@
@ViewDebug.ExportedProperty(category = "launcher")
private float mContentAlpha = 1;
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private float mFullscreenProgress = 0;
// Keeps track of task id whose visual state should not be reset
private int mIgnoreResetTaskId = -1;
@@ -288,6 +306,8 @@
private Layout mEmptyTextLayout;
private LiveTileOverlay mLiveTileOverlay;
+ private FloatingIconView mFloatingIconView;
+
private BaseActivity.MultiWindowModeChangedListener mMultiWindowModeChangedListener =
(inMultiWindowMode) -> {
if (!inMultiWindowMode && mOverviewStateEnabled) {
@@ -306,6 +326,7 @@
mActivity = (T) BaseActivity.fromContext(context);
mModel = RecentsModel.INSTANCE.get(context);
mIdp = InvariantDeviceProfile.INSTANCE.get(context);
+ mTempClipAnimationHelper = new ClipAnimationHelper(context);
mClearAllButton = (ClearAllButton) LayoutInflater.from(context)
.inflate(R.layout.overview_clear_all_button, this, false);
@@ -594,6 +615,14 @@
loadVisibleTaskData();
}
+ public void setFullscreenProgress(float fullscreenProgress) {
+ mFullscreenProgress = fullscreenProgress;
+ int taskCount = getTaskViewCount();
+ for (int i = 0; i < taskCount; i++) {
+ getTaskViewAt(i).setFullscreenProgress(mFullscreenProgress);
+ }
+ }
+
private void updateTaskStackListenerState() {
boolean handleTaskStackChanges = mOverviewStateEnabled && isAttachedToWindow()
&& getWindowVisibility() == VISIBLE;
@@ -1282,15 +1311,6 @@
setVisibility(alpha > 0 ? VISIBLE : GONE);
}
- private float[] getAdjacentScaleAndTranslation(TaskView currTask,
- float currTaskToScale, float currTaskToTranslationY) {
- float displacement = currTask.getWidth() * (currTaskToScale - currTask.getCurveScale());
- sTempFloatArray[0] = currTaskToScale;
- sTempFloatArray[1] = mIsRtl ? -displacement : displacement;
- sTempFloatArray[2] = currTaskToTranslationY;
- return sTempFloatArray;
- }
-
@Override
public void onViewAdded(View child) {
super.onViewAdded(child);
@@ -1419,27 +1439,15 @@
int centerTaskIndex = getCurrentPage();
boolean launchingCenterTask = taskIndex == centerTaskIndex;
- float toScale = clipAnimationHelper.getSourceRect().width()
- / clipAnimationHelper.getTargetRect().width();
- float toTranslationY = clipAnimationHelper.getSourceRect().centerY()
- - clipAnimationHelper.getTargetRect().centerY();
+ LauncherState.ScaleAndTranslation toScaleAndTranslation = clipAnimationHelper
+ .getScaleAndTranslation();
+ float toScale = toScaleAndTranslation.scale;
+ float toTranslationY = toScaleAndTranslation.translationY;
if (launchingCenterTask) {
- TaskView centerTask = getTaskViewAt(centerTaskIndex);
- if (taskIndex - 1 >= 0) {
- TaskView adjacentTask = getTaskViewAt(taskIndex - 1);
- float[] scaleAndTranslation = getAdjacentScaleAndTranslation(centerTask,
- toScale, toTranslationY);
- scaleAndTranslation[1] = -scaleAndTranslation[1];
- anim.play(createAnimForChild(adjacentTask, scaleAndTranslation));
- anim.play(ObjectAnimator.ofFloat(adjacentTask, TaskView.FULLSCREEN_PROGRESS, 1));
- }
- if (taskIndex + 1 < getTaskViewCount()) {
- TaskView adjacentTask = getTaskViewAt(taskIndex + 1);
- float[] scaleAndTranslation = getAdjacentScaleAndTranslation(centerTask,
- toScale, toTranslationY);
- anim.play(createAnimForChild(adjacentTask, scaleAndTranslation));
- anim.play(ObjectAnimator.ofFloat(adjacentTask, TaskView.FULLSCREEN_PROGRESS, 1));
- }
+ RecentsView recentsView = tv.getRecentsView();
+ anim.play(ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, toScale));
+ anim.play(ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y, toTranslationY));
+ anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
} else {
// We are launching an adjacent task, so parallax the center and other adjacent task.
float displacementX = tv.getWidth() * (toScale - tv.getCurveScale());
@@ -1457,16 +1465,6 @@
return anim;
}
- private Animator createAnimForChild(TaskView child, float[] toScaleAndTranslation) {
- AnimatorSet anim = new AnimatorSet();
- anim.play(ObjectAnimator.ofFloat(child, TaskView.ZOOM_SCALE, toScaleAndTranslation[0]));
- anim.play(new PropertyListBuilder()
- .translationX(toScaleAndTranslation[1])
- .translationY(toScaleAndTranslation[2])
- .build(child));
- return anim;
- }
-
public PendingAnimation createTaskLauncherAnimation(TaskView tv, long duration) {
if (FeatureFlags.IS_DOGFOOD_BUILD && mPendingAnimation != null) {
throw new IllegalStateException("Another pending animation is still running");
@@ -1477,60 +1475,38 @@
return new PendingAnimation(new AnimatorSet());
}
- tv.setVisibility(INVISIBLE);
int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
- TaskViewDrawable drawable = new TaskViewDrawable(tv, this);
- getOverlay().add(drawable);
-
final boolean[] passedOverviewThreshold = new boolean[] {false};
- ObjectAnimator drawableAnim =
- ObjectAnimator.ofFloat(drawable, TaskViewDrawable.PROGRESS, 1, 0);
- drawableAnim.setInterpolator(LINEAR);
- drawableAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- TransformParams mParams = new TransformParams();
+ ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
+ progressAnim.setInterpolator(LINEAR);
+ progressAnim.addUpdateListener(animator -> {
+ // Once we pass a certain threshold, update the sysui flags to match the target
+ // tasks' flags
+ mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW,
+ animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD
+ ? targetSysUiFlags
+ : 0);
- @Override
- public void onAnimationUpdate(ValueAnimator animator) {
- // Once we pass a certain threshold, update the sysui flags to match the target
- // tasks' flags
- mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW,
- animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD
- ? targetSysUiFlags
- : 0);
- if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
- if (mRecentsAnimationWrapper.targetSet != null
- && drawable.getTaskView().isRunningTask()) {
- mParams.setProgress(1 - animator.getAnimatedFraction())
- .setSyncTransactionApplier(mSyncTransactionApplier)
- .setForLiveTile(true);
- drawable.getClipAnimationHelper().applyTransform(
- mRecentsAnimationWrapper.targetSet, mParams);
- } else {
- redrawLiveTile(true);
- }
- }
+ onTaskLaunchAnimationUpdate(animator.getAnimatedFraction(), tv);
- // Passing the threshold from taskview to fullscreen app will vibrate
- final boolean passed = animator.getAnimatedFraction() >=
- SUCCESS_TRANSITION_PROGRESS;
- if (passed != passedOverviewThreshold[0]) {
- passedOverviewThreshold[0] = passed;
- performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- }
+ // Passing the threshold from taskview to fullscreen app will vibrate
+ final boolean passed = animator.getAnimatedFraction() >=
+ SUCCESS_TRANSITION_PROGRESS;
+ if (passed != passedOverviewThreshold[0]) {
+ passedOverviewThreshold[0] = passed;
+ performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
});
- AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv,
- drawable.getClipAnimationHelper());
- anim.play(drawableAnim);
+ ClipAnimationHelper clipAnimationHelper = new ClipAnimationHelper(mActivity);
+ clipAnimationHelper.fromTaskThumbnailView(tv.getThumbnail(), this);
+ clipAnimationHelper.prepareAnimation(mActivity.getDeviceProfile(), true /* isOpening */);
+ AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv, clipAnimationHelper);
+ anim.play(progressAnim);
anim.setDuration(duration);
- Consumer<Boolean> onTaskLaunchFinish = (result) -> {
- onTaskLaunched(result);
- tv.setVisibility(VISIBLE);
- getOverlay().remove(drawable);
- };
+ Consumer<Boolean> onTaskLaunchFinish = this::onTaskLaunched;
mPendingAnimation = new PendingAnimation(anim);
mPendingAnimation.addEndListener((onEndListener) -> {
@@ -1556,6 +1532,9 @@
return mPendingAnimation;
}
+ protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) {
+ }
+
public abstract boolean shouldUseMultiWindowTaskSizeStrategy();
protected void onTaskLaunched(boolean success) {
@@ -1704,4 +1683,14 @@
return super::onTouchEvent;
}
}
+
+ public FloatingIconView getFloatingIconView(Launcher launcher, View view, RectF iconLocation) {
+ mFloatingIconView = FloatingIconView.getFloatingIconView(launcher, view,
+ true /* hideOriginal */, iconLocation, false /* isOpening */, mFloatingIconView);
+ return mFloatingIconView;
+ }
+
+ public ClipAnimationHelper getTempClipAnimationHelper() {
+ return mTempClipAnimationHelper;
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index 7e15d52..df5831b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -33,6 +33,7 @@
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -59,7 +60,7 @@
private final static ColorMatrix COLOR_MATRIX = new ColorMatrix();
private final static ColorMatrix SATURATION_COLOR_MATRIX = new ColorMatrix();
- private final static Rect EMPTY_RECT = new Rect();
+ private final static RectF EMPTY_RECT_F = new RectF();
public static final Property<TaskThumbnailView, Float> DIM_ALPHA =
new FloatProperty<TaskThumbnailView>("dimAlpha") {
@@ -74,8 +75,6 @@
}
};
- private final float mCornerRadius;
-
private final BaseActivity mActivity;
private final TaskOverlay mOverlay;
private final boolean mIsDarkTextTheme;
@@ -87,10 +86,9 @@
private final Matrix mMatrix = new Matrix();
private float mClipBottom = -1;
- private Rect mScaledInsets = new Rect();
- private Rect mCurrentDrawnInsets = new Rect();
- private float mCurrentDrawnCornerRadius;
- private boolean mIsRotated;
+ // Contains the portion of the thumbnail that is clipped when fullscreen progress = 0.
+ private RectF mClippedInsets = new RectF();
+ private TaskView.FullscreenDrawParams mFullscreenParams;
private Task mTask;
private ThumbnailData mThumbnailData;
@@ -110,7 +108,6 @@
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mCornerRadius = TaskCornerRadius.get(context);
mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
@@ -118,7 +115,7 @@
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
- setCurrentDrawnInsetsAndRadius(EMPTY_RECT, mCornerRadius);
+ mFullscreenParams = new TaskView.FullscreenDrawParams(TaskCornerRadius.get(context));
}
public void bind(Task task) {
@@ -201,30 +198,30 @@
@Override
protected void onDraw(Canvas canvas) {
+ RectF currentDrawnInsets = mFullscreenParams.mCurrentDrawnInsets;
+ canvas.save();
+ canvas.translate(currentDrawnInsets.left, currentDrawnInsets.top);
+ canvas.scale(mFullscreenParams.mScale, mFullscreenParams.mScale);
// Draw the insets if we're being drawn fullscreen (we do this for quick switch).
drawOnCanvas(canvas,
- -mCurrentDrawnInsets.left,
- -mCurrentDrawnInsets.top,
- getMeasuredWidth() + mCurrentDrawnInsets.right,
- getMeasuredHeight() + mCurrentDrawnInsets.bottom,
- mCurrentDrawnCornerRadius);
+ -currentDrawnInsets.left,
+ -currentDrawnInsets.top,
+ getMeasuredWidth() + currentDrawnInsets.right,
+ getMeasuredHeight() + currentDrawnInsets.bottom,
+ mFullscreenParams.mCurrentDrawnCornerRadius);
+ canvas.restore();
}
- public Rect getInsetsToDrawInFullscreen(boolean isMultiWindowMode) {
- // Don't show insets in the wrong orientation or in multi window mode.
- return mIsRotated || isMultiWindowMode ? EMPTY_RECT : mScaledInsets;
+ public RectF getInsetsToDrawInFullscreen(boolean isMultiWindowMode) {
+ // Don't show insets in multi window mode.
+ return isMultiWindowMode ? EMPTY_RECT_F : mClippedInsets;
}
- public void setCurrentDrawnInsetsAndRadius(Rect insets, float radius) {
- mCurrentDrawnInsets.set(insets);
- mCurrentDrawnCornerRadius = radius;
+ public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams) {
+ mFullscreenParams = fullscreenParams;
invalidate();
}
- public float getCornerRadius() {
- return mCornerRadius;
- }
-
public void drawOnCanvas(Canvas canvas, float x, float y, float width, float height,
float cornerRadius) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
@@ -275,7 +272,7 @@
}
private void updateThumbnailMatrix() {
- mIsRotated = false;
+ boolean isRotated = false;
mClipBottom = -1;
if (mBitmapShader != null && mThumbnailData != null) {
float scale = mThumbnailData.scale;
@@ -296,30 +293,28 @@
final Configuration configuration =
getContext().getResources().getConfiguration();
// Rotate the screenshot if not in multi-window mode
- mIsRotated = FeatureFlags.OVERVIEW_USE_SCREENSHOT_ORIENTATION &&
+ isRotated = FeatureFlags.OVERVIEW_USE_SCREENSHOT_ORIENTATION &&
configuration.orientation != mThumbnailData.orientation &&
!mActivity.isInMultiWindowMode() &&
mThumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN;
// Scale the screenshot to always fit the width of the card.
- thumbnailScale = mIsRotated
+ thumbnailScale = isRotated
? getMeasuredWidth() / thumbnailHeight
: getMeasuredWidth() / thumbnailWidth;
}
- mScaledInsets.set(thumbnailInsets);
- Utilities.scaleRect(mScaledInsets, thumbnailScale);
-
- if (mIsRotated) {
+ if (isRotated) {
int rotationDir = profile.isVerticalBarLayout() && !profile.isSeascape() ? -1 : 1;
mMatrix.setRotate(90 * rotationDir);
int newLeftInset = rotationDir == 1 ? thumbnailInsets.bottom : thumbnailInsets.top;
int newTopInset = rotationDir == 1 ? thumbnailInsets.left : thumbnailInsets.right;
- mMatrix.postTranslate(-newLeftInset * scale, -newTopInset * scale);
+ mClippedInsets.offsetTo(newLeftInset * scale, newTopInset * scale);
if (rotationDir == -1) {
// Crop the right/bottom side of the screenshot rather than left/top
float excessHeight = thumbnailWidth * thumbnailScale - getMeasuredHeight();
- mMatrix.postTranslate(0, -excessHeight);
+ mClippedInsets.offset(0, excessHeight);
}
+ mMatrix.postTranslate(-mClippedInsets.left, -mClippedInsets.top);
// Move the screenshot to the thumbnail window (rotation moved it out).
if (rotationDir == 1) {
mMatrix.postTranslate(mThumbnailData.thumbnail.getHeight(), 0);
@@ -327,13 +322,28 @@
mMatrix.postTranslate(0, mThumbnailData.thumbnail.getWidth());
}
} else {
- mMatrix.setTranslate(-mThumbnailData.insets.left * scale,
- -mThumbnailData.insets.top * scale);
+ mClippedInsets.offsetTo(thumbnailInsets.left * scale, thumbnailInsets.top * scale);
+ mMatrix.setTranslate(-mClippedInsets.left, -mClippedInsets.top);
}
+
+ final float widthWithInsets;
+ final float heightWithInsets;
+ if (isRotated) {
+ widthWithInsets = mThumbnailData.thumbnail.getHeight() * thumbnailScale;
+ heightWithInsets = mThumbnailData.thumbnail.getWidth() * thumbnailScale;
+ } else {
+ widthWithInsets = mThumbnailData.thumbnail.getWidth() * thumbnailScale;
+ heightWithInsets = mThumbnailData.thumbnail.getHeight() * thumbnailScale;
+ }
+ mClippedInsets.left *= thumbnailScale;
+ mClippedInsets.top *= thumbnailScale;
+ mClippedInsets.right = widthWithInsets - mClippedInsets.left - getMeasuredWidth();
+ mClippedInsets.bottom = heightWithInsets - mClippedInsets.top - getMeasuredHeight();
+
mMatrix.postScale(thumbnailScale, thumbnailScale);
mBitmapShader.setLocalMatrix(mMatrix);
- float bitmapHeight = Math.max((mIsRotated ? thumbnailWidth : thumbnailHeight)
+ float bitmapHeight = Math.max((isRotated ? thumbnailWidth : thumbnailHeight)
* thumbnailScale, 0);
if (Math.round(bitmapHeight) < getMeasuredHeight()) {
mClipBottom = bitmapHeight;
@@ -341,7 +351,7 @@
mPaint.setShader(mBitmapShader);
}
- if (mIsRotated) {
+ if (isRotated) {
// The overlay doesn't really work when the screenshot is rotated, so don't add it.
mOverlay.reset();
} else {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 6cd46d9..053b738 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -32,6 +32,7 @@
import android.content.res.Resources;
import android.graphics.Outline;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -102,19 +103,6 @@
private static final List<Rect> SYSTEM_GESTURE_EXCLUSION_RECT =
Collections.singletonList(new Rect());
- public static final Property<TaskView, Float> ZOOM_SCALE =
- new FloatProperty<TaskView>("zoomScale") {
- @Override
- public void setValue(TaskView taskView, float v) {
- taskView.setZoomScale(v);
- }
-
- @Override
- public Float get(TaskView taskView) {
- return taskView.mZoomScale;
- }
- };
-
public static final FloatProperty<TaskView> FULLSCREEN_PROGRESS =
new FloatProperty<TaskView>("fullscreenProgress") {
@Override
@@ -164,9 +152,8 @@
private IconView mIconView;
private DigitalWellBeingToast mDigitalWellBeingToast;
private float mCurveScale;
- private float mZoomScale;
private float mFullscreenProgress;
- private final Rect mCurrentDrawnInsets = new Rect();
+ private final FullscreenDrawParams mCurrentFullscreenParams;
private final float mCornerRadius;
private final float mWindowCornerRadius;
private final BaseDraggingActivity mActivity;
@@ -214,7 +201,8 @@
});
mCornerRadius = TaskCornerRadius.get(context);
mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources());
- mOutlineProvider = new TaskOutlineProvider(getResources(), mCornerRadius);
+ mCurrentFullscreenParams = new FullscreenDrawParams(mCornerRadius);
+ mOutlineProvider = new TaskOutlineProvider(getResources(), mCurrentFullscreenParams);
setOutlineProvider(mOutlineProvider);
}
@@ -457,7 +445,6 @@
private void resetViewTransforms() {
setCurveScale(1);
- setZoomScale(1);
setTranslationX(0f);
setTranslationY(0f);
setTranslationZ(0);
@@ -473,7 +460,12 @@
@Override
public void onRecycle() {
resetViewTransforms();
- setFullscreenProgress(0);
+ // Clear any references to the thumbnail (it will be re-read either from the cache or the
+ // system on next bind)
+ mSnapshotView.setThumbnail(mTask, null);
+ if (mTask != null) {
+ mTask.thumbnail = null;
+ }
}
@Override
@@ -520,13 +512,8 @@
return mCurveScale;
}
- public void setZoomScale(float adjacentScale) {
- mZoomScale = adjacentScale;
- onScaleChanged();
- }
-
private void onScaleChanged() {
- float scale = mCurveScale * mZoomScale;
+ float scale = mCurveScale;
setScaleX(scale);
setScaleY(scale);
}
@@ -540,26 +527,26 @@
private static final class TaskOutlineProvider extends ViewOutlineProvider {
private final int mMarginTop;
- private final Rect mInsets = new Rect();
- private float mRadius;
+ private FullscreenDrawParams mFullscreenParams;
- TaskOutlineProvider(Resources res, float radius) {
+ TaskOutlineProvider(Resources res, FullscreenDrawParams fullscreenParams) {
mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
- mRadius = radius;
+ mFullscreenParams = fullscreenParams;
}
- public void setCurrentDrawnInsetsAndRadius(Rect insets, float radius) {
- mInsets.set(insets);
- mRadius = radius;
+ public void setFullscreenParams(FullscreenDrawParams params) {
+ mFullscreenParams = params;
}
@Override
public void getOutline(View view, Outline outline) {
- outline.setRoundRect(-mInsets.left,
- mMarginTop - mInsets.top,
- view.getWidth() + mInsets.right,
- view.getHeight() + mInsets.bottom,
- mRadius);
+ RectF insets = mFullscreenParams.mCurrentDrawnInsets;
+ float scale = mFullscreenParams.mScale;
+ outline.setRoundRect(0,
+ (int) (mMarginTop * scale),
+ (int) ((insets.left + view.getWidth() + insets.right) * scale),
+ (int) ((insets.top + view.getHeight() + insets.bottom) * scale),
+ mFullscreenParams.mCurrentDrawnCornerRadius);
}
}
@@ -658,17 +645,25 @@
TaskThumbnailView thumbnail = getThumbnail();
boolean isMultiWindowMode = mActivity.getDeviceProfile().isMultiWindowMode;
- Rect insets = thumbnail.getInsetsToDrawInFullscreen(isMultiWindowMode);
- mCurrentDrawnInsets.set((int) (insets.left * mFullscreenProgress),
- (int) (insets.top * mFullscreenProgress),
- (int) (insets.right * mFullscreenProgress),
- (int) (insets.bottom * mFullscreenProgress));
+ RectF insets = thumbnail.getInsetsToDrawInFullscreen(isMultiWindowMode);
+ float currentInsetsLeft = insets.left * mFullscreenProgress;
+ float currentInsetsRight = insets.right * mFullscreenProgress;
+ mCurrentFullscreenParams.setInsets(currentInsetsLeft,
+ insets.top * mFullscreenProgress,
+ currentInsetsRight,
+ insets.bottom * mFullscreenProgress);
float fullscreenCornerRadius = isMultiWindowMode ? 0 : mWindowCornerRadius;
- float cornerRadius = Utilities.mapRange(mFullscreenProgress, mCornerRadius,
- fullscreenCornerRadius) / getRecentsView().getScaleX();
+ mCurrentFullscreenParams.setCornerRadius(Utilities.mapRange(mFullscreenProgress,
+ mCornerRadius, fullscreenCornerRadius) / getRecentsView().getScaleX());
+ // We scaled the thumbnail to fit the content (excluding insets) within task view width.
+ // Now that we are drawing left/right insets again, we need to scale down to fit them.
+ if (getWidth() > 0) {
+ mCurrentFullscreenParams.setScale(getWidth()
+ / (getWidth() + currentInsetsLeft + currentInsetsRight));
+ }
- thumbnail.setCurrentDrawnInsetsAndRadius(mCurrentDrawnInsets, cornerRadius);
- mOutlineProvider.setCurrentDrawnInsetsAndRadius(mCurrentDrawnInsets, cornerRadius);
+ thumbnail.setFullscreenParams(mCurrentFullscreenParams);
+ mOutlineProvider.setFullscreenParams(mCurrentFullscreenParams);
invalidateOutline();
}
@@ -686,4 +681,30 @@
}
return mShowScreenshot;
}
+
+ /**
+ * We update and subsequently draw these in {@link #setFullscreenProgress(float)}.
+ */
+ static class FullscreenDrawParams {
+ RectF mCurrentDrawnInsets = new RectF();
+ float mCurrentDrawnCornerRadius;
+ /** The current scale we apply to the thumbnail to adjust for new left/right insets. */
+ float mScale = 1;
+
+ public FullscreenDrawParams(float cornerRadius) {
+ setCornerRadius(cornerRadius);
+ }
+
+ public void setInsets(float left, float top, float right, float bottom) {
+ mCurrentDrawnInsets.set(left, top, right, bottom);
+ }
+
+ public void setCornerRadius(float cornerRadius) {
+ mCurrentDrawnCornerRadius = cornerRadius;
+ }
+
+ public void setScale(float scale) {
+ mScale = scale;
+ }
+ }
}
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index 1d1c272..ecf1b0a 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -35,30 +35,42 @@
android:focusable="false"
android:importantForAccessibility="no" />
- <com.android.quickstep.views.DigitalWellBeingToast
- android:id="@+id/digital_well_being_toast"
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="48dp"
- android:importantForAccessibility="noHideDescendants"
- android:background="@drawable/bg_wellbeing_toast"
- android:layout_gravity="bottom"
- android:gravity="center"
- android:visibility="gone">
- <ImageView
- android:id="@+id/digital_well_being_hourglass"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_marginEnd="8dp"
- android:src="@drawable/ic_hourglass_top"
- />
- <TextView
- android:id="@+id/digital_well_being_remaining_time"
- android:layout_width="wrap_content"
- android:layout_height="24dp"
- android:fontFamily="sans-serif"
- android:textSize="14sp"
- android:textColor="@android:color/white"
- android:gravity="center_vertical"
- />
- </com.android.quickstep.views.DigitalWellBeingToast>
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_gravity="bottom|center_horizontal">
+ <FrameLayout
+ android:id="@+id/proactive_suggest_container"
+ android:layout_width="match_parent"
+ android:layout_height="36dp"
+ android:gravity="center"
+ android:visibility="gone"
+ />
+ <com.android.quickstep.views.DigitalWellBeingToast
+ android:id="@+id/digital_well_being_toast"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:importantForAccessibility="noHideDescendants"
+ android:background="@drawable/bg_wellbeing_toast"
+ android:gravity="center"
+ android:visibility="gone">
+ <ImageView
+ android:id="@+id/digital_well_being_hourglass"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_marginEnd="8dp"
+ android:src="@drawable/ic_hourglass_top"
+ />
+ <TextView
+ android:id="@+id/digital_well_being_remaining_time"
+ android:layout_width="wrap_content"
+ android:layout_height="24dp"
+ android:fontFamily="sans-serif"
+ android:textSize="14sp"
+ android:textColor="@android:color/white"
+ android:gravity="center_vertical"
+ />
+ </com.android.quickstep.views.DigitalWellBeingToast>
+ </LinearLayout>
</com.android.quickstep.views.TaskView>
\ No newline at end of file
diff --git a/quickstep/res/values-af/strings.xml b/quickstep/res/values-af/strings.xml
index 88954b2..64b8e2c 100644
--- a/quickstep/res/values-af/strings.xml
+++ b/quickstep/res/values-af/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minuut"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> oor vandag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Programvoorstelle"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alle programme"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Jou voorspelde programme"</string>
</resources>
diff --git a/quickstep/res/values-am/strings.xml b/quickstep/res/values-am/strings.xml
index 34fb3be..3daa922 100644
--- a/quickstep/res/values-am/strings.xml
+++ b/quickstep/res/values-am/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>፣ <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 ደቂቃ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ዛሬ <xliff:g id="TIME">%1$s</xliff:g> ቀርቷል"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"የመተግበሪያ ጥቆማዎች"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"ሁሉም መተግበሪያዎች"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"የእርስዎ የሚገመቱ መተግበሪያዎች"</string>
</resources>
diff --git a/quickstep/res/values-ar/strings.xml b/quickstep/res/values-ar/strings.xml
index ebdcf73..73c7c5c 100644
--- a/quickstep/res/values-ar/strings.xml
+++ b/quickstep/res/values-ar/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>، <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"أقل من دقيقة"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"يتبقى اليوم <xliff:g id="TIME">%1$s</xliff:g>."</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"اقتراحات التطبيقات"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"جميع التطبيقات"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"تطبيقاتك المتوقّعة"</string>
</resources>
diff --git a/quickstep/res/values-az/strings.xml b/quickstep/res/values-az/strings.xml
index 02312f4..aa8fa53 100644
--- a/quickstep/res/values-az/strings.xml
+++ b/quickstep/res/values-az/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 dəq"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Bu gün <xliff:g id="TIME">%1$s</xliff:g> qaldı"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Tətbiq təklifləri"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Bütün tətbiqlər"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Təklif edilən tətbiqlər"</string>
</resources>
diff --git a/quickstep/res/values-b+sr+Latn/strings.xml b/quickstep/res/values-b+sr+Latn/strings.xml
index baab4a1..fbbe9d2 100644
--- a/quickstep/res/values-b+sr+Latn/strings.xml
+++ b/quickstep/res/values-b+sr+Latn/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Još <xliff:g id="TIME">%1$s</xliff:g> danas"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Predlozi aplikacija"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Sve aplikacije"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Predviđene aplikacije"</string>
</resources>
diff --git a/quickstep/res/values-be/strings.xml b/quickstep/res/values-be/strings.xml
index b28f377..c4a2772 100644
--- a/quickstep/res/values-be/strings.xml
+++ b/quickstep/res/values-be/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 хв"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Сёння засталося <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Прапановы праграм"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Усе праграмы"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Вашы праграмы з падказак"</string>
</resources>
diff --git a/quickstep/res/values-bg/strings.xml b/quickstep/res/values-bg/strings.xml
index 0475c0d..9e8c54a 100644
--- a/quickstep/res/values-bg/strings.xml
+++ b/quickstep/res/values-bg/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 мин"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Оставащо време днес: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Предложения за приложения"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Всички приложения"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Предвидени приложения"</string>
</resources>
diff --git a/quickstep/res/values-bn/strings.xml b/quickstep/res/values-bn/strings.xml
index e6764e0..57f92e5 100644
--- a/quickstep/res/values-bn/strings.xml
+++ b/quickstep/res/values-bn/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< ১ মি."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"আজকে <xliff:g id="TIME">%1$s</xliff:g> বাকি আছে"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"অ্যাপের সাজেশন"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"সব অ্যাপ"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"আপনার প্রয়োজন হতে পারে এমন অ্যাপ"</string>
</resources>
diff --git a/quickstep/res/values-bs/strings.xml b/quickstep/res/values-bs/strings.xml
index 77b4c46..7968f7c 100644
--- a/quickstep/res/values-bs/strings.xml
+++ b/quickstep/res/values-bs/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Preostalo vrijeme: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Prijedlozi za aplikacije"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Sve aplikacije"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Predviđene aplikacije"</string>
</resources>
diff --git a/quickstep/res/values-ca/strings.xml b/quickstep/res/values-ca/strings.xml
index 484f445..6420aa8 100644
--- a/quickstep/res/values-ca/strings.xml
+++ b/quickstep/res/values-ca/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>; <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minut"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"temps restant avui: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Suggeriments d\'aplicacions"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Totes les aplicacions"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Prediccions d\'aplicacions"</string>
</resources>
diff --git a/quickstep/res/values-cs/strings.xml b/quickstep/res/values-cs/strings.xml
index a698d49..194ff87 100644
--- a/quickstep/res/values-cs/strings.xml
+++ b/quickstep/res/values-cs/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minuta"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"dnes zbývá: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Návrhy aplikací"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Všechny aplikace"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Vaše předpovídané aplikace"</string>
</resources>
diff --git a/quickstep/res/values-da/strings.xml b/quickstep/res/values-da/strings.xml
index b3e8524..b43a76e 100644
--- a/quickstep/res/values-da/strings.xml
+++ b/quickstep/res/values-da/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> tilbage i dag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Appforslag"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alle apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Dine foreslåede apps"</string>
</resources>
diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml
index 10e4fd7..7f4e56d 100644
--- a/quickstep/res/values-de/strings.xml
+++ b/quickstep/res/values-de/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Heute noch <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App-Vorschläge"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alle Apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"App-Vorschläge für dich"</string>
</resources>
diff --git a/quickstep/res/values-el/strings.xml b/quickstep/res/values-el/strings.xml
index 6ef1e94..87268df 100644
--- a/quickstep/res/values-el/strings.xml
+++ b/quickstep/res/values-el/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 λ."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Απομένουν <xliff:g id="TIME">%1$s</xliff:g> σήμερα"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Προτάσεις εφαρμογών"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Όλες οι εφαρμογές"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Προβλέψεις εφαρμογών"</string>
</resources>
diff --git a/quickstep/res/values-en-rAU/strings.xml b/quickstep/res/values-en-rAU/strings.xml
index d640b63..2d1418e 100644
--- a/quickstep/res/values-en-rAU/strings.xml
+++ b/quickstep/res/values-en-rAU/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minute"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> left today"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App suggestions"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"All apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Your predicted apps"</string>
</resources>
diff --git a/quickstep/res/values-en-rGB/strings.xml b/quickstep/res/values-en-rGB/strings.xml
index d640b63..2d1418e 100644
--- a/quickstep/res/values-en-rGB/strings.xml
+++ b/quickstep/res/values-en-rGB/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minute"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> left today"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App suggestions"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"All apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Your predicted apps"</string>
</resources>
diff --git a/quickstep/res/values-en-rIN/strings.xml b/quickstep/res/values-en-rIN/strings.xml
index d640b63..2d1418e 100644
--- a/quickstep/res/values-en-rIN/strings.xml
+++ b/quickstep/res/values-en-rIN/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minute"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> left today"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App suggestions"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"All apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Your predicted apps"</string>
</resources>
diff --git a/quickstep/res/values-es-rUS/strings.xml b/quickstep/res/values-es-rUS/strings.xml
index c93e8fc..5f5d0bd 100644
--- a/quickstep/res/values-es-rUS/strings.xml
+++ b/quickstep/res/values-es-rUS/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> (<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minuto"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Tiempo restante: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugerencias de apps"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Todas las apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Predicción de tus apps"</string>
</resources>
diff --git a/quickstep/res/values-es/strings.xml b/quickstep/res/values-es/strings.xml
index 3a588e5..329286b 100644
--- a/quickstep/res/values-es/strings.xml
+++ b/quickstep/res/values-es/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> (<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"<1 minuto"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"tiempo restante: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugerencias de aplicaciones"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Todas las aplicaciones"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Predicción de aplicaciones"</string>
</resources>
diff --git a/quickstep/res/values-et/strings.xml b/quickstep/res/values-et/strings.xml
index 7032765..0577b0f 100644
--- a/quickstep/res/values-et/strings.xml
+++ b/quickstep/res/values-et/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minut"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Tääna jäänud <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Rakenduste soovitused"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Kõik rakendused"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Teie ennustatud rakendused"</string>
</resources>
diff --git a/quickstep/res/values-eu/strings.xml b/quickstep/res/values-eu/strings.xml
index 66e08b9..c2d149e 100644
--- a/quickstep/res/values-eu/strings.xml
+++ b/quickstep/res/values-eu/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> (<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> gelditzen dira gaur"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Iradokitako aplikazioak"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Aplikazio guztiak"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Lagungarri izan dakizkizukeen aplikazioak"</string>
</resources>
diff --git a/quickstep/res/values-fa/strings.xml b/quickstep/res/values-fa/strings.xml
index 112d04c..cc26695 100644
--- a/quickstep/res/values-fa/strings.xml
+++ b/quickstep/res/values-fa/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>، <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< ۱ دقیقه"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> باقیمانده برای امروز"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"برنامههای پیشنهادی"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"همه برنامهها"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"برنامههای پیشبینیشده"</string>
</resources>
diff --git a/quickstep/res/values-fi/strings.xml b/quickstep/res/values-fi/strings.xml
index 6a0a359..f43433e 100644
--- a/quickstep/res/values-fi/strings.xml
+++ b/quickstep/res/values-fi/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> jäljellä tänään"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sovellusehdotukset"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Kaikki sovellukset"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Sovellusennusteet"</string>
</resources>
diff --git a/quickstep/res/values-fr-rCA/strings.xml b/quickstep/res/values-fr-rCA/strings.xml
index 248a5da..a9a1cff 100644
--- a/quickstep/res/values-fr-rCA/strings.xml
+++ b/quickstep/res/values-fr-rCA/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> : <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Il reste <xliff:g id="TIME">%1$s</xliff:g> aujourd\'hui"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Suggestions d\'applications"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Toutes les applications"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Vos prédictions d\'applications"</string>
</resources>
diff --git a/quickstep/res/values-fr/strings.xml b/quickstep/res/values-fr/strings.xml
index 338d9ba..5394f49 100644
--- a/quickstep/res/values-fr/strings.xml
+++ b/quickstep/res/values-fr/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Encore <xliff:g id="TIME">%1$s</xliff:g> aujourd\'hui"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Suggestions d\'applications"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Toutes les applications"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Vos applications prévues"</string>
</resources>
diff --git a/quickstep/res/values-gl/strings.xml b/quickstep/res/values-gl/strings.xml
index d6ddf3c..c6698bb 100644
--- a/quickstep/res/values-gl/strings.xml
+++ b/quickstep/res/values-gl/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> (<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"<1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Tempo restante hoxe <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Suxestións de aplicacións"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Todas as aplicacións"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"As túas aplicacións preditas"</string>
</resources>
diff --git a/quickstep/res/values-gu/strings.xml b/quickstep/res/values-gu/strings.xml
index 4493e3b..660ad87 100644
--- a/quickstep/res/values-gu/strings.xml
+++ b/quickstep/res/values-gu/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 મિનિટ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> આજે બાકી"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ઍપ સૂચનો"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"બધી ઍપ"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"તમારી પૂર્વાનુમાનિત ઍપ"</string>
</resources>
diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml
index 3c53cce..0467af4 100644
--- a/quickstep/res/values-hi/strings.xml
+++ b/quickstep/res/values-hi/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"<1 मिनट"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"आज <xliff:g id="TIME">%1$s</xliff:g> और चलेगा"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ऐप्लिकेशन के सुझाव"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"सभी ऐप्लिकेशन"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"आपके काम के ऐप्लिकेशन"</string>
</resources>
diff --git a/quickstep/res/values-hr/strings.xml b/quickstep/res/values-hr/strings.xml
index 103710f..ab56e57 100644
--- a/quickstep/res/values-hr/strings.xml
+++ b/quickstep/res/values-hr/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Još <xliff:g id="TIME">%1$s</xliff:g> danas"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Predložene aplikacije"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Sve aplikacije"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Vaše predviđene aplikacije"</string>
</resources>
diff --git a/quickstep/res/values-hu/strings.xml b/quickstep/res/values-hu/strings.xml
index 22b2380..dec6ea0 100644
--- a/quickstep/res/values-hu/strings.xml
+++ b/quickstep/res/values-hu/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 perc"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Ma még <xliff:g id="TIME">%1$s</xliff:g> van hátra"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Alkalmazásjavaslatok"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Az összes alkalmazás"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Várható alkalmazások"</string>
</resources>
diff --git a/quickstep/res/values-hy/strings.xml b/quickstep/res/values-hy/strings.xml
index 910265a..1656a14 100644
--- a/quickstep/res/values-hy/strings.xml
+++ b/quickstep/res/values-hy/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 ր"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Այսօր մնացել է՝ <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Առաջարկվող հավելվածներ"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Բոլոր հավելվածները"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Ձեր կանխատեսված հավելվածները"</string>
</resources>
diff --git a/quickstep/res/values-in/strings.xml b/quickstep/res/values-in/strings.xml
index a7749df..6824d16 100644
--- a/quickstep/res/values-in/strings.xml
+++ b/quickstep/res/values-in/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 menit"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> tersisa hari ini"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Saran aplikasi"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Semua aplikasi"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Aplikasi yang diprediksi"</string>
</resources>
diff --git a/quickstep/res/values-is/strings.xml b/quickstep/res/values-is/strings.xml
index ba0c672..f60a2c6 100644
--- a/quickstep/res/values-is/strings.xml
+++ b/quickstep/res/values-is/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 mín."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> eftir í dag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Tillögur að forritum"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Öll forrit"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Spáð forrit"</string>
</resources>
diff --git a/quickstep/res/values-it/strings.xml b/quickstep/res/values-it/strings.xml
index 746443e..559fdb4 100644
--- a/quickstep/res/values-it/strings.xml
+++ b/quickstep/res/values-it/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Rimanente oggi: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App suggerite"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Tutte le app"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Le app previste"</string>
</resources>
diff --git a/quickstep/res/values-iw/strings.xml b/quickstep/res/values-iw/strings.xml
index 96a8adc..58cab4e 100644
--- a/quickstep/res/values-iw/strings.xml
+++ b/quickstep/res/values-iw/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< דקה"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"הזמן שנותר להיום: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"הצעות לאפליקציות"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"כל האפליקציות"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"האפליקציות החזויות שלך"</string>
</resources>
diff --git a/quickstep/res/values-ja/strings.xml b/quickstep/res/values-ja/strings.xml
index 5484ae1..d3fecde 100644
--- a/quickstep/res/values-ja/strings.xml
+++ b/quickstep/res/values-ja/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>、<xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"1 分未満"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"今日はあと <xliff:g id="TIME">%1$s</xliff:g>です"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"アプリの候補"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"すべてのアプリ"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"予測されたアプリ"</string>
</resources>
diff --git a/quickstep/res/values-ka/strings.xml b/quickstep/res/values-ka/strings.xml
index 9218fb8..67b03a7 100644
--- a/quickstep/res/values-ka/strings.xml
+++ b/quickstep/res/values-ka/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 წუთი"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"დღეს დარჩენილია <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"აპების შემოთავაზებები"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"ყველა აპი"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"თქვენი პროგნოზირებული აპები"</string>
</resources>
diff --git a/quickstep/res/values-kk/strings.xml b/quickstep/res/values-kk/strings.xml
index 0766150..a9fcbed 100644
--- a/quickstep/res/values-kk/strings.xml
+++ b/quickstep/res/values-kk/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 мин"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Бүгін <xliff:g id="TIME">%1$s</xliff:g> қалды"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Қолданба ұсыныстары"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Барлық қолданбалар"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Ұсынылатын қолданбалар"</string>
</resources>
diff --git a/quickstep/res/values-km/strings.xml b/quickstep/res/values-km/strings.xml
index 8737ae8..c422041 100644
--- a/quickstep/res/values-km/strings.xml
+++ b/quickstep/res/values-km/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 នាទី"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"នៅសល់ <xliff:g id="TIME">%1$s</xliff:g> ទៀតនៅថ្ងៃនេះ"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ការណែនាំកម្មវិធី"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"កម្មវិធីទាំងអស់"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"កម្មវិធីដែលបានព្យាកររបស់អ្នក"</string>
</resources>
diff --git a/quickstep/res/values-kn/strings.xml b/quickstep/res/values-kn/strings.xml
index 099957c..5278261 100644
--- a/quickstep/res/values-kn/strings.xml
+++ b/quickstep/res/values-kn/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 ನಿ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ಇಂದು <xliff:g id="TIME">%1$s</xliff:g> ಸಮಯ ಉಳಿದಿದೆ"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ಆ್ಯಪ್ ಸಲಹೆಗಳು"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"ಎಲ್ಲಾ ಆ್ಯಪ್ಗಳು"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"ನಿಮ್ಮ ಸಂಭವನೀಯ ಆ್ಯಪ್ಗಳು"</string>
</resources>
diff --git a/quickstep/res/values-ko/strings.xml b/quickstep/res/values-ko/strings.xml
index 9543e79..7a8e6a1 100644
--- a/quickstep/res/values-ko/strings.xml
+++ b/quickstep/res/values-ko/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1분"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"오늘 <xliff:g id="TIME">%1$s</xliff:g> 남음"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"앱 추천"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"모든 앱"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"추천 앱"</string>
</resources>
diff --git a/quickstep/res/values-ky/strings.xml b/quickstep/res/values-ky/strings.xml
index d1d2d20..4018e57 100644
--- a/quickstep/res/values-ky/strings.xml
+++ b/quickstep/res/values-ky/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 мүнөт"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Бүгүн <xliff:g id="TIME">%1$s</xliff:g> мүнөт калды"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Колдонмо сунуштары"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Бардык колдонмолор"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Божомолдонгон колдонмолоруңуз"</string>
</resources>
diff --git a/quickstep/res/values-lo/strings.xml b/quickstep/res/values-lo/strings.xml
index aba4156..e406b70 100644
--- a/quickstep/res/values-lo/strings.xml
+++ b/quickstep/res/values-lo/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 ນາທີ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ເຫຼືອ <xliff:g id="TIME">%1$s</xliff:g> ມື້ນີ້"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ການແນະນຳແອັບ"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"ແອັບທັງໝົດ"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"ແອັບທີ່ຄາດເດົາໄວ້ແລ້ວຂອງທ່ານ"</string>
</resources>
diff --git a/quickstep/res/values-lt/strings.xml b/quickstep/res/values-lt/strings.xml
index 933b3f0..ed1fc37 100644
--- a/quickstep/res/values-lt/strings.xml
+++ b/quickstep/res/values-lt/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Šiandien liko: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Programų pasiūlymai"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Visos programos"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Numatomos programos"</string>
</resources>
diff --git a/quickstep/res/values-lv/strings.xml b/quickstep/res/values-lv/strings.xml
index 1e2ed00..85ce0e0 100644
--- a/quickstep/res/values-lv/strings.xml
+++ b/quickstep/res/values-lv/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"<1 minūte"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Šodien atlicis: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Ieteicamās lietotnes"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Visas lietotnes"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Jūsu prognozētās lietotnes"</string>
</resources>
diff --git a/quickstep/res/values-mk/strings.xml b/quickstep/res/values-mk/strings.xml
index 7a6c094..9f11521 100644
--- a/quickstep/res/values-mk/strings.xml
+++ b/quickstep/res/values-mk/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 минута"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Уште <xliff:g id="TIME">%1$s</xliff:g> за денес"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Предлози за апликации"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Сите апликации"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Вашите предвидени апликации"</string>
</resources>
diff --git a/quickstep/res/values-ml/strings.xml b/quickstep/res/values-ml/strings.xml
index b5eac1d..2e02e80 100644
--- a/quickstep/res/values-ml/strings.xml
+++ b/quickstep/res/values-ml/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 മിനിറ്റ്"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ഇന്ന് <xliff:g id="TIME">%1$s</xliff:g> ശേഷിക്കുന്നു"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ആപ്പ് നിർദ്ദേശങ്ങൾ"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"എല്ലാ ആപ്പുകളും"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"നിങ്ങളുടെ പ്രവചിക്കപ്പെട്ട ആപ്പുകൾ"</string>
</resources>
diff --git a/quickstep/res/values-mn/strings.xml b/quickstep/res/values-mn/strings.xml
index a105ef1..5de8602 100644
--- a/quickstep/res/values-mn/strings.xml
+++ b/quickstep/res/values-mn/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 минут"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Өнөөдөр <xliff:g id="TIME">%1$s</xliff:g> үлдсэн"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Аппын зөвлөмж"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Бүх апп"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Таны таамагласан аппууд"</string>
</resources>
diff --git a/quickstep/res/values-mr/strings.xml b/quickstep/res/values-mr/strings.xml
index bf725e3..1ca558a 100644
--- a/quickstep/res/values-mr/strings.xml
+++ b/quickstep/res/values-mr/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"१मिहून कमी"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"आज <xliff:g id="TIME">%1$s</xliff:g>शिल्लक आहे"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"अॅप सूचना"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"सर्व अॅप्स"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"तुमची पूर्वानुमानीत अॅप्स"</string>
</resources>
diff --git a/quickstep/res/values-ms/strings.xml b/quickstep/res/values-ms/strings.xml
index 2e3f236..2542963 100644
--- a/quickstep/res/values-ms/strings.xml
+++ b/quickstep/res/values-ms/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minit"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> lagi hari ini"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Cadangan apl"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Semua apl"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Apl ramalan anda"</string>
</resources>
diff --git a/quickstep/res/values-my/strings.xml b/quickstep/res/values-my/strings.xml
index 7b93125..7683e05 100644
--- a/quickstep/res/values-my/strings.xml
+++ b/quickstep/res/values-my/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>၊ <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< ၁ မိနစ်"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ယနေ့ <xliff:g id="TIME">%1$s</xliff:g> ခု ကျန်သည်"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"အက်ပ်အကြံပြုချက်များ"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"အက်ပ်အားလုံး"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"သင်၏ ခန့်မှန်းအက်ပ်များ"</string>
</resources>
diff --git a/quickstep/res/values-nb/strings.xml b/quickstep/res/values-nb/strings.xml
index 74f43d2..01bbb6a 100644
--- a/quickstep/res/values-nb/strings.xml
+++ b/quickstep/res/values-nb/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minutt"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> gjenstår i dag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Appanbefalinger"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alle apper"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Forslag til apper"</string>
</resources>
diff --git a/quickstep/res/values-ne/strings.xml b/quickstep/res/values-ne/strings.xml
index 6053def..60e9bd5 100644
--- a/quickstep/res/values-ne/strings.xml
+++ b/quickstep/res/values-ne/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< १ मिनेट"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"आज: <xliff:g id="TIME">%1$s</xliff:g> बाँकी"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"अनुप्रयोगसम्बन्धी सुझावहरू"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"सबै अनुप्रयोगहरू"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"तपाईंका पूर्वानुमानित अनुप्रयोगहरू"</string>
</resources>
diff --git a/quickstep/res/values-nl/strings.xml b/quickstep/res/values-nl/strings.xml
index 4e3a34c..8032567 100644
--- a/quickstep/res/values-nl/strings.xml
+++ b/quickstep/res/values-nl/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minuut"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Nog <xliff:g id="TIME">%1$s</xliff:g> vandaag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"App-suggesties"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alle apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Je voorspelde apps"</string>
</resources>
diff --git a/quickstep/res/values-pa/strings.xml b/quickstep/res/values-pa/strings.xml
index 5aeeae6..58c0d2a 100644
--- a/quickstep/res/values-pa/strings.xml
+++ b/quickstep/res/values-pa/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 ਮਿੰਟ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"ਅੱਜ <xliff:g id="TIME">%1$s</xliff:g> ਬਾਕੀ"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ਐਪ ਸੰਬੰਧੀ ਸੁਝਾਅ"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"ਸਾਰੀਆਂ ਐਪਾਂ"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"ਤੁਹਾਡੀਆਂ ਪੂਰਵ ਅਨੁਮਾਨਿਤ ਐਪਾਂ"</string>
</resources>
diff --git a/quickstep/res/values-pl/strings.xml b/quickstep/res/values-pl/strings.xml
index 210edcf..d83160d 100644
--- a/quickstep/res/values-pl/strings.xml
+++ b/quickstep/res/values-pl/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"> 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Na dziś zostało <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugerowane aplikacje"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Wszystkie aplikacje"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Przewidywane aplikacje"</string>
</resources>
diff --git a/quickstep/res/values-pt-rPT/strings.xml b/quickstep/res/values-pt-rPT/strings.xml
index 8a129d5..2fd34d6 100644
--- a/quickstep/res/values-pt-rPT/strings.xml
+++ b/quickstep/res/values-pt-rPT/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minuto"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Resta(m) <xliff:g id="TIME">%1$s</xliff:g> hoje."</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugestões de aplicações"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Todas as aplicações"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"As suas aplicações previstas"</string>
</resources>
diff --git a/quickstep/res/values-pt/strings.xml b/quickstep/res/values-pt/strings.xml
index e5380d5..673dfe2 100644
--- a/quickstep/res/values-pt/strings.xml
+++ b/quickstep/res/values-pt/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> restante(s) hoje"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugestões de apps"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Todos os apps"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Suas predições de apps"</string>
</resources>
diff --git a/quickstep/res/values-ro/strings.xml b/quickstep/res/values-ro/strings.xml
index 54452a0..2ac783e 100644
--- a/quickstep/res/values-ro/strings.xml
+++ b/quickstep/res/values-ro/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minut"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Au mai rămas <xliff:g id="TIME">%1$s</xliff:g> astăzi"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugestii de aplicații"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Toate aplicațiile"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Aplicațiile estimate"</string>
</resources>
diff --git a/quickstep/res/values-ru/strings.xml b/quickstep/res/values-ru/strings.xml
index 8b2016a..5dd89a6 100644
--- a/quickstep/res/values-ru/strings.xml
+++ b/quickstep/res/values-ru/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>: <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 мин."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Осталось сегодня: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Рекомендуемые приложения"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Все приложения"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Ваши рекомендуемые приложения"</string>
</resources>
diff --git a/quickstep/res/values-si/strings.xml b/quickstep/res/values-si/strings.xml
index 2163390..f6584c4 100644
--- a/quickstep/res/values-si/strings.xml
+++ b/quickstep/res/values-si/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 විනාඩියක්"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"අද <xliff:g id="TIME">%1$s</xliff:g>ක් ඉතුරුයි"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"යෙදුම් යෝජනා"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"සියලු යෙදුම්"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"ඔබේ පුරෝකථන කළ යෙදුම්"</string>
</resources>
diff --git a/quickstep/res/values-sk/strings.xml b/quickstep/res/values-sk/strings.xml
index 12983db..8a9c736 100644
--- a/quickstep/res/values-sk/strings.xml
+++ b/quickstep/res/values-sk/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"Menej ako 1 minúta"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Dnes ešte zostáva: <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Návrhy aplikácií"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Všetky aplikácie"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Vaše predpovedané aplikácie"</string>
</resources>
diff --git a/quickstep/res/values-sl/strings.xml b/quickstep/res/values-sl/strings.xml
index a940f2b..15f8f89 100644
--- a/quickstep/res/values-sl/strings.xml
+++ b/quickstep/res/values-sl/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Danes je ostalo še <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Predlogi za aplikacije"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Vse aplikacije"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Predvidene aplikacije"</string>
</resources>
diff --git a/quickstep/res/values-sq/strings.xml b/quickstep/res/values-sq/strings.xml
index e41bcb5..d8f5f28 100644
--- a/quickstep/res/values-sq/strings.xml
+++ b/quickstep/res/values-sq/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 minutë"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> të mbetura sot"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Sugjerimet e aplikacioneve"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Të gjitha aplikacionet"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Aplikacionet e tua të parashikuara"</string>
</resources>
diff --git a/quickstep/res/values-sr/strings.xml b/quickstep/res/values-sr/strings.xml
index 8f26c66..b721641 100644
--- a/quickstep/res/values-sr/strings.xml
+++ b/quickstep/res/values-sr/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 мин"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Још <xliff:g id="TIME">%1$s</xliff:g> данас"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Предлози апликација"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Све апликације"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Предвиђене апликације"</string>
</resources>
diff --git a/quickstep/res/values-sv/strings.xml b/quickstep/res/values-sv/strings.xml
index 70740e5..ba7ebcd 100644
--- a/quickstep/res/values-sv/strings.xml
+++ b/quickstep/res/values-sv/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> kvar i dag"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Appförslag"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Alla appar"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Föreslagna appar"</string>
</resources>
diff --git a/quickstep/res/values-sw/strings.xml b/quickstep/res/values-sw/strings.xml
index c646b6a..24db429 100644
--- a/quickstep/res/values-sw/strings.xml
+++ b/quickstep/res/values-sw/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< dak 1"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Umebakisha <xliff:g id="TIME">%1$s</xliff:g> leo"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Mapendekezo ya programu"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Programu zote"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Programu zako zinazopendekezwa"</string>
</resources>
diff --git a/quickstep/res/values-ta/strings.xml b/quickstep/res/values-ta/strings.xml
index 19bfaa9..97d51cd 100644
--- a/quickstep/res/values-ta/strings.xml
+++ b/quickstep/res/values-ta/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 நி"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"இன்று <xliff:g id="TIME">%1$s</xliff:g> மீதமுள்ளது"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ஆப்ஸ் பரிந்துரைகள்"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"அனைத்து ஆப்ஸும்"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"நீங்கள் கணித்த ஆப்ஸ்"</string>
</resources>
diff --git a/quickstep/res/values-te/strings.xml b/quickstep/res/values-te/strings.xml
index 071755a..24b37f7 100644
--- a/quickstep/res/values-te/strings.xml
+++ b/quickstep/res/values-te/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 నిమిషం"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"నేటికి <xliff:g id="TIME">%1$s</xliff:g> మిగిలి ఉంది"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"యాప్ సూచనలు"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"అన్ని యాప్లు"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"మీ సూచించబడిన యాప్లు"</string>
</resources>
diff --git a/quickstep/res/values-th/strings.xml b/quickstep/res/values-th/strings.xml
index c0e78ce..0f6821b 100644
--- a/quickstep/res/values-th/strings.xml
+++ b/quickstep/res/values-th/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"<1 นาที"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"วันนี้เหลืออีก <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"คำแนะนำเกี่ยวกับแอป"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"แอปทั้งหมด"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"แอปที่คาดการณ์ไว้"</string>
</resources>
diff --git a/quickstep/res/values-tl/strings.xml b/quickstep/res/values-tl/strings.xml
index 76a0b25..491bac5 100644
--- a/quickstep/res/values-tl/strings.xml
+++ b/quickstep/res/values-tl/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 min"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> na lang ngayon"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Mga iminumungkahing app"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Lahat ng app"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Iyong mga nahulaang app"</string>
</resources>
diff --git a/quickstep/res/values-tr/strings.xml b/quickstep/res/values-tr/strings.xml
index 8b59c7b..ec6d884 100644
--- a/quickstep/res/values-tr/strings.xml
+++ b/quickstep/res/values-tr/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 dk."</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Bugün <xliff:g id="TIME">%1$s</xliff:g> kaldı"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Uygulama önerileri"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Tüm uygulamalar"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Tahmin edilen uygulamalarınız"</string>
</resources>
diff --git a/quickstep/res/values-uk/strings.xml b/quickstep/res/values-uk/strings.xml
index 39c3848..7736062 100644
--- a/quickstep/res/values-uk/strings.xml
+++ b/quickstep/res/values-uk/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 хв"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Сьогодні залишилося <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Пропозиції додатків"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Усі додатки"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Передбачені додатки"</string>
</resources>
diff --git a/quickstep/res/values-ur/strings.xml b/quickstep/res/values-ur/strings.xml
index 4fd9e69..87b303f 100644
--- a/quickstep/res/values-ur/strings.xml
+++ b/quickstep/res/values-ur/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>،<xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 منٹ"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"آج <xliff:g id="TIME">%1$s</xliff:g> بچا ہے"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"ایپ کی تجاویز"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"تمام ایپس"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"آپ کی پیشن گوئی کردہ ایپس"</string>
</resources>
diff --git a/quickstep/res/values-uz/strings.xml b/quickstep/res/values-uz/strings.xml
index 466d79e..67c8e91 100644
--- a/quickstep/res/values-uz/strings.xml
+++ b/quickstep/res/values-uz/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 daqiqa"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Bugun <xliff:g id="TIME">%1$s</xliff:g> qoldi"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Tavsiya etiladigan ilovalar"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Barcha ilovalar"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Taklif qilingan ilovalaringiz"</string>
</resources>
diff --git a/quickstep/res/values-vi/strings.xml b/quickstep/res/values-vi/strings.xml
index 842b22b..34c89ef 100644
--- a/quickstep/res/values-vi/strings.xml
+++ b/quickstep/res/values-vi/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 phút"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"Hôm nay còn <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Các ứng dụng đề xuất"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Tất cả ứng dụng"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Các ứng dụng gợi ý của bạn"</string>
</resources>
diff --git a/quickstep/res/values-zh-rCN/strings.xml b/quickstep/res/values-zh-rCN/strings.xml
index 951489f..0e83977 100644
--- a/quickstep/res/values-zh-rCN/strings.xml
+++ b/quickstep/res/values-zh-rCN/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>(<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"不到 1 分钟"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"今天还可使用 <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"应用推荐"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"所有应用"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"您的预测应用"</string>
</resources>
diff --git a/quickstep/res/values-zh-rHK/strings.xml b/quickstep/res/values-zh-rHK/strings.xml
index 361623d..ac7e8e9 100644
--- a/quickstep/res/values-zh-rHK/strings.xml
+++ b/quickstep/res/values-zh-rHK/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>,<xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"少於 1 分鐘"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"今天剩餘時間:<xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"應用程式建議"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"所有應用程式"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"您的預測應用程式"</string>
</resources>
diff --git a/quickstep/res/values-zh-rTW/strings.xml b/quickstep/res/values-zh-rTW/strings.xml
index 6938d3e..3323bfd 100644
--- a/quickstep/res/values-zh-rTW/strings.xml
+++ b/quickstep/res/values-zh-rTW/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g> (<xliff:g id="REMAINING_TIME">%2$s</xliff:g>)"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 分鐘"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"今天還能使用 <xliff:g id="TIME">%1$s</xliff:g>"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"應用程式建議"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"所有應用程式"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"系統預測你會使用的應用程式"</string>
</resources>
diff --git a/quickstep/res/values-zu/strings.xml b/quickstep/res/values-zu/strings.xml
index 98f7b02..0f1d99d 100644
--- a/quickstep/res/values-zu/strings.xml
+++ b/quickstep/res/values-zu/strings.xml
@@ -31,4 +31,7 @@
<string name="task_contents_description_with_remaining_time" msgid="4479688746574672685">"<xliff:g id="TASK_DESCRIPTION">%1$s</xliff:g>, <xliff:g id="REMAINING_TIME">%2$s</xliff:g>"</string>
<string name="shorter_duration_less_than_one_minute" msgid="4722015666335015336">"< 1 iminithi"</string>
<string name="time_left_for_app" msgid="3111996412933644358">"<xliff:g id="TIME">%1$s</xliff:g> esele namhlanje"</string>
+ <string name="title_app_suggestions" msgid="4185902664111965088">"Iziphakamiso zohlelo lokusebenza"</string>
+ <string name="all_apps_label" msgid="8542784161730910663">"Zonke izinhlelo zokusebenza"</string>
+ <string name="all_apps_prediction_tip" msgid="2672336544844936186">"Izinhlelo zakho zokusebenza eziqagelwe"</string>
</resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 32f312f..82d1aa6 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -36,6 +36,7 @@
<!-- These speeds are in dp / ms -->
<dimen name="motion_pause_detector_speed_very_slow">0.0285dp</dimen>
+ <dimen name="motion_pause_detector_speed_slow">0.15dp</dimen>
<dimen name="motion_pause_detector_speed_somewhat_fast">0.285dp</dimen>
<dimen name="motion_pause_detector_speed_fast">0.5dp</dimen>
<dimen name="motion_pause_detector_min_displacement_from_app">36dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index e1a115a..91c4601 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -104,16 +104,18 @@
private static final String CONTROL_REMOTE_APP_TRANSITION_PERMISSION =
"android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
- private static final long APP_LAUNCH_DURATION = 500;
+ private static final long APP_LAUNCH_DURATION = 450;
// Use a shorter duration for x or y translation to create a curve effect
- private static final long APP_LAUNCH_CURVED_DURATION = APP_LAUNCH_DURATION / 2;
+ private static final long APP_LAUNCH_CURVED_DURATION = 250;
private static final long APP_LAUNCH_ALPHA_DURATION = 50;
+ private static final long APP_LAUNCH_ALPHA_START_DELAY = 50;
// We scale the durations for the downward app launch animations (minus the scale animation).
private static final float APP_LAUNCH_DOWN_DUR_SCALE_FACTOR = 0.8f;
private static final long APP_LAUNCH_DOWN_DURATION =
(long) (APP_LAUNCH_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
- private static final long APP_LAUNCH_DOWN_CURVED_DURATION = APP_LAUNCH_DOWN_DURATION / 2;
+ private static final long APP_LAUNCH_DOWN_CURVED_DURATION =
+ (long) (APP_LAUNCH_CURVED_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
private static final long APP_LAUNCH_ALPHA_DOWN_DURATION =
(long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
@@ -132,7 +134,7 @@
private final DragLayer mDragLayer;
private final AlphaProperty mDragLayerAlpha;
- private final Handler mHandler;
+ final Handler mHandler;
private final boolean mIsRtl;
private final float mContentTransY;
@@ -474,18 +476,29 @@
float shapeRevealDuration = APP_LAUNCH_DURATION * SHAPE_PROGRESS_DURATION;
- final float windowRadius = mDeviceProfile.isMultiWindowMode
- ? 0 : getWindowCornerRadius(mLauncher.getResources());
+ final float startCrop;
+ final float endCrop;
+ if (mDeviceProfile.isVerticalBarLayout()) {
+ startCrop = windowTargetBounds.height();
+ endCrop = windowTargetBounds.width();
+ } else {
+ startCrop = windowTargetBounds.width();
+ endCrop = windowTargetBounds.height();
+ }
+ final float windowRadius = mDeviceProfile.isMultiWindowMode
+ ? 0 : getWindowCornerRadius(mLauncher.getResources());
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
FloatProp mIconScale = new FloatProp(initialStartScale, scale, 0, APP_LAUNCH_DURATION,
EXAGGERATED_EASE);
- FloatProp mIconAlpha = new FloatProp(1f, 0f, shapeRevealDuration, alphaDuration,
- LINEAR);
- FloatProp mCropHeight = new FloatProp(windowTargetBounds.width(),
- windowTargetBounds.height(), 0, shapeRevealDuration, AGGRESSIVE_EASE);
+ FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
+ alphaDuration, LINEAR);
+ FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, APP_LAUNCH_DURATION,
+ EXAGGERATED_EASE);
+ FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0,
+ APP_LAUNCH_DURATION, EXAGGERATED_EASE);
@Override
public void onUpdate(float percent) {
@@ -493,10 +506,16 @@
float iconWidth = bounds.width() * mIconScale.value;
float iconHeight = bounds.height() * mIconScale.value;
- // Animate the window crop so that it starts off as a square, and then reveals
- // horizontally.
- int windowWidth = windowTargetBounds.width();
- int windowHeight = (int) mCropHeight.value;
+ // Animate the window crop so that it starts off as a square.
+ final int windowWidth;
+ final int windowHeight;
+ if (mDeviceProfile.isVerticalBarLayout()) {
+ windowWidth = (int) mCroppedSize.value;
+ windowHeight = windowTargetBounds.height();
+ } else {
+ windowWidth = windowTargetBounds.width();
+ windowHeight = (int) mCroppedSize.value;
+ }
crop.set(0, 0, windowWidth, windowHeight);
// Scale the app window to match the icon size.
@@ -518,6 +537,8 @@
float transX0 = temp.left - offsetX;
float transY0 = temp.top - offsetY;
+ float croppedHeight = (windowTargetBounds.height() - crop.height()) * scale;
+ float croppedWidth = (windowTargetBounds.width() - crop.width()) * scale;
SurfaceParams[] params = new SurfaceParams[targets.length];
for (int i = targets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = targets[i];
@@ -529,8 +550,13 @@
matrix.postTranslate(transX0, transY0);
targetCrop = crop;
alpha = 1f - mIconAlpha.value;
- cornerRadius = windowRadius;
+ cornerRadius = mWindowRadius.value;
matrix.mapRect(currentBounds, targetBounds);
+ if (mDeviceProfile.isVerticalBarLayout()) {
+ currentBounds.right -= croppedWidth;
+ } else {
+ currentBounds.bottom -= croppedHeight;
+ }
mFloatingView.update(currentBounds, mIconAlpha.value, percent, 0f,
cornerRadius * scale, true /* isOpening */);
} else {
@@ -573,70 +599,9 @@
* @return Runner that plays when user goes to Launcher
* ie. pressing home, swiping up from nav bar.
*/
- private RemoteAnimationRunnerCompat getWallpaperOpenRunner(boolean fromUnlock) {
- return new LauncherAnimationRunner(mHandler, false /* startAtFrontOfQueue */) {
- @Override
- public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
- AnimationResult result) {
- if (!mLauncher.hasBeenResumed()) {
- // If launcher is not resumed, wait until new async-frame after resume
- mLauncher.setOnResumeCallback(() ->
- postAsyncCallback(mHandler, () ->
- onCreateAnimation(targetCompats, result)));
- return;
- }
-
- if (mLauncher.hasSomeInvisibleFlag(PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION)) {
- mLauncher.addForceInvisibleFlag(INVISIBLE_BY_PENDING_FLAGS);
- mLauncher.getStateManager().moveToRestState();
- }
-
- AnimatorSet anim = null;
- RemoteAnimationProvider provider = mRemoteAnimationProvider;
- if (provider != null) {
- anim = provider.createWindowAnimation(targetCompats);
- }
-
- if (anim == null) {
- anim = new AnimatorSet();
- anim.play(fromUnlock
- ? getUnlockWindowAnimator(targetCompats)
- : getClosingWindowAnimators(targetCompats));
-
- // Normally, we run the launcher content animation when we are transitioning
- // home, but if home is already visible, then we don't want to animate the
- // contents of launcher unless we know that we are animating home as a result
- // of the home button press with quickstep, which will result in launcher being
- // started on touch down, prior to the animation home (and won't be in the
- // targets list because it is already visible). In that case, we force
- // invisibility on touch down, and only reset it after the animation to home
- // is initialized.
- if (launcherIsATargetWithMode(targetCompats, MODE_OPENING)
- || mLauncher.isForceInvisible()) {
- // Only register the content animation for cancellation when state changes
- mLauncher.getStateManager().setCurrentAnimation(anim);
- if (fromUnlock) {
- Pair<AnimatorSet, Runnable> contentAnimator =
- getLauncherContentAnimator(false /* isAppOpening */,
- new float[] {mContentTransY, 0});
- contentAnimator.first.setStartDelay(0);
- anim.play(contentAnimator.first);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- contentAnimator.second.run();
- }
- });
- } else {
- createLauncherResumeAnimation(anim);
- }
- }
- }
-
- mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL);
- result.setAnimation(anim);
- }
- };
+ RemoteAnimationRunnerCompat getWallpaperOpenRunner(boolean fromUnlock) {
+ return new WallpaperOpenLauncherAnimationRunner(mHandler, false /* startAtFrontOfQueue */,
+ fromUnlock);
}
/**
@@ -773,4 +738,79 @@
return mLauncher.checkSelfPermission(CONTROL_REMOTE_APP_TRANSITION_PERMISSION)
== PackageManager.PERMISSION_GRANTED;
}
+
+ /**
+ * Remote animation runner for animation from the app to Launcher, including recents.
+ */
+ class WallpaperOpenLauncherAnimationRunner extends LauncherAnimationRunner {
+ private final boolean mFromUnlock;
+
+ public WallpaperOpenLauncherAnimationRunner(Handler handler, boolean startAtFrontOfQueue,
+ boolean fromUnlock) {
+ super(handler, startAtFrontOfQueue);
+ mFromUnlock = fromUnlock;
+ }
+
+ @Override
+ public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
+ LauncherAnimationRunner.AnimationResult result) {
+ if (!mLauncher.hasBeenResumed()) {
+ // If launcher is not resumed, wait until new async-frame after resume
+ mLauncher.setOnResumeCallback(() ->
+ postAsyncCallback(mHandler, () ->
+ onCreateAnimation(targetCompats, result)));
+ return;
+ }
+
+ if (mLauncher.hasSomeInvisibleFlag(PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION)) {
+ mLauncher.addForceInvisibleFlag(INVISIBLE_BY_PENDING_FLAGS);
+ mLauncher.getStateManager().moveToRestState();
+ }
+
+ AnimatorSet anim = null;
+ RemoteAnimationProvider provider = mRemoteAnimationProvider;
+ if (provider != null) {
+ anim = provider.createWindowAnimation(targetCompats);
+ }
+
+ if (anim == null) {
+ anim = new AnimatorSet();
+ anim.play(mFromUnlock
+ ? getUnlockWindowAnimator(targetCompats)
+ : getClosingWindowAnimators(targetCompats));
+
+ // Normally, we run the launcher content animation when we are transitioning
+ // home, but if home is already visible, then we don't want to animate the
+ // contents of launcher unless we know that we are animating home as a result
+ // of the home button press with quickstep, which will result in launcher being
+ // started on touch down, prior to the animation home (and won't be in the
+ // targets list because it is already visible). In that case, we force
+ // invisibility on touch down, and only reset it after the animation to home
+ // is initialized.
+ if (launcherIsATargetWithMode(targetCompats, MODE_OPENING)
+ || mLauncher.isForceInvisible()) {
+ // Only register the content animation for cancellation when state changes
+ mLauncher.getStateManager().setCurrentAnimation(anim);
+ if (mFromUnlock) {
+ Pair<AnimatorSet, Runnable> contentAnimator =
+ getLauncherContentAnimator(false /* isAppOpening */,
+ new float[] {mContentTransY, 0});
+ contentAnimator.first.setStartDelay(0);
+ anim.play(contentAnimator.first);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ contentAnimator.second.run();
+ }
+ });
+ } else {
+ createLauncherResumeAnimation(anim);
+ }
+ }
+ }
+
+ mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL);
+ result.setAnimation(anim);
+ }
+ }
}
diff --git a/quickstep/src/com/android/launcher3/proxy/ProxyActivityStarter.java b/quickstep/src/com/android/launcher3/proxy/ProxyActivityStarter.java
new file mode 100644
index 0000000..e302b4f
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/proxy/ProxyActivityStarter.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2019 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.proxy;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender.SendIntentException;
+import android.os.Bundle;
+import android.util.Log;
+
+public class ProxyActivityStarter extends Activity {
+
+ private static final String TAG = "ProxyActivityStarter";
+
+ public static final String EXTRA_PARAMS = "start-activity-params";
+
+ private StartActivityParams mParams;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setVisible(false);
+
+ mParams = getIntent().getParcelableExtra(EXTRA_PARAMS);
+ if (mParams == null) {
+ Log.d(TAG, "Proxy activity started without params");
+ finishAndRemoveTask();
+ return;
+ }
+
+ if (savedInstanceState != null) {
+ // Already started the activity. Just wait for the result.
+ return;
+ }
+
+ if (mParams.intent != null) {
+ startActivityForResult(mParams.intent, mParams.requestCode, mParams.options);
+ return;
+ } else if (mParams.intentSender != null) {
+ try {
+ startIntentSenderForResult(mParams.intentSender, mParams.requestCode,
+ mParams.fillInIntent, mParams.flagsMask, mParams.flagsValues,
+ mParams.extraFlags,
+ mParams.options);
+ return;
+ } catch (SendIntentException e) {
+ mParams.deliverResult(this, RESULT_CANCELED, null);
+ }
+ }
+ finishAndRemoveTask();
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == mParams.requestCode) {
+ mParams.deliverResult(this, resultCode, data);
+ }
+ finishAndRemoveTask();
+ }
+
+ public static Intent getLaunchIntent(Context context, StartActivityParams params) {
+ return new Intent(context, ProxyActivityStarter.class)
+ .putExtra(EXTRA_PARAMS, params)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java b/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java
new file mode 100644
index 0000000..1e8bd93
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/proxy/StartActivityParams.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2019 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.proxy;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.app.PendingIntent.CanceledException;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+public class StartActivityParams implements Parcelable {
+
+ private static final String TAG = "StartActivityParams";
+
+ private final PendingIntent mCallback;
+ public final int requestCode;
+
+ public Intent intent;
+
+ public IntentSender intentSender;
+ public Intent fillInIntent;
+ public int flagsMask;
+ public int flagsValues;
+ public int extraFlags;
+ public Bundle options;
+
+ public StartActivityParams(Activity activity, int requestCode) {
+ mCallback = activity.createPendingResult(requestCode, new Intent(),
+ PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
+ this.requestCode = requestCode;
+ }
+
+ private StartActivityParams(Parcel parcel) {
+ mCallback = parcel.readTypedObject(PendingIntent.CREATOR);
+ requestCode = parcel.readInt();
+ intent = parcel.readTypedObject(Intent.CREATOR);
+
+ intentSender = parcel.readTypedObject(IntentSender.CREATOR);
+ fillInIntent = parcel.readTypedObject(Intent.CREATOR);
+ flagsMask = parcel.readInt();
+ flagsValues = parcel.readInt();
+ extraFlags = parcel.readInt();
+ options = parcel.readBundle();
+ }
+
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeTypedObject(mCallback, flags);
+ parcel.writeInt(requestCode);
+ parcel.writeTypedObject(intent, flags);
+
+ parcel.writeTypedObject(intentSender, flags);
+ parcel.writeTypedObject(fillInIntent, flags);
+ parcel.writeInt(flagsMask);
+ parcel.writeInt(flagsValues);
+ parcel.writeInt(extraFlags);
+ parcel.writeBundle(options);
+ }
+
+ public void deliverResult(Context context, int resultCode, Intent data) {
+ try {
+ mCallback.send(context, resultCode, data);
+ } catch (CanceledException e) {
+ Log.e(TAG, "Unable to send back result", e);
+ }
+ }
+
+ public static final Parcelable.Creator<StartActivityParams> CREATOR =
+ new Parcelable.Creator<StartActivityParams>() {
+ public StartActivityParams createFromParcel(Parcel source) {
+ return new StartActivityParams(source);
+ }
+
+ public StartActivityParams[] newArray(int size) {
+ return new StartActivityParams[size];
+ }
+ };
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 4f50cdb..4891746 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -16,6 +16,8 @@
package com.android.launcher3.uioverrides;
+import static android.app.Activity.RESULT_CANCELED;
+
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.ALL_APPS;
@@ -31,6 +33,9 @@
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.os.Bundle;
import android.os.CancellationSignal;
import android.util.Base64;
@@ -43,6 +48,8 @@
import com.android.launcher3.QuickstepAppTransitionManagerImpl;
import com.android.launcher3.Utilities;
import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.proxy.ProxyActivityStarter;
+import com.android.launcher3.proxy.StartActivityParams;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.SysUINavigationMode;
@@ -192,9 +199,43 @@
return true;
}
+ public static boolean startIntentSenderForResult(Activity activity, IntentSender intent,
+ int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) {
+ StartActivityParams params = new StartActivityParams(activity, requestCode);
+ params.intentSender = intent;
+ params.fillInIntent = fillInIntent;
+ params.flagsMask = flagsMask;
+ params.flagsValues = flagsValues;
+ params.extraFlags = extraFlags;
+ params.options = options;
+ ((Context) activity).startActivity(ProxyActivityStarter.getLaunchIntent(activity, params));
+ return true;
+ }
+
+ public static boolean startActivityForResult(Activity activity, Intent intent, int requestCode,
+ Bundle options) {
+ StartActivityParams params = new StartActivityParams(activity, requestCode);
+ params.intent = intent;
+ params.options = options;
+ activity.startActivity(ProxyActivityStarter.getLaunchIntent(activity, params));
+ return true;
+ }
+
+ /**
+ * Removes any active ProxyActivityStarter task and sends RESULT_CANCELED to Launcher.
+ *
+ * ProxyActivityStarter is started with clear task to reset the task after which it removes the
+ * task itself.
+ */
+ public static void resetPendingActivityResults(Launcher launcher, int requestCode) {
+ launcher.onActivityResult(requestCode, RESULT_CANCELED, null);
+ launcher.startActivity(ProxyActivityStarter.getLaunchIntent(launcher, null));
+ }
+
public static ScaleAndTranslation getOverviewScaleAndTranslationForNormalState(Launcher l) {
if (SysUINavigationMode.getMode(l) == Mode.NO_BUTTON) {
- float offscreenTranslationX = l.getDragLayer().getWidth()
+ float offscreenTranslationX = l.getDeviceProfile().widthPx
- l.getOverviewPanel().getPaddingStart();
return new ScaleAndTranslation(1f, offscreenTranslationX, 0f);
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/WallpaperColorInfo.java b/quickstep/src/com/android/launcher3/uioverrides/WallpaperColorInfo.java
index 8218517..711e59a 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/WallpaperColorInfo.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/WallpaperColorInfo.java
@@ -35,6 +35,10 @@
@TargetApi(Build.VERSION_CODES.P)
public class WallpaperColorInfo implements OnColorsChangedListener {
+ private static final int MAIN_COLOR_LIGHT = 0xffdadce0;
+ private static final int MAIN_COLOR_DARK = 0xff202124;
+ private static final int MAIN_COLOR_REGULAR = 0xff000000;
+
private static final Object sInstanceLock = new Object();
private static WallpaperColorInfo sInstance;
@@ -79,6 +83,10 @@
return mExtractionInfo.supportsDarkText;
}
+ public boolean isMainColorDark() {
+ return mExtractionInfo.mainColor == MAIN_COLOR_DARK;
+ }
+
@Override
public void onColorsChanged(WallpaperColors colors, int which) {
if ((which & FLAG_SYSTEM) != 0) {
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index 06a36c9..3538373 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -120,6 +120,16 @@
}
@Override
+ public void onTaskRemoved(int taskId) {
+ for (int i = mTasks.size() - 1; i >= 0; i--) {
+ if (mTasks.get(i).key.id == taskId) {
+ mTasks.remove(i);
+ return;
+ }
+ }
+ }
+
+ @Override
public synchronized void onActivityPinned(String packageName, int userId, int taskId,
int stackId) {
mChangeId++;
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 675cfe2..9f12484 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -166,6 +166,12 @@
}
}
+ @Override
+ public void onTaskRemoved(int taskId) {
+ Task.TaskKey dummyKey = new Task.TaskKey(taskId, 0, null, null, 0, 0);
+ mThumbnailCache.remove(dummyKey);
+ }
+
public void setSystemUiProxy(ISystemUiProxy systemUiProxy) {
mSystemUiProxy = systemUiProxy;
}
diff --git a/quickstep/src/com/android/quickstep/TaskThumbnailCache.java b/quickstep/src/com/android/quickstep/TaskThumbnailCache.java
index d05196b..57c5a27 100644
--- a/quickstep/src/com/android/quickstep/TaskThumbnailCache.java
+++ b/quickstep/src/com/android/quickstep/TaskThumbnailCache.java
@@ -187,6 +187,13 @@
}
/**
+ * Removes the cached thumbnail for the given task.
+ */
+ public void remove(Task.TaskKey key) {
+ mCache.remove(key);
+ }
+
+ /**
* @return The cache size.
*/
public int getCacheSize() {
diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
index f58f0d4..893c053 100644
--- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
+++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
@@ -35,10 +35,18 @@
/** If no motion is added for this amount of time, assume the motion has paused. */
private static final long FORCE_PAUSE_TIMEOUT = 300;
+ /**
+ * After {@link #makePauseHarderToTrigger()}, must
+ * move slowly for this long to trigger a pause.
+ */
+ private static final long HARDER_TRIGGER_TIMEOUT = 400;
+
private final float mSpeedVerySlow;
+ private final float mSpeedSlow;
private final float mSpeedSomewhatFast;
private final float mSpeedFast;
private final Alarm mForcePauseTimeout;
+ private final boolean mMakePauseHarderToTrigger;
private Long mPreviousTime = null;
private Float mPreviousPosition = null;
@@ -52,19 +60,29 @@
private boolean mHasEverBeenPaused;
/** @see #setDisallowPause(boolean) */
private boolean mDisallowPause;
+ // Time at which speed became < mSpeedSlow (only used if mMakePauseHarderToTrigger == true).
+ private long mSlowStartTime;
public MotionPauseDetector(Context context) {
+ this(context, false);
+ }
+
+ /**
+ * @param makePauseHarderToTrigger Used for gestures that require a more explicit pause.
+ */
+ public MotionPauseDetector(Context context, boolean makePauseHarderToTrigger) {
Resources res = context.getResources();
mSpeedVerySlow = res.getDimension(R.dimen.motion_pause_detector_speed_very_slow);
+ mSpeedSlow = res.getDimension(R.dimen.motion_pause_detector_speed_slow);
mSpeedSomewhatFast = res.getDimension(R.dimen.motion_pause_detector_speed_somewhat_fast);
mSpeedFast = res.getDimension(R.dimen.motion_pause_detector_speed_fast);
mForcePauseTimeout = new Alarm();
mForcePauseTimeout.setOnAlarmListener(alarm -> updatePaused(true /* isPaused */));
+ mMakePauseHarderToTrigger = makePauseHarderToTrigger;
}
/**
- * Get callbacks for when motion pauses and resumes, including an
- * immediate callback with the current pause state.
+ * Get callbacks for when motion pauses and resumes.
*/
public void setOnMotionPauseListener(OnMotionPauseListener listener) {
mOnMotionPauseListener = listener;
@@ -88,13 +106,15 @@
if (mFirstPosition == null) {
mFirstPosition = position;
}
- mForcePauseTimeout.setAlarm(FORCE_PAUSE_TIMEOUT);
+ mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger
+ ? HARDER_TRIGGER_TIMEOUT
+ : FORCE_PAUSE_TIMEOUT);
if (mPreviousTime != null && mPreviousPosition != null) {
long changeInTime = Math.max(1, time - mPreviousTime);
float changeInPosition = position - mPreviousPosition;
float velocity = changeInPosition / changeInTime;
if (mPreviousVelocity != null) {
- checkMotionPaused(velocity, mPreviousVelocity);
+ checkMotionPaused(velocity, mPreviousVelocity, time);
}
mPreviousVelocity = velocity;
}
@@ -102,7 +122,7 @@
mPreviousPosition = position;
}
- private void checkMotionPaused(float velocity, float prevVelocity) {
+ private void checkMotionPaused(float velocity, float prevVelocity, long time) {
float speed = Math.abs(velocity);
float previousSpeed = Math.abs(prevVelocity);
boolean isPaused;
@@ -122,6 +142,17 @@
boolean isRapidDeceleration = speed < previousSpeed * RAPID_DECELERATION_FACTOR;
isPaused = isRapidDeceleration && speed < mSpeedSomewhatFast;
}
+ if (mMakePauseHarderToTrigger) {
+ if (speed < mSpeedSlow) {
+ if (mSlowStartTime == 0) {
+ mSlowStartTime = time;
+ }
+ isPaused = time - mSlowStartTime >= HARDER_TRIGGER_TIMEOUT;
+ } else {
+ mSlowStartTime = 0;
+ isPaused = false;
+ }
+ }
}
}
updatePaused(isPaused);
@@ -149,6 +180,7 @@
mFirstPosition = null;
setOnMotionPauseListener(null);
mIsPaused = mHasEverBeenPaused = false;
+ mSlowStartTime = 0;
mForcePauseTimeout.cancelAlarm();
}
diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
index 1817135..5e20e56 100644
--- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
+++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
@@ -40,7 +40,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,6 +69,8 @@
// Disable app tracker
AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
+ PredictionUiStateManager.INSTANCE.initializeForTesting(null);
+
mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(
Client.HOME);
@@ -78,6 +79,8 @@
@After
public void tearDown() throws Throwable {
+ AppLaunchTracker.INSTANCE.initializeForTesting(null);
+ PredictionUiStateManager.INSTANCE.initializeForTesting(null);
mDevice.unfreezeRotation();
}
@@ -85,7 +88,6 @@
* Test that prediction UI is updated as soon as we get predictions from the system
*/
@Test
- @Ignore // b/131772711: this really fails (when being run as a part of the whole test suite)!
public void testPredictionExistsInAllApps() {
mActivityMonitor.startLauncher();
mLauncher.pressHome().switchToAllApps();
@@ -118,7 +120,6 @@
}
@Test
- @Ignore // b/131772711 - this was failing in the lab
public void testPredictionsDisabled() {
mActivityMonitor.startLauncher();
sendPredictionUpdate();
@@ -150,10 +151,10 @@
List<AppTarget> targets = new ArrayList<>(activities.length);
for (LauncherActivityInfo info : activities) {
ComponentName cn = info.getComponentName();
- AppTarget target = new AppTarget.Builder(new AppTargetId("app:" + cn))
- .setTarget(cn.getPackageName(), info.getUser())
- .setClassName(cn.getClassName())
- .build();
+ AppTarget target =
+ new AppTarget.Builder(new AppTargetId("app:" + cn), cn.getPackageName(), info.getUser())
+ .setClassName(cn.getClassName())
+ .build();
targets.add(target);
}
mCallback.onTargetsAvailable(targets);
diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
index 8bdb90d..2111e2c 100644
--- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
+++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
@@ -28,6 +28,7 @@
import com.android.launcher3.util.RaceConditionReproducer;
import com.android.quickstep.NavigationModeSwitchRule.Mode;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
+import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;
import org.junit.Before;
import org.junit.Ignore;
diff --git a/res/drawable-v28/round_rect_folder.xml b/res/drawable-v28/round_rect_folder.xml
new file mode 100644
index 0000000..0403be0
--- /dev/null
+++ b/res/drawable-v28/round_rect_folder.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?attr/folderFillColor" />
+ <corners android:radius="?android:attr/dialogCornerRadius" />
+</shape>
diff --git a/res/drawable/round_rect_folder.xml b/res/drawable/round_rect_folder.xml
new file mode 100644
index 0000000..8b3d06c
--- /dev/null
+++ b/res/drawable/round_rect_folder.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?attr/folderFillColor" />
+ <corners android:radius="@dimen/bg_round_rect_radius" />
+</shape>
diff --git a/res/layout/folder_application.xml b/res/layout/folder_application.xml
index de861a0..c156e11 100644
--- a/res/layout/folder_application.xml
+++ b/res/layout/folder_application.xml
@@ -18,5 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
style="@style/BaseIcon"
+ android:textColor="?attr/folderTextColor"
android:includeFontPadding="false"
launcher:iconDisplay="folder" />
diff --git a/res/layout/hotseat.xml b/res/layout/hotseat.xml
new file mode 100644
index 0000000..82b0b8d
--- /dev/null
+++ b/res/layout/hotseat.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<com.android.launcher3.Hotseat
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/hotseat"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:theme="@style/HomeScreenElementTheme"
+ android:importantForAccessibility="no"
+ launcher:containerType="hotseat" />
\ No newline at end of file
diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml
index 6ecc1f5..9cab9c2 100644
--- a/res/layout/launcher.xml
+++ b/res/layout/launcher.xml
@@ -39,19 +39,20 @@
launcher:pageIndicator="@+id/page_indicator" />
<!-- DO NOT CHANGE THE ID -->
- <com.android.launcher3.Hotseat
+ <include
android:id="@+id/hotseat"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:theme="@style/HomeScreenElementTheme"
- android:importantForAccessibility="no"
- launcher:containerType="hotseat" />
+ layout="@layout/hotseat" />
<include
android:id="@+id/overview_panel"
layout="@layout/overview_panel"
android:visibility="gone" />
+ <include
+ android:id="@+id/hints"
+ layout="@layout/proactive_hints_container"
+ android:visibility="gone"/>
+
<!-- Keep these behind the workspace so that they are not visible when
we go into AllApps -->
<com.android.launcher3.pageindicators.WorkspacePageIndicator
diff --git a/res/layout/proactive_hints_container.xml b/res/layout/proactive_hints_container.xml
new file mode 100644
index 0000000..2637f03
--- /dev/null
+++ b/res/layout/proactive_hints_container.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+<Space
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="0dp"
+ android:layout_height="0dp" />
\ No newline at end of file
diff --git a/res/layout/user_folder_icon_normalized.xml b/res/layout/user_folder_icon_normalized.xml
index 2e6ce94..835fee2 100644
--- a/res/layout/user_folder_icon_normalized.xml
+++ b/res/layout/user_folder_icon_normalized.xml
@@ -18,7 +18,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/round_rect_primary"
+ android:background="@drawable/round_rect_folder"
android:elevation="5dp"
android:orientation="vertical" >
diff --git a/res/values-v28/styles.xml b/res/values-v28/styles.xml
new file mode 100644
index 0000000..7df9ce5
--- /dev/null
+++ b/res/values-v28/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2019 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.
+*/
+-->
+<resources>
+ <style name="TextHeadline" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle" >
+ <item name="android:textFontWeight">400</item>
+ </style>
+</resources>
diff --git a/res/values-v29/styles.xml b/res/values-v29/styles.xml
new file mode 100644
index 0000000..f623823
--- /dev/null
+++ b/res/values-v29/styles.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2019 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.
+*/
+-->
+
+<resources>
+ <!-- Launcher theme -->
+ <style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.DayNight">
+ <item name="android:colorBackgroundCacheHint">@null</item>
+ <item name="android:colorEdgeEffect">#FF757575</item>
+ <item name="android:windowActionBar">false</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowShowWallpaper">true</item>
+ <item name="folderTextColor">?attr/workspaceTextColor</item>
+ <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
+ </style>
+</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 43194d5..69b8c8a 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -36,8 +36,10 @@
<attr name="loadingIconColor" format="color" />
<attr name="folderDotColor" format="color" />
+ <attr name="folderFillColor" format="color" />
<attr name="folderIconRadius" format="float" />
<attr name="folderIconBorderColor" format="color" />
+ <attr name="folderTextColor" format="color" />
<!-- BubbleTextView specific attributes. -->
<declare-styleable name="BubbleTextView">
@@ -55,7 +57,7 @@
<!-- BubbleTextView specific attributes. -->
<declare-styleable name="FolderIconPreview">
- <attr name="android:colorPrimary" />
+ <attr name="folderFillColor" />
<attr name="folderIconBorderColor" />
<attr name="folderDotColor" />
</declare-styleable>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 469b176..0da56da 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -235,6 +235,7 @@
<!-- Hints -->
<dimen name="chip_hint_height">26dp</dimen>
<dimen name="chip_hint_bottom_margin">194dp</dimen>
+ <dimen name="chip_hint_overhang">15dp</dimen>
<!-- Theming related -->
<dimen name="default_dialog_corner_radius">8dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7932c6d..881f65d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -19,13 +19,14 @@
<resources>
<!-- Launcher theme -->
- <style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.DayNight">
+ <style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.Light">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:colorEdgeEffect">#FF757575</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowShowWallpaper">true</item>
+ <item name="folderTextColor">?attr/workspaceTextColor</item>
</style>
<style name="LauncherTheme" parent="@style/BaseLauncherTheme">
@@ -44,7 +45,9 @@
<item name="workspaceStatusBarScrim">@drawable/workspace_bg</item>
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
<item name="folderDotColor">?android:attr/colorPrimary</item>
+ <item name="folderFillColor">#CDFFFFFF</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
+ <item name="folderTextColor">#FF212121</item>
<item name="loadingIconColor">#CCFFFFFF</item>
<item name="android:windowTranslucentStatus">false</item>
@@ -54,6 +57,11 @@
<item name="android:navigationBarColor">#00000000</item>
</style>
+ <style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme">
+ <item name="folderFillColor">#FF3C4043</item> <!-- 100% GM2 800 -->
+ <item name="folderTextColor">?attr/workspaceTextColor</item>
+ </style>
+
<style name="LauncherTheme.DarkText" parent="@style/LauncherTheme">
<item name="workspaceTextColor">#FF212121</item>
<item name="allAppsInterimScrimAlpha">128</item>
@@ -63,7 +71,9 @@
<item name="isWorkspaceDarkText">true</item>
<item name="workspaceStatusBarScrim">@null</item>
<item name="folderDotColor">#FF464646</item>
+ <item name="folderFillColor">#CDFFFFFF</item>
<item name="folderIconBorderColor">#FF80868B</item>
+ <item name="folderTextColor">?attr/workspaceTextColor</item>
</style>
<style name="LauncherTheme.Dark" parent="@style/LauncherTheme">
@@ -81,13 +91,22 @@
<item name="popupColorTertiary">#757575</item> <!-- Gray 600 -->
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
<item name="folderDotColor">#FF464646</item>
+ <item name="folderFillColor">#DD3C4043</item> <!-- 87% GM2 800 -->
<item name="folderIconBorderColor">#FF80868B</item>
+ <item name="folderTextColor">@android:color/white</item>
<item name="isMainColorDark">true</item>
<item name="loadingIconColor">#99FFFFFF</item>
</style>
+ <style name="LauncherTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark">
+ <item name="folderFillColor">#FF3C4043</item> <!-- 100% GM2 800 -->
+ <item name="folderTextColor">@android:color/white</item>
+ </style>
+
<style name="LauncherTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark">
<item name="allAppsInterimScrimAlpha">25</item>
+ <item name="folderFillColor">#CDFFFFFF</item>
+ <item name="folderTextColor">?attr/workspaceTextColor</item>
<item name="workspaceTextColor">#FF212121</item>
<item name="workspaceShadowColor">@android:color/transparent</item>
<item name="workspaceAmbientShadowColor">@android:color/transparent</item>
@@ -99,8 +118,11 @@
<!-- A derivative project can extend these themes to customize the application theme without
affecting the base theme -->
<style name="AppTheme" parent="@style/LauncherTheme" />
+ <style name="AppTheme.DarkMainColor" parent="@style/LauncherTheme.DarkMainColor" />
<style name="AppTheme.DarkText" parent="@style/LauncherTheme.DarkText" />
+
<style name="AppTheme.Dark" parent="@style/LauncherTheme.Dark" />
+ <style name="AppTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark.DarkMainColor" />
<style name="AppTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark.DarkText" />
<style name="AppItemActivityTheme" parent="@android:style/Theme.Material.Light.Dialog.Alert">
@@ -157,7 +179,7 @@
<item name="android:shadowRadius">0</item>
</style>
- <!-- Icon displayed on the worksapce -->
+ <!-- Icon displayed on the workspace -->
<style name="BaseIcon.Workspace" >
<item name="android:shadowRadius">2.0</item>
<item name="android:shadowColor">?attr/workspaceShadowColor</item>
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 7e72208..3455cb8 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -44,6 +44,12 @@
android:defaultValue="@bool/allow_rotation"
android:persistent="true" />
+ <SwitchPreference
+ android:key="pref_grid_options"
+ android:title="Enable grid options"
+ android:defaultValue="false"
+ android:persistent="true" />
+
<androidx.preference.PreferenceScreen
android:key="pref_developer_options"
android:persistent="false"
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index d6f992f..65f9d6b 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -90,7 +90,7 @@
// Usually we show the back button when a floating view is open. Instead, hide for these types.
public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
- | TYPE_SNACKBAR;
+ | TYPE_SNACKBAR | TYPE_WIDGET_RESIZE_FRAME | TYPE_LISTENER;
public static final int TYPE_ACCESSIBLE = TYPE_ALL & ~TYPE_DISCOVERY_BOUNCE & ~TYPE_LISTENER;
diff --git a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
index 0250c36..d949141 100644
--- a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
+++ b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
@@ -8,7 +8,6 @@
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
-import android.os.Handler;
import android.util.Log;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -34,16 +33,8 @@
final int[] oldIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
final int[] newIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
- if (oldIds.length == newIds.length) {
- final PendingResult asyncResult = goAsync();
- new Handler(LauncherModel.getWorkerLooper())
- .postAtFrontOfQueue(new Runnable() {
- @Override
- public void run() {
- restoreAppWidgetIds(context, oldIds, newIds);
- asyncResult.finish();
- }
- });
+ if (oldIds != null && newIds != null && oldIds.length == newIds.length) {
+ RestoreDbTask.setRestoredAppWidgetIds(context, oldIds, newIds);
} else {
Log.e(TAG, "Invalid host restored received");
}
@@ -54,7 +45,7 @@
* Updates the app widgets whose id has changed during the restore process.
*/
@WorkerThread
- static void restoreAppWidgetIds(Context context, int[] oldWidgetIds, int[] newWidgetIds) {
+ public static void restoreAppWidgetIds(Context context, int[] oldWidgetIds, int[] newWidgetIds) {
AppWidgetHost appWidgetHost = new LauncherAppWidgetHost(context);
if (FeatureFlags.GO_DISABLE_WIDGETS) {
Log.e(TAG, "Skipping widget ID remap as widgets not supported");
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 8291acc..bff7f42 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -46,10 +46,12 @@
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.graphics.DrawableFactory;
import com.android.launcher3.graphics.IconPalette;
+import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconCache.IconLoadRequest;
import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver;
+import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.PackageItemInfo;
import com.android.launcher3.views.ActivityContext;
@@ -388,7 +390,7 @@
protected void drawDotIfNecessary(Canvas canvas) {
if (!mForceHideDot && (hasDot() || mDotParams.scale > 0)) {
getIconBounds(mDotParams.iconBounds);
- mDotParams.spaceForOffset.set((getWidth() - mIconSize) / 2, getPaddingTop());
+ Utilities.scaleRectAboutCenter(mDotParams.iconBounds, IconShape.getNormalizationScale());
final int scrollX = getScrollX();
final int scrollY = getScrollY();
canvas.translate(scrollX, scrollY);
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 3eb01e6..09fb244 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -845,7 +845,8 @@
* width in {@link DeviceProfile#calculateCellWidth(int, int)}.
*/
public int getUnusedHorizontalSpace() {
- return getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth);
+ return (mRotationMode.isTransposed ? getMeasuredHeight() : getMeasuredWidth())
+ - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth);
}
public Drawable getScrimBackground() {
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c0affb9..c1f898c 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -24,15 +24,13 @@
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.view.Surface;
-import android.view.View;
import android.view.WindowManager;
import com.android.launcher3.CellLayout.ContainerType;
+import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
-import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
-
public class DeviceProfile {
public final InvariantDeviceProfile inv;
@@ -212,10 +210,9 @@
+ res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding);
hotseatBarSidePaddingEndPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
- // Add a bit of space between nav bar and hotseat in multi-window vertical bar layout.
- hotseatBarSidePaddingStartPx = isMultiWindowMode && isVerticalBarLayout()
- ? edgeMarginPx : 0;
- hotseatBarSizePx = Utilities.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
+ // Add a bit of space between nav bar and hotseat in vertical bar layout.
+ hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? verticalDragHandleSizePx : 0;
+ hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
@@ -240,7 +237,8 @@
updateWorkspacePadding();
// This is done last, after iconSizePx is calculated above.
- mDotRenderer = new DotRenderer(iconSizePx);
+ mDotRenderer = new DotRenderer(iconSizePx, IconShape.getShapePath(),
+ IconShape.DEFAULT_PATH_SIZE);
}
public DeviceProfile copy(Context context) {
@@ -320,7 +318,7 @@
// Workspace
final boolean isVerticalLayout = isVerticalBarLayout();
float invIconSizePx = isVerticalLayout ? inv.landscapeIconSize : inv.iconSize;
- iconSizePx = Math.max(1, (int) (Utilities.pxFromDp(invIconSizePx, dm) * scale));
+ iconSizePx = Math.max(1, (int) (ResourceUtils.pxFromDp(invIconSizePx, dm) * scale));
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
@@ -400,7 +398,7 @@
}
private void updateFolderCellSize(float scale, DisplayMetrics dm, Resources res) {
- folderChildIconSizePx = (int) (Utilities.pxFromDp(inv.iconSize, dm) * scale);
+ folderChildIconSizePx = (int) (ResourceUtils.pxFromDp(inv.iconSize, dm) * scale);
folderChildTextSizePx =
(int) (res.getDimensionPixelSize(R.dimen.folder_child_text_size) * scale);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 819a551..8a8a2fb 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -210,7 +210,7 @@
iconSize = interpolatedDisplayOption.iconSize;
iconShapePath = getIconShapePath(context);
landscapeIconSize = interpolatedDisplayOption.landscapeIconSize;
- iconBitmapSize = Utilities.pxFromDp(iconSize, dm);
+ iconBitmapSize = ResourceUtils.pxFromDp(iconSize, dm);
iconTextSize = interpolatedDisplayOption.iconTextSize;
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 417c5a2..40eb912 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -72,7 +72,6 @@
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.OvershootInterpolator;
import android.widget.Toast;
@@ -191,6 +190,8 @@
private static final String RUNTIME_STATE = "launcher.state";
// Type: PendingRequestArgs
private static final String RUNTIME_STATE_PENDING_REQUEST_ARGS = "launcher.request_args";
+ // Type: int
+ private static final String RUNTIME_STATE_PENDING_REQUEST_CODE = "launcher.request_code";
// Type: ActivityResultInfo
private static final String RUNTIME_STATE_PENDING_ACTIVITY_RESULT = "launcher.activity_result";
// Type: SparseArray<Parcelable>
@@ -264,6 +265,8 @@
* {@link #startActivityForResult(Intent, int)} or {@link #requestPermissions(String[], int)}
*/
private PendingRequestArgs mPendingRequestArgs;
+ // Request id for any pending activity result
+ private int mPendingActivityRequestCode = -1;
public ViewGroupFocusHelper mFocusHandler;
@@ -303,6 +306,7 @@
LauncherAppState app = LauncherAppState.getInstance(this);
mOldConfig = new Configuration(getResources().getConfiguration());
mModel = app.setLauncher(this);
+ mRotationHelper = new RotationHelper(this);
InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
initDeviceProfile(idp);
idp.addOnChangeListener(this);
@@ -325,7 +329,6 @@
setupViews();
mPopupDataProvider = new PopupDataProvider(this);
- mRotationHelper = new RotationHelper(this);
mAppTransitionManager = LauncherAppTransitionManager.newInstance(this);
boolean internalStateHandled = InternalStateHandler.handleCreate(this, getIntent());
@@ -396,12 +399,6 @@
}
}
});
-
- if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) {
- WindowManager.LayoutParams lp = getWindow().getAttributes();
- lp.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
- getWindow().setAttributes(lp);
- }
}
@Override
@@ -428,11 +425,15 @@
super.onConfigurationChanged(newConfig);
}
+ private boolean supportsFakeLandscapeUI() {
+ return FeatureFlags.FAKE_LANDSCAPE_UI.get() && !mRotationHelper.homeScreenCanRotate();
+ }
+
@Override
- protected void reapplyUi() {
- if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) {
- mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL :
- (mDeviceProfile.isSeascape() ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE);
+ public void reapplyUi() {
+ if (supportsFakeLandscapeUI()) {
+ mRotationMode = mStableDeviceProfile == null
+ ? RotationMode.NORMAL : UiFactory.getRotationMode(mDeviceProfile);
}
getRootView().dispatchInsets();
getStateManager().reapplyState(true /* cancelCurrentAnimation */);
@@ -486,11 +487,11 @@
mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
}
- if (FeatureFlags.FAKE_LANDSCAPE_UI.get() && mDeviceProfile.isVerticalBarLayout()
+ if (supportsFakeLandscapeUI()
+ && mDeviceProfile.isVerticalBarLayout()
&& !mDeviceProfile.isMultiWindowMode) {
mStableDeviceProfile = mDeviceProfile.inv.portraitProfile;
- mRotationMode = mDeviceProfile.isSeascape()
- ? RotationMode.SEASCAPE : RotationMode.LANDSCAPE;
+ mRotationMode = UiFactory.getRotationMode(mDeviceProfile);
} else {
mStableDeviceProfile = null;
mRotationMode = RotationMode.NORMAL;
@@ -503,7 +504,9 @@
public void updateInsets(Rect insets) {
mDeviceProfile.updateInsets(insets);
if (mStableDeviceProfile != null) {
- mStableDeviceProfile.updateInsets(insets);
+ Rect r = mStableDeviceProfile.getInsets();
+ mRotationMode.mapInsets(this, insets, r);
+ mStableDeviceProfile.updateInsets(r);
}
}
@@ -762,6 +765,7 @@
@Override
public void onActivityResult(
final int requestCode, final int resultCode, final Intent data) {
+ mPendingActivityRequestCode = -1;
handleActivityResult(requestCode, resultCode, data);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onActivityResult(requestCode, resultCode, data);
@@ -890,9 +894,21 @@
UiFactory.onLauncherStateOrResumeChanged(this);
AppLaunchTracker.INSTANCE.get(this).onReturnedToHome();
+ resetPendingActivityResultIfNeeded();
}
}
+ private void resetPendingActivityResultIfNeeded() {
+ if (hasBeenResumed() && mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
+ UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+ }
+ }
+
+ protected void onStateSet(LauncherState state) {
+ getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
+ resetPendingActivityResultIfNeeded();
+ }
+
@Override
protected void onResume() {
RaceConditionTracker.onEvent(ON_RESUME_EVT, ENTER);
@@ -1009,6 +1025,7 @@
if (requestArgs != null) {
setWaitingForResult(requestArgs);
}
+ mPendingActivityRequestCode = savedState.getInt(RUNTIME_STATE_PENDING_REQUEST_CODE);
mPendingActivityResult = savedState.getParcelable(RUNTIME_STATE_PENDING_ACTIVITY_RESULT);
@@ -1392,6 +1409,8 @@
if (mPendingRequestArgs != null) {
outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs);
}
+ outState.putInt(RUNTIME_STATE_PENDING_REQUEST_CODE, mPendingActivityRequestCode);
+
if (mPendingActivityResult != null) {
outState.putParcelable(RUNTIME_STATE_PENDING_ACTIVITY_RESULT, mPendingActivityResult);
}
@@ -1448,17 +1467,29 @@
@Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
- super.startActivityForResult(intent, requestCode, options);
+ if (requestCode != -1) {
+ mPendingActivityRequestCode = requestCode;
+ }
+ if (requestCode == -1
+ || !UiFactory.startActivityForResult(this, intent, requestCode, options)) {
+ super.startActivityForResult(intent, requestCode, options);
+ }
}
@Override
- public void startIntentSenderForResult (IntentSender intent, int requestCode,
+ public void startIntentSenderForResult(IntentSender intent, int requestCode,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
- try {
- super.startIntentSenderForResult(intent, requestCode,
- fillInIntent, flagsMask, flagsValues, extraFlags, options);
- } catch (IntentSender.SendIntentException e) {
- throw new ActivityNotFoundException();
+ if (requestCode != -1) {
+ mPendingActivityRequestCode = requestCode;
+ }
+ if (requestCode == -1 || !UiFactory.startIntentSenderForResult(this, intent, requestCode,
+ fillInIntent, flagsMask, flagsValues, extraFlags, options)) {
+ try {
+ super.startIntentSenderForResult(intent, requestCode,
+ fillInIntent, flagsMask, flagsValues, extraFlags, options);
+ } catch (IntentSender.SendIntentException e) {
+ throw new ActivityNotFoundException();
+ }
}
}
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index f830301..6ad5c36 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -158,7 +158,8 @@
mOpenHelper = new DatabaseHelper(getContext(), mListenerHandler);
if (RestoreDbTask.isPending(getContext())) {
- if (!RestoreDbTask.performRestore(mOpenHelper, new BackupManager(getContext()))) {
+ if (!RestoreDbTask.performRestore(getContext(), mOpenHelper,
+ new BackupManager(getContext()))) {
mOpenHelper.createEmptyDB(mOpenHelper.getWritableDatabase());
}
// Set is pending to false irrespective of the result, so that it doesn't get
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 51079b0..eff58a7 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -18,7 +18,6 @@
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
-
import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL;
@@ -203,6 +202,10 @@
return UiFactory.getOverviewScaleAndTranslationForNormalState(launcher);
}
+ public float getOverviewFullscreenProgress() {
+ return 0;
+ }
+
public void onStateEnabled(Launcher launcher) {
dispatchWindowStateChanged(launcher);
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index f5040b3..b1a3fc9 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -452,7 +452,7 @@
}
mState = state;
mState.onStateEnabled(mLauncher);
- mLauncher.getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
+ mLauncher.onStateSet(mState);
if (state.disablePageClipping) {
// Only disable clipping if needed, otherwise leave it as previous value.
diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java
new file mode 100644
index 0000000..8df3290
--- /dev/null
+++ b/src/com/android/launcher3/ResourceUtils.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 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;
+
+import android.content.res.Resources;
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+
+public class ResourceUtils {
+ public static final String NAVBAR_VERTICAL_SIZE = "navigation_bar_frame_height";
+ public static final String NAVBAR_HORIZONTAL_SIZE = "navigation_bar_width";
+
+ public static int getNavbarSize(String resName, Resources res) {
+ return getDimenByName(resName, res, 48);
+ }
+
+ private static int getDimenByName(String resName, Resources res, int defaultValue) {
+ final int frameSize;
+ final int frameSizeResID = res.getIdentifier(resName, "dimen", "android");
+ if (frameSizeResID != 0) {
+ frameSize = res.getDimensionPixelSize(frameSizeResID);
+ } else {
+ frameSize = pxFromDp(defaultValue, res.getDisplayMetrics());
+ }
+ return frameSize;
+ }
+
+ public static int pxFromDp(float size, DisplayMetrics metrics) {
+ return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, size, metrics));
+ }
+}
diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/TestProtocol.java
index ecbaa5b..eefecda 100644
--- a/src/com/android/launcher3/TestProtocol.java
+++ b/src/com/android/launcher3/TestProtocol.java
@@ -24,6 +24,7 @@
public static final String SCROLL_Y_FIELD = "scrollY";
public static final String STATE_FIELD = "state";
public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
+ public static final String SCROLL_FINISHED_MESSAGE = "TAPL_SCROLL_FINISHED";
public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE";
public static final int NORMAL_STATE_ORDINAL = 0;
public static final int SPRING_LOADED_STATE_ORDINAL = 1;
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 35b967f..af22f1b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -17,6 +17,7 @@
package com.android.launcher3;
import android.animation.ValueAnimator;
+import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
@@ -32,12 +33,16 @@
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.InsetDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.DeadObjectException;
@@ -45,6 +50,7 @@
import android.os.Message;
import android.os.PowerManager;
import android.os.TransactionTooLargeException;
+import android.provider.Settings;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@@ -62,9 +68,11 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
import com.android.launcher3.graphics.RotationMode;
+import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.IntArray;
+import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.views.Transposable;
import com.android.launcher3.widget.PendingAddShortcutInfo;
@@ -74,6 +82,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
+import java.util.StringTokenizer;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -81,6 +90,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
+
/**
* Various utilities shared amongst the Launcher's classes.
*/
@@ -124,6 +135,11 @@
Build.TYPE.toLowerCase(Locale.ROOT).contains("debug") ||
Build.TYPE.toLowerCase(Locale.ROOT).equals("eng");
+ public static boolean isDevelopersOptionsEnabled(Context context) {
+ return Settings.Global.getInt(context.getApplicationContext().getContentResolver(),
+ Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+ }
+
// An intent extra to indicate the horizontal scroll of the wallpaper.
public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";
@@ -151,6 +167,12 @@
return Log.isLoggable(propertyName, Log.VERBOSE);
}
+ public static boolean existsStyleWallpapers(Context context) {
+ ResolveInfo ri = context.getPackageManager().resolveActivity(
+ PackageManagerHelper.getStyleWallpapersIntent(context), 0);
+ return ri != null;
+ }
+
/**
* Given a coordinate relative to the descendant, find the coordinate in a parent view's
* coordinates.
@@ -477,10 +499,7 @@
float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT;
return (size / densityRatio);
}
- public static int pxFromDp(float size, DisplayMetrics metrics) {
- return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
- size, metrics));
- }
+
public static int pxFromSp(float size, DisplayMetrics metrics) {
return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
size, metrics));
@@ -655,4 +674,77 @@
return null;
}
}
+
+ /**
+ * For apps icons and shortcut icons that have badges, this method creates a drawable that can
+ * later on be rendered on top of the layers for the badges. For app icons, work profile badges
+ * can only be applied. For deep shortcuts, when dragged from the pop up container, there's no
+ * badge. When dragged from workspace or folder, it may contain app AND/OR work profile badge
+ **/
+ @TargetApi(Build.VERSION_CODES.O)
+ public static Drawable getBadge(Launcher launcher, ItemInfo info, Object obj) {
+ LauncherAppState appState = LauncherAppState.getInstance(launcher);
+ int iconSize = appState.getInvariantDeviceProfile().iconBitmapSize;
+ if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
+ boolean iconBadged = (info instanceof ItemInfoWithIcon)
+ && (((ItemInfoWithIcon) info).runtimeStatusFlags & FLAG_ICON_BADGED) > 0;
+ if ((info.id == ItemInfo.NO_ID && !iconBadged)
+ || !(obj instanceof ShortcutInfo)) {
+ // The item is not yet added on home screen.
+ return new FixedSizeEmptyDrawable(iconSize);
+ }
+ ShortcutInfo si = (ShortcutInfo) obj;
+ LauncherIcons li = LauncherIcons.obtain(appState.getContext());
+ Bitmap badge = li.getShortcutInfoBadge(si, appState.getIconCache()).iconBitmap;
+ li.recycle();
+ float badgeSize = launcher.getResources().getDimension(R.dimen.profile_badge_size);
+ float insetFraction = (iconSize - badgeSize) / iconSize;
+ return new InsetDrawable(new FastBitmapDrawable(badge),
+ insetFraction, insetFraction, 0, 0);
+ } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
+ return ((FolderAdaptiveIcon) obj).getBadge();
+ } else {
+ return launcher.getPackageManager()
+ .getUserBadgedIcon(new FixedSizeEmptyDrawable(iconSize), info.user);
+ }
+ }
+
+ public static int[] getIntArrayFromString(String tokenized) {
+ StringTokenizer tokenizer = new StringTokenizer(tokenized, ",");
+ int[] array = new int[tokenizer.countTokens()];
+ int count = 0;
+ while (tokenizer.hasMoreTokens()) {
+ array[count] = Integer.parseInt(tokenizer.nextToken());
+ count++;
+ }
+ return array;
+ }
+
+ public static String getStringFromIntArray(int[] array) {
+ StringBuilder str = new StringBuilder();
+ for (int value : array) {
+ str.append(value).append(",");
+ }
+ return str.toString();
+ }
+
+ private static class FixedSizeEmptyDrawable extends ColorDrawable {
+
+ private final int mSize;
+
+ public FixedSizeEmptyDrawable(int size) {
+ super(Color.TRANSPARENT);
+ mSize = size;
+ }
+
+ @Override
+ public int getIntrinsicHeight() {
+ return mSize;
+ }
+
+ @Override
+ public int getIntrinsicWidth() {
+ return mSize;
+ }
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 0f4c42d..a508ce5 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -302,7 +302,7 @@
rotationMode.mapRect(padding, mTempRect);
setPadding(mTempRect.left, mTempRect.top, mTempRect.right, mTempRect.bottom);
- rotationMode.mapRect(insets, mInsets);
+ rotationMode.mapRect(stableGrid.getInsets(), mInsets);
if (mWorkspaceFadeInAdjacentScreens) {
// In landscape mode the page spacing is set to the default.
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index e2a5160..41252aa 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -604,4 +604,18 @@
return super.performAccessibilityAction(action, arguments);
}
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ switch (ev.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN:
+ mAllAppsStore.setDeferUpdates(true);
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ mAllAppsStore.setDeferUpdates(false);
+ break;
+ }
+ return super.dispatchTouchEvent(ev);
+ }
}
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 180ca48..548d5de 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -32,7 +32,8 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
-import com.android.launcher3.graphics.DrawableFactory;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
@@ -419,4 +420,13 @@
public boolean hasOverlappingRendering() {
return false;
}
+
+ @Override
+ public void onScrollStateChanged(int state) {
+ super.onScrollStateChanged(state);
+
+ if (state == SCROLL_STATE_IDLE && Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
+ }
+ }
}
diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java
index 7467119..1d62b43 100644
--- a/src/com/android/launcher3/allapps/DiscoveryBounce.java
+++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java
@@ -24,7 +24,6 @@
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
-import android.app.ActivityManager;
import android.content.SharedPreferences;
import android.os.Handler;
import android.view.MotionEvent;
@@ -32,6 +31,7 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.states.InternalStateHandler;
@@ -134,7 +134,7 @@
&& !shouldShowForWorkProfile(launcher))
|| AbstractFloatingView.getTopOpenView(launcher) != null
|| UserManagerCompat.getInstance(launcher).isDemoUser()
- || ActivityManager.isRunningInTestHarness()) {
+ || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
return;
}
@@ -159,7 +159,7 @@
|| (launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false)
&& !shouldShowForWorkProfile(launcher))
|| UserManagerCompat.getInstance(launcher).isDemoUser()
- || ActivityManager.isRunningInTestHarness()) {
+ || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
return;
}
diff --git a/src/com/android/launcher3/anim/FlingSpringAnim.java b/src/com/android/launcher3/anim/FlingSpringAnim.java
index bb0f855..f53ea51 100644
--- a/src/com/android/launcher3/anim/FlingSpringAnim.java
+++ b/src/com/android/launcher3/anim/FlingSpringAnim.java
@@ -28,10 +28,8 @@
public class FlingSpringAnim {
private static final float FLING_FRICTION = 1.5f;
- // Have the spring pull towards the target if we've slowed down too much before reaching it.
- private static final float FLING_END_THRESHOLD_PX = 50f;
- private static final float SPRING_STIFFNESS = 350f;
- private static final float SPRING_DAMPING = SpringForce.DAMPING_RATIO_LOW_BOUNCY;
+ private static final float SPRING_STIFFNESS = 200;
+ private static final float SPRING_DAMPING = 0.85f;
private final FlingAnimation mFlingAnim;
private SpringAnimation mSpringAnim;
@@ -39,23 +37,27 @@
private float mTargetPosition;
public <K> FlingSpringAnim(K object, FloatPropertyCompat<K> property, float startPosition,
- float targetPosition, float startVelocity, OnAnimationEndListener onEndListener) {
+ float targetPosition, float startVelocity, float minVisChange, float minValue,
+ float maxValue, float springVelocityFactor, OnAnimationEndListener onEndListener) {
mFlingAnim = new FlingAnimation(object, property)
.setFriction(FLING_FRICTION)
- .setMinimumVisibleChange(FLING_END_THRESHOLD_PX)
+ // Have the spring pull towards the target if we've slowed down too much before
+ // reaching it.
+ .setMinimumVisibleChange(minVisChange)
.setStartVelocity(startVelocity)
- .setMinValue(Math.min(startPosition, targetPosition))
- .setMaxValue(Math.max(startPosition, targetPosition));
+ .setMinValue(minValue)
+ .setMaxValue(maxValue);
mTargetPosition = targetPosition;
mFlingAnim.addEndListener(((animation, canceled, value, velocity) -> {
mSpringAnim = new SpringAnimation(object, property)
- .setStartVelocity(velocity)
+ .setStartValue(value)
+ .setStartVelocity(velocity * springVelocityFactor)
.setSpring(new SpringForce(mTargetPosition)
.setStiffness(SPRING_STIFFNESS)
.setDampingRatio(SPRING_DAMPING));
mSpringAnim.addEndListener(onEndListener);
- mSpringAnim.start();
+ mSpringAnim.animateToFinalPosition(mTargetPosition);
}));
}
diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
index b4d0c54..86f773f 100644
--- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
+++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
@@ -62,6 +62,13 @@
sendEventToTest(accessibilityManager, TestProtocol.SWITCHED_TO_STATE_MESSAGE, parcel);
}
+ public static void sendScrollFinishedEventToTest(Context context) {
+ final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
+ if (accessibilityManager == null) return;
+
+ sendEventToTest(accessibilityManager, TestProtocol.SCROLL_FINISHED_MESSAGE, null);
+ }
+
private static void sendEventToTest(
AccessibilityManager accessibilityManager, String eventTag, Bundle data) {
final AccessibilityEvent e = AccessibilityEvent.obtain(
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompat.java b/src/com/android/launcher3/compat/LauncherAppsCompat.java
index 4275f31..58fc73d 100644
--- a/src/com/android/launcher3/compat/LauncherAppsCompat.java
+++ b/src/com/android/launcher3/compat/LauncherAppsCompat.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
+import android.content.pm.PackageInstaller;
import android.content.pm.ShortcutInfo;
import android.graphics.Rect;
import android.os.Bundle;
@@ -56,7 +57,9 @@
public static LauncherAppsCompat getInstance(Context context) {
synchronized (sInstanceLock) {
if (sInstance == null) {
- if (Utilities.ATLEAST_OREO) {
+ if (Utilities.ATLEAST_Q) {
+ sInstance = new LauncherAppsCompatVQ(context.getApplicationContext());
+ } else if (Utilities.ATLEAST_OREO) {
sInstance = new LauncherAppsCompatVO(context.getApplicationContext());
} else {
sInstance = new LauncherAppsCompatVL(context.getApplicationContext());
@@ -83,4 +86,6 @@
UserHandle user);
public abstract List<ShortcutConfigActivityInfo> getCustomShortcutActivityList(
@Nullable PackageUserKey packageUser);
+
+ public abstract List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions();
}
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
index fc48ba7..1d19b53 100644
--- a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
+++ b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
@@ -22,6 +22,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
+import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
@@ -199,5 +200,10 @@
}
return result;
}
+
+ @Override
+ public List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions() {
+ return mContext.getPackageManager().getPackageInstaller().getAllSessions();
+ }
}
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVQ.java b/src/com/android/launcher3/compat/LauncherAppsCompatVQ.java
new file mode 100644
index 0000000..0a1811e
--- /dev/null
+++ b/src/com/android/launcher3/compat/LauncherAppsCompatVQ.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 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.compat;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInstaller;
+
+import java.util.List;
+
+@TargetApi(29)
+public class LauncherAppsCompatVQ extends LauncherAppsCompatVO {
+
+ LauncherAppsCompatVQ(Context context) {
+ super(context);
+ }
+
+ public List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions() {
+ return mLauncherApps.getAllPackageInstallerSessions();
+ }
+}
diff --git a/src/com/android/launcher3/compat/PackageInstallerCompatVL.java b/src/com/android/launcher3/compat/PackageInstallerCompatVL.java
index fe7b4e5..a34ca50 100644
--- a/src/com/android/launcher3/compat/PackageInstallerCompatVL.java
+++ b/src/com/android/launcher3/compat/PackageInstallerCompatVL.java
@@ -27,6 +27,7 @@
import android.text.TextUtils;
import android.util.SparseArray;
+import com.android.launcher3.Utilities;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
@@ -49,6 +50,7 @@
private final Handler mWorker;
private final Context mAppContext;
private final HashMap<String,Boolean> mSessionVerifiedMap = new HashMap<>();
+ private final LauncherAppsCompat mLauncherApps;
PackageInstallerCompatVL(Context context) {
mAppContext = context.getApplicationContext();
@@ -56,6 +58,7 @@
mCache = LauncherAppState.getInstance(context).getIconCache();
mWorker = new Handler(LauncherModel.getWorkerLooper());
mInstaller.registerSessionCallback(mCallback, mWorker);
+ mLauncherApps = LauncherAppsCompat.getInstance(context);
}
@Override
@@ -171,7 +174,9 @@
@Override
public List<SessionInfo> getAllVerifiedSessions() {
- List<SessionInfo> list = new ArrayList<>(mInstaller.getAllSessions());
+ List<SessionInfo> list = new ArrayList<>(Utilities.ATLEAST_Q
+ ? mLauncherApps.getAllPackageInstallerSessions()
+ : mInstaller.getAllSessions());
Iterator<SessionInfo> it = list.iterator();
while (it.hasNext()) {
if (verify(it.next()) == null) {
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index 70df97a..7e20d11 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -58,9 +58,7 @@
}
public static boolean showFlagTogglerUi(Context context) {
- return Utilities.IS_DEBUG_DEVICE &&
- Settings.Global.getInt(context.getApplicationContext().getContentResolver(),
- Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+ return Utilities.IS_DEBUG_DEVICE && Utilities.isDevelopersOptionsEnabled(context);
}
public static final boolean IS_DOGFOOD_BUILD = false;
@@ -111,7 +109,7 @@
"Show chip hints and gleams on the overview screen");
public static final TogglableFlag FAKE_LANDSCAPE_UI = new TogglableFlag(
- "FAKE_LANDSCAPE_UI", false,
+ "FAKE_LANDSCAPE_UI", true,
"Rotate launcher UI instead of using transposed layout");
public static void initialize(Context context) {
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 8de2f57..b35e23c 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -638,25 +638,11 @@
final int layoutDirection = getLayoutDirection();
int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
- int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
- int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK;
if (child instanceof Transposable) {
- if (rotation == RotationMode.SEASCAPE) {
- if (horizontalGravity == Gravity.RIGHT) {
- horizontalGravity = Gravity.LEFT;
- } else if (horizontalGravity == Gravity.LEFT) {
- horizontalGravity = Gravity.RIGHT;
- }
+ absoluteGravity = rotation.toNaturalGravity(absoluteGravity);
- if (verticalGravity == Gravity.TOP) {
- verticalGravity = Gravity.BOTTOM;
- } else if (verticalGravity == Gravity.BOTTOM) {
- verticalGravity = Gravity.TOP;
- }
- }
-
- switch (horizontalGravity) {
+ switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.CENTER_HORIZONTAL:
childTop = (parentHeight - height) / 2 +
lp.topMargin - lp.bottomMargin;
@@ -669,7 +655,7 @@
childTop = parentHeight - lp.leftMargin - width / 2 - height / 2;
}
- switch (verticalGravity) {
+ switch (absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) {
case Gravity.CENTER_VERTICAL:
childLeft = (parentWidth - width) / 2 +
lp.leftMargin - lp.rightMargin;
@@ -682,7 +668,7 @@
childLeft = height / 2 - width / 2 + lp.topMargin;
}
} else {
- switch (horizontalGravity) {
+ switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.CENTER_HORIZONTAL:
childLeft = (parentWidth - width) / 2 +
lp.leftMargin - lp.rightMargin;
@@ -695,7 +681,7 @@
childLeft = lp.leftMargin;
}
- switch (verticalGravity) {
+ switch (absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) {
case Gravity.TOP:
childTop = lp.topMargin;
break;
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 3ab97b0..7af12c5 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -16,7 +16,7 @@
package com.android.launcher3.dragndrop;
-import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
+import static com.android.launcher3.Utilities.getBadge;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -24,7 +24,6 @@
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.TargetApi;
-import android.content.pm.ShortcutInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -37,7 +36,6 @@
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.InsetDrawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
@@ -45,11 +43,11 @@
import com.android.launcher3.FastBitmapDrawable;
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.FirstFrameAnimatorHelper;
@@ -64,7 +62,7 @@
import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
-public class DragView extends View {
+public class DragView extends View implements LauncherStateManager.StateListener {
private static final ColorMatrix sTempMatrix1 = new ColorMatrix();
private static final ColorMatrix sTempMatrix2 = new ColorMatrix();
@@ -176,6 +174,27 @@
setElevation(getResources().getDimension(R.dimen.drag_elevation));
}
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mLauncher.getStateManager().addStateListener(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mLauncher.getStateManager().removeStateListener(this);
+ }
+
+ @Override
+ public void onStateTransitionStart(LauncherState toState) { }
+
+ @Override
+ public void onStateTransitionComplete(LauncherState finalState) {
+ setVisibility((finalState == LauncherState.NORMAL
+ || finalState == LauncherState.SPRING_LOADED) ? VISIBLE : INVISIBLE);
+ }
+
/**
* Initialize {@code #mIconDrawable} if the item can be represented using
* an {@link AdaptiveIconDrawable} or {@link FolderAdaptiveIcon}.
@@ -195,7 +214,6 @@
new Handler(workerLooper).postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
- LauncherAppState appState = LauncherAppState.getInstance(mLauncher);
Object[] outObj = new Object[1];
int w = mBitmap.getWidth();
int h = mBitmap.getHeight();
@@ -211,7 +229,7 @@
// Badge is applied after icon normalization so the bounds for badge should not
// be scaled down due to icon normalization.
Rect badgeBounds = new Rect(bounds);
- mBadge = getBadge(info, appState, outObj[0]);
+ mBadge = getBadge(mLauncher, info, outObj[0]);
mBadge.setBounds(badgeBounds);
// Do not draw the background in case of folder as its translucent
@@ -307,40 +325,6 @@
invalidate();
}
- /**
- * For apps icons and shortcut icons that have badges, this method creates a drawable that can
- * later on be rendered on top of the layers for the badges. For app icons, work profile badges
- * can only be applied. For deep shortcuts, when dragged from the pop up container, there's no
- * badge. When dragged from workspace or folder, it may contain app AND/OR work profile badge
- **/
-
- @TargetApi(Build.VERSION_CODES.O)
- private Drawable getBadge(ItemInfo info, LauncherAppState appState, Object obj) {
- int iconSize = appState.getInvariantDeviceProfile().iconBitmapSize;
- if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
- boolean iconBadged = (info instanceof ItemInfoWithIcon)
- && (((ItemInfoWithIcon) info).runtimeStatusFlags & FLAG_ICON_BADGED) > 0;
- if ((info.id == ItemInfo.NO_ID && !iconBadged)
- || !(obj instanceof ShortcutInfo)) {
- // The item is not yet added on home screen.
- return new FixedSizeEmptyDrawable(iconSize);
- }
- ShortcutInfo si = (ShortcutInfo) obj;
- LauncherIcons li = LauncherIcons.obtain(appState.getContext());
- Bitmap badge = li.getShortcutInfoBadge(si, appState.getIconCache()).iconBitmap;
- li.recycle();
- float badgeSize = mLauncher.getResources().getDimension(R.dimen.profile_badge_size);
- float insetFraction = (iconSize - badgeSize) / iconSize;
- return new InsetDrawable(new FastBitmapDrawable(badge),
- insetFraction, insetFraction, 0, 0);
- } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
- return ((FolderAdaptiveIcon) obj).getBadge();
- } else {
- return mLauncher.getPackageManager()
- .getUserBadgedIcon(new FixedSizeEmptyDrawable(iconSize), info.user);
- }
- }
-
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());
@@ -626,24 +610,4 @@
mSpring.animateToFinalPosition(Utilities.boundToRange(value, -mDelta, mDelta));
}
}
-
- private static class FixedSizeEmptyDrawable extends ColorDrawable {
-
- private final int mSize;
-
- public FixedSizeEmptyDrawable(int size) {
- super(Color.TRANSPARENT);
- mSize = size;
- }
-
- @Override
- public int getIntrinsicHeight() {
- return mSize;
- }
-
- @Override
- public int getIntrinsicWidth() {
- return mSize;
- }
- }
}
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 2450039..962f215 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -35,10 +35,13 @@
import android.view.View;
import android.view.animation.AnimationUtils;
+import androidx.core.graphics.ColorUtils;
+
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PropertyResetListener;
@@ -151,7 +154,8 @@
final float yDistance = initialY - lp.y;
// Set up the Folder background.
- final int finalColor = Themes.getAttrColor(mContext, android.R.attr.colorPrimary);
+ final int finalColor = ColorUtils.setAlphaComponent(
+ Themes.getAttrColor(mContext, R.attr.folderFillColor), 255);
final int initialColor = setColorAlphaBound(
finalColor, mPreviewBackground.getBackgroundAlpha());
mFolderBackground.mutate();
@@ -165,7 +169,7 @@
Math.round((totalOffsetX + initialSize) / initialScale),
Math.round((paddingOffsetY + initialSize) / initialScale));
Rect endRect = new Rect(0, 0, lp.width, lp.height);
- float finalRadius = Utilities.pxFromDp(2, mContext.getResources().getDisplayMetrics());
+ float finalRadius = ResourceUtils.pxFromDp(2, mContext.getResources().getDisplayMetrics());
// Create the animators.
AnimatorSet a = new AnimatorSet();
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 6fa9ba9..8d9c520 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -36,6 +36,8 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import androidx.annotation.NonNull;
+
import com.android.launcher3.Alarm;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BubbleTextView;
@@ -50,11 +52,11 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.OnAlarmListener;
import com.android.launcher3.R;
-import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.SimpleOnStylusPressListener;
import com.android.launcher3.StylusEventHelper;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.dot.FolderDotInfo;
import com.android.launcher3.dragndrop.BaseItemDragListener;
@@ -68,8 +70,6 @@
import java.util.ArrayList;
import java.util.List;
-import androidx.annotation.NonNull;
-
/**
* An icon that can appear on in the workspace representing an {@link Folder}.
*/
@@ -510,10 +510,11 @@
Rect iconBounds = mDotParams.iconBounds;
BubbleTextView.getIconBounds(this, iconBounds,
mLauncher.getWallpaperDeviceProfile().iconSizePx);
+ float iconScale = (float) mBackground.previewSize / iconBounds.width();
+ Utilities.scaleRectAboutCenter(iconBounds, iconScale);
// If we are animating to the accepting state, animate the dot out.
mDotParams.scale = Math.max(0, mDotScale - mBackground.getScaleProgress());
- mDotParams.spaceForOffset.set(getWidth() - iconBounds.right, iconBounds.top);
mDotParams.color = mBackground.getDotColor();
mDotRenderer.draw(canvas, mDotParams);
}
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index 09e8276..b2c0ca7 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -131,7 +131,7 @@
TypedArray ta = context.getTheme().obtainStyledAttributes(R.styleable.FolderIconPreview);
mDotColor = ta.getColor(R.styleable.FolderIconPreview_folderDotColor, 0);
mStrokeColor = ta.getColor(R.styleable.FolderIconPreview_folderIconBorderColor, 0);
- mBgColor = ta.getColor(R.styleable.FolderIconPreview_android_colorPrimary, 0);
+ mBgColor = ta.getColor(R.styleable.FolderIconPreview_folderFillColor, 0);
ta.recycle();
DeviceProfile grid = activity.getWallpaperDeviceProfile();
diff --git a/src/com/android/launcher3/graphics/RotationMode.java b/src/com/android/launcher3/graphics/RotationMode.java
index 1b2cbdb..b06305f 100644
--- a/src/com/android/launcher3/graphics/RotationMode.java
+++ b/src/com/android/launcher3/graphics/RotationMode.java
@@ -15,14 +15,17 @@
*/
package com.android.launcher3.graphics;
+import android.content.Context;
import android.graphics.Rect;
public abstract class RotationMode {
+ public static RotationMode NORMAL = new RotationMode(0) { };
+
public final float surfaceRotation;
public final boolean isTransposed;
- private RotationMode(float surfaceRotation) {
+ public RotationMode(float surfaceRotation) {
this.surfaceRotation = surfaceRotation;
isTransposed = surfaceRotation != 0;
}
@@ -35,25 +38,11 @@
out.set(left, top, right, bottom);
}
- public static RotationMode NORMAL = new RotationMode(0) { };
+ public void mapInsets(Context context, Rect insets, Rect out) {
+ out.set(insets);
+ }
- public static RotationMode LANDSCAPE = new RotationMode(-90) {
- @Override
- public void mapRect(int left, int top, int right, int bottom, Rect out) {
- out.left = top;
- out.top = right;
- out.right = bottom;
- out.bottom = left;
- }
- };
-
- public static RotationMode SEASCAPE = new RotationMode(90) {
- @Override
- public void mapRect(int left, int top, int right, int bottom, Rect out) {
- out.left = bottom;
- out.top = left;
- out.right = top;
- out.bottom = right;
- }
- };
+ public int toNaturalGravity(int absoluteGravity) {
+ return absoluteGravity;
+ }
}
diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
index 66f9dbf..c0aa75f 100644
--- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
+++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
@@ -43,7 +43,7 @@
import com.android.launcher3.CellLayout;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.Workspace;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.util.Themes;
@@ -148,7 +148,7 @@
mLauncher = Launcher.getLauncher(view.getContext());
mWallpaperColorInfo = WallpaperColorInfo.getInstance(mLauncher);
- mMaskHeight = Utilities.pxFromDp(ALPHA_MASK_BITMAP_DP,
+ mMaskHeight = ResourceUtils.pxFromDp(ALPHA_MASK_BITMAP_DP,
view.getResources().getDisplayMetrics());
mTopScrim = Themes.getAttrDrawable(view.getContext(), R.attr.workspaceStatusBarScrim);
mBottomMask = mTopScrim == null ? null : createDitheredAlphaMask();
@@ -297,8 +297,8 @@
public Bitmap createDitheredAlphaMask() {
DisplayMetrics dm = mLauncher.getResources().getDisplayMetrics();
- int width = Utilities.pxFromDp(ALPHA_MASK_WIDTH_DP, dm);
- int gradientHeight = Utilities.pxFromDp(ALPHA_MASK_HEIGHT_DP, dm);
+ int width = ResourceUtils.pxFromDp(ALPHA_MASK_WIDTH_DP, dm);
+ int gradientHeight = ResourceUtils.pxFromDp(ALPHA_MASK_HEIGHT_DP, dm);
Bitmap dst = Bitmap.createBitmap(width, mMaskHeight, Bitmap.Config.ALPHA_8);
Canvas c = new Canvas(dst);
Paint paint = new Paint(Paint.DITHER_FLAG);
diff --git a/src/com/android/launcher3/logging/EventLogArray.java b/src/com/android/launcher3/logging/EventLogArray.java
index bfb3792..f20f365 100644
--- a/src/com/android/launcher3/logging/EventLogArray.java
+++ b/src/com/android/launcher3/logging/EventLogArray.java
@@ -18,6 +18,7 @@
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
@@ -76,8 +77,12 @@
nextIndex = (nextIndex + 1) % logs.length;
}
+ public void clear() {
+ Arrays.setAll(logs, (i) -> null);
+ }
+
public void dump(String prefix, PrintWriter writer) {
- writer.println(prefix + name + " event history:");
+ writer.println(prefix + "EventLog (" + name + ") history:");
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm:ss.SSSZ ", Locale.US);
Date date = new Date();
diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java
index 1ffa698..9b75b43 100644
--- a/src/com/android/launcher3/logging/LoggerUtils.java
+++ b/src/com/android/launcher3/logging/LoggerUtils.java
@@ -144,6 +144,10 @@
+ "), pageIdx=" + t.pageIndex;
}
+ if (t.searchQueryLength != 0) {
+ typeStr += ", searchQueryLength=" + t.searchQueryLength;
+ }
+
if (t.itemType == ItemType.TASK) {
typeStr += ", pageIdx=" + t.pageIndex;
}
diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java
index e6e20e1..3c0c5fd 100644
--- a/src/com/android/launcher3/provider/RestoreDbTask.java
+++ b/src/com/android/launcher3/provider/RestoreDbTask.java
@@ -16,18 +16,23 @@
package com.android.launcher3.provider;
+import static com.android.launcher3.Utilities.getIntArrayFromString;
+import static com.android.launcher3.Utilities.getStringFromIntArray;
import static com.android.launcher3.provider.LauncherDbUtils.dropTable;
import android.app.backup.BackupManager;
import android.content.ContentValues;
import android.content.Context;
+import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import android.os.Build;
import android.os.UserHandle;
import android.util.LongSparseArray;
import android.util.SparseLongArray;
+import androidx.annotation.NonNull;
+
+import com.android.launcher3.AppWidgetsRestoredReceiver;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherProvider.DatabaseHelper;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -53,10 +58,16 @@
private static final String INFO_COLUMN_NAME = "name";
private static final String INFO_COLUMN_DEFAULT_VALUE = "dflt_value";
- public static boolean performRestore(DatabaseHelper helper, BackupManager backupManager) {
+ private static final String APPWIDGET_OLD_IDS = "appwidget_old_ids";
+ private static final String APPWIDGET_IDS = "appwidget_ids";
+
+ public static boolean performRestore(Context context, DatabaseHelper helper,
+ BackupManager backupManager) {
SQLiteDatabase db = helper.getWritableDatabase();
try (SQLiteTransaction t = new SQLiteTransaction(db)) {
- new RestoreDbTask().sanitizeDB(helper, db, backupManager);
+ RestoreDbTask task = new RestoreDbTask();
+ task.sanitizeDB(helper, db, backupManager);
+ task.restoreAppWidgetIdsIfExists(context);
t.commit();
return true;
} catch (Exception e) {
@@ -201,7 +212,7 @@
*/
private UserHandle getUserForAncestralSerialNumber(BackupManager backupManager,
long ancestralSerialNumber) {
- if (Build.VERSION.SDK_INT < 29) {
+ if (!Utilities.ATLEAST_Q) {
return null;
}
return backupManager.getUserForAncestralSerialNumber(ancestralSerialNumber);
@@ -230,4 +241,27 @@
FileLog.d(TAG, "Restore data received through full backup " + isPending);
Utilities.getPrefs(context).edit().putBoolean(RESTORE_TASK_PENDING, isPending).commit();
}
+
+ private void restoreAppWidgetIdsIfExists(Context context) {
+ SharedPreferences prefs = Utilities.getPrefs(context);
+ if (prefs.contains(APPWIDGET_OLD_IDS) && prefs.contains(APPWIDGET_IDS)) {
+ AppWidgetsRestoredReceiver.restoreAppWidgetIds(context,
+ getIntArrayFromString(prefs.getString(APPWIDGET_OLD_IDS, "")),
+ getIntArrayFromString(prefs.getString(APPWIDGET_IDS, "")));
+ } else {
+ FileLog.d(TAG, "No app widget ids to restore.");
+ }
+
+ prefs.edit().remove(APPWIDGET_OLD_IDS)
+ .remove(APPWIDGET_IDS).apply();
+ }
+
+ public static void setRestoredAppWidgetIds(Context context, @NonNull int[] oldIds,
+ @NonNull int[] newIds) {
+ Utilities.getPrefs(context).edit()
+ .putString(APPWIDGET_OLD_IDS, getStringFromIntArray(oldIds))
+ .putString(APPWIDGET_IDS, getStringFromIntArray(newIds))
+ .commit();
+ }
+
}
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index 6e7188f..18b6094 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -24,6 +24,10 @@
import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
@@ -32,6 +36,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.GridOptionsProvider;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.SecureSettingsObserver;
@@ -47,7 +52,8 @@
* Settings activity for Launcher. Currently implements the following setting: Allow rotation
*/
public class SettingsActivity extends Activity
- implements OnPreferenceStartFragmentCallback, OnPreferenceStartScreenCallback {
+ implements OnPreferenceStartFragmentCallback, OnPreferenceStartScreenCallback,
+ SharedPreferences.OnSharedPreferenceChangeListener{
private static final String DEVELOPER_OPTIONS_KEY = "pref_developer_options";
private static final String FLAGS_PREFERENCE_KEY = "flag_toggler";
@@ -61,6 +67,8 @@
private static final int DELAY_HIGHLIGHT_DURATION_MILLIS = 600;
public static final String SAVE_HIGHLIGHTED_KEY = "android:preference_highlighted";
+ public static final String GRID_OPTIONS_PREFERENCE_KEY = "pref_grid_options";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -79,6 +87,28 @@
.replace(android.R.id.content, f)
.commit();
}
+ Utilities.getPrefs(getApplicationContext()).registerOnSharedPreferenceChangeListener(this);
+ }
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (GRID_OPTIONS_PREFERENCE_KEY.equals(key)) {
+
+ final ComponentName cn = new ComponentName(getApplicationContext(),
+ GridOptionsProvider.class);
+ Context c = getApplicationContext();
+ int oldValue = c.getPackageManager().getComponentEnabledSetting(cn);
+ int newValue;
+ if (Utilities.getPrefs(c).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)) {
+ newValue = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+ } else {
+ newValue = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+ }
+
+ if (oldValue != newValue) {
+ c.getPackageManager().setComponentEnabledSetting(cn, newValue,
+ PackageManager.DONT_KILL_APP);
+ }
+ }
}
private boolean startFragment(String fragment, Bundle args, String key) {
@@ -200,6 +230,10 @@
// Show if plugins are enabled or flag UI is enabled.
return FeatureFlags.showFlagTogglerUi(getContext()) ||
PluginManagerWrapper.hasPlugins(getContext());
+ case GRID_OPTIONS_PREFERENCE_KEY:
+ return Utilities.isDevelopersOptionsEnabled(getContext()) &&
+ Utilities.IS_DEBUG_DEVICE &&
+ Utilities.existsStyleWallpapers(getContext());
}
return true;
diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java
index fb41ea1..3727fa6 100644
--- a/src/com/android/launcher3/states/RotationHelper.java
+++ b/src/com/android/launcher3/states/RotationHelper.java
@@ -20,13 +20,16 @@
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.util.DisplayMetrics.DENSITY_DEVICE_STABLE;
-import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
+import android.view.WindowManager;
+import android.view.WindowManager.LayoutParams;
+import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.UiThreadHelper;
/**
@@ -49,7 +52,7 @@
public static final int REQUEST_ROTATE = 1;
public static final int REQUEST_LOCK = 2;
- private final Activity mActivity;
+ private final Launcher mLauncher;
private final SharedPreferences mPrefs;
private boolean mIgnoreAutoRotateSettings;
@@ -70,13 +73,13 @@
private int mLastActivityFlags = -1;
- public RotationHelper(Activity activity) {
- mActivity = activity;
+ public RotationHelper(Launcher launcher) {
+ mLauncher = launcher;
// On large devices we do not handle auto-rotate differently.
- mIgnoreAutoRotateSettings = mActivity.getResources().getBoolean(R.bool.allow_rotation);
+ mIgnoreAutoRotateSettings = mLauncher.getResources().getBoolean(R.bool.allow_rotation);
if (!mIgnoreAutoRotateSettings) {
- mPrefs = Utilities.getPrefs(mActivity);
+ mPrefs = Utilities.getPrefs(mLauncher);
mPrefs.registerOnSharedPreferenceChangeListener(this);
mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue());
@@ -85,11 +88,32 @@
}
}
+ public boolean homeScreenCanRotate() {
+ return mIgnoreAutoRotateSettings || mAutoRotateEnabled
+ || mStateHandlerRequest != REQUEST_NONE;
+ }
+
+ private void updateRotationAnimation() {
+ if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) {
+ WindowManager.LayoutParams lp = mLauncher.getWindow().getAttributes();
+ lp.rotationAnimation = homeScreenCanRotate()
+ ? WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE
+ : WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
+ mLauncher.getWindow().setAttributes(lp);
+ }
+ }
+
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
+ boolean wasRotationEnabled = mAutoRotateEnabled;
mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue());
- notifyChange();
+ if (mAutoRotateEnabled != wasRotationEnabled) {
+
+ notifyChange();
+ updateRotationAnimation();
+ mLauncher.reapplyUi();
+ }
}
public void setStateHandlerRequest(int request) {
@@ -109,7 +133,7 @@
// Used by tests only.
public void forceAllowRotationForTesting(boolean allowRotation) {
mIgnoreAutoRotateSettings =
- allowRotation || mActivity.getResources().getBoolean(R.bool.allow_rotation);
+ allowRotation || mLauncher.getResources().getBoolean(R.bool.allow_rotation);
notifyChange();
}
@@ -117,6 +141,7 @@
if (!mInitialized) {
mInitialized = true;
notifyChange();
+ updateRotationAnimation();
}
}
@@ -150,7 +175,7 @@
}
if (activityFlags != mLastActivityFlags) {
mLastActivityFlags = activityFlags;
- UiThreadHelper.setOrientationAsync(mActivity, activityFlags);
+ UiThreadHelper.setOrientationAsync(mLauncher, activityFlags);
}
}
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 7439ac1..7d3a941 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -172,6 +172,11 @@
}
}
+ public static Intent getStyleWallpapersIntent(Context context) {
+ return new Intent(Intent.ACTION_SET_WALLPAPER).setComponent(
+ new ComponentName(context.getString(R.string.wallpaper_picker_package),
+ "com.android.customization.picker.CustomizationPickerActivity"));
+ }
/**
* Starts the details activity for {@code info}
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
index 0c44012..0d02715 100644
--- a/src/com/android/launcher3/util/Themes.java
+++ b/src/com/android/launcher3/util/Themes.java
@@ -48,10 +48,12 @@
if (darkTheme) {
return wallpaperColorInfo.supportsDarkText() ?
- R.style.AppTheme_Dark_DarkText : R.style.AppTheme_Dark;
+ R.style.AppTheme_Dark_DarkText : wallpaperColorInfo.isMainColorDark() ?
+ R.style.AppTheme_Dark_DarkMainColor : R.style.AppTheme_Dark;
} else {
return wallpaperColorInfo.supportsDarkText() ?
- R.style.AppTheme_DarkText : R.style.AppTheme;
+ R.style.AppTheme_DarkText : wallpaperColorInfo.isMainColorDark() ?
+ R.style.AppTheme_DarkMainColor : R.style.AppTheme;
}
}
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 787c93c..e5c75c3 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.views;
+import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
+import static com.android.launcher3.Utilities.getBadge;
import static com.android.launcher3.Utilities.mapToRange;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
@@ -62,6 +64,9 @@
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
+import androidx.dynamicanimation.animation.FloatPropertyCompat;
+import androidx.dynamicanimation.animation.SpringAnimation;
+import androidx.dynamicanimation.animation.SpringForce;
/**
* A view that is created to look like another view with the purpose of creating fluid animations.
@@ -76,6 +81,39 @@
private static final RectF sTmpRectF = new RectF();
private static final Object[] sTmpObjArray = new Object[1];
+ // We spring the foreground drawable relative to the icon's movement in the DragLayer.
+ // We then use these two factor values to scale the movement of the fg within this view.
+ private static final int FG_TRANS_X_FACTOR = 80;
+ private static final int FG_TRANS_Y_FACTOR = 100;
+
+ private static final FloatPropertyCompat<FloatingIconView> mFgTransYProperty
+ = new FloatPropertyCompat<FloatingIconView>("FloatingViewFgTransY") {
+ @Override
+ public float getValue(FloatingIconView view) {
+ return view.mFgTransY;
+ }
+
+ @Override
+ public void setValue(FloatingIconView view, float transY) {
+ view.mFgTransY = transY;
+ view.invalidate();
+ }
+ };
+
+ private static final FloatPropertyCompat<FloatingIconView> mFgTransXProperty
+ = new FloatPropertyCompat<FloatingIconView>("FloatingViewFgTransX") {
+ @Override
+ public float getValue(FloatingIconView view) {
+ return view.mFgTransX;
+ }
+
+ @Override
+ public void setValue(FloatingIconView view, float transX) {
+ view.mFgTransX = transX;
+ view.invalidate();
+ }
+ };
+
private Runnable mEndRunnable;
private CancellationSignal mLoadIconSignal;
@@ -85,6 +123,7 @@
private boolean mIsVerticalBarLayout = false;
private boolean mIsAdaptiveIcon = false;
+ private @Nullable Drawable mBadge;
private @Nullable Drawable mForeground;
private @Nullable Drawable mBackground;
private float mRotation;
@@ -98,20 +137,32 @@
private RectF mPositionOut;
private Runnable mOnTargetChangeRunnable;
+ private final Rect mOutline = new Rect();
private final Rect mFinalDrawableBounds = new Rect();
- private final Rect mBgDrawableBounds = new Rect();
- private float mBgDrawableStartScale = 1f;
- private float mBgDrawableEndScale = 1f;
private AnimatorSet mFadeAnimatorSet;
private ListenerView mListenerView;
+ private final SpringAnimation mFgSpringY;
+ private float mFgTransY;
+ private final SpringAnimation mFgSpringX;
+ private float mFgTransX;
+
private FloatingIconView(Launcher launcher) {
super(launcher);
mLauncher = launcher;
mBlurSizeOutline = getResources().getDimensionPixelSize(
R.dimen.blur_size_medium_outline);
mListenerView = new ListenerView(launcher, null);
+
+ mFgSpringX = new SpringAnimation(this, mFgTransXProperty)
+ .setSpring(new SpringForce()
+ .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
+ .setStiffness(SpringForce.STIFFNESS_LOW));
+ mFgSpringY = new SpringAnimation(this, mFgTransYProperty)
+ .setSpring(new SpringForce()
+ .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
+ .setStiffness(SpringForce.STIFFNESS_LOW));
}
@Override
@@ -143,11 +194,10 @@
setTranslationX(dX);
setTranslationY(dY);
- float scaleX = rect.width() / (float) lp.width;
- float scaleY = rect.height() / (float) lp.height;
- float scale = mIsAdaptiveIcon && !isOpening ? Math.max(scaleX, scaleY)
- : Math.min(scaleX, scaleY);
- scale = Math.max(1f, scale);
+ float minSize = Math.min(lp.width, lp.height);
+ float scaleX = rect.width() / minSize;
+ float scaleY = rect.height() / minSize;
+ float scale = Math.max(1f, Math.min(scaleX, scaleY));
setPivotX(0);
setPivotY(0);
@@ -160,27 +210,57 @@
Math.max(shapeProgressStart, progress), shapeProgressStart, 1f, 0, toMax,
LINEAR), 0, 1);
- mTaskCornerRadius = cornerRadius;
- if (mIsAdaptiveIcon && shapeRevealProgress >= 0) {
- if (mRevealAnimator == null) {
- mRevealAnimator = (ValueAnimator) IconShape.getShape().createRevealAnimator(this,
- mStartRevealRect, mEndRevealRect, mTaskCornerRadius / scale, !isOpening);
- mRevealAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mRevealAnimator = null;
- }
- });
- mRevealAnimator.start();
- // We pause here so we can set the current fraction ourselves.
- mRevealAnimator.pause();
+ if (mIsVerticalBarLayout) {
+ mOutline.right = (int) (rect.width() / scale);
+ } else {
+ mOutline.bottom = (int) (rect.height() / scale);
+ }
+
+ mTaskCornerRadius = cornerRadius / scale;
+ if (mIsAdaptiveIcon) {
+ if (!isOpening && shapeRevealProgress >= 0) {
+ if (mRevealAnimator == null) {
+ mRevealAnimator = (ValueAnimator) IconShape.getShape().createRevealAnimator(
+ this, mStartRevealRect, mOutline, mTaskCornerRadius, !isOpening);
+ mRevealAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mRevealAnimator = null;
+ }
+ });
+ mRevealAnimator.start();
+ // We pause here so we can set the current fraction ourselves.
+ mRevealAnimator.pause();
+ }
+ mRevealAnimator.setCurrentFraction(shapeRevealProgress);
}
- mRevealAnimator.setCurrentFraction(shapeRevealProgress);
+ float drawableScale = (mIsVerticalBarLayout ? mOutline.width() : mOutline.height())
+ / minSize;
+ setBackgroundDrawableBounds(drawableScale);
+ if (isOpening) {
+ // Center align foreground
+ int height = mFinalDrawableBounds.height();
+ int width = mFinalDrawableBounds.width();
+ int diffY = mIsVerticalBarLayout ? 0
+ : (int) (((height * drawableScale) - height) / 2);
+ int diffX = mIsVerticalBarLayout ? (int) (((width * drawableScale) - width) / 2)
+ : 0;
+ sTmpRect.set(mFinalDrawableBounds);
+ sTmpRect.offset(diffX, diffY);
+ mForeground.setBounds(sTmpRect);
+ } else {
+ // Spring the foreground relative to the icon's movement within the DragLayer.
+ int diffX = (int) (dX / mLauncher.getDeviceProfile().availableWidthPx
+ * FG_TRANS_X_FACTOR);
+ int diffY = (int) (dY / mLauncher.getDeviceProfile().availableHeightPx
+ * FG_TRANS_Y_FACTOR);
- float bgScale = (mBgDrawableEndScale * shapeRevealProgress) + mBgDrawableStartScale
- * (1 - shapeRevealProgress);
- setBackgroundDrawableBounds(bgScale);
+ mFgSpringX.animateToFinalPosition(diffX);
+ mFgSpringY.animateToFinalPosition(diffY);
+ }
+
+
}
invalidate();
invalidateOutline();
@@ -291,7 +371,9 @@
if (supportsAdaptiveIcons) {
drawable = Utilities.getFullDrawable(mLauncher, info, lp.width, lp.height,
false, sTmpObjArray);
- if (!(drawable instanceof AdaptiveIconDrawable)) {
+ if ((drawable instanceof AdaptiveIconDrawable)) {
+ mBadge = getBadge(mLauncher, info, sTmpObjArray[0]);
+ } else {
// The drawable we get back is not an adaptive icon, so we need to use the
// BubbleTextView icon that is already legacy treated.
drawable = btvIcon;
@@ -350,8 +432,17 @@
mStartRevealRect.set(0, 0, originalWidth, originalHeight);
+ if (mBadge != null) {
+ mBadge.setBounds(mStartRevealRect);
+ if (!isOpening) {
+ DRAWABLE_ALPHA.set(mBadge, 0);
+ }
+
+ }
+
if (!isFolderIcon) {
- mStartRevealRect.inset(mBlurSizeOutline, mBlurSizeOutline);
+ Utilities.scaleRectAboutCenter(mStartRevealRect,
+ IconShape.getNormalizationScale());
}
float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
@@ -363,24 +454,22 @@
layout(lp.leftMargin, lp.topMargin, lp.leftMargin + lp.width, lp.topMargin
+ lp.height);
- Rect rectOutline = new Rect();
float scale = Math.max((float) lp.height / originalHeight,
(float) lp.width / originalWidth);
+ float bgDrawableStartScale;
if (isOpening) {
- mBgDrawableStartScale = 1f;
- mBgDrawableEndScale = scale;
- rectOutline.set(0, 0, originalWidth, originalHeight);
+ bgDrawableStartScale = 1f;
+ mOutline.set(0, 0, originalWidth, originalHeight);
} else {
- mBgDrawableStartScale = scale;
- mBgDrawableEndScale = 1f;
- rectOutline.set(0, 0, lp.width, lp.height);
+ bgDrawableStartScale = scale;
+ mOutline.set(0, 0, lp.width, lp.height);
}
+ setBackgroundDrawableBounds(bgDrawableStartScale);
mEndRevealRect.set(0, 0, lp.width, lp.height);
- setBackgroundDrawableBounds(mBgDrawableStartScale);
setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
- outline.setRoundRect(rectOutline, mTaskCornerRadius);
+ outline.setRoundRect(mOutline, mTaskCornerRadius);
}
});
setClipToOutline(true);
@@ -397,17 +486,15 @@
}
private void setBackgroundDrawableBounds(float scale) {
- mBgDrawableBounds.set(mFinalDrawableBounds);
- Utilities.scaleRectAboutCenter(mBgDrawableBounds, scale);
+ sTmpRect.set(mFinalDrawableBounds);
+ Utilities.scaleRectAboutCenter(sTmpRect, scale);
// Since the drawable is at the top of the view, we need to offset to keep it centered.
if (mIsVerticalBarLayout) {
- mBgDrawableBounds.offsetTo((int) (mFinalDrawableBounds.left * scale),
- mBgDrawableBounds.top);
+ sTmpRect.offsetTo((int) (mFinalDrawableBounds.left * scale), sTmpRect.top);
} else {
- mBgDrawableBounds.offsetTo(mBgDrawableBounds.left,
- (int) (mFinalDrawableBounds.top * scale));
+ sTmpRect.offsetTo(sTmpRect.left, (int) (mFinalDrawableBounds.top * scale));
}
- mBackground.setBounds(mBgDrawableBounds);
+ mBackground.setBounds(sTmpRect);
}
@WorkerThread
@@ -452,7 +539,13 @@
mBackground.draw(canvas);
}
if (mForeground != null) {
+ int count2 = canvas.save();
+ canvas.translate(mFgTransX, mFgTransY);
mForeground.draw(canvas);
+ canvas.restoreToCount(count2);
+ }
+ if (mBadge != null) {
+ mBadge.draw(canvas);
}
canvas.restoreToCount(count);
}
@@ -572,6 +665,23 @@
}
});
+ if (mBadge != null) {
+ ObjectAnimator badgeFade = ObjectAnimator.ofInt(mBadge, DRAWABLE_ALPHA, 255);
+ badgeFade.addUpdateListener(valueAnimator -> invalidate());
+ fade.play(badgeFade);
+ }
+
+ if (originalView instanceof BubbleTextView) {
+ BubbleTextView btv = (BubbleTextView) originalView;
+ btv.forceHideDot(true);
+ fade.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ btv.forceHideDot(false);
+ }
+ });
+ }
+
if (originalView instanceof FolderIcon) {
FolderIcon folderIcon = (FolderIcon) originalView;
folderIcon.setBackgroundVisible(false);
@@ -617,7 +727,6 @@
mBackground = null;
mClipPath = null;
mFinalDrawableBounds.setEmpty();
- mBgDrawableBounds.setEmpty();
if (mRevealAnimator != null) {
mRevealAnimator.cancel();
}
@@ -630,5 +739,12 @@
mListenerView.setListener(null);
mOriginalIcon = null;
mOnTargetChangeRunnable = null;
+ mTaskCornerRadius = 0;
+ mOutline.setEmpty();
+ mFgTransY = 0;
+ mFgSpringX.cancel();
+ mFgTransX = 0;
+ mFgSpringY.cancel();
+ mBadge = null;
}
}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 7062369..63f7427 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -152,9 +152,9 @@
RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
ArrayList<OptionItem> options = new ArrayList<>();
- int resString = existsStyleWallpapers(launcher) ?
+ int resString = Utilities.existsStyleWallpapers(launcher) ?
R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
- int resDrawable = existsStyleWallpapers(launcher) ?
+ int resDrawable = Utilities.existsStyleWallpapers(launcher) ?
R.drawable.ic_palette : R.drawable.ic_wallpaper;
options.add(new OptionItem(resString, resDrawable,
ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
@@ -168,14 +168,6 @@
show(launcher, target, options);
}
- private static boolean existsStyleWallpapers(Launcher launcher) {
- Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
- intent.setComponent(new ComponentName(launcher.getString(R.string.wallpaper_picker_package),
- "com.android.customization.picker.CustomizationPickerActivity"));
- ResolveInfo ri = launcher.getPackageManager().resolveActivity(intent, 0);
- return ri != null;
- }
-
public static boolean onWidgetsClicked(View view) {
return openWidgets(Launcher.getLauncher(view.getContext()));
}
@@ -212,7 +204,7 @@
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(EXTRA_WALLPAPER_OFFSET,
launcher.getWorkspace().getWallpaperOffsetForCenterPage());
- if (!existsStyleWallpapers(launcher)) {
+ if (!Utilities.existsStyleWallpapers(launcher)) {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
} else {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "focus_wallpaper");
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 3e2c0ae..a7078a2 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -36,7 +36,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.util.PackageUserKey;
@@ -126,7 +126,7 @@
// Otherwise, add an empty view to the start as padding (but still scroll edge to edge).
View leftPaddingView = LayoutInflater.from(getContext()).inflate(
R.layout.widget_list_divider, widgetRow, false);
- leftPaddingView.getLayoutParams().width = Utilities.pxFromDp(
+ leftPaddingView.getLayoutParams().width = ResourceUtils.pxFromDp(
16, getResources().getDisplayMetrics());
widgetCells.addView(leftPaddingView, 0);
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index c01b54a..550327d 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -18,12 +18,17 @@
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.os.Bundle;
import android.os.CancellationSignal;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState.ScaleAndTranslation;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.util.TouchController;
import java.io.PrintWriter;
@@ -73,4 +78,22 @@
public static ScaleAndTranslation getOverviewScaleAndTranslationForNormalState(Launcher l) {
return new ScaleAndTranslation(1.1f, 0f, 0f);
}
+
+ public static RotationMode getRotationMode(DeviceProfile dp) {
+ return RotationMode.NORMAL;
+ }
+
+ public static boolean startIntentSenderForResult(Activity activity, IntentSender intent,
+ int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) {
+ return false;
+ }
+
+ public static boolean startActivityForResult(Activity activity, Intent intent, int requestCode,
+ Bundle options) {
+ return false;
+ }
+
+ public static void resetPendingActivityResults(Launcher launcher, int requestCode) { }
+
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/WallpaperColorInfo.java b/src_ui_overrides/com/android/launcher3/uioverrides/WallpaperColorInfo.java
index 56e3260..b05e125 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/WallpaperColorInfo.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/WallpaperColorInfo.java
@@ -30,6 +30,10 @@
public class WallpaperColorInfo implements WallpaperManagerCompat.OnColorsChangedListenerCompat {
+ private static final int MAIN_COLOR_LIGHT = 0xffdadce0;
+ private static final int MAIN_COLOR_DARK = 0xff202124;
+ private static final int MAIN_COLOR_REGULAR = 0xff000000;
+
private static final int FALLBACK_COLOR = Color.WHITE;
private static final Object sInstanceLock = new Object();
private static WallpaperColorInfo sInstance;
@@ -76,6 +80,10 @@
return mSupportsDarkText;
}
+ public boolean isMainColorDark() {
+ return mMainColor == MAIN_COLOR_DARK;
+ }
+
@Override
public void onColorsChanged(WallpaperColorsCompat colors, int which) {
if ((which & FLAG_SYSTEM) != 0) {
diff --git a/tests/Android.mk b/tests/Android.mk
index 080c98b..0991a04 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -30,6 +30,7 @@
LOCAL_STATIC_JAVA_LIBRARIES += libSharedSystemUI
LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \
+ ../src/com/android/launcher3/ResourceUtils.java \
../src/com/android/launcher3/util/SecureSettingsObserver.java \
../src/com/android/launcher3/TestProtocol.java
endif
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 75db2f1..b6878bb 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -51,6 +51,7 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherState;
import com.android.launcher3.MainThreadExecutor;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.tapl.LauncherInstrumentation;
@@ -208,7 +209,9 @@
* @return the matching object.
*/
protected UiObject2 scrollAndFind(UiObject2 container, BySelector condition) {
- container.setGestureMargins(0, 0, 0, 200);
+ final int margin = ResourceUtils.getNavbarSize(
+ ResourceUtils.NAVBAR_VERTICAL_SIZE, mLauncher.getResources()) + 1;
+ container.setGestureMargins(0, 0, 0, margin);
int i = 0;
for (; ; ) {
@@ -216,7 +219,8 @@
mDevice.wait(Until.findObject(condition), SHORT_UI_TIMEOUT);
UiObject2 widget = container.findObject(condition);
if (widget != null && widget.getVisibleBounds().intersects(
- 0, 0, mDevice.getDisplayWidth(), mDevice.getDisplayHeight() - 200)) {
+ 0, 0, mDevice.getDisplayWidth(),
+ mDevice.getDisplayHeight() - margin)) {
return widget;
}
if (++i > 40) fail("Too many attempts");
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 581e886..7578dff 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -24,7 +24,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import android.content.Intent;
import android.util.Log;
import androidx.test.filters.LargeTest;
@@ -241,9 +240,8 @@
}
public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
- final AppIcon app = allApps.getAppIcon("Calculator");
- assertNotNull("AppIcon.launch returned null", app.launch(
- test.resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)));
+ final AppIcon app = allApps.getAppIcon("TestActivity7");
+ assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
test.executeOnLauncher(launcher -> assertTrue(
"Launcher activity is the top activity; expecting another activity to be the top "
+ "one",
diff --git a/tests/src/com/android/launcher3/ui/TestViewHelpers.java b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
index 2116f5e..a73bde0 100644
--- a/tests/src/com/android/launcher3/ui/TestViewHelpers.java
+++ b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
@@ -27,6 +27,7 @@
import android.os.Process;
import android.os.SystemClock;
import android.util.Log;
+import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -186,10 +187,8 @@
*/
public static UiObject2 openWidgetsTray() {
final UiDevice device = getDevice();
- device.pressMenu(); // Enter overview mode.
- device.wait(Until.findObject(
- By.text(getTargetContext().getString(R.string.widget_button_text))),
- AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT).click();
+ device.pressKeyCode(KeyEvent.KEYCODE_W, KeyEvent.META_CTRL_ON);
+ device.waitForIdle();
return findViewById(R.id.widgets_list_view);
}
diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
index b66fa8a..a57d7ba 100644
--- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
@@ -17,26 +17,25 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.graphics.Color;
+import android.view.View;
+
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
-import android.view.View;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.R;
-import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.testcomponent.AppWidgetNoConfig;
import com.android.launcher3.testcomponent.AppWidgetWithConfig;
@@ -49,7 +48,6 @@
import com.android.launcher3.widget.WidgetCell;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -181,7 +179,9 @@
// Accept confirmation:
BlockingBroadcastReceiver resultReceiver = new BlockingBroadcastReceiver(mCallbackAction);
- mDevice.wait(Until.findObject(By.text("Add automatically")), DEFAULT_UI_TIMEOUT).click();
+ mDevice.wait(Until.findObject(
+ By.text(mLauncher.isAvd() ? "ADD AUTOMATICALLY" : "Add automatically")),
+ DEFAULT_UI_TIMEOUT).click();
Intent result = resultReceiver.blockingGetIntent();
assertNotNull(result);
mAppWidgetId = result.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 1ad0037..a296975 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -18,11 +18,14 @@
import static com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
+import android.graphics.Rect;
+
import androidx.annotation.NonNull;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
+import com.android.launcher3.ResourceUtils;
import com.android.launcher3.TestProtocol;
/**
@@ -31,7 +34,6 @@
public class AllApps extends LauncherInstrumentation.VisibleContainer {
private static final int MAX_SCROLL_ATTEMPTS = 40;
private static final int MIN_INTERACT_SIZE = 100;
- private static final int FLING_SPEED = LauncherInstrumentation.needSlowGestures() ? 1000 : 3000;
private final int mHeight;
@@ -66,12 +68,9 @@
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to get app icon on all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
- if (mLauncher.getNavigationModel() != ZERO_BUTTON) {
- final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
- allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1);
- } else {
- allAppsContainer.setGestureMargins(0, 0, 0, 200);
- }
+ allAppsContainer.setGestureMargins(0, 0, 0,
+ ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_VERTICAL_SIZE,
+ mLauncher.getResources()) + 1);
final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher);
if (!hasClickableIcon(allAppsContainer, appIconSelector)) {
scrollBackToBeginning();
@@ -104,7 +103,7 @@
"search_container_all_apps");
int attempts = 0;
- allAppsContainer.setGestureMargins(0, searchBox.getVisibleBounds().bottom + 1, 0, 5);
+ final Rect margins = new Rect(0, searchBox.getVisibleBounds().bottom + 1, 0, 5);
for (int scroll = getScroll(allAppsContainer);
scroll != 0;
@@ -115,7 +114,7 @@
"Exceeded max scroll attempts: " + MAX_SCROLL_ATTEMPTS,
++attempts <= MAX_SCROLL_ATTEMPTS);
- allAppsContainer.scroll(Direction.UP, 1);
+ mLauncher.scroll(allAppsContainer, Direction.UP, 1, margins, 50);
}
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("scrolled up")) {
@@ -135,7 +134,7 @@
// Try to figure out how much percentage of the container needs to be scrolled in order
// to reveal the app icon to have the MIN_INTERACT_SIZE
final float pct = Math.max(((float) (MIN_INTERACT_SIZE - appHeight)) / mHeight, 0.2f);
- allAppsContainer.scroll(Direction.DOWN, pct);
+ mLauncher.scroll(allAppsContainer, Direction.DOWN, pct, null, 10);
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"scrolled an icon in all apps to make it visible - and then")) {
mLauncher.waitForIdle();
@@ -152,9 +151,8 @@
mLauncher.addContextLayer("want to fling forward in all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center to avoid starting at elements near the top.
- allAppsContainer.setGestureMargins(0, 0, 0, mHeight / 2);
- allAppsContainer.fling(Direction.DOWN,
- (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
+ mLauncher.scroll(
+ allAppsContainer, Direction.DOWN, 1, new Rect(0, 0, 0, mHeight / 2), 10);
verifyActiveContainer();
}
}
@@ -167,9 +165,8 @@
mLauncher.addContextLayer("want to fling backward in all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center, for symmetry with forward.
- allAppsContainer.setGestureMargins(0, mHeight / 2, 0, 0);
- allAppsContainer.fling(Direction.UP,
- (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
+ mLauncher.scroll(
+ allAppsContainer, Direction.UP, 1, new Rect(0, mHeight / 2, 0, 0), 10);
verifyActiveContainer();
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 3b2a7b8..8f5e7fe 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -17,16 +17,12 @@
package com.android.launcher3.tapl;
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
-import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
-import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
import android.graphics.Point;
import android.os.SystemClock;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
-import androidx.test.uiautomator.By;
-import androidx.test.uiautomator.Until;
import com.android.launcher3.TestProtocol;
@@ -59,8 +55,6 @@
"want to switch from background to overview")) {
verifyActiveContainer();
goToOverviewUnchecked(BACKGROUND_APP_STATE_ORDINAL);
- mLauncher.assertTrue("Overview not visible", mLauncher.getDevice().wait(
- Until.hasObject(By.pkg(getOverviewPackageName())), WAIT_TIME_MS));
return new BaseOverview(mLauncher);
}
}
@@ -78,7 +72,8 @@
final long downTime = SystemClock.uptimeMillis();
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start);
- mLauncher.movePointer(downTime, ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION, start, end);
+ mLauncher.movePointer(
+ downTime, downTime, ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION, start, end);
LauncherInstrumentation.sleep(ZERO_BUTTON_SWIPE_UP_HOLD_DURATION);
mLauncher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, end);
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 70d8cf7..ace49e9 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -28,11 +28,12 @@
* Common overview pane for both Launcher and fallback recents
*/
public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
- private static final int FLING_SPEED = LauncherInstrumentation.needSlowGestures() ? 500 : 1500;
+ private static final int FLING_SPEED = LauncherInstrumentation.isAvd() ? 500 : 1500;
private static final int FLINGS_FOR_DISMISS_LIMIT = 40;
BaseOverview(LauncherInstrumentation launcher) {
super(launcher);
+ verifyActiveContainer();
}
@Override
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index f5c5a8d..57fd4b9 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL;
+import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
import android.app.ActivityManager;
import android.app.Instrumentation;
@@ -27,6 +28,7 @@
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Point;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -46,6 +48,7 @@
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Configurator;
+import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
@@ -55,6 +58,7 @@
import org.junit.Assert;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Deque;
@@ -70,6 +74,7 @@
private static final String TAG = "Tapl";
private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20;
+ private static final int GESTURE_STEP_MS = 16;
// Types for launcher containers that the user is interacting with. "Background" is a
// pseudo-container corresponding to inactive launcher covered by another app.
@@ -175,23 +180,25 @@
// Workaround, use constructed context because both the instrumentation context and the
// app context are not constructed with resources that take overlays into account
final Context ctx = baseContext.createPackageContext("android", 0);
- log("Interaction mode = " + getCurrentInteractionMode(ctx));
- if (isGesturalMode(ctx)) {
- return NavigationModel.ZERO_BUTTON;
- } else if (isSwipeUpMode(ctx)) {
- return NavigationModel.TWO_BUTTON;
- } else if (isLegacyMode(ctx)) {
- return NavigationModel.THREE_BUTTON;
- } else {
- fail("Can't detect navigation mode");
+ for (int i = 0; i < 100; ++i) {
+ log("Interaction mode = " + getCurrentInteractionMode(ctx));
+ if (isGesturalMode(ctx)) {
+ return NavigationModel.ZERO_BUTTON;
+ } else if (isSwipeUpMode(ctx)) {
+ return NavigationModel.TWO_BUTTON;
+ } else if (isLegacyMode(ctx)) {
+ return NavigationModel.THREE_BUTTON;
+ }
+ Thread.sleep(100);
}
- } catch (PackageManager.NameNotFoundException e) {
+ fail("Can't detect navigation mode");
+ } catch (Exception e) {
fail(e.toString());
}
return NavigationModel.THREE_BUTTON;
}
- public static boolean needSlowGestures() {
+ public static boolean isAvd() {
return Build.MODEL.contains("Cuttlefish");
}
@@ -208,7 +215,22 @@
};
}
+ private void dumpViewHierarchy() {
+ final ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ try {
+ mDevice.dumpWindowHierarchy(stream);
+ stream.flush();
+ stream.close();
+ for (String line : stream.toString().split("\\r?\\n")) {
+ Log.e(TAG, line.trim());
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "error dumping XML to logcat", e);
+ }
+ }
+
private void fail(String message) {
+ dumpViewHierarchy();
Assert.fail("http://go/tapl : " + getContextDescription() + message);
}
@@ -293,14 +315,14 @@
} else {
waitUntilGone(APPS_RES_ID);
}
- // Fall through
- }
- case BASE_OVERVIEW: {
waitUntilGone(WORKSPACE_RES_ID);
waitUntilGone(WIDGETS_RES_ID);
return waitForLauncherObject(OVERVIEW_RES_ID);
}
+ case BASE_OVERVIEW: {
+ return waitForFallbackLauncherObject(OVERVIEW_RES_ID);
+ }
case BACKGROUND: {
waitUntilGone(WORKSPACE_RES_ID);
waitUntilGone(APPS_RES_ID);
@@ -359,10 +381,10 @@
? NORMAL_STATE_ORDINAL : BACKGROUND_APP_STATE_ORDINAL;
final Point displaySize = getRealDisplaySize();
- swipe(
+ swipeToState(
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
- finalState, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME);
+ ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, finalState);
}
} else {
log(action = "clicking home button");
@@ -374,16 +396,6 @@
event -> true,
"Pressing Home didn't produce any events");
mDevice.waitForIdle();
-
- // Temporarily press home twice as the first click sometimes gets ignored (b/124239413)
- executeAndWaitForEvent(
- () -> {
- log("LauncherInstrumentation.pressHome before clicking");
- waitForSystemUiObject("home").click();
- },
- event -> true,
- "Pressing Home didn't produce any events");
- mDevice.waitForIdle();
}
try (LauncherInstrumentation.Closable c = addContextLayer(
"performed action to switch to Home - " + action)) {
@@ -535,10 +547,34 @@
return object;
}
+ @NonNull
+ UiObject2 waitForLauncherObjectByClass(String clazz) {
+ final BySelector selector = getLauncherObjectSelectorByClass(clazz);
+ final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
+ assertNotNull("Can't find a launcher object; selector: " + selector, object);
+ return object;
+ }
+
+ @NonNull
+ UiObject2 waitForFallbackLauncherObject(String resName) {
+ final BySelector selector = getFallbackLauncherObjectSelector(resName);
+ final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
+ assertNotNull("Can't find a fallback launcher object; selector: " + selector, object);
+ return object;
+ }
+
BySelector getLauncherObjectSelector(String resName) {
return By.res(getLauncherPackageName(), resName);
}
+ BySelector getLauncherObjectSelectorByClass(String clazz) {
+ return By.pkg(getLauncherPackageName()).clazz(clazz);
+ }
+
+ BySelector getFallbackLauncherObjectSelector(String resName) {
+ return By.res(getOverviewPackageName(), resName);
+ }
+
String getLauncherPackageName() {
return mDevice.getLauncherPackageName();
}
@@ -553,8 +589,73 @@
}
void swipe(int startX, int startY, int endX, int endY, int expectedState, int steps) {
+ changeStateViaGesture(startX, startY, endX, endY, expectedState,
+ () -> mDevice.swipe(startX, startY, endX, endY, steps));
+ }
+
+ void swipeToState(int startX, int startY, int endX, int endY, int steps, int expectedState) {
+ changeStateViaGesture(startX, startY, endX, endY, expectedState,
+ () -> linearGesture(startX, startY, endX, endY, steps));
+ }
+
+ void scroll(UiObject2 container, Direction direction, float percent, Rect margins, int steps) {
+ final Rect rect = container.getVisibleBounds();
+ if (margins != null) {
+ rect.left += margins.left;
+ rect.top += margins.top;
+ rect.right -= margins.right;
+ rect.bottom -= margins.bottom;
+ }
+
+ final int startX;
+ final int startY;
+ final int endX;
+ final int endY;
+
+ switch (direction) {
+ case UP: {
+ startX = endX = rect.centerX();
+ final int vertCenter = rect.centerY();
+ final float halfGestureHeight = rect.height() * percent / 2.0f;
+ startY = (int) (vertCenter - halfGestureHeight);
+ endY = (int) (vertCenter + halfGestureHeight);
+ }
+ break;
+ case DOWN: {
+ startX = endX = rect.centerX();
+ final int vertCenter = rect.centerY();
+ final float halfGestureHeight = rect.height() * percent / 2.0f;
+ startY = (int) (vertCenter + halfGestureHeight);
+ endY = (int) (vertCenter - halfGestureHeight);
+ }
+ break;
+ default:
+ fail("Unsupported direction");
+ return;
+ }
+
+ executeAndWaitForEvent(
+ () -> linearGesture(startX, startY, endX, endY, steps),
+ event -> TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()),
+ "Didn't receive a scroll end message: " + startX + ", " + startY
+ + ", " + endX + ", " + endY);
+ }
+
+ // Inject a swipe gesture. Inject exactly 'steps' motion points, incrementing event time by a
+ // fixed interval each time.
+ private void linearGesture(int startX, int startY, int endX, int endY, int steps) {
+ final long downTime = SystemClock.uptimeMillis();
+ final Point start = new Point(startX, startY);
+ final Point end = new Point(endX, endY);
+ sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start);
+ final long endTime = movePointer(downTime, downTime, steps * GESTURE_STEP_MS, start, end);
+ sendPointer(downTime, endTime, MotionEvent.ACTION_UP, end);
+ }
+
+ private void changeStateViaGesture(int startX, int startY, int endX, int endY,
+ int expectedState, Runnable gesture) {
final Bundle parcel = (Bundle) executeAndWaitForEvent(
- () -> mDevice.swipe(startX, startY, endX, endY, steps),
+ gesture,
event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
"Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
+ ", " + endX + ", " + endY);
@@ -575,6 +676,10 @@
return ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
+ public Resources getResources() {
+ return getContext().getResources();
+ }
+
private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
float x, float y) {
MotionEvent.PointerProperties properties = new MotionEvent.PointerProperties();
@@ -599,21 +704,22 @@
event.recycle();
}
- void movePointer(long downTime, long duration, Point from, Point to) {
+ long movePointer(long downTime, long startTime, long duration, Point from, Point to) {
final Point point = new Point();
- final long startTime = SystemClock.uptimeMillis();
- for (; ; ) {
- sleep(16);
+ long steps = duration / GESTURE_STEP_MS;
+ long currentTime = startTime;
+ for (long i = 0; i < steps; ++i) {
+ sleep(GESTURE_STEP_MS);
- final long currentTime = SystemClock.uptimeMillis();
+ currentTime += GESTURE_STEP_MS;
final float progress = (currentTime - startTime) / (float) duration;
- if (progress > 1) return;
point.x = from.x + (int) (progress * (to.x - from.x));
point.y = from.y + (int) (progress * (to.y - from.y));
sendPointer(downTime, currentTime, MotionEvent.ACTION_MOVE, point);
}
+ return currentTime;
}
public static boolean isGesturalMode(Context context) {
@@ -657,10 +763,7 @@
}
static void sleep(int duration) {
- try {
- Thread.sleep(duration);
- } catch (InterruptedException e) {
- }
+ SystemClock.sleep(duration);
}
int getEdgeSensitivityWidth() {
diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java
index e625510..ec99d26 100644
--- a/tests/tapl/com/android/launcher3/tapl/Overview.java
+++ b/tests/tapl/com/android/launcher3/tapl/Overview.java
@@ -49,13 +49,14 @@
"want to switch from overview to all apps")) {
verifyActiveContainer();
- // Swipe from the prediction row to the top.
+ // Swipe from an app icon to the top.
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
- final UiObject2 predictionRow = mLauncher.waitForLauncherObject("prediction_row");
- mLauncher.swipe(mLauncher.getDevice().getDisplayWidth() / 2,
- predictionRow.getVisibleBounds().centerY(),
+ final UiObject2 appIcon = mLauncher.waitForLauncherObjectByClass(
+ "android.widget.TextView");
+ mLauncher.swipeToState(mLauncher.getDevice().getDisplayWidth() / 2,
+ appIcon.getVisibleBounds().centerY(),
mLauncher.getDevice().getDisplayWidth() / 2,
- 0, ALL_APPS_STATE_ORDINAL);
+ 0, 50, ALL_APPS_STATE_ORDINAL);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped all way up from overview")) {
diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java
index 100a11c..f7e0b6c 100644
--- a/tests/tapl/com/android/launcher3/tapl/Widgets.java
+++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java
@@ -19,6 +19,8 @@
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
+import com.android.launcher3.ResourceUtils;
+
/**
* All widgets container.
*/
@@ -38,7 +40,9 @@
"want to fling forward in widgets")) {
LauncherInstrumentation.log("Widgets.flingForward enter");
final UiObject2 widgetsContainer = verifyActiveContainer();
- widgetsContainer.setGestureMargins(0, 0, 0, 200);
+ widgetsContainer.setGestureMargins(0, 0, 0,
+ ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_VERTICAL_SIZE,
+ mLauncher.getResources()) + 1);
widgetsContainer.fling(Direction.DOWN,
(int) (FLING_SPEED * mLauncher.getDisplayDensity()));
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung forward")) {
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 9a47aef..11c0794 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -37,7 +37,7 @@
*/
public final class Workspace extends Home {
private static final float FLING_SPEED =
- LauncherInstrumentation.needSlowGestures() ? 1500.0F : 3500.0F;
+ LauncherInstrumentation.isAvd() ? 1500.0F : 3500.0F;
private static final int DRAG_DURACTION = 2000;
private final UiObject2 mHotseat;
@@ -58,16 +58,21 @@
verifyActiveContainer();
final UiObject2 hotseat = mHotseat;
final Point start = hotseat.getVisibleCenter();
+ start.y = hotseat.getVisibleBounds().bottom - 1;
final int swipeHeight = mLauncher.getTestInfo(
TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT).
getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
- mLauncher.swipe(
+ LauncherInstrumentation.log(
+ "switchToAllApps: swipeHeight = " + swipeHeight + ", slop = "
+ + mLauncher.getTouchSlop());
+
+ mLauncher.swipeToState(
start.x,
start.y,
start.x,
start.y - swipeHeight - mLauncher.getTouchSlop(),
- ALL_APPS_STATE_ORDINAL
- );
+ 60,
+ ALL_APPS_STATE_ORDINAL);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped to all apps")) {
@@ -150,7 +155,8 @@
LauncherInstrumentation.log("dragIconToWorkspace: sent down");
launcher.waitForLauncherObject(longPressIndicator);
LauncherInstrumentation.log("dragIconToWorkspace: indicator");
- launcher.movePointer(downTime, DRAG_DURACTION, launchableCenter, dest);
+ launcher.movePointer(
+ downTime, SystemClock.uptimeMillis(), DRAG_DURACTION, launchableCenter, dest);
LauncherInstrumentation.log("dragIconToWorkspace: moved pointer");
launcher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);