Merge "Annotating hierarchy dump for the error description" into ub-launcher3-qt-dev
diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml
index c80e531..863a8ba 100644
--- a/quickstep/recents_ui_overrides/res/values/dimens.xml
+++ b/quickstep/recents_ui_overrides/res/values/dimens.xml
@@ -27,5 +27,5 @@
<!-- Swipe up to home related -->
<dimen name="swipe_up_fling_min_visible_change">18dp</dimen>
<dimen name="swipe_up_y_overshoot">10dp</dimen>
- <dimen name="swipe_up_max_workspace_trans_y">-80dp</dimen>
+ <dimen name="swipe_up_max_workspace_trans_y">-60dp</dimen>
</resources>
\ No newline at end of file
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 a662d74..8436fe5 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
@@ -32,7 +32,8 @@
public class BackgroundAppState extends OverviewState {
private static final int STATE_FLAGS =
- FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
+ FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY
+ | FLAG_DISABLE_INTERACTION;
public BackgroundAppState(int id) {
this(id, LauncherLogProto.ContainerType.TASKSWITCHER);
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 7563c3f..294a997 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -58,6 +58,8 @@
import android.view.Surface;
import android.view.WindowManager;
+import androidx.annotation.BinderThread;
+
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
@@ -84,6 +86,7 @@
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
+import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -268,6 +271,9 @@
private final RectF mSwipeTouchRegion = new RectF();
private ComponentName mGestureBlockingActivity;
+ private Region mExclusionRegion;
+ private SystemGestureExclusionListenerCompat mExclusionListener;
+
@Override
public void onCreate() {
super.onCreate();
@@ -284,14 +290,23 @@
mIsUserUnlocked = false;
registerReceiver(mUserUnlockedReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
}
- onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this));
mDefaultDisplayId = getSystemService(WindowManager.class).getDefaultDisplay()
.getDisplayId();
-
String blockingActivity = getString(R.string.gesture_blocking_activity);
mGestureBlockingActivity = TextUtils.isEmpty(blockingActivity) ? null :
ComponentName.unflattenFromString(blockingActivity);
+
+ mExclusionListener = new SystemGestureExclusionListenerCompat(mDefaultDisplayId) {
+ @Override
+ @BinderThread
+ public void onExclusionChanged(Region region) {
+ // Assignments are atomic, it should be safe on binder thread
+ mExclusionRegion = region;
+ }
+ };
+
+ onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this));
sConnected = true;
}
@@ -370,6 +385,12 @@
disposeEventHandlers();
initInputMonitor();
+
+ if (mMode == Mode.NO_BUTTON) {
+ mExclusionListener.register();
+ } else {
+ mExclusionListener.unregister();
+ }
}
@Override
@@ -437,6 +458,7 @@
sConnected = false;
Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver);
SysUINavigationMode.INSTANCE.get(this).removeModeChangeListener(this);
+ mExclusionListener.unregister();
super.onDestroy();
}
@@ -557,10 +579,15 @@
final ActivityControlHelper activityControl =
mOverviewComponentObserver.getActivityControlHelper();
boolean shouldDefer = activityControl.deferStartingActivity(mActiveNavBarRegion, event);
+
+ // mExclusionRegion can change on binder thread, use a local instance here.
+ Region exclusionRegion = mExclusionRegion;
+ boolean disableHorizontalSwipe = mMode == Mode.NO_BUTTON && exclusionRegion != null
+ && exclusionRegion.contains((int) event.getX(), (int) event.getY());
return new OtherActivityInputConsumer(this, runningTaskInfo, mRecentsModel,
mOverviewComponentObserver.getOverviewIntent(), activityControl,
shouldDefer, mOverviewCallbacks, mInputConsumer, this::onConsumerInactive,
- mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion);
+ mSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion, disableHorizontalSwipe);
}
private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) {
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 0d0478a..c7aaa9b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.Utilities.postAsyncCallback;
+import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -106,7 +107,6 @@
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.LatencyTrackerCompat;
-import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
import com.android.systemui.shared.system.WindowCallbacksCompat;
@@ -647,6 +647,9 @@
}
private void buildAnimationController() {
+ if (mStateCallback.hasStates(STATE_GESTURE_COMPLETED)) {
+ return;
+ }
initTransitionEndpoints(mActivity.getDeviceProfile());
mAnimationFactory.createActivityController(mTransitionDragLength);
}
@@ -902,10 +905,14 @@
// If swiping at a diagonal, base end target on the faster velocity.
endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity)
? NEW_TASK : HOME;
- } else if (endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold)) {
- // If user scrolled to a new task, only go to recents if they already passed
- // the overview threshold. Otherwise, we'll snap to the new task and launch it.
- endTarget = RECENTS;
+ } else if (endVelocity < 0) {
+ if (reachedOverviewThreshold) {
+ endTarget = RECENTS;
+ } else {
+ // If swiping at a diagonal, base end target on the faster velocity.
+ endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity)
+ ? NEW_TASK : RECENTS;
+ }
} else {
endTarget = goingToNewTask ? NEW_TASK : LAST_TASK;
}
@@ -976,6 +983,12 @@
} else if (endTarget == RECENTS) {
mLiveTileOverlay.startIconAnimation();
if (mRecentsView != null) {
+ int nearestPage = mRecentsView.getPageNearestToCenterOfScreen();
+ if (mRecentsView.getNextPage() != nearestPage) {
+ // We shouldn't really scroll to the next page when swiping up to recents.
+ // Only allow settling on the next page if it's nearest to the center.
+ mRecentsView.snapToPage(nearestPage, Math.toIntExact(duration));
+ }
if (mRecentsView.getScroller().getDuration() > MAX_SWIPE_DURATION) {
mRecentsView.snapToPage(mRecentsView.getNextPage(), (int) MAX_SWIPE_DURATION);
}
@@ -1057,8 +1070,8 @@
setStateOnUiThread(target.endState);
}
});
- homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y);
windowAnim.start(velocityPxPerMs);
+ homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y);
mRunningWindowAnim = RunningWindowAnim.wrap(windowAnim);
mLauncherTransitionController = null;
} else {
@@ -1131,16 +1144,25 @@
AnimatorPlaybackController homeAnim = homeAnimationFactory.createActivityAnimationToHome();
+ // End on a "round-enough" radius so that the shape reveal doesn't have to do too much
+ // rounding at the end of the animation.
+ float startRadius = mClipAnimationHelper.getCurrentCornerRadius();
+ float endRadius = startRect.width() / 6f;
// We want the window alpha to be 0 once this threshold is met, so that the
// FolderIconView can be seen morphing into the icon shape.
final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f;
anim.addOnUpdateListener((currentRect, progress) -> {
homeAnim.setPlayFraction(progress);
- float windowAlpha = Math.max(0, Utilities.mapToRange(progress, 0,
- windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR));
+ float alphaProgress = ACCEL_1_5.getInterpolation(progress);
+ float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0,
+ windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1);
mTransformParams.setProgress(progress)
.setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
+ if (isFloatingIconView) {
+ mTransformParams.setCornerRadius(endRadius * progress + startRadius
+ * (1f - progress));
+ }
mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
false /* launcherOnTop */);
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 bf276e1..837423a 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
@@ -62,6 +62,10 @@
private static final String TAG = "AssistantTouchConsumer";
private static final long RETRACT_ANIMATION_DURATION_MS = 300;
+ // From //java/com/google/android/apps/gsa/search/shared/util/OpaContract.java.
+ private static final String OPA_BUNDLE_TRIGGER = "triggered_by";
+ // From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto.
+ private static final int OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE = 83;
private static final String INVOCATION_TYPE_KEY = "invocation_type";
private static final int INVOCATION_TYPE_GESTURE = 1;
private static final int INVOCATION_TYPE_FLING = 6;
@@ -230,6 +234,7 @@
startAssistantInternal(SWIPE);
Bundle args = new Bundle();
+ args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE);
args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
mSysUiProxy.startAssistant(args);
mLaunchedAssistant = true;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index b0acffa..0ed4c99 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -111,6 +111,7 @@
private final float mDragSlop;
private final float mSquaredTouchSlop;
+ private final boolean mDisableHorizontalSwipe;
// Slop used to check when we start moving window.
private boolean mPassedDragSlop;
@@ -132,7 +133,7 @@
InputConsumerController inputConsumer,
Consumer<OtherActivityInputConsumer> onCompleteCallback,
SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat,
- RectF swipeTouchRegion) {
+ RectF swipeTouchRegion, boolean disableHorizontalSwipe) {
super(base);
mMainThreadHandler = new Handler(Looper.getMainLooper());
@@ -162,6 +163,7 @@
mSquaredTouchSlop = slop * slop;
mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
+ mDisableHorizontalSwipe = !mPassedTouchSlop && disableHorizontalSwipe;
}
@Override
@@ -169,6 +171,13 @@
return TYPE_OTHER_ACTIVITY;
}
+ private void forceCancelGesture(MotionEvent ev) {
+ int action = ev.getAction();
+ ev.setAction(ACTION_CANCEL);
+ finishTouchTracking(ev);
+ ev.setAction(action);
+ }
+
@Override
public void onMotionEvent(MotionEvent ev) {
if (mVelocityTracker == null) {
@@ -216,10 +225,7 @@
// Cancel interaction in case of multi-touch interaction
int ptrIdx = ev.getActionIndex();
if (!mSwipeTouchRegion.contains(ev.getX(ptrIdx), ev.getY(ptrIdx))) {
- int action = ev.getAction();
- ev.setAction(ACTION_CANCEL);
- finishTouchTracking(ev);
- ev.setAction(action);
+ forceCancelGesture(ev);
}
}
break;
@@ -258,7 +264,15 @@
}
if (!mPassedTouchSlop) {
- if (squaredHypot(displacementX, mLastPos.y - mDownPos.y) >= mSquaredTouchSlop) {
+ float displacementY = mLastPos.y - mDownPos.y;
+ if (squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop) {
+ if (mDisableHorizontalSwipe
+ && Math.abs(displacementX) > Math.abs(displacementY)) {
+ // Horizontal gesture is not allowed in this region
+ forceCancelGesture(ev);
+ break;
+ }
+
mPassedTouchSlop = true;
if (mIsDeferredDownTarget) {
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 e2fb602..aca23e4 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
@@ -197,10 +197,15 @@
mTmpMatrix.postTranslate(app.position.x, app.position.y);
mClipRectF.roundOut(crop);
if (mSupportsRoundedCornersOnWindows) {
- float windowCornerRadius = mUseRoundedCornersOnWindows
- ? mWindowCornerRadius : 0;
- cornerRadius = Utilities.mapRange(progress, windowCornerRadius,
- mTaskCornerRadius);
+ if (params.cornerRadius > -1) {
+ cornerRadius = params.cornerRadius;
+ scale = params.currentRect.width() / crop.width();
+ } else {
+ float windowCornerRadius = mUseRoundedCornersOnWindows
+ ? mWindowCornerRadius : 0;
+ cornerRadius = Utilities.mapRange(progress, windowCornerRadius,
+ mTaskCornerRadius);
+ }
mCurrentCornerRadius = cornerRadius;
}
}
@@ -355,6 +360,7 @@
@Nullable RectF currentRect;
float targetAlpha;
boolean forLiveTile;
+ float cornerRadius;
SyncRtSurfaceTransactionApplierCompat syncTransactionApplier;
@@ -365,6 +371,7 @@
currentRect = null;
targetAlpha = 0;
forLiveTile = false;
+ cornerRadius = -1;
}
public TransformParams setProgress(float progress) {
@@ -373,6 +380,11 @@
return this;
}
+ public TransformParams setCornerRadius(float cornerRadius) {
+ this.cornerRadius = cornerRadius;
+ return this;
+ }
+
public TransformParams setCurrentRectAndTargetAlpha(RectF currentRect, float targetAlpha) {
this.currentRect = currentRect;
this.targetAlpha = targetAlpha;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 93b6e4b..837c2dc 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -44,14 +44,13 @@
*/
public class StaggeredWorkspaceAnim {
- private static final int APP_CLOSE_ROW_START_DELAY_MS = 16;
- private static final int ALPHA_DURATION_MS = 200;
+ private static final int APP_CLOSE_ROW_START_DELAY_MS = 10;
+ private static final int ALPHA_DURATION_MS = 250;
private static final float MAX_VELOCITY_PX_PER_S = 22f;
- private static final float DAMPING_RATIO =
- (SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY + SpringForce.DAMPING_RATIO_LOW_BOUNCY) / 2f;
- private static final float STIFFNESS = SpringForce.STIFFNESS_LOW;
+ private static final float DAMPING_RATIO = 0.7f;
+ private static final float STIFFNESS = 150f;
private final float mVelocity;
private final float mSpringTransY;
@@ -71,9 +70,9 @@
// Scale the translationY based on the initial velocity to better sync the workspace items
// with the floating view.
- float transFactor = 0.1f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
+ float transFactor = 0.2f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
mSpringTransY = transFactor * launcher.getResources()
- .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);;
+ .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);
DeviceProfile grid = launcher.getDeviceProfile();
ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace()
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 917465f..f8d454f 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
@@ -52,6 +52,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.UserEventDispatcher;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -182,6 +183,9 @@
super(context, attrs, defStyleAttr);
mActivity = BaseDraggingActivity.fromContext(context);
setOnClickListener((view) -> {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "TaskView onClick");
+ }
if (getTask() == null) {
return;
}
@@ -285,6 +289,9 @@
public void launchTask(boolean animate, boolean freezeTaskList, Consumer<Boolean> resultCallback,
Handler resultCallbackHandler) {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "launchTask");
+ }
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (isRunningTask()) {
getRecentsView().finishRecentsAnimation(false /* toRecents */,
@@ -299,6 +306,9 @@
private void launchTaskInternal(boolean animate, boolean freezeTaskList,
Consumer<Boolean> resultCallback, Handler resultCallbackHandler) {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.d(TestProtocol.NO_START_TASK_TAG, "launchTaskInternal");
+ }
if (mTask != null) {
final ActivityOptions opts;
if (animate) {
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 79540c1..dcf2e3c 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -119,6 +119,9 @@
private static final long APP_LAUNCH_ALPHA_DOWN_DURATION =
(long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
+ private static final long CROP_DURATION = 375;
+ private static final long RADIUS_DURATION = 375;
+
public static final int RECENTS_LAUNCH_DURATION = 336;
private static final int LAUNCHER_RESUME_START_DELAY = 100;
private static final int CLOSING_TRANSITION_DURATION_MS = 250;
@@ -494,10 +497,10 @@
EXAGGERATED_EASE);
FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
alphaDuration, LINEAR);
- FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, APP_LAUNCH_DURATION,
+ FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, CROP_DURATION,
EXAGGERATED_EASE);
FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0,
- APP_LAUNCH_DURATION, EXAGGERATED_EASE);
+ RADIUS_DURATION, EXAGGERATED_EASE);
@Override
public void onUpdate(float percent) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 711cfd2..855535b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -277,6 +277,7 @@
final Handler mHandler = new Handler();
private final Runnable mHandleDeferredResume = this::handleDeferredResume;
+ private boolean mDeferredResumePending;
private float mCurrentAssistantVisibility = 0f;
@@ -490,9 +491,7 @@
mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
}
- if (supportsFakeLandscapeUI()
- && mDeviceProfile.isVerticalBarLayout()
- && !mDeviceProfile.isMultiWindowMode) {
+ if (supportsFakeLandscapeUI() && mDeviceProfile.isVerticalBarLayout()) {
mStableDeviceProfile = mDeviceProfile.inv.portraitProfile;
mRotationMode = UiFactory.getRotationMode(mDeviceProfile);
} else {
@@ -500,6 +499,7 @@
mRotationMode = RotationMode.NORMAL;
}
+ mRotationHelper.updateRotationAnimation();
onDeviceProfileInitiated();
mModelWriter = mModel.getWriter(getWallpaperDeviceProfile().isVerticalBarLayout(), true);
}
@@ -890,26 +890,40 @@
}
private void handleDeferredResume() {
- if (hasBeenResumed()) {
+ if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
getUserEventDispatcher().logActionCommand(Action.Command.RESUME,
mStateManager.getState().containerType, -1);
getUserEventDispatcher().startSession();
UiFactory.onLauncherStateOrResumeChanged(this);
AppLaunchTracker.INSTANCE.get(this).onReturnedToHome();
- resetPendingActivityResultIfNeeded();
- }
- }
- private void resetPendingActivityResultIfNeeded() {
- if (hasBeenResumed() && mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
- UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+ // Process any items that were added while Launcher was away.
+ InstallShortcutReceiver.disableAndFlushInstallQueue(
+ InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this);
+
+ // Refresh shortcuts if the permission changed.
+ mModel.refreshShortcutsIfRequired();
+
+ DiscoveryBounce.showForHomeIfNeeded(this);
+
+ if (mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
+ UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+ }
+ mDeferredResumePending = false;
+ } else {
+ mDeferredResumePending = true;
}
}
protected void onStateSet(LauncherState state) {
getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
- resetPendingActivityResultIfNeeded();
+ if (mDeferredResumePending) {
+ handleDeferredResume();
+ }
+ if (mLauncherCallbacks != null) {
+ mLauncherCallbacks.onStateChanged();
+ }
}
@Override
@@ -923,14 +937,7 @@
Utilities.postAsyncCallback(mHandler, mHandleDeferredResume);
setOnResumeCallback(null);
- // Process any items that were added while Launcher was away.
- InstallShortcutReceiver.disableAndFlushInstallQueue(
- InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this);
- // Refresh shortcuts if the permission changed.
- mModel.refreshShortcutsIfRequired();
-
- DiscoveryBounce.showForHomeIfNeeded(this);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onResume();
}
diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java
index edac516..dfe75ec 100644
--- a/src/com/android/launcher3/LauncherCallbacks.java
+++ b/src/com/android/launcher3/LauncherCallbacks.java
@@ -21,7 +21,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.util.ArrayList;
/**
* LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
@@ -53,6 +52,11 @@
boolean handleBackPressed();
void onTrimMemory(int level);
+ /**
+ * Called when the launcher state changed
+ */
+ default void onStateChanged() { }
+
/*
* Extension points for providing custom behavior on certain user interactions.
*/
diff --git a/src/com/android/launcher3/anim/FlingSpringAnim.java b/src/com/android/launcher3/anim/FlingSpringAnim.java
index f53ea51..eaf3b1c 100644
--- a/src/com/android/launcher3/anim/FlingSpringAnim.java
+++ b/src/com/android/launcher3/anim/FlingSpringAnim.java
@@ -29,7 +29,7 @@
private static final float FLING_FRICTION = 1.5f;
private static final float SPRING_STIFFNESS = 200;
- private static final float SPRING_DAMPING = 0.85f;
+ private static final float SPRING_DAMPING = 0.8f;
private final FlingAnimation mFlingAnim;
private SpringAnimation mSpringAnim;
diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
index 81c95cb..43ae651 100644
--- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
+++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
@@ -53,6 +53,9 @@
}
public static void sendStateEventToTest(Context context, int stateOrdinal) {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "sendStateEventToTest");
+ }
final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
if (accessibilityManager == null) return;
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index b35e23c..6ba015b 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -130,16 +130,6 @@
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
}
- @Override
- protected boolean findActiveController(MotionEvent ev) {
- if (mActivity.getStateManager().getState().disableInteraction) {
- // You Shall Not Pass!!!
- mActiveController = null;
- return true;
- }
- return super.findActiveController(ev);
- }
-
private boolean isEventOverAccessibleDropTargetBar(MotionEvent ev) {
return isInAccessibleDrag() && isEventOverView(mActivity.getDropTargetBar(), ev);
}
diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java
index b6c3c35..cd96d6e 100644
--- a/src/com/android/launcher3/states/RotationHelper.java
+++ b/src/com/android/launcher3/states/RotationHelper.java
@@ -94,16 +94,20 @@
public boolean homeScreenCanRotate() {
return mIgnoreAutoRotateSettings || mAutoRotateEnabled
- || mStateHandlerRequest != REQUEST_NONE;
+ || mStateHandlerRequest != REQUEST_NONE
+ || mLauncher.getDeviceProfile().isMultiWindowMode;
}
- private void updateRotationAnimation() {
+ public void updateRotationAnimation() {
if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) {
WindowManager.LayoutParams lp = mLauncher.getWindow().getAttributes();
+ int oldAnim = lp.rotationAnimation;
lp.rotationAnimation = homeScreenCanRotate()
? WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE
: WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
- mLauncher.getWindow().setAttributes(lp);
+ if (oldAnim != lp.rotationAnimation) {
+ mLauncher.getWindow().setAttributes(lp);
+ }
}
}
@@ -123,6 +127,7 @@
public void setStateHandlerRequest(int request) {
if (mStateHandlerRequest != request) {
mStateHandlerRequest = request;
+ updateRotationAnimation();
notifyChange();
}
}
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index a678ef2..99efb22 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -68,6 +68,8 @@
public static boolean sDebugTracing = false;
public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
+ public static final String NO_ALLAPPS_EVENT_TAG = "b/133867119";
public static final String NO_DRAG_TAG = "b/133009122";
public static final String NO_START_TAG = "b/132900132";
+ public static final String NO_START_TASK_TAG = "b/133765434";
}
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 35fc873..9703aa6 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -43,6 +43,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.compat.AccessibilityManagerCompat;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -363,6 +364,9 @@
@Override
public void onDragEnd(float velocity, boolean fling) {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragEnd");
+ }
final int logAction = fling ? Touch.FLING : Touch.SWIPE;
boolean blockedFling = fling && mFlingBlockCheck.isBlocked();
@@ -499,6 +503,9 @@
}
protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) {
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onSwipeInteractionCompleted 1");
+ }
if (mAtomicComponentsController != null) {
mAtomicComponentsController.getAnimationPlayer().end();
mAtomicComponentsController = null;
@@ -517,6 +524,10 @@
}
mLauncher.getStateManager().goToState(targetState, false /* animated */);
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.e(
+ TestProtocol.NO_ALLAPPS_EVENT_TAG, "onSwipeInteractionCompleted 2");
+ }
AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal);
}
}
diff --git a/src/com/android/launcher3/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java
index 4e3dcf8..4616e58 100644
--- a/src/com/android/launcher3/touch/SwipeDetector.java
+++ b/src/com/android/launcher3/touch/SwipeDetector.java
@@ -25,6 +25,7 @@
import android.view.ViewConfiguration;
import com.android.launcher3.Utilities;
+import com.android.launcher3.testing.TestProtocol;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
@@ -174,6 +175,11 @@
}
mState = newState;
+ if (com.android.launcher3.testing.TestProtocol.sDebugTracing) {
+ android.util.Log.e(TestProtocol.NO_ALLAPPS_EVENT_TAG,
+ "setState: " + newState + " @ " + android.util.Log.getStackTraceString(
+ new Throwable()));
+ }
}
public boolean isDraggingOrSettling() {
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index cf0ee62..e4591b6 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -77,7 +77,7 @@
public class FloatingIconView extends View implements
Animator.AnimatorListener, ClipPathView, OnGlobalLayoutListener {
- public static final float SHAPE_PROGRESS_DURATION = 0.15f;
+ public static final float SHAPE_PROGRESS_DURATION = 0.10f;
private static final int FADE_DURATION_MS = 200;
private static final Rect sTmpRect = new Rect();
private static final RectF sTmpRectF = new RectF();
@@ -85,8 +85,8 @@
// We spring the foreground drawable relative to the icon's movement in the DragLayer.
// We then use these two factor values to scale the movement of the fg within this view.
- private static final int FG_TRANS_X_FACTOR = 80;
- private static final int FG_TRANS_Y_FACTOR = 100;
+ private static final int FG_TRANS_X_FACTOR = 60;
+ private static final int FG_TRANS_Y_FACTOR = 75;
private static final FloatPropertyCompat<FloatingIconView> mFgTransYProperty
= new FloatPropertyCompat<FloatingIconView>("FloatingViewFgTransY") {
@@ -641,6 +641,11 @@
view.setVisibility(VISIBLE);
originalView.setVisibility(INVISIBLE);
};
+ if (!isOpening) {
+ // Hide immediately since the floating view starts at a different location.
+ originalView.setVisibility(INVISIBLE);
+ view.mLoadIconSignal.setOnCancelListener(() -> originalView.setVisibility(VISIBLE));
+ }
CancellationSignal loadIconSignal = view.mLoadIconSignal;
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening,
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 18a8f27..d03035a 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -20,8 +20,10 @@
import android.graphics.Point;
import android.graphics.Rect;
+import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
@@ -42,6 +44,10 @@
super(launcher);
final UiObject2 allAppsContainer = verifyActiveContainer();
mHeight = allAppsContainer.getVisibleBounds().height();
+ final UiObject2 appListRecycler = mLauncher.waitForObjectInContainer(allAppsContainer,
+ "apps_list_view");
+ // Wait for the recycler to populate.
+ mLauncher.waitForObjectInContainer(appListRecycler, By.clazz(TextView.class));
}
@Override
@@ -115,7 +121,7 @@
verifyActiveContainer();
}
- final UiObject2 appIcon = mLauncher.getObjectInContainer(allAppsContainer,
+ final UiObject2 appIcon = mLauncher.getObjectInContainer(appListRecycler,
appIconSelector);
ensureIconVisible(appIcon, allAppsContainer, appListRecycler);
return new AppIcon(mLauncher, appIcon);
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index ee12b27..e45fca8 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -571,6 +571,16 @@
return object;
}
+ @NonNull
+ UiObject2 waitForObjectInContainer(UiObject2 container, BySelector selector) {
+ final UiObject2 object = container.wait(
+ Until.findObject(selector),
+ WAIT_TIME_MS);
+ assertNotNull("Can't find a launcher object id: " + selector + " in container: " +
+ container.getResourceName(), object);
+ return object;
+ }
+
@Nullable
private boolean hasLauncherObject(String resId) {
return mDevice.hasObject(getLauncherObjectSelector(resId));
@@ -582,11 +592,6 @@
}
@NonNull
- UiObject2 waitForLauncherObjectByClass(String clazz) {
- return waitForObjectBySelector(getLauncherObjectSelectorByClass(clazz));
- }
-
- @NonNull
UiObject2 waitForFallbackLauncherObject(String resName) {
return waitForObjectBySelector(getFallbackLauncherObjectSelector(resName));
}
@@ -601,10 +606,6 @@
return By.res(getLauncherPackageName(), resName);
}
- BySelector getLauncherObjectSelectorByClass(String clazz) {
- return By.pkg(getLauncherPackageName()).clazz(clazz);
- }
-
BySelector getFallbackLauncherObjectSelector(String resName) {
return By.res(getOverviewPackageName(), resName);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
index 2ea7618..8b12464 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
@@ -20,6 +20,8 @@
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
+import com.android.launcher3.testing.TestProtocol;
+
/**
* A recent task in the overview panel carousel.
*/
@@ -59,9 +61,14 @@
*/
public Background open() {
verifyActiveContainer();
- mLauncher.assertTrue("Launching task didn't open a new window: " +
- mTask.getParent().getContentDescription(),
- mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS));
+ mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
+ try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
+ "clicking an overview task")) {
+ mLauncher.assertTrue("Launching task didn't open a new window: " +
+ mTask.getParent().getContentDescription(),
+ mTask.clickAndWait(Until.newWindow(), WAIT_TIME_MS));
+ }
+ mLauncher.getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING);
return new Background(mLauncher);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 7dcc426..33754c1 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -66,6 +66,7 @@
"switchToAllApps: swipeHeight = " + swipeHeight + ", slop = "
+ mLauncher.getTouchSlop());
+ mLauncher.getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
mLauncher.swipeToState(
start.x,
start.y,
@@ -73,6 +74,7 @@
start.y - swipeHeight - mLauncher.getTouchSlop(),
60,
ALL_APPS_STATE_ORDINAL);
+ mLauncher.getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped to all apps")) {