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

Commit 8134c904 authored by Wyatt Riley's avatar Wyatt Riley Committed by Android (Google) Code Review
Browse files

Merge "Providing GNSS Model Name & Year"

parents 5c74af94 d87cf917
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21360,6 +21360,8 @@ package android.location {
    method public void clearTestProviderStatus(java.lang.String);
    method public java.util.List<java.lang.String> getAllProviders();
    method public java.lang.String getBestProvider(android.location.Criteria, boolean);
    method public java.lang.String getGnssHardwareModelName();
    method public int getGnssYearOfHardware();
    method public deprecated android.location.GpsStatus getGpsStatus(android.location.GpsStatus);
    method public android.location.Location getLastKnownLocation(java.lang.String);
    method public android.location.LocationProvider getProvider(java.lang.String);
@@ -21395,6 +21397,7 @@ package android.location {
    method public void unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
    method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
    method public void unregisterGnssStatusCallback(android.location.GnssStatus.Callback);
    field public static final java.lang.String GNSS_HARDWARE_MODEL_NAME_UNKNOWN = "Model Name Unknown";
    field public static final java.lang.String GPS_PROVIDER = "gps";
    field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
    field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
+0 −4
Original line number Diff line number Diff line
@@ -318,10 +318,6 @@ package android.location {
    method public void setType(int);
  }

  public class LocationManager {
    method public int getGnssYearOfHardware();
  }

}

package android.net {
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ interface ILocationManager
    void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);

    int getGnssYearOfHardware();
    String getGnssHardwareModelName();

    int getGnssBatchSize(String packageName);
    boolean addGnssBatchingCallback(in IBatchedLocationCallback callback, String packageName);
+26 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.location;
import com.android.internal.location.ProviderProperties;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
@@ -225,6 +226,12 @@ public class LocationManager {
    public static final String HIGH_POWER_REQUEST_CHANGE_ACTION =
        "android.location.HIGH_POWER_REQUEST_CHANGE";

    /**
     * The value returned by {@link LocationManager#getGnssHardwareModelName()} when the hardware
     * does not support providing the actual value.
     */
    public static final String GNSS_HARDWARE_MODEL_NAME_UNKNOWN = "Model Name Unknown";

    // Map from LocationListeners to their associated ListenerTransport objects
    private HashMap<LocationListener,ListenerTransport> mListeners =
        new HashMap<LocationListener,ListenerTransport>();
@@ -1969,11 +1976,10 @@ public class LocationManager {
    }

    /**
     * Returns the system information of the GPS hardware.
     * May return 0 if GPS hardware is earlier than 2016.
     * @hide
     * Returns the model year of the GNSS hardware and software build.
     *
     * May return 0 if the model year is less than 2016.
     */
    @TestApi
    public int getGnssYearOfHardware() {
        try {
            return mService.getGnssYearOfHardware();
@@ -1982,6 +1988,22 @@ public class LocationManager {
        }
    }

    /**
     * Returns the Model Name (including Vendor and Hardware/Software Version) of the GNSS hardware
     * driver.
     *
     * Will return {@link LocationManager#GNSS_HARDWARE_MODEL_NAME_UNKNOWN} when the GNSS hardware
     * abstraction layer does not support providing this value.
     */
    @NonNull
    public String getGnssHardwareModelName() {
        try {
            return mService.getGnssHardwareModelName();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Returns the batch size (in number of Location objects) that are supported by the batching
     * interface.
+14 −1
Original line number Diff line number Diff line
@@ -1144,7 +1144,7 @@ public class LocationManagerService extends ILocationManager.Stub {
    }

    /**
     * Returns the system information of the GNSS hardware.
     * Returns the year of the GNSS hardware.
     */
    @Override
    public int getGnssYearOfHardware() {
@@ -1155,6 +1155,19 @@ public class LocationManagerService extends ILocationManager.Stub {
        }
    }


    /**
     * Returns the model name of the GNSS hardware.
     */
    @Override
    public String getGnssHardwareModelName() {
        if (mGnssSystemInfoProvider != null) {
            return mGnssSystemInfoProvider.getGnssHardwareModelName();
        } else {
            return LocationManager.GNSS_HARDWARE_MODEL_NAME_UNKNOWN;
        }
    }

    /**
     * Runs some checks for GNSS (FINE) level permissions, used by several methods which directly
     * (try to) access GNSS information at this layer.
Loading