-
- Downloads
Move default MimeMap implementation to frameworks.
This CL topic moves the default MimeMap implementation to frameworks. Libcore starts with a minimal implementation sufficient to pass CtsLibcoreTestCases, but frameworks can inject the real implementation. Before this CL topic, the data files and logic (MimeMapImpl) were part of core-*.jar on device; after this CL, they instead live in framework.jar. Tests from MimeMapTest that check behavior of that default implementation also move to a non-libcore CTS test. Specifically, the logic and android.mime.types now live in frameworks/base/mime. The default implementation is injected into libcore from RuntimeInit. I chose to use a separate directory (frameworks/base/mime/) and build java_library target ("mimemap") in order to keep this as separate as possible from the rest of frameworks code, to make it as easy as possible to factor this out into a separate APEX module if we ever choose to do so. Planned work for follow-up CL: 1. Make CTS more opinionated, with a plan to assert that all of the default mappings are present. How exactly the expectated mapping will be bundled in CTS is still TBD. 2. Add a vendor.mime.types file (defaults to empty) where vendors can add additional mappings; I plan to make it such that mappings in that file are parsed last but never override any earlier mappings, as if each mime type / file extension was prefixed with '?'. 3. Perhaps enforce that public APIs android.webkit.MimeTypeMap and java.net.URLConnection.getFileNameMap() behave consistently with MimeMap.getDefault(). Test: atest CtsLibcoreTestCases Test: atest CtsMimeMapTestCases Bug: 136256059 Change-Id: Ib955699694d24a25c33ef2445443afb7c35ed9e7
Showing
- Android.bp 1 addition, 0 deletionsAndroid.bp
- core/java/com/android/internal/os/RuntimeInit.java 9 additions, 0 deletionscore/java/com/android/internal/os/RuntimeInit.java
- mime/Android.bp 43 additions, 0 deletionsmime/Android.bp
- mime/java-res/android.mime.types 146 additions, 0 deletionsmime/java-res/android.mime.types
- mime/java/android/content/type/MimeMapImpl.java 194 additions, 0 deletionsmime/java/android/content/type/MimeMapImpl.java
Loading
Please register or sign in to comment