diff options
13 files changed, 84 insertions, 12 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 1f89de861111..2e5a7501f898 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -319,6 +319,12 @@ public interface WindowManager extends ViewManager { int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER = 0x4; /** + * Transition flag: Keyguard is going away with subtle animation. + * @hide + */ + int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8; + + /** * @hide */ @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = { diff --git a/core/java/android/view/WindowManagerPolicyConstants.java b/core/java/android/view/WindowManagerPolicyConstants.java index 46a59f09eca7..a22f5a576ab6 100644 --- a/core/java/android/view/WindowManagerPolicyConstants.java +++ b/core/java/android/view/WindowManagerPolicyConstants.java @@ -38,10 +38,11 @@ public interface WindowManagerPolicyConstants { int FLAG_INTERACTIVE = 0x20000000; int FLAG_PASS_TO_USER = 0x40000000; - // Flags for IActivityManager.keyguardGoingAway() + // Flags for IActivityTaskManager.keyguardGoingAway() int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0; int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1; int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2; + int KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS = 1 << 3; // Flags used for indicating whether the internal and/or external input devices // of some type are available. diff --git a/core/res/res/anim/lock_screen_behind_enter_subtle.xml b/core/res/res/anim/lock_screen_behind_enter_subtle.xml new file mode 100644 index 000000000000..23b26b791a57 --- /dev/null +++ b/core/res/res/anim/lock_screen_behind_enter_subtle.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2019 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:detachWallpaper="true" + android:shareInterpolator="false"> + + <alpha + android:fromAlpha="0.0" android:toAlpha="1.0" + android:fillEnabled="true" android:fillBefore="true" + android:interpolator="@interpolator/linear" + android:duration="233"/> + <translate android:fromYDelta="5%p" android:toYDelta="0" + android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" + android:interpolator="@interpolator/fast_out_slow_in" + android:duration="233" /> +</set>
\ No newline at end of file diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index fb38aa9ac15a..219865f171e1 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2274,6 +2274,7 @@ <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" /> + <java-symbol type="anim" name="lock_screen_behind_enter_subtle" /> <java-symbol type="anim" name="lock_screen_wallpaper_exit" /> <java-symbol type="anim" name="launch_task_behind_source" /> <java-symbol type="anim" name="wallpaper_open_exit" /> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index cc30fc8b10dd..d7ca4d006082 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1800,6 +1800,10 @@ public class KeyguardViewMediator extends SystemUI { if (mStatusBarKeyguardViewManager.isUnlockWithWallpaper()) { flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; } + if (mStatusBarKeyguardViewManager.shouldSubtleWindowAnimationsForUnlock()) { + flags |= WindowManagerPolicyConstants + .KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS; + } mUpdateMonitor.setKeyguardGoingAway(true /* goingAway */); 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 834d1fc24f90..6dc2c8cab055 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -808,6 +808,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb return mStatusBar.isInLaunchTransition(); } + + /** + * @return Whether subtle animation should be used for unlocking the device. + */ + public boolean shouldSubtleWindowAnimationsForUnlock() { + return mStatusBar.mKeyguardBypassController.getBypassEnabled() + && mStatusBar.mState == StatusBarState.KEYGUARD; + } + public boolean isGoingToNotificationShade() { return ((SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class)) .leaveOpenOnKeyguardHide(); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index da87b2f1994b..2052b1570f34 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2517,14 +2517,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public Animation createHiddenByKeyguardExit(boolean onWallpaper, - boolean goingToNotificationShade) { + boolean goingToNotificationShade, boolean subtleAnimation) { if (goingToNotificationShade) { return AnimationUtils.loadAnimation(mContext, R.anim.lock_screen_behind_enter_fade_in); } - AnimationSet set = (AnimationSet) AnimationUtils.loadAnimation(mContext, onWallpaper ? - R.anim.lock_screen_behind_enter_wallpaper : - R.anim.lock_screen_behind_enter); + final int resource; + if (onWallpaper) { + resource = R.anim.lock_screen_behind_enter_wallpaper; + } else if (subtleAnimation) { + resource = R.anim.lock_screen_behind_enter_subtle; + } else { + resource = R.anim.lock_screen_behind_enter; + } + + AnimationSet set = (AnimationSet) AnimationUtils.loadAnimation(mContext, resource); // TODO: Use XML interpolators when we have log interpolators available in XML. final List<Animation> animations = set.getAnimations(); diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index b196754796e9..6d9c71096cb0 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -980,7 +980,7 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { * Create and return an animation to re-display a window that was force hidden by Keyguard. */ public Animation createHiddenByKeyguardExit(boolean onWallpaper, - boolean goingToNotificationShade); + boolean goingToNotificationShade, boolean subtleAnimation); /** * Create and return an animation to let the wallpaper disappear after being shown behind diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index b6af939d7390..557a609dbc7b 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -23,6 +23,7 @@ import static android.view.WindowManager.TRANSIT_ACTIVITY_RELAUNCH; import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; @@ -1802,8 +1803,10 @@ public class AppTransition implements Dump { } final boolean toShade = (mNextAppTransitionFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0; + final boolean subtle = + (mNextAppTransitionFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0; return mService.mPolicy.createHiddenByKeyguardExit( - transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, toShade); + transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, toShade, subtle); } int getAppStackClipMode() { diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 6c5ef5259285..d4e95cfb8025 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -23,6 +23,7 @@ import static android.view.WindowManager.TRANSIT_ACTIVITY_RELAUNCH; import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; @@ -425,7 +426,8 @@ public class AppTransitionController { private void handleNonAppWindowsInTransition(int transit, int flags) { if (transit == TRANSIT_KEYGUARD_GOING_AWAY) { if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 - && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) { + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 + && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) { Animation anim = mService.mPolicy.createKeyguardWallpaperExit( (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); if (anim != null) { @@ -437,7 +439,8 @@ public class AppTransitionController { || transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { mDisplayContent.startKeyguardExitOnNonAppWindows( transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, - (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0, + (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0); } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 1332e6dfd4b2..5c83b020b5d6 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -3471,12 +3471,14 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo /** * Starts the Keyguard exit animation on all windows that don't belong to an app token. */ - void startKeyguardExitOnNonAppWindows(boolean onWallpaper, boolean goingToShade) { + void startKeyguardExitOnNonAppWindows(boolean onWallpaper, boolean goingToShade, + boolean subtle) { final WindowManagerPolicy policy = mWmService.mPolicy; forAllWindows(w -> { if (w.mAppToken == null && policy.canBeHiddenByKeyguardLw(w) && w.wouldBeVisibleIfPolicyIgnored() && !w.isVisible()) { - w.startAnimation(policy.createHiddenByKeyguardExit(onWallpaper, goingToShade)); + w.startAnimation(policy.createHiddenByKeyguardExit( + onWallpaper, goingToShade, subtle)); } }, true /* traverseTopToBottom */); } diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java index 169f03b0023d..ca4749f7b365 100644 --- a/services/core/java/com/android/server/wm/KeyguardController.java +++ b/services/core/java/com/android/server/wm/KeyguardController.java @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; @@ -26,6 +27,7 @@ import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_UNSET; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS; +import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; @@ -238,6 +240,9 @@ class KeyguardController { if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER) != 0) { result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; } + if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS) != 0) { + result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; + } return result; } diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java index c3561f4bf6ab..1c9e50425841 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java @@ -141,7 +141,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy { @Override public Animation createHiddenByKeyguardExit(boolean onWallpaper, - boolean goingToNotificationShade) { + boolean goingToNotificationShade, boolean subtleAnimation) { return null; } |