Loading core/java/com/android/internal/jank/Cuj.java +12 −2 Original line number Diff line number Diff line Loading @@ -342,8 +342,14 @@ public class Cuj { */ public static final int CUJ_NOTIFICATIONS_ANIMATED_ACTION = 131; /** * Track the animation of the assistant invocation by long pressing the power button. */ public static final int CUJ_LPP_ASSIST_INVOCATION_EFFECT = 132; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_NOTIFICATIONS_ANIMATED_ACTION; @VisibleForTesting static final int LAST_CUJ = CUJ_LPP_ASSIST_INVOCATION_EFFECT; /** @hide */ @IntDef({ Loading Loading @@ -466,7 +472,8 @@ public class Cuj { CUJ_DEFAULT_TASK_TO_TASK_ANIMATION, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY, CUJ_STATUS_BAR_APP_RETURN_TO_CALL_CHIP, CUJ_NOTIFICATIONS_ANIMATED_ACTION CUJ_NOTIFICATIONS_ANIMATED_ACTION, CUJ_LPP_ASSIST_INVOCATION_EFFECT }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -600,6 +607,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_STATUS_BAR_APP_RETURN_TO_CALL_CHIP] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__STATUS_BAR_APP_RETURN_TO_CALL_CHIP; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_NOTIFICATIONS_ANIMATED_ACTION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__NOTIFICATIONS_ANIMATED_ACTION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LPP_ASSIST_INVOCATION_EFFECT] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LPP_ASSIST_INVOCATION_EFFECT; } private Cuj() { Loading Loading @@ -858,6 +866,8 @@ public class Cuj { return "STATUS_BAR_APP_RETURN_TO_CALL_CHIP"; case CUJ_NOTIFICATIONS_ANIMATED_ACTION: return "NOTIFICATIONS_ANIMATED_ACTION"; case CUJ_LPP_ASSIST_INVOCATION_EFFECT: return "CUJ_LPP_ASSIST_INVOCATION_EFFECT"; } return "UNKNOWN"; } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/topwindoweffects/TopLevelWindowEffectsTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.view.WindowManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.jank.interactionJankMonitor import com.android.systemui.keyevent.data.repository.fakeKeyEventRepository import com.android.systemui.keyevent.domain.interactor.keyEventInteractor import com.android.systemui.kosmos.Kosmos Loading Loading @@ -79,6 +80,7 @@ class TopLevelWindowEffectsTest : SysuiTestCase() { SqueezeEffectInteractor(squeezeEffectRepository = fakeSqueezeEffectRepository), appZoomOutOptional = Optional.empty(), notificationShadeWindowController = notificationShadeWindowController, interactionJankMonitor = kosmos.interactionJankMonitor, ) } Loading packages/SystemUI/src/com/android/systemui/topwindoweffects/TopLevelWindowEffects.kt +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.WindowInsets import android.view.WindowManager import androidx.annotation.DrawableRes import androidx.annotation.VisibleForTesting import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.CoreStartable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application Loading Loading @@ -57,6 +58,7 @@ constructor( // TODO(b/409930584): make AppZoomOut non-optional private val appZoomOutOptional: Optional<AppZoomOut>, private val notificationShadeWindowController: NotificationShadeWindowController, private val interactionJankMonitor: InteractionJankMonitor, ) : CoreStartable { private var root: EffectsWindowRoot? = null Loading Loading @@ -105,6 +107,7 @@ constructor( } }, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, ) root?.let { rootView -> runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) } Loading packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/EffectsWindowRoot.kt +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context import androidx.annotation.DrawableRes import androidx.compose.runtime.Composable import androidx.compose.ui.platform.AbstractComposeView import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.compose.ComposeInitializer import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel import com.android.wm.shell.appzoomout.AppZoomOut Loading @@ -35,6 +36,7 @@ class EffectsWindowRoot( @DrawableRes private val bottomRoundedCornerResourceId: Int, private val physicalPixelDisplaySizeRatio: Float, private val appZoomOutOptional: Optional<AppZoomOut>, private val interactionJankMonitor: InteractionJankMonitor, ) : AbstractComposeView(context) { override fun onAttachedToWindow() { Loading @@ -56,6 +58,7 @@ class EffectsWindowRoot( bottomRoundedCornerResourceId = bottomRoundedCornerResourceId, physicalPixelDisplaySizeRatio = physicalPixelDisplaySizeRatio, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, ) } } packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/SqueezeEffect.kt +8 −0 Original line number Diff line number Diff line Loading @@ -37,9 +37,12 @@ import androidx.compose.ui.graphics.drawscope.withTransform import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.VectorPainter import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalWindowInfo import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import com.android.internal.jank.Cuj import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.lifecycle.rememberViewModel import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel.Companion.ZOOM_OUT_SCALE Loading @@ -60,8 +63,10 @@ fun SqueezeEffect( physicalPixelDisplaySizeRatio: Float, onEffectFinished: suspend () -> Unit, appZoomOutOptional: Optional<AppZoomOut>, interactionJankMonitor: InteractionJankMonitor, ) { val viewModel = rememberViewModel(traceName = "SqueezeEffect") { viewModelFactory.create() } val view = LocalView.current val down = viewModel.isPowerButtonPressed val longPressed = viewModel.isPowerButtonLongPressed Loading Loading @@ -97,9 +102,11 @@ fun SqueezeEffect( LaunchedEffect(isMainAnimationRunning) { if (isMainAnimationRunning) { interactionJankMonitor.begin(view, Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) squeezeProgress.animateTo(1f, animationSpec = tween(durationMillis = 800)) squeezeProgress.animateTo(0f, animationSpec = tween(durationMillis = 333)) if (squeezeProgress.value == 0f) { interactionJankMonitor.end(Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) onEffectFinished() } isAnimationInterruptible = true Loading @@ -108,6 +115,7 @@ fun SqueezeEffect( squeezeProgress.animateTo(0f, animationSpec = tween(durationMillis = 333)) } if (squeezeProgress.value == 0f) { interactionJankMonitor.cancel(Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) onEffectFinished() } } Loading Loading
core/java/com/android/internal/jank/Cuj.java +12 −2 Original line number Diff line number Diff line Loading @@ -342,8 +342,14 @@ public class Cuj { */ public static final int CUJ_NOTIFICATIONS_ANIMATED_ACTION = 131; /** * Track the animation of the assistant invocation by long pressing the power button. */ public static final int CUJ_LPP_ASSIST_INVOCATION_EFFECT = 132; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_NOTIFICATIONS_ANIMATED_ACTION; @VisibleForTesting static final int LAST_CUJ = CUJ_LPP_ASSIST_INVOCATION_EFFECT; /** @hide */ @IntDef({ Loading Loading @@ -466,7 +472,8 @@ public class Cuj { CUJ_DEFAULT_TASK_TO_TASK_ANIMATION, CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY, CUJ_STATUS_BAR_APP_RETURN_TO_CALL_CHIP, CUJ_NOTIFICATIONS_ANIMATED_ACTION CUJ_NOTIFICATIONS_ANIMATED_ACTION, CUJ_LPP_ASSIST_INVOCATION_EFFECT }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -600,6 +607,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_MOVE_WINDOW_TO_DISPLAY; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_STATUS_BAR_APP_RETURN_TO_CALL_CHIP] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__STATUS_BAR_APP_RETURN_TO_CALL_CHIP; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_NOTIFICATIONS_ANIMATED_ACTION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__NOTIFICATIONS_ANIMATED_ACTION; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LPP_ASSIST_INVOCATION_EFFECT] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LPP_ASSIST_INVOCATION_EFFECT; } private Cuj() { Loading Loading @@ -858,6 +866,8 @@ public class Cuj { return "STATUS_BAR_APP_RETURN_TO_CALL_CHIP"; case CUJ_NOTIFICATIONS_ANIMATED_ACTION: return "NOTIFICATIONS_ANIMATED_ACTION"; case CUJ_LPP_ASSIST_INVOCATION_EFFECT: return "CUJ_LPP_ASSIST_INVOCATION_EFFECT"; } return "UNKNOWN"; } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/topwindoweffects/TopLevelWindowEffectsTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.view.WindowManager import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.jank.interactionJankMonitor import com.android.systemui.keyevent.data.repository.fakeKeyEventRepository import com.android.systemui.keyevent.domain.interactor.keyEventInteractor import com.android.systemui.kosmos.Kosmos Loading Loading @@ -79,6 +80,7 @@ class TopLevelWindowEffectsTest : SysuiTestCase() { SqueezeEffectInteractor(squeezeEffectRepository = fakeSqueezeEffectRepository), appZoomOutOptional = Optional.empty(), notificationShadeWindowController = notificationShadeWindowController, interactionJankMonitor = kosmos.interactionJankMonitor, ) } Loading
packages/SystemUI/src/com/android/systemui/topwindoweffects/TopLevelWindowEffects.kt +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.WindowInsets import android.view.WindowManager import androidx.annotation.DrawableRes import androidx.annotation.VisibleForTesting import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.CoreStartable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application Loading Loading @@ -57,6 +58,7 @@ constructor( // TODO(b/409930584): make AppZoomOut non-optional private val appZoomOutOptional: Optional<AppZoomOut>, private val notificationShadeWindowController: NotificationShadeWindowController, private val interactionJankMonitor: InteractionJankMonitor, ) : CoreStartable { private var root: EffectsWindowRoot? = null Loading Loading @@ -105,6 +107,7 @@ constructor( } }, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, ) root?.let { rootView -> runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) } Loading
packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/EffectsWindowRoot.kt +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context import androidx.annotation.DrawableRes import androidx.compose.runtime.Composable import androidx.compose.ui.platform.AbstractComposeView import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.compose.ComposeInitializer import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel import com.android.wm.shell.appzoomout.AppZoomOut Loading @@ -35,6 +36,7 @@ class EffectsWindowRoot( @DrawableRes private val bottomRoundedCornerResourceId: Int, private val physicalPixelDisplaySizeRatio: Float, private val appZoomOutOptional: Optional<AppZoomOut>, private val interactionJankMonitor: InteractionJankMonitor, ) : AbstractComposeView(context) { override fun onAttachedToWindow() { Loading @@ -56,6 +58,7 @@ class EffectsWindowRoot( bottomRoundedCornerResourceId = bottomRoundedCornerResourceId, physicalPixelDisplaySizeRatio = physicalPixelDisplaySizeRatio, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, ) } }
packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/SqueezeEffect.kt +8 −0 Original line number Diff line number Diff line Loading @@ -37,9 +37,12 @@ import androidx.compose.ui.graphics.drawscope.withTransform import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.VectorPainter import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalWindowInfo import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import com.android.internal.jank.Cuj import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.lifecycle.rememberViewModel import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel import com.android.systemui.topwindoweffects.ui.viewmodel.SqueezeEffectViewModel.Companion.ZOOM_OUT_SCALE Loading @@ -60,8 +63,10 @@ fun SqueezeEffect( physicalPixelDisplaySizeRatio: Float, onEffectFinished: suspend () -> Unit, appZoomOutOptional: Optional<AppZoomOut>, interactionJankMonitor: InteractionJankMonitor, ) { val viewModel = rememberViewModel(traceName = "SqueezeEffect") { viewModelFactory.create() } val view = LocalView.current val down = viewModel.isPowerButtonPressed val longPressed = viewModel.isPowerButtonLongPressed Loading Loading @@ -97,9 +102,11 @@ fun SqueezeEffect( LaunchedEffect(isMainAnimationRunning) { if (isMainAnimationRunning) { interactionJankMonitor.begin(view, Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) squeezeProgress.animateTo(1f, animationSpec = tween(durationMillis = 800)) squeezeProgress.animateTo(0f, animationSpec = tween(durationMillis = 333)) if (squeezeProgress.value == 0f) { interactionJankMonitor.end(Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) onEffectFinished() } isAnimationInterruptible = true Loading @@ -108,6 +115,7 @@ fun SqueezeEffect( squeezeProgress.animateTo(0f, animationSpec = tween(durationMillis = 333)) } if (squeezeProgress.value == 0f) { interactionJankMonitor.cancel(Cuj.CUJ_LPP_ASSIST_INVOCATION_EFFECT) onEffectFinished() } } Loading