Merge change I63c2d9ed into eclair
* changes:
Update the names of the widgets when the locale changes.
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index f8b8ecc..6bf7102 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -51,6 +51,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.HashMap;
import java.util.HashSet;
@@ -105,6 +106,7 @@
}
Context mContext;
+ Locale mLocale;
PackageManager mPackageManager;
AlarmManager mAlarmManager;
ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
@@ -131,6 +133,11 @@
mContext.registerReceiver(mBroadcastReceiver,
new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null);
+ // Register for configuration changes so we can update the names
+ // of the widgets when the locale changes.
+ mContext.registerReceiver(mBroadcastReceiver,
+ new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED), null, null);
+
// Register for broadcasts about package install, etc., so we can
// update the provider list.
IntentFilter filter = new IntentFilter();
@@ -1046,6 +1053,22 @@
//Log.d(TAG, "received " + action);
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
sendInitialBroadcasts();
+ } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
+ Locale revised = Locale.getDefault();
+ if (revised == null || mLocale == null ||
+ !(revised.equals(mLocale))) {
+ mLocale = revised;
+
+ synchronized (mAppWidgetIds) {
+ int N = mInstalledProviders.size();
+ for (int i=N-1; i>=0; i--) {
+ Provider p = mInstalledProviders.get(i);
+ String pkgName = p.info.provider.getPackageName();
+ updateProvidersForPackageLocked(pkgName);
+ }
+ saveStateLocked();
+ }
+ }
} else {
Uri uri = intent.getData();
if (uri == null) {