Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af0cef98 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

MimeMapImpl.createDefaultInstance() -> DefaultMimeMapFactory.create().

The class no longer implements MimeMap, so the name MimeMapImpl
no longer made sense.

Test: Treehugger
Bug: 136256059
Change-Id: I2cbc70a7769232b704a9bdfde2def832c1e292b8
parent fd9657d0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ java_library {
    ],

    srcs: [
        "java/android/content/type/MimeMapImpl.java",
        "java/android/content/type/DefaultMimeMapFactory.java",
    ],

    java_resources: [
+9 −6
Original line number Diff line number Diff line
@@ -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('#');