[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
This commit is contained in:
dujin.cha
2011-11-22 12:13:33 +09:00
committed by Marco Nelissen
parent e36657e541
commit fe464a76d8

15
media/java/android/mtp/MtpDatabase.java Normal file → Executable file
View File

@@ -38,6 +38,7 @@ import android.view.WindowManager;
import java.io.File;
import java.util.HashMap;
import java.util.Locale;
/**
* {@hide}
@@ -120,6 +121,20 @@ public class MtpDatabase {
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);
}