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

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

Merge "Move roots constants to a shared location." into nyc-andromeda-dev

parents aa86dcd0 8659cbcc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -21,6 +21,5 @@
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/grid_item_margin"
    android:textAlignment="viewStart"
    android:typeface="monospace"
    android:textSize="11sp"
    android:textColor="#FF000000" />
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.view.View;
import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.Menus;
import com.android.documentsui.base.RootInfo;
import com.android.documentsui.base.Shared;
import com.android.documentsui.base.State;
import com.android.documentsui.dirlist.DirectoryFragment;
import com.android.documentsui.queries.SearchViewManager;
+12 −18
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.provider.DocumentsContract;
import android.util.Log;

import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.Providers;
import com.android.documentsui.base.RootInfo;
import com.android.documentsui.base.State;
import com.android.documentsui.base.State.ActionType;
@@ -48,13 +49,6 @@ import java.util.List;
public final class Metrics {
    private static final String TAG = "Metrics";

    // These are the native provider authorities that the metrics code is capable of recognizing and
    // explicitly counting.
    private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";
    private static final String AUTHORITY_STORAGE = "com.android.externalstorage.documents";
    private static final String AUTHORITY_DOWNLOADS = "com.android.providers.downloads.documents";
    private static final String AUTHORITY_MTP = "com.android.mtp.documents";

    // These strings have to be whitelisted in tron. Do not change them.
    private static final String COUNT_LAUNCH_ACTION = "docsui_launch_action";
    private static final String COUNT_ROOT_VISITED = "docsui_root_visited";
@@ -668,26 +662,26 @@ public final class Metrics {
        }

        switch (uri.getAuthority()) {
            case AUTHORITY_MEDIA:
            case Providers.AUTHORITY_MEDIA:
                switch (DocumentsContract.getRootId(uri)) {
                    case "audio_root":
                    case Providers.ROOT_ID_AUDIO:
                        return ROOT_AUDIO;
                    case "images_root":
                    case Providers.ROOT_ID_IMAGES:
                        return ROOT_IMAGES;
                    case "videos_root":
                    case Providers.ROOT_ID_VIDEOS:
                        return ROOT_VIDEOS;
                    default:
                        return ROOT_OTHER;
                }
            case AUTHORITY_STORAGE:
                if ("home".equals(DocumentsContract.getRootId(uri))) {
            case Providers.AUTHORITY_STORAGE:
                if (Providers.ROOT_ID_HOME.equals(DocumentsContract.getRootId(uri))) {
                    return ROOT_HOME;
                } else {
                    return ROOT_DEVICE_STORAGE;
                }
            case AUTHORITY_DOWNLOADS:
            case Providers.AUTHORITY_DOWNLOADS:
                return ROOT_DOWNLOADS;
            case AUTHORITY_MTP:
            case Providers.AUTHORITY_MTP:
                return ROOT_MTP;
            default:
                return ROOT_OTHER;
@@ -748,9 +742,9 @@ public final class Metrics {

    private static boolean isSystemProvider(String authority) {
        switch (authority) {
            case AUTHORITY_MEDIA:
            case AUTHORITY_STORAGE:
            case AUTHORITY_DOWNLOADS:
            case Providers.AUTHORITY_MEDIA:
            case Providers.AUTHORITY_STORAGE:
            case Providers.AUTHORITY_DOWNLOADS:
                return true;
            default:
                return false;
+4 −3
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;

import com.android.documentsui.base.Providers;

import java.io.File;
import java.io.IOException;
import java.util.List;
@@ -78,7 +80,6 @@ import java.util.List;
public class OpenExternalDirectoryActivity extends Activity {
    private static final String TAG = "OpenExternalDirectory";
    private static final String FM_TAG = "open_external_directory";
    private static final String EXTERNAL_STORAGE_AUTH = "com.android.externalstorage.documents";
    private static final String EXTRA_FILE = "com.android.documentsui.FILE";
    private static final String EXTRA_APP_LABEL = "com.android.documentsui.APP_LABEL";
    private static final String EXTRA_VOLUME_LABEL = "com.android.documentsui.VOLUME_LABEL";
@@ -315,7 +316,7 @@ public class OpenExternalDirectoryActivity extends Activity {
        }
        if (DEBUG) Log.d(TAG, "doc id for " + file + ": " + docId);

        final Uri uri = DocumentsContract.buildTreeDocumentUri(EXTERNAL_STORAGE_AUTH, docId);
        final Uri uri = DocumentsContract.buildTreeDocumentUri(Providers.AUTHORITY_STORAGE, docId);
        if (uri == null) {
            Log.e(TAG, "Could not get URI for doc id " + docId);
            return null;
@@ -502,7 +503,7 @@ public class OpenExternalDirectoryActivity extends Activity {
    private synchronized ContentProviderClient getExternalStorageClient() {
        if (mExternalStorageClient == null) {
            mExternalStorageClient =
                    getContentResolver().acquireContentProviderClient(EXTERNAL_STORAGE_AUTH);
                    getContentResolver().acquireContentProviderClient(Providers.AUTHORITY_STORAGE);
        }
        return mExternalStorageClient;
    }
+2 −1
Original line number Diff line number Diff line
@@ -222,7 +222,8 @@ public class DocumentInfo implements Durable, Parcelable {
                + ", isDeleteSupported=" + isDeleteSupported()
                + ", isCreateSupported=" + isCreateSupported()
                + ", isRenameSupported=" + isRenameSupported()
                + "}";
                + "} @ "
                + derivedUri;
    }

    public boolean isCreateSupported() {
Loading