Merge "Add bottom margin to recents Go again" into ub-launcher3-qt-dev
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index c03222d..fe10a7a 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
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;
@@ -134,7 +135,11 @@
return anim;
}
- mRecentsView.playRemoteAppToRecentsAnimation(anim, closingAppTarget, recentsTarget);
+ if (closingAppTarget.activityType == ACTIVITY_TYPE_HOME) {
+ mRecentsView.playRemoteHomeToRecentsAnimation(anim, closingAppTarget, recentsTarget);
+ } else {
+ mRecentsView.playRemoteAppToRecentsAnimation(anim, closingAppTarget, recentsTarget);
+ }
return anim;
}
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/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index c5e9cf4..bcb6343 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -184,7 +184,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);
@@ -638,6 +639,53 @@
}
/**
+ * 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.
*
@@ -654,6 +702,7 @@
// 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);
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..fa28106 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
@@ -158,10 +158,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 +169,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/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
index ffe3633..47ce44c 100644
--- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
+++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
@@ -149,10 +149,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/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 60d2850..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);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 70d8cf7..b3a369a 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -33,6 +33,7 @@
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 0d8d92c..a63d468 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;
@@ -296,14 +297,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);
@@ -528,10 +529,22 @@
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 getFallbackLauncherObjectSelector(String resName) {
+ return By.res(getOverviewPackageName(), resName);
+ }
+
String getLauncherPackageName() {
return mDevice.getLauncherPackageName();
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index e8a0b54..c0bafa2 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -58,9 +58,13 @@
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);
+ LauncherInstrumentation.log(
+ "switchToAllApps: swipeHeight = " + swipeHeight + ", slop = "
+ + mLauncher.getTouchSlop());
mLauncher.swipe(
start.x,
start.y,