Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +10 −1 Original line number Diff line number Diff line Loading @@ -304,6 +304,10 @@ public class HdmiControlService extends SystemService { // Make sure HdmiCecConfig is instantiated and the XMLs are read. private HdmiCecConfig mHdmiCecConfig; // Timeout value for start ARC action after an established eARC connection was terminated, // e.g. because eARC was disabled in Settings. private static final int EARC_TRIGGER_START_ARC_ACTION_DELAY = 500; /** * Interface to report send result. */ Loading Loading @@ -5041,7 +5045,12 @@ public class HdmiControlService extends SystemService { // AudioService here that the eARC connection is terminated. HdmiLogger.debug("eARC state change [new: HDMI_EARC_STATUS_ARC_PENDING(2)]"); notifyEarcStatusToAudioService(false, new ArrayList<>()); mHandler.postDelayed( new Runnable() { @Override public void run() { startArcAction(true, null); } }, EARC_TRIGGER_START_ARC_ACTION_DELAY); getAtomWriter().earcStatusChanged(isEarcSupported(), isEarcEnabled(), oldEarcStatus, status, HdmiStatsEnums.LOG_REASON_EARC_STATUS_CHANGED); } else { Loading services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ public class HdmiControlServiceTest { private HdmiPortInfo[] mHdmiPortInfo; private ArrayList<Integer> mLocalDeviceTypes = new ArrayList<>(); private static final int PORT_ID_EARC_SUPPORTED = 3; private static final int EARC_TRIGGER_START_ARC_ACTION_DELAY = 500; @Before public void setUp() throws Exception { Loading Loading @@ -1374,6 +1375,11 @@ public class HdmiControlServiceTest { PORT_ID_EARC_SUPPORTED); verify(mHdmiControlServiceSpy, times(1)) .notifyEarcStatusToAudioService(eq(false), eq(new ArrayList<>())); // ARC should be never initiated here. It should be started after 500 ms. verify(mHdmiControlServiceSpy, times(0)).startArcAction(anyBoolean(), any()); // We move 500 ms forward because the action is only started 500 ms later. mTestLooper.moveTimeForward(EARC_TRIGGER_START_ARC_ACTION_DELAY); mTestLooper.dispatchAll(); verify(mHdmiControlServiceSpy, times(1)).startArcAction(eq(true), any()); } Loading Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +10 −1 Original line number Diff line number Diff line Loading @@ -304,6 +304,10 @@ public class HdmiControlService extends SystemService { // Make sure HdmiCecConfig is instantiated and the XMLs are read. private HdmiCecConfig mHdmiCecConfig; // Timeout value for start ARC action after an established eARC connection was terminated, // e.g. because eARC was disabled in Settings. private static final int EARC_TRIGGER_START_ARC_ACTION_DELAY = 500; /** * Interface to report send result. */ Loading Loading @@ -5041,7 +5045,12 @@ public class HdmiControlService extends SystemService { // AudioService here that the eARC connection is terminated. HdmiLogger.debug("eARC state change [new: HDMI_EARC_STATUS_ARC_PENDING(2)]"); notifyEarcStatusToAudioService(false, new ArrayList<>()); mHandler.postDelayed( new Runnable() { @Override public void run() { startArcAction(true, null); } }, EARC_TRIGGER_START_ARC_ACTION_DELAY); getAtomWriter().earcStatusChanged(isEarcSupported(), isEarcEnabled(), oldEarcStatus, status, HdmiStatsEnums.LOG_REASON_EARC_STATUS_CHANGED); } else { Loading
services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ public class HdmiControlServiceTest { private HdmiPortInfo[] mHdmiPortInfo; private ArrayList<Integer> mLocalDeviceTypes = new ArrayList<>(); private static final int PORT_ID_EARC_SUPPORTED = 3; private static final int EARC_TRIGGER_START_ARC_ACTION_DELAY = 500; @Before public void setUp() throws Exception { Loading Loading @@ -1374,6 +1375,11 @@ public class HdmiControlServiceTest { PORT_ID_EARC_SUPPORTED); verify(mHdmiControlServiceSpy, times(1)) .notifyEarcStatusToAudioService(eq(false), eq(new ArrayList<>())); // ARC should be never initiated here. It should be started after 500 ms. verify(mHdmiControlServiceSpy, times(0)).startArcAction(anyBoolean(), any()); // We move 500 ms forward because the action is only started 500 ms later. mTestLooper.moveTimeForward(EARC_TRIGGER_START_ARC_ACTION_DELAY); mTestLooper.dispatchAll(); verify(mHdmiControlServiceSpy, times(1)).startArcAction(eq(true), any()); } Loading