Set only one remote adapter for RemoteViews

Previously, it is possible to have two different kinds of adapters in
the RemoteViews from partial updates. This could cause some unexpected
behaviors and performance issues. This change overwrites previous remote
adapters when there is a partial update to the RemoteViews.

Test: Presubmit
Bug: 245950570
Change-Id: I3761f52fbe77db2efa302225086314587565fdf9
This commit is contained in:
Sihua Ma
2023-05-23 21:41:16 +00:00
parent 9c828ecc62
commit 944abc5a89

View File

@@ -232,6 +232,7 @@ public class RemoteViews implements Parcelable, Filter {
private static final int NIGHT_MODE_REFLECTION_ACTION_TAG = 30;
private static final int SET_REMOTE_COLLECTION_ITEMS_ADAPTER_TAG = 31;
private static final int ATTRIBUTE_REFLECTION_ACTION_TAG = 32;
private static final int SET_REMOTE_ADAPTER_TAG = 33;
/** @hide **/
@IntDef(prefix = "MARGIN_", value = {
@@ -955,6 +956,11 @@ public class RemoteViews implements Parcelable, Filter {
return SET_REMOTE_VIEW_ADAPTER_LIST_TAG;
}
@Override
public String getUniqueKey() {
return (SET_REMOTE_ADAPTER_TAG + "_" + viewId);
}
int viewTypeCount;
ArrayList<RemoteViews> list;
}
@@ -1077,6 +1083,11 @@ public class RemoteViews implements Parcelable, Filter {
public int getActionTag() {
return SET_REMOTE_COLLECTION_ITEMS_ADAPTER_TAG;
}
@Override
public String getUniqueKey() {
return (SET_REMOTE_ADAPTER_TAG + "_" + viewId);
}
}
private class SetRemoteViewsAdapterIntent extends Action {