Merge changes Ie017bedf,If29d58fa into main
* changes:
CEC: invalidate physical address on getPhysicalAddress failure
CEC: avoid sign-extending physical addresses
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index cd2c037..339a062 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -1207,9 +1207,11 @@
@Override
public void onValues(int result, short addr) {
- if (result == Result.SUCCESS) {
- synchronized (mLock) {
- mPhysicalAddress = new Short(addr).intValue();
+ synchronized (mLock) {
+ if (result == Result.SUCCESS) {
+ mPhysicalAddress = Short.toUnsignedInt(addr);
+ } else {
+ mPhysicalAddress = INVALID_PHYSICAL_ADDRESS;
}
}
}
@@ -1605,9 +1607,11 @@
@Override
public void onValues(int result, short addr) {
- if (result == Result.SUCCESS) {
- synchronized (mLock) {
- mPhysicalAddress = new Short(addr).intValue();
+ synchronized (mLock) {
+ if (result == Result.SUCCESS) {
+ mPhysicalAddress = Short.toUnsignedInt(addr);
+ } else {
+ mPhysicalAddress = INVALID_PHYSICAL_ADDRESS;
}
}
}