From c25f4f1d0ee5e62cc69d02bcf8c96fc876cd436b Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Mon, 22 Jun 2020 13:55:45 -0700 Subject: Various small fixes Test: manual Change-Id: Id9874dd034aae96d540fac7c580c6689e25f44e8 --- location/java/android/location/ILocationManager.aidl | 7 +++---- location/java/android/location/LocationManager.java | 7 +++---- .../java/android/location/util/identity/CallerIdentity.java | 11 ++++++++--- .../java/com/android/internal/location/ProviderRequest.java | 3 +++ 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'location/java') diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index 6d848c912d95..1f7b69f8840e 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -76,6 +76,7 @@ interface ILocationManager void addGnssMeasurementsListener(in GnssRequest request, in IGnssMeasurementsListener listener, String packageName, String attributionTag); void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener); + void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections); void addGnssAntennaInfoListener(in IGnssAntennaInfoListener listener, String packageName, String attributionTag); void removeGnssAntennaInfoListener(in IGnssAntennaInfoListener listener); @@ -83,13 +84,11 @@ interface ILocationManager void addGnssNavigationMessageListener(in IGnssNavigationMessageListener listener, String packageName, String attributionTag); void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener); - void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections, String packageName); - - int getGnssBatchSize(String packageName); + int getGnssBatchSize(); void setGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName, String attributionTag); void removeGnssBatchingCallback(); void startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName, String attributionTag); - void flushGnssBatch(String packageName); + void flushGnssBatch(); void stopGnssBatch(); void injectLocation(in Location location); diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 2c6f0c91ee7d..401a5a137327 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -2157,8 +2157,7 @@ public class LocationManager { @NonNull GnssMeasurementCorrections measurementCorrections) { Preconditions.checkArgument(measurementCorrections != null); try { - mService.injectGnssMeasurementCorrections( - measurementCorrections, mContext.getPackageName()); + mService.injectGnssMeasurementCorrections(measurementCorrections); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -2302,7 +2301,7 @@ public class LocationManager { @RequiresPermission(Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize() { try { - return mService.getGnssBatchSize(mContext.getPackageName()); + return mService.getGnssBatchSize(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -2365,7 +2364,7 @@ public class LocationManager { @RequiresPermission(Manifest.permission.LOCATION_HARDWARE) public void flushGnssBatch() { try { - mService.flushGnssBatch(mContext.getPackageName()); + mService.flushGnssBatch(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/location/java/android/location/util/identity/CallerIdentity.java b/location/java/android/location/util/identity/CallerIdentity.java index 9876a1b4df19..c32970f1bb04 100644 --- a/location/java/android/location/util/identity/CallerIdentity.java +++ b/location/java/android/location/util/identity/CallerIdentity.java @@ -25,6 +25,7 @@ import android.os.WorkSource; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; +import com.android.internal.util.HexDump; import java.util.Objects; @@ -170,7 +171,7 @@ public final class CallerIdentity { } StringBuilder builder = new StringBuilder(length); - builder.append(mPid).append("/").append(mPackageName); + builder.append(mUid).append("/").append(mPackageName); if (mAttributionTag != null) { builder.append("["); if (mAttributionTag.startsWith(mPackageName)) { @@ -180,6 +181,9 @@ public final class CallerIdentity { } builder.append("]"); } + if (mListenerId != null) { + builder.append("/").append(HexDump.toHexString(mListenerId.hashCode())); + } return builder.toString(); } @@ -192,10 +196,11 @@ public final class CallerIdentity { return false; } CallerIdentity that = (CallerIdentity) o; - return getUid() == that.getUid() + return mUid == that.mUid && mPid == that.mPid && mPackageName.equals(that.mPackageName) - && Objects.equals(mAttributionTag, that.mAttributionTag); + && Objects.equals(mAttributionTag, that.mAttributionTag) + && Objects.equals(mListenerId, that.mListenerId); } @Override diff --git a/location/java/com/android/internal/location/ProviderRequest.java b/location/java/com/android/internal/location/ProviderRequest.java index a81ddfed8194..5d072f838055 100644 --- a/location/java/com/android/internal/location/ProviderRequest.java +++ b/location/java/com/android/internal/location/ProviderRequest.java @@ -126,6 +126,9 @@ public final class ProviderRequest implements Parcelable { if (locationSettingsIgnored) { s.append(", locationSettingsIgnored"); } + if (!workSource.isEmpty()) { + s.append(", ").append(workSource); + } } else { s.append("OFF"); } -- cgit v1.2.3-59-g8ed1b