Fix bad merge: Add STREAM_VOICE_CALL to MUTE_STREAMS_AFFECTED on upgrade

Fixed bad merge which deleted the changes merged in ag/4405475.
Update the system setting MUTE_STREAMS_AFFECTED to indicate that
STREAM_VOICE_CALL is affected by mute, as starting from P, phone apps can
mute the voice call stream as well.

Test: Manual test.
Bug: 110398177
Change-Id: I348af3fe1703d7a705728c33efffc48ce0fdfe7d
This commit is contained in:
Nadav Bar
2018-09-12 15:41:51 +03:00
parent 0ed64376e4
commit 8bc8c9ee0a

View File

@@ -2948,7 +2948,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 171;
private static final int SETTINGS_VERSION = 172;
private final int mUserId;
@@ -3900,6 +3900,37 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 171;
}
if (currentVersion == 171) {
// Version 171: by default, add STREAM_VOICE_CALL to list of streams that can
// be muted.
final SettingsState systemSettings = getSystemSettingsLocked(userId);
final Setting currentSetting = systemSettings.getSettingLocked(
Settings.System.MUTE_STREAMS_AFFECTED);
if (!currentSetting.isNull()) {
try {
int currentSettingIntegerValue = Integer.parseInt(
currentSetting.getValue());
if ((currentSettingIntegerValue
& (1 << AudioManager.STREAM_VOICE_CALL)) == 0) {
systemSettings.insertSettingLocked(
Settings.System.MUTE_STREAMS_AFFECTED,
Integer.toString(
currentSettingIntegerValue
| (1 << AudioManager.STREAM_VOICE_CALL)),
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
}
} catch (NumberFormatException e) {
// remove the setting in case it is not a valid integer
Slog.w("Failed to parse integer value of MUTE_STREAMS_AFFECTED"
+ "setting, removing setting", e);
systemSettings.deleteSettingLocked(
Settings.System.MUTE_STREAMS_AFFECTED);
}
}
currentVersion = 172;
}
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {