Add comments to keep Java and native binder PersistableBundle in sync
Add comments stating that certain methods of the Java binder framework
should be kept in sync with the corresponding methods mirrored in the
native PersistableBundle implementation.
BUG: 25815410
Change-Id: I475b2e9a527291eea58c8178cd733c444dfcfed5
diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java
index c373308..532070e 100644
--- a/core/java/android/os/BaseBundle.java
+++ b/core/java/android/os/BaseBundle.java
@@ -31,7 +31,9 @@
private static final String TAG = "Bundle";
static final boolean DEBUG = false;
+ // Keep in sync with frameworks/native/libs/binder/PersistableBundle.cpp.
static final int BUNDLE_MAGIC = 0x4C444E42; // 'B' 'N' 'D' 'L'
+
static final Parcel EMPTY_PARCEL;
static {
@@ -1307,6 +1309,8 @@
* @param parcel The parcel to copy this bundle to.
*/
void writeToParcelInner(Parcel parcel, int flags) {
+ // Keep implementation in sync with writeToParcel() in
+ // frameworks/native/libs/binder/PersistableBundle.cpp.
if (mParcelledData != null) {
if (mParcelledData == EMPTY_PARCEL) {
parcel.writeInt(0);
@@ -1344,6 +1348,8 @@
* @param parcel The parcel to overwrite this bundle from.
*/
void readFromParcelInner(Parcel parcel) {
+ // Keep implementation in sync with readFromParcel() in
+ // frameworks/native/libs/binder/PersistableBundle.cpp.
int length = parcel.readInt();
if (length < 0) {
throw new RuntimeException("Bad length in parcel: " + length);