Loading packages/SystemUI/src/com/android/systemui/topwindoweffects/TopLevelWindowEffects.kt +36 −24 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ constructor( private var root: EffectsWindowRoot? = null // TODO(b/414267753): Make cleanup of window logic more robust private var isInvocationEffectHappening = false override fun start() { topLevelWindowEffectsScope.launch { squeezeEffectInteractor.isSqueezeEffectEnabled.collectLatest { enabled -> Loading @@ -80,6 +83,8 @@ constructor( roundedCornerInfo.bottomResourceId, roundedCornerInfo.physicalPixelDisplaySizeRatio, ) } else if (root != null && !isInvocationEffectHappening) { removeWindow() } } } Loading @@ -92,7 +97,14 @@ constructor( @DrawableRes bottomRoundedCornerId: Int, physicalPixelDisplaySizeRatio: Float, ) { if (root == null) { if (isInvocationEffectHappening) { return } if (root != null) { removeWindow() } root = EffectsWindowRoot( context = context, Loading @@ -103,25 +115,25 @@ constructor( onEffectFinished = ::removeWindow, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, onEffectStarted = { isInvocationEffectHappening = true }, ) .apply { visibility = View.GONE } root?.let { rootView -> if (TopUiControllerRefactor.isEnabled) { topUiController.setRequestTopUi(true, TAG) } else { runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) } } windowManager.addView(rootView, getWindowManagerLayoutParams()) rootView.post { rootView.visibility = View.VISIBLE } } } } private suspend fun removeWindow() { if (root?.isAttachedToWindow == true) { windowManager.removeView(root) root = null } root = null isInvocationEffectHappening = false if (TopUiControllerRefactor.isEnabled) { topUiController.setRequestTopUi(false, TAG) } else { Loading Loading @@ -155,7 +167,7 @@ constructor( lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS lp.title = "TopLevelWindowEffects" lp.title = TAG lp.fitInsetsTypes = WindowInsets.Type.systemOverlays() lp.gravity = Gravity.TOP Loading packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/EffectsWindowRoot.kt +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import java.util.Optional @SuppressLint("ViewConstructor") class EffectsWindowRoot( context: Context, private val onEffectStarted: suspend () -> Unit, private val onEffectFinished: suspend () -> Unit, private val viewModelFactory: SqueezeEffectViewModel.Factory, @DrawableRes private val topRoundedCornerResourceId: Int, Loading @@ -53,6 +54,7 @@ class EffectsWindowRoot( override fun Content() { SqueezeEffect( viewModelFactory = viewModelFactory, onEffectStarted = onEffectStarted, onEffectFinished = onEffectFinished, topRoundedCornerResourceId = topRoundedCornerResourceId, bottomRoundedCornerResourceId = bottomRoundedCornerResourceId, Loading packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/SqueezeEffect.kt +3 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ fun SqueezeEffect( @DrawableRes topRoundedCornerResourceId: Int, @DrawableRes bottomRoundedCornerResourceId: Int, physicalPixelDisplaySizeRatio: Float, onEffectStarted: suspend () -> Unit, onEffectFinished: suspend () -> Unit, appZoomOutOptional: Optional<AppZoomOut>, interactionJankMonitor: InteractionJankMonitor, Loading Loading @@ -94,6 +95,8 @@ fun SqueezeEffect( // lifting the power button the animation shouldn't be interruptible either. var isAnimationInterruptible by remember { mutableStateOf(true) } LaunchedEffect(Unit) { onEffectStarted() } LaunchedEffect(longPressed) { if (longPressed) { isAnimationInterruptible = false Loading Loading
packages/SystemUI/src/com/android/systemui/topwindoweffects/TopLevelWindowEffects.kt +36 −24 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ constructor( private var root: EffectsWindowRoot? = null // TODO(b/414267753): Make cleanup of window logic more robust private var isInvocationEffectHappening = false override fun start() { topLevelWindowEffectsScope.launch { squeezeEffectInteractor.isSqueezeEffectEnabled.collectLatest { enabled -> Loading @@ -80,6 +83,8 @@ constructor( roundedCornerInfo.bottomResourceId, roundedCornerInfo.physicalPixelDisplaySizeRatio, ) } else if (root != null && !isInvocationEffectHappening) { removeWindow() } } } Loading @@ -92,7 +97,14 @@ constructor( @DrawableRes bottomRoundedCornerId: Int, physicalPixelDisplaySizeRatio: Float, ) { if (root == null) { if (isInvocationEffectHappening) { return } if (root != null) { removeWindow() } root = EffectsWindowRoot( context = context, Loading @@ -103,25 +115,25 @@ constructor( onEffectFinished = ::removeWindow, appZoomOutOptional = appZoomOutOptional, interactionJankMonitor = interactionJankMonitor, onEffectStarted = { isInvocationEffectHappening = true }, ) .apply { visibility = View.GONE } root?.let { rootView -> if (TopUiControllerRefactor.isEnabled) { topUiController.setRequestTopUi(true, TAG) } else { runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) } } windowManager.addView(rootView, getWindowManagerLayoutParams()) rootView.post { rootView.visibility = View.VISIBLE } } } } private suspend fun removeWindow() { if (root?.isAttachedToWindow == true) { windowManager.removeView(root) root = null } root = null isInvocationEffectHappening = false if (TopUiControllerRefactor.isEnabled) { topUiController.setRequestTopUi(false, TAG) } else { Loading Loading @@ -155,7 +167,7 @@ constructor( lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS lp.title = "TopLevelWindowEffects" lp.title = TAG lp.fitInsetsTypes = WindowInsets.Type.systemOverlays() lp.gravity = Gravity.TOP Loading
packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/EffectsWindowRoot.kt +2 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import java.util.Optional @SuppressLint("ViewConstructor") class EffectsWindowRoot( context: Context, private val onEffectStarted: suspend () -> Unit, private val onEffectFinished: suspend () -> Unit, private val viewModelFactory: SqueezeEffectViewModel.Factory, @DrawableRes private val topRoundedCornerResourceId: Int, Loading @@ -53,6 +54,7 @@ class EffectsWindowRoot( override fun Content() { SqueezeEffect( viewModelFactory = viewModelFactory, onEffectStarted = onEffectStarted, onEffectFinished = onEffectFinished, topRoundedCornerResourceId = topRoundedCornerResourceId, bottomRoundedCornerResourceId = bottomRoundedCornerResourceId, Loading
packages/SystemUI/src/com/android/systemui/topwindoweffects/ui/compose/SqueezeEffect.kt +3 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ fun SqueezeEffect( @DrawableRes topRoundedCornerResourceId: Int, @DrawableRes bottomRoundedCornerResourceId: Int, physicalPixelDisplaySizeRatio: Float, onEffectStarted: suspend () -> Unit, onEffectFinished: suspend () -> Unit, appZoomOutOptional: Optional<AppZoomOut>, interactionJankMonitor: InteractionJankMonitor, Loading Loading @@ -94,6 +95,8 @@ fun SqueezeEffect( // lifting the power button the animation shouldn't be interruptible either. var isAnimationInterruptible by remember { mutableStateOf(true) } LaunchedEffect(Unit) { onEffectStarted() } LaunchedEffect(longPressed) { if (longPressed) { isAnimationInterruptible = false Loading