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

Commit 78772dde authored by Paul Colta's avatar Paul Colta Committed by Android (Google) Code Review
Browse files

Merge "HDMI: Increase the timeout before sending <Request Active Source>" into main

parents 801dcba7 f432d66e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.hdmi;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.IHdmiControlCallback;
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;

/**
 * Feature action that sends <Request Active Source> message and waits for <Active Source> on TV
@@ -39,6 +40,10 @@ public class RequestActiveSourceAction extends HdmiCecFeatureAction {
    // Number of retries <Request Active Source> is sent if no device answers this message.
    private static final int MAX_SEND_RETRY_COUNT = 1;

    // Timeout to wait for the LauncherX API call to be completed.
    @VisibleForTesting
    protected static final int TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS = 10000;

    private int mSendRetryCount = 0;


@@ -55,7 +60,7 @@ public class RequestActiveSourceAction extends HdmiCecFeatureAction {
        // We wait for default timeout to allow the message triggered by the LauncherX API call to
        // be sent by the TV and another default timeout in case the message has to be answered
        // (e.g. TV sent a <Set Stream Path> or <Routing Change>).
        addTimer(mState, HdmiConfig.TIMEOUT_MS * 2);
        addTimer(mState, TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        return true;
    }

+6 −5
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC
import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_WAKE_UP_MESSAGE;
import static com.android.server.hdmi.HdmiControlService.STANDBY_SCREEN_OFF;
import static com.android.server.hdmi.HdmiControlService.WAKE_UP_SCREEN_ON;
import static com.android.server.hdmi.RequestActiveSourceAction.TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS;

import static com.google.common.truth.Truth.assertThat;

@@ -1792,7 +1793,7 @@ public class HdmiCecLocalDeviceTvTest {
        mTestLooper.dispatchAll();

        // Skip the LauncherX API timeout.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS * 2);
        mTestLooper.moveTimeForward(TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(requestActiveSource);
@@ -1825,7 +1826,7 @@ public class HdmiCecLocalDeviceTvTest {
        mTestLooper.dispatchAll();

        // Skip the LauncherX API timeout.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS * 2);
        mTestLooper.moveTimeForward(TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(requestActiveSource);
@@ -1861,7 +1862,7 @@ public class HdmiCecLocalDeviceTvTest {
        mTestLooper.dispatchAll();

        // Skip the LauncherX API timeout.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS * 2);
        mTestLooper.moveTimeForward(TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(requestActiveSource);
@@ -1904,7 +1905,7 @@ public class HdmiCecLocalDeviceTvTest {
        mTestLooper.dispatchAll();

        // Skip the LauncherX API timeout.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS * 2);
        mTestLooper.moveTimeForward(TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).contains(requestActiveSource);
@@ -1941,7 +1942,7 @@ public class HdmiCecLocalDeviceTvTest {
        mHdmiControlService.sendCecCommand(setStreamPathFromTv);

        // Skip the LauncherX API timeout.
        mTestLooper.moveTimeForward(HdmiConfig.TIMEOUT_MS * 2);
        mTestLooper.moveTimeForward(TIMEOUT_WAIT_FOR_LAUNCHERX_API_CALL_MS);
        mTestLooper.dispatchAll();

        assertThat(mNativeWrapper.getResultMessages()).doesNotContain(requestActiveSource);