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

* changes:
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0 am: 32da4bbe1e am: a01397282d am: 6fccb21cd7 am: f6384b4a10 am: 04ab0619be
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0 am: 32da4bbe1e am: a01397282d am: 6fccb21cd7 am: f6384b4a10
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0 am: 32da4bbe1e am: a01397282d am: 6fccb21cd7
  [automerger] Don't pad before calling writeInPlace(). am: 732132b765 am: a6a5c3fa47 am: 325909a4e4 am: 953b08b7c0 am: 32da4bbe1e am: a01397282d
  [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 84a561b..9d96dd6 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1535,7 +1535,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);
@@ -1557,7 +1562,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;
@@ -1575,7 +1585,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;