Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 224a5afc authored by Sherry Huang's avatar Sherry Huang Committed by Android (Google) Code Review
Browse files

Merge "HDMI-CEC: Increase number of retry for DevicePowerStatusAction" into main

parents 5f380f46 82773e66
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+7 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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);
    }
+10 −5
Original line number Diff line number Diff line
@@ -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 {
@@ -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();
    }
@@ -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();
    }