OSDN Git Service

MediaSessionService: Fix NPE
authorJaewan Kim <jaewan@google.com>
Thu, 7 Jun 2018 01:16:22 +0000 (10:16 +0900)
committerJaewan Kim <jaewan@google.com>
Thu, 7 Jun 2018 02:27:35 +0000 (11:27 +0900)
Bug: 109766690
Test: Run CtsMediaTests
Change-Id: Id94bc1a4c46a28f920b10e39c0ada7ad6a90fc01

services/core/java/com/android/server/media/MediaSessionService.java

index 6fff367..68b2a58 100644 (file)
@@ -781,6 +781,9 @@ public class MediaSessionService extends SystemService implements Monitor {
     }
 
     private void dispatchVolumeKeyLongPressLocked(KeyEvent keyEvent) {
+        if (mCurrentFullUserRecord.mOnVolumeKeyLongPressListener == null) {
+            return;
+        }
         try {
             mCurrentFullUserRecord.mOnVolumeKeyLongPressListener.onVolumeKeyLongPress(keyEvent);
         } catch (RemoteException e) {