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

Commit 5f3ff7e3 authored by Wonsik Kim's avatar Wonsik Kim Committed by Android (Google) Code Review
Browse files

Merge "stagefright: Handle DEAD_OBJECT correctly in conversion"

parents 9d83f9d4 71115426
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -97,6 +97,17 @@ int native_handle_read_fd(native_handle_t const* nh, int index) {
 * `convertTo()` do.
 */

/**
 * \brief Convert `Return<void>` to `status_t`. This is for legacy binder calls.
 *
 * \param[in] t The source `Return<void>`.
 * \return The corresponding `status_t`.
 */
// convert: Return<void> -> status_t
status_t toStatusT(Return<void> const& t) {
    return t.isOk() ? OK : (t.isDeadObject() ? DEAD_OBJECT : UNKNOWN_ERROR);
}

/**
 * \brief Convert `Return<void>` to `binder::Status`.
 *
@@ -107,21 +118,10 @@ int native_handle_read_fd(native_handle_t const* nh, int index) {
::android::binder::Status toBinderStatus(
        Return<void> const& t) {
    return ::android::binder::Status::fromExceptionCode(
            t.isOk() ? OK : UNKNOWN_ERROR,
            toStatusT(t),
            t.description().c_str());
}

/**
 * \brief Convert `Return<void>` to `status_t`. This is for legacy binder calls.
 *
 * \param[in] t The source `Return<void>`.
 * \return The corresponding `status_t`.
 */
// convert: Return<void> -> status_t
status_t toStatusT(Return<void> const& t) {
    return t.isOk() ? OK : UNKNOWN_ERROR;
}

/**
 * \brief Wrap `native_handle_t*` in `hidl_handle`.
 *
+6 −1
Original line number Diff line number Diff line
@@ -190,7 +190,12 @@ inline status_t toStatusT(Status const& t) {
 */
// convert: Status -> status_t
inline status_t toStatusT(Return<Status> const& t) {
    return t.isOk() ? toStatusT(static_cast<Status>(t)) : UNKNOWN_ERROR;
    if (t.isOk()) {
        return toStatusT(static_cast<Status>(t));
    } else if (t.isDeadObject()) {
        return DEAD_OBJECT;
    }
    return UNKNOWN_ERROR;
}

/**