Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ca53156 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "[Floaty] Delay Floaty visibility by one frame to prevent jank" into main

parents 1ff85dce e0be3f53
Loading
Loading
Loading
Loading
+20 −17
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.topwindoweffects
import android.content.Context
import android.content.Context
import android.graphics.PixelFormat
import android.graphics.PixelFormat
import android.view.Gravity
import android.view.Gravity
import android.view.View
import android.view.WindowInsets
import android.view.WindowInsets
import android.view.WindowManager
import android.view.WindowManager
import androidx.annotation.DrawableRes
import androidx.annotation.DrawableRes
@@ -97,23 +98,25 @@ constructor(
                        topRoundedCornerResourceId = topRoundedCornerId,
                        topRoundedCornerResourceId = topRoundedCornerId,
                        bottomRoundedCornerResourceId = bottomRoundedCornerId,
                        bottomRoundedCornerResourceId = bottomRoundedCornerId,
                        physicalPixelDisplaySizeRatio = physicalPixelDisplaySizeRatio,
                        physicalPixelDisplaySizeRatio = physicalPixelDisplaySizeRatio,
                    onEffectFinished = {
                        onEffectFinished = ::removeWindow,
                        if (root?.isAttachedToWindow == true) {
                            windowManager.removeView(root)
                            root = null
                        }
                        runOnMainThread {
                            notificationShadeWindowController.setRequestTopUi(false, TAG)
                        }
                    },
                        appZoomOutOptional = appZoomOutOptional,
                        appZoomOutOptional = appZoomOutOptional,
                        interactionJankMonitor = interactionJankMonitor,
                        interactionJankMonitor = interactionJankMonitor,
                    )
                    )
                    .apply { visibility = View.GONE }
            root?.let { rootView ->
            root?.let { rootView ->
                runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) }
                runOnMainThread { notificationShadeWindowController.setRequestTopUi(true, TAG) }
                windowManager.addView(rootView, getWindowManagerLayoutParams())
                windowManager.addView(rootView, getWindowManagerLayoutParams())
                rootView.post { rootView.visibility = View.VISIBLE }
            }
        }
        }
    }
    }

    private suspend fun removeWindow() {
        if (root?.isAttachedToWindow == true) {
            windowManager.removeView(root)
            root = null
        }
        runOnMainThread { notificationShadeWindowController.setRequestTopUi(false, TAG) }
    }
    }


    private suspend fun runOnMainThread(block: () -> Unit) {
    private suspend fun runOnMainThread(block: () -> Unit) {