summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java7
-rw-r--r--services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java19
2 files changed, 25 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index aae7b59b1a1a..5682c330e4b0 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -471,6 +471,10 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
void startRoutingControl(int oldPath, int newPath, IHdmiControlCallback callback) {
assertRunOnServiceThread();
if (oldPath == newPath) {
+ HdmiCecMessage setStreamPath =
+ HdmiCecMessageBuilder.buildSetStreamPath(getDeviceInfo().getLogicalAddress(),
+ oldPath);
+ mService.sendCecCommand(setStreamPath);
return;
}
HdmiCecMessage routingChange =
@@ -642,7 +646,8 @@ public class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
int address = message.getSource();
int type = message.getParams()[2];
- if (!mService.getHdmiCecNetwork().isInDeviceList(address, path)) {
+ if (!ActiveSource.of(address, path).equals(getActiveSource())) {
+ HdmiLogger.debug("Check if a new device is connected to the active path");
handleNewDeviceAtTheTailOfActivePath(path);
}
startNewDeviceAction(ActiveSource.of(address, path), type);
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java
index 935c8b8720fb..51276a4db883 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java
@@ -2234,6 +2234,25 @@ public class HdmiCecLocalDeviceTvTest {
}
@Test
+ public void handleReportPhysicalAddress_samePathAsActiveSource_differentLA_newActiveSource() {
+ // This scenario can be reproduced if active source is hotplugged out and replaced with
+ // another device that might have another LA.
+ int physicalAddress = 0x1000;
+ mHdmiControlService.setActiveSource(Constants.ADDR_PLAYBACK_1, physicalAddress,
+ "HdmiControlServiceTest");
+ mHdmiCecLocalDeviceTv.setActivePath(physicalAddress);
+ HdmiCecMessage reportPhysicalAddressFromPlayback2 =
+ HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(ADDR_PLAYBACK_2,
+ physicalAddress, HdmiDeviceInfo.DEVICE_PLAYBACK);
+ HdmiCecMessage setStreamPath = HdmiCecMessageBuilder.buildSetStreamPath(ADDR_TV,
+ physicalAddress);
+ mNativeWrapper.onCecMessage(reportPhysicalAddressFromPlayback2);
+ mTestLooper.dispatchAll();
+
+ assertThat(mNativeWrapper.getResultMessages()).contains(setStreamPath);
+ }
+
+ @Test
public void onOneTouchPlay_wakeUp_addCecDevice() {
assertThat(mHdmiControlService.getHdmiCecNetwork().getDeviceInfoList(false))
.isEmpty();