Loading packages/SystemUI/animation/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ android_library { static_libs: [ "PluginCoreLib", "WindowManager-Shell", ], manifest: "AndroidManifest.xml", Loading packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt +11 −15 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.app.ActivityManager import android.app.ActivityTaskManager import android.app.AppGlobals import android.app.PendingIntent import android.app.TaskInfo import android.content.Context import android.graphics.Matrix import android.graphics.PorterDuff Loading @@ -30,8 +31,6 @@ import android.view.animation.AnimationUtils import android.view.animation.PathInterpolator import com.android.internal.annotations.VisibleForTesting import com.android.internal.policy.ScreenDecorationsUtils import com.android.wm.shell.startingsurface.SplashscreenContentDrawer import com.android.wm.shell.startingsurface.StartingSurface import kotlin.math.roundToInt private const val TAG = "ActivityLaunchAnimator" Loading @@ -41,8 +40,7 @@ private const val TAG = "ActivityLaunchAnimator" * nicely into the starting window. */ class ActivityLaunchAnimator( private val keyguardHandler: KeyguardHandler, private val startingSurface: StartingSurface?, private val callback: Callback, context: Context ) { companion object { Loading Loading @@ -120,7 +118,7 @@ class ActivityLaunchAnimator( Log.d(TAG, "Starting intent with a launch animation") val runner = Runner(controller) val isOnKeyguard = keyguardHandler.isOnKeyguard() val isOnKeyguard = callback.isOnKeyguard() // Pass the RemoteAnimationAdapter to the intent starter only if we are not on the keyguard. val animationAdapter = if (!isOnKeyguard) { Loading Loading @@ -163,7 +161,7 @@ class ActivityLaunchAnimator( // Hide the keyguard using the launch animation instead of the default unlock animation. if (isOnKeyguard) { keyguardHandler.hideKeyguardWithAnimation(runner) callback.hideKeyguardWithAnimation(runner) } } } Loading Loading @@ -212,7 +210,7 @@ class ActivityLaunchAnimator( fun startPendingIntent(animationAdapter: RemoteAnimationAdapter?): Int } interface KeyguardHandler { interface Callback { /** Whether we are currently on the keyguard or not. */ fun isOnKeyguard(): Boolean Loading @@ -221,6 +219,9 @@ class ActivityLaunchAnimator( /** Enable/disable window blur so they don't overlap with the window launch animation **/ fun setBlursDisabledForAppLaunch(disabled: Boolean) /* Get the background color of [task]. */ fun getBackgroundColor(task: TaskInfo): Int } /** Loading Loading @@ -484,12 +485,7 @@ class ActivityLaunchAnimator( // which is usually the same color of the app background. We first fade in this layer // to hide the expanding view, then we fade it out with SRC mode to draw a hole in the // launch container and reveal the opening window. val windowBackgroundColor = if (startingSurface != null) { startingSurface.getBackgroundColor(window.taskInfo) } else { Log.w(TAG, "No starting surface, defaulting to SystemBGColor") SplashscreenContentDrawer.getSystemBGColor() } val windowBackgroundColor = callback.getBackgroundColor(window.taskInfo) val windowBackgroundLayer = GradientDrawable().apply { setColor(windowBackgroundColor) alpha = 0 Loading @@ -505,7 +501,7 @@ class ActivityLaunchAnimator( animator.addListener(object : AnimatorListenerAdapter() { override fun onAnimationStart(animation: Animator?, isReverse: Boolean) { Log.d(TAG, "Animation started") keyguardHandler.setBlursDisabledForAppLaunch(true) callback.setBlursDisabledForAppLaunch(true) controller.onLaunchAnimationStart(isExpandingFullyAbove) // Add the drawable to the launch container overlay. Overlays always draw Loading @@ -516,7 +512,7 @@ class ActivityLaunchAnimator( override fun onAnimationEnd(animation: Animator?) { Log.d(TAG, "Animation ended") keyguardHandler.setBlursDisabledForAppLaunch(false) callback.setBlursDisabledForAppLaunch(false) iCallback?.invoke() controller.onLaunchAnimationEnd(isExpandingFullyAbove) launchContainerOverlay.remove(windowBackgroundLayer) Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +14 −4 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.StatusBarManager; import android.app.TaskInfo; import android.app.UiModeManager; import android.app.WallpaperInfo; import android.app.WallpaperManager; Loading Loading @@ -247,6 +248,7 @@ import com.android.systemui.volume.VolumeComponent; import com.android.systemui.wmshell.BubblesManager; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.legacysplitscreen.LegacySplitScreen; import com.android.wm.shell.startingsurface.SplashscreenContentDrawer; import com.android.wm.shell.startingsurface.StartingSurface; import java.io.FileDescriptor; Loading @@ -269,7 +271,7 @@ public class StatusBar extends SystemUI implements DemoMode, ColorExtractor.OnColorsChangedListener, ConfigurationListener, StatusBarStateController.StateListener, LifecycleOwner, BatteryController.BatteryStateChangeCallback, ActivityLaunchAnimator.KeyguardHandler { ActivityLaunchAnimator.Callback { public static final boolean MULTIUSER_DEBUG = false; protected static final int MSG_HIDE_RECENT_APPS = 1020; Loading Loading @@ -1421,9 +1423,7 @@ public class StatusBar extends SystemUI implements DemoMode, private void setUpPresenter() { // Set up the initial notification state. mActivityLaunchAnimator = new ActivityLaunchAnimator(this, mStartingSurfaceOptional.orElse(null), mContext); mActivityLaunchAnimator = new ActivityLaunchAnimator(this, mContext); mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( mNotificationShadeWindowViewController, mStackScrollerController.getNotificationListContainer(), Loading Loading @@ -2123,6 +2123,16 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardViewMediator.setBlursDisabledForAppLaunch(disabled); } @Override public int getBackgroundColor(TaskInfo task) { if (!mStartingSurfaceOptional.isPresent()) { Log.w(TAG, "No starting surface, defaulting to SystemBGColor"); return SplashscreenContentDrawer.getSystemBGColor(); } return mStartingSurfaceOptional.get().getBackgroundColor(task); } public boolean isDeviceInVrMode() { return mPresenter.isDeviceInVrMode(); } Loading packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt +6 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.wm.shell.startingsurface.StartingSurface import junit.framework.Assert.assertFalse import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertNull Loading @@ -47,10 +46,9 @@ import org.mockito.junit.MockitoJUnit @RunWithLooper class ActivityLaunchAnimatorTest : SysuiTestCase() { private val launchContainer = LinearLayout(mContext) @Mock lateinit var keyguardHandler: ActivityLaunchAnimator.KeyguardHandler @Mock lateinit var callback: ActivityLaunchAnimator.Callback @Spy private val controller = TestLaunchAnimatorController(launchContainer) @Mock lateinit var iCallback: IRemoteAnimationFinishedCallback @Mock lateinit var startingSurface: StartingSurface @Mock lateinit var failHandler: Log.TerribleFailureHandler private lateinit var activityLaunchAnimator: ActivityLaunchAnimator Loading @@ -58,7 +56,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { @Before fun setup() { activityLaunchAnimator = ActivityLaunchAnimator(keyguardHandler, startingSurface, mContext) activityLaunchAnimator = ActivityLaunchAnimator(callback, mContext) } private fun startIntentWithAnimation( Loading Loading @@ -121,8 +119,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { @Test fun animatesIfActivityIsAlreadyOpenAndIsOnKeyguard() { `when`(keyguardHandler.isOnKeyguard()).thenReturn(true) val animator = ActivityLaunchAnimator(keyguardHandler, startingSurface, context) `when`(callback.isOnKeyguard()).thenReturn(true) val animator = ActivityLaunchAnimator(callback, context) val willAnimateCaptor = ArgumentCaptor.forClass(Boolean::class.java) var animationAdapter: RemoteAnimationAdapter? = null Loading @@ -134,7 +132,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { waitForIdleSync() verify(controller).onIntentStarted(willAnimateCaptor.capture()) verify(keyguardHandler).hideKeyguardWithAnimation(any()) verify(callback).hideKeyguardWithAnimation(any()) assertTrue(willAnimateCaptor.value) assertNull(animationAdapter) Loading Loading @@ -176,7 +174,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { val runner = activityLaunchAnimator.createRunner(controller) runner.onAnimationStart(0, arrayOf(fakeWindow()), emptyArray(), emptyArray(), iCallback) waitForIdleSync() verify(keyguardHandler).setBlursDisabledForAppLaunch(eq(true)) verify(callback).setBlursDisabledForAppLaunch(eq(true)) verify(controller).onLaunchAnimationStart(anyBoolean()) } Loading Loading
packages/SystemUI/animation/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ android_library { static_libs: [ "PluginCoreLib", "WindowManager-Shell", ], manifest: "AndroidManifest.xml", Loading
packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt +11 −15 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.app.ActivityManager import android.app.ActivityTaskManager import android.app.AppGlobals import android.app.PendingIntent import android.app.TaskInfo import android.content.Context import android.graphics.Matrix import android.graphics.PorterDuff Loading @@ -30,8 +31,6 @@ import android.view.animation.AnimationUtils import android.view.animation.PathInterpolator import com.android.internal.annotations.VisibleForTesting import com.android.internal.policy.ScreenDecorationsUtils import com.android.wm.shell.startingsurface.SplashscreenContentDrawer import com.android.wm.shell.startingsurface.StartingSurface import kotlin.math.roundToInt private const val TAG = "ActivityLaunchAnimator" Loading @@ -41,8 +40,7 @@ private const val TAG = "ActivityLaunchAnimator" * nicely into the starting window. */ class ActivityLaunchAnimator( private val keyguardHandler: KeyguardHandler, private val startingSurface: StartingSurface?, private val callback: Callback, context: Context ) { companion object { Loading Loading @@ -120,7 +118,7 @@ class ActivityLaunchAnimator( Log.d(TAG, "Starting intent with a launch animation") val runner = Runner(controller) val isOnKeyguard = keyguardHandler.isOnKeyguard() val isOnKeyguard = callback.isOnKeyguard() // Pass the RemoteAnimationAdapter to the intent starter only if we are not on the keyguard. val animationAdapter = if (!isOnKeyguard) { Loading Loading @@ -163,7 +161,7 @@ class ActivityLaunchAnimator( // Hide the keyguard using the launch animation instead of the default unlock animation. if (isOnKeyguard) { keyguardHandler.hideKeyguardWithAnimation(runner) callback.hideKeyguardWithAnimation(runner) } } } Loading Loading @@ -212,7 +210,7 @@ class ActivityLaunchAnimator( fun startPendingIntent(animationAdapter: RemoteAnimationAdapter?): Int } interface KeyguardHandler { interface Callback { /** Whether we are currently on the keyguard or not. */ fun isOnKeyguard(): Boolean Loading @@ -221,6 +219,9 @@ class ActivityLaunchAnimator( /** Enable/disable window blur so they don't overlap with the window launch animation **/ fun setBlursDisabledForAppLaunch(disabled: Boolean) /* Get the background color of [task]. */ fun getBackgroundColor(task: TaskInfo): Int } /** Loading Loading @@ -484,12 +485,7 @@ class ActivityLaunchAnimator( // which is usually the same color of the app background. We first fade in this layer // to hide the expanding view, then we fade it out with SRC mode to draw a hole in the // launch container and reveal the opening window. val windowBackgroundColor = if (startingSurface != null) { startingSurface.getBackgroundColor(window.taskInfo) } else { Log.w(TAG, "No starting surface, defaulting to SystemBGColor") SplashscreenContentDrawer.getSystemBGColor() } val windowBackgroundColor = callback.getBackgroundColor(window.taskInfo) val windowBackgroundLayer = GradientDrawable().apply { setColor(windowBackgroundColor) alpha = 0 Loading @@ -505,7 +501,7 @@ class ActivityLaunchAnimator( animator.addListener(object : AnimatorListenerAdapter() { override fun onAnimationStart(animation: Animator?, isReverse: Boolean) { Log.d(TAG, "Animation started") keyguardHandler.setBlursDisabledForAppLaunch(true) callback.setBlursDisabledForAppLaunch(true) controller.onLaunchAnimationStart(isExpandingFullyAbove) // Add the drawable to the launch container overlay. Overlays always draw Loading @@ -516,7 +512,7 @@ class ActivityLaunchAnimator( override fun onAnimationEnd(animation: Animator?) { Log.d(TAG, "Animation ended") keyguardHandler.setBlursDisabledForAppLaunch(false) callback.setBlursDisabledForAppLaunch(false) iCallback?.invoke() controller.onLaunchAnimationEnd(isExpandingFullyAbove) launchContainerOverlay.remove(windowBackgroundLayer) Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +14 −4 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.StatusBarManager; import android.app.TaskInfo; import android.app.UiModeManager; import android.app.WallpaperInfo; import android.app.WallpaperManager; Loading Loading @@ -247,6 +248,7 @@ import com.android.systemui.volume.VolumeComponent; import com.android.systemui.wmshell.BubblesManager; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.legacysplitscreen.LegacySplitScreen; import com.android.wm.shell.startingsurface.SplashscreenContentDrawer; import com.android.wm.shell.startingsurface.StartingSurface; import java.io.FileDescriptor; Loading @@ -269,7 +271,7 @@ public class StatusBar extends SystemUI implements DemoMode, ColorExtractor.OnColorsChangedListener, ConfigurationListener, StatusBarStateController.StateListener, LifecycleOwner, BatteryController.BatteryStateChangeCallback, ActivityLaunchAnimator.KeyguardHandler { ActivityLaunchAnimator.Callback { public static final boolean MULTIUSER_DEBUG = false; protected static final int MSG_HIDE_RECENT_APPS = 1020; Loading Loading @@ -1421,9 +1423,7 @@ public class StatusBar extends SystemUI implements DemoMode, private void setUpPresenter() { // Set up the initial notification state. mActivityLaunchAnimator = new ActivityLaunchAnimator(this, mStartingSurfaceOptional.orElse(null), mContext); mActivityLaunchAnimator = new ActivityLaunchAnimator(this, mContext); mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( mNotificationShadeWindowViewController, mStackScrollerController.getNotificationListContainer(), Loading Loading @@ -2123,6 +2123,16 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardViewMediator.setBlursDisabledForAppLaunch(disabled); } @Override public int getBackgroundColor(TaskInfo task) { if (!mStartingSurfaceOptional.isPresent()) { Log.w(TAG, "No starting surface, defaulting to SystemBGColor"); return SplashscreenContentDrawer.getSystemBGColor(); } return mStartingSurfaceOptional.get().getBackgroundColor(task); } public boolean isDeviceInVrMode() { return mPresenter.isDeviceInVrMode(); } Loading
packages/SystemUI/tests/src/com/android/systemui/animation/ActivityLaunchAnimatorTest.kt +6 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq import com.android.wm.shell.startingsurface.StartingSurface import junit.framework.Assert.assertFalse import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertNull Loading @@ -47,10 +46,9 @@ import org.mockito.junit.MockitoJUnit @RunWithLooper class ActivityLaunchAnimatorTest : SysuiTestCase() { private val launchContainer = LinearLayout(mContext) @Mock lateinit var keyguardHandler: ActivityLaunchAnimator.KeyguardHandler @Mock lateinit var callback: ActivityLaunchAnimator.Callback @Spy private val controller = TestLaunchAnimatorController(launchContainer) @Mock lateinit var iCallback: IRemoteAnimationFinishedCallback @Mock lateinit var startingSurface: StartingSurface @Mock lateinit var failHandler: Log.TerribleFailureHandler private lateinit var activityLaunchAnimator: ActivityLaunchAnimator Loading @@ -58,7 +56,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { @Before fun setup() { activityLaunchAnimator = ActivityLaunchAnimator(keyguardHandler, startingSurface, mContext) activityLaunchAnimator = ActivityLaunchAnimator(callback, mContext) } private fun startIntentWithAnimation( Loading Loading @@ -121,8 +119,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { @Test fun animatesIfActivityIsAlreadyOpenAndIsOnKeyguard() { `when`(keyguardHandler.isOnKeyguard()).thenReturn(true) val animator = ActivityLaunchAnimator(keyguardHandler, startingSurface, context) `when`(callback.isOnKeyguard()).thenReturn(true) val animator = ActivityLaunchAnimator(callback, context) val willAnimateCaptor = ArgumentCaptor.forClass(Boolean::class.java) var animationAdapter: RemoteAnimationAdapter? = null Loading @@ -134,7 +132,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { waitForIdleSync() verify(controller).onIntentStarted(willAnimateCaptor.capture()) verify(keyguardHandler).hideKeyguardWithAnimation(any()) verify(callback).hideKeyguardWithAnimation(any()) assertTrue(willAnimateCaptor.value) assertNull(animationAdapter) Loading Loading @@ -176,7 +174,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { val runner = activityLaunchAnimator.createRunner(controller) runner.onAnimationStart(0, arrayOf(fakeWindow()), emptyArray(), emptyArray(), iCallback) waitForIdleSync() verify(keyguardHandler).setBlursDisabledForAppLaunch(eq(true)) verify(callback).setBlursDisabledForAppLaunch(eq(true)) verify(controller).onLaunchAnimationStart(anyBoolean()) } Loading