summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java33
-rw-r--r--go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java2
-rw-r--r--go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java60
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java35
4 files changed, 92 insertions, 38 deletions
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index 62e40d194..c03222db1 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -42,6 +42,7 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
private final ActivityControlHelper<T> mHelper;
private final int mTargetTaskId;
private IconRecentsView mRecentsView;
+ private AppToOverviewAnimationListener mAnimationReadyListener;
AppToOverviewAnimationProvider(ActivityControlHelper<T> helper, int targetTaskId) {
mHelper = helper;
@@ -49,12 +50,24 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
}
/**
+ * 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) -> {
@@ -79,6 +92,9 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
*/
@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,4 +147,21 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
long getRecentsLaunchDuration() {
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/FallbackActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
index d39a66c70..eb0c5b942 100644
--- a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -45,12 +45,12 @@ public final class FallbackActivityControllerHelper extends
@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible,
boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
- // TODO: Logic for setting remote animation
if (activityVisible) {
return (transitionLength) -> { };
}
IconRecentsView rv = activity.getOverviewPanel();
+ rv.setUsingRemoteAnimation(true);
rv.setAlpha(0);
return new AnimationFactory() {
diff --git a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index 379cc100e..0fa3d866f 100644
--- a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -18,7 +18,6 @@ package com.android.quickstep;
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.MainThreadExecutor;
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 @@ public class OverviewCommandHelper {
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 class OverviewCommandHelper {
public RecentsActivityCommand() {
mHelper = mOverviewComponentObserver.getActivityControlHelper();
mCreateTime = SystemClock.elapsedRealtime();
- mAnimationProvider =
- new AppToOverviewAnimationProvider<>(mHelper, RecentsModel.getRunningTaskId());
// Preload the plan
mRecentsModel.getTasks(null);
@@ -136,11 +132,37 @@ public class OverviewCommandHelper {
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 @@ public class OverviewCommandHelper {
}
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/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index e71cda687..2572bdd11 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -153,6 +153,8 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
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;
@@ -298,6 +300,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
* 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
@@ -322,16 +325,22 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
+ "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);
});
}
@@ -401,7 +410,14 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
* @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);
}
@@ -622,6 +638,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
}
});
mLayoutAnimation.start();
+ mStartedEnterAnimation = true;
}
/**
@@ -648,6 +665,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
playRemoteAppScaleDownAnim(anim, appMatrix, appTarget, recentsTarget,
bottomView.getThumbnailView());
playRemoteTaskListFadeIn(anim, bottomView);
+ mStartedEnterAnimation = true;
}
/**
@@ -829,6 +847,9 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
mInsets = insets;
mTaskRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
mTaskRecyclerView.invalidateItemDecorations();
+ if (mInsets.top != 0) {
+ updateStatusBarScrim();
+ }
}
/**