OSDN Git Service

Fix issue #10807048: Groupon: The application crash when user rotates...
authorDianne Hackborn <hackbod@google.com>
Sat, 21 Sep 2013 01:13:52 +0000 (18:13 -0700)
committerDianne Hackborn <hackbod@google.com>
Sat, 21 Sep 2013 01:13:52 +0000 (18:13 -0700)
commite784d1e4cfeaf3a9accd7caa33c087abd8f39040
tree15e140e5cdd077a83d15bd90616a516b4606e82a
parent560d2e463ed282badd1d069d60d98b59af3b880f
Fix issue #10807048:  Groupon: The application crash when user rotates...

...device to another mode (portrait or landscape) on Main page.

So, it turns out that Bundle claimed to have an invariant that either
mParcelledData or mMap would hold its data, never both.  The new
implementation on top of ArrayMap assumed this was the case.  However,
there is one situation where it is not true: an application can take
an existing Bundle that contains data, and call readFromParcel() on it.
The implementation of readFromParcel() would just pull out the
parceled data and stuff it in to mParcelledData for later unparceling,
even if that Bundle already had a non-empty mMap.

To fix this, we just look for this case in readFromParcel() and
immediately unparcel at that point into the existing map, using a
new unparcelling method that doesn't rely on the target map being
empty.

Change-Id: Ib816b6876a6cd2760b7a3372c7a79ca2f12dfeba
core/java/android/os/Bundle.java
core/java/android/os/Parcel.java