Merge "add settings for dock audio enabled" into jb-mr1-dev
This commit is contained in:
@ -5292,6 +5292,14 @@ public final class Settings {
|
|||||||
public static final String ALWAYS_FINISH_ACTIVITIES =
|
public static final String ALWAYS_FINISH_ACTIVITIES =
|
||||||
"always_finish_activities";
|
"always_finish_activities";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use Dock audio output for media:
|
||||||
|
* 0 = disabled
|
||||||
|
* 1 = enabled
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings to backup. This is here so that it's in the same place as the settings
|
* Settings to backup. This is here so that it's in the same place as the settings
|
||||||
* keys and easy to update.
|
* keys and easy to update.
|
||||||
@ -5323,6 +5331,7 @@ public final class Settings {
|
|||||||
WIFI_NUM_OPEN_NETWORKS_KEPT,
|
WIFI_NUM_OPEN_NETWORKS_KEPT,
|
||||||
EMERGENCY_TONE,
|
EMERGENCY_TONE,
|
||||||
CALL_AUTO_RETRY,
|
CALL_AUTO_RETRY,
|
||||||
|
DOCK_AUDIO_MEDIA_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
// Populated lazily, guarded by class object:
|
// Populated lazily, guarded by class object:
|
||||||
|
@ -429,10 +429,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
// Devices for which the volume is fixed and VolumePanel slider should be disabled
|
// Devices for which the volume is fixed and VolumePanel slider should be disabled
|
||||||
final int mFixedVolumeDevices = AudioSystem.DEVICE_OUT_AUX_DIGITAL |
|
final int mFixedVolumeDevices = AudioSystem.DEVICE_OUT_AUX_DIGITAL |
|
||||||
AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET |
|
AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET |
|
||||||
|
AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET |
|
||||||
AudioSystem.DEVICE_OUT_ALL_USB;
|
AudioSystem.DEVICE_OUT_ALL_USB;
|
||||||
|
|
||||||
private final boolean mMonitorOrientation;
|
private final boolean mMonitorOrientation;
|
||||||
|
|
||||||
|
private boolean mDockAudioMediaEnabled = true;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Construction
|
// Construction
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -630,6 +633,27 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void readDockAudioSettings(ContentResolver cr)
|
||||||
|
{
|
||||||
|
mDockAudioMediaEnabled = Settings.Global.getInt(
|
||||||
|
cr, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 1) == 1;
|
||||||
|
|
||||||
|
if (mDockAudioMediaEnabled) {
|
||||||
|
mBecomingNoisyIntentDevices |= AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET;
|
||||||
|
} else {
|
||||||
|
mBecomingNoisyIntentDevices &= ~AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMsg(mAudioHandler,
|
||||||
|
MSG_SET_FORCE_USE,
|
||||||
|
SENDMSG_QUEUE,
|
||||||
|
AudioSystem.FOR_DOCK,
|
||||||
|
mDockAudioMediaEnabled ?
|
||||||
|
AudioSystem.FORCE_ANALOG_DOCK : AudioSystem.FORCE_NONE,
|
||||||
|
null,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
private void readPersistedSettings() {
|
private void readPersistedSettings() {
|
||||||
final ContentResolver cr = mContentResolver;
|
final ContentResolver cr = mContentResolver;
|
||||||
|
|
||||||
@ -693,6 +717,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
Settings.System.MODE_RINGER_STREAMS_AFFECTED,
|
Settings.System.MODE_RINGER_STREAMS_AFFECTED,
|
||||||
mRingerModeAffectedStreams,
|
mRingerModeAffectedStreams,
|
||||||
UserHandle.USER_CURRENT);
|
UserHandle.USER_CURRENT);
|
||||||
|
|
||||||
|
readDockAudioSettings(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mMuteAffectedStreams = System.getIntForUser(cr,
|
mMuteAffectedStreams = System.getIntForUser(cr,
|
||||||
@ -3408,6 +3434,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
super(new Handler());
|
super(new Handler());
|
||||||
mContentResolver.registerContentObserver(Settings.System.getUriFor(
|
mContentResolver.registerContentObserver(Settings.System.getUriFor(
|
||||||
Settings.System.MODE_RINGER_STREAMS_AFFECTED), false, this);
|
Settings.System.MODE_RINGER_STREAMS_AFFECTED), false, this);
|
||||||
|
mContentResolver.registerContentObserver(Settings.Global.getUriFor(
|
||||||
|
Settings.Global.DOCK_AUDIO_MEDIA_ENABLED), false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -3443,6 +3471,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
mRingerModeAffectedStreams = ringerModeAffectedStreams;
|
mRingerModeAffectedStreams = ringerModeAffectedStreams;
|
||||||
setRingerModeInt(getRingerMode(), false);
|
setRingerModeInt(getRingerMode(), false);
|
||||||
}
|
}
|
||||||
|
readDockAudioSettings(mContentResolver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3722,7 +3751,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
config = AudioSystem.FORCE_BT_CAR_DOCK;
|
config = AudioSystem.FORCE_BT_CAR_DOCK;
|
||||||
break;
|
break;
|
||||||
case Intent.EXTRA_DOCK_STATE_LE_DESK:
|
case Intent.EXTRA_DOCK_STATE_LE_DESK:
|
||||||
|
synchronized (mSettingsLock) {
|
||||||
|
if (mDockAudioMediaEnabled) {
|
||||||
config = AudioSystem.FORCE_ANALOG_DOCK;
|
config = AudioSystem.FORCE_ANALOG_DOCK;
|
||||||
|
} else {
|
||||||
|
config = AudioSystem.FORCE_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Intent.EXTRA_DOCK_STATE_HE_DESK:
|
case Intent.EXTRA_DOCK_STATE_HE_DESK:
|
||||||
config = AudioSystem.FORCE_DIGITAL_DOCK;
|
config = AudioSystem.FORCE_DIGITAL_DOCK;
|
||||||
@ -3731,6 +3766,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
default:
|
default:
|
||||||
config = AudioSystem.FORCE_NONE;
|
config = AudioSystem.FORCE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioSystem.setForceUse(AudioSystem.FOR_DOCK, config);
|
AudioSystem.setForceUse(AudioSystem.FOR_DOCK, config);
|
||||||
} else if (action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED)) {
|
} else if (action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED)) {
|
||||||
state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE,
|
state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE,
|
||||||
|
Reference in New Issue
Block a user