Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e7f7d4b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12445464 from d7af1311 to 25Q1-release

Change-Id: I5f43426d80ed16a011b92371a0a1663668da7971
parents 6f3674a1 d7af1311
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -156,8 +156,6 @@ typedef struct ASurfaceTransactionStats ASurfaceTransactionStats;
 *
 * THREADING
 * The transaction completed callback can be invoked on any thread.
 *
 * Available since API level 29.
 */
typedef void (*ASurfaceTransaction_OnComplete)(void* _Null_unspecified context,
                                               ASurfaceTransactionStats* _Nonnull stats);
@@ -184,8 +182,6 @@ typedef void (*ASurfaceTransaction_OnComplete)(void* _Null_unspecified context,
 *
 * THREADING
 * The transaction committed callback can be invoked on any thread.
 *
 * Available since API level 31.
 */
typedef void (*ASurfaceTransaction_OnCommit)(void* _Null_unspecified context,
                                             ASurfaceTransactionStats* _Nonnull stats);
@@ -213,8 +209,6 @@ typedef void (*ASurfaceTransaction_OnCommit)(void* _Null_unspecified context,
 *
 * THREADING
 * The callback can be invoked on any thread.
 *
 * Available since API level 36.
 */
typedef void (*ASurfaceTransaction_OnBufferRelease)(void* _Null_unspecified context,
                                                    int release_fence_fd);
+9 −26
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ status_t Parcel::appendFrom(const Parcel* parcel, size_t offset, size_t len) {
    return err;
}

int Parcel::compareData(const Parcel& other) {
int Parcel::compareData(const Parcel& other) const {
    size_t size = dataSize();
    if (size != other.dataSize()) {
        return size < other.dataSize() ? -1 : 1;
@@ -1150,31 +1150,6 @@ status_t Parcel::finishWrite(size_t len)
    return NO_ERROR;
}

status_t Parcel::writeUnpadded(const void* data, 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;
    }

    size_t end = mDataPos + len;
    if (end < mDataPos) {
        // integer overflow
        return BAD_VALUE;
    }

    if (end <= mDataCapacity) {
restart_write:
        memcpy(mData+mDataPos, data, len);
        return finishWrite(len);
    }

    status_t err = growData(len);
    if (err == NO_ERROR) goto restart_write;
    return err;
}

status_t Parcel::write(const void* data, size_t len)
{
    if (len > INT32_MAX) {
@@ -2948,6 +2923,14 @@ status_t Parcel::growData(size_t len)
        return BAD_VALUE;
    }

    if (mDataPos > mDataSize) {
        // b/370831157 - this case used to abort. We also don't expect mDataPos < mDataSize, but
        // this would only waste a bit of memory, so it's okay.
        ALOGE("growData only expected at the end of a Parcel. pos: %zu, size: %zu, capacity: %zu",
              mDataPos, len, mDataCapacity);
        return BAD_VALUE;
    }

    if (len > SIZE_MAX - mDataSize) return NO_MEMORY; // overflow
    if (mDataSize + len > SIZE_MAX / 3) return NO_MEMORY; // overflow
    size_t newSize = ((mDataSize+len)*3)/2;
+4 −5
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public:

    LIBBINDER_EXPORTED status_t appendFrom(const Parcel* parcel, size_t start, size_t len);

    LIBBINDER_EXPORTED int compareData(const Parcel& other);
    LIBBINDER_EXPORTED int compareData(const Parcel& other) const;
    LIBBINDER_EXPORTED status_t compareDataInRange(size_t thisOffset, const Parcel& other,
                                                   size_t otherOffset, size_t length,
                                                   int* result) const;
@@ -172,7 +172,6 @@ public:

    LIBBINDER_EXPORTED status_t write(const void* data, size_t len);
    LIBBINDER_EXPORTED void* writeInplace(size_t len);
    LIBBINDER_EXPORTED status_t writeUnpadded(const void* data, size_t len);
    LIBBINDER_EXPORTED status_t writeInt32(int32_t val);
    LIBBINDER_EXPORTED status_t writeUint32(uint32_t val);
    LIBBINDER_EXPORTED status_t writeInt64(int64_t val);
@@ -637,9 +636,6 @@ public:

    LIBBINDER_EXPORTED const flat_binder_object* readObject(bool nullMetaData) const;

    // Explicitly close all file descriptors in the parcel.
    LIBBINDER_EXPORTED void closeFileDescriptors();

    // Debugging: get metrics on current allocations.
    LIBBINDER_EXPORTED static size_t getGlobalAllocSize();
    LIBBINDER_EXPORTED static size_t getGlobalAllocCount();
@@ -652,6 +648,9 @@ public:
    LIBBINDER_EXPORTED void print(std::ostream& to, uint32_t flags = 0) const;

private:
    // Explicitly close all file descriptors in the parcel.
    void closeFileDescriptors();

    // `objects` and `objectsSize` always 0 for RPC Parcels.
    typedef void (*release_func)(const uint8_t* data, size_t dataSize, const binder_size_t* objects,
                                 size_t objectsSize);
+6 −6
Original line number Diff line number Diff line
@@ -224,8 +224,10 @@ void AIBinder_Class_setOnDump(AIBinder_Class* clazz, AIBinder_onDump onDump) __I
 *
 * Trace messages will use the provided names instead of bare integer codes when set. If not set by
 * this function, trace messages will only be identified by the bare code. This should be called one
 * time during clazz initialization. clazz and transactionCodeToFunctionMap should have same
 * lifetime. Resetting/clearing the transactionCodeToFunctionMap is not allowed.
 * time during clazz initialization. clazz is defined using AIBinder_Class_define and
 * transactionCodeToFunctionMap should have same scope as clazz. Resetting/clearing the
 * transactionCodeToFunctionMap is not allowed. Passing null for either clazz or
 * transactionCodeToFunctionMap will abort.
 *
 * Available since API level 36.
 *
@@ -236,9 +238,6 @@ void AIBinder_Class_setOnDump(AIBinder_Class* clazz, AIBinder_onDump onDump) __I
 * contiguous, and this is required for maximum memory efficiency.
 * You can use nullptr if certain transaction codes are not used. Lifetime should be same as clazz.
 * \param length number of elements in the transactionCodeToFunctionMap
 *
 * \return true if setting codeToFunction to clazz is successful. return false if clazz or
 * codeToFunction is nullptr.
 */
void AIBinder_Class_setTransactionCodeToFunctionNameMap(AIBinder_Class* clazz,
                                                        const char** transactionCodeToFunctionMap,
@@ -257,7 +256,8 @@ void AIBinder_Class_setTransactionCodeToFunctionNameMap(AIBinder_Class* clazz,
 * \param transactionCode transaction_code_t for which function name is requested.
 *
 * \return function name in form of const char* if transaction code is valid for given class.
 * if transaction code is invalid or transactionCodeToFunctionMap is not set, nullptr is returned
 * The value returned is valid for the lifetime of clazz. if transaction code is invalid or
 * transactionCodeToFunctionMap is not set, nullptr is returned.
 */
const char* AIBinder_Class_getFunctionName(AIBinder_Class* clazz, transaction_code_t code)
        __INTRODUCED_IN(36);
+10 −1
Original line number Diff line number Diff line
@@ -149,7 +149,16 @@ TEST_F(LibbinderCacheTest, RemoveFromCacheOnServerDeath) {
    EXPECT_EQ(OK, mServiceManager->addService(kCachedServiceName, binder2));

    // Confirm that new service is returned instead of old.
    sp<IBinder> result2 = mServiceManager->checkService(kCachedServiceName);
    int retry_count = 5;
    sp<IBinder> result2;
    do {
        std::this_thread::sleep_for(std::chrono::milliseconds(50));
        if (retry_count-- == 0) {
            break;
        }
        result2 = mServiceManager->checkService(kCachedServiceName);
    } while (result2 != binder2);

    ASSERT_EQ(binder2, result2);
}

Loading