Skip to content

Commit 180cfd5

Browse files
author
Adam Cohen
committed
If a default keyguard layout isn't specified, fallback to the default layout
-> Also fixing a typo in AppWidgetProvider clone() -- this was the cause of the "couldn't load widget". It wasn't getting expressed before for various reasons. Change-Id: Ib7114565a414d66facd8b4baeb97d5a71e96b5e9
1 parent 6275b3f commit 180cfd5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

core/java/android/appwidget/AppWidgetHostView.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,10 @@ protected View getDefaultView() {
553553
if (options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) {
554554
int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY);
555555
if (category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) {
556-
layoutId = mInfo.initialKeyguardLayout;
556+
int kgLayoutId = mInfo.initialKeyguardLayout;
557+
// If a default keyguard layout is not specified, use the standard
558+
// default layout.
559+
layoutId = kgLayoutId == 0 ? layoutId : kgLayoutId;
557560
}
558561
}
559562
defaultView = inflater.inflate(layoutId, this, false);

core/java/android/appwidget/AppWidgetProviderInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public AppWidgetProviderInfo clone() {
260260
that.minResizeWidth = this.minResizeHeight;
261261
that.minResizeHeight = this.minResizeHeight;
262262
that.updatePeriodMillis = this.updatePeriodMillis;
263-
that.initialLayout = that.initialLayout;
263+
that.initialLayout = this.initialLayout;
264264
that.initialKeyguardLayout = this.initialKeyguardLayout;
265265
that.configure = this.configure == null ? null : this.configure.clone();
266266
that.label = this.label == null ? null : this.label.substring(0);

0 commit comments

Comments
 (0)