Merge changes from topic "am-27943b02-3710-49e4-84f6-eabc78fdbe01" into nyc-dr1-dev

* changes:
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0 am: 32da4bbe1e
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765
  Don't pad before calling writeInPlace().
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index c3a31fb..e5a34c2 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1429,7 +1429,12 @@
             && len <= pad_size(len)) {
         if (mObjectsSize > 0) {
             status_t err = validateReadData(mDataPos + pad_size(len));
-            if(err != NO_ERROR) return err;
+            if(err != NO_ERROR) {
+                // Still increment the data position by the expected length
+                mDataPos += pad_size(len);
+                ALOGV("read Setting data pos of %p to %zu", this, mDataPos);
+                return err;
+            }
         }
         memcpy(outData, mData+mDataPos, len);
         mDataPos += pad_size(len);
@@ -1451,7 +1456,12 @@
             && len <= pad_size(len)) {
         if (mObjectsSize > 0) {
             status_t err = validateReadData(mDataPos + pad_size(len));
-            if(err != NO_ERROR) return NULL;
+            if(err != NO_ERROR) {
+                // Still increment the data position by the expected length
+                mDataPos += pad_size(len);
+                ALOGV("readInplace Setting data pos of %p to %zu", this, mDataPos);
+                return NULL;
+            }
         }
 
         const void* data = mData+mDataPos;
@@ -1469,7 +1479,11 @@
     if ((mDataPos+sizeof(T)) <= mDataSize) {
         if (mObjectsSize > 0) {
             status_t err = validateReadData(mDataPos + sizeof(T));
-            if(err != NO_ERROR) return err;
+            if(err != NO_ERROR) {
+                // Still increment the data position by the expected length
+                mDataPos += sizeof(T);
+                return err;
+            }
         }
 
         const void* data = mData+mDataPos;