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 <chre.h>
29
30 #include <shared/abort.h>
31
nanoappHandleEvent(uint32_t,uint16_t,const void *)32 extern "C" void nanoappHandleEvent(uint32_t /* senderInstanceId */,
33 uint16_t /* eventType */,
34 const void* /* eventData */) {
35 // Intentionally do nothing.
36 }
37
nanoappStart(void)38 extern "C" bool nanoappStart(void) {
39 // Return failure
40 return false;
41 }
42
nanoappEnd(void)43 extern "C" void nanoappEnd(void) {
44 // It is an error for the CHRE to call this method.
45 nanoapp_testing::abort(nanoapp_testing::AbortBlame::kChreInNanoappEnd);
46 }
47