summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2014-12-09 23:59:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2014-12-09 23:59:58 +0000
commit236dc2c81d9bb2a38b29dd1a4c7e23be25290ef2 (patch)
tree9ca328886d7439671c8ece26e64d61a440457cf9 /media
parent41a635e083c2b8e5fe9f5226645857dd83e400b2 (diff)
parent8650c358fb44b943dd74751742333bf1cebf7b8e (diff)
downloadframeworks_base-236dc2c81d9bb2a38b29dd1a4c7e23be25290ef2.zip
frameworks_base-236dc2c81d9bb2a38b29dd1a4c7e23be25290ef2.tar.gz
frameworks_base-236dc2c81d9bb2a38b29dd1a4c7e23be25290ef2.tar.bz2
am 1102e712: Merge "Throw IOException when missing default ringtone." into lmp-mr1-dev
automerge: 8650c35 * commit '8650c358fb44b943dd74751742333bf1cebf7b8e': Throw IOException when missing default ringtone.
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaPlayer.java4
-rw-r--r--media/java/android/media/Ringtone.java13
2 files changed, 11 insertions, 6 deletions
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index acf1b43..615dac2 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -61,6 +61,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -979,6 +980,9 @@ public class MediaPlayer implements SubtitleController.Listener
// Redirect ringtones to go directly to underlying provider
uri = RingtoneManager.getActualDefaultRingtoneUri(context,
RingtoneManager.getDefaultType(uri));
+ if (uri == null) {
+ throw new FileNotFoundException("Failed to resolve default ringtone");
+ }
}
AssetFileDescriptor fd = null;
diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java
index 7d075ba..8441541 100644
--- a/media/java/android/media/Ringtone.java
+++ b/media/java/android/media/Ringtone.java
@@ -51,6 +51,12 @@ public class Ringtone {
private final Context mContext;
private final AudioManager mAudioManager;
+
+ /**
+ * Flag indicating if we're allowed to fall back to remote playback using
+ * {@link #mRemotePlayer}. Typically this is false when we're the remote
+ * player and there is nobody else to delegate to.
+ */
private final boolean mAllowRemote;
private final IRingtonePlayer mRemotePlayer;
private final Binder mRemoteToken;
@@ -211,12 +217,7 @@ public class Ringtone {
mLocalPlayer.setAudioAttributes(mAudioAttributes);
mLocalPlayer.prepare();
- } catch (SecurityException e) {
- destroyLocalPlayer();
- if (!mAllowRemote) {
- Log.w(TAG, "Remote playback not allowed: " + e);
- }
- } catch (IOException e) {
+ } catch (SecurityException | IOException e) {
destroyLocalPlayer();
if (!mAllowRemote) {
Log.w(TAG, "Remote playback not allowed: " + e);