summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/hdmi/ActiveSourceHandler.java4
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java7
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java1
-rw-r--r--services/core/java/com/android/server/hdmi/RoutingControlAction.java14
4 files changed, 19 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/hdmi/ActiveSourceHandler.java b/services/core/java/com/android/server/hdmi/ActiveSourceHandler.java
index 7f48768..01547c1 100644
--- a/services/core/java/com/android/server/hdmi/ActiveSourceHandler.java
+++ b/services/core/java/com/android/server/hdmi/ActiveSourceHandler.java
@@ -68,8 +68,12 @@ final class ActiveSourceHandler {
}
if (!tv.isProhibitMode()) {
+ ActiveSource old = ActiveSource.of(tv.getActiveSource());
tv.updateActiveSource(newActive);
boolean notifyInputChange = (mCallback == null);
+ if (!old.equals(newActive)) {
+ tv.setPrevPortId(tv.getActivePortId());
+ }
tv.updateActiveInput(newActive.physicalAddress, notifyInputChange);
invokeCallback(HdmiControlManager.RESULT_SUCCESS);
} else {
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index d17e9b3..c08c061 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -71,6 +71,9 @@ abstract class HdmiCecLocalDevice {
logicalAddress = logical;
physicalAddress = physical;
}
+ public static ActiveSource of(ActiveSource source) {
+ return new ActiveSource(source.logicalAddress, source.physicalAddress);
+ }
public static ActiveSource of(int logical, int physical) {
return new ActiveSource(logical, physical);
}
@@ -102,10 +105,10 @@ abstract class HdmiCecLocalDevice {
StringBuffer s = new StringBuffer();
String logicalAddressString = (logicalAddress == Constants.ADDR_INVALID)
? "invalid" : String.format("0x%02x", logicalAddress);
- s.append("logical_address: ").append(logicalAddressString);
+ s.append("(").append(logicalAddressString);
String physicalAddressString = (physicalAddress == Constants.INVALID_PHYSICAL_ADDRESS)
? "invalid" : String.format("0x%04x", physicalAddress);
- s.append(", physical_address: ").append(physicalAddressString);
+ s.append(", ").append(physicalAddressString).append(")");
return s.toString();
}
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index d5cb5e3..fbd60fc 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -343,7 +343,6 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
void updateActiveInput(int path, boolean notifyInputChange) {
assertRunOnServiceThread();
// Seq #15
- setPrevPortId(getActivePortId());
setActivePath(path);
// TODO: Handle PAP/PIP case.
// Show OSD port change banner
diff --git a/services/core/java/com/android/server/hdmi/RoutingControlAction.java b/services/core/java/com/android/server/hdmi/RoutingControlAction.java
index ce5b9ab..6c8694e 100644
--- a/services/core/java/com/android/server/hdmi/RoutingControlAction.java
+++ b/services/core/java/com/android/server/hdmi/RoutingControlAction.java
@@ -119,7 +119,7 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
private void handleReportPowerStatus(int devicePowerStatus) {
if (isPowerOnOrTransient(getTvPowerStatus())) {
- tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
+ updateActiveInput();
if (isPowerOnOrTransient(devicePowerStatus)) {
sendSetStreamPath();
}
@@ -127,6 +127,12 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
}
+ private void updateActiveInput() {
+ HdmiCecLocalDeviceTv tv = tv();
+ tv.setPrevPortId(tv.getActivePortId());
+ tv.updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
+ }
+
private int getTvPowerStatus() {
return tv().getPowerStatus();
}
@@ -165,13 +171,13 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
}
});
} else {
- tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
+ updateActiveInput();
finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
}
return;
case STATE_WAIT_FOR_REPORT_POWER_STATUS:
if (isPowerOnOrTransient(getTvPowerStatus())) {
- tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
+ updateActiveInput();
sendSetStreamPath();
}
finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
@@ -189,7 +195,7 @@ final class RoutingControlAction extends HdmiCecFeatureAction {
mState = STATE_WAIT_FOR_REPORT_POWER_STATUS;
addTimer(mState, TIMEOUT_REPORT_POWER_STATUS_MS);
} else {
- tv().updateActiveInput(mCurrentRoutingPath, mNotifyInputChange);
+ updateActiveInput();
sendSetStreamPath();
finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
}