summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/hardware/OverlayProperties.aidl19
-rw-r--r--core/java/android/hardware/OverlayProperties.java98
-rw-r--r--core/java/android/hardware/display/DisplayManagerGlobal.java9
-rw-r--r--core/java/android/hardware/display/IDisplayManager.aidl4
-rw-r--r--core/java/android/view/Display.java7
-rw-r--r--core/java/android/view/SurfaceControl.java10
-rw-r--r--core/jni/Android.bp1
-rw-r--r--core/jni/AndroidRuntime.cpp2
-rw-r--r--core/jni/android_hardware_OverlayProperties.cpp147
-rw-r--r--core/jni/android_view_SurfaceControl.cpp12
-rw-r--r--core/jni/include/android_runtime/android_hardware_OverlayProperties.h31
-rw-r--r--graphics/java/android/graphics/HardwareRenderer.java6
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java17
13 files changed, 341 insertions, 22 deletions
diff --git a/core/java/android/hardware/OverlayProperties.aidl b/core/java/android/hardware/OverlayProperties.aidl
new file mode 100644
index 000000000000..4f6631240171
--- /dev/null
+++ b/core/java/android/hardware/OverlayProperties.aidl
@@ -0,0 +1,19 @@
+/**
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware;
+
+parcelable OverlayProperties; \ No newline at end of file
diff --git a/core/java/android/hardware/OverlayProperties.java b/core/java/android/hardware/OverlayProperties.java
index 2a0956b47a7b..1ce1361cd4e7 100644
--- a/core/java/android/hardware/OverlayProperties.java
+++ b/core/java/android/hardware/OverlayProperties.java
@@ -16,32 +16,96 @@
package android.hardware;
-import java.util.List;
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import libcore.util.NativeAllocationRegistry;
/**
- * // TODO(b/242588489): Continue work, the class needs a jni-specific constructor and DisplayInfo
- * // side constructs the object.
+ * The class provides overlay properties of the device. OverlayProperties
+ * exposes some capabilities from HWC e.g. if fp16 can be supported for HWUI.
+ *
+ * In the future, more capabilities can be added, e.g., whether or not
+ * per-layer colorspaces are supported.
*
* @hide
*/
-public final class OverlayProperties {
- private final SupportedBufferCombinations[] mCombinations = null;
- private final boolean mSupportFp16ForHdr = false;
-
- static class SupportedBufferCombinations {
- @HardwareBuffer.Format List<Integer> mHardwareBufferFormats;
- @DataSpace.NamedDataSpace List<Integer> mDataSpaces;
- SupportedBufferCombinations(@HardwareBuffer.Format List<Integer> hardwareBufferFormats,
- @DataSpace.NamedDataSpace List<Integer> dataSpaces) {
- mHardwareBufferFormats = hardwareBufferFormats;
- mDataSpaces = dataSpaces;
+public final class OverlayProperties implements Parcelable {
+
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(OverlayProperties.class.getClassLoader(),
+ nGetDestructor());
+
+ private long mNativeObject;
+ // Invoked on destruction
+ private Runnable mCloser;
+
+ public OverlayProperties(long nativeObject) {
+ if (nativeObject != 0) {
+ mCloser = sRegistry.registerNativeAllocation(this, nativeObject);
}
+ mNativeObject = nativeObject;
}
- /***
- * @return if the device can support fp16.
+ /**
+ * @return True if the device can support fp16, false otherwise.
*/
public boolean supportFp16ForHdr() {
- return mSupportFp16ForHdr;
+ if (mNativeObject == 0) {
+ return false;
+ }
+ return nSupportFp16ForHdr(mNativeObject);
}
+
+ /**
+ * Release the local reference.
+ */
+ public void release() {
+ if (mNativeObject != 0) {
+ mCloser.run();
+ mNativeObject = 0;
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Flatten this object in to a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written.
+ * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}.
+ */
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ if (mNativeObject == 0) {
+ dest.writeInt(0);
+ return;
+ }
+ dest.writeInt(1);
+ nWriteOverlayPropertiesToParcel(mNativeObject, dest);
+ }
+
+ public static final @NonNull Parcelable.Creator<OverlayProperties> CREATOR =
+ new Parcelable.Creator<OverlayProperties>() {
+ public OverlayProperties createFromParcel(Parcel in) {
+ if (in.readInt() != 0) {
+ return new OverlayProperties(nReadOverlayPropertiesFromParcel(in));
+ }
+ return null;
+ }
+
+ public OverlayProperties[] newArray(int size) {
+ return new OverlayProperties[size];
+ }
+ };
+
+ private static native long nGetDestructor();
+ private static native boolean nSupportFp16ForHdr(long nativeObject);
+ private static native void nWriteOverlayPropertiesToParcel(long nativeObject, Parcel dest);
+ private static native long nReadOverlayPropertiesFromParcel(Parcel in);
}
diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java
index 79223f5d2414..cc397d57d838 100644
--- a/core/java/android/hardware/display/DisplayManagerGlobal.java
+++ b/core/java/android/hardware/display/DisplayManagerGlobal.java
@@ -113,7 +113,7 @@ public final class DisplayManagerGlobal {
private final SparseArray<DisplayInfo> mDisplayInfoCache = new SparseArray<>();
private final ColorSpace mWideColorSpace;
- private final OverlayProperties mOverlayProperties = new OverlayProperties();
+ private final OverlayProperties mOverlayProperties;
private int[] mDisplayIdCache;
private int mWifiDisplayScanNestCount;
@@ -125,6 +125,7 @@ public final class DisplayManagerGlobal {
mWideColorSpace =
ColorSpace.get(
ColorSpace.Named.values()[mDm.getPreferredWideGamutColorSpaceId()]);
+ mOverlayProperties = mDm.getOverlaySupport();
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
@@ -728,7 +729,11 @@ public final class DisplayManagerGlobal {
return mWideColorSpace;
}
- /** @hide */
+ /**
+ * Gets the overlay properties for all displays.
+ *
+ * @hide
+ */
public OverlayProperties getOverlaySupport() {
return mOverlayProperties;
}
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
index b166e215075a..6b5594b1a3dd 100644
--- a/core/java/android/hardware/display/IDisplayManager.aidl
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -18,6 +18,7 @@ package android.hardware.display;
import android.content.pm.ParceledListSlice;
import android.graphics.Point;
+import android.hardware.OverlayProperties;
import android.hardware.display.BrightnessConfiguration;
import android.hardware.display.BrightnessInfo;
import android.hardware.display.Curve;
@@ -192,4 +193,7 @@ interface IDisplayManager {
// to set the layerStack after the display was created, which is not something we support in
// DMS. This should be deleted in V release.
void setDisplayIdToMirror(in IBinder token, int displayId);
+
+ // Query overlay properties of the device
+ OverlayProperties getOverlaySupport();
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 7199e57e7970..5933ae4f8ca4 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -1291,7 +1291,10 @@ public final class Display {
}
}
- /** @hide */
+ /**
+ * Returns null if it's virtual display.
+ * @hide
+ */
@Nullable
public OverlayProperties getOverlaySupport() {
synchronized (mLock) {
@@ -1299,7 +1302,7 @@ public final class Display {
if (mDisplayInfo.type != TYPE_VIRTUAL) {
return mGlobal.getOverlaySupport();
}
- return new OverlayProperties();
+ return null;
}
}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 06851de95f82..e1ca0f139113 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -47,6 +47,7 @@ import android.graphics.Region;
import android.gui.DropInputMode;
import android.hardware.DataSpace;
import android.hardware.HardwareBuffer;
+import android.hardware.OverlayProperties;
import android.hardware.SyncFence;
import android.hardware.display.DeviceProductInfo;
import android.hardware.display.DisplayManager;
@@ -201,6 +202,7 @@ public final class SurfaceControl implements Parcelable {
private static native DisplayPrimaries nativeGetDisplayNativePrimaries(
IBinder displayToken);
private static native int[] nativeGetCompositionDataspaces();
+ private static native OverlayProperties nativeGetOverlaySupport();
private static native boolean nativeSetActiveColorMode(IBinder displayToken,
int colorMode);
private static native boolean nativeGetBootDisplayModeSupport();
@@ -2044,6 +2046,14 @@ public final class SurfaceControl implements Parcelable {
}
/**
+ * @return the overlay properties of the device
+ * @hide
+ */
+ public static OverlayProperties getOverlaySupport() {
+ return nativeGetOverlaySupport();
+ }
+
+ /**
* @hide
*/
public static boolean getBootDisplayModeSupport() {
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index cc3d90635b32..d8b91c7dca79 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -192,6 +192,7 @@ cc_library_shared {
"android_hardware_display_DisplayManagerGlobal.cpp",
"android_hardware_display_DisplayViewport.cpp",
"android_hardware_HardwareBuffer.cpp",
+ "android_hardware_OverlayProperties.cpp",
"android_hardware_SensorManager.cpp",
"android_hardware_SerialPort.cpp",
"android_hardware_SyncFence.cpp",
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 0798110134f8..f549cd828e7d 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -82,6 +82,7 @@ extern int register_android_hardware_camera2_impl_CameraExtensionJpegProcessor(J
extern int register_android_hardware_camera2_utils_SurfaceUtils(JNIEnv* env);
extern int register_android_hardware_display_DisplayManagerGlobal(JNIEnv* env);
extern int register_android_hardware_HardwareBuffer(JNIEnv *env);
+extern int register_android_hardware_OverlayProperties(JNIEnv* env);
extern int register_android_hardware_SensorManager(JNIEnv *env);
extern int register_android_hardware_SerialPort(JNIEnv *env);
extern int register_android_hardware_SyncFence(JNIEnv* env);
@@ -1603,6 +1604,7 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_android_hardware_camera2_utils_SurfaceUtils),
REG_JNI(register_android_hardware_display_DisplayManagerGlobal),
REG_JNI(register_android_hardware_HardwareBuffer),
+ REG_JNI(register_android_hardware_OverlayProperties),
REG_JNI(register_android_hardware_SensorManager),
REG_JNI(register_android_hardware_SerialPort),
REG_JNI(register_android_hardware_SyncFence),
diff --git a/core/jni/android_hardware_OverlayProperties.cpp b/core/jni/android_hardware_OverlayProperties.cpp
new file mode 100644
index 000000000000..a96af8628e62
--- /dev/null
+++ b/core/jni/android_hardware_OverlayProperties.cpp
@@ -0,0 +1,147 @@
+/**
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "OverlayProperties"
+// #define LOG_NDEBUG 0
+
+#include <android/gui/OverlayProperties.h>
+#include <binder/Parcel.h>
+#include <gui/SurfaceComposerClient.h>
+#include <nativehelper/JNIHelp.h>
+
+#include "android_os_Parcel.h"
+#include "core_jni_helpers.h"
+#include "jni.h"
+
+using namespace android;
+
+// ----------------------------------------------------------------------------
+// Types
+// ----------------------------------------------------------------------------
+static struct {
+ jclass clazz;
+ jmethodID ctor;
+} gOverlayPropertiesClassInfo;
+
+// ----------------------------------------------------------------------------
+// OverlayProperties lifecycle
+// ----------------------------------------------------------------------------
+
+static void destroyOverlayProperties(gui::OverlayProperties* overlayProperties) {
+ delete overlayProperties;
+}
+
+static jlong android_hardware_OverlayProperties_getDestructor(JNIEnv*, jclass) {
+ return static_cast<jlong>(reinterpret_cast<uintptr_t>(&destroyOverlayProperties));
+}
+
+//----------------------------------------------------------------------------
+// Accessors
+// ----------------------------------------------------------------------------
+
+static jboolean android_hardware_OverlayProperties_supportFp16ForHdr(JNIEnv* env, jobject thiz,
+ jlong nativeObject) {
+ gui::OverlayProperties* properties = reinterpret_cast<gui::OverlayProperties*>(nativeObject);
+ if (properties != nullptr) {
+ for (const auto& i : properties->combinations) {
+ if (std::find(i.pixelFormats.begin(), i.pixelFormats.end(),
+ static_cast<int32_t>(HAL_PIXEL_FORMAT_RGBA_FP16)) !=
+ i.pixelFormats.end() &&
+ std::find(i.dataspaces.begin(), i.dataspaces.end(),
+ static_cast<int32_t>(HAL_DATASPACE_BT2020_PQ)) != i.dataspaces.end()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// Serialization
+// ----------------------------------------------------------------------------
+
+static void android_hardware_OverlayProperties_write(JNIEnv* env, jclass, jlong nativeObject,
+ jobject dest) {
+ Parcel* parcel = parcelForJavaObject(env, dest);
+ if (parcel == nullptr) {
+ jniThrowNullPointerException(env, nullptr);
+ return;
+ }
+ gui::OverlayProperties* overlayProperties =
+ reinterpret_cast<gui::OverlayProperties*>(nativeObject);
+ if (overlayProperties != nullptr) {
+ overlayProperties->writeToParcel(parcel);
+ }
+}
+
+static long android_hardware_OverlayProperties_read(JNIEnv* env, jclass, jobject in) {
+ Parcel* parcel = parcelForJavaObject(env, in);
+ if (parcel == nullptr) {
+ jniThrowNullPointerException(env, nullptr);
+ return 0;
+ }
+ gui::OverlayProperties* overlayProperties = new gui::OverlayProperties;
+ if (overlayProperties->readFromParcel(parcel) != NO_ERROR) {
+ delete overlayProperties;
+ return 0;
+ }
+ return reinterpret_cast<jlong>(overlayProperties);
+}
+
+// ----------------------------------------------------------------------------
+// Public functions
+// ----------------------------------------------------------------------------
+
+namespace android {
+
+jobject android_hardware_OverlayProperties_convertToJavaObject(
+ JNIEnv* env, gui::OverlayProperties* overlayProperties) {
+ jobject overlayPropertiesObj =
+ env->NewObject(gOverlayPropertiesClassInfo.clazz, gOverlayPropertiesClassInfo.ctor,
+ reinterpret_cast<jlong>(overlayProperties));
+ return overlayPropertiesObj;
+}
+
+}; // namespace android
+
+// ----------------------------------------------------------------------------
+// JNI Glue
+// ----------------------------------------------------------------------------
+
+const char* const kClassPathName = "android/hardware/OverlayProperties";
+
+// clang-format off
+static const JNINativeMethod gMethods[] = {
+ { "nGetDestructor", "()J", (void*) android_hardware_OverlayProperties_getDestructor },
+ { "nSupportFp16ForHdr", "(J)Z",
+ (void*) android_hardware_OverlayProperties_supportFp16ForHdr },
+ { "nWriteOverlayPropertiesToParcel", "(JLandroid/os/Parcel;)V",
+ (void*) android_hardware_OverlayProperties_write },
+ { "nReadOverlayPropertiesFromParcel", "(Landroid/os/Parcel;)J",
+ (void*) android_hardware_OverlayProperties_read },
+};
+// clang-format on
+
+int register_android_hardware_OverlayProperties(JNIEnv* env) {
+ int err = RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
+
+ jclass clazz = FindClassOrDie(env, "android/hardware/OverlayProperties");
+ gOverlayPropertiesClassInfo.clazz = MakeGlobalRefOrDie(env, clazz);
+ gOverlayPropertiesClassInfo.ctor =
+ GetMethodIDOrDie(env, gOverlayPropertiesClassInfo.clazz, "<init>", "(J)V");
+
+ return err;
+}
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index eaec58bee646..5a0a84b9a4ba 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -27,6 +27,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/android_graphics_GraphicBuffer.h>
#include <android_runtime/android_hardware_HardwareBuffer.h>
+#include <android_runtime/android_hardware_OverlayProperties.h>
#include <android_runtime/android_view_Surface.h>
#include <android_runtime/android_view_SurfaceControl.h>
#include <android_runtime/android_view_SurfaceSession.h>
@@ -1346,6 +1347,15 @@ static jintArray nativeGetCompositionDataspaces(JNIEnv* env, jclass) {
return array;
}
+static jobject nativeGetOverlaySupport(JNIEnv* env, jclass) {
+ gui::OverlayProperties* overlayProperties = new gui::OverlayProperties;
+ if (SurfaceComposerClient::getOverlaySupport(overlayProperties) != NO_ERROR) {
+ delete overlayProperties;
+ return nullptr;
+ }
+ return android_hardware_OverlayProperties_convertToJavaObject(env, overlayProperties);
+}
+
static jboolean nativeSetActiveColorMode(JNIEnv* env, jclass,
jobject tokenObj, jint colorMode) {
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
@@ -2025,6 +2035,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetGameContentType },
{"nativeGetCompositionDataspaces", "()[I",
(void*)nativeGetCompositionDataspaces},
+ {"nativeGetOverlaySupport", "()Landroid/hardware/OverlayProperties;",
+ (void*) nativeGetOverlaySupport},
{"nativeClearContentFrameStats", "(J)Z",
(void*)nativeClearContentFrameStats },
{"nativeGetContentFrameStats", "(JLandroid/view/WindowContentFrameStats;)Z",
diff --git a/core/jni/include/android_runtime/android_hardware_OverlayProperties.h b/core/jni/include/android_runtime/android_hardware_OverlayProperties.h
new file mode 100644
index 000000000000..372cca9456ab
--- /dev/null
+++ b/core/jni/include/android_runtime/android_hardware_OverlayProperties.h
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ANDROID_HARDWARE_OVERLAYPROPERTIES_H
+#define _ANDROID_HARDWARE_OVERLAYPROPERTIES_H
+
+#include <android/gui/OverlayProperties.h>
+
+#include "jni.h"
+
+namespace android {
+
+extern jobject android_hardware_OverlayProperties_convertToJavaObject(
+ JNIEnv* env, gui::OverlayProperties* overlayProperties);
+
+}; // namespace android
+
+#endif // _ANDROID_HARDWARE_OVERLAYPROPERTIES_H
diff --git a/graphics/java/android/graphics/HardwareRenderer.java b/graphics/java/android/graphics/HardwareRenderer.java
index 48dd3e6c451b..d8873c4d5f64 100644
--- a/graphics/java/android/graphics/HardwareRenderer.java
+++ b/graphics/java/android/graphics/HardwareRenderer.java
@@ -25,6 +25,7 @@ import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
+import android.hardware.OverlayProperties;
import android.hardware.display.DisplayManager;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
@@ -1321,6 +1322,9 @@ public class HardwareRenderer {
// memory policy in play will interpret these values differently.
int largestWidth = activeMode.getPhysicalWidth();
int largestHeight = activeMode.getPhysicalHeight();
+ final OverlayProperties overlayProperties = defaultDisplay.getOverlaySupport();
+ boolean supportFp16ForHdr = overlayProperties != null
+ ? overlayProperties.supportFp16ForHdr() : false;
for (int i = 0; i < allDisplays.length; i++) {
final Display display = allDisplays[i];
@@ -1348,7 +1352,7 @@ public class HardwareRenderer {
nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(),
wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(),
defaultDisplay.getPresentationDeadlineNanos(),
- defaultDisplay.getOverlaySupport().supportFp16ForHdr());
+ supportFp16ForHdr);
mDisplayInitialized = true;
}
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 78b697d13f7b..fcb7b577bf13 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -58,6 +58,7 @@ import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.graphics.ColorSpace;
import android.graphics.Point;
+import android.hardware.OverlayProperties;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.hardware.devicestate.DeviceStateManager;
@@ -411,6 +412,7 @@ public final class DisplayManagerService extends SystemService {
private final Curve mMinimumBrightnessCurve;
private final Spline mMinimumBrightnessSpline;
private final ColorSpace mWideColorSpace;
+ private final OverlayProperties mOverlayProperties;
private SensorManager mSensorManager;
private BrightnessTracker mBrightnessTracker;
@@ -503,6 +505,7 @@ public final class DisplayManagerService extends SystemService {
mCurrentUserId = UserHandle.USER_SYSTEM;
ColorSpace[] colorSpaces = SurfaceControl.getCompositionColorSpaces();
mWideColorSpace = colorSpaces[1];
+ mOverlayProperties = SurfaceControl.getOverlaySupport();
mAllowNonNativeRefreshRateOverride = mInjector.getAllowNonNativeRefreshRateOverride();
mSystemReady = false;
}
@@ -1785,6 +1788,10 @@ public final class DisplayManagerService extends SystemService {
return mWideColorSpace.getId();
}
+ OverlayProperties getOverlaySupportInternal() {
+ return mOverlayProperties;
+ }
+
void setUserPreferredDisplayModeInternal(int displayId, Display.Mode mode) {
synchronized (mSyncRoot) {
if (mode != null && !isResolutionAndRefreshRateValid(mode)
@@ -3597,6 +3604,16 @@ public final class DisplayManagerService extends SystemService {
}
}
}
+
+ @Override
+ public OverlayProperties getOverlaySupport() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return getOverlaySupportInternal();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
}
private static boolean isValidBrightness(float brightness) {