Loading location/java/android/location/ILocationManager.aidl +3 −4 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading location/java/android/location/LocationManager.java +3 −4 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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(); } Loading Loading @@ -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(); } Loading location/java/android/location/util/identity/CallerIdentity.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)) { Loading @@ -180,6 +181,9 @@ public final class CallerIdentity { } builder.append("]"); } if (mListenerId != null) { builder.append("/").append(HexDump.toHexString(mListenerId.hashCode())); } return builder.toString(); } Loading @@ -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 Loading location/java/com/android/internal/location/ProviderRequest.java +3 −0 Original line number Diff line number Diff line Loading @@ -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"); } Loading services/core/java/com/android/server/location/AbstractLocationProvider.java +9 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.location.ProviderRequest; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; Loading Loading @@ -308,7 +309,8 @@ public abstract class AbstractLocationProvider { if (listener != null) { long identity = Binder.clearCallingIdentity(); try { listener.onReportLocation(location); // copy location so if provider makes further changes they do not propagate listener.onReportLocation(new Location(location)); } finally { Binder.restoreCallingIdentity(identity); } Loading @@ -323,7 +325,12 @@ public abstract class AbstractLocationProvider { if (listener != null) { long identity = Binder.clearCallingIdentity(); try { listener.onReportLocation(locations); // copy location so if provider makes further changes they do not propagate ArrayList<Location> copy = new ArrayList<>(locations.size()); for (Location location : locations) { copy.add(new Location(location)); } listener.onReportLocation(copy); } finally { Binder.restoreCallingIdentity(identity); } Loading Loading
location/java/android/location/ILocationManager.aidl +3 −4 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading
location/java/android/location/LocationManager.java +3 −4 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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(); } Loading Loading @@ -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(); } Loading
location/java/android/location/util/identity/CallerIdentity.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)) { Loading @@ -180,6 +181,9 @@ public final class CallerIdentity { } builder.append("]"); } if (mListenerId != null) { builder.append("/").append(HexDump.toHexString(mListenerId.hashCode())); } return builder.toString(); } Loading @@ -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 Loading
location/java/com/android/internal/location/ProviderRequest.java +3 −0 Original line number Diff line number Diff line Loading @@ -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"); } Loading
services/core/java/com/android/server/location/AbstractLocationProvider.java +9 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.location.ProviderRequest; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; Loading Loading @@ -308,7 +309,8 @@ public abstract class AbstractLocationProvider { if (listener != null) { long identity = Binder.clearCallingIdentity(); try { listener.onReportLocation(location); // copy location so if provider makes further changes they do not propagate listener.onReportLocation(new Location(location)); } finally { Binder.restoreCallingIdentity(identity); } Loading @@ -323,7 +325,12 @@ public abstract class AbstractLocationProvider { if (listener != null) { long identity = Binder.clearCallingIdentity(); try { listener.onReportLocation(locations); // copy location so if provider makes further changes they do not propagate ArrayList<Location> copy = new ArrayList<>(locations.size()); for (Location location : locations) { copy.add(new Location(location)); } listener.onReportLocation(copy); } finally { Binder.restoreCallingIdentity(identity); } Loading