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.GnssMeasurementCorrections;
25 import android.location.GnssRequest;
26 import android.location.IBatchedLocationCallback;
27 import android.location.IGnssAntennaInfoListener;
28 import android.location.IGnssMeasurementsListener;
29 import android.location.IGnssStatusListener;
30 import android.location.IGnssNavigationMessageListener;
31 import android.location.ILocationListener;
32 import android.location.Location;
33 import android.location.LocationRequest;
34 import android.location.LocationTime;
35 import android.os.Bundle;
36 import android.os.ICancellationSignal;
37 
38 import com.android.internal.location.ProviderProperties;
39 
40 /**
41  * System private API for talking with the location service.
42  *
43  * @hide
44  */
45 interface ILocationManager
46 {
getLastLocation(in LocationRequest request, String packageName, String featureId)47     Location getLastLocation(in LocationRequest request, String packageName, String featureId);
getCurrentLocation(in LocationRequest request, in ICancellationSignal cancellationSignal, in ILocationListener listener, String packageName, String featureId, String listenerId)48     boolean getCurrentLocation(in LocationRequest request,
49             in ICancellationSignal cancellationSignal, in ILocationListener listener,
50             String packageName, String featureId, String listenerId);
51 
requestLocationUpdates(in LocationRequest request, in ILocationListener listener, in PendingIntent intent, String packageName, String featureId, String listenerId)52     void requestLocationUpdates(in LocationRequest request, in ILocationListener listener,
53             in PendingIntent intent, String packageName, String featureId, String listenerId);
removeUpdates(in ILocationListener listener, in PendingIntent intent)54     void removeUpdates(in ILocationListener listener, in PendingIntent intent);
55 
requestGeofence(in LocationRequest request, in Geofence geofence, in PendingIntent intent, String packageName, String featureId)56     void requestGeofence(in LocationRequest request, in Geofence geofence,
57             in PendingIntent intent, String packageName, String featureId);
removeGeofence(in Geofence fence, in PendingIntent intent, String packageName)58     void removeGeofence(in Geofence fence, in PendingIntent intent, String packageName);
59 
registerGnssStatusCallback(IGnssStatusListener callback, String packageName, String featureId)60     boolean registerGnssStatusCallback(IGnssStatusListener callback, String packageName,
61             String featureId);
unregisterGnssStatusCallback(IGnssStatusListener callback)62     void unregisterGnssStatusCallback(IGnssStatusListener callback);
63 
geocoderIsPresent()64     boolean geocoderIsPresent();
getFromLocation(double latitude, double longitude, int maxResults, in GeocoderParams params, out List<Address> addrs)65     String getFromLocation(double latitude, double longitude, int maxResults,
66         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)67     String getFromLocationName(String locationName,
68         double lowerLeftLatitude, double lowerLeftLongitude,
69         double upperRightLatitude, double upperRightLongitude, int maxResults,
70         in GeocoderParams params, out List<Address> addrs);
71 
addGnssMeasurementsListener(in GnssRequest request, in IGnssMeasurementsListener listener, String packageName, String featureId)72     boolean addGnssMeasurementsListener(in GnssRequest request,
73             in IGnssMeasurementsListener listener,
74             String packageName, String featureId);
injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections, in String packageName)75     void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections,
76             in String packageName);
getGnssCapabilities()77     long getGnssCapabilities();
removeGnssMeasurementsListener(in IGnssMeasurementsListener listener)78     void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
79 
addGnssAntennaInfoListener(in IGnssAntennaInfoListener listener, String packageName, String featureId)80     boolean addGnssAntennaInfoListener(in IGnssAntennaInfoListener listener,
81              String packageName, String featureId);
removeGnssAntennaInfoListener(in IGnssAntennaInfoListener listener)82     void removeGnssAntennaInfoListener(in IGnssAntennaInfoListener listener);
83 
addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener, String packageName, String featureId)84     boolean addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener,
85              String packageName, String featureId);
removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener)86     void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);
87 
getGnssYearOfHardware()88     int getGnssYearOfHardware();
getGnssHardwareModelName()89     String getGnssHardwareModelName();
90 
getGnssBatchSize(String packageName)91     int getGnssBatchSize(String packageName);
addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName, String featureId)92     boolean addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName, String featureId);
removeGnssBatchingCallback()93     void removeGnssBatchingCallback();
startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName, String featureId)94     boolean startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName, String featureId);
flushGnssBatch(String packageName)95     void flushGnssBatch(String packageName);
stopGnssBatch()96     boolean stopGnssBatch();
injectLocation(in Location location)97     void injectLocation(in Location location);
98 
getAllProviders()99     List<String> getAllProviders();
getProviders(in Criteria criteria, boolean enabledOnly)100     List<String> getProviders(in Criteria criteria, boolean enabledOnly);
getBestProvider(in Criteria criteria, boolean enabledOnly)101     String getBestProvider(in Criteria criteria, boolean enabledOnly);
getProviderProperties(String provider)102     ProviderProperties getProviderProperties(String provider);
isProviderPackage(String packageName)103     boolean isProviderPackage(String packageName);
getProviderPackages(String provider)104     List<String> getProviderPackages(String provider);
105 
setExtraLocationControllerPackage(String packageName)106     void setExtraLocationControllerPackage(String packageName);
getExtraLocationControllerPackage()107     String getExtraLocationControllerPackage();
setExtraLocationControllerPackageEnabled(boolean enabled)108     void setExtraLocationControllerPackageEnabled(boolean enabled);
isExtraLocationControllerPackageEnabled()109     boolean isExtraLocationControllerPackageEnabled();
110 
isProviderEnabledForUser(String provider, int userId)111     boolean isProviderEnabledForUser(String provider, int userId);
isLocationEnabledForUser(int userId)112     boolean isLocationEnabledForUser(int userId);
setLocationEnabledForUser(boolean enabled, int userId)113     void setLocationEnabledForUser(boolean enabled, int userId);
addTestProvider(String name, in ProviderProperties properties, String packageName, String featureId)114     void addTestProvider(String name, in ProviderProperties properties, String packageName, String featureId);
removeTestProvider(String provider, String packageName, String featureId)115     void removeTestProvider(String provider, String packageName, String featureId);
setTestProviderLocation(String provider, in Location location, String packageName, String featureId)116     void setTestProviderLocation(String provider, in Location location, String packageName, String featureId);
setTestProviderEnabled(String provider, boolean enabled, String packageName, String featureId)117     void setTestProviderEnabled(String provider, boolean enabled, String packageName, String featureId);
getTestProviderCurrentRequests(String provider)118     List<LocationRequest> getTestProviderCurrentRequests(String provider);
getGnssTimeMillis()119     LocationTime getGnssTimeMillis();
120 
sendExtraCommand(String provider, String command, inout Bundle extras)121     boolean sendExtraCommand(String provider, String command, inout Bundle extras);
122 
123     // --- internal ---
124 
125     // for reporting callback completion
locationCallbackFinished(ILocationListener listener)126     void locationCallbackFinished(ILocationListener listener);
127 
128     // used by gts tests to verify whitelists
getBackgroundThrottlingWhitelist()129     String[] getBackgroundThrottlingWhitelist();
getIgnoreSettingsWhitelist()130     String[] getIgnoreSettingsWhitelist();
131 }
132