1/*
2 * Copyright (C) 2007, 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.location;
18
19import android.app.PendingIntent;
20import android.location.Address;
21import android.location.Criteria;
22import android.location.GeocoderParams;
23import android.location.Geofence;
24import android.location.IBatchedLocationCallback;
25import android.location.IGnssMeasurementsListener;
26import android.location.IGnssStatusListener;
27import android.location.IGnssNavigationMessageListener;
28import android.location.ILocationListener;
29import android.location.Location;
30import android.location.LocationRequest;
31import android.os.Bundle;
32
33import com.android.internal.location.ProviderProperties;
34
35/**
36 * System private API for talking with the location service.
37 *
38 * @hide
39 */
40interface ILocationManager
41{
42    void requestLocationUpdates(in LocationRequest request, in ILocationListener listener,
43            in PendingIntent intent, String packageName);
44    void removeUpdates(in ILocationListener listener, in PendingIntent intent, String packageName);
45
46    void requestGeofence(in LocationRequest request, in Geofence geofence,
47            in PendingIntent intent, String packageName);
48    void removeGeofence(in Geofence fence, in PendingIntent intent, String packageName);
49
50    Location getLastLocation(in LocationRequest request, String packageName);
51
52    boolean registerGnssStatusCallback(IGnssStatusListener callback, String packageName);
53    void unregisterGnssStatusCallback(IGnssStatusListener callback);
54
55    boolean geocoderIsPresent();
56    String getFromLocation(double latitude, double longitude, int maxResults,
57        in GeocoderParams params, out List<Address> addrs);
58    String getFromLocationName(String locationName,
59        double lowerLeftLatitude, double lowerLeftLongitude,
60        double upperRightLatitude, double upperRightLongitude, int maxResults,
61        in GeocoderParams params, out List<Address> addrs);
62
63    boolean sendNiResponse(int notifId, int userResponse);
64
65    boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener, in String packageName);
66    void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
67
68    boolean addGnssNavigationMessageListener(
69            in IGnssNavigationMessageListener listener,
70            in String packageName);
71    void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);
72
73    int getGnssYearOfHardware();
74    String getGnssHardwareModelName();
75
76    int getGnssBatchSize(String packageName);
77    boolean addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName);
78    void removeGnssBatchingCallback();
79    boolean startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName);
80    void flushGnssBatch(String packageName);
81    boolean stopGnssBatch();
82    boolean injectLocation(in Location location);
83
84    // --- deprecated ---
85    List<String> getAllProviders();
86    List<String> getProviders(in Criteria criteria, boolean enabledOnly);
87    String getBestProvider(in Criteria criteria, boolean enabledOnly);
88    boolean providerMeetsCriteria(String provider, in Criteria criteria);
89    ProviderProperties getProviderProperties(String provider);
90    String getNetworkProviderPackage();
91
92    boolean isProviderEnabledForUser(String provider, int userId);
93    boolean setProviderEnabledForUser(String provider, boolean enabled, int userId);
94    boolean isLocationEnabledForUser(int userId);
95    void setLocationEnabledForUser(boolean enabled, int userId);
96    void addTestProvider(String name, in ProviderProperties properties, String opPackageName);
97    void removeTestProvider(String provider, String opPackageName);
98    void setTestProviderLocation(String provider, in Location loc, String opPackageName);
99    void clearTestProviderLocation(String provider, String opPackageName);
100    void setTestProviderEnabled(String provider, boolean enabled, String opPackageName);
101    void clearTestProviderEnabled(String provider, String opPackageName);
102    void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime,
103            String opPackageName);
104    void clearTestProviderStatus(String provider, String opPackageName);
105
106    boolean sendExtraCommand(String provider, String command, inout Bundle extras);
107
108    // --- internal ---
109
110    // Used by location providers to tell the location manager when it has a new location.
111    // Passive is true if the location is coming from the passive provider, in which case
112    // it need not be shared with other providers.
113    void reportLocation(in Location location, boolean passive);
114
115    // Used when a (initially Gnss) Location batch arrives
116    void reportLocationBatch(in List<Location> locations);
117
118    // for reporting callback completion
119    void locationCallbackFinished(ILocationListener listener);
120
121    // used by gts tests to verify throttling whitelist
122    String[] getBackgroundThrottlingWhitelist();
123}
124