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

Commit cae66277 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

Obtain TV power status correctly in HdmiControlService

Bug: 15845654

Change-Id: I28b97e7ecb462b4fbaf6ac573e4d0fc9fcf724da
parent 5344cd98
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -215,6 +215,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
        addAndStartAction(new RoutingControlAction(this, newPath, false, callback));
    }

    int getPowerStatus() {
        return mService.getPowerStatus();
    }

    /**
     * Sends key to a target CEC device.
     *
+5 −8
Original line number Diff line number Diff line
@@ -108,9 +108,8 @@ final class RoutingControlAction extends FeatureAction {
    }

    private void handleReportPowerStatus(int devicePowerStatus) {
        int tvPowerStatus = getTvPowerStatus();
        if (isPowerStatusOnOrTransientToOn(tvPowerStatus)) {
            if (isPowerStatusOnOrTransientToOn(devicePowerStatus)) {
        if (isPowerOnOrTransient(getTvPowerStatus())) {
            if (isPowerOnOrTransient(devicePowerStatus)) {
                sendSetStreamPath();
            } else {
                tv().updateActivePortId(tv().pathToPortId(mCurrentRoutingPath));
@@ -121,11 +120,10 @@ final class RoutingControlAction extends FeatureAction {
     }

    private int getTvPowerStatus() {
        // TODO: Obtain TV power status.
        return HdmiCec.POWER_STATUS_ON;
        return tv().getPowerStatus();
    }

    private static boolean isPowerStatusOnOrTransientToOn(int status) {
    private static boolean isPowerOnOrTransient(int status) {
        return status == HdmiCec.POWER_STATUS_ON || status == HdmiCec.POWER_STATUS_TRANSIENT_TO_ON;
    }

@@ -156,8 +154,7 @@ final class RoutingControlAction extends FeatureAction {
                }
                return;
            case STATE_WAIT_FOR_REPORT_POWER_STATUS:
                int tvPowerStatus = getTvPowerStatus();
                if (isPowerStatusOnOrTransientToOn(tvPowerStatus)) {
                if (isPowerOnOrTransient(getTvPowerStatus())) {
                    tv().updateActivePortId(tv().pathToPortId(mCurrentRoutingPath));
                    sendSetStreamPath();
                }