diff options
| author | 2022-11-30 14:45:21 +0000 | |
|---|---|---|
| committer | 2022-11-30 14:45:21 +0000 | |
| commit | a608da9dfd3230dd4b486d35cae7f479e39408ed (patch) | |
| tree | 849d781ad9eddffdcc35e4f14fc95e94fb2326c2 | |
| parent | 9f06cf82407e3f887a859d7f5abac6b7213fd1c3 (diff) | |
Allow No Sensor to be Specified in DDC
Adding the following:
<proxSensor>
<type></type>
<name></name>
</proxSensor>
to the DDC, will stop any fallback from being used, and allow the usage
of no sensor to be used for that display. This is useful for when a
display has no sensor and the fallback should not be used. If this is
not added to the ddc, the fallback will still only occur if the display
is the default display.
Bug: 202604469
Test: dumpsys display | grep mProximitySensor
Test: com.android.server.display
Change-Id: I8508a191b7c7c5990929e4d020ffd144c7faeef7
| -rw-r--r-- | services/core/java/com/android/server/display/DisplayDeviceConfig.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/display/utils/SensorUtils.java | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java index 523a2dca7a18..c1e9526a9127 100644 --- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java +++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java @@ -1941,8 +1941,8 @@ public class DisplayDeviceConfig { } private void setProxSensorUnspecified() { - mProximitySensor.name = ""; - mProximitySensor.type = ""; + mProximitySensor.name = null; + mProximitySensor.type = null; } private void loadProxSensorFromDdc(DisplayConfiguration config) { diff --git a/services/core/java/com/android/server/display/utils/SensorUtils.java b/services/core/java/com/android/server/display/utils/SensorUtils.java index cb40b406899f..4924ad525fcc 100644 --- a/services/core/java/com/android/server/display/utils/SensorUtils.java +++ b/services/core/java/com/android/server/display/utils/SensorUtils.java @@ -33,6 +33,9 @@ public class SensorUtils { */ public static Sensor findSensor(SensorManager sensorManager, String sensorType, String sensorName, int fallbackType) { + if ("".equals(sensorName) && "".equals(sensorType)) { + return null; + } final boolean isNameSpecified = !TextUtils.isEmpty(sensorName); final boolean isTypeSpecified = !TextUtils.isEmpty(sensorType); if (isNameSpecified || isTypeSpecified) { |