Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt +8 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ import kotlin.math.max class NotificationLaunchAnimatorControllerProvider( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone private val headsUpManager: HeadsUpManagerPhone, private val jankMonitor: InteractionJankMonitor ) { fun getAnimatorController( notification: ExpandableNotificationRow Loading @@ -25,7 +26,8 @@ class NotificationLaunchAnimatorControllerProvider( notificationShadeWindowViewController, notificationListContainer, headsUpManager, notification notification, jankMonitor ) } } Loading @@ -39,7 +41,8 @@ class NotificationLaunchAnimatorController( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val notification: ExpandableNotificationRow private val notification: ExpandableNotificationRow, private val jankMonitor: InteractionJankMonitor ) : ActivityLaunchAnimator.Controller { companion object { Loading Loading @@ -137,12 +140,12 @@ class NotificationLaunchAnimatorController( notification.isExpandAnimationRunning = true notificationListContainer.setExpandingNotification(notification) InteractionJankMonitor.getInstance().begin(notification, jankMonitor.begin(notification, InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) } override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) { InteractionJankMonitor.getInstance().end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) notification.isExpandAnimationRunning = false notificationShadeWindowViewController.setExpandAnimationRunning(false) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +14 −10 Original line number Diff line number Diff line Loading @@ -183,6 +183,7 @@ public class NotificationStackScrollLayoutController { private final NotificationGroupManagerLegacy mLegacyGroupManager; private final SectionHeaderController mSilentHeaderController; private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; private final InteractionJankMonitor mJankMonitor; private NotificationStackScrollLayout mView; private boolean mFadeNotificationsOnDismiss; Loading Loading @@ -661,7 +662,8 @@ public class NotificationStackScrollLayoutController { LayoutInflater layoutInflater, NotificationRemoteInputManager remoteInputManager, VisualStabilityManager visualStabilityManager, ShadeController shadeController) { ShadeController shadeController, InteractionJankMonitor jankMonitor) { mAllowLongPress = allowLongPress; mNotificationGutsManager = notificationGutsManager; mVisibilityProvider = visibilityProvider; Loading @@ -684,6 +686,7 @@ public class NotificationStackScrollLayoutController { mNotificationSwipeHelperBuilder = notificationSwipeHelperBuilder; mStatusBar = statusBar; mScrimController = scrimController; mJankMonitor = jankMonitor; groupManager.registerGroupExpansionChangeListener( (changedRow, expanded) -> mView.onGroupExpandChanged(changedRow, expanded)); legacyGroupManager.registerGroupChangeListener(new OnGroupChangeListener() { Loading Loading @@ -1784,9 +1787,9 @@ public class NotificationStackScrollLayoutController { // We log any touches other than down, which will be captured by onTouchEvent. // In the intercept we only start tracing when it's not a down (otherwise that down // would be duplicated when intercepted). if (scrollWantsIt && ev.getActionMasked() != MotionEvent.ACTION_DOWN) { InteractionJankMonitor.getInstance().begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); if (mJankMonitor != null && scrollWantsIt && ev.getActionMasked() != MotionEvent.ACTION_DOWN) { mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } return swipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt; } Loading Loading @@ -1854,24 +1857,25 @@ public class NotificationStackScrollLayoutController { } private void traceJankOnTouchEvent(int action, boolean scrollerWantsIt) { if (mJankMonitor == null) { Log.w(TAG, "traceJankOnTouchEvent, mJankMonitor is null"); return; } // Handle interaction jank monitor cases. switch (action) { case MotionEvent.ACTION_DOWN: if (scrollerWantsIt) { InteractionJankMonitor.getInstance() .begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; case MotionEvent.ACTION_UP: if (scrollerWantsIt && !mView.isFlingAfterUpEvent()) { InteractionJankMonitor.getInstance() .end(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.end(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; case MotionEvent.ACTION_CANCEL: if (scrollerWantsIt) { InteractionJankMonitor.getInstance() .cancel(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.cancel(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +8 −2 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ import androidx.lifecycle.LifecycleRegistry; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; Loading Loading @@ -677,6 +678,8 @@ public class StatusBar extends CoreStartable implements private final ColorExtractor.OnColorsChangedListener mOnColorsChangedListener = (extractor, which) -> updateTheme(); private final InteractionJankMonitor mJankMonitor; /** * Public constructor for StatusBar. Loading Loading @@ -779,7 +782,8 @@ public class StatusBar extends CoreStartable implements WallpaperManager wallpaperManager, Optional<StartingSurface> startingSurfaceOptional, ActivityLaunchAnimator activityLaunchAnimator, NotifPipelineFlags notifPipelineFlags) { NotifPipelineFlags notifPipelineFlags, InteractionJankMonitor jankMonitor) { super(context); mNotificationsController = notificationsController; mFragmentService = fragmentService; Loading Loading @@ -867,6 +871,7 @@ public class StatusBar extends CoreStartable implements mMainExecutor = delayableExecutor; mMessageRouter = messageRouter; mWallpaperManager = wallpaperManager; mJankMonitor = jankMonitor; mLockscreenShadeTransitionController = lockscreenShadeTransitionController; mStartingSurfaceOptional = startingSurfaceOptional; Loading Loading @@ -1387,7 +1392,8 @@ public class StatusBar extends CoreStartable implements mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( mNotificationShadeWindowViewController, mStackScrollerController.getNotificationListContainer(), mHeadsUpManager mHeadsUpManager, mJankMonitor ); // TODO: inject this. Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.os.Handler; import android.os.PowerManager; import android.util.DisplayMetrics; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.logging.MetricsLogger; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; Loading Loading @@ -227,7 +228,8 @@ public interface StatusBarPhoneModule { WallpaperManager wallpaperManager, Optional<StartingSurface> startingSurfaceOptional, ActivityLaunchAnimator activityLaunchAnimator, NotifPipelineFlags notifPipelineFlags) { NotifPipelineFlags notifPipelineFlags, InteractionJankMonitor jankMonitor) { return new StatusBar( context, notificationsController, Loading Loading @@ -321,7 +323,8 @@ public interface StatusBarPhoneModule { wallpaperManager, startingSurfaceOptional, activityLaunchAnimator, notifPipelineFlags notifPipelineFlags, jankMonitor ); } } packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.SysuiTestCase import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationTestHelper Loading @@ -29,6 +30,7 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { @Mock lateinit var notificationShadeWindowViewController: NotificationShadeWindowViewController @Mock lateinit var notificationListContainer: NotificationListContainer @Mock lateinit var headsUpManager: HeadsUpManagerPhone @Mock lateinit var jankMonitor: InteractionJankMonitor private lateinit var notificationTestHelper: NotificationTestHelper private lateinit var notification: ExpandableNotificationRow Loading @@ -49,7 +51,8 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { notificationShadeWindowViewController, notificationListContainer, headsUpManager, notification notification, jankMonitor ) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt +8 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ import kotlin.math.max class NotificationLaunchAnimatorControllerProvider( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone private val headsUpManager: HeadsUpManagerPhone, private val jankMonitor: InteractionJankMonitor ) { fun getAnimatorController( notification: ExpandableNotificationRow Loading @@ -25,7 +26,8 @@ class NotificationLaunchAnimatorControllerProvider( notificationShadeWindowViewController, notificationListContainer, headsUpManager, notification notification, jankMonitor ) } } Loading @@ -39,7 +41,8 @@ class NotificationLaunchAnimatorController( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val notification: ExpandableNotificationRow private val notification: ExpandableNotificationRow, private val jankMonitor: InteractionJankMonitor ) : ActivityLaunchAnimator.Controller { companion object { Loading Loading @@ -137,12 +140,12 @@ class NotificationLaunchAnimatorController( notification.isExpandAnimationRunning = true notificationListContainer.setExpandingNotification(notification) InteractionJankMonitor.getInstance().begin(notification, jankMonitor.begin(notification, InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) } override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) { InteractionJankMonitor.getInstance().end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) notification.isExpandAnimationRunning = false notificationShadeWindowViewController.setExpandAnimationRunning(false) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +14 −10 Original line number Diff line number Diff line Loading @@ -183,6 +183,7 @@ public class NotificationStackScrollLayoutController { private final NotificationGroupManagerLegacy mLegacyGroupManager; private final SectionHeaderController mSilentHeaderController; private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; private final InteractionJankMonitor mJankMonitor; private NotificationStackScrollLayout mView; private boolean mFadeNotificationsOnDismiss; Loading Loading @@ -661,7 +662,8 @@ public class NotificationStackScrollLayoutController { LayoutInflater layoutInflater, NotificationRemoteInputManager remoteInputManager, VisualStabilityManager visualStabilityManager, ShadeController shadeController) { ShadeController shadeController, InteractionJankMonitor jankMonitor) { mAllowLongPress = allowLongPress; mNotificationGutsManager = notificationGutsManager; mVisibilityProvider = visibilityProvider; Loading @@ -684,6 +686,7 @@ public class NotificationStackScrollLayoutController { mNotificationSwipeHelperBuilder = notificationSwipeHelperBuilder; mStatusBar = statusBar; mScrimController = scrimController; mJankMonitor = jankMonitor; groupManager.registerGroupExpansionChangeListener( (changedRow, expanded) -> mView.onGroupExpandChanged(changedRow, expanded)); legacyGroupManager.registerGroupChangeListener(new OnGroupChangeListener() { Loading Loading @@ -1784,9 +1787,9 @@ public class NotificationStackScrollLayoutController { // We log any touches other than down, which will be captured by onTouchEvent. // In the intercept we only start tracing when it's not a down (otherwise that down // would be duplicated when intercepted). if (scrollWantsIt && ev.getActionMasked() != MotionEvent.ACTION_DOWN) { InteractionJankMonitor.getInstance().begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); if (mJankMonitor != null && scrollWantsIt && ev.getActionMasked() != MotionEvent.ACTION_DOWN) { mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } return swipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt; } Loading Loading @@ -1854,24 +1857,25 @@ public class NotificationStackScrollLayoutController { } private void traceJankOnTouchEvent(int action, boolean scrollerWantsIt) { if (mJankMonitor == null) { Log.w(TAG, "traceJankOnTouchEvent, mJankMonitor is null"); return; } // Handle interaction jank monitor cases. switch (action) { case MotionEvent.ACTION_DOWN: if (scrollerWantsIt) { InteractionJankMonitor.getInstance() .begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; case MotionEvent.ACTION_UP: if (scrollerWantsIt && !mView.isFlingAfterUpEvent()) { InteractionJankMonitor.getInstance() .end(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.end(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; case MotionEvent.ACTION_CANCEL: if (scrollerWantsIt) { InteractionJankMonitor.getInstance() .cancel(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); mJankMonitor.cancel(CUJ_NOTIFICATION_SHADE_SCROLL_FLING); } break; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +8 −2 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ import androidx.lifecycle.LifecycleRegistry; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; Loading Loading @@ -677,6 +678,8 @@ public class StatusBar extends CoreStartable implements private final ColorExtractor.OnColorsChangedListener mOnColorsChangedListener = (extractor, which) -> updateTheme(); private final InteractionJankMonitor mJankMonitor; /** * Public constructor for StatusBar. Loading Loading @@ -779,7 +782,8 @@ public class StatusBar extends CoreStartable implements WallpaperManager wallpaperManager, Optional<StartingSurface> startingSurfaceOptional, ActivityLaunchAnimator activityLaunchAnimator, NotifPipelineFlags notifPipelineFlags) { NotifPipelineFlags notifPipelineFlags, InteractionJankMonitor jankMonitor) { super(context); mNotificationsController = notificationsController; mFragmentService = fragmentService; Loading Loading @@ -867,6 +871,7 @@ public class StatusBar extends CoreStartable implements mMainExecutor = delayableExecutor; mMessageRouter = messageRouter; mWallpaperManager = wallpaperManager; mJankMonitor = jankMonitor; mLockscreenShadeTransitionController = lockscreenShadeTransitionController; mStartingSurfaceOptional = startingSurfaceOptional; Loading Loading @@ -1387,7 +1392,8 @@ public class StatusBar extends CoreStartable implements mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( mNotificationShadeWindowViewController, mStackScrollerController.getNotificationListContainer(), mHeadsUpManager mHeadsUpManager, mJankMonitor ); // TODO: inject this. Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.os.Handler; import android.os.PowerManager; import android.util.DisplayMetrics; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.logging.MetricsLogger; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; Loading Loading @@ -227,7 +228,8 @@ public interface StatusBarPhoneModule { WallpaperManager wallpaperManager, Optional<StartingSurface> startingSurfaceOptional, ActivityLaunchAnimator activityLaunchAnimator, NotifPipelineFlags notifPipelineFlags) { NotifPipelineFlags notifPipelineFlags, InteractionJankMonitor jankMonitor) { return new StatusBar( context, notificationsController, Loading Loading @@ -321,7 +323,8 @@ public interface StatusBarPhoneModule { wallpaperManager, startingSurfaceOptional, activityLaunchAnimator, notifPipelineFlags notifPipelineFlags, jankMonitor ); } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.SysuiTestCase import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationTestHelper Loading @@ -29,6 +30,7 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { @Mock lateinit var notificationShadeWindowViewController: NotificationShadeWindowViewController @Mock lateinit var notificationListContainer: NotificationListContainer @Mock lateinit var headsUpManager: HeadsUpManagerPhone @Mock lateinit var jankMonitor: InteractionJankMonitor private lateinit var notificationTestHelper: NotificationTestHelper private lateinit var notification: ExpandableNotificationRow Loading @@ -49,7 +51,8 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { notificationShadeWindowViewController, notificationListContainer, headsUpManager, notification notification, jankMonitor ) } Loading