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

Commit c741d62f authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Keep device name empty when the remote device does not report its osd name"

parents 352eb3f1 01da9337
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -333,7 +333,8 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {
        current.mPhysicalAddress = HdmiUtils.twoBytesToInt(params);
        current.mPortId = getPortId(current.mPhysicalAddress);
        current.mDeviceType = params[2] & 0xFF;
        current.mDisplayName = HdmiUtils.getDefaultDeviceName(current.mDeviceType);
        // Keep display name empty. TIF fallbacks to the service label provided by the package mg.
        current.mDisplayName = "";

        // This is to manager CEC device separately in case they don't have address.
        if (mIsTvDevice) {
@@ -359,17 +360,13 @@ final class DeviceDiscoveryAction extends HdmiCecFeatureAction {
            return;
        }

        String displayName = null;
        String displayName = "";
        try {
            if (cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT) {
                displayName = HdmiUtils.getDefaultDeviceName(current.mLogicalAddress);
            } else {
            if (cmd.getOpcode() != Constants.MESSAGE_FEATURE_ABORT) {
                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.
            displayName = HdmiUtils.getDefaultDeviceName(current.mLogicalAddress);
        }
        current.mDisplayName = displayName;
        increaseProcessedDeviceCount();
+3 −2
Original line number Diff line number Diff line
@@ -489,7 +489,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        if (oldDevice == null || oldDevice.getPhysicalAddress() != path) {
            addCecDevice(new HdmiDeviceInfo(
                    address, path, mService.pathToPortId(path), type,
                    Constants.UNKNOWN_VENDOR_ID, HdmiUtils.getDefaultDeviceName(address)));
                    Constants.UNKNOWN_VENDOR_ID, ""));
            // if we are adding a new device info, send out a give osd name command
            // to update the name of the device in TIF
            mService.sendCecCommand(
@@ -526,7 +526,8 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            return true;
        }

        if (deviceInfo.getDisplayName().equals(osdName)) {
        if (deviceInfo.getDisplayName() != null
            && deviceInfo.getDisplayName().equals(osdName)) {
            Slog.d(TAG, "Ignore incoming <Set Osd Name> having same osd name:" + message);
            return true;
        }