summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-06-15 21:09:10 -0700
committerJeff Sharkey <jsharkey@android.com>2015-06-15 21:39:28 -0700
commitb521feaed410b6862baca9b42d5fd7c398e07b2f (patch)
tree5916d7a46ffa214a1c2fcf4175febfafc7895970 /packages
parent0463cad783e78381f390855d1cc9d7d8d803b634 (diff)
downloadframeworks_base-b521feaed410b6862baca9b42d5fd7c398e07b2f.zip
frameworks_base-b521feaed410b6862baca9b42d5fd7c398e07b2f.tar.gz
frameworks_base-b521feaed410b6862baca9b42d5fd7c398e07b2f.tar.bz2
Update file size formatting.
Per UX, default strings should have space between value and units resulting in "12.3 GB". Add a formatting variant that returns the various components for callers who want to build their own strings. For now there is only one mounted emulated volume at a time, and it's always the primary storage, so give it the default rootId to keep old Uris working. Change-Id: Ifcc72a91a6b397ee65dc92642153286186eb64ac
Diffstat (limited to 'packages')
-rw-r--r--packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index 73a723d..4143e15 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -120,13 +120,20 @@ public class ExternalStorageProvider extends DocumentsProvider {
if (!volume.isMountedReadable()) continue;
final String rootId;
- if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) {
+ final String title;
+ if (volume.getType() == VolumeInfo.TYPE_EMULATED) {
+ // We currently only support a single emulated volume mounted at
+ // a time, and it's always considered the primary
rootId = ROOT_ID_PRIMARY_EMULATED;
- } else if (volume.getType() == VolumeInfo.TYPE_EMULATED) {
- final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume);
- rootId = privateVol.getFsUuid();
+ if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) {
+ title = getContext().getString(R.string.root_internal_storage);
+ } else {
+ final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume);
+ title = mStorageManager.getBestVolumeDescription(privateVol);
+ }
} else if (volume.getType() == VolumeInfo.TYPE_PUBLIC) {
rootId = volume.getFsUuid();
+ title = mStorageManager.getBestVolumeDescription(volume);
} else {
// Unsupported volume; ignore
continue;
@@ -148,11 +155,7 @@ public class ExternalStorageProvider extends DocumentsProvider {
root.rootId = rootId;
root.flags = Root.FLAG_SUPPORTS_CREATE | Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED
| Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_IS_CHILD;
- if (ROOT_ID_PRIMARY_EMULATED.equals(rootId)) {
- root.title = getContext().getString(R.string.root_internal_storage);
- } else {
- root.title = mStorageManager.getBestVolumeDescription(volume);
- }
+ root.title = title;
if (volume.getType() == VolumeInfo.TYPE_PUBLIC) {
root.flags |= Root.FLAG_HAS_SETTINGS;
}