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
This commit is contained in:
Fiona Campbell
2022-11-30 14:45:21 +00:00
parent 9f06cf8240
commit a608da9dfd
2 changed files with 5 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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) {