diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-11-14 19:16:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-14 19:16:38 +0000 |
commit | afc506c54bd244fc96e20e74e428569b845e3767 (patch) | |
tree | f4abfcea6c671bfd55676db3a96a2c3f3de8d108 /packages/SettingsProvider | |
parent | e3435feed48ecd1f37904f48ebb7e39dc9456d03 (diff) | |
parent | 670cf5c663f4f17faafa9d4f7cf7209f68a02468 (diff) | |
download | frameworks_base-afc506c54bd244fc96e20e74e428569b845e3767.zip frameworks_base-afc506c54bd244fc96e20e74e428569b845e3767.tar.gz frameworks_base-afc506c54bd244fc96e20e74e428569b845e3767.tar.bz2 |
am 670cf5c6: am 22c3f906: am 628d2606: Merge "Move ringtone redirection to MediaPlayer." into lmp-mr1-dev
* commit '670cf5c663f4f17faafa9d4f7cf7209f68a02468':
Move ringtone redirection to MediaPlayer.
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 34e57bc..6828301 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -37,13 +37,11 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.UserInfo; -import android.content.res.AssetFileDescriptor; import android.database.AbstractCursor; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteQueryBuilder; -import android.media.RingtoneManager; import android.net.Uri; import android.os.Binder; import android.os.Bundle; @@ -54,7 +52,6 @@ import android.os.Process; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; -import android.provider.MediaStore; import android.provider.Settings; import android.provider.Settings.Secure; import android.text.TextUtils; @@ -1228,77 +1225,8 @@ public class SettingsProvider extends ContentProvider { @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { - - /* - * When a client attempts to openFile the default ringtone or - * notification setting Uri, we will proxy the call to the current - * default ringtone's Uri (if it is in the media provider). - */ - int ringtoneType = RingtoneManager.getDefaultType(uri); - // Above call returns -1 if the Uri doesn't match a default type - if (ringtoneType != -1) { - Context context = getContext(); - - // Get the current value for the default sound - Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType); - - if (soundUri != null) { - // Proxy the openFile call to media provider - String authority = soundUri.getAuthority(); - if (authority.equals(MediaStore.AUTHORITY)) { - return context.getContentResolver().openFileDescriptor(soundUri, mode); - } - } - } - - return super.openFile(uri, mode); - } - - @Override - public AssetFileDescriptor openAssetFile(Uri uri, String mode) throws FileNotFoundException { - - /* - * When a client attempts to openFile the default ringtone or - * notification setting Uri, we will proxy the call to the current - * default ringtone's Uri (if it is in the media provider). - */ - int ringtoneType = RingtoneManager.getDefaultType(uri); - // Above call returns -1 if the Uri doesn't match a default type - if (ringtoneType != -1) { - Context context = getContext(); - - // Get the current value for the default sound - Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType); - - if (soundUri != null) { - // Proxy the openFile call to media provider - String authority = soundUri.getAuthority(); - if (authority.equals(MediaStore.AUTHORITY)) { - ParcelFileDescriptor pfd = null; - try { - pfd = context.getContentResolver().openFileDescriptor(soundUri, mode); - return new AssetFileDescriptor(pfd, 0, -1); - } catch (FileNotFoundException ex) { - // fall through and open the fallback ringtone below - } - } - - try { - return super.openAssetFile(soundUri, mode); - } catch (FileNotFoundException ex) { - // Since a non-null Uri was specified, but couldn't be opened, - // fall back to the built-in ringtone. - return context.getResources().openRawResourceFd( - com.android.internal.R.raw.fallbackring); - } - } - // no need to fall through and have openFile() try again, since we - // already know that will fail. - throw new FileNotFoundException(); // or return null ? - } - - // Note that this will end up calling openFile() above. - return super.openAssetFile(uri, mode); + throw new FileNotFoundException("Direct file access no longer supported; " + + "ringtone playback is available through android.media.Ringtone"); } /** |