• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 /**
18  * Trivial nanoapp which fails on startup.
19  *
20  * Non-trivial nanoapp tests may indicate early failure by failing the
21  * nanoappStart() method.  This test assures that those failures are
22  * properly reported by the CHRE, so we know our other test failures will
23  * be caught.
24  */
25 
26 #include <cstdint>
27 
28 #include <shared/abort.h>
29 #include "chre_api/chre.h"
30 
nanoappHandleEvent(uint32_t,uint16_t,const void *)31 extern "C" void nanoappHandleEvent(uint32_t /* senderInstanceId */,
32                                    uint16_t /* eventType */,
33                                    const void * /* eventData */) {
34   // Intentionally do nothing.
35 }
36 
nanoappStart(void)37 extern "C" bool nanoappStart(void) {
38   // Return failure
39   return false;
40 }
41 
nanoappEnd(void)42 extern "C" void nanoappEnd(void) {
43   // It is an error for the CHRE to call this method.
44   nanoapp_testing::abort(nanoapp_testing::AbortBlame::kChreInNanoappEnd);
45 }
46