Loading core/java/android/hardware/hdmi/HdmiControlManager.java +22 −20 Original line number Original line Diff line number Diff line Loading @@ -424,36 +424,37 @@ public final class HdmiControlManager { * * * @hide * @hide */ */ public static final String SETTING_NAME_HDMI_CEC_ENABLED = "hdmi_cec_enabled"; public static final String CEC_SETTING_NAME_HDMI_CEC_ENABLED = "hdmi_cec_enabled"; /** /** * Name of a setting deciding on the Standby message behaviour on sleep. * Name of a setting deciding on the Standby message behaviour on sleep. * * * @hide * @hide */ */ public static final String SETTING_NAME_SEND_STANDBY_ON_SLEEP = "send_standby_on_sleep"; public static final String CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP = "send_standby_on_sleep"; /** /** * Name of a setting deciding on power state action when losing Active Source. * Name of a setting deciding on power state action when losing Active Source. * * * @hide * @hide */ */ public static final String SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST = public static final String CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST = "power_state_change_on_active_source_lost"; "power_state_change_on_active_source_lost"; /** /** * Name of a setting deciding whether System Audio Muting is allowed. * Name of a setting deciding whether System Audio Muting is allowed. * * * @hide * @hide */ */ public static final String SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING = "system_audio_mode_muting"; public static final String CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING = "system_audio_mode_muting"; /** /** * @hide * @hide */ */ @StringDef({ @StringDef({ SETTING_NAME_HDMI_CEC_ENABLED, CEC_SETTING_NAME_HDMI_CEC_ENABLED, SETTING_NAME_SEND_STANDBY_ON_SLEEP, CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP, SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, }) }) public @interface SettingName {} public @interface CecSettingName {} // True if we have a logical device of type playback hosted in the system. // True if we have a logical device of type playback hosted in the system. private final boolean mHasPlaybackDevice; private final boolean mHasPlaybackDevice; Loading Loading @@ -1301,14 +1302,15 @@ public final class HdmiControlManager { * @hide * @hide */ */ @NonNull @NonNull @CecSettingName @RequiresPermission(android.Manifest.permission.HDMI_CEC) @RequiresPermission(android.Manifest.permission.HDMI_CEC) public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { if (mService == null) { if (mService == null) { Log.e(TAG, "HdmiControlService is not available"); Log.e(TAG, "HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getAvailableCecSettings(); return mService.getUserCecSettings(); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1326,7 +1328,7 @@ public final class HdmiControlManager { */ */ @NonNull @NonNull @RequiresPermission(android.Manifest.permission.HDMI_CEC) @RequiresPermission(android.Manifest.permission.HDMI_CEC) public List<String> getAllowedCecSettingValues(@NonNull String name) { public List<String> getAllowedCecSettingValues(@NonNull @CecSettingName String name) { if (mService == null) { if (mService == null) { Log.e(TAG, "HdmiControlService is not available"); Log.e(TAG, "HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); Loading Loading @@ -1354,7 +1356,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_HDMI_CEC_ENABLED, value); mService.setCecSettingValue(CEC_SETTING_NAME_HDMI_CEC_ENABLED, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1377,7 +1379,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_HDMI_CEC_ENABLED); return mService.getCecSettingValue(CEC_SETTING_NAME_HDMI_CEC_ENABLED); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1399,7 +1401,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_SEND_STANDBY_ON_SLEEP, value); mService.setCecSettingValue(CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1422,7 +1424,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_SEND_STANDBY_ON_SLEEP); return mService.getCecSettingValue(CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1446,7 +1448,7 @@ public final class HdmiControlManager { } } try { try { mService.setCecSettingValue( mService.setCecSettingValue( SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, value); CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1470,7 +1472,7 @@ public final class HdmiControlManager { } } try { try { return mService.getCecSettingValue( return mService.getCecSettingValue( SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST); CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1492,7 +1494,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, value); mService.setCecSettingValue(CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1515,7 +1517,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING); return mService.getCecSettingValue(CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading core/java/android/hardware/hdmi/HdmiControlServiceWrapper.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -296,8 +296,8 @@ public final class HdmiControlServiceWrapper { } } @Override @Override public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return HdmiControlServiceWrapper.this.getAvailableCecSettings(); return HdmiControlServiceWrapper.this.getUserCecSettings(); } } @Override @Override Loading Loading @@ -489,7 +489,7 @@ public final class HdmiControlServiceWrapper { IHdmiCecVolumeControlFeatureListener listener) {} IHdmiCecVolumeControlFeatureListener listener) {} /** @hide */ /** @hide */ public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return new ArrayList<>(); return new ArrayList<>(); } } Loading core/java/android/hardware/hdmi/IHdmiControlService.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,7 @@ interface IHdmiControlService { boolean isHdmiCecVolumeControlEnabled(); boolean isHdmiCecVolumeControlEnabled(); void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute); void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute); void setSystemAudioModeOnForAudioOnlySource(); void setSystemAudioModeOnForAudioOnlySource(); List<String> getAvailableCecSettings(); List<String> getUserCecSettings(); List<String> getAllowedCecSettingValues(String name); List<String> getAllowedCecSettingValues(String name); String getCecSettingValue(String name); String getCecSettingValue(String name); void setCecSettingValue(String name, String value); void setCecSettingValue(String name, String value); Loading core/tests/hdmitests/src/android/hardware/hdmi/HdmiAudioSystemClientTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -376,7 +376,7 @@ public class HdmiAudioSystemClientTest { } } @Override @Override public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return new ArrayList<>(); return new ArrayList<>(); } } Loading services/core/java/com/android/server/hdmi/HdmiCecConfig.java +33 −19 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.hdmi; package com.android.server.hdmi; import static android.hardware.hdmi.HdmiControlManager.CecSettingName; import android.annotation.IntDef; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; Loading Loading @@ -179,13 +181,13 @@ public class HdmiCecConfig { @Storage @Storage private int getStorage(@NonNull Setting setting) { private int getStorage(@NonNull Setting setting) { switch (setting.getName()) { switch (setting.getName()) { case HdmiControlManager.SETTING_NAME_HDMI_CEC_ENABLED: case HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED: return STORAGE_GLOBAL_SETTINGS; return STORAGE_GLOBAL_SETTINGS; case HdmiControlManager.SETTING_NAME_SEND_STANDBY_ON_SLEEP: case HdmiControlManager.CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP: return STORAGE_GLOBAL_SETTINGS; return STORAGE_GLOBAL_SETTINGS; case HdmiControlManager.SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: case HdmiControlManager.CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: return STORAGE_SYSPROPS; return STORAGE_SYSPROPS; case HdmiControlManager.SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: case HdmiControlManager.CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: return STORAGE_SYSPROPS; return STORAGE_SYSPROPS; default: default: throw new RuntimeException("Invalid CEC setting '" + setting.getName() throw new RuntimeException("Invalid CEC setting '" + setting.getName() Loading @@ -195,13 +197,13 @@ public class HdmiCecConfig { private String getStorageKey(@NonNull Setting setting) { private String getStorageKey(@NonNull Setting setting) { switch (setting.getName()) { switch (setting.getName()) { case HdmiControlManager.SETTING_NAME_HDMI_CEC_ENABLED: case HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED: return Global.HDMI_CONTROL_ENABLED; return Global.HDMI_CONTROL_ENABLED; case HdmiControlManager.SETTING_NAME_SEND_STANDBY_ON_SLEEP: case HdmiControlManager.CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP: return Global.HDMI_CONTROL_SEND_STANDBY_ON_SLEEP; return Global.HDMI_CONTROL_SEND_STANDBY_ON_SLEEP; case HdmiControlManager.SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: case HdmiControlManager.CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: return SYSPROP_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST; return SYSPROP_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST; case HdmiControlManager.SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: case HdmiControlManager.CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: return SYSPROP_SYSTEM_AUDIO_MODE_MUTING; return SYSPROP_SYSTEM_AUDIO_MODE_MUTING; default: default: throw new RuntimeException("Invalid CEC setting '" + setting.getName() throw new RuntimeException("Invalid CEC setting '" + setting.getName() Loading Loading @@ -238,33 +240,44 @@ public class HdmiCecConfig { } } /** /** * Returns a list of currently available settings based on the XML metadata. * Returns a list of all settings based on the XML metadata. */ public @CecSettingName List<String> getAllSettings() { List<String> allSettings = new ArrayList<String>(); for (Setting setting : mProductConfig.getSetting()) { allSettings.add(setting.getName()); } return allSettings; } /** * Returns a list of user-modifiable settings based on the XML metadata. */ */ public List<String> getAvailableSettings() { public @CecSettingName List<String> getUserSettings() { Set<String> availableSettings = new HashSet<String>(); Set<String> userSettings = new HashSet<String>(); // First read from the product config. // First read from the product config. for (Setting setting : mProductConfig.getSetting()) { for (Setting setting : mProductConfig.getSetting()) { if (setting.getUserConfigurable()) { if (setting.getUserConfigurable()) { availableSettings.add(setting.getName()); userSettings.add(setting.getName()); } } } } if (mVendorOverride != null) { if (mVendorOverride != null) { // Next either add or remove based on the vendor override. // Next either add or remove based on the vendor override. for (Setting setting : mVendorOverride.getSetting()) { for (Setting setting : mVendorOverride.getSetting()) { if (setting.getUserConfigurable()) { if (setting.getUserConfigurable()) { availableSettings.add(setting.getName()); userSettings.add(setting.getName()); } else { } else { availableSettings.remove(setting.getName()); userSettings.remove(setting.getName()); } } } } } } return new ArrayList(availableSettings); return new ArrayList(userSettings); } } /** /** * For a given setting name returns values that are allowed for that setting. * For a given setting name returns values that are allowed for that setting. */ */ public List<String> getAllowedValues(@NonNull String name) { public List<String> getAllowedValues(@NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -279,7 +292,7 @@ public class HdmiCecConfig { /** /** * For a given setting name returns the default value for that setting. * For a given setting name returns the default value for that setting. */ */ public String getDefaultValue(@NonNull String name) { public String getDefaultValue(@NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -290,7 +303,7 @@ public class HdmiCecConfig { /** /** * For a given setting name returns the current value of that setting. * For a given setting name returns the current value of that setting. */ */ public String getValue(@NonNull Context context, @NonNull String name) { public String getValue(@NonNull Context context, @NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -302,7 +315,8 @@ public class HdmiCecConfig { /** /** * For a given setting name and value sets the current value of that setting. * For a given setting name and value sets the current value of that setting. */ */ public void setValue(@NonNull Context context, @NonNull String name, @NonNull String value) { public void setValue(@NonNull Context context, @NonNull @CecSettingName String name, @NonNull String value) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading Loading
core/java/android/hardware/hdmi/HdmiControlManager.java +22 −20 Original line number Original line Diff line number Diff line Loading @@ -424,36 +424,37 @@ public final class HdmiControlManager { * * * @hide * @hide */ */ public static final String SETTING_NAME_HDMI_CEC_ENABLED = "hdmi_cec_enabled"; public static final String CEC_SETTING_NAME_HDMI_CEC_ENABLED = "hdmi_cec_enabled"; /** /** * Name of a setting deciding on the Standby message behaviour on sleep. * Name of a setting deciding on the Standby message behaviour on sleep. * * * @hide * @hide */ */ public static final String SETTING_NAME_SEND_STANDBY_ON_SLEEP = "send_standby_on_sleep"; public static final String CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP = "send_standby_on_sleep"; /** /** * Name of a setting deciding on power state action when losing Active Source. * Name of a setting deciding on power state action when losing Active Source. * * * @hide * @hide */ */ public static final String SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST = public static final String CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST = "power_state_change_on_active_source_lost"; "power_state_change_on_active_source_lost"; /** /** * Name of a setting deciding whether System Audio Muting is allowed. * Name of a setting deciding whether System Audio Muting is allowed. * * * @hide * @hide */ */ public static final String SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING = "system_audio_mode_muting"; public static final String CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING = "system_audio_mode_muting"; /** /** * @hide * @hide */ */ @StringDef({ @StringDef({ SETTING_NAME_HDMI_CEC_ENABLED, CEC_SETTING_NAME_HDMI_CEC_ENABLED, SETTING_NAME_SEND_STANDBY_ON_SLEEP, CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP, SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, }) }) public @interface SettingName {} public @interface CecSettingName {} // True if we have a logical device of type playback hosted in the system. // True if we have a logical device of type playback hosted in the system. private final boolean mHasPlaybackDevice; private final boolean mHasPlaybackDevice; Loading Loading @@ -1301,14 +1302,15 @@ public final class HdmiControlManager { * @hide * @hide */ */ @NonNull @NonNull @CecSettingName @RequiresPermission(android.Manifest.permission.HDMI_CEC) @RequiresPermission(android.Manifest.permission.HDMI_CEC) public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { if (mService == null) { if (mService == null) { Log.e(TAG, "HdmiControlService is not available"); Log.e(TAG, "HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getAvailableCecSettings(); return mService.getUserCecSettings(); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1326,7 +1328,7 @@ public final class HdmiControlManager { */ */ @NonNull @NonNull @RequiresPermission(android.Manifest.permission.HDMI_CEC) @RequiresPermission(android.Manifest.permission.HDMI_CEC) public List<String> getAllowedCecSettingValues(@NonNull String name) { public List<String> getAllowedCecSettingValues(@NonNull @CecSettingName String name) { if (mService == null) { if (mService == null) { Log.e(TAG, "HdmiControlService is not available"); Log.e(TAG, "HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); Loading Loading @@ -1354,7 +1356,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_HDMI_CEC_ENABLED, value); mService.setCecSettingValue(CEC_SETTING_NAME_HDMI_CEC_ENABLED, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1377,7 +1379,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_HDMI_CEC_ENABLED); return mService.getCecSettingValue(CEC_SETTING_NAME_HDMI_CEC_ENABLED); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1399,7 +1401,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_SEND_STANDBY_ON_SLEEP, value); mService.setCecSettingValue(CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1422,7 +1424,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_SEND_STANDBY_ON_SLEEP); return mService.getCecSettingValue(CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1446,7 +1448,7 @@ public final class HdmiControlManager { } } try { try { mService.setCecSettingValue( mService.setCecSettingValue( SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, value); CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1470,7 +1472,7 @@ public final class HdmiControlManager { } } try { try { return mService.getCecSettingValue( return mService.getCecSettingValue( SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST); CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1492,7 +1494,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { mService.setCecSettingValue(SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, value); mService.setCecSettingValue(CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING, value); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading @@ -1515,7 +1517,7 @@ public final class HdmiControlManager { throw new RuntimeException("HdmiControlService is not available"); throw new RuntimeException("HdmiControlService is not available"); } } try { try { return mService.getCecSettingValue(SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING); return mService.getCecSettingValue(CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading
core/java/android/hardware/hdmi/HdmiControlServiceWrapper.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -296,8 +296,8 @@ public final class HdmiControlServiceWrapper { } } @Override @Override public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return HdmiControlServiceWrapper.this.getAvailableCecSettings(); return HdmiControlServiceWrapper.this.getUserCecSettings(); } } @Override @Override Loading Loading @@ -489,7 +489,7 @@ public final class HdmiControlServiceWrapper { IHdmiCecVolumeControlFeatureListener listener) {} IHdmiCecVolumeControlFeatureListener listener) {} /** @hide */ /** @hide */ public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return new ArrayList<>(); return new ArrayList<>(); } } Loading
core/java/android/hardware/hdmi/IHdmiControlService.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,7 @@ interface IHdmiControlService { boolean isHdmiCecVolumeControlEnabled(); boolean isHdmiCecVolumeControlEnabled(); void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute); void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute); void setSystemAudioModeOnForAudioOnlySource(); void setSystemAudioModeOnForAudioOnlySource(); List<String> getAvailableCecSettings(); List<String> getUserCecSettings(); List<String> getAllowedCecSettingValues(String name); List<String> getAllowedCecSettingValues(String name); String getCecSettingValue(String name); String getCecSettingValue(String name); void setCecSettingValue(String name, String value); void setCecSettingValue(String name, String value); Loading
core/tests/hdmitests/src/android/hardware/hdmi/HdmiAudioSystemClientTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -376,7 +376,7 @@ public class HdmiAudioSystemClientTest { } } @Override @Override public List<String> getAvailableCecSettings() { public List<String> getUserCecSettings() { return new ArrayList<>(); return new ArrayList<>(); } } Loading
services/core/java/com/android/server/hdmi/HdmiCecConfig.java +33 −19 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.hdmi; package com.android.server.hdmi; import static android.hardware.hdmi.HdmiControlManager.CecSettingName; import android.annotation.IntDef; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; Loading Loading @@ -179,13 +181,13 @@ public class HdmiCecConfig { @Storage @Storage private int getStorage(@NonNull Setting setting) { private int getStorage(@NonNull Setting setting) { switch (setting.getName()) { switch (setting.getName()) { case HdmiControlManager.SETTING_NAME_HDMI_CEC_ENABLED: case HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED: return STORAGE_GLOBAL_SETTINGS; return STORAGE_GLOBAL_SETTINGS; case HdmiControlManager.SETTING_NAME_SEND_STANDBY_ON_SLEEP: case HdmiControlManager.CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP: return STORAGE_GLOBAL_SETTINGS; return STORAGE_GLOBAL_SETTINGS; case HdmiControlManager.SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: case HdmiControlManager.CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: return STORAGE_SYSPROPS; return STORAGE_SYSPROPS; case HdmiControlManager.SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: case HdmiControlManager.CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: return STORAGE_SYSPROPS; return STORAGE_SYSPROPS; default: default: throw new RuntimeException("Invalid CEC setting '" + setting.getName() throw new RuntimeException("Invalid CEC setting '" + setting.getName() Loading @@ -195,13 +197,13 @@ public class HdmiCecConfig { private String getStorageKey(@NonNull Setting setting) { private String getStorageKey(@NonNull Setting setting) { switch (setting.getName()) { switch (setting.getName()) { case HdmiControlManager.SETTING_NAME_HDMI_CEC_ENABLED: case HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED: return Global.HDMI_CONTROL_ENABLED; return Global.HDMI_CONTROL_ENABLED; case HdmiControlManager.SETTING_NAME_SEND_STANDBY_ON_SLEEP: case HdmiControlManager.CEC_SETTING_NAME_SEND_STANDBY_ON_SLEEP: return Global.HDMI_CONTROL_SEND_STANDBY_ON_SLEEP; return Global.HDMI_CONTROL_SEND_STANDBY_ON_SLEEP; case HdmiControlManager.SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: case HdmiControlManager.CEC_SETTING_NAME_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST: return SYSPROP_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST; return SYSPROP_POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST; case HdmiControlManager.SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: case HdmiControlManager.CEC_SETTING_NAME_SYSTEM_AUDIO_MODE_MUTING: return SYSPROP_SYSTEM_AUDIO_MODE_MUTING; return SYSPROP_SYSTEM_AUDIO_MODE_MUTING; default: default: throw new RuntimeException("Invalid CEC setting '" + setting.getName() throw new RuntimeException("Invalid CEC setting '" + setting.getName() Loading Loading @@ -238,33 +240,44 @@ public class HdmiCecConfig { } } /** /** * Returns a list of currently available settings based on the XML metadata. * Returns a list of all settings based on the XML metadata. */ public @CecSettingName List<String> getAllSettings() { List<String> allSettings = new ArrayList<String>(); for (Setting setting : mProductConfig.getSetting()) { allSettings.add(setting.getName()); } return allSettings; } /** * Returns a list of user-modifiable settings based on the XML metadata. */ */ public List<String> getAvailableSettings() { public @CecSettingName List<String> getUserSettings() { Set<String> availableSettings = new HashSet<String>(); Set<String> userSettings = new HashSet<String>(); // First read from the product config. // First read from the product config. for (Setting setting : mProductConfig.getSetting()) { for (Setting setting : mProductConfig.getSetting()) { if (setting.getUserConfigurable()) { if (setting.getUserConfigurable()) { availableSettings.add(setting.getName()); userSettings.add(setting.getName()); } } } } if (mVendorOverride != null) { if (mVendorOverride != null) { // Next either add or remove based on the vendor override. // Next either add or remove based on the vendor override. for (Setting setting : mVendorOverride.getSetting()) { for (Setting setting : mVendorOverride.getSetting()) { if (setting.getUserConfigurable()) { if (setting.getUserConfigurable()) { availableSettings.add(setting.getName()); userSettings.add(setting.getName()); } else { } else { availableSettings.remove(setting.getName()); userSettings.remove(setting.getName()); } } } } } } return new ArrayList(availableSettings); return new ArrayList(userSettings); } } /** /** * For a given setting name returns values that are allowed for that setting. * For a given setting name returns values that are allowed for that setting. */ */ public List<String> getAllowedValues(@NonNull String name) { public List<String> getAllowedValues(@NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -279,7 +292,7 @@ public class HdmiCecConfig { /** /** * For a given setting name returns the default value for that setting. * For a given setting name returns the default value for that setting. */ */ public String getDefaultValue(@NonNull String name) { public String getDefaultValue(@NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -290,7 +303,7 @@ public class HdmiCecConfig { /** /** * For a given setting name returns the current value of that setting. * For a given setting name returns the current value of that setting. */ */ public String getValue(@NonNull Context context, @NonNull String name) { public String getValue(@NonNull Context context, @NonNull @CecSettingName String name) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading @@ -302,7 +315,8 @@ public class HdmiCecConfig { /** /** * For a given setting name and value sets the current value of that setting. * For a given setting name and value sets the current value of that setting. */ */ public void setValue(@NonNull Context context, @NonNull String name, @NonNull String value) { public void setValue(@NonNull Context context, @NonNull @CecSettingName String name, @NonNull String value) { Setting setting = getSetting(name); Setting setting = getSetting(name); if (setting == null) { if (setting == null) { throw new IllegalArgumentException("Setting '" + name + "' does not exist."); throw new IllegalArgumentException("Setting '" + name + "' does not exist."); Loading