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

Commit a3e25f8b authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

libbinder_ndk: remove NullableStrongBinder am: 8356bb86

am: 14f38f93

Change-Id: Id46ee08d39198d338d353a504db67da4c57cb897
parents 59d9c9f8 14f38f93
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -297,31 +297,17 @@ typedef int8_t* (*AParcel_byteArrayAllocator)(void* arrayData, size_t length);
binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder) __INTRODUCED_IN(29);

/**
 * Reads an AIBinder from the next location in a non-null parcel. This will fail if the binder is
 * non-null. One strong ref-count of ownership is passed to the caller of this function.
 * Reads an AIBinder from the next location in a non-null parcel. One strong ref-count of ownership
 * is passed to the caller of this function.
 *
 * \param parcel the parcel to read from.
 * \param binder the out parameter for what is read from the parcel. This will not be null on
 * success.
 * \param binder the out parameter for what is read from the parcel. This may be null.
 *
 * \return STATUS_OK on successful write.
 */
binder_status_t AParcel_readStrongBinder(const AParcel* parcel, AIBinder** binder)
        __INTRODUCED_IN(29);

/**
 * Reads an AIBinder from the next location in a non-null parcel. This may read a null. One strong
 * ref-count of ownership is passed to the caller of this function.
 *
 * \param parcel the parcel to read from.
 * \param binder the out parameter for what is read from the parcel. This may be null even on
 * success.
 *
 * \return STATUS_OK on successful write.
 */
binder_status_t AParcel_readNullableStrongBinder(const AParcel* parcel, AIBinder** binder)
        __INTRODUCED_IN(29);

/**
 * Writes a file descriptor to the next location in a non-null parcel. This does not take ownership
 * of fd.
+22 −0
Original line number Diff line number Diff line
@@ -84,6 +84,28 @@ static inline void AParcel_stdVectorSetter(void* vectorData, size_t index, T val
    (*vec)[index] = value;
}

/**
 * Convenience method to write a strong binder but return an error if it is null.
 */
static inline binder_status_t AParcel_writeRequiredStrongBinder(AParcel* parcel, AIBinder* binder) {
    if (binder == nullptr) {
        return STATUS_UNEXPECTED_NULL;
    }
    return AParcel_writeStrongBinder(parcel, binder);
}

/**
 * Convenience method to read a strong binder but return an error if it is null.
 */
static inline binder_status_t AParcel_readRequiredStrongBinder(const AParcel* parcel,
                                                               AIBinder** binder) {
    binder_status_t ret = AParcel_readStrongBinder(parcel, binder);
    if (ret == STATUS_OK && *binder == nullptr) {
        return STATUS_UNEXPECTED_NULL;
    }
    return ret;
}

/**
 * Allocates a std::string to length and returns the underlying buffer. For use with
 * AParcel_readString. See use below in AParcel_readString(const AParcel*, std::string*).
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ LIBBINDER_NDK { # introduced=29
    AParcel_readInt32Array;
    AParcel_readInt64;
    AParcel_readInt64Array;
    AParcel_readNullableStrongBinder;
    AParcel_readParcelFileDescriptor;
    AParcel_readStatusHeader;
    AParcel_readString;
+0 −11
Original line number Diff line number Diff line
@@ -193,17 +193,6 @@ binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder) {
    return parcel->get()->writeStrongBinder(writeBinder);
}
binder_status_t AParcel_readStrongBinder(const AParcel* parcel, AIBinder** binder) {
    sp<IBinder> readBinder = nullptr;
    status_t status = parcel->get()->readStrongBinder(&readBinder);
    if (status != STATUS_OK) {
        return PruneStatusT(status);
    }
    sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(readBinder);
    AIBinder_incStrong(ret.get());
    *binder = ret.get();
    return PruneStatusT(status);
}
binder_status_t AParcel_readNullableStrongBinder(const AParcel* parcel, AIBinder** binder) {
    sp<IBinder> readBinder = nullptr;
    status_t status = parcel->get()->readNullableStrongBinder(&readBinder);
    if (status != STATUS_OK) {