forked from anbox/platform_frameworks_native
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of HostBinder
- Loading branch information
1 parent
77cac99
commit 153a9a9
Showing
17 changed files
with
384 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <binder/HostBinder.h> | ||
extern "C" | ||
void publishSVM(binder_state *bs) { | ||
android::HostBinder host(bs); | ||
host.publishSVM(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __SVCHOSTBINDER_H__ | ||
#define __SVCHOSTBINDER_H__ | ||
struct binder_state | ||
{ | ||
int fd; | ||
void *mapped; | ||
size_t mapsize; | ||
}; | ||
#ifdef __cplusplus | ||
extern "C" | ||
#endif | ||
void publishSVM(struct binder_state *bs); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef __HOSTBINDER_H__ | ||
#define __HOSTBINDER_H__ | ||
#include <utils/RefBase.h> | ||
#include <binder/HostBinderShim.h> | ||
struct binder_state | ||
{ | ||
int fd; | ||
void *mapped; | ||
size_t mapsize; | ||
}; | ||
namespace android { | ||
class IBinder; | ||
class HostBinder { | ||
public: | ||
HostBinder(int mDriverFD_); | ||
HostBinder(binder_state* bs); | ||
sp<IBinder> getSVMObj(); | ||
void publishSVM(); | ||
private: | ||
int mDriverFD; | ||
std::shared_ptr<HostBinderShim> shim; | ||
std::shared_ptr<HostBinderShim> getShim(); | ||
}; | ||
class LocalBinder : public BBinder | ||
{ | ||
public: | ||
sp<IBinder> remoteBinder; | ||
LocalBinder(std::shared_ptr<HostBinderShim> &shim_); | ||
protected: | ||
virtual status_t onTransact( uint32_t code, | ||
const Parcel& data, | ||
Parcel* reply, | ||
uint32_t flags = 0); | ||
private: | ||
std::shared_ptr<HostBinderShim> shim; | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef __HOSTBINDERSHIM_H__ | ||
#define __HOSTBINDERSHIM_H__ | ||
#include <utils/RefBase.h> | ||
#include <utils/String16.h> | ||
#include <binder/IBinder.h> | ||
#include <binder/Parcel.h> | ||
namespace android { | ||
class Parcel; | ||
class IBinder; | ||
class HostBinderShim { | ||
public: | ||
sp<IBinder> getHostAMS(); | ||
virtual void writeInterfaceToken(Parcel &data, String16 name) = 0; | ||
virtual void writeIntent(Parcel &out, const char *mPackage, const char *mClass, bool hasBundle) = 0; | ||
virtual void writeBroadcastBundle(Parcel &data, const char *key, sp<IBinder> binder) = 0; | ||
virtual void broadCastIntent(Parcel &data, const char* key, sp<IBinder> binder) = 0; | ||
virtual void sendBroadCast(sp<IBinder> ams, Parcel &data) = 0; | ||
virtual void enforceDescriptor(const Parcel &data) = 0; | ||
virtual bool needReadStatus() = 0; | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef __HOSTBINDERSHIM30_H__ | ||
#define __HOSTBINDERSHIM30_H__ | ||
#include <binder/HostBinderShim.h> | ||
namespace android { | ||
class HostBinderShim30: public HostBinderShim { | ||
public: | ||
void writeInterfaceToken(Parcel &data, String16 name); | ||
void writeIntent(Parcel &out, const char *mPackage, const char *mClass, bool hasBundle); | ||
void writeBroadcastBundle(Parcel &data, const char *key, sp<IBinder> binder); | ||
void broadCastIntent(Parcel &data, const char* key, sp<IBinder> binder); | ||
void sendBroadCast(sp<IBinder> ams, Parcel &data); | ||
void enforceDescriptor(const Parcel &data); | ||
bool needReadStatus(); | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.