Providing GNSS Model Name & Year

GNSS Model Year moves from a TestApi to public
GNSS Model Name is connected from a new .hal to public

Bug: 38003769
Test: Builds, works with CTS & Test App on Pixel 2
Change-Id: I3e0a56c60e1a4d298e120df11ffd37b06ecea050
This commit is contained in:
Wyatt Riley
2017-12-05 09:31:52 -08:00
parent 41b745ca0d
commit d87cf91762
7 changed files with 94 additions and 33 deletions

View File

@@ -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.