Merge changes from topics "bug136256059_attempt2", "bug136256059_builder"

am: 6ed8fce33f

Change-Id: If95ba459b29a3fd2eede6390bbab18f95f762587
This commit is contained in:
Tobias Thierer
2019-09-30 02:38:49 -07:00
committed by android-build-merger
3 changed files with 12 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.ApplicationErrorReport;
import android.content.type.MimeMapImpl;
import android.content.type.DefaultMimeMapFactory;
import android.os.Build;
import android.os.DeadObjectException;
import android.os.Debug;
@@ -209,7 +209,7 @@ public class RuntimeInit {
* contains many more entries that are derived from IANA registrations but
* with several customizations (extensions, overrides).
*/
MimeMap.setDefault(MimeMapImpl.createDefaultInstance());
MimeMap.setDefault(DefaultMimeMapFactory.create());
}
@UnsupportedAppUsage

View File

@@ -20,7 +20,7 @@ java_library {
],
srcs: [
"java/android/content/type/MimeMapImpl.java",
"java/android/content/type/DefaultMimeMapFactory.java",
],
java_resources: [

View File

@@ -26,21 +26,24 @@ import java.util.List;
import java.util.regex.Pattern;
/**
* Default implementation of {@link MimeMap}, a bidirectional mapping between
* MIME types and file extensions.
* Creates the framework default {@link MimeMap}, a bidirectional mapping
* between MIME types and file extensions.
*
* This default mapping is loaded from data files that start with some mappings
* recognized by IANA plus some custom extensions and overrides.
*
* @hide
*/
public class MimeMapImpl {
public class DefaultMimeMapFactory {
private DefaultMimeMapFactory() {
}
/**
* Creates and returns a new {@link MimeMapImpl} instance that implements.
* Creates and returns a new {@link MimeMap} instance that implements.
* Android's default mapping between MIME types and extensions.
*/
public static MimeMap createDefaultInstance() {
public static MimeMap create() {
return parseFromResources("/mime.types", "/android.mime.types");
}
@@ -56,7 +59,7 @@ public class MimeMapImpl {
private static void parseTypes(MimeMap.Builder builder, String resource) {
try (BufferedReader r = new BufferedReader(
new InputStreamReader(MimeMapImpl.class.getResourceAsStream(resource)))) {
new InputStreamReader(DefaultMimeMapFactory.class.getResourceAsStream(resource)))) {
String line;
while ((line = r.readLine()) != null) {
int commentPos = line.indexOf('#');