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 { 42 void requestLocationUpdates(in LocationRequest request, in ILocationListener listener, 43 in PendingIntent intent, String packageName); 44 void removeUpdates(in ILocationListener listener, in PendingIntent intent, String packageName); 45 46 void requestGeofence(in LocationRequest request, in Geofence geofence, 47 in PendingIntent intent, String packageName); 48 void removeGeofence(in Geofence fence, in PendingIntent intent, String packageName); 49 50 Location getLastLocation(in LocationRequest request, String packageName); 51 52 boolean registerGnssStatusCallback(IGnssStatusListener callback, String packageName); 53 void unregisterGnssStatusCallback(IGnssStatusListener callback); 54 55 boolean geocoderIsPresent(); 56 String getFromLocation(double latitude, double longitude, int maxResults, 57 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 63 boolean sendNiResponse(int notifId, int userResponse); 64 65 boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener, in String packageName); 66 void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener); 67 68 boolean addGnssNavigationMessageListener( 69 in IGnssNavigationMessageListener listener, 70 in String packageName); 71 void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener); 72 73 int getGnssYearOfHardware(); 74 75 int getGnssBatchSize(String packageName); 76 boolean addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName); 77 void removeGnssBatchingCallback(); 78 boolean startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName); 79 void flushGnssBatch(String packageName); 80 boolean stopGnssBatch(); 81 82 // --- deprecated --- 83 List<String> getAllProviders(); 84 List<String> getProviders(in Criteria criteria, boolean enabledOnly); 85 String getBestProvider(in Criteria criteria, boolean enabledOnly); 86 boolean providerMeetsCriteria(String provider, in Criteria criteria); 87 ProviderProperties getProviderProperties(String provider); 88 String getNetworkProviderPackage(); 89 boolean isProviderEnabled(String provider); 90 91 void addTestProvider(String name, in ProviderProperties properties, String opPackageName); 92 void removeTestProvider(String provider, String opPackageName); 93 void setTestProviderLocation(String provider, in Location loc, String opPackageName); 94 void clearTestProviderLocation(String provider, String opPackageName); 95 void setTestProviderEnabled(String provider, boolean enabled, String opPackageName); 96 void clearTestProviderEnabled(String provider, String opPackageName); 97 void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime, 98 String opPackageName); 99 void clearTestProviderStatus(String provider, String opPackageName); 100 101 boolean sendExtraCommand(String provider, String command, inout Bundle extras); 102 103 // --- internal --- 104 105 // Used by location providers to tell the location manager when it has a new location. 106 // Passive is true if the location is coming from the passive provider, in which case 107 // it need not be shared with other providers. 108 void reportLocation(in Location location, boolean passive); 109 110 // Used when a (initially Gnss) Location batch arrives 111 void reportLocationBatch(in List<Location> locations); 112 113 // for reporting callback completion 114 void locationCallbackFinished(ILocationListener listener); 115 116 // used by gts tests to verify throttling whitelist 117 String[] getBackgroundThrottlingWhitelist(); 118 } 119