Don't show empty widget in the case where a widget can't be inflated

If the use deletes the widget by disabling a package or removing it,
we used to show a placeholder widget.  Now it skips the widget if it's
not available.

Change-Id: I8582139bf982e41f3f16b5c002e248c5717290aa
This commit is contained in:
Jim Miller
2012-09-17 20:53:51 -07:00
parent b45965f519
commit 99a3cae55b

View File

@@ -662,8 +662,12 @@ public class KeyguardHostView extends KeyguardViewBase {
private void addWidget(int appId) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
AppWidgetProviderInfo appWidgetInfo = appWidgetManager.getAppWidgetInfo(appId);
AppWidgetHostView view = getAppWidgetHost().createView(mContext, appId, appWidgetInfo);
addWidget(view);
if (appWidgetInfo != null) {
AppWidgetHostView view = getAppWidgetHost().createView(mContext, appId, appWidgetInfo);
addWidget(view);
} else {
Log.w(TAG, "AppWidgetInfo was null; not adding widget id " + appId);
}
}
private void maybePopulateWidgets() {