From 1801d19bcd212d71a9504e991b976542324338c0 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 13 May 2020 20:06:09 -0700 Subject: [PATCH] Remove LockscreenRecentsActivity - This activity would create another task (no longer in the same stack since we don't have activity type stacks) which was causing the camera to be occluded sometimes, which then cancels the recents animation - Tweaking the animation slightly to match the movement of the closing the activity back to the lockscreen Bug: 156514461 Test: Launch camera on the lockscreen and swipe up to dismiss (repeatedly) Change-Id: I8aaac22767288d7fbf183683276c50acaaf831d2 --- quickstep/AndroidManifest.xml | 6 -- .../quickstep/LockScreenRecentsActivity.java | 31 ---------- .../DeviceLockedInputConsumer.java | 62 +++++++++++++------ quickstep/res/values/dimens.xml | 3 + 4 files changed, 45 insertions(+), 57 deletions(-) delete mode 100644 quickstep/recents_ui_overrides/src/com/android/quickstep/LockScreenRecentsActivity.java diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index 04506b5647..b2286f1bd7 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -95,12 +95,6 @@ android:clearTaskOnLaunch="true" android:exported="false" /> - - = (1 - MIN_PROGRESS_FOR_OVERVIEW); } - if (dismissTask) { - // For now, just start the home intent so user is prompted to unlock the device. - mContext.startActivity(new Intent(Intent.ACTION_MAIN) - .addCategory(Intent.CATEGORY_HOME) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - } + + // Animate back to fullscreen before finishing + ValueAnimator animator = ValueAnimator.ofFloat(mTransformParams.getProgress(), 0f); + animator.setDuration(100); + animator.setInterpolator(Interpolators.ACCEL); + animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + mTransformParams.setProgress((float) valueAnimator.getAnimatedValue()); + mAppWindowAnimationHelper.applyTransform(mTransformParams); + } + }); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (dismissTask) { + // For now, just start the home intent so user is prompted to unlock the device. + mContext.startActivity(new Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_HOME) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + mHomeLaunched = true; + } + mStateCallback.setState(STATE_HANDLER_INVALIDATED); + } + }); + animator.start(); + } else { + mStateCallback.setState(STATE_HANDLER_INVALIDATED); } mVelocityTracker.recycle(); mVelocityTracker = null; @@ -205,13 +226,11 @@ public class DeviceLockedInputConsumer implements InputConsumer, private void startRecentsTransition() { mThresholdCrossed = true; + mHomeLaunched = false; TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers"); mInputMonitorCompat.pilferPointers(); - Intent intent = new Intent(Intent.ACTION_MAIN) - .addCategory(Intent.CATEGORY_DEFAULT) - .setComponent(new ComponentName(mContext, LockScreenRecentsActivity.class)) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK) + Intent intent = mGestureState.getHomeIntent() .putExtra(INTENT_EXTRA_LOG_TRACE_ID, mGestureState.getGestureId()); mTaskAnimationManager.startRecentsAnimation(mGestureState, intent, this); } @@ -229,8 +248,9 @@ public class DeviceLockedInputConsumer implements InputConsumer, mAppWindowAnimationHelper.updateSource(displaySize, targetCompat); } - Utilities.scaleRectAboutCenter(displaySize, SCALE_DOWN); - displaySize.offsetTo(displaySize.left, 0); + // Offset the surface slightly + displaySize.offset(0, mContext.getResources().getDimensionPixelSize( + R.dimen.device_locked_y_offset)); mTransformParams.setTargetSet(mRecentsAnimationTargets); mAppWindowAnimationHelper.updateTargetRect(displaySize); mAppWindowAnimationHelper.applyTransform(mTransformParams); @@ -245,7 +265,9 @@ public class DeviceLockedInputConsumer implements InputConsumer, } private void endRemoteAnimation() { - if (mRecentsAnimationController != null) { + if (mHomeLaunched) { + ActivityManagerWrapper.getInstance().cancelRecentsAnimation(false); + } else if (mRecentsAnimationController != null) { mRecentsAnimationController.finishController( false /* toRecents */, null /* callback */, false /* sendUserLeaveHint */); } diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 72275c81b1..ee55e610c7 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -79,6 +79,9 @@ 28dp + + -80dp + 40dp