Browse mode for DocumentsUI, removed volume state.

The existing management mode is too specific, and requires that
storage backends add queryChildDocumentsForManage(), etc.  Instead,
to offer more natural browsing support, add a new BROWSE_ROOT intent.

It behaves mostly like MANAGE_ROOT, except that it doesn't mutate
its Uris with setManageMode(), and it shortcuts straight to VIEW on
clicked documents.

It can be launched like this:

$ adb shell am start -a android.provider.action.BROWSE_ROOT
    -d content://com.android.externalstorage.documents/root/8405-1DFB
    -c android.intent.category.DEFAULT

Also rename a MetricsConstants to make it clearer, and don't
auto-mount all emulated volumes.

Fix bugs around parceling of DiskInfo/VolumeInfo.  Method to resolve
the best description for a VolumeInfo, which might need to fall
back to DiskInfo.

Add back "removed" volume state so we send broadcast when a volume
is destroyed, matching the expected public API behavior.

Bug: 19993667
Change-Id: I13aff32c5e11dfc63da44aee9e93a27f4690a43f
diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java
index 56c55f1..4704b67 100644
--- a/core/java/android/os/storage/DiskInfo.java
+++ b/core/java/android/os/storage/DiskInfo.java
@@ -16,7 +16,7 @@
 
 package android.os.storage;
 
-import android.content.Context;
+import android.content.res.Resources;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.util.DebugUtils;
@@ -57,12 +57,12 @@
         volumes = parcel.readStringArray();
     }
 
-    public String getDescription(Context context) {
+    public String getDescription() {
         // TODO: splice vendor label into these strings
         if ((flags & FLAG_SD) != 0) {
-            return context.getString(com.android.internal.R.string.storage_sd_card);
+            return Resources.getSystem().getString(com.android.internal.R.string.storage_sd_card);
         } else if ((flags & FLAG_USB) != 0) {
-            return context.getString(com.android.internal.R.string.storage_usb);
+            return Resources.getSystem().getString(com.android.internal.R.string.storage_usb);
         } else {
             return null;
         }
@@ -119,7 +119,7 @@
     @Override
     public void writeToParcel(Parcel parcel, int flags) {
         parcel.writeString(id);
-        parcel.writeInt(flags);
+        parcel.writeInt(this.flags);
         parcel.writeLong(size);
         parcel.writeString(label);
         parcel.writeStringArray(volumes);