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

Commit 01da9337 authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

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

name

Previouly HDMI framework used a default name when a new hdmi cec device
is connected to the current devicei without reporting its osd name. But
this does not align with the produce requirement.

Current solution is to keep the name empty when notify device added to
the TV Input Framework. TIF handles this situation and takes the label
name of the service provided by the package manager instead. In this
case products can decide their own default name there.

Test: manual
Bug: 127378724
Change-Id: I8d3eb091b3f398a96a39729c8e1232e10acb3fcc
(cherry picked from commit 1d00fa718990a7d2e47470571a56e2f1ed124737)
parent 97fffca6
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;
        }