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