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

Commit c9f5b17d authored by Aga Wronska's avatar Aga Wronska Committed by android-build-merger
Browse files

Merge "Add config flag to show/hide internal storage. Hide internal storage by...

Merge "Add config flag to show/hide internal storage. Hide internal storage by default." into nyc-dev
am: 5f7d673f

* commit '5f7d673f':
  Add config flag to show/hide internal storage. Hide internal storage by default.
parents 85ea32b0 5f7d673f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -438,6 +438,10 @@ public class VolumeInfo implements Parcelable {
        final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setData(uri);

        // note that docsui treats this as *force* show advanced. So sending
        // false permits advanced to be shown based on user preferences.
        intent.putExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, isPrimary());
        intent.putExtra(DocumentsContract.EXTRA_SHOW_FILESIZE, true);
        return intent;
    }
+15 −3
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ public final class DocumentsContract {
    /** {@hide} */
    public static final String EXTRA_PACKAGE_NAME = "android.content.extra.PACKAGE_NAME";

    /** {@hide} */
    public static final String EXTRA_SHOW_ADVANCED = "android.content.extra.SHOW_ADVANCED";

    /** {@hide} */
    public static final String EXTRA_SHOW_FILESIZE = "android.content.extra.SHOW_FILESIZE";

@@ -555,6 +558,15 @@ public final class DocumentsContract {
         */
        public static final int FLAG_EMPTY = 1 << 16;

        /**
         * Flag indicating that this root should only be visible to advanced
         * users.
         *
         * @see #COLUMN_FLAGS
         * @hide
         */
        public static final int FLAG_ADVANCED = 1 << 17;

        /**
         * Flag indicating that this root has settings.
         *
@@ -562,7 +574,7 @@ public final class DocumentsContract {
         * @see DocumentsContract#ACTION_DOCUMENT_ROOT_SETTINGS
         * @hide
         */
        public static final int FLAG_HAS_SETTINGS = 1 << 17;
        public static final int FLAG_HAS_SETTINGS = 1 << 18;

        /**
         * Flag indicating that this root is on removable SD card storage.
@@ -570,7 +582,7 @@ public final class DocumentsContract {
         * @see #COLUMN_FLAGS
         * @hide
         */
        public static final int FLAG_REMOVABLE_SD = 1 << 18;
        public static final int FLAG_REMOVABLE_SD = 1 << 19;

        /**
         * Flag indicating that this root is on removable USB storage.
@@ -578,7 +590,7 @@ public final class DocumentsContract {
         * @see #COLUMN_FLAGS
         * @hide
         */
        public static final int FLAG_REMOVABLE_USB = 1 << 19;
        public static final int FLAG_REMOVABLE_USB = 1 << 20;
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -24,5 +24,6 @@
    <!-- Indicates if the home directory should be hidden in the roots list, that is presented
         in the drawer/left side panel ) -->
    <bool name="home_root_hidden">true</bool>

    <!-- Indicates if the advanced roots like internal storage should be hidden in the roots list) -->
    <bool name="advanced_roots_hidden">true</bool>
</resources>
+9 −0
Original line number Diff line number Diff line
@@ -320,6 +320,8 @@ public class RootsFragment extends Fragment {

                if (root.isHome() && isHomeRootHidden(context)) {
                    continue;
                } else if (root.isAdvanced() && areAdvancedRootsHidden(context)) {
                    continue;
                } else if (root.isLibrary()) {
                    if (DEBUG) Log.d(TAG, "Adding " + root + " as library.");
                    libraries.add(item);
@@ -377,6 +379,13 @@ public class RootsFragment extends Fragment {
            return context.getResources().getBoolean(R.bool.home_root_hidden);
        }

        /*
         * Indicates if the advanced roots should be hidden.
         */
        private boolean areAdvancedRootsHidden(Context context) {
            return context.getResources().getBoolean(R.bool.advanced_roots_hidden);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final Item item = getItem(position);
+4 −0
Original line number Diff line number Diff line
@@ -298,6 +298,10 @@ public class RootInfo implements Durable, Parcelable, Comparable<RootInfo> {
        return (flags & Root.FLAG_SUPPORTS_SEARCH) != 0;
    }

    public boolean isAdvanced() {
        return (flags & Root.FLAG_ADVANCED) != 0;
    }

    public boolean isLocalOnly() {
        return (flags & Root.FLAG_LOCAL_ONLY) != 0;
    }
Loading