summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTracy Zhou <tracyzhou@google.com>2018-10-16 14:49:55 -0700
committerTracy Zhou <tracyzhou@google.com>2018-10-24 14:24:54 -0700
commitd43e7c2fd40ed58edafa874bfae732a2edbca823 (patch)
tree933f6b756c5bcdf14e33414fab8701f6554a2e89
parente3f664db79c19ccb423a72e806ec014d4c029741 (diff)
downloadandroid_packages_apps_Trebuchet-d43e7c2fd40ed58edafa874bfae732a2edbca823.tar.gz
android_packages_apps_Trebuchet-d43e7c2fd40ed58edafa874bfae732a2edbca823.tar.bz2
android_packages_apps_Trebuchet-d43e7c2fd40ed58edafa874bfae732a2edbca823.zip
Support Live Tile in Quickstep (Pt1) - Z ordering
- Place Launcher above app surface. - Use LauncherLayoutListener to clear the area where the current task is in order to punch a hole and reveal the app view underneath Bug: 111697218 Test: Manual test Change-Id: I4d4e0f1113a8e60566257c030ae9b591789eb3b3
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java3
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/OverviewState.java3
-rw-r--r--quickstep/src/com/android/quickstep/ActivityControlHelper.java6
-rw-r--r--quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java7
-rw-r--r--quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java29
-rw-r--r--quickstep/src/com/android/quickstep/views/LauncherLayoutListener.java38
-rw-r--r--src/com/android/launcher3/AbstractFloatingView.java11
7 files changed, 75 insertions, 22 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
index 1eaa8bc92..190628603 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.uioverrides;
+import static com.android.launcher3.AbstractFloatingView.TYPE_QUICKSTEP_PREVIEW;
import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
@@ -44,7 +45,7 @@ public class AllAppsState extends LauncherState {
@Override
public void onStateEnabled(Launcher launcher) {
- AbstractFloatingView.closeAllOpenViews(launcher);
+ AbstractFloatingView.closeAllOpenViewsExcept(launcher, TYPE_QUICKSTEP_PREVIEW);
dispatchWindowStateChanged(launcher);
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 0d77bca58..8f1d46c8d 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.uioverrides;
+import static com.android.launcher3.AbstractFloatingView.TYPE_QUICKSTEP_PREVIEW;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
@@ -74,7 +75,7 @@ public class OverviewState extends LauncherState {
public void onStateEnabled(Launcher launcher) {
RecentsView rv = launcher.getOverviewPanel();
rv.setOverviewStateEnabled(true);
- AbstractFloatingView.closeAllOpenViews(launcher);
+ AbstractFloatingView.closeAllOpenViewsExcept(launcher, TYPE_QUICKSTEP_PREVIEW);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index 2331a4e30..c809e2832 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -40,6 +40,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
@@ -537,6 +538,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
@Override
public void finish() { }
+
+ @Override
+ public void update(boolean shouldFinish, boolean isLongSwipe, RectF currentRect) { }
};
}
@@ -613,6 +617,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
void setHandler(WindowTransformSwipeHandler handler);
void finish();
+
+ void update(boolean shouldFinish, boolean isLongSwipe, RectF currentRect);
}
interface ActivityInitListener {
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 6908b8978..9ea88842d 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -597,6 +597,11 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
}
private void updateFinalShiftUi() {
+ if (mRecentsAnimationWrapper.getController() != null && mLayoutListener != null) {
+ mLayoutListener.update(mCurrentShift.value > 1, mUiLongSwipeMode,
+ mClipAnimationHelper.getCurrentRectWithInsets());
+ }
+
final boolean passed = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW;
if (passed != mPassedOverviewThreshold) {
mPassedOverviewThreshold = passed;
@@ -874,7 +879,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
mLayoutListener.finish();
mActivityControlHelper.getAlphaProperty(mActivity).setValue(1);
- mRecentsView.setRunningTaskHidden(false);
mRecentsView.setRunningTaskIconScaledDown(false);
mQuickScrubController.cancelActiveQuickscrub();
}
@@ -895,6 +899,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
if (mWasLauncherAlreadyVisible && mLauncherTransitionController != null) {
mLauncherTransitionController.setPlayFraction(1);
}
+ mRecentsView.setRunningTaskHidden(false);
}
private void switchToScreenshot() {
diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
index 8c84f29b7..57a0e8f8f 100644
--- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -77,10 +77,11 @@ public class ClipAnimationHelper {
public final Rect mHomeStackBounds = new Rect();
// The clip rect in source app window coordinates
- private final Rect mClipRect = new Rect();
+ private final RectF mClipRectF = new RectF();
private final RectFEvaluator mRectFEvaluator = new RectFEvaluator();
private final Matrix mTmpMatrix = new Matrix();
private final RectF mTmpRectF = new RectF();
+ private final RectF mCurrentRectWithInsets = new RectF();
private float mTargetScale = 1f;
private float mOffsetScale = 1f;
@@ -153,12 +154,12 @@ public class ClipAnimationHelper {
mTargetOffset.y * offsetYProgress);
}
- mClipRect.left = (int) (mSourceWindowClipInsets.left * progress);
- mClipRect.top = (int) (mSourceWindowClipInsets.top * progress);
- mClipRect.right = (int)
- (mSourceStackBounds.width() - (mSourceWindowClipInsets.right * progress));
- mClipRect.bottom = (int)
- (mSourceStackBounds.height() - (mSourceWindowClipInsets.bottom * progress));
+ mClipRectF.left = mSourceWindowClipInsets.left * progress;
+ mClipRectF.top = mSourceWindowClipInsets.top * progress;
+ mClipRectF.right =
+ mSourceStackBounds.width() - (mSourceWindowClipInsets.right * progress);
+ mClipRectF.bottom =
+ mSourceStackBounds.height() - (mSourceWindowClipInsets.bottom * progress);
SurfaceParams[] params = new SurfaceParams[targetSet.unfilteredApps.length];
for (int i = 0; i < targetSet.unfilteredApps.length; i++) {
@@ -166,11 +167,12 @@ public class ClipAnimationHelper {
mTmpMatrix.setTranslate(app.position.x, app.position.y);
Rect crop = app.sourceContainerBounds;
float alpha = 1f;
+ int layer;
if (app.mode == targetSet.targetMode) {
if (app.activityType != RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) {
mTmpMatrix.setRectToRect(mSourceRect, currentRect, ScaleToFit.FILL);
mTmpMatrix.postTranslate(app.position.x, app.position.y);
- crop = mClipRect;
+ mClipRectF.roundOut(crop);
}
if (app.isNotInRecents
@@ -179,17 +181,22 @@ public class ClipAnimationHelper {
}
alpha = mTaskAlphaCallback.apply(app, alpha);
+ layer = RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers);
} else {
crop = null;
+ layer = Integer.MAX_VALUE;
}
-
- params[i] = new SurfaceParams(app.leash, alpha, mTmpMatrix, crop,
- RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers));
+ params[i] = new SurfaceParams(app.leash, alpha, mTmpMatrix, crop, layer);
}
applyParams(syncTransactionApplier, params);
return currentRect;
}
+ public RectF getCurrentRectWithInsets() {
+ mTmpMatrix.mapRect(mCurrentRectWithInsets, mClipRectF);
+ return mCurrentRectWithInsets;
+ }
+
private void applyParams(@Nullable SyncRtSurfaceTransactionApplier syncTransactionApplier,
SurfaceParams[] params) {
if (syncTransactionApplier != null) {
diff --git a/quickstep/src/com/android/quickstep/views/LauncherLayoutListener.java b/quickstep/src/com/android/quickstep/views/LauncherLayoutListener.java
index 61740d729..c12a57968 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherLayoutListener.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherLayoutListener.java
@@ -15,11 +15,17 @@
*/
package com.android.quickstep.views;
-import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.view.MotionEvent;
+import android.widget.FrameLayout;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Insettable;
@@ -34,12 +40,28 @@ public class LauncherLayoutListener extends AbstractFloatingView
implements Insettable, LayoutListener {
private final Launcher mLauncher;
+ private final Paint mPaint = new Paint();
private WindowTransformSwipeHandler mHandler;
+ private RectF mCurrentRect;
public LauncherLayoutListener(Launcher launcher) {
super(launcher, null);
mLauncher = launcher;
- setVisibility(INVISIBLE);
+ mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
+ setLayoutParams(new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
+ }
+
+ @Override
+ public void update(boolean shouldFinish, boolean isLongSwipe, RectF currentRect) {
+ if (shouldFinish) {
+ finish();
+ return;
+ }
+
+ mCurrentRect = currentRect;
+
+ setWillNotDraw(mCurrentRect == null || isLongSwipe);
+ invalidate();
}
@Override
@@ -81,11 +103,6 @@ public class LauncherLayoutListener extends AbstractFloatingView
}
@Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- setMeasuredDimension(1, 1);
- }
-
- @Override
public void logActionCommand(int command) {
// We should probably log the weather
}
@@ -97,8 +114,13 @@ public class LauncherLayoutListener extends AbstractFloatingView
@Override
public void finish() {
- setHandler(null);
close(false);
+ setHandler(null);
mLauncher.getRotationHelper().setStateHandlerRequest(REQUEST_NONE);
}
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ canvas.drawRect(mCurrentRect, mPaint);
+ }
}
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 45751328a..7cab18d8d 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -219,6 +219,17 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
closeAllOpenViews(activity, true);
}
+ public static void closeAllOpenViewsExcept(ActivityContext activity, boolean animate,
+ @FloatingViewType int type) {
+ closeOpenViews(activity, animate, TYPE_ALL & ~type);
+ activity.finishAutoCancelActionMode();
+ }
+
+ public static void closeAllOpenViewsExcept(ActivityContext activity,
+ @FloatingViewType int type) {
+ closeAllOpenViewsExcept(activity, true, type);
+ }
+
public static AbstractFloatingView getTopOpenView(ActivityContext activity) {
return getTopOpenViewWithType(activity, TYPE_ALL);
}