Skip to content

Commit eabde3d

Browse files
dujin.chaAndroid Git Automerger
authored andcommitted
am fe464a7: [Prime K] Fix gabage character issue
* commit 'fe464a76d8fc858be971dbb5e67b1d22fd925347': [Prime K] Fix gabage character issue
2 parents eff6ed0 + fe464a7 commit eabde3d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

media/java/android/mtp/MtpDatabase.java

100644100755
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import java.io.File;
4040
import java.util.HashMap;
41+
import java.util.Locale;
4142

4243
/**
4344
* {@hide}
@@ -120,6 +121,20 @@ public MtpDatabase(Context context, String volumeName, String storagePath) {
120121
mMediaStoragePath = storagePath;
121122
mObjectsUri = Files.getMtpObjectsUri(volumeName);
122123
mMediaScanner = new MediaScanner(context);
124+
125+
// Set locale to MediaScanner.
126+
Locale locale = context.getResources().getConfiguration().locale;
127+
if (locale != null) {
128+
String language = locale.getLanguage();
129+
String country = locale.getCountry();
130+
if (language != null) {
131+
if (country != null) {
132+
mMediaScanner.setLocale(language + "_" + country);
133+
} else {
134+
mMediaScanner.setLocale(language);
135+
}
136+
}
137+
}
123138
initDeviceProperties(context);
124139
}
125140

0 commit comments

Comments
 (0)