Hdr format settings [UX]

Adding new APIs in display manager to get the user disabled formats, to get the formats
supported by device and get formats reported by display.

Bug: 172905239
Test: N/A
Change-Id: I58a7714f03a3e165bbd22f2fa7a021ad90b41b39
This commit is contained in:
Kriti Dang
2021-01-18 17:54:36 +01:00
parent 7c9201db31
commit 25f1822005
6 changed files with 49 additions and 0 deletions

View File

@@ -1138,6 +1138,7 @@ package android.hardware.display {
public final class DisplayManager {
method public boolean areUserDisabledHdrTypesAllowed();
method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public int getRefreshRateSwitchingType();
method @NonNull public int[] getUserDisabledHdrTypes();
method public boolean isMinimalPostProcessingRequested(int);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAreUserDisabledHdrTypesAllowed(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public void setRefreshRateSwitchingType(int);
@@ -2595,6 +2596,7 @@ package android.view {
}
public final class Display {
method @NonNull public int[] getReportedHdrTypes();
method @NonNull public android.graphics.ColorSpace[] getSupportedWideColorGamut();
method public int getType();
method public boolean hasAccess(int);

View File

@@ -747,6 +747,17 @@ public final class DisplayManager {
return mGlobal.areUserDisabledHdrTypesAllowed();
}
/**
* Returns the HDR formats disabled by the user.
*
* @hide
*/
@TestApi
public @NonNull int[] getUserDisabledHdrTypes() {
return mGlobal.getUserDisabledHdrTypes();
}
/**
* Creates a virtual display.
*

View File

@@ -551,6 +551,18 @@ public final class DisplayManagerGlobal {
}
}
/**
* Returns the HDR formats disabled by the user.
*
*/
public int[] getUserDisabledHdrTypes() {
try {
return mDm.getUserDisabledHdrTypes();
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
public void requestColorMode(int displayId, int colorMode) {
try {
mDm.requestColorMode(displayId, colorMode);

View File

@@ -77,6 +77,9 @@ interface IDisplayManager {
// No permissions required.
boolean areUserDisabledHdrTypesAllowed();
// No permissions required.
int[] getUserDisabledHdrTypes();
// Requires CONFIGURE_DISPLAY_COLOR_MODE
void requestColorMode(int displayId, int colorMode);

View File

@@ -1095,6 +1095,22 @@ public final class Display {
}
}
/**
* @hide
* Returns the display's HDR supported types.
*
* @see #isHdr()
* @see HdrCapabilities#getSupportedHdrTypes()
*/
@TestApi
@NonNull
public int[] getReportedHdrTypes() {
synchronized (mLock) {
updateDisplayInfoLocked();
return mDisplayInfo.hdrCapabilities.getSupportedHdrTypes();
}
}
/**
* Returns whether this display supports any HDR type.
*

View File

@@ -2479,6 +2479,11 @@ public final class DisplayManagerService extends SystemService {
}
}
@Override // Binder call
public int[] getUserDisabledHdrTypes() {
return mUserDisabledHdrTypes;
}
@Override // Binder call
public void requestColorMode(int displayId, int colorMode) {
mContext.enforceCallingOrSelfPermission(