Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d395959 authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Various small fixes"

parents bd55d677 c25f4f1d
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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);

+3 −4
Original line number Diff line number Diff line
@@ -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();
        }
+8 −3
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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");
        }
+9 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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);
            }
@@ -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