Fix issue #11290095: Parcel change causing crashing in KLP...
...when reading from empty byte[]
Add CTS test for this.
Change-Id: I3a4242f28bfc4a64442f1ff1e3d22a653749c215
diff --git a/tests/tests/os/src/android/os/cts/BundleTest.java b/tests/tests/os/src/android/os/cts/BundleTest.java
index c8582f2..7674b6b 100644
--- a/tests/tests/os/src/android/os/cts/BundleTest.java
+++ b/tests/tests/os/src/android/os/cts/BundleTest.java
@@ -72,6 +72,17 @@
new Bundle(getClass().getClassLoader());
}
+ public void testEmptyStream() {
+ Parcel p = Parcel.obtain();
+ p.unmarshall(new byte[] {}, 0, 0);
+ Bundle b = p.readBundle();
+ assertTrue(b.isEmpty());
+ mBundle.putBoolean("android", true);
+ p.unmarshall(new byte[] {}, 0, 0);
+ mBundle.readFromParcel(p);
+ assertTrue(mBundle.isEmpty());
+ }
+
// first put sth into tested Bundle, it shouldn't be empty, then clear it and it should be empty
public void testClear() {
mBundle.putBoolean("android", true);