1/*
2 * Copyright (C) 2020 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
17package android.hardware.contexthub@1.2;
18
19import @1.0::ContextHubMsg;
20import @1.0::HubAppInfo;
21import @1.1::Setting;
22
23/**
24 * Used to indicate the type of user setting that has changed.
25 */
26enum Setting : @1.1::Setting {
27    /**
28     * Indicates that the WiFi capabilities can be used in CHRE. This setting
29     * follows the overall availability of WiFi-related functionality within
30     * the Android framework, for example if WiFi is disabled for connectivity
31     * purposes but is enabled for location purposes (scanning), then
32     * WIFI_AVAILABLE is enabled.
33     */
34    WIFI_AVAILABLE,
35    AIRPLANE_MODE,
36
37    /**
38     * Indicates if the microphone access is available for CHRE. Microphone
39     * access is disabled if the user has turned off the microphone as a
40     * privacy setting, in which case audio data cannot be used and propagated
41     * by CHRE.
42     */
43    MICROPHONE,
44};
45
46struct ContextHubMsg {
47    @1.0::ContextHubMsg msg_1_0;
48
49    /**
50     * The list of Android permissions held by the sending nanoapp at the time
51     * the message was sent.
52     *
53     * The framework MUST drop messages to host apps that don't have a superset
54     * of the permissions that the sending nanoapp is using.
55     */
56    vec<string> permissions;
57};
58
59struct HubAppInfo {
60    @1.0::HubAppInfo info_1_0;
61
62    /**
63     * The list of Android permissions used by this nanoapp. This list MUST
64     * correspond to the permissions required for an equivalent Android app to
65     * sample similar signals through the Android framework.
66     *
67     * For example, if a nanoapp used location-based signals, the permissions
68     * list MUST contains android.permission.ACCESS_FINE_LOCATION and
69     * android.permission.ACCESS_BACKGROUND_LOCATION. If it were to also list to
70     * audio data, it would require adding android.permission.RECORD_AUDIO to
71     * this list.
72     */
73    vec<string> permissions;
74};
75