Terminate ARC when eARC gets enabled on the RX device

If the RX device has an active ARC connection and eARC disabled,
the user may enable eARC in the RX device's settings, i.e. the Audio
System's settings. In this scenario, the RX will initiate an eARC
connection and should in theory send <Terminate ARC> to terminate the
active ARC connection.

Even if the RX doesn´t send this message, the TX should send the RX a
request to terminate the active ARC connection with a
<Request ARC Termination> message. The TX should send this message when
the HAL reports an EARC_PENDING or EARC_CONNECTED status after the last
status update had been ARC_PENDING.

Test: atest
Bug: 262573690
Change-Id: I8514bcc0858ba6fa744fe2db4c81bdfbed90de22
This commit is contained in:
Nathalie Le Clair
2022-12-15 17:52:17 +01:00
parent 69c298b0e3
commit ffa600a03a
2 changed files with 30 additions and 0 deletions

View File

@@ -78,9 +78,11 @@ public class HdmiEarcLocalDeviceTx extends HdmiEarcLocalDevice {
}
protected void handleEarcStateChange(@Constants.EarcStatus int status) {
int oldEarcStatus;
synchronized (mLock) {
HdmiLogger.debug(TAG, "eARC state change [old:%b new %b]", mEarcStatus,
status);
oldEarcStatus = mEarcStatus;
mEarcStatus = status;
}
@@ -91,7 +93,13 @@ public class HdmiEarcLocalDeviceTx extends HdmiEarcLocalDevice {
} else if (status == HDMI_EARC_STATUS_ARC_PENDING) {
notifyEarcStatusToAudioService(false, new ArrayList<>());
mService.startArcAction(true, null);
} else if (status == HDMI_EARC_STATUS_EARC_PENDING
&& oldEarcStatus == HDMI_EARC_STATUS_ARC_PENDING) {
mService.startArcAction(false, null);
} else if (status == HDMI_EARC_STATUS_EARC_CONNECTED) {
if (oldEarcStatus == HDMI_EARC_STATUS_ARC_PENDING) {
mService.startArcAction(false, null);
}
mReportCapsHandler.postDelayed(mReportCapsRunnable, REPORT_CAPS_MAX_DELAY_MS);
}
}

View File

@@ -1319,6 +1319,28 @@ public class HdmiControlServiceTest {
verify(mHdmiControlServiceSpy, times(1)).startArcAction(eq(true), any());
}
@Test
public void earcStateWasArcPending_becomesEarcPending_terminateArc() {
mHdmiControlServiceSpy.clearEarcLocalDevice();
HdmiEarcLocalDeviceTx localDeviceTx = new HdmiEarcLocalDeviceTx(mHdmiControlServiceSpy);
mHdmiControlServiceSpy.addEarcLocalDevice(localDeviceTx);
localDeviceTx.handleEarcStateChange(Constants.HDMI_EARC_STATUS_ARC_PENDING);
mTestLooper.dispatchAll();
localDeviceTx.handleEarcStateChange(Constants.HDMI_EARC_STATUS_EARC_PENDING);
verify(mHdmiControlServiceSpy, times(1)).startArcAction(eq(false), any());
}
@Test
public void earcStateWasArcPending_becomesEarcEnabled_terminateArc() {
mHdmiControlServiceSpy.clearEarcLocalDevice();
HdmiEarcLocalDeviceTx localDeviceTx = new HdmiEarcLocalDeviceTx(mHdmiControlServiceSpy);
mHdmiControlServiceSpy.addEarcLocalDevice(localDeviceTx);
localDeviceTx.handleEarcStateChange(Constants.HDMI_EARC_STATUS_ARC_PENDING);
mTestLooper.dispatchAll();
localDeviceTx.handleEarcStateChange(Constants.HDMI_EARC_STATUS_EARC_CONNECTED);
verify(mHdmiControlServiceSpy, times(1)).startArcAction(eq(false), any());
}
protected static class MockPlaybackDevice extends HdmiCecLocalDevicePlayback {
private boolean mCanGoToStandby;