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

Commit 702b4ad8 authored by Amy's avatar Amy Committed by Jay Patel
Browse files

Save Query Display Callback when the local device is still under address

allocation.

When a CEC disabled playback device enables the CEC control again, the device gets into
logical address allocation process. But AudioService might try to query
the connected TV's CEC support by calling queryDisplayStatus API in the
HdmiPlaybackClient.

In this case the API will return source not available via the callback,
which might set the playback device as a full volume device incorrectly.

Changing the API to handle this case correctly.

Test: manual
Bug: 139559982

Cherry pick from pi-tv-dev to master

Change-Id: I3c67610dab3956886ecb5a82444d4d00548c3934
(cherry picked from commit 8feb9d02ce5bdcbbc9eb5c8851ed7d3d85bc2ecc)
parent 58345440
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -296,6 +296,11 @@ public class HdmiControlService extends SystemService {
    private final HdmiControlBroadcastReceiver
            mHdmiControlBroadcastReceiver = new HdmiControlBroadcastReceiver();

    @Nullable
    // Save callback when the device is still under logcial address allocation
    // Invoke once new local device is ready.
    private IHdmiControlCallback mDisplayStatusCallback = null;

    @Nullable
    private HdmiCecController mCecController;

@@ -763,6 +768,11 @@ public class HdmiControlService extends SystemService {
                    // Address allocation completed for all devices. Notify each device.
                    if (allocatingDevices.size() == ++finished[0]) {
                        mAddressAllocated = true;
                        // Reinvoke the saved display status callback once the local device is ready.
                        if (mDisplayStatusCallback != null) {
                            queryDisplayStatus(mDisplayStatusCallback);
                            mDisplayStatusCallback = null;
                        }
                        if (initiatedBy != INITIATED_BY_HOTPLUG) {
                            // In case of the hotplug we don't call onInitializeCecComplete()
                            // since we reallocate the logical address only.
@@ -2192,6 +2202,13 @@ public class HdmiControlService extends SystemService {
    @ServiceThreadOnly
    private void queryDisplayStatus(final IHdmiControlCallback callback) {
        assertRunOnServiceThread();
        if (!mAddressAllocated) {
            mDisplayStatusCallback = callback;
            Slog.d(TAG, "Local device is under address allocation. "
                        + "Queue display callback for later process.");
            return;
        }

        HdmiCecLocalDevicePlayback source = playback();
        if (source == null) {
            Slog.w(TAG, "Local playback device not available");