diff options
author | Soonil Nagarkar <sooniln@google.com> | 2020-01-29 15:23:06 -0800 |
---|---|---|
committer | Soonil Nagarkar <sooniln@google.com> | 2020-01-29 15:23:06 -0800 |
commit | b6375a4f7ffb46d0e8b5a908b35bbf28e9b60908 (patch) | |
tree | ea3684ebc7df68a681153ddd49aad94c184559b4 /location/java | |
parent | 24e6e408b03d8103812a7dec57e28df9224f8f9c (diff) |
Create AppForegroundHelper
Create a new helper to deal with application foreground state changes.
1) Rename various Helpers.
2) Move GnssManagerService into location dir.
3) Use new AppForegroundHelper everywhere.
4) Move sendNiRequest to internal API
5) Some refactoring of NetInitiatedActivity
Test: atest AppForegroundHelperTest
Change-Id: Ifffe0e6a34452a18d017c6b190547b904d77b430
Diffstat (limited to 'location/java')
-rw-r--r-- | location/java/android/location/ILocationManager.aidl | 2 | ||||
-rw-r--r-- | location/java/android/location/LocationManager.java | 15 | ||||
-rw-r--r-- | location/java/android/location/LocationManagerInternal.java | 15 |
3 files changed, 15 insertions, 17 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index 79bec920c10e..6a5c0ec9457a 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -69,8 +69,6 @@ interface ILocationManager double upperRightLatitude, double upperRightLongitude, int maxResults, in GeocoderParams params, out List<Address> addrs); - boolean sendNiResponse(int notifId, int userResponse); - boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener, String packageName, String featureId, String listenerIdentifier); void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections, diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 0c5fe787bbbc..197787e5b6e6 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -2397,21 +2397,6 @@ public class LocationManager { } } - /** - * Used by NetInitiatedActivity to report user response - * for network initiated GPS fix requests. - * - * @hide - */ - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) - public boolean sendNiResponse(int notifId, int userResponse) { - try { - return mService.sendNiResponse(notifId, userResponse); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - private void checkPendingIntent(PendingIntent pendingIntent) { Preconditions.checkArgument(pendingIntent != null, "invalid null pending intent"); if (!pendingIntent.isTargetedToPackage()) { diff --git a/location/java/android/location/LocationManagerInternal.java b/location/java/android/location/LocationManagerInternal.java index 44d9d2372665..69162bab3167 100644 --- a/location/java/android/location/LocationManagerInternal.java +++ b/location/java/android/location/LocationManagerInternal.java @@ -41,4 +41,19 @@ public abstract class LocationManagerInternal { * @throws IllegalArgumentException if provider is null */ public abstract void requestSetProviderAllowed(@NonNull String provider, boolean allowed); + + /** + * Returns true if the given package belongs to a location provider, and so should be afforded + * some special privileges. + * + * @param packageName The package name to check + * @return True is the given package belongs to a location provider, false otherwise + */ + public abstract boolean isProviderPackage(@NonNull String packageName); + + /** + * Should only be used by GNSS code. + */ + // TODO: there is no reason for this to exist as part of any API. move all the logic into gnss + public abstract void sendNiResponse(int notifId, int userResponse); } |