diff options
4 files changed, 71 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f3d214f..1cf0129 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1300,6 +1300,8 @@ public class KeyguardViewMediator extends SystemUI { @Override public void run() { try { + mStatusBarKeyguardViewManager.keyguardGoingAway(); + // Don't actually hide the Keyguard at the moment, wait for window // manager until it tells us it's safe to do so with // startKeyguardExitAnimation. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 3740d2a..8aafe52 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3115,6 +3115,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mLaunchTransitionFadingAway = false; } }); + mIconController.appTransitionStarting(SystemClock.uptimeMillis(), + StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION); } }; if (mNotificationPanel.isLaunchTransitionRunning()) { @@ -3182,16 +3184,31 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } /** + * Notifies the status bar that Keyguard is going away very soon. + */ + public void keyguardGoingAway() { + + // Treat Keyguard exit animation as an app transition to achieve nice transition for status + // bar. + mIconController.appTransitionPending(); + } + + /** * Notifies the status bar the Keyguard is fading away with the specified timings. * - * @param delay the animation delay in miliseconds + * @param startTime the start time of the animations in uptime millis + * @param delay the precalculated animation delay in miliseconds * @param fadeoutDuration the duration of the exit animation, in milliseconds */ - public void setKeyguardFadingAway(long delay, long fadeoutDuration) { + public void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration) { mKeyguardFadingAway = true; mKeyguardFadingAwayDelay = delay; mKeyguardFadingAwayDuration = fadeoutDuration; mWaitingForKeyguardExit = false; + mIconController.appTransitionStarting( + startTime + fadeoutDuration + - StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION, + StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION); disable(mDisabledUnmodified, true /* animate */); } @@ -3207,8 +3224,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } private void updatePublicMode() { - setLockscreenPublicMode(mStatusBarKeyguardViewManager.isShowing() - && mStatusBarKeyguardViewManager.isSecure(mCurrentUserId)); + setLockscreenPublicMode( + mStatusBarKeyguardViewManager.isShowing() && mStatusBarKeyguardViewManager + .isSecure(mCurrentUserId)); } private void updateKeyguardState(boolean goingToFullShade, boolean fromShadeLocked) { @@ -3637,7 +3655,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void appTransitionPending() { - mIconController.appTransitionPending(); + + // Use own timings when Keyguard is going away, see keyguardGoingAway and + // setKeyguardFadingAway + if (!mKeyguardFadingAway) { + mIconController.appTransitionPending(); + } } @Override @@ -3647,7 +3670,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void appTransitionStarting(long startTime, long duration) { - mIconController.appTransitionStarting(startTime, duration); + + // Use own timings when Keyguard is going away, see keyguardGoingAway and + // setKeyguardFadingAway + if (!mKeyguardFadingAway) { + mIconController.appTransitionStarting(startTime, duration); + } } private final class ShadeUpdates { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java index 8662b04..3bdf94a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java @@ -22,7 +22,9 @@ import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.PorterDuff; import android.os.Bundle; +import android.os.Handler; import android.os.SystemClock; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; @@ -50,7 +52,7 @@ import java.util.ArrayList; */ public class StatusBarIconController { - private static final long DEFAULT_TINT_ANIMATION_DURATION = 120; + public static final long DEFAULT_TINT_ANIMATION_DURATION = 120; private Context mContext; private PhoneStatusBar mPhoneStatusBar; @@ -79,6 +81,18 @@ public class StatusBarIconController { private int mPendingIconTint; private ValueAnimator mTintAnimator; + private final Handler mHandler; + private boolean mTransitionDeferring; + private long mTransitionDeferringStartTime; + private long mTransitionDeferringDuration; + + private final Runnable mTransitionDeferringDoneRunnable = new Runnable() { + @Override + public void run() { + mTransitionDeferring = false; + } + }; + public StatusBarIconController(Context context, View statusBar, View keyguardStatusBar, PhoneStatusBar phoneStatusBar) { mContext = context; @@ -98,6 +112,7 @@ public class StatusBarIconController { android.R.interpolator.linear_out_slow_in); mFastOutSlowIn = AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_slow_in); + mHandler = new Handler(); updateResources(); } @@ -282,6 +297,10 @@ public class StatusBarIconController { public void setIconTint(int tint) { if (mTransitionPending) { deferIconTintChange(tint); + } else if (mTransitionDeferring) { + animateIconTint(tint, + Math.max(0, mTransitionDeferringStartTime - SystemClock.uptimeMillis()), + mTransitionDeferringDuration); } else { animateIconTint(tint, 0 /* delay */, DEFAULT_TINT_ANIMATION_DURATION); } @@ -371,6 +390,16 @@ public class StatusBarIconController { animateIconTint(mPendingIconTint, Math.max(0, startTime - SystemClock.uptimeMillis()), duration); + + } else if (mTransitionPending) { + + // If we don't have a pending tint change yet, the change might come in the future until + // startTime is reached. + mTransitionDeferring = true; + mTransitionDeferringStartTime = startTime; + mTransitionDeferringDuration = duration; + mHandler.removeCallbacks(mTransitionDeferringDoneRunnable); + mHandler.postAtTime(mTransitionDeferringDoneRunnable, startTime); } mTransitionPending = false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 19305f3..2f3a159 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -257,7 +257,7 @@ public class StatusBarKeyguardViewManager { } }); } else { - mPhoneStatusBar.setKeyguardFadingAway(delay, fadeoutDuration); + mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration); boolean staying = mPhoneStatusBar.hideKeyguard(); if (!staying) { mStatusBarWindowManager.setKeyguardFadingAway(true); @@ -435,4 +435,8 @@ public class StatusBarKeyguardViewManager { public boolean isInputRestricted() { return mViewMediatorCallback.isInputRestricted(); } + + public void keyguardGoingAway() { + mPhoneStatusBar.keyguardGoingAway(); + } } |