Return true from isHwservicemanagerInstalled if we get EACCES error am: d81269f8cd

Original change: https://android-review.googlesource.com/c/platform/system/libhwbinder/+/3220483

Change-Id: I3dc9690be6f8107c81abd1527186ca9f918d7871
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Parcel.cpp b/Parcel.cpp
index 177b102..190a364 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -339,23 +339,6 @@
     return NO_ERROR;
 }
 
-status_t Parcel::setData(const uint8_t* buffer, size_t len)
-{
-    if (len > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    status_t err = restartWrite(len);
-    if (err == NO_ERROR) {
-        memcpy(const_cast<uint8_t*>(data()), buffer, len);
-        mDataSize = len;
-        mFdsKnown = false;
-    }
-    return err;
-}
-
 void Parcel::markSensitive() const
 {
     mDeallocZero = true;
@@ -1776,58 +1759,6 @@
     return newData;
 }
 
-status_t Parcel::restartWrite(size_t desired)
-{
-    if (desired > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    if (mOwner) {
-        freeData();
-        return continueWrite(desired);
-    }
-
-    uint8_t* data = reallocZeroFree(mData, mDataCapacity, desired, mDeallocZero);
-    if (!data && desired > mDataCapacity) {
-        mError = NO_MEMORY;
-        return NO_MEMORY;
-    }
-
-    releaseObjects();
-
-    if (data || desired == 0) {
-        LOG_ALLOC("Parcel %p: restart from %zu to %zu capacity", this, mDataCapacity, desired);
-        if (mDataCapacity > desired) {
-            gParcelGlobalAllocSize -= (mDataCapacity - desired);
-        } else {
-            gParcelGlobalAllocSize += (desired - mDataCapacity);
-        }
-
-        if (!mData) {
-            gParcelGlobalAllocCount++;
-        }
-        mData = data;
-        mDataCapacity = desired;
-    }
-
-    mDataSize = mDataPos = 0;
-    ALOGV("restartWrite Setting data size of %p to %zu", this, mDataSize);
-    ALOGV("restartWrite Setting data pos of %p to %zu", this, mDataPos);
-
-    free(mObjects);
-    mObjects = nullptr;
-    mObjectsSize = mObjectsCapacity = 0;
-    mNextObjectHint = 0;
-    mHasFds = false;
-    clearCache();
-    mFdsKnown = true;
-    mAllowFds = true;
-
-    return NO_ERROR;
-}
-
 status_t Parcel::continueWrite(size_t desired)
 {
     if (desired > INT32_MAX) {
diff --git a/include/hwbinder/Parcel.h b/include/hwbinder/Parcel.h
index 4822fa0..f86fabe 100644
--- a/include/hwbinder/Parcel.h
+++ b/include/hwbinder/Parcel.h
@@ -68,8 +68,6 @@
     void                setDataPosition(size_t pos) const;
     status_t            setDataCapacity(size_t size);
 
-    status_t            setData(const uint8_t* buffer, size_t len);
-
     // Zeros data when reallocating. Other mitigations may be added
     // in the future.
     //
@@ -270,7 +268,6 @@
     void                releaseObjects();
     void                acquireObjects();
     status_t            growData(size_t len);
-    status_t            restartWrite(size_t desired);
     status_t            continueWrite(size_t desired);
     status_t            writePointer(uintptr_t val);
     status_t            readPointer(uintptr_t *pArg) const;