libbinder: ensure entire Parcel is the same format

Extra check in preparation for versioning work/as a guard against misuse
of this API. Note - these functions are very much like constructors, but
they can't be because Parcel is that errorprone type of object which
resets its internal state (for better or worse).

Bug: 182938972
Test: binderRpcTest
Change-Id: Ibdbe8161db9d0c8fba86f1c691c73aab49b21bc0
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp
index 5f68a25..985d086 100644
--- a/libs/binder/tests/binderRpcTest.cpp
+++ b/libs/binder/tests/binderRpcTest.cpp
@@ -44,6 +44,13 @@
 
 namespace android {
 
+TEST(BinderRpcParcel, EntireParcelFormatted) {
+    Parcel p;
+    p.writeInt32(3);
+
+    EXPECT_DEATH(p.markForBinder(sp<BBinder>::make()), "");
+}
+
 using android::binder::Status;
 
 #define EXPECT_OK(status)                 \