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

Commit 02eeaf52 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove legacy code for Home root"

parents 194178ef 3afe6d51
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@
    <!-- Intentionally unset. Vendors should set this in an overlay. -->
    <string name="trusted_quick_viewer_package" translatable="false"></string>

    <bool name="show_documents_root">false</bool>

    <!-- Indicates if DocumentsUI should handle VIEW_DOWNLOADS Intent.
    on ARC++ devices, there exists another handler which handles VIEW_DOWNLOADS Intent. -->
    <bool name="handle_view_downloads_intent">true</bool>
+1 −19
Original line number Diff line number Diff line
@@ -220,10 +220,7 @@ public class RootInfo implements Durable, Parcelable, Comparable<RootInfo> {
    private void deriveFields() {
        derivedMimeTypes = (mimeTypes != null) ? mimeTypes.split("\n") : null;

        if (isExternalStorageHome()) {
            derivedType = TYPE_LOCAL;
            derivedIcon = LOAD_FROM_CONTENT_RESOLVER;
        } else if (isMtp()) {
        if (isMtp()) {
            derivedType = TYPE_MTP;
            derivedIcon = R.drawable.ic_usb_storage;
        } else if (isUsb()) {
@@ -277,16 +274,6 @@ public class RootInfo implements Durable, Parcelable, Comparable<RootInfo> {
        return authority == null && rootId == null;
    }

    /*
     * Return true, if the root is from ExternalStorage and the id is home. Otherwise, return false.
     */
    public boolean isExternalStorageHome() {
        // Note that "home" is the expected root id for the auto-created
        // user home directory on external storage. The "home" value should
        // match ExternalStorageProvider.ROOT_ID_HOME.
        return isExternalStorage() && "home".equals(rootId);
    }

    public boolean isExternalStorage() {
        return Providers.AUTHORITY_STORAGE.equals(authority);
    }
@@ -389,11 +376,6 @@ public class RootInfo implements Durable, Parcelable, Comparable<RootInfo> {
    }

    private Drawable loadMimeTypeIcon(Context context) {

        if (isExternalStorageHome()) {
            return IconUtils.loadMimeIcon(context, DocumentsContract.Document.MIME_TYPE_DIR);
        }

        switch (derivedType) {
            case TYPE_IMAGES:
                return IconUtils.loadMimeIcon(context, MimeTypes.IMAGE_MIME);
+0 −7
Original line number Diff line number Diff line
@@ -284,13 +284,6 @@ public final class Shared {
        }
    }

    /**
     * Returns true if "Documents" root should be shown.
     */
    public static boolean shouldShowDocumentsRoot(Context context) {
        return context.getResources().getBoolean(R.bool.show_documents_root);
    }

    /**
     * Check config whether DocumentsUI is launcher enabled or not.
     * @return true if launcher icon is shown.
+1 −4
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ import com.android.documentsui.base.DocumentStack;
import com.android.documentsui.base.Events;
import com.android.documentsui.base.Providers;
import com.android.documentsui.base.RootInfo;
import com.android.documentsui.base.Shared;
import com.android.documentsui.base.State;
import com.android.documentsui.base.UserId;
import com.android.documentsui.roots.ProvidersAccess;
@@ -301,9 +300,7 @@ public class RootsFragment extends Fragment {
        for (final RootInfo root : roots) {
            final RootItem item;

            if (root.isExternalStorageHome() && !Shared.shouldShowDocumentsRoot(getContext())) {
                continue;
            } else if (root.isLibrary() || root.isDownloads()) {
            if (root.isLibrary() || root.isDownloads()) {
                item = new RootItem(root, mActionHandler);
                libraries.add(item);
            } else if (root.isStorage()) {
+4 −9
Original line number Diff line number Diff line
@@ -16,13 +16,14 @@

package com.android.documentsui.testing;

import android.content.res.Resources;
import android.util.SparseArray;
import android.util.SparseBooleanArray;

import androidx.annotation.BoolRes;
import androidx.annotation.NonNull;
import androidx.annotation.PluralsRes;
import androidx.annotation.StringRes;
import android.content.res.Resources;
import android.util.SparseArray;
import android.util.SparseBooleanArray;

import com.android.documentsui.R;
import com.android.documentsui.files.QuickViewIntentBuilder;
@@ -52,8 +53,6 @@ public abstract class TestResources extends Resources {
        res.strings = new SparseArray<>();
        res.plurals = new SparseArray<>();

        res.setProductivityDeviceEnabled(false);

        // quick view package can be set via system property on debug builds.
        // unfortunately that interfers with testing. For that reason we have
        // this little hack....QuickViewIntentBuilder will check for this value
@@ -71,10 +70,6 @@ public abstract class TestResources extends Resources {
        strings.put(R.string.default_root_uri, uri);
    }

    public void setProductivityDeviceEnabled(boolean enabled) {
        bools.put(R.bool.show_documents_root, enabled);
    }

    @Override
    public final boolean getBoolean(@BoolRes int id) throws NotFoundException {
        return bools.get(id);
Loading