Prewarm renderer for All Apps blur.

We already notify renderer when a non-0 blur is about to be
applied, but this change gives additional heads up. On my device,
I saw the following latency improvements (for sending the alert,
not necessarily when it was acted upon):

 - All Apps swipe transtion: 10ms early
 - Taskbar All Apps button: 30ms early

Also clean up the SurfaceControl.Transactions using
try-with-resources.

Flag: com.android.launcher3.all_apps_blur
Bug: 410973453
Bug: 411292920
Bug: 411033774
Test: Log inspections; will run perf tests with ABTD
Change-Id: I640720767de71f439ba479f83db00c00eefe07dd
This commit is contained in:
Andy Wickham committed 2025-04-18 14:58:19 -07:00
1 parent 8c96a1528c
commit 9e6de0876f
4 files changed
+57 -35

No files matched your search

@@ -29,9 +29,11 @@ import android.graphics.Rect;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;
import android.view.CrossWindowBlurListeners;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.animation.Interpolator;
import android.window.OnBackInvokedDispatcher;
@@ -54,6 +56,8 @@ import java.util.function.Consumer;
/** Wrapper for taskbar all apps with slide-in behavior. */
public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverlayContext>
implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
private static final String TAG = "TaskbarAllAppsSlideInView";
private final Handler mHandler;
private final int mMaxBlurRadius;
private final Consumer<Boolean> mWindowBlurListener = blursEnabled -> invalidate();
@@ -107,6 +111,14 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
}
private void showOnFullyAttachedToWindow(boolean animate) {
if (mActivityContext.isBackgroundBlurEnabled()) {
ViewRootImpl overlayVri = mActivityContext.getRootView().getViewRootImpl();
if (overlayVri == null) {
Log.w(TAG, "overlayVRI is null, cannot notifyRendererOfExpensiveFrame()");
} else {
overlayVri.notifyRendererOfExpensiveFrame();
}
}
mAllAppsCallbacks.onAllAppsTransitionStart(true);
if (!animate) {
mAllAppsCallbacks.onAllAppsTransitionEnd(true);