xref: /aosp_15_r20/hardware/interfaces/gnss/visibility_control/1.0/IGnssVisibilityControlCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Worker/**
20*4d7e907cSAndroid Build Coastguard Worker * GNSS location reporting permissions and notification callback interface.
21*4d7e907cSAndroid Build Coastguard Worker */
22*4d7e907cSAndroid Build Coastguard Workerinterface IGnssVisibilityControlCallback {
23*4d7e907cSAndroid Build Coastguard Worker    /**
24*4d7e907cSAndroid Build Coastguard Worker     * Protocol stack that is requesting the non-framework location information.
25*4d7e907cSAndroid Build Coastguard Worker     */
26*4d7e907cSAndroid Build Coastguard Worker    enum NfwProtocolStack : uint8_t {
27*4d7e907cSAndroid Build Coastguard Worker        /** Cellular control plane requests */
28*4d7e907cSAndroid Build Coastguard Worker        CTRL_PLANE                      = 0,
29*4d7e907cSAndroid Build Coastguard Worker        /** All types of SUPL requests */
30*4d7e907cSAndroid Build Coastguard Worker        SUPL                            = 1,
31*4d7e907cSAndroid Build Coastguard Worker
32*4d7e907cSAndroid Build Coastguard Worker        /** All types of requests from IMS */
33*4d7e907cSAndroid Build Coastguard Worker        IMS                             = 10,
34*4d7e907cSAndroid Build Coastguard Worker        /** All types of requests from SIM */
35*4d7e907cSAndroid Build Coastguard Worker        SIM                             = 11,
36*4d7e907cSAndroid Build Coastguard Worker
37*4d7e907cSAndroid Build Coastguard Worker        /** Requests from other protocol stacks */
38*4d7e907cSAndroid Build Coastguard Worker        OTHER_PROTOCOL_STACK            = 100
39*4d7e907cSAndroid Build Coastguard Worker    };
40*4d7e907cSAndroid Build Coastguard Worker
41*4d7e907cSAndroid Build Coastguard Worker    /*
42*4d7e907cSAndroid Build Coastguard Worker     * Entity that is requesting/receiving the location information.
43*4d7e907cSAndroid Build Coastguard Worker     */
44*4d7e907cSAndroid Build Coastguard Worker    enum NfwRequestor : uint8_t {
45*4d7e907cSAndroid Build Coastguard Worker        /** Wireless service provider */
46*4d7e907cSAndroid Build Coastguard Worker        CARRIER                         = 0,
47*4d7e907cSAndroid Build Coastguard Worker
48*4d7e907cSAndroid Build Coastguard Worker        /** Device manufacturer */
49*4d7e907cSAndroid Build Coastguard Worker        OEM                             = 10,
50*4d7e907cSAndroid Build Coastguard Worker        /** Modem chipset vendor */
51*4d7e907cSAndroid Build Coastguard Worker        MODEM_CHIPSET_VENDOR            = 11,
52*4d7e907cSAndroid Build Coastguard Worker        /** GNSS chipset vendor */
53*4d7e907cSAndroid Build Coastguard Worker        GNSS_CHIPSET_VENDOR             = 12,
54*4d7e907cSAndroid Build Coastguard Worker        /** Other chipset vendor */
55*4d7e907cSAndroid Build Coastguard Worker        OTHER_CHIPSET_VENDOR            = 13,
56*4d7e907cSAndroid Build Coastguard Worker
57*4d7e907cSAndroid Build Coastguard Worker        /** Automobile client */
58*4d7e907cSAndroid Build Coastguard Worker        AUTOMOBILE_CLIENT               = 20,
59*4d7e907cSAndroid Build Coastguard Worker
60*4d7e907cSAndroid Build Coastguard Worker        /** Other sources */
61*4d7e907cSAndroid Build Coastguard Worker        OTHER_REQUESTOR                 = 100
62*4d7e907cSAndroid Build Coastguard Worker     };
63*4d7e907cSAndroid Build Coastguard Worker
64*4d7e907cSAndroid Build Coastguard Worker    /**
65*4d7e907cSAndroid Build Coastguard Worker     * GNSS response type for non-framework location requests.
66*4d7e907cSAndroid Build Coastguard Worker     */
67*4d7e907cSAndroid Build Coastguard Worker    enum NfwResponseType : uint8_t {
68*4d7e907cSAndroid Build Coastguard Worker        /** Request rejected because framework has not given permission for this use case */
69*4d7e907cSAndroid Build Coastguard Worker        REJECTED                        = 0,
70*4d7e907cSAndroid Build Coastguard Worker
71*4d7e907cSAndroid Build Coastguard Worker        /** Request accepted but could not provide location because of a failure */
72*4d7e907cSAndroid Build Coastguard Worker        ACCEPTED_NO_LOCATION_PROVIDED   = 1,
73*4d7e907cSAndroid Build Coastguard Worker
74*4d7e907cSAndroid Build Coastguard Worker        /** Request accepted and location provided */
75*4d7e907cSAndroid Build Coastguard Worker        ACCEPTED_LOCATION_PROVIDED      = 2,
76*4d7e907cSAndroid Build Coastguard Worker     };
77*4d7e907cSAndroid Build Coastguard Worker
78*4d7e907cSAndroid Build Coastguard Worker    /**
79*4d7e907cSAndroid Build Coastguard Worker     * Represents a non-framework location information request/response notification.
80*4d7e907cSAndroid Build Coastguard Worker     */
81*4d7e907cSAndroid Build Coastguard Worker    struct NfwNotification {
82*4d7e907cSAndroid Build Coastguard Worker        /**
83*4d7e907cSAndroid Build Coastguard Worker         * Package name of the Android proxy application representing the non-framework
84*4d7e907cSAndroid Build Coastguard Worker         * entity that requested location. Set to empty string if unknown.
85*4d7e907cSAndroid Build Coastguard Worker         *
86*4d7e907cSAndroid Build Coastguard Worker         * For user-initiated emergency use cases, this field must be set to empty string
87*4d7e907cSAndroid Build Coastguard Worker         * and the inEmergencyMode field must be set to true.
88*4d7e907cSAndroid Build Coastguard Worker         */
89*4d7e907cSAndroid Build Coastguard Worker        string proxyAppPackageName;
90*4d7e907cSAndroid Build Coastguard Worker
91*4d7e907cSAndroid Build Coastguard Worker        /** Protocol stack that initiated the non-framework location request. */
92*4d7e907cSAndroid Build Coastguard Worker        NfwProtocolStack protocolStack;
93*4d7e907cSAndroid Build Coastguard Worker
94*4d7e907cSAndroid Build Coastguard Worker        /**
95*4d7e907cSAndroid Build Coastguard Worker         * Name of the protocol stack if protocolStack field is set to OTHER_PROTOCOL_STACK.
96*4d7e907cSAndroid Build Coastguard Worker         * Otherwise, set to empty string.
97*4d7e907cSAndroid Build Coastguard Worker         *
98*4d7e907cSAndroid Build Coastguard Worker         * This field is opaque to the framework and used for logging purposes.
99*4d7e907cSAndroid Build Coastguard Worker         */
100*4d7e907cSAndroid Build Coastguard Worker        string otherProtocolStackName;
101*4d7e907cSAndroid Build Coastguard Worker
102*4d7e907cSAndroid Build Coastguard Worker        /** Source initiating/receiving the location information. */
103*4d7e907cSAndroid Build Coastguard Worker        NfwRequestor requestor;
104*4d7e907cSAndroid Build Coastguard Worker
105*4d7e907cSAndroid Build Coastguard Worker        /**
106*4d7e907cSAndroid Build Coastguard Worker         * Identity of the endpoint receiving the location information. For example, carrier
107*4d7e907cSAndroid Build Coastguard Worker         * name, OEM name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc.
108*4d7e907cSAndroid Build Coastguard Worker         *
109*4d7e907cSAndroid Build Coastguard Worker         * This field is opaque to the framework and used for logging purposes.
110*4d7e907cSAndroid Build Coastguard Worker         */
111*4d7e907cSAndroid Build Coastguard Worker        string requestorId;
112*4d7e907cSAndroid Build Coastguard Worker
113*4d7e907cSAndroid Build Coastguard Worker        /** Indicates whether location information was provided for this request. */
114*4d7e907cSAndroid Build Coastguard Worker        NfwResponseType responseType;
115*4d7e907cSAndroid Build Coastguard Worker
116*4d7e907cSAndroid Build Coastguard Worker        /** Is the device in user initiated emergency session. */
117*4d7e907cSAndroid Build Coastguard Worker        bool inEmergencyMode;
118*4d7e907cSAndroid Build Coastguard Worker
119*4d7e907cSAndroid Build Coastguard Worker        /** Is cached location provided */
120*4d7e907cSAndroid Build Coastguard Worker        bool isCachedLocation;
121*4d7e907cSAndroid Build Coastguard Worker    };
122*4d7e907cSAndroid Build Coastguard Worker
123*4d7e907cSAndroid Build Coastguard Worker    /**
124*4d7e907cSAndroid Build Coastguard Worker     * Callback to report a non-framework delivered location.
125*4d7e907cSAndroid Build Coastguard Worker     *
126*4d7e907cSAndroid Build Coastguard Worker     * The GNSS HAL implementation must call this method to notify the framework whenever
127*4d7e907cSAndroid Build Coastguard Worker     * a non-framework location request is made to the GNSS HAL.
128*4d7e907cSAndroid Build Coastguard Worker     *
129*4d7e907cSAndroid Build Coastguard Worker     * Non-framework entities like low power sensor hubs that request location from GNSS and
130*4d7e907cSAndroid Build Coastguard Worker     * only pass location information through Android framework controls are exempt from this
131*4d7e907cSAndroid Build Coastguard Worker     * power-spending reporting. However, low power sensor hubs or other chipsets which may send
132*4d7e907cSAndroid Build Coastguard Worker     * the location information to anywhere other than Android framework (which provides user
133*4d7e907cSAndroid Build Coastguard Worker     * visibility and control), must report location information use through this API whenever
134*4d7e907cSAndroid Build Coastguard Worker     * location information (or events driven by that location such as "home" location detection)
135*4d7e907cSAndroid Build Coastguard Worker     * leaves the domain of that low power chipset.
136*4d7e907cSAndroid Build Coastguard Worker     *
137*4d7e907cSAndroid Build Coastguard Worker     * To avoid overly spamming the framework, high speed location reporting of the exact same
138*4d7e907cSAndroid Build Coastguard Worker     * type may be throttled to report location at a lower rate than the actual report rate, as
139*4d7e907cSAndroid Build Coastguard Worker     * long as the location is reported with a latency of no more than the larger of 5 seconds,
140*4d7e907cSAndroid Build Coastguard Worker     * or the next the Android processor awake time. For example, if an Automotive client is
141*4d7e907cSAndroid Build Coastguard Worker     * getting location information from the GNSS location system at 20Hz, this method may be
142*4d7e907cSAndroid Build Coastguard Worker     * called at 1Hz. As another example, if a low power processor is getting location from the
143*4d7e907cSAndroid Build Coastguard Worker     * GNSS chipset, and the Android processor is asleep, the notification to the Android HAL may
144*4d7e907cSAndroid Build Coastguard Worker     * be delayed until the next wake of the Android processor.
145*4d7e907cSAndroid Build Coastguard Worker     *
146*4d7e907cSAndroid Build Coastguard Worker     * @param notification Non-framework delivered location request/response description.
147*4d7e907cSAndroid Build Coastguard Worker     */
148*4d7e907cSAndroid Build Coastguard Worker    nfwNotifyCb(NfwNotification notification);
149*4d7e907cSAndroid Build Coastguard Worker
150*4d7e907cSAndroid Build Coastguard Worker    /**
151*4d7e907cSAndroid Build Coastguard Worker     * Tells if the device is currently in an emergency session.
152*4d7e907cSAndroid Build Coastguard Worker     *
153*4d7e907cSAndroid Build Coastguard Worker     * Emergency session is defined as the device being actively in a user initiated emergency
154*4d7e907cSAndroid Build Coastguard Worker     * call or in post emergency call extension time period.
155*4d7e907cSAndroid Build Coastguard Worker     *
156*4d7e907cSAndroid Build Coastguard Worker     * If the GNSS HAL implementation cannot determine if the device is in emergency session
157*4d7e907cSAndroid Build Coastguard Worker     * mode, it must call this method to confirm that the device is in emergency session before
158*4d7e907cSAndroid Build Coastguard Worker     * serving network initiated emergency SUPL and Control Plane location requests.
159*4d7e907cSAndroid Build Coastguard Worker     *
160*4d7e907cSAndroid Build Coastguard Worker     * @return success True if the framework determines that the device is in emergency session.
161*4d7e907cSAndroid Build Coastguard Worker     */
162*4d7e907cSAndroid Build Coastguard Worker    isInEmergencySession() generates (bool success);
163*4d7e907cSAndroid Build Coastguard Worker};
164