1
0
mirror of https://github.com/ioacademy-jikim/android_framwork synced 2025-06-07 16:06:29 +00:00
ioacademy-jikim 931b702e82 11
2018-06-15 15:44:42 +09:00

28 lines
598 B
C++

#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <binder/Binder.h>
#include <binder/IPCThreadState.h>
#include <utils/String16.h>
#include <binder/MemoryHeapBase.h>
#include <string.h>
using namespace android;
int main()
{
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm(defaultServiceManager());
sp<IMemoryHeap> heap = new MemoryHeapBase(4096);
sm->addService( String16("ashmem.service"), heap->asBinder(heap) );
char *p;
p = (char*)heap->base();
strcpy( p, "Hello Android!!");
IPCThreadState::self()->joinThreadPool();
return 0;
}