diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index dabc7dafef..b7c0774494 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -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 implements Insettable, DeviceProfile.OnDeviceProfileChangeListener { + private static final String TAG = "TaskbarAllAppsSlideInView"; + private final Handler mHandler; private final int mMaxBlurRadius; private final Consumer mWindowBlurListener = blursEnabled -> invalidate(); @@ -107,6 +111,14 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView 0 && radius < mMaxBlurRadius; - if (wantsEarlyWakeUp && !mInEarlyWakeUp) { - Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup with token" - + mEarlyWakeupInfo); - transaction.setEarlyWakeupStart(mEarlyWakeupInfo); - mInEarlyWakeUp = true; - } else if (!wantsEarlyWakeUp && mInEarlyWakeUp) { - Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token" - + mEarlyWakeupInfo); - transaction.setEarlyWakeupEnd(mEarlyWakeupInfo); - mInEarlyWakeUp = false; - } + try (transaction) { + // Set early wake-up flags when we know we're executing an expensive operation, this way + // SurfaceFlinger will adjust its internal offsets to avoid jank. + boolean wantsEarlyWakeUp = radius > 0 && radius < mMaxBlurRadius; + if (wantsEarlyWakeUp && !mInEarlyWakeUp) { + Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup with token " + + mEarlyWakeupInfo); + transaction.setEarlyWakeupStart(mEarlyWakeupInfo); + mInEarlyWakeUp = true; + } else if (!wantsEarlyWakeUp && mInEarlyWakeUp) { + Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token " + + mEarlyWakeupInfo); + transaction.setEarlyWakeupEnd(mEarlyWakeupInfo); + mInEarlyWakeUp = false; + } - rootSurfaceControl.applyTransactionOnDraw(transaction); + rootSurfaceControl.applyTransactionOnDraw(transaction); + } } boolean isBackgroundBlurEnabled() { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index a74b350a64..5ba3fbf97a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -26,6 +26,7 @@ import android.view.MotionEvent; import com.android.app.animation.Interpolators; import com.android.internal.jank.Cuj; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.Flags; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsTransitionController; @@ -216,6 +217,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr @Override protected void onReinitToState(LauncherState newToState) { super.onReinitToState(newToState); + if (Flags.allAppsBlur() && mLauncher.isBackgroundBlurEnabled() && newToState == ALL_APPS) { + // About to start blurring during swipe to All Apps; prepare the renderer. + mLauncher.getRootView().getViewRootImpl().notifyRendererOfExpensiveFrame(); + } if (newToState != ALL_APPS) { InteractionJankMonitorWrapper.cancel(Cuj.CUJ_LAUNCHER_OPEN_ALL_APPS); } diff --git a/quickstep/src/com/android/quickstep/util/BaseDepthController.java b/quickstep/src/com/android/quickstep/util/BaseDepthController.java index 4ba71b7a82..1c83c3f849 100644 --- a/quickstep/src/com/android/quickstep/util/BaseDepthController.java +++ b/quickstep/src/com/android/quickstep/util/BaseDepthController.java @@ -231,27 +231,30 @@ public class BaseDepthController { if (transaction == null) { transaction = createTransaction(); } - transaction.setBackgroundBlurRadius(blurSurface, mCurrentBlur) - .setOpaque(blurSurface, isSurfaceOpaque); + final SurfaceControl.Transaction finalTransaction = transaction; + try (finalTransaction) { + finalTransaction.setBackgroundBlurRadius(blurSurface, mCurrentBlur) + .setOpaque(blurSurface, isSurfaceOpaque); - // Set early wake-up flags when we know we're executing an expensive operation, this way - // SurfaceFlinger will adjust its internal offsets to avoid jank. - boolean wantsEarlyWakeUp = depth > 0 && depth < 1; - if (wantsEarlyWakeUp && !mInEarlyWakeUp) { - transaction.setEarlyWakeupStart(mEarlyWakeupInfo); - mInEarlyWakeUp = true; - } else if (!wantsEarlyWakeUp && mInEarlyWakeUp) { - transaction.setEarlyWakeupEnd(mEarlyWakeupInfo); - mInEarlyWakeUp = false; - } + // Set early wake-up flags when we know we're executing an expensive operation, this way + // SurfaceFlinger will adjust its internal offsets to avoid jank. + boolean wantsEarlyWakeUp = depth > 0 && depth < 1; + if (wantsEarlyWakeUp && !mInEarlyWakeUp) { + finalTransaction.setEarlyWakeupStart(mEarlyWakeupInfo); + mInEarlyWakeUp = true; + } else if (!wantsEarlyWakeUp && mInEarlyWakeUp) { + finalTransaction.setEarlyWakeupEnd(mEarlyWakeupInfo); + mInEarlyWakeUp = false; + } - if (applyImmediately) { - transaction.apply(); - } else { - AttachedSurfaceControl rootSurfaceControl = - mLauncher.getRootView().getRootSurfaceControl(); - if (rootSurfaceControl != null) { - rootSurfaceControl.applyTransactionOnDraw(transaction); + if (applyImmediately) { + finalTransaction.apply(); + } else { + AttachedSurfaceControl rootSurfaceControl = + mLauncher.getRootView().getRootSurfaceControl(); + if (rootSurfaceControl != null) { + rootSurfaceControl.applyTransactionOnDraw(finalTransaction); + } } }