[Prime K] Fix gabage character issue
Korean characters show up as gabage characters in Music player.
Reason : MTP service does not set the locale for the MediaScanner
Solution : Set locale when MtpDatabase creates MediaScanner.
Bug ID : 5567433
Signed-off-by: dujin.cha <dujin.cha@samsung.com>
Change-Id: I4bfe5f603c113170d45bd57a8709c21c665e260b
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
old mode 100644
new mode 100755
index 4e271c7..98617d2
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -38,6 +38,7 @@
import java.io.File;
import java.util.HashMap;
+import java.util.Locale;
/**
* {@hide}
@@ -120,6 +121,20 @@
mMediaStoragePath = storagePath;
mObjectsUri = Files.getMtpObjectsUri(volumeName);
mMediaScanner = new MediaScanner(context);
+
+ // Set locale to MediaScanner.
+ Locale locale = context.getResources().getConfiguration().locale;
+ if (locale != null) {
+ String language = locale.getLanguage();
+ String country = locale.getCountry();
+ if (language != null) {
+ if (country != null) {
+ mMediaScanner.setLocale(language + "_" + country);
+ } else {
+ mMediaScanner.setLocale(language);
+ }
+ }
+ }
initDeviceProperties(context);
}