• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.GnssAntennaInfo;
25 import android.location.GnssCapabilities;
26 import android.location.GnssMeasurementCorrections;
27 import android.location.GnssMeasurementRequest;
28 import android.location.IGeocodeListener;
29 import android.location.IGnssAntennaInfoListener;
30 import android.location.IGnssMeasurementsListener;
31 import android.location.IGnssStatusListener;
32 import android.location.IGnssNavigationMessageListener;
33 import android.location.IGnssNmeaListener;
34 import android.location.ILocationCallback;
35 import android.location.ILocationListener;
36 import android.location.LastLocationRequest;
37 import android.location.Location;
38 import android.location.LocationRequest;
39 import android.location.LocationTime;
40 import android.location.provider.IProviderRequestListener;
41 import android.location.provider.ProviderProperties;
42 import android.os.Bundle;
43 import android.os.ICancellationSignal;
44 import android.os.PackageTagsList;
45 
46 /**
47  * System private API for talking with the location service.
48  *
49  * @hide
50  */
51 interface ILocationManager
52 {
getLastLocation(String provider, in LastLocationRequest request, String packageName, @nullable String attributionTag)53     @nullable Location getLastLocation(String provider, in LastLocationRequest request, String packageName, @nullable String attributionTag);
getCurrentLocation(String provider, in LocationRequest request, in ILocationCallback callback, String packageName, @nullable String attributionTag, String listenerId)54     @nullable ICancellationSignal getCurrentLocation(String provider, in LocationRequest request, in ILocationCallback callback, String packageName, @nullable String attributionTag, String listenerId);
55 
registerLocationListener(String provider, in LocationRequest request, in ILocationListener listener, String packageName, @nullable String attributionTag, String listenerId)56     void registerLocationListener(String provider, in LocationRequest request, in ILocationListener listener, String packageName, @nullable String attributionTag, String listenerId);
unregisterLocationListener(in ILocationListener listener)57     void unregisterLocationListener(in ILocationListener listener);
58 
registerLocationPendingIntent(String provider, in LocationRequest request, in PendingIntent pendingIntent, String packageName, @nullable String attributionTag)59     void registerLocationPendingIntent(String provider, in LocationRequest request, in PendingIntent pendingIntent, String packageName, @nullable String attributionTag);
unregisterLocationPendingIntent(in PendingIntent pendingIntent)60     void unregisterLocationPendingIntent(in PendingIntent pendingIntent);
61 
injectLocation(in Location location)62     void injectLocation(in Location location);
63 
requestListenerFlush(String provider, in ILocationListener listener, int requestCode)64     void requestListenerFlush(String provider, in ILocationListener listener, int requestCode);
requestPendingIntentFlush(String provider, in PendingIntent pendingIntent, int requestCode)65     void requestPendingIntentFlush(String provider, in PendingIntent pendingIntent, int requestCode);
66 
requestGeofence(in Geofence geofence, in PendingIntent intent, String packageName, String attributionTag)67     void requestGeofence(in Geofence geofence, in PendingIntent intent, String packageName, String attributionTag);
removeGeofence(in PendingIntent intent)68     void removeGeofence(in PendingIntent intent);
69 
geocoderIsPresent()70     boolean geocoderIsPresent();
getFromLocation(double latitude, double longitude, int maxResults, in GeocoderParams params, in IGeocodeListener listener)71     void getFromLocation(double latitude, double longitude, int maxResults,
72         in GeocoderParams params, in IGeocodeListener listener);
getFromLocationName(String locationName, double lowerLeftLatitude, double lowerLeftLongitude, double upperRightLatitude, double upperRightLongitude, int maxResults, in GeocoderParams params, in IGeocodeListener listener)73     void getFromLocationName(String locationName,
74         double lowerLeftLatitude, double lowerLeftLongitude,
75         double upperRightLatitude, double upperRightLongitude, int maxResults,
76         in GeocoderParams params, in IGeocodeListener listener);
77 
getGnssCapabilities()78     GnssCapabilities getGnssCapabilities();
getGnssYearOfHardware()79     int getGnssYearOfHardware();
getGnssHardwareModelName()80     String getGnssHardwareModelName();
81 
getGnssAntennaInfos()82     @nullable List<GnssAntennaInfo> getGnssAntennaInfos();
83 
registerGnssStatusCallback(in IGnssStatusListener callback, String packageName, @nullable String attributionTag, String listenerId)84     void registerGnssStatusCallback(in IGnssStatusListener callback, String packageName, @nullable String attributionTag, String listenerId);
unregisterGnssStatusCallback(in IGnssStatusListener callback)85     void unregisterGnssStatusCallback(in IGnssStatusListener callback);
86 
registerGnssNmeaCallback(in IGnssNmeaListener callback, String packageName, @nullable String attributionTag, String listenerId)87     void registerGnssNmeaCallback(in IGnssNmeaListener callback, String packageName, @nullable String attributionTag, String listenerId);
unregisterGnssNmeaCallback(in IGnssNmeaListener callback)88     void unregisterGnssNmeaCallback(in IGnssNmeaListener callback);
89 
addGnssMeasurementsListener(in GnssMeasurementRequest request, in IGnssMeasurementsListener listener, String packageName, @nullable String attributionTag, String listenerId)90     void addGnssMeasurementsListener(in GnssMeasurementRequest request, in IGnssMeasurementsListener listener, String packageName, @nullable String attributionTag, String listenerId);
removeGnssMeasurementsListener(in IGnssMeasurementsListener listener)91     void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections)92     void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections);
93 
addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener, String packageName, @nullable String attributionTag, String listenerId)94     void addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener, String packageName, @nullable String attributionTag, String listenerId);
removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener)95     void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);
96 
addGnssAntennaInfoListener(in IGnssAntennaInfoListener listener, String packageName, @nullable String attributionTag, String listenerId)97     void addGnssAntennaInfoListener(in IGnssAntennaInfoListener listener, String packageName, @nullable String attributionTag, String listenerId);
removeGnssAntennaInfoListener(in IGnssAntennaInfoListener listener)98     void removeGnssAntennaInfoListener(in IGnssAntennaInfoListener listener);
99 
addProviderRequestListener(in IProviderRequestListener listener)100     void addProviderRequestListener(in IProviderRequestListener listener);
removeProviderRequestListener(in IProviderRequestListener listener)101     void removeProviderRequestListener(in IProviderRequestListener listener);
102 
getGnssBatchSize()103     int getGnssBatchSize();
startGnssBatch(long periodNanos, in ILocationListener listener, String packageName, @nullable String attributionTag, String listenerId)104     void startGnssBatch(long periodNanos, in ILocationListener listener, String packageName, @nullable String attributionTag, String listenerId);
flushGnssBatch()105     void flushGnssBatch();
stopGnssBatch()106     void stopGnssBatch();
107 
hasProvider(String provider)108     boolean hasProvider(String provider);
getAllProviders()109     List<String> getAllProviders();
getProviders(in Criteria criteria, boolean enabledOnly)110     List<String> getProviders(in Criteria criteria, boolean enabledOnly);
getBestProvider(in Criteria criteria, boolean enabledOnly)111     String getBestProvider(in Criteria criteria, boolean enabledOnly);
getProviderProperties(String provider)112     ProviderProperties getProviderProperties(String provider);
isProviderPackage(@ullable String provider, String packageName, @nullable String attributionTag)113     boolean isProviderPackage(@nullable String provider, String packageName, @nullable String attributionTag);
getProviderPackages(String provider)114     List<String> getProviderPackages(String provider);
115 
setExtraLocationControllerPackage(String packageName)116     void setExtraLocationControllerPackage(String packageName);
getExtraLocationControllerPackage()117     String getExtraLocationControllerPackage();
setExtraLocationControllerPackageEnabled(boolean enabled)118     void setExtraLocationControllerPackageEnabled(boolean enabled);
isExtraLocationControllerPackageEnabled()119     boolean isExtraLocationControllerPackageEnabled();
120 
isProviderEnabledForUser(String provider, int userId)121     boolean isProviderEnabledForUser(String provider, int userId);
isLocationEnabledForUser(int userId)122     boolean isLocationEnabledForUser(int userId);
setLocationEnabledForUser(boolean enabled, int userId)123     void setLocationEnabledForUser(boolean enabled, int userId);
124 
isAdasGnssLocationEnabledForUser(int userId)125     boolean isAdasGnssLocationEnabledForUser(int userId);
setAdasGnssLocationEnabledForUser(boolean enabled, int userId)126     void setAdasGnssLocationEnabledForUser(boolean enabled, int userId);
127 
isAutomotiveGnssSuspended()128     boolean isAutomotiveGnssSuspended();
setAutomotiveGnssSuspended(boolean suspended)129     void setAutomotiveGnssSuspended(boolean suspended);
130 
addTestProvider(String name, in ProviderProperties properties, in List<String> locationTags, String packageName, @nullable String attributionTag)131     void addTestProvider(String name, in ProviderProperties properties,
132         in List<String> locationTags, String packageName, @nullable String attributionTag);
removeTestProvider(String provider, String packageName, @nullable String attributionTag)133     void removeTestProvider(String provider, String packageName, @nullable String attributionTag);
setTestProviderLocation(String provider, in Location location, String packageName, @nullable String attributionTag)134     void setTestProviderLocation(String provider, in Location location, String packageName, @nullable String attributionTag);
setTestProviderEnabled(String provider, boolean enabled, String packageName, @nullable String attributionTag)135     void setTestProviderEnabled(String provider, boolean enabled, String packageName, @nullable String attributionTag);
136 
getGnssTimeMillis()137     LocationTime getGnssTimeMillis();
138 
sendExtraCommand(String provider, String command, inout Bundle extras)139     void sendExtraCommand(String provider, String command, inout Bundle extras);
140 
141     // used by gts tests to verify whitelists
getBackgroundThrottlingWhitelist()142     String[] getBackgroundThrottlingWhitelist();
getIgnoreSettingsAllowlist()143     PackageTagsList getIgnoreSettingsAllowlist();
getAdasAllowlist()144     PackageTagsList getAdasAllowlist();
145 }
146