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

Commit 26c6f474 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "HDMICEC: Rename DeviceSelectAction"

parents 2f6679e7 d15cbe06
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import com.android.server.hdmi.HdmiControlService.SendMessageCallback;
 * for a new active source. It does its best to wake up the target in standby mode
 * before issuing the command >Set Stream path<.
 */
final class DeviceSelectAction extends HdmiCecFeatureAction {
final class DeviceSelectActionFromTv extends HdmiCecFeatureAction {
    private static final String TAG = "DeviceSelect";

    // Time in milliseconds we wait for the device power status to switch to 'Standby'
@@ -74,7 +74,7 @@ final class DeviceSelectAction extends HdmiCecFeatureAction {
     * @param target target logical device that will be a new active source
     * @param callback callback object
     */
    DeviceSelectAction(HdmiCecLocalDeviceTv source, HdmiDeviceInfo target,
    DeviceSelectActionFromTv(HdmiCecLocalDeviceTv source, HdmiDeviceInfo target,
                              IHdmiControlCallback callback) {
        this(source, target, callback,
             source.getDeviceInfo().getCecVersion() >= HdmiControlManager.HDMI_CEC_VERSION_2_0
@@ -82,7 +82,7 @@ final class DeviceSelectAction extends HdmiCecFeatureAction {
    }

    @VisibleForTesting
    DeviceSelectAction(HdmiCecLocalDeviceTv source, HdmiDeviceInfo target,
    DeviceSelectActionFromTv(HdmiCecLocalDeviceTv source, HdmiDeviceInfo target,
                       IHdmiControlCallback callback, boolean isCec20) {
        super(source, callback);
        mTarget = target;
+2 −2
Original line number Diff line number Diff line
@@ -263,8 +263,8 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
            invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
            return;
        }
        removeAction(DeviceSelectAction.class);
        addAndStartAction(new DeviceSelectAction(this, targetDevice, callback));
        removeAction(DeviceSelectActionFromTv.class);
        addAndStartAction(new DeviceSelectActionFromTv(this, targetDevice, callback));
    }

    @ServiceThreadOnly
+3 −3
Original line number Diff line number Diff line
@@ -237,15 +237,15 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction {
    }

    private void mayCancelDeviceSelect(int address) {
        List<DeviceSelectAction> actions = getActions(DeviceSelectAction.class);
        List<DeviceSelectActionFromTv> actions = getActions(DeviceSelectActionFromTv.class);
        if (actions.isEmpty()) {
            return;
        }

        // Should have only one Device Select Action
        DeviceSelectAction action = actions.get(0);
        DeviceSelectActionFromTv action = actions.get(0);
        if (action.getTargetAddress() == address) {
            removeAction(DeviceSelectAction.class);
            removeAction(DeviceSelectActionFromTv.class);
        }
    }

+12 −12
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@ import static android.hardware.hdmi.HdmiControlManager.POWER_STATUS_TRANSIENT_TO
import static com.android.server.hdmi.Constants.ADDR_PLAYBACK_1;
import static com.android.server.hdmi.Constants.ADDR_PLAYBACK_2;
import static com.android.server.hdmi.Constants.ADDR_TV;
import static com.android.server.hdmi.DeviceSelectAction.STATE_WAIT_FOR_DEVICE_POWER_ON;
import static com.android.server.hdmi.DeviceSelectAction.STATE_WAIT_FOR_REPORT_POWER_STATUS;
import static com.android.server.hdmi.DeviceSelectActionFromTv.STATE_WAIT_FOR_DEVICE_POWER_ON;
import static com.android.server.hdmi.DeviceSelectActionFromTv.STATE_WAIT_FOR_REPORT_POWER_STATUS;
import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC;

import static com.google.common.truth.Truth.assertThat;
@@ -58,7 +58,7 @@ import java.util.Collections;

@SmallTest
@RunWith(JUnit4.class)
public class DeviceSelectActionTest {
public class DeviceSelectActionFromTvTest {

    private static final int PORT_1 = 1;
    private static final int PORT_2 = 1;
@@ -193,12 +193,12 @@ public class DeviceSelectActionTest {
        }
    }

    private DeviceSelectAction createDeviceSelectAction(TestActionTimer actionTimer,
    private DeviceSelectActionFromTv createDeviceSelectAction(TestActionTimer actionTimer,
                                                        TestCallback callback,
                                                        boolean isCec20) {
        HdmiDeviceInfo hdmiDeviceInfo =
                mHdmiControlService.getHdmiCecNetwork().getCecDeviceInfo(ADDR_PLAYBACK_1);
        DeviceSelectAction action = new DeviceSelectAction(mHdmiCecLocalDeviceTv,
        DeviceSelectActionFromTv action = new DeviceSelectActionFromTv(mHdmiCecLocalDeviceTv,
                                                           hdmiDeviceInfo, callback, isCec20);
        action.setActionTimer(actionTimer);
        return action;
@@ -210,7 +210,7 @@ public class DeviceSelectActionTest {
        // playback1.
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/false);
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_2, PHYSICAL_ADDRESS_PLAYBACK_2,
                                                 "testDeviceSelect");
@@ -231,7 +231,7 @@ public class DeviceSelectActionTest {
                                                 "testDeviceSelect");
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/false);
        action.start();
        mTestLooper.dispatchAll();
@@ -257,7 +257,7 @@ public class DeviceSelectActionTest {
                                                 "testDeviceSelect");
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/false);
        action.start();
        mTestLooper.dispatchAll();
@@ -284,7 +284,7 @@ public class DeviceSelectActionTest {
                                                 "testDeviceSelect");
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/false);
        action.start();
        mTestLooper.dispatchAll();
@@ -312,7 +312,7 @@ public class DeviceSelectActionTest {
                HdmiControlManager.POWER_STATUS_ON);
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/true);
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_2, PHYSICAL_ADDRESS_PLAYBACK_2,
                                                 "testDeviceSelect");
@@ -328,7 +328,7 @@ public class DeviceSelectActionTest {
                HdmiControlManager.POWER_STATUS_UNKNOWN);
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/true);
        mHdmiCecLocalDeviceTv.updateActiveSource(ADDR_PLAYBACK_2, PHYSICAL_ADDRESS_PLAYBACK_2,
                                                 "testDeviceSelect");
@@ -351,7 +351,7 @@ public class DeviceSelectActionTest {
                                                 "testDeviceSelect");
        TestActionTimer actionTimer = new TestActionTimer();
        TestCallback callback = new TestCallback();
        DeviceSelectAction action = createDeviceSelectAction(actionTimer, callback,
        DeviceSelectActionFromTv action = createDeviceSelectAction(actionTimer, callback,
                                        /*isCec20=*/true);
        action.start();
        mTestLooper.dispatchAll();