| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef ANDROID_OS_HW_PARCEL_H |
| 18 |
#define ANDROID_OS_HW_PARCEL_H |
| 19 |
|
| 20 |
#include "hwbinder/EphemeralStorage.h" |
| 21 |
|
| 22 |
#include <android-base/macros.h> |
| 23 |
#include <hwbinder/IBinder.h> |
| 24 |
#include <hwbinder/Parcel.h> |
| 25 |
#include <jni.h> |
| 26 |
#include <utils/RefBase.h> |
| 27 |
|
| 28 |
namespace android { |
| 29 |
|
| 30 |
struct JHwParcel : public RefBase { |
| 31 |
static void InitClass(JNIEnv *env); |
| 32 |
|
| 33 |
static sp<JHwParcel> SetNativeContext( |
| 34 |
JNIEnv *env, jobject thiz, const sp<JHwParcel> &context); |
| 35 |
|
| 36 |
static sp<JHwParcel> GetNativeContext(JNIEnv *env, jobject thiz); |
| 37 |
|
| 38 |
static jobject NewObject(JNIEnv *env); |
| 39 |
|
| 40 |
JHwParcel(JNIEnv *env, jobject thiz); |
| 41 |
|
| 42 |
void setParcel(hardware::Parcel *parcel, bool assumeOwnership); |
| 43 |
hardware::Parcel *getParcel(); |
| 44 |
|
| 45 |
EphemeralStorage *getStorage(); |
| 46 |
|
| 47 |
void setTransactCallback(::android::hardware::IBinder::TransactCallback cb); |
| 48 |
|
| 49 |
void send(); |
| 50 |
bool wasSent() const; |
| 51 |
|
| 52 |
protected: |
| 53 |
virtual ~JHwParcel(); |
| 54 |
|
| 55 |
private: |
| 56 |
hardware::Parcel *mParcel; |
| 57 |
bool mOwnsParcel; |
| 58 |
|
| 59 |
EphemeralStorage mStorage; |
| 60 |
|
| 61 |
::android::hardware::IBinder::TransactCallback mTransactCallback; |
| 62 |
bool mWasSent; |
| 63 |
|
| 64 |
DISALLOW_COPY_AND_ASSIGN(JHwParcel); |
| 65 |
}; |
| 66 |
|
| 67 |
void signalExceptionForError(JNIEnv *env, status_t err, bool canThrowRemoteException = false); |
| 68 |
int register_android_os_HwParcel(JNIEnv *env); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
#endif |