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

Commit cd7b2833 authored by Devin Moore's avatar Devin Moore Committed by Android (Google) Code Review
Browse files

Merge "HwParcel owns HwBlobs" into main

parents b2e7511d eef93477
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -235,6 +235,10 @@ bool JHwParcel::wasSent() const {
    return mWasSent;
}

void JHwParcel::addBlob(const sp<JHwBlob> &blob) {
    mBlobs.emplace_back(blob);
}

}  // namespace android

////////////////////////////////////////////////////////////////////////////////
@@ -1059,6 +1063,7 @@ static void JHwParcel_native_writeBuffer(
        JHwParcel::GetNativeContext(env, thiz)->getParcel();

    sp<JHwBlob> blob = JHwBlob::GetNativeContext(env, blobObj);
    JHwParcel::GetNativeContext(env, thiz)->addBlob(blob);
    status_t err = blob->writeToParcel(parcel);

    if (err != OK) {
+6 −2
Original line number Diff line number Diff line
@@ -17,14 +17,15 @@
#ifndef ANDROID_OS_HW_PARCEL_H
#define ANDROID_OS_HW_PARCEL_H

#include "hwbinder/EphemeralStorage.h"

#include <android-base/macros.h>
#include <hwbinder/IBinder.h>
#include <hwbinder/Parcel.h>
#include <jni.h>
#include <utils/RefBase.h>

#include "android_os_HwBlob.h"
#include "hwbinder/EphemeralStorage.h"

namespace android {

struct JHwParcel : public RefBase {
@@ -44,6 +45,8 @@ struct JHwParcel : public RefBase {

    EphemeralStorage *getStorage();

    void addBlob(const sp<JHwBlob> &blob);

    void setTransactCallback(::android::hardware::IBinder::TransactCallback cb);

    void send();
@@ -60,6 +63,7 @@ private:

    ::android::hardware::IBinder::TransactCallback mTransactCallback;
    bool mWasSent;
    std::vector<sp<JHwBlob>> mBlobs;

    DISALLOW_COPY_AND_ASSIGN(JHwParcel);
};