Loading packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt +31 −17 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.app.ActivityManager import android.app.ActivityTaskManager import android.app.AppGlobals import android.app.PendingIntent import android.app.TaskInfo import android.content.Context Loading Loading @@ -44,6 +43,7 @@ class ActivityLaunchAnimator( context: Context ) { companion object { private const val DEBUG = false const val ANIMATION_DURATION = 500L private const val ANIMATION_DURATION_FADE_OUT_CONTENT = 150L private const val ANIMATION_DURATION_FADE_IN_WINDOW = 183L Loading Loading @@ -75,8 +75,6 @@ class ActivityLaunchAnimator( } } private val packageManager = AppGlobals.getPackageManager() /** The interpolator used for the width, height, Y position and corner radius. */ private val animationInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.launch_animation_interpolator_y) Loading @@ -100,6 +98,10 @@ class ActivityLaunchAnimator( * If possible, you should pass the [packageName] of the intent that will be started so that * trampoline activity launches will also be animated. * * If the device is currently locked, the user will have to unlock it before the intent is * started unless [showOverLockscreen] is true. In that case, the activity will be started * directly over the lockscreen. * * This method will throw any exception thrown by [intentStarter]. */ @JvmOverloads Loading @@ -107,21 +109,22 @@ class ActivityLaunchAnimator( controller: Controller?, animate: Boolean = true, packageName: String? = null, showOverLockscreen: Boolean = false, intentStarter: (RemoteAnimationAdapter?) -> Int ) { if (controller == null || !animate) { Log.d(TAG, "Starting intent with no animation") Log.i(TAG, "Starting intent with no animation") intentStarter(null) controller?.callOnIntentStartedOnMainThread(willAnimate = false) return } Log.d(TAG, "Starting intent with a launch animation") val runner = Runner(controller) val isOnKeyguard = callback.isOnKeyguard() val hideKeyguardWithAnimation = callback.isOnKeyguard() && !showOverLockscreen // Pass the RemoteAnimationAdapter to the intent starter only if we are not on the keyguard. val animationAdapter = if (!isOnKeyguard) { // Pass the RemoteAnimationAdapter to the intent starter only if we are not hiding the // keyguard with the animation val animationAdapter = if (!hideKeyguardWithAnimation) { RemoteAnimationAdapter( runner, ANIMATION_DURATION, Loading Loading @@ -149,9 +152,11 @@ class ActivityLaunchAnimator( val willAnimate = launchResult == ActivityManager.START_TASK_TO_FRONT || launchResult == ActivityManager.START_SUCCESS || (launchResult == ActivityManager.START_DELIVERED_TO_TOP && isOnKeyguard) (launchResult == ActivityManager.START_DELIVERED_TO_TOP && hideKeyguardWithAnimation) Log.d(TAG, "launchResult=$launchResult willAnimate=$willAnimate isOnKeyguard=$isOnKeyguard") Log.i(TAG, "launchResult=$launchResult willAnimate=$willAnimate " + "hideKeyguardWithAnimation=$hideKeyguardWithAnimation") controller.callOnIntentStartedOnMainThread(willAnimate) // If we expect an animation, post a timeout to cancel it in case the remote animation is Loading @@ -160,7 +165,7 @@ class ActivityLaunchAnimator( runner.postTimeout() // Hide the keyguard using the launch animation instead of the default unlock animation. if (isOnKeyguard) { if (hideKeyguardWithAnimation) { callback.hideKeyguardWithAnimation(runner) } } Loading Loading @@ -424,13 +429,16 @@ class ActivityLaunchAnimator( nonApps: Array<out RemoteAnimationTarget>?, iCallback: IRemoteAnimationFinishedCallback? ) { if (DEBUG) { Log.d(TAG, "Remote animation started") } val window = apps?.firstOrNull { it.mode == RemoteAnimationTarget.MODE_OPENING } if (window == null) { Log.d(TAG, "Aborting the animation as no window is opening") Log.i(TAG, "Aborting the animation as no window is opening") removeTimeout() iCallback?.invoke() controller.onLaunchAnimationCancelled() Loading Loading @@ -500,7 +508,10 @@ class ActivityLaunchAnimator( val launchContainerOverlay = launchContainer.overlay animator.addListener(object : AnimatorListenerAdapter() { override fun onAnimationStart(animation: Animator?, isReverse: Boolean) { if (DEBUG) { Log.d(TAG, "Animation started") } callback.setBlursDisabledForAppLaunch(true) controller.onLaunchAnimationStart(isExpandingFullyAbove) Loading @@ -511,7 +522,10 @@ class ActivityLaunchAnimator( } override fun onAnimationEnd(animation: Animator?) { if (DEBUG) { Log.d(TAG, "Animation ended") } callback.setBlursDisabledForAppLaunch(false) iCallback?.invoke() controller.onLaunchAnimationEnd(isExpandingFullyAbove) Loading Loading @@ -686,7 +700,7 @@ class ActivityLaunchAnimator( return } Log.d(TAG, "Remote animation timed out") Log.i(TAG, "Remote animation timed out") timedOut = true controller.onLaunchAnimationCancelled() } Loading @@ -696,7 +710,7 @@ class ActivityLaunchAnimator( return } Log.d(TAG, "Remote animation was cancelled") Log.i(TAG, "Remote animation was cancelled") cancelled = true removeTimeout() context.mainExecutor.execute { Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java +9 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,16 @@ public interface ActivityStarter { */ void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade, int flags); void startActivity(Intent intent, boolean dismissShade); default void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController) { startActivity(intent, dismissShade, animationController, false /* showOverLockscreenWhenLocked */); } void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController); @Nullable ActivityLaunchAnimator.Controller animationController, boolean showOverLockscreenWhenLocked); void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade); void startActivity(Intent intent, boolean dismissShade, Callback callback); void postStartActivityDismissingKeyguard(Intent intent, int delay); Loading packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml +2 −1 Original line number Diff line number Diff line Loading @@ -22,11 +22,12 @@ android:color="?android:attr/textColorPrimary"> <item> <shape android:shape="oval"> android:shape="rectangle"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> <corners android:radius="@dimen/keyguard_affordance_fixed_radius"/> </shape> </item> </ripple> Loading packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,7 @@ <dimen name="keyguard_affordance_fixed_height">48dp</dimen> <dimen name="keyguard_affordance_fixed_width">48dp</dimen> <dimen name="keyguard_affordance_fixed_radius">24dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> Loading packages/SystemUI/src/com/android/systemui/ActivityStarterDelegate.java +4 −2 Original line number Diff line number Diff line Loading @@ -92,9 +92,11 @@ public class ActivityStarterDelegate implements ActivityStarter { @Override public void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController) { @Nullable ActivityLaunchAnimator.Controller animationController, boolean showOverLockscreenWhenLocked) { mActualStarterOptionalLazy.get().ifPresent( starter -> starter.startActivity(intent, dismissShade, animationController)); starter -> starter.startActivity(intent, dismissShade, animationController, showOverLockscreenWhenLocked)); } @Override Loading Loading
packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt +31 −17 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.app.ActivityManager import android.app.ActivityTaskManager import android.app.AppGlobals import android.app.PendingIntent import android.app.TaskInfo import android.content.Context Loading Loading @@ -44,6 +43,7 @@ class ActivityLaunchAnimator( context: Context ) { companion object { private const val DEBUG = false const val ANIMATION_DURATION = 500L private const val ANIMATION_DURATION_FADE_OUT_CONTENT = 150L private const val ANIMATION_DURATION_FADE_IN_WINDOW = 183L Loading Loading @@ -75,8 +75,6 @@ class ActivityLaunchAnimator( } } private val packageManager = AppGlobals.getPackageManager() /** The interpolator used for the width, height, Y position and corner radius. */ private val animationInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.launch_animation_interpolator_y) Loading @@ -100,6 +98,10 @@ class ActivityLaunchAnimator( * If possible, you should pass the [packageName] of the intent that will be started so that * trampoline activity launches will also be animated. * * If the device is currently locked, the user will have to unlock it before the intent is * started unless [showOverLockscreen] is true. In that case, the activity will be started * directly over the lockscreen. * * This method will throw any exception thrown by [intentStarter]. */ @JvmOverloads Loading @@ -107,21 +109,22 @@ class ActivityLaunchAnimator( controller: Controller?, animate: Boolean = true, packageName: String? = null, showOverLockscreen: Boolean = false, intentStarter: (RemoteAnimationAdapter?) -> Int ) { if (controller == null || !animate) { Log.d(TAG, "Starting intent with no animation") Log.i(TAG, "Starting intent with no animation") intentStarter(null) controller?.callOnIntentStartedOnMainThread(willAnimate = false) return } Log.d(TAG, "Starting intent with a launch animation") val runner = Runner(controller) val isOnKeyguard = callback.isOnKeyguard() val hideKeyguardWithAnimation = callback.isOnKeyguard() && !showOverLockscreen // Pass the RemoteAnimationAdapter to the intent starter only if we are not on the keyguard. val animationAdapter = if (!isOnKeyguard) { // Pass the RemoteAnimationAdapter to the intent starter only if we are not hiding the // keyguard with the animation val animationAdapter = if (!hideKeyguardWithAnimation) { RemoteAnimationAdapter( runner, ANIMATION_DURATION, Loading Loading @@ -149,9 +152,11 @@ class ActivityLaunchAnimator( val willAnimate = launchResult == ActivityManager.START_TASK_TO_FRONT || launchResult == ActivityManager.START_SUCCESS || (launchResult == ActivityManager.START_DELIVERED_TO_TOP && isOnKeyguard) (launchResult == ActivityManager.START_DELIVERED_TO_TOP && hideKeyguardWithAnimation) Log.d(TAG, "launchResult=$launchResult willAnimate=$willAnimate isOnKeyguard=$isOnKeyguard") Log.i(TAG, "launchResult=$launchResult willAnimate=$willAnimate " + "hideKeyguardWithAnimation=$hideKeyguardWithAnimation") controller.callOnIntentStartedOnMainThread(willAnimate) // If we expect an animation, post a timeout to cancel it in case the remote animation is Loading @@ -160,7 +165,7 @@ class ActivityLaunchAnimator( runner.postTimeout() // Hide the keyguard using the launch animation instead of the default unlock animation. if (isOnKeyguard) { if (hideKeyguardWithAnimation) { callback.hideKeyguardWithAnimation(runner) } } Loading Loading @@ -424,13 +429,16 @@ class ActivityLaunchAnimator( nonApps: Array<out RemoteAnimationTarget>?, iCallback: IRemoteAnimationFinishedCallback? ) { if (DEBUG) { Log.d(TAG, "Remote animation started") } val window = apps?.firstOrNull { it.mode == RemoteAnimationTarget.MODE_OPENING } if (window == null) { Log.d(TAG, "Aborting the animation as no window is opening") Log.i(TAG, "Aborting the animation as no window is opening") removeTimeout() iCallback?.invoke() controller.onLaunchAnimationCancelled() Loading Loading @@ -500,7 +508,10 @@ class ActivityLaunchAnimator( val launchContainerOverlay = launchContainer.overlay animator.addListener(object : AnimatorListenerAdapter() { override fun onAnimationStart(animation: Animator?, isReverse: Boolean) { if (DEBUG) { Log.d(TAG, "Animation started") } callback.setBlursDisabledForAppLaunch(true) controller.onLaunchAnimationStart(isExpandingFullyAbove) Loading @@ -511,7 +522,10 @@ class ActivityLaunchAnimator( } override fun onAnimationEnd(animation: Animator?) { if (DEBUG) { Log.d(TAG, "Animation ended") } callback.setBlursDisabledForAppLaunch(false) iCallback?.invoke() controller.onLaunchAnimationEnd(isExpandingFullyAbove) Loading Loading @@ -686,7 +700,7 @@ class ActivityLaunchAnimator( return } Log.d(TAG, "Remote animation timed out") Log.i(TAG, "Remote animation timed out") timedOut = true controller.onLaunchAnimationCancelled() } Loading @@ -696,7 +710,7 @@ class ActivityLaunchAnimator( return } Log.d(TAG, "Remote animation was cancelled") Log.i(TAG, "Remote animation was cancelled") cancelled = true removeTimeout() context.mainExecutor.execute { Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java +9 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,16 @@ public interface ActivityStarter { */ void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade, int flags); void startActivity(Intent intent, boolean dismissShade); default void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController) { startActivity(intent, dismissShade, animationController, false /* showOverLockscreenWhenLocked */); } void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController); @Nullable ActivityLaunchAnimator.Controller animationController, boolean showOverLockscreenWhenLocked); void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade); void startActivity(Intent intent, boolean dismissShade, Callback callback); void postStartActivityDismissingKeyguard(Intent intent, int delay); Loading
packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml +2 −1 Original line number Diff line number Diff line Loading @@ -22,11 +22,12 @@ android:color="?android:attr/textColorPrimary"> <item> <shape android:shape="oval"> android:shape="rectangle"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> <corners android:radius="@dimen/keyguard_affordance_fixed_radius"/> </shape> </item> </ripple> Loading
packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,7 @@ <dimen name="keyguard_affordance_fixed_height">48dp</dimen> <dimen name="keyguard_affordance_fixed_width">48dp</dimen> <dimen name="keyguard_affordance_fixed_radius">24dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/ActivityStarterDelegate.java +4 −2 Original line number Diff line number Diff line Loading @@ -92,9 +92,11 @@ public class ActivityStarterDelegate implements ActivityStarter { @Override public void startActivity(Intent intent, boolean dismissShade, @Nullable ActivityLaunchAnimator.Controller animationController) { @Nullable ActivityLaunchAnimator.Controller animationController, boolean showOverLockscreenWhenLocked) { mActualStarterOptionalLazy.get().ifPresent( starter -> starter.startActivity(intent, dismissShade, animationController)); starter -> starter.startActivity(intent, dismissShade, animationController, showOverLockscreenWhenLocked)); } @Override Loading