Check the validity of the port id of HdmiCecMessage only in TV.
In playback device, we don't track the port info, so we can't verify
the validity of the port id part of the physical address parameter of
HdmiCecMessages.
Bug: 16274232
Change-Id: I41f95dba0505d45688e2c9031b78863dc93248ce
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
index c9330c5..d491ac2 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
@@ -243,12 +243,17 @@
}
private boolean isValidPhysicalAddress(byte[] params, int offset) {
+ // TODO: Add more logic like validating 1.0.1.0.
+
+ if (!mService.isTvDevice()) {
+ // If the device is not TV, we can't convert path to port-id, so stop here.
+ return true;
+ }
int path = HdmiUtils.twoBytesToInt(params, offset);
int portId = mService.pathToPortId(path);
if (portId == Constants.INVALID_PORT_ID) {
return false;
}
- // TODO: Add more logic like validating 1.0.1.0.
return true;
}