DisplayManager: Add color sampling hardware query
Add calls to SurfaceControl JNI interface that allow
the DisplayManager to drive color histogram functionality.
Fixes: 112756444
Test: Boot
Test: additional test in 'atest FrameworksServicesTests:DisplayManagerServiceTest'
Change-Id: Ifa46dab53b09db62da79ad82e9687d9155ddc6da
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 360a7d1..cf8d21b 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -46,6 +46,8 @@
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal.DisplayTransactionListener;
import android.hardware.display.DisplayViewport;
+import android.hardware.display.DisplayedContentSample;
+import android.hardware.display.DisplayedContentSamplingAttributes;
import android.hardware.display.IDisplayManager;
import android.hardware.display.IDisplayManagerCallback;
import android.hardware.display.IVirtualDisplayCallback;
@@ -1241,6 +1243,29 @@
}
}
+ @VisibleForTesting
+ DisplayedContentSamplingAttributes getDisplayedContentSamplingAttributesInternal(
+ int displayId) {
+ IBinder displayToken = SurfaceControl.getBuiltInDisplay(displayId);
+ return SurfaceControl.getDisplayedContentSamplingAttributes(displayToken);
+ }
+
+ @VisibleForTesting
+ boolean setDisplayedContentSamplingEnabledInternal(
+ int displayId, boolean enable, int componentMask, int maxFrames) {
+ IBinder displayToken = SurfaceControl.getBuiltInDisplay(displayId);
+ return SurfaceControl.setDisplayedContentSamplingEnabled(
+ displayToken, enable, componentMask, maxFrames);
+ }
+
+ @VisibleForTesting
+ DisplayedContentSample getDisplayedContentSampleInternal(int displayId,
+ long maxFrames, long timestamp) {
+ IBinder displayToken = SurfaceControl.getBuiltInDisplay(displayId);
+ return SurfaceControl.getDisplayedContentSample(
+ displayToken, maxFrames, timestamp);
+ }
+
private void clearViewportsLocked() {
mViewports.clear();
}
@@ -2331,5 +2356,25 @@
}
}
}
+
+ @Override
+ public DisplayedContentSamplingAttributes getDisplayedContentSamplingAttributes(
+ int displayId) {
+ return getDisplayedContentSamplingAttributesInternal(displayId);
+ }
+
+ @Override
+ public boolean setDisplayedContentSamplingEnabled(
+ int displayId, boolean enable, int componentMask, int maxFrames) {
+ return setDisplayedContentSamplingEnabledInternal(
+ displayId, enable, componentMask, maxFrames);
+ }
+
+ @Override
+ public DisplayedContentSample getDisplayedContentSample(int displayId,
+ long maxFrames, long timestamp) {
+ return getDisplayedContentSampleInternal(displayId, maxFrames, timestamp);
+ }
+
}
}