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

Commit 01b979c8 authored by Nick Chalko's avatar Nick Chalko Committed by shubang
Browse files

Call HdmiCecLocalDeviceAudioSystem to report audio status.

ag/5316629

Test: m -j, local test
Change-Id: Ifab94b1edaec834d5af4f025596f87694aaa206d
parent 9ec5dee9
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
    protected boolean handleGiveAudioStatus(HdmiCecMessage message) {
        assertRunOnServiceThread();

        reportAudioStatus(message);
        reportAudioStatus(message.getSource());
        return true;
    }

@@ -583,17 +583,20 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
            .setWiredDeviceConnectionState(AudioSystem.DEVICE_IN_HDMI, enabled ? 1 : 0, "", "");
    }

    private void reportAudioStatus(HdmiCecMessage message) {
    void reportAudioStatus(int source) {
        assertRunOnServiceThread();

        int volume = mService.getAudioManager().getStreamVolume(AudioManager.STREAM_MUSIC);
        boolean mute = mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC);
        int maxVolume = mService.getAudioManager().getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        int minVolume = mService.getAudioManager().getStreamMinVolume(AudioManager.STREAM_MUSIC);
        int scaledVolume = VolumeControlAction.scaleToCecVolume(volume, maxVolume);
        HdmiLogger.debug("Reporting volume %i (%i-%i) as CEC volume %i", volume,
                minVolume, maxVolume, scaledVolume);

        mService.sendCecCommand(
                HdmiCecMessageBuilder.buildReportAudioStatus(
                        mAddress, message.getSource(), scaledVolume, mute));
                        mAddress, source, scaledVolume, mute));
    }

    /**
+1 −8
Original line number Diff line number Diff line
@@ -1834,14 +1834,7 @@ public class HdmiControlService extends SystemService {
                        Slog.w(TAG, "audio system is not in system audio mode");
                        return;
                    }
                    int scaledVolume = VolumeControlAction.scaleToCecVolume(volume, maxVolume);

                    sendCecCommand(HdmiCecMessageBuilder
                            .buildReportAudioStatus(
                                    device.getDeviceInfo().getLogicalAddress(),
                                    Constants.ADDR_TV,
                                    scaledVolume,
                                    isMute));
                    audioSystem().reportAudioStatus(Constants.ADDR_TV);
                }
            });
        }