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:00:49 (GMT)
commite67353928f36bfaa97a14863b0a329d21218c895 (patch)
tree2778022829c83db9f96f62a31e8cfdf24f4d2596
parent8c2c0a406dbc36aeff4c23763d6aa83ddaf624e9 (diff)
downloadandroid_packages_apps_Trebuchet-e67353928f36bfaa97a14863b0a329d21218c895.zip
android_packages_apps_Trebuchet-e67353928f36bfaa97a14863b0a329d21218c895.tar.gz
android_packages_apps_Trebuchet-e67353928f36bfaa97a14863b0a329d21218c895.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;
+ }
+
}