Support old/new package names for widgets.

Change-Id: I134c4e694e66aaea47ad7da83d37b6621f4a527a
This commit is contained in:
Romain Guy
2010-03-11 15:30:02 -08:00
parent b51132cb4f
commit ff3e61c6d5

View File

@@ -935,6 +935,16 @@ class AppWidgetService extends IAppWidgetService.Stub
// as before?
String pkg = parser.getAttributeValue(null, "pkg");
String cl = parser.getAttributeValue(null, "cl");
final PackageManager packageManager = mContext.getPackageManager();
try {
packageManager.getReceiverInfo(new ComponentName(pkg, cl), 0);
} catch (PackageManager.NameNotFoundException e) {
String[] pkgs = packageManager.currentToCanonicalPackageNames(
new String[] { pkg });
pkg = pkgs[0];
}
Provider p = lookupProviderLocked(new ComponentName(pkg, cl));
if (p == null && mSafeMode) {
// if we're in safe mode, make a temporary one