1 /*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "rpc_world_manager.h"
18
19 #ifdef CHRE_NANOAPP_INTERNAL
20 namespace chre {
21 namespace {
22 #endif // CHRE_NANOAPP_INTERNAL
23
nanoappHandleEvent(uint32_t senderInstanceId,uint16_t eventType,const void * eventData)24 void nanoappHandleEvent(uint32_t senderInstanceId, uint16_t eventType,
25 const void *eventData) {
26 RpcWorldManagerSingleton::get()->handleEvent(senderInstanceId, eventType,
27 eventData);
28 }
29
nanoappStart(void)30 bool nanoappStart(void) {
31 RpcWorldManagerSingleton::init();
32 return RpcWorldManagerSingleton::get()->start();
33 }
34
nanoappEnd(void)35 void nanoappEnd(void) {
36 RpcWorldManagerSingleton::get()->end();
37 RpcWorldManagerSingleton::deinit();
38 }
39
40 #ifdef CHRE_NANOAPP_INTERNAL
41 } // namespace
42 } // namespace chre
43
44 #include "chre/platform/static_nanoapp_init.h"
45 #include "chre/util/nanoapp/app_id.h"
46 #include "chre/util/system/napp_permissions.h"
47
48 CHRE_STATIC_NANOAPP_INIT(RpcWorld, chre::kRpcWorldAppId, 0,
49 chre::NanoappPermissions::CHRE_PERMS_NONE);
50 #endif // CHRE_NANOAPP_INTERNAL