From 813857d851cf7815038d27bd9246a880dfbcbb06 Mon Sep 17 00:00:00 2001 From: "guofei.xue" Date: Mon, 27 Jul 2020 16:26:39 +0800 Subject: [PATCH] When the mUri is null,it will happen NullPointerException. When test the monkey, the mUri is existed to be null pointer high probability. In order to prevent a null pointer exception, added a judgment condition that the mUri is not null or empty. Test:Perform the monkey test,and See if this NullPointerException will happen again when call the method of android.media.Ringtone#play. Bug: 169292270 Change-Id: I7907f0a376d67bb0a0f50ea155e2aa2f4552b1de --- media/java/android/media/Ringtone.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java index d35bc4176cb38..d02b496978219 100644 --- a/media/java/android/media/Ringtone.java +++ b/media/java/android/media/Ringtone.java @@ -372,7 +372,7 @@ public class Ringtone { AudioAttributes.toLegacyStreamType(mAudioAttributes)) != 0) { startLocalPlayer(); } - } else if (mAllowRemote && (mRemotePlayer != null)) { + } else if (mAllowRemote && (mRemotePlayer != null) && (mUri != null)) { final Uri canonicalUri = mUri.getCanonicalUri(); final boolean looping; final float volume;