am 7bffa188: am fc752425: am cd55d2e5: Merge "Add setting to disable automatic USB audio routing" into lmp-dev
* commit '7bffa188c6cfc180b0efea2e7d00b73088acb875': Add setting to disable automatic USB audio routing
This commit is contained in:
@@ -2374,6 +2374,16 @@ public final class Settings {
|
||||
*/
|
||||
public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
|
||||
|
||||
/**
|
||||
* Whether automatic routing of system audio to USB audio peripheral is disabled.
|
||||
* The value is boolean (1 or 0), where 1 means automatic routing is disabled,
|
||||
* and 0 means automatic routing is enabled.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
|
||||
"usb_audio_automatic_routing_disabled";
|
||||
|
||||
/**
|
||||
* Whether the audible DTMF tones are played by the dialer when dialing. The value is
|
||||
* boolean (1 or 0).
|
||||
|
||||
@@ -4573,6 +4573,17 @@ public class AudioService extends IAudioService.Stub {
|
||||
outDevice = AudioSystem.DEVICE_OUT_USB_ACCESSORY;
|
||||
setWiredDeviceConnectionState(outDevice, state, params);
|
||||
} else if (action.equals(Intent.ACTION_USB_AUDIO_DEVICE_PLUG)) {
|
||||
// FIXME Does not yet handle the case where the setting is changed
|
||||
// after device connection. Ideally we should handle the settings change
|
||||
// in SettingsObserver. Here we should log that a USB device is connected
|
||||
// and disconnected with its address (card , device) and force the
|
||||
// connection or disconnection when the setting changes.
|
||||
int isDisabled = Settings.System.getInt(mContentResolver,
|
||||
Settings.System.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0);
|
||||
if (isDisabled != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = intent.getIntExtra("state", 0);
|
||||
|
||||
int alsaCard = intent.getIntExtra("card", -1);
|
||||
|
||||
Reference in New Issue
Block a user