diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-27 12:26:23 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-27 12:26:23 +0000 |
| commit | 77576fe964760d1bc381cb0dc0081dd4f599bfcc (patch) | |
| tree | 04778b5dcfff7f61e89e1869454f0e7ec212e0bf /core/java | |
| parent | 48a2ffac38a5b962620f118525f34aac9f46889d (diff) | |
| parent | da665a67f1a60895c9df3ae9a88b9209a5aa08b7 (diff) | |
Merge "CEC: Make HDMI CEC volume control configurable" into rvc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/hardware/hdmi/HdmiControlManager.java | 62 | ||||
| -rw-r--r-- | core/java/android/hardware/hdmi/IHdmiControlService.aidl | 2 | ||||
| -rwxr-xr-x | core/java/android/provider/Settings.java | 37 |
3 files changed, 101 insertions, 0 deletions
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java index 65a8e15ba340..6bc962b67576 100644 --- a/core/java/android/hardware/hdmi/HdmiControlManager.java +++ b/core/java/android/hardware/hdmi/HdmiControlManager.java @@ -650,6 +650,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. * * @hide diff --git a/core/java/android/hardware/hdmi/IHdmiControlService.aidl b/core/java/android/hardware/hdmi/IHdmiControlService.aidl index a8fed2b03cfc..3582a927ff46 100644 --- a/core/java/android/hardware/hdmi/IHdmiControlService.aidl +++ b/core/java/android/hardware/hdmi/IHdmiControlService.aidl @@ -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(); } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index ac1998a04016..fbd6cbae47d9 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -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 |
