From e086d9ad6118d2a7a3132305c2e7d719cd6fe030 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 9 Mar 2010 15:03:53 -0800 Subject: Use a queried package name for the IME settings activity. This fixes a bug that if the package name of the IME settingsActivity is different from it's class name, it wouldn't find the activity. This allows the package name to be optionally specified in the XML or it will be queried, for proper intent resolution. Change-Id: Ib9e6e8ef7d59ad9e88300529873eed2b39fe9981 --- src/com/android/settings/LanguageSettings.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/com/android/settings/LanguageSettings.java') diff --git a/src/com/android/settings/LanguageSettings.java b/src/com/android/settings/LanguageSettings.java index 61ede0d..4d1f994 100644 --- a/src/com/android/settings/LanguageSettings.java +++ b/src/com/android/settings/LanguageSettings.java @@ -120,7 +120,11 @@ public class LanguageSettings extends PreferenceActivity { // If setting activity is available, add a setting screen entry. if (null != property.getSettingsActivity()) { PreferenceScreen prefScreen = new PreferenceScreen(this, null); - prefScreen.setKey(property.getSettingsActivity()); + String settingsActivity = property.getSettingsActivity(); + if (settingsActivity.lastIndexOf("/") < 0) { + settingsActivity = property.getPackageName() + "/" + settingsActivity; + } + prefScreen.setKey(settingsActivity); prefScreen.setTitle(label); if (N == 1) { prefScreen.setSummary(getString(R.string.onscreen_keyboard_settings_summary)); @@ -274,6 +278,11 @@ public class LanguageSettings extends PreferenceActivity { String activityName = pref.getKey(); String packageName = activityName.substring(0, activityName .lastIndexOf(".")); + int slash = activityName.indexOf("/"); + if (slash > 0) { + packageName = activityName.substring(0, slash); + activityName = activityName.substring(slash + 1); + } if (activityName.length() > 0) { Intent i = new Intent(Intent.ACTION_MAIN); i.setClassName(packageName, activityName); -- cgit v1.1