Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6136c29 authored by Jeff DeCew's avatar Jeff DeCew Committed by Automerger Merge Worker
Browse files

Merge "Fix crash in RemoteViews w/ Bundle due to Parcel.allowSquashing" into...

Merge "Fix crash in RemoteViews w/ Bundle due to Parcel.allowSquashing" into sc-v2-dev am: 88cccabf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16553366

Change-Id: Ib2bed18a6dd1f7b0a872aabb6a8ca9bcf3ac9f4e
parents be20eee5 88cccabf
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -300,6 +300,13 @@ public class RemoteViews implements Parcelable, Filter {
     */
    public static final int FLAG_USE_LIGHT_BACKGROUND_LAYOUT = 4;

    /**
     * A ReadWriteHelper which has the same behavior as ReadWriteHelper.DEFAULT, but which is
     * intentionally a different instance in order to trick Bundle reader so that it doesn't allow
     * lazy initialization.
     */
    private static final Parcel.ReadWriteHelper ALTERNATIVE_DEFAULT = new Parcel.ReadWriteHelper();

    /**
     * Used to restrict the views which can be inflated
     *
@@ -1856,7 +1863,18 @@ public class RemoteViews implements Parcelable, Filter {
                    this.value = in.readTypedObject(Bitmap.CREATOR);
                    break;
                case BUNDLE:
                    // Because we use Parcel.allowSquashing() when writing, and that affects
                    //  how the contents of Bundles are written, we need to ensure the bundle is
                    //  unparceled immediately, not lazily.  Setting a custom ReadWriteHelper
                    //  just happens to have that effect on Bundle.readFromParcel().
                    // TODO(b/212731590): build this state tracking into Bundle
                    if (in.hasReadWriteHelper()) {
                        this.value = in.readBundle();
                    } else {
                        in.setReadWriteHelper(ALTERNATIVE_DEFAULT);
                        this.value = in.readBundle();
                        in.setReadWriteHelper(null);
                    }
                    break;
                case INTENT:
                    this.value = in.readTypedObject(Intent.CREATOR);