Merge "Add getOverviewFullscreenProgress() to LauncherState" into ub-launcher3-qt-dev
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 c3a7698..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;
@@ -64,6 +65,7 @@
}
}
setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state.getVisibleElements(mLauncher));
+ mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress());
}
@Override
@@ -95,7 +97,10 @@
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..5408af3 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,12 @@
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.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 +33,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 +57,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()
+ .getOverviewFullscreenScaleAndTranslation(dummyTask);
+ }
+
+ @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 c26a1d0..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,11 +15,8 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-
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.TaskView;
@@ -28,23 +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);
- }
- TaskView dummyTask = recentsView.getTaskViewAt(0);
- ClipAnimationHelper clipAnimationHelper = new ClipAnimationHelper(launcher);
- return clipAnimationHelper.getOverviewFullscreenScaleAndTranslation(dummyTask);
+ super(id, LauncherLogProto.ContainerType.APP);
}
@Override
@@ -56,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/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 434353d..817d64f 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;
@@ -266,7 +265,7 @@
endState.getVerticalProgress(activity));
anim.play(shiftAnim);
}
- playScaleDownAnim(anim, activity, endState);
+ playScaleDownAnim(anim, activity, fromState, endState);
anim.setDuration(transitionLength * 2);
AnimatorPlaybackController controller =
@@ -292,7 +291,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());
@@ -300,19 +299,23 @@
return;
}
- ClipAnimationHelper clipHelper = new ClipAnimationHelper(launcher);
LauncherState.ScaleAndTranslation fromScaleAndTranslation
- = clipHelper.getOverviewFullscreenScaleAndTranslation(v);
+ = fromState.getOverviewScaleAndTranslation(launcher);
LauncherState.ScaleAndTranslation endScaleAndTranslation
= endState.getOverviewScaleAndTranslation(launcher);
+ float fromFullscreenProgress = fromState.getOverviewFullscreenProgress();
+ float endFullscreenProgress = endState.getOverviewFullscreenProgress();
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);
- anim.playTogether(scale, translateY);
+ applyFullscreenProgress.setInterpolator(LINEAR);
+ anim.playTogether(scale, translateY, applyFullscreenProgress);
}
@Override
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 f2260d6..0773904 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -504,6 +504,7 @@
private void setupRecentsViewUi() {
if (mContinuingLastGesture) {
+ updateSysUiFlags(mCurrentShift.value);
return;
}
mRecentsView.onGestureAnimationStart(mRunningTaskId);
@@ -677,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()) {
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 bded5ba..c37965a 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
@@ -142,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;
@@ -165,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
@@ -276,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;
@@ -310,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);
@@ -598,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;
@@ -1714,4 +1739,8 @@
true /* hideOriginal */, iconLocation, false /* isOpening */, mFloatingIconView);
return mFloatingIconView;
}
+
+ public ClipAnimationHelper getTempClipAnimationHelper() {
+ return mTempClipAnimationHelper;
+ }
}
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);
}