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