Merge "Plumb overlayPropertes into DMS side."
This commit is contained in:
19
core/java/android/hardware/OverlayProperties.aidl
Normal file
19
core/java/android/hardware/OverlayProperties.aidl
Normal file
@@ -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;
|
||||
@@ -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;
|
||||
public final class OverlayProperties implements Parcelable {
|
||||
|
||||
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;
|
||||
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 True if the device can support fp16, false otherwise.
|
||||
*/
|
||||
public boolean supportFp16ForHdr() {
|
||||
if (mNativeObject == 0) {
|
||||
return false;
|
||||
}
|
||||
return nSupportFp16ForHdr(mNativeObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the local reference.
|
||||
*/
|
||||
public void release() {
|
||||
if (mNativeObject != 0) {
|
||||
mCloser.run();
|
||||
mNativeObject = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* @return if the device can support fp16.
|
||||
*/
|
||||
public boolean supportFp16ForHdr() {
|
||||
return mSupportFp16ForHdr;
|
||||
@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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
@@ -2043,6 +2045,14 @@ public final class SurfaceControl implements Parcelable {
|
||||
return colorSpaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the overlay properties of the device
|
||||
* @hide
|
||||
*/
|
||||
public static OverlayProperties getOverlaySupport() {
|
||||
return nativeGetOverlaySupport();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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),
|
||||
|
||||
147
core/jni/android_hardware_OverlayProperties.cpp
Normal file
147
core/jni/android_hardware_OverlayProperties.cpp
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -1330,6 +1331,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];
|
||||
@@ -1357,7 +1361,7 @@ public class HardwareRenderer {
|
||||
nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(),
|
||||
wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(),
|
||||
defaultDisplay.getPresentationDeadlineNanos(),
|
||||
defaultDisplay.getOverlaySupport().supportFp16ForHdr());
|
||||
supportFp16ForHdr);
|
||||
|
||||
mDisplayInitialized = true;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user