Don't update everything when only refreshrate changes
This was going through the whole display-info-changed flow
when only the refreshrate changed. This was causing updates
with outdated information (where displaymanager callback
happens before configurationchanged). The result is that
things like touch-monitors (based on display info) were
out-of-sync with view content (which is based on configuration).
This change just updates the local record of screenrefresh
when it changes.
Bug: 179308296
Test: With fixed-rotation-in-config, open recents and repeatedly
rotate the device. Make sure touch regions stay aligned
with recents content.
Change-Id: I9a8c553dfa55ec4402edcecac44bc87cb51c75fc
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 1641083..ba925f5 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -67,12 +67,11 @@
public static final int CHANGE_ACTIVE_SCREEN = 1 << 0;
public static final int CHANGE_ROTATION = 1 << 1;
- public static final int CHANGE_FRAME_DELAY = 1 << 2;
- public static final int CHANGE_DENSITY = 1 << 3;
- public static final int CHANGE_SUPPORTED_BOUNDS = 1 << 4;
+ public static final int CHANGE_DENSITY = 1 << 2;
+ public static final int CHANGE_SUPPORTED_BOUNDS = 1 << 3;
public static final int CHANGE_ALL = CHANGE_ACTIVE_SCREEN | CHANGE_ROTATION
- | CHANGE_FRAME_DELAY | CHANGE_DENSITY | CHANGE_SUPPORTED_BOUNDS;
+ | CHANGE_DENSITY | CHANGE_SUPPORTED_BOUNDS;
private final Context mContext;
private final DisplayManager mDM;
@@ -149,16 +148,15 @@
return;
}
if (Utilities.ATLEAST_S) {
- // Only check for refresh rate. Everything else comes from component callbacks
- if (getSingleFrameMs(display) == mInfo.singleFrameMs) {
- return;
- }
+ // Only update refresh rate. Everything else comes from component callbacks
+ mInfo.mSingleFrameMs = getSingleFrameMs(display);
+ return;
}
handleInfoChange(display);
}
public static int getSingleFrameMs(Context context) {
- return INSTANCE.get(context).getInfo().singleFrameMs;
+ return INSTANCE.get(context).getInfo().mSingleFrameMs;
}
/**
@@ -249,9 +247,6 @@
if (newInfo.rotation != oldInfo.rotation) {
change |= CHANGE_ROTATION;
}
- if (newInfo.singleFrameMs != oldInfo.singleFrameMs) {
- change |= CHANGE_FRAME_DELAY;
- }
if (newInfo.densityDpi != oldInfo.densityDpi || newInfo.fontScale != oldInfo.fontScale) {
change |= CHANGE_DENSITY;
}
@@ -292,7 +287,7 @@
public static class Info {
- public final int singleFrameMs;
+ private int mSingleFrameMs;
// Configuration properties
public final int rotation;
@@ -323,7 +318,7 @@
densityDpi = config.densityDpi;
mScreenSizeDp = new PortraitSize(config.screenHeightDp, config.screenWidthDp);
- singleFrameMs = getSingleFrameMs(display);
+ mSingleFrameMs = getSingleFrameMs(display);
currentSize = new Point();
display.getRealSize(currentSize);
diff --git a/src/com/android/launcher3/views/FloatingSurfaceView.java b/src/com/android/launcher3/views/FloatingSurfaceView.java
index f32f904..e7cb3b3 100644
--- a/src/com/android/launcher3/views/FloatingSurfaceView.java
+++ b/src/com/android/launcher3/views/FloatingSurfaceView.java
@@ -97,7 +97,7 @@
// Remove after some time, to avoid flickering
Executors.MAIN_EXECUTOR.getHandler().postDelayed(mRemoveViewRunnable,
- DisplayController.INSTANCE.get(mLauncher).getInfo().singleFrameMs);
+ DisplayController.getSingleFrameMs(mLauncher));
}
private void removeViewFromParent() {