summaryrefslogtreecommitdiff
authorXiaoliang Wang <xiaoliang.wang@amlogic.com>2015-12-26 04:00:43 (GMT)
committer Xiaoliang Wang <xiaoliang.wang@amlogic.com>2015-12-26 04:00:43 (GMT)
commit36db328ce37abd392b69f6063e92f899c3cd5ae4 (patch)
treec6690b6eb29a26492a74597bd0085c1d3f75ad5b
parent4333c0765308384c10771210f5f960224e36c425 (diff)
downloadOTAUpgrade2-36db328ce37abd392b69f6063e92f899c3cd5ae4.zip
OTAUpgrade2-36db328ce37abd392b69f6063e92f899c3cd5ae4.tar.gz
OTAUpgrade2-36db328ce37abd392b69f6063e92f899c3cd5ae4.tar.bz2
PD #117190: show best volume label instead of UUID
Change-Id: I39b534482946e2373a40b8d1b8e45d085a4ebd5e
Diffstat
-rw-r--r--src/com/droidlogic/otaupgrade/FileSelector.java9
-rw-r--r--src/com/droidlogic/otaupgrade/PrefUtils.java24
2 files changed, 32 insertions, 1 deletions
diff --git a/src/com/droidlogic/otaupgrade/FileSelector.java b/src/com/droidlogic/otaupgrade/FileSelector.java
index 25a9acb..086f720 100644
--- a/src/com/droidlogic/otaupgrade/FileSelector.java
+++ b/src/com/droidlogic/otaupgrade/FileSelector.java
@@ -194,7 +194,14 @@ public class FileSelector extends Activity implements OnItemClickListener {
TextView tv = ( TextView ) convertView;
File file = mFiles[position];
String name = file.getPath();
- tv.setText ( name );
+ String nameDest = null;
+ if (mPrefUtil != null) {
+ nameDest = mPrefUtil.getTransPath(name);
+ }
+ else {
+ nameDest = name;
+ }
+ tv.setText ( nameDest );
return tv;
}
}
diff --git a/src/com/droidlogic/otaupgrade/PrefUtils.java b/src/com/droidlogic/otaupgrade/PrefUtils.java
index 3de8df5..7622a46 100644
--- a/src/com/droidlogic/otaupgrade/PrefUtils.java
+++ b/src/com/droidlogic/otaupgrade/PrefUtils.java
@@ -190,6 +190,30 @@ public class PrefUtils {
return null;
}
+ public String getTransPath(String inPath) {
+ String outPath = inPath;
+ String pathLast;
+ String pathVol;
+ int idx = -1;
+ int len;
+
+ StorageManager storageManager = (StorageManager)mContext.getSystemService(Context.STORAGE_SERVICE);
+ List<VolumeInfo> volumes = storageManager.getVolumes();
+ Collections.sort(volumes, VolumeInfo.getDescriptionComparator());
+ for (VolumeInfo vol : volumes) {
+ if (vol != null && vol.isMountedReadable() && vol.getType() == VolumeInfo.TYPE_PUBLIC) {
+ pathVol = vol.getPath().getAbsolutePath();
+ idx = inPath.indexOf(pathVol);
+ if (idx != -1) {
+ len = pathVol.length();
+ pathLast = inPath.substring(idx + len);
+ outPath = storageManager.getBestVolumeDescription(vol) + pathLast;
+ }
+ }
+ }
+
+ return outPath;
+ }
void write2File() {
ArrayList<File> externalDevs = getExternalStorageList();