Correct invalidation of layout when new color resources are provided.

The mViewMode variable is only used if there is no RemoteViews object.
But we still want to update the colors in that case.

Bug: 179783721
Test: atest CtsWidgetTestCases:android.widget.cts.RemoteViewsThemeColorsTest
Change-Id: I078d21422a6300e7aaecb0baa2a49b9e14cae9e9
This commit is contained in:
Pierre Barbier de Reuille
2021-03-09 22:13:23 +00:00
parent c4bbeabbee
commit 4554bcd1bc

View File

@@ -849,6 +849,7 @@ public class AppWidgetHostView extends FrameLayout {
public void setColorResources(@NonNull SparseIntArray colorMapping) {
mColorResources = RemoteViews.ColorResources.create(mContext, colorMapping);
mLayoutId = -1;
mViewMode = VIEW_MODE_NOINIT;
reapplyLastRemoteViews();
}
@@ -863,6 +864,7 @@ public class AppWidgetHostView extends FrameLayout {
if (mColorResources != null) {
mColorResources = null;
mLayoutId = -1;
mViewMode = VIEW_MODE_NOINIT;
reapplyLastRemoteViews();
}
}