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

Commit e6bdbeb0 authored by Tony Huang's avatar Tony Huang
Browse files

Refactor some codes for unbundle (2/N)

1. Refactor some @hide api call to normal api call
   for same function
2. Remove unnecessary @hide api call.

Bug: 118794189
Test: atest DocumentsUITest
Change-Id: I08198bf12362dbaa67a3709f99a2d7bc7523cb83
parent cd58901f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -22,12 +22,11 @@ import android.content.res.Resources;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.webkit.MimeTypeMap;

import com.android.documentsui.base.Lookup;
import com.android.documentsui.base.MimeTypes;

import libcore.net.MimeUtils;

import java.util.HashMap;

/**
@@ -152,7 +151,7 @@ public class FileTypeMap implements Lookup<String, String> {

    private String getFileTypeString(
            String mimeType, @StringRes int formatStringId, @StringRes int defaultStringId) {
        final String extension = MimeUtils.guessExtensionFromMimeType(mimeType);
        final String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);

        return TextUtils.isEmpty(extension)
                ? mRes.getString(defaultStringId)
+0 −4
Original line number Diff line number Diff line
@@ -29,10 +29,6 @@ import androidx.annotation.BoolRes;
 */
public interface Features {

    // technically we want to check >= O, but we'd need to patch back the O version code :|
    public static final boolean OMC_RUNTIME =
            android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.N_MR1;

    boolean isArchiveCreationEnabled();
    boolean isCommandInterceptorEnabled();
    boolean isContentPagingEnabled();
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ public class State implements android.os.Parcelable {
        public State createFromParcel(Parcel in, ClassLoader loader) {
            final State state = new State();
            state.action = in.readInt();
            state.acceptMimes = in.readStringArray();
            state.acceptMimes = in.createStringArray();
            state.allowMultiple = in.readInt() != 0;
            state.localOnly = in.readInt() != 0;
            state.showDeviceStorageOption = in.readInt() != 0;
+3 −1
Original line number Diff line number Diff line
@@ -164,7 +164,9 @@ public final class ClipStorage implements ClipStore {
        try {
            Os.symlink(primary.getAbsolutePath(), link.getAbsolutePath());
        } catch (ErrnoException e) {
            e.rethrowAsIOException();
            IOException newException = new IOException(e.getMessage());
            newException.initCause(e);
            throw newException;
        }
        return link;
    }
+0 −6
Original line number Diff line number Diff line
@@ -323,12 +323,6 @@ final class RuntimeDocumentClipper implements DocumentClipper {

    private static ClipData createClipData(
            ClipDescription description, ArrayList<ClipData.Item> clipItems) {

        // technically we want to check >= O, but we'd need to patch back the O version code :|
        if (Features.OMC_RUNTIME) {
            return new ClipData(description, clipItems);
        }

        ClipData clip = new ClipData(description, clipItems.get(0));
        for (int i = 1; i < clipItems.size(); i++) {
            clip.addItem(clipItems.get(i));
Loading