summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pechetty Sravani (xWF) <pechetty@google.com> 2024-09-02 01:49:04 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-09-02 01:49:04 +0000
commit46d6dcdf53dee0f32151ad74d57b495fef5e6906 (patch)
treee371a43f613c9af08647f764c1fc5fa10e90febc
parent5273932dcfb841e6af75d819d397afdfc135330e (diff)
Revert "Fix Framework code for HDR bugs"
Revert submission 26927817-Hdr-settings-updates Reason for revert: Droidmonitor created revert due to b/363406718. Reverted changes: /q/submissionid:26927817-Hdr-settings-updates Change-Id: I4a7d934848224d870aaea697249be052479deadc
-rw-r--r--core/java/android/view/Display.java3
-rw-r--r--core/java/android/view/DisplayInfo.java9
-rw-r--r--services/core/java/com/android/server/display/DisplayControl.java2
-rw-r--r--services/core/java/com/android/server/display/DisplayDeviceInfo.java8
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java145
-rw-r--r--services/core/java/com/android/server/display/LogicalDisplay.java24
-rw-r--r--services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java123
7 files changed, 72 insertions, 242 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index f55253d24d96..1f7ed8be357c 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -1331,7 +1331,7 @@ public final class Display {
public HdrCapabilities getHdrCapabilities() {
synchronized (mLock) {
updateDisplayInfoLocked();
- if (mDisplayInfo.hdrCapabilities == null || mDisplayInfo.isForceSdr) {
+ if (mDisplayInfo.hdrCapabilities == null) {
return null;
}
int[] supportedHdrTypes;
@@ -1353,7 +1353,6 @@ public final class Display {
supportedHdrTypes[index++] = enabledType;
}
}
-
return new HdrCapabilities(supportedHdrTypes,
mDisplayInfo.hdrCapabilities.mMaxLuminance,
mDisplayInfo.hdrCapabilities.mMaxAverageLuminance,
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index cac3e3c25098..157cec8a4d0f 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -230,9 +230,6 @@ public final class DisplayInfo implements Parcelable {
/** The formats disabled by user **/
public int[] userDisabledHdrTypes = {};
- /** When true, all HDR capabilities are disabled **/
- public boolean isForceSdr;
-
/**
* Indicates whether the display can be switched into a mode with minimal post
* processing.
@@ -443,7 +440,6 @@ public final class DisplayInfo implements Parcelable {
&& colorMode == other.colorMode
&& Arrays.equals(supportedColorModes, other.supportedColorModes)
&& Objects.equals(hdrCapabilities, other.hdrCapabilities)
- && isForceSdr == other.isForceSdr
&& Arrays.equals(userDisabledHdrTypes, other.userDisabledHdrTypes)
&& minimalPostProcessingSupported == other.minimalPostProcessingSupported
&& logicalDensityDpi == other.logicalDensityDpi
@@ -506,7 +502,6 @@ public final class DisplayInfo implements Parcelable {
supportedColorModes = Arrays.copyOf(
other.supportedColorModes, other.supportedColorModes.length);
hdrCapabilities = other.hdrCapabilities;
- isForceSdr = other.isForceSdr;
userDisabledHdrTypes = other.userDisabledHdrTypes;
minimalPostProcessingSupported = other.minimalPostProcessingSupported;
logicalDensityDpi = other.logicalDensityDpi;
@@ -572,7 +567,6 @@ public final class DisplayInfo implements Parcelable {
supportedColorModes[i] = source.readInt();
}
hdrCapabilities = source.readParcelable(null, android.view.Display.HdrCapabilities.class);
- isForceSdr = source.readBoolean();
minimalPostProcessingSupported = source.readBoolean();
logicalDensityDpi = source.readInt();
physicalXDpi = source.readFloat();
@@ -642,7 +636,6 @@ public final class DisplayInfo implements Parcelable {
dest.writeInt(supportedColorModes[i]);
}
dest.writeParcelable(hdrCapabilities, flags);
- dest.writeBoolean(isForceSdr);
dest.writeBoolean(minimalPostProcessingSupported);
dest.writeInt(logicalDensityDpi);
dest.writeFloat(physicalXDpi);
@@ -881,8 +874,6 @@ public final class DisplayInfo implements Parcelable {
sb.append(Arrays.toString(appsSupportedModes));
sb.append(", hdrCapabilities ");
sb.append(hdrCapabilities);
- sb.append(", isForceSdr ");
- sb.append(isForceSdr);
sb.append(", userDisabledHdrTypes ");
sb.append(Arrays.toString(userDisabledHdrTypes));
sb.append(", minimalPostProcessingSupported ");
diff --git a/services/core/java/com/android/server/display/DisplayControl.java b/services/core/java/com/android/server/display/DisplayControl.java
index ddea285d3564..38eb416ffdd8 100644
--- a/services/core/java/com/android/server/display/DisplayControl.java
+++ b/services/core/java/com/android/server/display/DisplayControl.java
@@ -109,7 +109,7 @@ public class DisplayControl {
/**
* Sets the HDR conversion mode for the device.
*
- * Returns the system preferred HDR output type in case when HDR conversion mode is
+ * Returns the system preferred Hdr output type nn case when HDR conversion mode is
* {@link android.hardware.display.HdrConversionMode#HDR_CONVERSION_SYSTEM}.
* Returns Hdr::INVALID in other cases.
* @hide
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index acf4db30ba93..93bd92614403 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -318,16 +318,13 @@ final class DisplayDeviceInfo {
*/
public Display.HdrCapabilities hdrCapabilities;
- /** When true, all HDR capabilities are hidden from public APIs */
- public boolean isForceSdr;
-
/**
* Indicates whether this display supports Auto Low Latency Mode.
*/
public boolean allmSupported;
/**
- * Indicates whether this display supports Game content type.
+ * Indicates whether this display suppors Game content type.
*/
public boolean gameContentTypeSupported;
@@ -519,7 +516,6 @@ final class DisplayDeviceInfo {
|| !Arrays.equals(supportedModes, other.supportedModes)
|| !Arrays.equals(supportedColorModes, other.supportedColorModes)
|| !Objects.equals(hdrCapabilities, other.hdrCapabilities)
- || isForceSdr != other.isForceSdr
|| allmSupported != other.allmSupported
|| gameContentTypeSupported != other.gameContentTypeSupported
|| densityDpi != other.densityDpi
@@ -564,7 +560,6 @@ final class DisplayDeviceInfo {
colorMode = other.colorMode;
supportedColorModes = other.supportedColorModes;
hdrCapabilities = other.hdrCapabilities;
- isForceSdr = other.isForceSdr;
allmSupported = other.allmSupported;
gameContentTypeSupported = other.gameContentTypeSupported;
densityDpi = other.densityDpi;
@@ -608,7 +603,6 @@ final class DisplayDeviceInfo {
sb.append(", colorMode ").append(colorMode);
sb.append(", supportedColorModes ").append(Arrays.toString(supportedColorModes));
sb.append(", hdrCapabilities ").append(hdrCapabilities);
- sb.append(", isForceSdr ").append(isForceSdr);
sb.append(", allmSupported ").append(allmSupported);
sb.append(", gameContentTypeSupported ").append(gameContentTypeSupported);
sb.append(", density ").append(densityDpi);
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 1813c2eb3242..187caba4db03 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -48,7 +48,6 @@ import static android.os.Process.ROOT_UID;
import static android.provider.Settings.Secure.RESOLUTION_MODE_FULL;
import static android.provider.Settings.Secure.RESOLUTION_MODE_HIGH;
import static android.provider.Settings.Secure.RESOLUTION_MODE_UNKNOWN;
-import static android.view.Display.HdrCapabilities.HDR_TYPE_INVALID;
import static com.android.server.display.layout.Layout.Display.POSITION_REAR;
@@ -283,7 +282,7 @@ public final class DisplayManagerService extends SystemService {
@GuardedBy("mSyncRoot")
private int[] mUserDisabledHdrTypes = {};
@Display.HdrCapabilities.HdrType
- private int[] mSupportedHdrOutputTypes;
+ private int[] mSupportedHdrOutputType;
@GuardedBy("mSyncRoot")
private boolean mAreUserDisabledHdrTypesAllowed = true;
@@ -298,10 +297,10 @@ public final class DisplayManagerService extends SystemService {
// HDR conversion mode chosen by user
@GuardedBy("mSyncRoot")
private HdrConversionMode mHdrConversionMode = null;
- // Whether app has disabled HDR conversion
- private boolean mShouldDisableHdrConversion = false;
+ // Actual HDR conversion mode, which takes app overrides into account.
+ private HdrConversionMode mOverrideHdrConversionMode = null;
@GuardedBy("mSyncRoot")
- private int mSystemPreferredHdrOutputType = HDR_TYPE_INVALID;
+ private int mSystemPreferredHdrOutputType = Display.HdrCapabilities.HDR_TYPE_INVALID;
// The synchronization root for the display manager.
@@ -1408,8 +1407,7 @@ public final class DisplayManagerService extends SystemService {
}
}
- @VisibleForTesting
- void setUserDisabledHdrTypesInternal(int[] userDisabledHdrTypes) {
+ private void setUserDisabledHdrTypesInternal(int[] userDisabledHdrTypes) {
synchronized (mSyncRoot) {
if (userDisabledHdrTypes == null) {
Slog.e(TAG, "Null is not an expected argument to "
@@ -1427,7 +1425,6 @@ public final class DisplayManagerService extends SystemService {
if (Arrays.equals(mUserDisabledHdrTypes, userDisabledHdrTypes)) {
return;
}
-
String userDisabledFormatsString = "";
if (userDisabledHdrTypes.length != 0) {
userDisabledFormatsString = TextUtils.join(",",
@@ -1443,15 +1440,6 @@ public final class DisplayManagerService extends SystemService {
handleLogicalDisplayChangedLocked(display);
});
}
- /** Note: it may be expected to reset the Conversion Mode when an HDR type is enabled
- and the Conversion Mode is set to System Preferred. This is handled in the Settings
- code because in the special case where HDR is indirectly disabled by Force SDR
- Conversion, manually enabling HDR is not recognized as an action that reduces the
- disabled HDR count. Thus, this case needs to be checked in the Settings code when we
- know we're enabling an HDR mode. If we split checking for SystemConversion and
- isForceSdr in two places, we may have duplicate calls to resetting to System Conversion
- and get two black screens.
- */
}
}
@@ -1464,20 +1452,19 @@ public final class DisplayManagerService extends SystemService {
return true;
}
- @VisibleForTesting
- void setAreUserDisabledHdrTypesAllowedInternal(
+ private void setAreUserDisabledHdrTypesAllowedInternal(
boolean areUserDisabledHdrTypesAllowed) {
synchronized (mSyncRoot) {
if (mAreUserDisabledHdrTypesAllowed == areUserDisabledHdrTypesAllowed) {
return;
}
mAreUserDisabledHdrTypesAllowed = areUserDisabledHdrTypesAllowed;
- Settings.Global.putInt(mContext.getContentResolver(),
- Settings.Global.ARE_USER_DISABLED_HDR_FORMATS_ALLOWED,
- areUserDisabledHdrTypesAllowed ? 1 : 0);
if (mUserDisabledHdrTypes.length == 0) {
return;
}
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.ARE_USER_DISABLED_HDR_FORMATS_ALLOWED,
+ areUserDisabledHdrTypesAllowed ? 1 : 0);
int userDisabledHdrTypes[] = {};
if (!mAreUserDisabledHdrTypesAllowed) {
userDisabledHdrTypes = mUserDisabledHdrTypes;
@@ -1488,14 +1475,6 @@ public final class DisplayManagerService extends SystemService {
display.setUserDisabledHdrTypes(finalUserDisabledHdrTypes);
handleLogicalDisplayChangedLocked(display);
});
- // When HDR conversion mode is set to SYSTEM, modification to
- // areUserDisabledHdrTypesAllowed requires refreshing the HDR conversion mode to tell
- // the system which HDR types it is not allowed to use.
- if (getHdrConversionModeInternal().getConversionMode()
- == HdrConversionMode.HDR_CONVERSION_SYSTEM) {
- setHdrConversionModeInternal(
- new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_SYSTEM));
- }
}
}
@@ -2369,7 +2348,7 @@ public final class DisplayManagerService extends SystemService {
final int preferredHdrOutputType =
hdrConversionMode.getConversionMode() == HdrConversionMode.HDR_CONVERSION_FORCE
? hdrConversionMode.getPreferredHdrOutputType()
- : HDR_TYPE_INVALID;
+ : Display.HdrCapabilities.HDR_TYPE_INVALID;
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.HDR_FORCE_CONVERSION_TYPE, preferredHdrOutputType);
}
@@ -2382,7 +2361,7 @@ public final class DisplayManagerService extends SystemService {
? Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.HDR_FORCE_CONVERSION_TYPE,
Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION)
- : HDR_TYPE_INVALID;
+ : Display.HdrCapabilities.HDR_TYPE_INVALID;
mHdrConversionMode = new HdrConversionMode(conversionMode, preferredHdrOutputType);
setHdrConversionModeInternal(mHdrConversionMode);
}
@@ -2519,38 +2498,22 @@ public final class DisplayManagerService extends SystemService {
});
}
- /**
- * Returns the HDR output types that are supported by the device's HDR conversion capabilities,
- * stripping out any user-disabled HDR types if mAreUserDisabledHdrTypesAllowed is false.
- */
@GuardedBy("mSyncRoot")
- @VisibleForTesting
- int[] getEnabledHdrOutputTypesLocked() {
- if (mAreUserDisabledHdrTypesAllowed) {
- return getSupportedHdrOutputTypesInternal();
- }
- // Strip out all HDR formats that are currently user-disabled
- IntArray enabledHdrOutputTypesArray = new IntArray();
+ private int[] getEnabledAutoHdrTypesLocked() {
+ IntArray autoHdrOutputTypesArray = new IntArray();
for (int type : getSupportedHdrOutputTypesInternal()) {
- boolean isEnabled = true;
+ boolean isDisabled = false;
for (int disabledType : mUserDisabledHdrTypes) {
if (type == disabledType) {
- isEnabled = false;
+ isDisabled = true;
break;
}
}
- if (isEnabled) {
- enabledHdrOutputTypesArray.add(type);
+ if (!isDisabled) {
+ autoHdrOutputTypesArray.add(type);
}
}
- return enabledHdrOutputTypesArray.toArray();
- }
-
- @VisibleForTesting
- int[] getEnabledHdrOutputTypes() {
- synchronized (mSyncRoot) {
- return getEnabledHdrOutputTypesLocked();
- }
+ return autoHdrOutputTypesArray.toArray();
}
@GuardedBy("mSyncRoot")
@@ -2559,7 +2522,7 @@ public final class DisplayManagerService extends SystemService {
final int preferredHdrOutputType =
mode.getConversionMode() == HdrConversionMode.HDR_CONVERSION_SYSTEM
? mSystemPreferredHdrOutputType : mode.getPreferredHdrOutputType();
- if (preferredHdrOutputType != HDR_TYPE_INVALID) {
+ if (preferredHdrOutputType != Display.HdrCapabilities.HDR_TYPE_INVALID) {
int[] hdrTypesWithLatency = mInjector.getHdrOutputTypesWithLatency();
return ArrayUtils.contains(hdrTypesWithLatency, preferredHdrOutputType);
}
@@ -2593,57 +2556,41 @@ public final class DisplayManagerService extends SystemService {
if (!mInjector.getHdrOutputConversionSupport()) {
return;
}
-
+ int[] autoHdrOutputTypes = null;
synchronized (mSyncRoot) {
if (hdrConversionMode.getConversionMode() == HdrConversionMode.HDR_CONVERSION_SYSTEM
&& hdrConversionMode.getPreferredHdrOutputType()
- != HDR_TYPE_INVALID) {
+ != Display.HdrCapabilities.HDR_TYPE_INVALID) {
throw new IllegalArgumentException("preferredHdrOutputType must not be set if"
+ " the conversion mode is HDR_CONVERSION_SYSTEM");
}
mHdrConversionMode = hdrConversionMode;
storeHdrConversionModeLocked(mHdrConversionMode);
- // If the HDR conversion is HDR_CONVERSION_SYSTEM, all supported HDR types are allowed
- // except the ones specifically disabled by the user.
- int[] enabledHdrOutputTypes = null;
+ // For auto mode, all supported HDR types are allowed except the ones specifically
+ // disabled by the user.
if (hdrConversionMode.getConversionMode() == HdrConversionMode.HDR_CONVERSION_SYSTEM) {
- enabledHdrOutputTypes = getEnabledHdrOutputTypesLocked();
+ autoHdrOutputTypes = getEnabledAutoHdrTypesLocked();
}
int conversionMode = hdrConversionMode.getConversionMode();
int preferredHdrType = hdrConversionMode.getPreferredHdrOutputType();
-
// If the HDR conversion is disabled by an app through WindowManager.LayoutParams, then
// set HDR conversion mode to HDR_CONVERSION_PASSTHROUGH.
- if (mShouldDisableHdrConversion) {
- conversionMode = HdrConversionMode.HDR_CONVERSION_PASSTHROUGH;
- preferredHdrType = -1;
- enabledHdrOutputTypes = null;
- } else {
+ if (mOverrideHdrConversionMode == null) {
// HDR_CONVERSION_FORCE with HDR_TYPE_INVALID is used to represent forcing SDR type.
- // But, internally SDR is forced by using passthrough mode and not reporting any
- // HDR capabilities to apps.
+ // But, internally SDR is selected by using passthrough mode.
if (conversionMode == HdrConversionMode.HDR_CONVERSION_FORCE
- && preferredHdrType == HDR_TYPE_INVALID) {
+ && preferredHdrType == Display.HdrCapabilities.HDR_TYPE_INVALID) {
conversionMode = HdrConversionMode.HDR_CONVERSION_PASSTHROUGH;
- mLogicalDisplayMapper.forEachLocked(
- logicalDisplay -> {
- if (logicalDisplay.setIsForceSdr(true)) {
- handleLogicalDisplayChangedLocked(logicalDisplay);
- }
- });
- } else {
- mLogicalDisplayMapper.forEachLocked(
- logicalDisplay -> {
- if (logicalDisplay.setIsForceSdr(false)) {
- handleLogicalDisplayChangedLocked(logicalDisplay);
- }
- });
}
+ } else {
+ conversionMode = mOverrideHdrConversionMode.getConversionMode();
+ preferredHdrType = mOverrideHdrConversionMode.getPreferredHdrOutputType();
+ autoHdrOutputTypes = null;
}
mSystemPreferredHdrOutputType = mInjector.setHdrConversionMode(
- conversionMode, preferredHdrType, enabledHdrOutputTypes);
+ conversionMode, preferredHdrType, autoHdrOutputTypes);
}
}
@@ -2665,8 +2612,8 @@ public final class DisplayManagerService extends SystemService {
}
HdrConversionMode mode;
synchronized (mSyncRoot) {
- mode = mShouldDisableHdrConversion
- ? new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_PASSTHROUGH)
+ mode = mOverrideHdrConversionMode != null
+ ? mOverrideHdrConversionMode
: mHdrConversionMode;
// Handle default: PASSTHROUGH. Don't include the system-preferred type.
if (mode == null
@@ -2674,6 +2621,8 @@ public final class DisplayManagerService extends SystemService {
return new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_PASSTHROUGH);
}
// Handle default or current mode: SYSTEM. Include the system preferred type.
+ // mOverrideHdrConversionMode and mHdrConversionMode do not include the system
+ // preferred type, it is kept separately in mSystemPreferredHdrOutputType.
if (mode == null
|| mode.getConversionMode() == HdrConversionMode.HDR_CONVERSION_SYSTEM) {
return new HdrConversionMode(
@@ -2684,10 +2633,10 @@ public final class DisplayManagerService extends SystemService {
}
private @Display.HdrCapabilities.HdrType int[] getSupportedHdrOutputTypesInternal() {
- if (mSupportedHdrOutputTypes == null) {
- mSupportedHdrOutputTypes = mInjector.getSupportedHdrOutputTypes();
+ if (mSupportedHdrOutputType == null) {
+ mSupportedHdrOutputType = mInjector.getSupportedHdrOutputTypes();
}
- return mSupportedHdrOutputTypes;
+ return mSupportedHdrOutputType;
}
void setShouldAlwaysRespectAppRequestedModeInternal(boolean enabled) {
@@ -2873,9 +2822,15 @@ public final class DisplayManagerService extends SystemService {
// HDR conversion is disabled in two cases:
// - HDR conversion introduces latency and minimal post-processing is requested
// - app requests to disable HDR conversion
- boolean previousShouldDisableHdrConversion = mShouldDisableHdrConversion;
- mShouldDisableHdrConversion = disableHdrConversion || disableHdrConversionForLatency;
- if (previousShouldDisableHdrConversion != mShouldDisableHdrConversion) {
+ if (mOverrideHdrConversionMode == null && (disableHdrConversion
+ || disableHdrConversionForLatency)) {
+ mOverrideHdrConversionMode =
+ new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_PASSTHROUGH);
+ setHdrConversionModeInternal(mHdrConversionMode);
+ handleLogicalDisplayChangedLocked(display);
+ } else if (mOverrideHdrConversionMode != null && !disableHdrConversion
+ && !disableHdrConversionForLatency) {
+ mOverrideHdrConversionMode = null;
setHdrConversionModeInternal(mHdrConversionMode);
handleLogicalDisplayChangedLocked(display);
}
@@ -3554,9 +3509,9 @@ public final class DisplayManagerService extends SystemService {
}
int setHdrConversionMode(int conversionMode, int preferredHdrOutputType,
- int[] allowedHdrOutputTypes) {
+ int[] autoHdrTypes) {
return DisplayControl.setHdrConversionMode(conversionMode, preferredHdrOutputType,
- allowedHdrOutputTypes);
+ autoHdrTypes);
}
@Display.HdrCapabilities.HdrType
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 5e42444ecf12..5d55d1904f1b 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -518,7 +518,6 @@ final class LogicalDisplay {
deviceInfo.supportedColorModes,
deviceInfo.supportedColorModes.length);
mBaseDisplayInfo.hdrCapabilities = deviceInfo.hdrCapabilities;
- mBaseDisplayInfo.isForceSdr = deviceInfo.isForceSdr;
mBaseDisplayInfo.userDisabledHdrTypes = mUserDisabledHdrTypes;
mBaseDisplayInfo.minimalPostProcessingSupported =
deviceInfo.allmSupported || deviceInfo.gameContentTypeSupported;
@@ -900,29 +899,6 @@ final class LogicalDisplay {
}
/**
- * Checks whether display is of the type where HDR settings are relevant, and then sets
- * whether Force SDR conversion mode is active. isForceSdr is checked by the Display when
- * returning HDR capabilities.
- *
- * @param isForceSdr Whether Force SDR conversion mode is active
- * @return Whether Display Manager should call handleLogicalDisplayChangedLocked()
- */
- public boolean setIsForceSdr(boolean isForceSdr) {
- int displayType = getDisplayInfoLocked().type;
- boolean isTargetDisplayType = displayType == Display.TYPE_INTERNAL
- || displayType == Display.TYPE_EXTERNAL
- || displayType == Display.TYPE_OVERLAY;
-
- boolean handleLogicalDisplayChangedLocked = false;
- if (isTargetDisplayType && mBaseDisplayInfo.isForceSdr != isForceSdr) {
- mBaseDisplayInfo.isForceSdr = isForceSdr;
- mInfo.set(null);
- handleLogicalDisplayChangedLocked = true;
- }
- return handleLogicalDisplayChangedLocked;
- }
-
- /**
* Swap the underlying {@link DisplayDevice} with the specified LogicalDisplay.
*
* @param targetDisplay The display with which to swap display-devices.
diff --git a/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java b/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
index 8f9382729119..026fcc486a92 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
+++ b/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
@@ -27,7 +27,6 @@ import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_D
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION;
import static android.view.ContentRecordingSession.RECORD_CONTENT_DISPLAY;
import static android.view.ContentRecordingSession.RECORD_CONTENT_TASK;
-import static android.view.Display.HdrCapabilities.HDR_TYPE_INVALID;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
import static com.android.server.display.ExternalDisplayPolicy.ENABLE_ON_CONNECT;
@@ -191,8 +190,8 @@ public class DisplayManagerServiceTest {
private static final String VIRTUAL_DISPLAY_NAME = "Test Virtual Display";
private static final String PACKAGE_NAME = "com.android.frameworks.displayservicetests";
private static final long STANDARD_DISPLAY_EVENTS = DisplayManager.EVENT_FLAG_DISPLAY_ADDED
- | DisplayManager.EVENT_FLAG_DISPLAY_CHANGED
- | DisplayManager.EVENT_FLAG_DISPLAY_REMOVED;
+ | DisplayManager.EVENT_FLAG_DISPLAY_CHANGED
+ | DisplayManager.EVENT_FLAG_DISPLAY_REMOVED;
private static final long STANDARD_AND_CONNECTION_DISPLAY_EVENTS =
STANDARD_DISPLAY_EVENTS | DisplayManager.EVENT_FLAG_DISPLAY_CONNECTION_CHANGED;
@@ -234,8 +233,6 @@ public class DisplayManagerServiceTest {
private UserManager mUserManager;
- private int[] mAllowedHdrOutputTypes;
-
private final DisplayManagerService.Injector mShortMockedInjector =
new DisplayManagerService.Injector() {
@Override
@@ -254,12 +251,11 @@ public class DisplayManagerServiceTest {
displayAdapterListener, flags,
mMockedDisplayNotificationManager,
new LocalDisplayAdapter.Injector() {
- @Override
- public LocalDisplayAdapter.SurfaceControlProxy
- getSurfaceControlProxy() {
- return mSurfaceControlProxy;
- }
- });
+ @Override
+ public LocalDisplayAdapter.SurfaceControlProxy getSurfaceControlProxy() {
+ return mSurfaceControlProxy;
+ }
+ });
}
@Override
@@ -319,7 +315,7 @@ public class DisplayManagerServiceTest {
@Override
int setHdrConversionMode(int conversionMode, int preferredHdrOutputType,
- int[] allowedHdrOutputTypes) {
+ int[] autoHdrTypes) {
mHdrConversionMode = conversionMode;
mPreferredHdrOutputType = preferredHdrOutputType;
return Display.HdrCapabilities.HDR_TYPE_INVALID;
@@ -1291,11 +1287,11 @@ public class DisplayManagerServiceTest {
.setUniqueId("uniqueId --- mirror display");
assertThrows(SecurityException.class, () -> {
localService.createVirtualDisplay(
- builder.build(),
- mMockAppToken /* callback */,
- null /* virtualDeviceToken */,
- mock(DisplayWindowPolicyController.class),
- PACKAGE_NAME);
+ builder.build(),
+ mMockAppToken /* callback */,
+ null /* virtualDeviceToken */,
+ mock(DisplayWindowPolicyController.class),
+ PACKAGE_NAME);
});
}
@@ -1429,7 +1425,7 @@ public class DisplayManagerServiceTest {
// The virtual display should not have FLAG_ALWAYS_UNLOCKED set.
assertEquals(0, (displayManager.getDisplayDeviceInfoInternal(displayId).flags
- & DisplayDeviceInfo.FLAG_ALWAYS_UNLOCKED));
+ & DisplayDeviceInfo.FLAG_ALWAYS_UNLOCKED));
}
/**
@@ -1462,7 +1458,7 @@ public class DisplayManagerServiceTest {
// The virtual display should not have FLAG_PRESENTATION set.
assertEquals(0, (displayManager.getDisplayDeviceInfoInternal(displayId).flags
- & DisplayDeviceInfo.FLAG_PRESENTATION));
+ & DisplayDeviceInfo.FLAG_PRESENTATION));
}
@Test
@@ -2354,7 +2350,6 @@ public class DisplayManagerServiceTest {
HdrConversionMode.HDR_CONVERSION_FORCE,
Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION);
displayManager.setHdrConversionModeInternal(mode);
-
assertEquals(mode, displayManager.getHdrConversionModeSettingInternal());
assertEquals(mode.getConversionMode(), mHdrConversionMode);
assertEquals(mode.getPreferredHdrOutputType(), mPreferredHdrOutputType);
@@ -2399,86 +2394,6 @@ public class DisplayManagerServiceTest {
}
@Test
- public void testSetAreUserDisabledHdrTypesAllowed_withFalse_whenHdrDisabled_stripsHdrType() {
- DisplayManagerService displayManager = new DisplayManagerService(
- mContext, new BasicInjector() {
- @Override
- int setHdrConversionMode(int conversionMode, int preferredHdrOutputType,
- int[] allowedTypes) {
- mAllowedHdrOutputTypes = allowedTypes;
- return Display.HdrCapabilities.HDR_TYPE_INVALID;
- }
-
- // Overriding this method to capture the allowed HDR type
- @Override
- int[] getSupportedHdrOutputTypes() {
- return new int[]{Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION};
- }
- });
-
- // Setup: no HDR types disabled, userDisabledTypes allowed, system conversion
- displayManager.setUserDisabledHdrTypesInternal(new int [0]);
- displayManager.setAreUserDisabledHdrTypesAllowedInternal(true);
- displayManager.setHdrConversionModeInternal(
- new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_SYSTEM));
-
- assertEquals(1, mAllowedHdrOutputTypes.length);
- assertTrue(Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION == mAllowedHdrOutputTypes[0]);
-
- // Action: disable Dolby Vision, set userDisabledTypes not allowed
- displayManager.setUserDisabledHdrTypesInternal(
- new int [] {Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION});
- displayManager.setAreUserDisabledHdrTypesAllowedInternal(false);
-
- assertEquals(0, mAllowedHdrOutputTypes.length);
- }
-
- @Test
- public void testGetEnabledHdrTypesLocked_whenTypesDisabled_stripsDisabledTypes() {
- DisplayManagerService displayManager = new DisplayManagerService(
- mContext, new BasicInjector() {
- @Override
- int[] getSupportedHdrOutputTypes() {
- return new int[]{Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION};
- }
- });
-
- displayManager.setUserDisabledHdrTypesInternal(new int [0]);
- displayManager.setAreUserDisabledHdrTypesAllowedInternal(true);
- int [] enabledHdrOutputTypes = displayManager.getEnabledHdrOutputTypes();
- assertEquals(1, enabledHdrOutputTypes.length);
- assertTrue(Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION == enabledHdrOutputTypes[0]);
-
- displayManager.setAreUserDisabledHdrTypesAllowedInternal(false);
- enabledHdrOutputTypes = displayManager.getEnabledHdrOutputTypes();
- assertEquals(1, enabledHdrOutputTypes.length);
- assertTrue(Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION == enabledHdrOutputTypes[0]);
-
- displayManager.setUserDisabledHdrTypesInternal(
- new int [] {Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION});
- enabledHdrOutputTypes = displayManager.getEnabledHdrOutputTypes();
- assertEquals(0, enabledHdrOutputTypes.length);
- }
-
- @Test
- public void testSetHdrConversionModeInternal_isForceSdrIsUpdated() {
- DisplayManagerService displayManager = new DisplayManagerService(mContext, mBasicInjector);
- LogicalDisplayMapper logicalDisplayMapper = displayManager.getLogicalDisplayMapper();
- FakeDisplayDevice displayDevice =
- createFakeDisplayDevice(displayManager, new float[]{60f}, Display.TYPE_EXTERNAL);
- LogicalDisplay logicalDisplay =
- logicalDisplayMapper.getDisplayLocked(displayDevice, /* includeDisabled= */ true);
-
- displayManager.setHdrConversionModeInternal(
- new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_FORCE, HDR_TYPE_INVALID));
- assertTrue(logicalDisplay.getDisplayInfoLocked().isForceSdr);
-
- displayManager.setHdrConversionModeInternal(
- new HdrConversionMode(HdrConversionMode.HDR_CONVERSION_SYSTEM));
- assertFalse(logicalDisplay.getDisplayInfoLocked().isForceSdr);
- }
-
- @Test
public void testReturnsRefreshRateForDisplayAndSensor_proximitySensorSet() {
DisplayManagerService displayManager = new DisplayManagerService(mContext, mBasicInjector);
DisplayManagerInternal localService = displayManager.new LocalService();
@@ -3436,7 +3351,7 @@ public class DisplayManagerServiceTest {
}
private FakeDisplayDevice createFakeDisplayDevice(DisplayManagerService displayManager,
- Display.Mode[] modes) {
+ Display.Mode[] modes) {
FakeDisplayDevice displayDevice = new FakeDisplayDevice();
DisplayDeviceInfo displayDeviceInfo = new DisplayDeviceInfo();
displayDeviceInfo.supportedModes = modes;
@@ -3692,9 +3607,9 @@ public class DisplayManagerServiceTest {
public void setUserPreferredDisplayModeLocked(Display.Mode preferredMode) {
for (Display.Mode mode : mDisplayDeviceInfo.supportedModes) {
if (mode.matchesIfValid(
- preferredMode.getPhysicalWidth(),
- preferredMode.getPhysicalHeight(),
- preferredMode.getRefreshRate())) {
+ preferredMode.getPhysicalWidth(),
+ preferredMode.getPhysicalHeight(),
+ preferredMode.getRefreshRate())) {
mPreferredMode = mode;
break;
}