Loading services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ final class DevicePowerStatusAction extends HdmiCecFeatureAction { // Retry the power status query as it might happen when the target device is waking up. In // that case a device may be quite busy and can fail to respond within the 2s timeout. private int mRetriesOnTimeout = 1; private int mRetriesOnTimeout = 3; static DevicePowerStatusAction create(HdmiCecLocalDevice source, int targetAddress, IHdmiControlCallback callback) { Loading services/tests/servicestests/src/com/android/server/hdmi/DevicePowerStatusActionTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import java.util.Collections; public class DevicePowerStatusActionTest { private static final int TIMEOUT_MS = HdmiConfig.TIMEOUT_MS + 1; private static final int RETRY_ON_TIMEOUT = 3; private Context mContextSpy; private HdmiControlService mHdmiControlService; Loading Loading @@ -200,10 +201,12 @@ public class DevicePowerStatusActionTest { mTestLooper.moveTimeForward(TIMEOUT_MS); mTestLooper.dispatchAll(); for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { assertThat(mNativeWrapper.getResultMessages()).contains(expected); mNativeWrapper.clearResultMessages(); mTestLooper.moveTimeForward(TIMEOUT_MS); mTestLooper.dispatchAll(); } verify(mCallbackMock).onComplete(HdmiControlManager.POWER_STATUS_UNKNOWN); } Loading services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +10 −5 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class HdmiControlServiceTest { 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; private static final int RETRY_ON_TIMEOUT = 3; @Before public void setUp() throws Exception { Loading Loading @@ -801,12 +802,14 @@ public class HdmiControlServiceTest { HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED, HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mTestLooper.dispatchAll(); // Hit timeout twice due to retries mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); // Hit timeout multiple times due to retries for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); } assertThat(hdmiControlStatusCallback.mCecEnabled).isTrue(); assertThat(hdmiControlStatusCallback.mCecAvailable).isFalse(); } Loading Loading @@ -925,9 +928,11 @@ public class HdmiControlServiceTest { // Wait for DevicePowerStatusAction to finish. mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); } assertThat(hdmiControlStatusCallback.mCecEnabled).isTrue(); assertThat(hdmiControlStatusCallback.mCecAvailable).isFalse(); } Loading Loading
services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ final class DevicePowerStatusAction extends HdmiCecFeatureAction { // Retry the power status query as it might happen when the target device is waking up. In // that case a device may be quite busy and can fail to respond within the 2s timeout. private int mRetriesOnTimeout = 1; private int mRetriesOnTimeout = 3; static DevicePowerStatusAction create(HdmiCecLocalDevice source, int targetAddress, IHdmiControlCallback callback) { Loading
services/tests/servicestests/src/com/android/server/hdmi/DevicePowerStatusActionTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import java.util.Collections; public class DevicePowerStatusActionTest { private static final int TIMEOUT_MS = HdmiConfig.TIMEOUT_MS + 1; private static final int RETRY_ON_TIMEOUT = 3; private Context mContextSpy; private HdmiControlService mHdmiControlService; Loading Loading @@ -200,10 +201,12 @@ public class DevicePowerStatusActionTest { mTestLooper.moveTimeForward(TIMEOUT_MS); mTestLooper.dispatchAll(); for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { assertThat(mNativeWrapper.getResultMessages()).contains(expected); mNativeWrapper.clearResultMessages(); mTestLooper.moveTimeForward(TIMEOUT_MS); mTestLooper.dispatchAll(); } verify(mCallbackMock).onComplete(HdmiControlManager.POWER_STATUS_UNKNOWN); } Loading
services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +10 −5 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class HdmiControlServiceTest { 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; private static final int RETRY_ON_TIMEOUT = 3; @Before public void setUp() throws Exception { Loading Loading @@ -801,12 +802,14 @@ public class HdmiControlServiceTest { HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED, HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mTestLooper.dispatchAll(); // Hit timeout twice due to retries mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); // Hit timeout multiple times due to retries for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); } assertThat(hdmiControlStatusCallback.mCecEnabled).isTrue(); assertThat(hdmiControlStatusCallback.mCecAvailable).isFalse(); } Loading Loading @@ -925,9 +928,11 @@ public class HdmiControlServiceTest { // Wait for DevicePowerStatusAction to finish. mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); for (int i = 0; i < RETRY_ON_TIMEOUT; i++) { mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS); mTestLooper.dispatchAll(); } assertThat(hdmiControlStatusCallback.mCecEnabled).isTrue(); assertThat(hdmiControlStatusCallback.mCecAvailable).isFalse(); } Loading