Add supported refresh rate to displays
Change-Id: I51231dd6dd231d57dd1ac499349d6335121f07d5
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 284780d..00ff1cf 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -22,6 +22,7 @@
import android.view.Surface;
import java.io.PrintWriter;
+import java.util.Arrays;
import java.util.List;
import libcore.util.Objects;
@@ -72,6 +73,9 @@
// True if the logical display has unique content.
private boolean mHasContent;
+ // The pending requested refresh rate. 0 if no request is pending.
+ private float mRequestedRefreshRate;
+
// Temporary rectangle used when needed.
private final Rect mTempLayerStackRect = new Rect();
private final Rect mTempDisplayRect = new Rect();
@@ -210,6 +214,8 @@
mBaseDisplayInfo.logicalHeight = deviceInfo.height;
mBaseDisplayInfo.rotation = Surface.ROTATION_0;
mBaseDisplayInfo.refreshRate = deviceInfo.refreshRate;
+ mBaseDisplayInfo.supportedRefreshRates = Arrays.copyOf(
+ deviceInfo.supportedRefreshRates, deviceInfo.supportedRefreshRates.length);
mBaseDisplayInfo.logicalDensityDpi = deviceInfo.densityDpi;
mBaseDisplayInfo.physicalXDpi = deviceInfo.xDpi;
mBaseDisplayInfo.physicalYDpi = deviceInfo.yDpi;
@@ -253,6 +259,9 @@
// Set the layer stack.
device.setLayerStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack);
+ // Set the refresh rate
+ device.requestRefreshRateLocked(mRequestedRefreshRate);
+
// Set the viewport.
// This is the area of the logical display that we intend to show on the
// display device. For now, it is always the full size of the logical display.
@@ -328,6 +337,23 @@
mHasContent = hasContent;
}
+ /**
+ * Requests the given refresh rate.
+ * @param requestedRefreshRate The desired refresh rate.
+ */
+ public void setRequestedRefreshRateLocked(float requestedRefreshRate) {
+ mRequestedRefreshRate = requestedRefreshRate;
+ }
+
+ /**
+ * Gets the pending requested refresh rate.
+ *
+ * @return The pending refresh rate requested
+ */
+ public float getRequestedRefreshRateLocked() {
+ return mRequestedRefreshRate;
+ }
+
public void dumpLocked(PrintWriter pw) {
pw.println("mDisplayId=" + mDisplayId);
pw.println("mLayerStack=" + mLayerStack);