summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryong.zou <yong.zou@ck-telecom.com>2015-04-15 07:25:12 (GMT)
committerRajesh Yengisetty <rajesh@cyngn.com>2015-04-15 16:01:04 (GMT)
commit31a7bed3293c61665a1b0741360151f907d38dd0 (patch)
tree9c2bd3b1e5efeb0a9c65c793dace37ef2119be08
parentee224cb05e13d38c670733e59ae11b81515967b6 (diff)
downloadandroid_packages_apps_Trebuchet-31a7bed3293c61665a1b0741360151f907d38dd0.zip
android_packages_apps_Trebuchet-31a7bed3293c61665a1b0741360151f907d38dd0.tar.gz
android_packages_apps_Trebuchet-31a7bed3293c61665a1b0741360151f907d38dd0.tar.bz2
Trebuchet: Fix Settings shortcut widget title displays wrong when changing system language
1.Add a Settings shortcut widget to workspace 2.Change the system language 3.Check the Settings shortcut widget title The Settings shortcut widget title should update when changing the language Change-Id: I5012a3e99b9734230a844ce20e856ff86fba773a (cherry picked from commit c4326d489d5e8e252417a5edadc9e413c355d471)
-rw-r--r--src/com/android/launcher3/LauncherModel.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 4da49ce..e0ad461 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -30,6 +30,7 @@ import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
@@ -2181,6 +2182,11 @@ public class LauncherModel extends BroadcastReceiver
iconPackageIndex, iconResourceIndex, iconIndex,
titleIndex);
+ CharSequence title = getShortcutTitle(manager, intent);
+ if (title != null) {
+ info.title = title;
+ }
+
// App shortcuts that used to be automatically added to Launcher
// didn't always have the correct intent flags set, so do that
// here
@@ -3963,4 +3969,17 @@ public class LauncherModel extends BroadcastReceiver
Log.d(TAG, "mLoaderTask=null");
}
}
+
+ private CharSequence getShortcutTitle(PackageManager manager, Intent intent) {
+ ComponentName componentName = intent.getComponent();
+ if (componentName == null) {
+ return null;
+ }
+ ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
+ if (resolveInfo != null) {
+ return resolveInfo.activityInfo.loadLabel(manager);
+ }
+ return null;
+ }
+
}