diff options
9 files changed, 89 insertions, 25 deletions
diff --git a/core/res/res/anim/keyguard_occlude_open_enter.xml b/core/res/res/anim/keyguard_occlude_open_enter.xml new file mode 100644 index 000000000000..e742616abec4 --- /dev/null +++ b/core/res/res/anim/keyguard_occlude_open_enter.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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 + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false"> + <translate + android:fromYDelta="90%" + android:toYDelta="0%" + android:interpolator="@interpolator/fast_out_slow_in" + android:duration="400"/> + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:interpolator="@interpolator/fast_out_slow_in" + android:duration="300"/> +</set> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 1c66b2b8ca41..184fb828611b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2161,6 +2161,7 @@ <java-symbol type="anim" name="push_down_out" /> <java-symbol type="anim" name="push_up_in" /> <java-symbol type="anim" name="push_up_out" /> + <java-symbol type="anim" name="keyguard_occlude_open_enter" /> <java-symbol type="anim" name="lock_screen_behind_enter" /> <java-symbol type="anim" name="lock_screen_behind_enter_wallpaper" /> <java-symbol type="anim" name="lock_screen_behind_enter_fade_in" /> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index 042e4ff16d3a..b80cd30914a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -103,9 +103,9 @@ public class KeyguardClockPositionAlgorithm { private float mDarkAmount; /** - * If keyguard will require a password or just fade away. + * If keyguard will just fade away or will require a password. */ - private boolean mCurrentlySecure; + private boolean mFadeAway; /** * Dozing and receiving a notification (AOD notification.) @@ -135,7 +135,7 @@ public class KeyguardClockPositionAlgorithm { public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight, float panelExpansion, int parentHeight, - int keyguardStatusHeight, float dark, boolean secure, boolean pulsing, + int keyguardStatusHeight, float dark, boolean fadeAway, boolean pulsing, int bouncerTop) { mMinTopMargin = minTopMargin + mContainerTopPadding; mMaxShadeBottom = maxShadeBottom; @@ -144,7 +144,7 @@ public class KeyguardClockPositionAlgorithm { mHeight = parentHeight; mKeyguardStatusHeight = keyguardStatusHeight; mDarkAmount = dark; - mCurrentlySecure = secure; + mFadeAway = fadeAway; mPulsing = pulsing; mBouncerTop = bouncerTop; } @@ -198,7 +198,7 @@ public class KeyguardClockPositionAlgorithm { float clockYRegular = getExpandedClockPosition(); boolean hasEnoughSpace = mMinTopMargin + mKeyguardStatusHeight < mBouncerTop; - float clockYTarget = mCurrentlySecure && hasEnoughSpace ? + float clockYTarget = !mFadeAway && hasEnoughSpace ? mMinTopMargin : -mKeyguardStatusHeight; // Move clock up while collapsing the shade @@ -218,11 +218,11 @@ public class KeyguardClockPositionAlgorithm { */ private float getClockAlpha(int y) { float alphaKeyguard; - if (mCurrentlySecure) { - alphaKeyguard = 1; - } else { + if (mFadeAway) { alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedClockPosition())); alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard); + } else { + alphaKeyguard = 1; } return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index be8bf02fe2fa..7db580205ab9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -524,7 +524,8 @@ public class NotificationPanelView extends PanelView implements totalHeight, mKeyguardStatusView.getHeight(), mInterpolatedDarkAmount, - mStatusBar.isKeyguardCurrentlySecure(), + !mStatusBar.isKeyguardCurrentlySecure() + || mStatusBar.isKeyguardOccludeAnimationRunning(), mPulsing, mBouncerTop); mClockPositionAlgorithm.run(mClockPositionResult); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index c4008934c49f..e7ef011329be 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -322,6 +322,8 @@ public class StatusBar extends SystemUI implements DemoMode, public static final int FADE_KEYGUARD_START_DELAY = 100; public static final int FADE_KEYGUARD_DURATION = 300; public static final int FADE_KEYGUARD_DURATION_PULSING = 96; + public static final int FADE_BACKDROP_DURATION = 300; + public static final int FADE_BACKDROP_DURATION_FAST = 240; /** If true, the system is in the half-boot-to-decryption-screen state. * Prudently disable QS and notifications. */ @@ -543,6 +545,7 @@ public class StatusBar extends SystemUI implements DemoMode, private boolean mIsOccluded; private boolean mWereIconsJustHidden; private boolean mBouncerWasShowingWhenHidden; + private boolean mKeyguardOccludeAnimationRunning; // Notifies StatusBarKeyguardViewManager every time the keyguard transition is over, // this animation is tied to the scrim for historic reasons. @@ -1641,7 +1644,7 @@ public class StatusBar extends SystemUI implements DemoMode, boolean wakeAndUnlock = mBiometricUnlockController != null && mBiometricUnlockController.isWakeAndUnlock(); - if (mLaunchTransitionFadingAway || wakeAndUnlock) { + if (mLaunchTransitionFadingAway && !mIsOccluded || wakeAndUnlock) { mBackdrop.setVisibility(View.INVISIBLE); Trace.endSection(); return; @@ -1760,7 +1763,8 @@ public class StatusBar extends SystemUI implements DemoMode, boolean cannotAnimateDoze = mDozing && !ScrimState.AOD.getAnimateChange(); if (mBiometricUnlockController.getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING - || hideBecauseOccluded || cannotAnimateDoze) { + || hideBecauseOccluded && !mKeyguardOccludeAnimationRunning + || cannotAnimateDoze) { // We are unlocking directly - no animation! mBackdrop.setVisibility(View.GONE); @@ -1771,7 +1775,9 @@ public class StatusBar extends SystemUI implements DemoMode, mBackdrop.animate() .alpha(SRC_MIN_ALPHA) .setInterpolator(Interpolators.ACCELERATE_DECELERATE) - .setDuration(300) + .setDuration( + mKeyguardOccludeAnimationRunning + ? FADE_BACKDROP_DURATION_FAST : FADE_BACKDROP_DURATION) .setStartDelay(0) .withEndAction(() -> { mBackdrop.setVisibility(View.GONE); @@ -3668,6 +3674,27 @@ public class StatusBar extends SystemUI implements DemoMode, } /** + * Is keyguard being occluded by a newly launched activity. + */ + public boolean isKeyguardOccludeAnimationRunning() { + return mKeyguardOccludeAnimationRunning; + } + + /** + * Plays the animation when new activity is launched over keyguard. + */ + public void animateKeyguardOccluding() { + mKeyguardOccludeAnimationRunning = true; + addPostCollapseAction(() -> { + mStatusBarKeyguardViewManager.reset(true /* hideBouncerWhenShowing */); + mKeyguardOccludeAnimationRunning = false; + }); + mStatusBarKeyguardViewManager.animateCollapsePanels(1.0f /* speedfactor */); + updateScrimController(); + updateMediaMetaData(false /* metaDataChanged */, true /* allowEnterAnimation */); + } + + /** * Plays the animation when an activity that was occluding Keyguard goes away. */ public void animateKeyguardUnoccluding() { @@ -4012,7 +4039,7 @@ public class StatusBar extends SystemUI implements DemoMode, private void showBouncerIfKeyguard() { if ((mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) - && !mKeyguardViewMediator.isHiding()) { + && !mKeyguardViewMediator.isHiding() && !mKeyguardOccludeAnimationRunning) { showBouncer(true /* scrimmed */); } } @@ -4512,6 +4539,11 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onStartedGoingToSleep() { + // in case we start going to sleep while new animation is launching over keyguard, make + // sure to finish it + if (mKeyguardOccludeAnimationRunning) { + runPostCollapseRunnables(); + } notifyHeadsUpGoingToSleep(); dismissVolumeDialog(); } @@ -4753,7 +4785,7 @@ public class StatusBar extends SystemUI implements DemoMode, ? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER; mScrimController.transitionTo(state); } else if (isInLaunchTransition() || mLaunchCameraOnScreenTurningOn - || launchingAffordanceWithPreview) { + || launchingAffordanceWithPreview || mKeyguardOccludeAnimationRunning) { mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback); } else if (mBrightnessMirrorVisible) { mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR); 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 c4424d8e3c97..97088bd0ce84 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -365,6 +365,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } }); return; + } else if (animate) { + mOccluded = true; + mStatusBar.animateKeyguardOccluding(); + mStatusBarWindowManager.setKeyguardOccluded(mOccluded); + return; } } else if (!occluded && mOccluded && mShowing) { StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java index a38328a8161e..f83fb43af8f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java @@ -144,7 +144,8 @@ public class StatusBarWindowManager implements RemoteInputController.Callback, D state.scrimsVisibility == ScrimController.VISIBILITY_FULLY_OPAQUE; final boolean keyguardOrAod = state.keyguardShowing || (state.dozing && mDozeParameters.getAlwaysOn()); - if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) { + if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper + && !state.keyguardOccluded) { mLpChanged.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; } else { mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 8ef1196bf625..fdeb28d757ca 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2779,13 +2779,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { attrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; break; case TYPE_STATUS_BAR: - // If the Keyguard is in a hidden state (occluded by another window), we force to - // remove the wallpaper and keyguard flag so that any change in-flight after setting - // the keyguard as occluded wouldn't set these flags again. + // remove the keyguard flag so that any change in-flight after setting + // the keyguard as occluded wouldn't set the flag again. // See {@link #processKeyguardSetHiddenResultLw}. if (mKeyguardOccluded) { - attrs.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; attrs.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; } break; @@ -5843,17 +5841,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { mKeyguardDelegate.setOccluded(false, true /* animate */); if (mStatusBar != null) { mStatusBar.getAttrs().privateFlags |= PRIVATE_FLAG_KEYGUARD; - if (!mKeyguardDelegate.hasLockscreenWallpaper()) { - mStatusBar.getAttrs().flags |= FLAG_SHOW_WALLPAPER; - } } return true; } else if (isOccluded && changed && showing) { mKeyguardOccluded = true; - mKeyguardDelegate.setOccluded(true, false /* animate */); + mKeyguardDelegate.setOccluded(true, !mShowingDream /* animate */); if (mStatusBar != null) { mStatusBar.getAttrs().privateFlags &= ~PRIVATE_FLAG_KEYGUARD; - mStatusBar.getAttrs().flags &= ~FLAG_SHOW_WALLPAPER; } return true; } else if (changed) { diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index d73606f3003f..7ee35e79e2e4 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -1557,7 +1557,7 @@ public class AppTransition implements Dump { if (isKeyguardGoingAwayTransit(transit) && enter) { a = loadKeyguardExitAnimation(transit); } else if (transit == TRANSIT_KEYGUARD_OCCLUDE) { - a = null; + a = loadAnimationRes(lp, com.android.internal.R.anim.keyguard_occlude_open_enter); } else if (transit == TRANSIT_KEYGUARD_UNOCCLUDE && !enter) { a = loadAnimationRes(lp, com.android.internal.R.anim.wallpaper_open_exit); } else if (transit == TRANSIT_CRASHING_ACTIVITY_CLOSE) { |