Merge "Fix NullPointerException at VolumeSliceHelper" into sc-dev

This commit is contained in:
Jason Chiu
2021-05-19 07:03:17 +00:00
committed by Android (Google) Code Review

View File

@@ -111,6 +111,7 @@ public class VolumeSliceHelper {
private static void handleStreamChanged(Context context, Intent intent) {
final int inputType = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);
synchronized (sRegisteredUri) {
for (Map.Entry<Uri, Integer> entry : sRegisteredUri.entrySet()) {
if (entry.getValue() == inputType) {
context.getContentResolver().notifyChange(entry.getKey(), null /* observer */);
@@ -118,10 +119,13 @@ public class VolumeSliceHelper {
}
}
}
}
private static void notifyAllStreamsChanged(Context context) {
synchronized (sRegisteredUri) {
sRegisteredUri.forEach((uri, audioStream) -> {
context.getContentResolver().notifyChange(uri, null /* observer */);
});
}
}
}