Merge "Fix issue with restored task display ids" into ub-launcher3-qt-dev
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/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/src/com/android/launcher3/appprediction/PredictionAppTracker.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionAppTracker.java
index fa28106..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) {
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..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 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/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/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/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/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 128fd45..808a8ea 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -84,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)
@@ -439,12 +462,18 @@
mUncheckedConsumer.onMotionEvent(event);
}
+ private boolean validSystemUiFlags() {
+ return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
+ && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
+ }
+
+ private boolean topTaskLocked() {
+ return ActivityManagerWrapper.getInstance().isLockToAppActive();
+ }
private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
- boolean validSystemUIFlags = (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
- && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
- boolean topTaskLocked = ActivityManagerWrapper.getInstance().isLockToAppActive();
- boolean isInValidSystemUiState = validSystemUIFlags && !topTaskLocked;
+ boolean topTaskLocked = topTaskLocked();
+ boolean isInValidSystemUiState = validSystemUiFlags() && !topTaskLocked;
if (!mIsUserUnlocked) {
if (isInValidSystemUiState) {
@@ -540,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 537858d..0773904 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -170,13 +170,13 @@
STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED;
public enum GestureEndTarget {
- HOME(1, STATE_SCALED_CONTROLLER_HOME | STATE_CAPTURE_SCREENSHOT, true, false,
- ContainerType.WORKSPACE, false),
+ 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);
@@ -320,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
@@ -331,8 +331,9 @@
| STATE_SCALED_CONTROLLER_RECENTS,
this::finishCurrentTransitionToRecents);
- mStateCallback.addCallback(STATE_SCREENSHOT_CAPTURED | STATE_GESTURE_COMPLETED
- | STATE_SCALED_CONTROLLER_HOME,
+ mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_GESTURE_COMPLETED
+ | STATE_SCALED_CONTROLLER_HOME | STATE_APP_CONTROLLER_RECEIVED
+ | STATE_LAUNCHER_DRAWN,
this::finishCurrentTransitionToHome);
mStateCallback.addCallback(STATE_SCALED_CONTROLLER_HOME | STATE_CURRENT_TASK_FINISHED,
this::reset);
@@ -503,6 +504,7 @@
private void setupRecentsViewUi() {
if (mContinuingLastGesture) {
+ updateSysUiFlags(mCurrentShift.value);
return;
}
mRecentsView.onGestureAnimationStart(mRunningTaskId);
@@ -676,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/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
index 0448fd1..c1a5ddc 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
@@ -257,7 +257,7 @@
@Override
public void onDragEnd(float velocity, boolean fling) {
- if (fling) {
+ if (fling && !mLaunchedAssistant) {
mLastProgress = 1;
updateAssistant(FLING);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
index 2e8880d..6e7cb8f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/InputConsumer.java
@@ -63,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/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index a650113..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
@@ -285,13 +285,20 @@
/**
* Compute scale and translation y such that the specified task view fills the screen.
*/
- public LauncherState.ScaleAndTranslation getOverviewFullscreenScaleAndTranslation(TaskView v) {
+ 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);
@@ -332,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/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 bdac750..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,6 +30,7 @@
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;
@@ -179,6 +180,21 @@
}
@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,
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..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;
@@ -77,6 +77,7 @@
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;
@@ -99,7 +100,6 @@
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;
@@ -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;
@@ -1286,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);
@@ -1423,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());
@@ -1461,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");
@@ -1481,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) -> {
@@ -1560,6 +1532,9 @@
return mPendingAnimation;
}
+ protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) {
+ }
+
public abstract boolean shouldUseMultiWindowTaskSizeStrategy();
protected void onTaskLaunched(boolean success) {
@@ -1714,4 +1689,8 @@
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 a9184ec..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
@@ -75,8 +75,6 @@
}
};
- private final float mCornerRadius;
-
private final BaseActivity mActivity;
private final TaskOverlay mOverlay;
private final boolean mIsDarkTextTheme;
@@ -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);
- mFullscreenParams = new TaskView.FullscreenDrawParams(mCornerRadius);
+ mFullscreenParams = new TaskView.FullscreenDrawParams(TaskCornerRadius.get(context));
}
public void bind(Task task) {
@@ -225,10 +222,6 @@
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()) {
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 c67058d..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
@@ -103,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
@@ -165,7 +152,6 @@
private IconView mIconView;
private DigitalWellBeingToast mDigitalWellBeingToast;
private float mCurveScale;
- private float mZoomScale;
private float mFullscreenProgress;
private final FullscreenDrawParams mCurrentFullscreenParams;
private final float mCornerRadius;
@@ -459,7 +445,6 @@
private void resetViewTransforms() {
setCurveScale(1);
- setZoomScale(1);
setTranslationX(0f);
setTranslationY(0f);
setTranslationZ(0);
@@ -527,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);
}
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index d1ef631..ecf1b0a 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -35,40 +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>
-
- <FrameLayout
- android:id="@+id/proactive_suggest_container"
- android:layout_width="match_parent"
- android:layout_height="36dp"
- android:gravity="center"
- android:layout_gravity="bottom|center"
- android:translationY="20dp"
- android:elevation="4dp"
- />
+ 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/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 77ac35c..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,6 +199,40 @@
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.getDeviceProfile().widthPx
diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
index 47ce44c..5e20e56 100644
--- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
+++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
@@ -79,6 +79,8 @@
@After
public void tearDown() throws Throwable {
+ AppLaunchTracker.INSTANCE.initializeForTesting(null);
+ PredictionUiStateManager.INSTANCE.initializeForTesting(null);
mDevice.unfreezeRotation();
}
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/styles.xml b/res/values/styles.xml
index 8116e30..881f65d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -19,7 +19,7 @@
<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>
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/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index d098b8c..c1f898c 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -210,9 +210,8 @@
+ 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;
+ // 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)
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 359d8d9..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;
@@ -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/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/Utilities.java b/src/com/android/launcher3/Utilities.java
index 732aa95..af22f1b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -50,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;
@@ -71,6 +72,7 @@
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;
@@ -133,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";
@@ -160,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.
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index bad8282..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;
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 77b2cdc..7af12c5 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -46,6 +46,8 @@
import com.android.launcher3.Launcher;
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;
@@ -60,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();
@@ -172,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}.
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 9373976..962f215 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -35,6 +35,8 @@
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;
@@ -152,7 +154,8 @@
final float yDistance = initialY - lp.y;
// Set up the Folder background.
- final int finalColor = Themes.getAttrColor(mContext, R.attr.folderFillColor);
+ final int finalColor = ColorUtils.setAlphaComponent(
+ Themes.getAttrColor(mContext, R.attr.folderFillColor), 255);
final int initialColor = setColorAlphaBound(
finalColor, mPreviewBackground.getBackgroundAlpha());
mFolderBackground.mutate();
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/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/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/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index cb7bba7..e5c75c3 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -441,7 +441,8 @@
}
if (!isFolderIcon) {
- mStartRevealRect.inset(mBlurSizeOutline, mBlurSizeOutline);
+ Utilities.scaleRectAboutCenter(mStartRevealRect,
+ IconShape.getNormalizationScale());
}
float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
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_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 6008d14..550327d 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -18,6 +18,9 @@
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;
@@ -79,4 +82,18 @@
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/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/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index b3a369a..ace49e9 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -28,7 +28,7 @@
* 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) {
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index ec62188..57fd4b9 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -58,6 +58,7 @@
import org.junit.Assert;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Deque;
@@ -197,7 +198,7 @@
return NavigationModel.THREE_BUTTON;
}
- public static boolean needSlowGestures() {
+ public static boolean isAvd() {
return Build.MODEL.contains("Cuttlefish");
}
@@ -214,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);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 3cab1a1..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;