Launcher3: send token with early wakeup request to SurfaceFlinger
Passes a binder token to SurfaceFlinger and adds tracing for debugging Bug: 323292798 Test: presubmit Flag: EXEMPT log only update; bugfix Change-Id: I7875bd6a2498a938af236ffda783f7c265cdd874
This commit is contained in:
@@ -26,6 +26,8 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.gui.EarlyWakeupInfo;
|
||||
import android.os.Binder;
|
||||
import android.util.Log;
|
||||
import android.view.AttachedSurfaceControl;
|
||||
import android.view.Gravity;
|
||||
@@ -98,6 +100,10 @@ public final class TaskbarOverlayController {
|
||||
private TaskbarControllers mControllers; // Initialized in init.
|
||||
// True if we have alerted surface flinger of an expensive call for blur.
|
||||
private boolean mInEarlyWakeUp;
|
||||
/**
|
||||
* Token for early wakeup requests to SurfaceFlinger.
|
||||
*/
|
||||
private EarlyWakeupInfo mEarlyWakeupInfo = new EarlyWakeupInfo();
|
||||
|
||||
public TaskbarOverlayController(
|
||||
TaskbarActivityContext taskbarContext, DeviceProfile launcherDeviceProfile) {
|
||||
@@ -108,6 +114,8 @@ public final class TaskbarOverlayController {
|
||||
mLauncherDeviceProfile = launcherDeviceProfile;
|
||||
mMaxBlurRadius = mTaskbarContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.max_depth_blur_radius_enhanced);
|
||||
mEarlyWakeupInfo.token = new Binder();
|
||||
mEarlyWakeupInfo.trace = TaskbarOverlayController.class.getName();
|
||||
}
|
||||
|
||||
/** Initialize the controller. */
|
||||
@@ -259,12 +267,14 @@ public final class TaskbarOverlayController {
|
||||
// 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");
|
||||
transaction.setEarlyWakeupStart();
|
||||
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");
|
||||
transaction.setEarlyWakeupEnd();
|
||||
Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token"
|
||||
+ mEarlyWakeupInfo);
|
||||
transaction.setEarlyWakeupEnd(mEarlyWakeupInfo);
|
||||
mInEarlyWakeUp = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
|
||||
import android.app.WallpaperManager;
|
||||
import android.graphics.RenderEffect;
|
||||
import android.graphics.Shader;
|
||||
import android.gui.EarlyWakeupInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
@@ -110,6 +112,10 @@ public class BaseDepthController {
|
||||
protected boolean mWaitingOnSurfaceValidity;
|
||||
|
||||
private SurfaceControl mBlurSurface = null;
|
||||
/**
|
||||
* Info for early wakeup requests to SurfaceFlinger.
|
||||
*/
|
||||
private EarlyWakeupInfo mEarlyWakeupInfo = new EarlyWakeupInfo();
|
||||
|
||||
public BaseDepthController(Launcher activity) {
|
||||
mLauncher = activity;
|
||||
@@ -125,6 +131,8 @@ public class BaseDepthController {
|
||||
new MultiPropertyFactory<>(this, DEPTH, DEPTH_INDEX_COUNT, Float::max);
|
||||
stateDepth = depthProperty.get(DEPTH_INDEX_STATE_TRANSITION);
|
||||
widgetDepth = depthProperty.get(DEPTH_INDEX_WIDGET);
|
||||
mEarlyWakeupInfo.token = new Binder();
|
||||
mEarlyWakeupInfo.trace = BaseDepthController.class.getName();
|
||||
}
|
||||
|
||||
protected void setCrossWindowBlursEnabled(boolean isEnabled) {
|
||||
@@ -204,10 +212,10 @@ public class BaseDepthController {
|
||||
// SurfaceFlinger will adjust its internal offsets to avoid jank.
|
||||
boolean wantsEarlyWakeUp = depth > 0 && depth < 1;
|
||||
if (wantsEarlyWakeUp && !mInEarlyWakeUp) {
|
||||
transaction.setEarlyWakeupStart();
|
||||
transaction.setEarlyWakeupStart(mEarlyWakeupInfo);
|
||||
mInEarlyWakeUp = true;
|
||||
} else if (!wantsEarlyWakeUp && mInEarlyWakeUp) {
|
||||
transaction.setEarlyWakeupEnd();
|
||||
transaction.setEarlyWakeupEnd(mEarlyWakeupInfo);
|
||||
mInEarlyWakeUp = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user