Fix bug where RemoteViews addView is backwards.

The index on where to add a child view was not being saved when writing
to a Parcel. This causes the index to default to 0 and resulted in views
always being added as the first view.

Now, persist this value to the Parcel and restore it.

Test: booted up on Nexus 6P, created notification with RemoteView, added
two views and verified views added in correct order.
Bug: 63177271

Change-Id: I94384e348b8a5168efe0601f382cdd2db6791fdb
This commit is contained in:
Anthony Chen
2017-07-05 11:22:25 -07:00
parent e80ea58d60
commit ea202f6646

View File

@@ -1578,12 +1578,14 @@ public class RemoteViews implements Parcelable, Filter {
ViewGroupActionAdd(Parcel parcel, BitmapCache bitmapCache, ApplicationInfo info,
int depth) {
viewId = parcel.readInt();
mIndex = parcel.readInt();
mNestedViews = new RemoteViews(parcel, bitmapCache, info, depth);
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(VIEW_GROUP_ACTION_ADD_TAG);
dest.writeInt(viewId);
dest.writeInt(mIndex);
mNestedViews.writeToParcel(dest, flags);
}