-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHelloWorldService.cpp
More file actions
executable file
·40 lines (31 loc) · 1.06 KB
/
HelloWorldService.cpp
File metadata and controls
executable file
·40 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//#define LOG_NDEBUG 0
#define LOG_TAG "HelloWorldService"
#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>
#include <HelloWorldService.h>
#include <utils/Log.h>
namespace android {
void HelloWorldService::instantiate() {
defaultServiceManager()->addService(
String16("android.native.helloworld"), new HelloWorldService());
}
status_t HelloWorldService::helloWorld(const char *str) {
ALOGI("%s\n", str);
printf("helloWorld function run on process(pid=%d), show string: %s\n", getpid(), str);
return NO_ERROR;
}
status_t HelloWorldService::foo() {
printf("foo function run on process(pid=%d)\n", getpid());
return NO_ERROR;
}
HelloWorldService::HelloWorldService() {
ALOGI("HelloWorldService is created");
}
HelloWorldService::~HelloWorldService() {
ALOGI("HelloWorldService is destroyed");
}
status_t HelloWorldService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
return BnHelloWorldService::onTransact(code, data, reply, flags);
}
}; // namespace android