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

Commit 77576fe9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "CEC: Make HDMI CEC volume control configurable" into rvc-dev

parents 48a2ffac da665a67
Loading
Loading
Loading
Loading
+62 −0
Original line number Diff line number Diff line
@@ -649,6 +649,68 @@ public final class HdmiControlManager {
        }
    }

    /**
     * Controls whether volume control commands via HDMI CEC are enabled.
     *
     * <p>When disabled:
     * <ul>
     *     <li>the device will not send any HDMI CEC audio messages
     *     <li>received HDMI CEC audio messages are responded to with {@code <Feature Abort>}
     * </ul>
     *
     * <p>Effects on different device types:
     * <table>
     *     <tr><th>HDMI CEC device type</th><th>enabled</th><th>disabled</th></tr>
     *     <tr>
     *         <td>TV (type: 0)</td>
     *         <td>Per CEC specification.</td>
     *         <td>TV changes system volume. TV no longer reacts to incoming volume changes via
     *         {@code <User Control Pressed>}. TV no longer handles {@code <Report Audio Status>}
     *         .</td>
     *     </tr>
     *     <tr>
     *         <td>Playback device (type: 4)</td>
     *         <td>Device sends volume commands to TV/Audio system via {@code <User Control
     *         Pressed>}</td><td>Device does not send volume commands via {@code <User Control
     *         Pressed>}.</td>
     *     </tr>
     *     <tr>
     *         <td>Audio device (type: 5)</td>
     *         <td>Full "System Audio Control" capabilities.</td>
     *         <td>Audio device no longer reacts to incoming {@code <User Control Pressed>}
     *         volume commands. Audio device no longer reports volume changes via {@code <Report
     *         Audio Status>}.</td>
     *     </tr>
     * </table>
     *
     * <p> Due to the resulting behavior, usage on TV and Audio devices is discouraged.
     *
     * @param isHdmiCecVolumeControlEnabled target state of HDMI CEC volume control.
     * @see Settings.Global.HDMI_CONTROL_VOLUME_CONTROL_ENABLED
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.HDMI_CEC)
    public void setHdmiCecVolumeControlEnabled(boolean isHdmiCecVolumeControlEnabled) {
        try {
            mService.setHdmiCecVolumeControlEnabled(isHdmiCecVolumeControlEnabled);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Returns whether volume changes via HDMI CEC are enabled.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.HDMI_CEC)
    public boolean isHdmiCecVolumeControlEnabled() {
        try {
            return mService.isHdmiCecVolumeControlEnabled();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets whether the system is in system audio mode.
     *
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ interface IHdmiControlService {
    void sendMhlVendorCommand(int portId, int offset, int length, in byte[] data);
    void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener);
    void setStandbyMode(boolean isStandbyModeOn);
    void setHdmiCecVolumeControlEnabled(boolean isHdmiCecVolumeControlEnabled);
    boolean isHdmiCecVolumeControlEnabled();
    void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute);
    void setSystemAudioModeOnForAudioOnlySource();
}
+37 −0
Original line number Diff line number Diff line
@@ -9614,6 +9614,43 @@ public final class Settings {
        */
       public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
        /**
         * Controls whether volume control commands via HDMI CEC are enabled. (0 = false, 1 =
         * true).
         *
         * <p>Effects on different device types:
         * <table>
         *     <tr><th>HDMI CEC device type</th><th>0: disabled</th><th>1: enabled</th></tr>
         *     <tr>
         *         <td>TV (type: 0)</td>
         *         <td>Per CEC specification.</td>
         *         <td>TV changes system volume. TV no longer reacts to incoming volume changes
         *         via {@code <User Control Pressed>}. TV no longer handles {@code <Report Audio
         *         Status>}.</td>
         *     </tr>
         *     <tr>
         *         <td>Playback device (type: 4)</td>
         *         <td>Device sends volume commands to TV/Audio system via {@code <User Control
         *         Pressed>}</td>
         *         <td>Device does not send volume commands via {@code <User Control Pressed>}.</td>
         *     </tr>
         *     <tr>
         *         <td>Audio device (type: 5)</td>
         *         <td>Full "System Audio Control" capabilities.</td>
         *         <td>Audio device no longer reacts to incoming {@code <User Control Pressed>}
         *         volume commands. Audio device no longer reports volume changes via {@code
         *         <Report Audio Status>}.</td>
         *     </tr>
         * </table>
         *
         * <p> Due to the resulting behavior, usage on TV and Audio devices is discouraged.
         *
         * @hide
         * @see android.hardware.hdmi.HdmiControlManager#setHdmiCecVolumeControlEnabled(boolean)
         */
        public static final String HDMI_CONTROL_VOLUME_CONTROL_ENABLED =
                "hdmi_control_volume_control_enabled";
       /**
        * Whether HDMI System Audio Control feature is enabled. If enabled, TV will try to turn on
        * system audio mode if there's a connected CEC-enabled AV Receiver. Then audio stream will
+9 −0
Original line number Diff line number Diff line
@@ -354,6 +354,15 @@ public class HdmiAudioSystemClientTest {
        @Override
        public void askRemoteDeviceToBecomeActiveSource(int physicalAddress) {
        }

        @Override
        public void setHdmiCecVolumeControlEnabled(boolean isHdmiCecVolumeControlEnabled) {
        }

        @Override
        public boolean isHdmiCecVolumeControlEnabled() {
            return true;
        }
    }

}
+1 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ public class SettingsBackupTest {
                    Settings.Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED,
                    Settings.Global.HDMI_CONTROL_AUTO_WAKEUP_ENABLED,
                    Settings.Global.HDMI_CONTROL_ENABLED,
                    Settings.Global.HDMI_CONTROL_VOLUME_CONTROL_ENABLED,
                    Settings.Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED,
                    Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
                    Settings.Global.HIDDEN_API_POLICY,
Loading