Merge "AudioService: fix volume group setting name" into tm-qpr-dev
This commit is contained in:
@@ -2251,8 +2251,8 @@ public class AudioService extends IAudioService.Stub
|
|||||||
synchronized (VolumeStreamState.class) {
|
synchronized (VolumeStreamState.class) {
|
||||||
mStreamStates[AudioSystem.STREAM_DTMF]
|
mStreamStates[AudioSystem.STREAM_DTMF]
|
||||||
.setAllIndexes(mStreamStates[dtmfStreamAlias], caller);
|
.setAllIndexes(mStreamStates[dtmfStreamAlias], caller);
|
||||||
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName =
|
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setSettingName(
|
||||||
System.VOLUME_SETTINGS_INT[a11yStreamAlias];
|
System.VOLUME_SETTINGS_INT[a11yStreamAlias]);
|
||||||
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes(
|
mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes(
|
||||||
mStreamStates[a11yStreamAlias], caller);
|
mStreamStates[a11yStreamAlias], caller);
|
||||||
}
|
}
|
||||||
@@ -7505,7 +7505,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
private int mPublicStreamType = AudioSystem.STREAM_MUSIC;
|
private int mPublicStreamType = AudioSystem.STREAM_MUSIC;
|
||||||
private AudioAttributes mAudioAttributes = AudioProductStrategy.getDefaultAttributes();
|
private AudioAttributes mAudioAttributes = AudioProductStrategy.getDefaultAttributes();
|
||||||
private boolean mIsMuted = false;
|
private boolean mIsMuted = false;
|
||||||
private final String mSettingName;
|
private String mSettingName;
|
||||||
|
|
||||||
// No API in AudioSystem to get a device from strategy or from attributes.
|
// No API in AudioSystem to get a device from strategy or from attributes.
|
||||||
// Need a valid public stream type to use current API getDeviceForStream
|
// Need a valid public stream type to use current API getDeviceForStream
|
||||||
@@ -7834,15 +7834,19 @@ public class AudioService extends IAudioService.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void persistVolumeGroup(int device) {
|
private void persistVolumeGroup(int device) {
|
||||||
if (mUseFixedVolume) {
|
// No need to persist the index if the volume group is backed up
|
||||||
|
// by a public stream type as this is redundant
|
||||||
|
if (mUseFixedVolume || mHasValidStreamType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DEBUG_VOL) {
|
if (DEBUG_VOL) {
|
||||||
Log.v(TAG, "persistVolumeGroup: storing index " + getIndex(device) + " for group "
|
Log.v(TAG, "persistVolumeGroup: storing index " + getIndex(device) + " for group "
|
||||||
+ mAudioVolumeGroup.name()
|
+ mAudioVolumeGroup.name()
|
||||||
+ ", device " + AudioSystem.getOutputDeviceName(device)
|
+ ", device " + AudioSystem.getOutputDeviceName(device)
|
||||||
+ " and User=" + getCurrentUserId());
|
+ " and User=" + getCurrentUserId()
|
||||||
|
+ " mSettingName: " + mSettingName);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean success = mSettings.putSystemIntForUser(mContentResolver,
|
boolean success = mSettings.putSystemIntForUser(mContentResolver,
|
||||||
getSettingNameForDevice(device),
|
getSettingNameForDevice(device),
|
||||||
getIndex(device),
|
getIndex(device),
|
||||||
@@ -7905,6 +7909,14 @@ public class AudioService extends IAudioService.Stub
|
|||||||
return mSettingName + "_" + AudioSystem.getOutputDeviceName(device);
|
return mSettingName + "_" + AudioSystem.getOutputDeviceName(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSettingName(String settingName) {
|
||||||
|
mSettingName = settingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSettingName() {
|
||||||
|
return mSettingName;
|
||||||
|
}
|
||||||
|
|
||||||
private void dump(PrintWriter pw) {
|
private void dump(PrintWriter pw) {
|
||||||
pw.println("- VOLUME GROUP " + mAudioVolumeGroup.name() + ":");
|
pw.println("- VOLUME GROUP " + mAudioVolumeGroup.name() + ":");
|
||||||
pw.print(" Muted: ");
|
pw.print(" Muted: ");
|
||||||
@@ -8029,6 +8041,9 @@ public class AudioService extends IAudioService.Stub
|
|||||||
*/
|
*/
|
||||||
public void setVolumeGroupState(VolumeGroupState volumeGroupState) {
|
public void setVolumeGroupState(VolumeGroupState volumeGroupState) {
|
||||||
mVolumeGroupState = volumeGroupState;
|
mVolumeGroupState = volumeGroupState;
|
||||||
|
if (mVolumeGroupState != null) {
|
||||||
|
mVolumeGroupState.setSettingName(mVolumeIndexSettingName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Update the minimum index that can be used without MODIFY_AUDIO_SETTINGS permission
|
* Update the minimum index that can be used without MODIFY_AUDIO_SETTINGS permission
|
||||||
@@ -8099,6 +8114,17 @@ public class AudioService extends IAudioService.Stub
|
|||||||
return (mVolumeIndexSettingName != null && !mVolumeIndexSettingName.isEmpty());
|
return (mVolumeIndexSettingName != null && !mVolumeIndexSettingName.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSettingName(String settingName) {
|
||||||
|
mVolumeIndexSettingName = settingName;
|
||||||
|
if (mVolumeGroupState != null) {
|
||||||
|
mVolumeGroupState.setSettingName(mVolumeIndexSettingName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSettingName() {
|
||||||
|
return mVolumeIndexSettingName;
|
||||||
|
}
|
||||||
|
|
||||||
public void readSettings() {
|
public void readSettings() {
|
||||||
synchronized (mSettingsLock) {
|
synchronized (mSettingsLock) {
|
||||||
synchronized (VolumeStreamState.class) {
|
synchronized (VolumeStreamState.class) {
|
||||||
@@ -8747,7 +8773,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
if (streamState.hasValidSettingsName()) {
|
if (streamState.hasValidSettingsName()) {
|
||||||
mSettings.putSystemIntForUser(mContentResolver,
|
mSettings.putSystemIntForUser(mContentResolver,
|
||||||
streamState.getSettingNameForDevice(device),
|
streamState.getSettingNameForDevice(device),
|
||||||
(streamState.getIndex(device) + 5)/ 10,
|
(streamState.getIndex(device) + 5) / 10,
|
||||||
UserHandle.USER_CURRENT);
|
UserHandle.USER_CURRENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user