Merge "Improve lockscreen launch animations" into lmp-mr1-dev
This commit is contained in:
@@ -18,8 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
<alpha
|
||||||
android:detachWallpaper="true" android:interpolator="@interpolator/decelerate_quad">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="160" />
|
android:detachWallpaper="true"
|
||||||
</set>
|
android:interpolator="@interpolator/decelerate_quad"
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:duration="160" />
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
android:shareInterpolator="false"
|
android:shareInterpolator="false"
|
||||||
android:startOffset="100">
|
android:startOffset="100">
|
||||||
|
|
||||||
<translate android:fromYDelta="110%" android:toYDelta="0"
|
<translate android:fromYDelta="110%p" android:toYDelta="0"
|
||||||
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
|
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
|
||||||
android:interpolator="@interpolator/decelerate_quint"
|
android:interpolator="@interpolator/decelerate_quint"
|
||||||
android:duration="300" />
|
android:duration="300" />
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
android:interpolator="@interpolator/decelerate_quint"
|
android:interpolator="@interpolator/decelerate_quint"
|
||||||
android:duration="400"/>
|
android:duration="400"/>
|
||||||
|
|
||||||
<translate android:fromYDelta="11%" android:toYDelta="0"
|
<translate android:fromYDelta="11%p" android:toYDelta="0"
|
||||||
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
|
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
|
||||||
android:interpolator="@interpolator/decelerate_quint"
|
android:interpolator="@interpolator/decelerate_quint"
|
||||||
android:duration="300" />
|
android:duration="300" />
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
|||||||
*/
|
*/
|
||||||
public class KeyguardViewMediator extends SystemUI {
|
public class KeyguardViewMediator extends SystemUI {
|
||||||
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
|
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
|
||||||
|
private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000;
|
||||||
|
|
||||||
final static boolean DEBUG = false;
|
final static boolean DEBUG = false;
|
||||||
private final static boolean DBG_WAKE = false;
|
private final static boolean DBG_WAKE = false;
|
||||||
|
|
||||||
@@ -136,6 +138,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private static final int DISMISS = 17;
|
private static final int DISMISS = 17;
|
||||||
private static final int START_KEYGUARD_EXIT_ANIM = 18;
|
private static final int START_KEYGUARD_EXIT_ANIM = 18;
|
||||||
private static final int ON_ACTIVITY_DRAWN = 19;
|
private static final int ON_ACTIVITY_DRAWN = 19;
|
||||||
|
private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default amount of time we stay awake (used for all key input)
|
* The default amount of time we stay awake (used for all key input)
|
||||||
@@ -294,7 +297,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
// ActivityManagerService) will not reconstruct the keyguard if it is already showing.
|
// ActivityManagerService) will not reconstruct the keyguard if it is already showing.
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
mSwitchingUser = true;
|
mSwitchingUser = true;
|
||||||
mKeyguardDonePending = false;
|
resetKeyguardDonePendingLocked();
|
||||||
resetStateLocked();
|
resetStateLocked();
|
||||||
adjustStatusBarLocked();
|
adjustStatusBarLocked();
|
||||||
// When we switch users we want to bring the new user to the biometric unlock even
|
// When we switch users we want to bring the new user to the biometric unlock even
|
||||||
@@ -450,6 +453,8 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
mKeyguardDonePending = true;
|
mKeyguardDonePending = true;
|
||||||
mHideAnimationRun = true;
|
mHideAnimationRun = true;
|
||||||
mStatusBarKeyguardViewManager.startPreHideAnimation(null /* finishRunnable */);
|
mStatusBarKeyguardViewManager.startPreHideAnimation(null /* finishRunnable */);
|
||||||
|
mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
|
||||||
|
KEYGUARD_DONE_PENDING_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -584,7 +589,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
mScreenOn = false;
|
mScreenOn = false;
|
||||||
if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
|
if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
|
||||||
|
|
||||||
mKeyguardDonePending = false;
|
resetKeyguardDonePendingLocked();
|
||||||
mHideAnimationRun = false;
|
mHideAnimationRun = false;
|
||||||
|
|
||||||
// Lock immediately based on setting if secure (user has a pin/pattern/password).
|
// Lock immediately based on setting if secure (user has a pin/pattern/password).
|
||||||
@@ -1108,6 +1113,9 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
StartKeyguardExitAnimParams params = (StartKeyguardExitAnimParams) msg.obj;
|
StartKeyguardExitAnimParams params = (StartKeyguardExitAnimParams) msg.obj;
|
||||||
handleStartKeyguardExitAnimation(params.startTime, params.fadeoutDuration);
|
handleStartKeyguardExitAnimation(params.startTime, params.fadeoutDuration);
|
||||||
break;
|
break;
|
||||||
|
case KEYGUARD_DONE_PENDING_TIMEOUT:
|
||||||
|
Log.w(TAG, "Timeout while waiting for activity drawn!");
|
||||||
|
// Fall through.
|
||||||
case ON_ACTIVITY_DRAWN:
|
case ON_ACTIVITY_DRAWN:
|
||||||
handleOnActivityDrawn();
|
handleOnActivityDrawn();
|
||||||
break;
|
break;
|
||||||
@@ -1122,7 +1130,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private void handleKeyguardDone(boolean authenticated, boolean wakeup) {
|
private void handleKeyguardDone(boolean authenticated, boolean wakeup) {
|
||||||
if (DEBUG) Log.d(TAG, "handleKeyguardDone");
|
if (DEBUG) Log.d(TAG, "handleKeyguardDone");
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mKeyguardDonePending = false;
|
resetKeyguardDonePendingLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
@@ -1242,7 +1250,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
mStatusBarKeyguardViewManager.show(options);
|
mStatusBarKeyguardViewManager.show(options);
|
||||||
mHiding = false;
|
mHiding = false;
|
||||||
mShowing = true;
|
mShowing = true;
|
||||||
mKeyguardDonePending = false;
|
resetKeyguardDonePendingLocked();
|
||||||
mHideAnimationRun = false;
|
mHideAnimationRun = false;
|
||||||
updateActivityLockScreenState();
|
updateActivityLockScreenState();
|
||||||
adjustStatusBarLocked();
|
adjustStatusBarLocked();
|
||||||
@@ -1321,7 +1329,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
|
|
||||||
mStatusBarKeyguardViewManager.hide(startTime, fadeoutDuration);
|
mStatusBarKeyguardViewManager.hide(startTime, fadeoutDuration);
|
||||||
mShowing = false;
|
mShowing = false;
|
||||||
mKeyguardDonePending = false;
|
resetKeyguardDonePendingLocked();
|
||||||
mHideAnimationRun = false;
|
mHideAnimationRun = false;
|
||||||
updateActivityLockScreenState();
|
updateActivityLockScreenState();
|
||||||
adjustStatusBarLocked();
|
adjustStatusBarLocked();
|
||||||
@@ -1417,6 +1425,11 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
&& mSearchManager.getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null;
|
&& mSearchManager.getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resetKeyguardDonePendingLocked() {
|
||||||
|
mKeyguardDonePending = false;
|
||||||
|
mHandler.removeMessages(KEYGUARD_DONE_PENDING_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
public void onBootCompleted() {
|
public void onBootCompleted() {
|
||||||
mUpdateMonitor.dispatchBootCompleted();
|
mUpdateMonitor.dispatchBootCompleted();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|||||||
@@ -349,7 +349,8 @@ public class WindowAnimator {
|
|||||||
} else {
|
} else {
|
||||||
boolean applyExistingExitAnimation = mPostKeyguardExitAnimation != null
|
boolean applyExistingExitAnimation = mPostKeyguardExitAnimation != null
|
||||||
&& !winAnimator.mKeyguardGoingAwayAnimation
|
&& !winAnimator.mKeyguardGoingAwayAnimation
|
||||||
&& win.hasDrawnLw();
|
&& win.hasDrawnLw()
|
||||||
|
&& win.mAttachedWindow == null;
|
||||||
|
|
||||||
// If the window is already showing and we don't need to apply an existing
|
// If the window is already showing and we don't need to apply an existing
|
||||||
// Keyguard exit animation, skip.
|
// Keyguard exit animation, skip.
|
||||||
@@ -364,7 +365,8 @@ public class WindowAnimator {
|
|||||||
}
|
}
|
||||||
if (DEBUG_KEYGUARD || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
|
if (DEBUG_KEYGUARD || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
|
||||||
"Now policy shown: " + win);
|
"Now policy shown: " + win);
|
||||||
if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0) {
|
if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
|
||||||
|
&& win.mAttachedWindow == null) {
|
||||||
if (unForceHiding == null) {
|
if (unForceHiding == null) {
|
||||||
unForceHiding = new ArrayList<>();
|
unForceHiding = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,13 @@ import android.view.View;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManagerPolicy;
|
import android.view.WindowManagerPolicy;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
import android.view.animation.AlphaAnimation;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.AnimationSet;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.Transformation;
|
import android.view.animation.Transformation;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
import com.android.server.wm.WindowManagerService.H;
|
import com.android.server.wm.WindowManagerService.H;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -98,6 +101,7 @@ class WindowStateAnimator {
|
|||||||
int mAnimLayer;
|
int mAnimLayer;
|
||||||
int mLastLayer;
|
int mLastLayer;
|
||||||
long mAnimationStartTime;
|
long mAnimationStartTime;
|
||||||
|
long mLastAnimationTime;
|
||||||
|
|
||||||
SurfaceControl mSurfaceControl;
|
SurfaceControl mSurfaceControl;
|
||||||
SurfaceControl mPendingDestroySurface;
|
SurfaceControl mPendingDestroySurface;
|
||||||
@@ -312,6 +316,7 @@ class WindowStateAnimator {
|
|||||||
mAnimating = true;
|
mAnimating = true;
|
||||||
}
|
}
|
||||||
if ((mAnimation != null) && mLocalAnimating) {
|
if ((mAnimation != null) && mLocalAnimating) {
|
||||||
|
mLastAnimationTime = currentTime;
|
||||||
if (stepAnimation(currentTime)) {
|
if (stepAnimation(currentTime)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1794,11 +1799,14 @@ class WindowStateAnimator {
|
|||||||
if ((mLocalAnimating && mAnimationIsEntrance == isEntrance)
|
if ((mLocalAnimating && mAnimationIsEntrance == isEntrance)
|
||||||
|| mKeyguardGoingAwayAnimation) {
|
|| mKeyguardGoingAwayAnimation) {
|
||||||
// If we are trying to apply an animation, but already running
|
// If we are trying to apply an animation, but already running
|
||||||
// an animation of the same type, or when we are playing the Keyguard dismissing
|
// an animation of the same type, then just leave that one alone.
|
||||||
// animation, then just leave that one alone.
|
|
||||||
|
|
||||||
// TODO: if mKeyguardGoingAwayAnimation and this is a exiting starting window, modify
|
// If we are in a keyguard exit animation, and the window should animate away, modify
|
||||||
// existing animation to fade it out as well.
|
// keyguard exit animation such that it also fades out.
|
||||||
|
if (mAnimation != null && mKeyguardGoingAwayAnimation
|
||||||
|
&& transit == WindowManagerPolicy.TRANSIT_PREVIEW_DONE) {
|
||||||
|
applyFadeoutDuringKeyguardExitAnimation();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1856,6 +1864,28 @@ class WindowStateAnimator {
|
|||||||
return mAnimation != null;
|
return mAnimation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyFadeoutDuringKeyguardExitAnimation() {
|
||||||
|
long startTime = mAnimation.getStartTime();
|
||||||
|
long duration = mAnimation.getDuration();
|
||||||
|
long elapsed = mLastAnimationTime - startTime;
|
||||||
|
long fadeDuration = duration - elapsed;
|
||||||
|
if (fadeDuration <= 0) {
|
||||||
|
// Never mind, this would be no visible animation, so abort the animation change.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AnimationSet newAnimation = new AnimationSet(false /* shareInterpolator */);
|
||||||
|
newAnimation.setDuration(duration);
|
||||||
|
newAnimation.setStartTime(startTime);
|
||||||
|
newAnimation.addAnimation(mAnimation);
|
||||||
|
Animation fadeOut = AnimationUtils.loadAnimation(
|
||||||
|
mContext, com.android.internal.R.anim.app_starting_exit);
|
||||||
|
fadeOut.setDuration(fadeDuration);
|
||||||
|
fadeOut.setStartOffset(elapsed);
|
||||||
|
newAnimation.addAnimation(fadeOut);
|
||||||
|
newAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), mAnimDw, mAnimDh);
|
||||||
|
mAnimation = newAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
|
public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
|
||||||
if (mAnimating || mLocalAnimating || mAnimationIsEntrance
|
if (mAnimating || mLocalAnimating || mAnimationIsEntrance
|
||||||
|| mAnimation != null) {
|
|| mAnimation != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user