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