Fix bug #6522190 MountService should respond to configuration changes ("INTERNAL STORAGE" string should be translated dynamically)
- use an ID instead of a String for StorageVolume description
- use this ID for getting the correct localized version of the description string
Change-Id: I30f3080fce2c889be38bfdf9f5121dffcf8a99e8
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 13ab586..1482d22 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1065,7 +1065,9 @@
private static final String TAG_STORAGE_LIST = "StorageList";
private static final String TAG_STORAGE = "storage";
- private void readStorageList(Resources resources) {
+ private void readStorageList() {
+ Resources resources = mContext.getResources();
+
int id = com.android.internal.R.xml.storage_list;
XmlResourceParser parser = resources.getXml(id);
AttributeSet attrs = Xml.asAttributeSet(parser);
@@ -1084,6 +1086,8 @@
CharSequence path = a.getText(
com.android.internal.R.styleable.Storage_mountPoint);
+ int descriptionId = a.getResourceId(
+ com.android.internal.R.styleable.Storage_storageDescription, -1);
CharSequence description = a.getText(
com.android.internal.R.styleable.Storage_storageDescription);
boolean primary = a.getBoolean(
@@ -1110,7 +1114,7 @@
} else {
String pathString = path.toString();
StorageVolume volume = new StorageVolume(pathString,
- description.toString(), removable, emulated,
+ descriptionId, removable, emulated,
mtpReserve, allowMassStorage, maxFileSize);
if (primary) {
if (mPrimaryVolume == null) {
@@ -1151,8 +1155,7 @@
*/
public MountService(Context context) {
mContext = context;
- Resources resources = context.getResources();
- readStorageList(resources);
+ readStorageList();
if (mPrimaryVolume != null) {
mExternalStoragePath = mPrimaryVolume.getPath();