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

Commit 3af63c3e authored by Amy's avatar Amy Committed by Amy Zhang
Browse files

Send out OSD name when the device just gets its logical address

allocated

Test: manual
Bug: 129092034
Change-Id: Ifc69a3e545cf2a953933e00fc091739571e92b46
(cherry picked from commit ccbd518248b89bc22d48b25fe9f4add3778860ea)
parent 49d0108e
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.IHdmiControlCallback;
import android.hardware.input.InputManager;
import android.hardware.tv.cec.V1_0.SendMessageResult;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -426,15 +427,26 @@ abstract class HdmiCecLocalDevice {
        assertRunOnServiceThread();
        // Note that since this method is called after logical address allocation is done,
        // mDeviceInfo should not be null.
        buildAndSendSetOsdName(message.getSource());
        return true;
    }

    protected void buildAndSendSetOsdName(int dest) {
        HdmiCecMessage cecMessage =
            HdmiCecMessageBuilder.buildSetOsdNameCommand(
                        mAddress, message.getSource(), mDeviceInfo.getDisplayName());
                mAddress, dest, mDeviceInfo.getDisplayName());
        if (cecMessage != null) {
            mService.sendCecCommand(cecMessage);
            mService.sendCecCommand(cecMessage, new SendMessageCallback() {
                @Override
                public void onSendCompleted(int error) {
                    if (error != SendMessageResult.SUCCESS) {
                        HdmiLogger.debug("Failed to send cec command " + cecMessage);
                    }
                }
            });
        } else {
            Slog.w(TAG, "Failed to build <Get Osd Name>:" + mDeviceInfo.getDisplayName());
        }
        return true;
    }

    // Audio System device with no Playback device type
+4 −0
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
                mAddress, mService.getPhysicalAddress(), mDeviceType));
        mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
                mAddress, mService.getVendorId()));
        // Actively send out an OSD name to the TV to update the TV panel in case the TV
        // does not query the OSD name on time. This is not a required behavior by the spec.
        // It is used for some TVs that need the OSD name update but don't query it themselves.
        buildAndSendSetOsdName(Constants.ADDR_TV);
        if (mService.audioSystem() == null) {
            // If current device is not a functional audio system device,
            // send message to potential audio system device in the system to get the system