1/*
2 * Copyright (C) 2018 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.gnss.visibility_control@1.0;
18
19import IGnssVisibilityControlCallback;
20
21/**
22 * Represents the GNSS location reporting permissions and notification interface.
23 *
24 * This interface is used to tell the GNSS HAL implementation whether the framework user has
25 * granted permission to the GNSS HAL implementation to provide GNSS location information for
26 * non-framework (NFW), non-user initiated emergency use cases, and to notify the framework user
27 * of these GNSS location information deliveries.
28 *
29 * For user initiated emergency cases (and for the configured extended emergency session duration),
30 * the GNSS HAL implementation must serve the emergency location supporting network initiated
31 * location requests immediately irrespective of this permission settings.
32 *
33 * There is no separate need for the GNSS HAL implementation to monitor the global device location
34 * on/off setting. Permission to use GNSS for non-framework use cases is expressly controlled
35 * by the method enableNfwLocationAccess(). The framework monitors the location permission settings
36 * of the configured proxy applications(s), and device location settings, and calls the method
37 * enableNfwLocationAccess() whenever the user control proxy applications have, or do not have,
38 * location permission. The proxy applications are used to provide user visibility and control of
39 * location access by the non-framework on/off device entities they are representing.
40 *
41 * For device user visibility, the GNSS HAL implementation must call the method
42 * IGnssVisibilityControlCallback.nfwNotifyCb() whenever location request is rejected or
43 * location information is provided to non-framework entities (on or off device). This includes
44 * the network initiated location requests for user-initiated emergency use cases as well.
45 *
46 * The HAL implementations that support this interface must not report GNSS location, measurement,
47 * status, or other information that can be used to derive user location to any entity when not
48 * expressly authorized by this HAL. This includes all endpoints for location information
49 * off the device, including carriers, vendors, OEM and others directly or indirectly.
50 */
51interface IGnssVisibilityControl {
52    /**
53     * Enables/disables non-framework entity location access permission in the GNSS HAL.
54     *
55     * The framework will call this method to update GNSS HAL implementation every time the
56     * framework user, through the given proxy application(s) and/or device location settings,
57     * explicitly grants/revokes the location access permission for non-framework, non-user
58     * initiated emergency use cases.
59     *
60     * Whenever the user location information is delivered to non-framework entities, the HAL
61     * implementation must call the method IGnssVisibilityControlCallback.nfwNotifyCb() to notify
62     * the framework for user visibility.
63     *
64     * @param proxyApps Full list of package names of proxy Android applications representing
65     * the non-framework location access entities (on/off the device) for which the framework
66     * user has granted non-framework location access permission. The GNSS HAL implementation
67     * must provide location information only to non-framework entities represented by these
68     * proxy applications.
69     *
70     * The package name of the proxy Android application follows the standard Java language
71     * package naming format. For example, com.example.myapp.
72     *
73     * @return success True if the operation was successful.
74     */
75    enableNfwLocationAccess(vec<string> proxyApps) generates (bool success);
76
77    /**
78     * Registers the callback for HAL implementation to use.
79     *
80     * @param callback Handle to IGnssVisibilityControlCallback interface.
81     */
82    setCallback(IGnssVisibilityControlCallback callback) generates (bool success);
83};