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

Commit 3ae16dda authored by Yuncheol Heo's avatar Yuncheol Heo Committed by Android (Google) Code Review
Browse files

Merge "Check the validity of the port id of HdmiCecMessage only in TV." into lmp-dev

parents a65118e1 e946ed8f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -243,12 +243,17 @@ public final class HdmiCecMessageValidator {
    }

    private boolean isValidPhysicalAddress(byte[] params, int offset) {
        // TODO: Add more logic like validating 1.0.1.0.

        if (!mService.isTvDevice()) {
            // If the device is not TV, we can't convert path to port-id, so stop here.
            return true;
        }
        int path = HdmiUtils.twoBytesToInt(params, offset);
        int portId = mService.pathToPortId(path);
        if (portId == Constants.INVALID_PORT_ID) {
            return false;
        }
        // TODO: Add more logic like validating 1.0.1.0.
        return true;
    }

+4 −4
Original line number Diff line number Diff line
@@ -981,10 +981,6 @@ public final class HdmiControlService extends SystemService {
            }
        }

        private boolean isTvDevice() {
            return tv() != null;
        }

        @Override
        public void setProhibitMode(final boolean enabled) {
            enforceAccessPermission();
@@ -1328,6 +1324,10 @@ public final class HdmiControlService extends SystemService {
        return (HdmiCecLocalDeviceTv) mCecController.getLocalDevice(HdmiCecDeviceInfo.DEVICE_TV);
    }

    boolean isTvDevice() {
        return tv() != null;
    }

    private HdmiCecLocalDevicePlayback playback() {
        return (HdmiCecLocalDevicePlayback)
                mCecController.getLocalDevice(HdmiCecDeviceInfo.DEVICE_PLAYBACK);