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

Commit 68e1f172 authored by Shuichi.Noguchi's avatar Shuichi.Noguchi
Browse files

Fix OTP performance with no Vendor ID device

Currently it takes too much time to change to the source device which
doesn't support <Device Vendor ID> when it executes One Touch Play.

Skip waiting the response for <Give Device Vendor ID> or/and
<Get OSD Name> in order to reduce the device detection time
if the connected device doesn't support them.

Test: OTP from source device which doesn't support <Device Vendor ID>
Change-Id: I021608dfd7e69e72828919a63a423160b319e4f9
parent 171fce83
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -228,12 +228,20 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {
                if (cmd.getOpcode() == Constants.MESSAGE_SET_OSD_NAME) {
                    handleSetOsdName(cmd);
                    return true;
                } else if ((cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT) &&
                        ((cmd.getParams()[0] & 0xFF) == Constants.MESSAGE_GIVE_OSD_NAME)) {
                    handleSetOsdName(cmd);
                    return true;
                }
                return false;
            case STATE_WAITING_FOR_VENDOR_ID:
                if (cmd.getOpcode() == Constants.MESSAGE_DEVICE_VENDOR_ID) {
                    handleVendorId(cmd);
                    return true;
                } else if ((cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT) &&
                        ((cmd.getParams()[0] & 0xFF) == Constants.MESSAGE_GIVE_DEVICE_VENDOR_ID)) {
                    handleVendorId(cmd);
                    return true;
                }
                return false;
            case STATE_WAITING_FOR_DEVICE_POLLING:
@@ -281,7 +289,11 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {

        String displayName = null;
        try {
            if (cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT) {
                displayName = HdmiUtils.getDefaultDeviceName(current.mLogicalAddress);
            } else {
                displayName = new String(cmd.getParams(), "US-ASCII");
            }
        } catch (UnsupportedEncodingException e) {
            Slog.w(TAG, "Failed to decode display name: " + cmd.toString());
            // If failed to get display name, use the default name of device.
@@ -302,9 +314,12 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {
            return;
        }

        if (cmd.getOpcode() != Constants.MESSAGE_FEATURE_ABORT) {
            byte[] params = cmd.getParams();
            int vendorId = HdmiUtils.threeBytesToInt(params);
            current.mVendorId = vendorId;
        }

        increaseProcessedDeviceCount();
        checkAndProceedStage();
    }