diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-08-13 12:34:58 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-08-13 15:23:06 -0700 |
commit | 02dfd2630437ea5591942e503606fdeff29eb11e (patch) | |
tree | 878249efa160d9d6da60164eb91543ce19b1a851 /core/java/android/content/ContentProvider.java | |
parent | aba188523cd6ce7f5385fd2c10fa72c17ac80b88 (diff) | |
download | frameworks_base-02dfd2630437ea5591942e503606fdeff29eb11e.zip frameworks_base-02dfd2630437ea5591942e503606fdeff29eb11e.tar.gz frameworks_base-02dfd2630437ea5591942e503606fdeff29eb11e.tar.bz2 |
Fix bug with calls to the typeless open API.
Fix bug where we weren't using the default stream if a caller
requested "*/*" as a type. This broke apps calling the old open
APIs on content providers that did not report MIME types.
Change-Id: Id6e3e64e36cb8637097c3a7834b09407c27487d2
Diffstat (limited to 'core/java/android/content/ContentProvider.java')
-rw-r--r-- | core/java/android/content/ContentProvider.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java index e1d431f..8105843 100644 --- a/core/java/android/content/ContentProvider.java +++ b/core/java/android/content/ContentProvider.java @@ -851,8 +851,14 @@ public abstract class ContentProvider implements ComponentCallbacks { */ public AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts) throws FileNotFoundException { + if ("*/*".equals(mimeTypeFilter)) { + // If they can take anything, the untyped open call is good enough. + return openAssetFile(uri, "r"); + } String baseType = getType(uri); if (baseType != null && compareMimeTypes(baseType, mimeTypeFilter)) { + // Use old untyped open call if this provider has a type for this + // URI and it matches the request. return openAssetFile(uri, "r"); } throw new FileNotFoundException("Can't open " + uri + " as type " + mimeTypeFilter); |