Merge "Muting ring volume slider disables notification" into tm-qpr-dev am: 40a293fbdf am: d65e087b0d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21164988

Change-Id: I560670cee8bd07312766d494c4a66ef770e121cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Behnam Heydarshahi
2023-02-16 15:47:36 +00:00
committed by Automerger Merge Worker
7 changed files with 121 additions and 24 deletions

View File

@@ -93,8 +93,9 @@ public class VolumeSliceHelper {
if (AudioManager.VOLUME_CHANGED_ACTION.equals(action)) {
handleVolumeChanged(context, intent);
} else if (AudioManager.STREAM_MUTE_CHANGED_ACTION.equals(action)
|| AudioManager.STREAM_DEVICES_CHANGED_ACTION.equals(action)) {
} else if (AudioManager.STREAM_MUTE_CHANGED_ACTION.equals(action)) {
handleMuteChanged(context, intent);
} else if (AudioManager.STREAM_DEVICES_CHANGED_ACTION.equals(action)) {
handleStreamChanged(context, intent);
} else {
notifyAllStreamsChanged(context);
@@ -109,8 +110,29 @@ public class VolumeSliceHelper {
}
}
/**
* When mute is changed, notifyChange on relevant Volume Slice ContentResolvers to mark them
* as needing update.
*
* In addition to the matching stream, we always notifyChange for the Notification stream
* when Ring events are issued. This is to make sure that Notification always gets updated
* for RingerMode changes, even if Notification's volume is zero and therefore it would not
* get its own AudioManager.VOLUME_CHANGED_ACTION.
*/
private static void handleMuteChanged(Context context, Intent intent) {
final int inputType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);
handleStreamChanged(context, inputType);
if (inputType == AudioManager.STREAM_RING) {
handleStreamChanged(context, AudioManager.STREAM_NOTIFICATION);
}
}
private static void handleStreamChanged(Context context, Intent intent) {
final int inputType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);
handleStreamChanged(context, inputType);
}
private static void handleStreamChanged(Context context, int inputType) {
synchronized (sRegisteredUri) {
for (Map.Entry<Uri, Integer> entry : sRegisteredUri.entrySet()) {
if (entry.getValue() == inputType) {