From 6565c0dbe4c5cf96aa1c2576974b0f464b2db6cd Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 9 Jul 2018 15:51:16 -0700 Subject: [PATCH] MediaSessionRecord: protect adjustVolume from SecurityException Take into account that all methods that end up calling AudioService.adjustStreamVolume(...) can throw a SecurityException when the caller doesn't have the right permission to change the DnD mode. Bug: 110525559 Test: none yet Change-Id: I4622a07ea8be2ce03fb9732796a08f671a17b45d --- .../core/java/com/android/server/media/MediaSessionRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java index 442354bbb6b97..a49cf44dc775a 100644 --- a/services/core/java/com/android/server/media/MediaSessionRecord.java +++ b/services/core/java/com/android/server/media/MediaSessionRecord.java @@ -481,7 +481,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); } - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException | SecurityException e) { Log.e(TAG, "Cannot adjust volume: direction=" + direction + ", stream=" + stream + ", flags=" + flags + ", packageName=" + packageName + ", uid=" + uid + ", useSuggested=" + useSuggested