Merge "Add separate hasCapabilityName() methods in GnssCapabilities" into qt-dev
This commit is contained in:
@@ -3079,16 +3079,15 @@ package android.location {
|
||||
}
|
||||
|
||||
public final class GnssCapabilities {
|
||||
method public boolean hasCapability(int);
|
||||
field public static final int GEOFENCING = 2; // 0x2
|
||||
field public static final int LOW_POWER_MODE = 0; // 0x0
|
||||
field public static final int MEASUREMENTS = 3; // 0x3
|
||||
field public static final int MEASUREMENT_CORRECTIONS = 5; // 0x5
|
||||
field public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7; // 0x7
|
||||
field public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6; // 0x6
|
||||
field public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8; // 0x8
|
||||
field public static final int NAV_MESSAGES = 4; // 0x4
|
||||
field public static final int SATELLITE_BLACKLIST = 1; // 0x1
|
||||
method public boolean hasGeofencing();
|
||||
method public boolean hasLowPowerMode();
|
||||
method public boolean hasMeasurementCorrections();
|
||||
method public boolean hasMeasurementCorrectionsExcessPathLength();
|
||||
method public boolean hasMeasurementCorrectionsLosSats();
|
||||
method public boolean hasMeasurementCorrectionsReflectingPane();
|
||||
method public boolean hasMeasurements();
|
||||
method public boolean hasNavMessages();
|
||||
method public boolean hasSatelliteBlacklist();
|
||||
}
|
||||
|
||||
public final class GnssMeasurementCorrections implements android.os.Parcelable {
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
|
||||
package android.location;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* A container of supported GNSS chipset capabilities.
|
||||
*
|
||||
@@ -29,53 +25,61 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
@SystemApi
|
||||
public final class GnssCapabilities {
|
||||
/** The GNSS chipset supports low power mode. */
|
||||
public static final int LOW_POWER_MODE = 0;
|
||||
|
||||
/** The GNSS chipset supports blacklisting satellites. */
|
||||
public static final int SATELLITE_BLACKLIST = 1;
|
||||
|
||||
/** The GNSS chipset supports geofencing. */
|
||||
public static final int GEOFENCING = 2;
|
||||
|
||||
/** The GNSS chipset supports measurements.*/
|
||||
public static final int MEASUREMENTS = 3;
|
||||
|
||||
/** The GNSS chipset supports navigation messages. */
|
||||
public static final int NAV_MESSAGES = 4;
|
||||
|
||||
/** The GNSS chipset supports measurement corrections. */
|
||||
public static final int MEASUREMENT_CORRECTIONS = 5;
|
||||
|
||||
/** The GNSS chipset supports line-of-sight satellite identification measurement corrections. */
|
||||
public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6;
|
||||
|
||||
/** The GNSS chipset supports per satellite excess-path-length measurement corrections. */
|
||||
public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7;
|
||||
|
||||
/** The GNSS chipset supports reflecting planes measurement corrections. */
|
||||
public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8;
|
||||
|
||||
private static final int MIN_CAPABILITY = 0;
|
||||
private static final int MAX_CAPABILITY = MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
|
||||
/**
|
||||
* GNSS capability.
|
||||
* Bit mask indicating GNSS chipset supports low power mode.
|
||||
* @hide
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
LOW_POWER_MODE,
|
||||
SATELLITE_BLACKLIST,
|
||||
GEOFENCING,
|
||||
MEASUREMENTS,
|
||||
NAV_MESSAGES,
|
||||
MEASUREMENT_CORRECTIONS,
|
||||
MEASUREMENT_CORRECTIONS_LOS_SATS,
|
||||
MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH,
|
||||
MEASUREMENT_CORRECTIONS_REFLECTING_PLANE
|
||||
})
|
||||
public @interface Capability {}
|
||||
public static final long LOW_POWER_MODE = 1L << 0;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports blacklisting satellites.
|
||||
* @hide
|
||||
*/
|
||||
public static final long SATELLITE_BLACKLIST = 1L << 1;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports geofencing.
|
||||
* @hide
|
||||
*/
|
||||
public static final long GEOFENCING = 1L << 2;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports measurements.
|
||||
* @hide
|
||||
*/
|
||||
public static final long MEASUREMENTS = 1L << 3;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports navigation messages.
|
||||
* @hide
|
||||
*/
|
||||
public static final long NAV_MESSAGES = 1L << 4;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports measurement corrections.
|
||||
* @hide
|
||||
*/
|
||||
public static final long MEASUREMENT_CORRECTIONS = 1L << 5;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports line-of-sight satellite identification
|
||||
* measurement corrections.
|
||||
* @hide
|
||||
*/
|
||||
public static final long MEASUREMENT_CORRECTIONS_LOS_SATS = 1L << 6;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports per satellite excess-path-length
|
||||
* measurement corrections.
|
||||
* @hide
|
||||
*/
|
||||
public static final long MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 1L << 7;
|
||||
|
||||
/**
|
||||
* Bit mask indicating GNSS chipset supports reflecting planes measurement corrections.
|
||||
* @hide
|
||||
*/
|
||||
public static final long MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 1L << 8;
|
||||
|
||||
/** @hide */
|
||||
public static final long INVALID_CAPABILITIES = -1;
|
||||
@@ -93,60 +97,94 @@ public final class GnssCapabilities {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the {@code capability} is supported by the GNSS implementation.
|
||||
* Returns {@code true} if GNSS chipset supports low power mode, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasCapability(@Capability int capability) {
|
||||
return isValidCapability(capability) && (mGnssCapabilities & (1 << capability)) != 0;
|
||||
public boolean hasLowPowerMode() {
|
||||
return hasCapability(LOW_POWER_MODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports blacklisting satellites, {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean hasSatelliteBlacklist() {
|
||||
return hasCapability(SATELLITE_BLACKLIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports geofencing, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasGeofencing() {
|
||||
return hasCapability(GEOFENCING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports measurements, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasMeasurements() {
|
||||
return hasCapability(MEASUREMENTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports navigation messages, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasNavMessages() {
|
||||
return hasCapability(NAV_MESSAGES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports measurement corrections, {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean hasMeasurementCorrections() {
|
||||
return hasCapability(MEASUREMENT_CORRECTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports line-of-sight satellite identification
|
||||
* measurement corrections, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasMeasurementCorrectionsLosSats() {
|
||||
return hasCapability(MEASUREMENT_CORRECTIONS_LOS_SATS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports per satellite excess-path-length measurement
|
||||
* corrections, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasMeasurementCorrectionsExcessPathLength() {
|
||||
return hasCapability(MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports reflecting planes measurement corrections,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasMeasurementCorrectionsReflectingPane() {
|
||||
return hasCapability(MEASUREMENT_CORRECTIONS_REFLECTING_PLANE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("GnssCapabilities: (");
|
||||
int capability = 0;
|
||||
boolean addSeparator = false;
|
||||
long gnssCapabilities = mGnssCapabilities;
|
||||
while (gnssCapabilities != 0) {
|
||||
if ((gnssCapabilities & 1) != 0) {
|
||||
if (addSeparator) {
|
||||
sb.append(' ');
|
||||
} else {
|
||||
addSeparator = true;
|
||||
}
|
||||
sb.append(toStringCapability(capability));
|
||||
}
|
||||
gnssCapabilities >>= 1;
|
||||
++capability;
|
||||
StringBuilder sb = new StringBuilder("GnssCapabilities: ( ");
|
||||
if (hasLowPowerMode()) sb.append("LOW_POWER_MODE ");
|
||||
if (hasSatelliteBlacklist()) sb.append("SATELLITE_BLACKLIST ");
|
||||
if (hasGeofencing()) sb.append("GEOFENCING ");
|
||||
if (hasMeasurements()) sb.append("MEASUREMENTS ");
|
||||
if (hasNavMessages()) sb.append("NAV_MESSAGES ");
|
||||
if (hasMeasurementCorrections()) sb.append("MEASUREMENT_CORRECTIONS ");
|
||||
if (hasMeasurementCorrectionsLosSats()) sb.append("MEASUREMENT_CORRECTIONS_LOS_SATS ");
|
||||
if (hasMeasurementCorrectionsExcessPathLength()) {
|
||||
sb.append("MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH ");
|
||||
}
|
||||
if (hasMeasurementCorrectionsReflectingPane()) {
|
||||
sb.append("MEASUREMENT_CORRECTIONS_REFLECTING_PLANE ");
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private boolean isValidCapability(@Capability int capability) {
|
||||
return capability >= MIN_CAPABILITY && capability <= MAX_CAPABILITY;
|
||||
}
|
||||
|
||||
private static String toStringCapability(@Capability int capability) {
|
||||
switch (capability) {
|
||||
case LOW_POWER_MODE:
|
||||
return "LOW_POWER_MODE";
|
||||
case SATELLITE_BLACKLIST:
|
||||
return "SATELLITE_BLACKLIST";
|
||||
case GEOFENCING:
|
||||
return "GEOFENCING";
|
||||
case MEASUREMENTS:
|
||||
return "MEASUREMENTS";
|
||||
case NAV_MESSAGES:
|
||||
return "NAV_MESSAGES";
|
||||
case MEASUREMENT_CORRECTIONS:
|
||||
return "MEASUREMENT_CORRECTIONS";
|
||||
case MEASUREMENT_CORRECTIONS_LOS_SATS:
|
||||
return "MEASUREMENT_CORRECTIONS_LOS_SATS";
|
||||
case MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH:
|
||||
return "MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH";
|
||||
case MEASUREMENT_CORRECTIONS_REFLECTING_PLANE:
|
||||
return "MEASUREMENT_CORRECTIONS_REFLECTING_PLANE";
|
||||
default:
|
||||
return "Unknown(" + capability + ")";
|
||||
}
|
||||
private boolean hasCapability(long capability) {
|
||||
return (mGnssCapabilities & capability) == capability;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,33 +28,16 @@ public class GnssCapabilitiesProvider {
|
||||
private static final String TAG = "GnssCapabilitiesProvider";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
// Bit masks for capabilities in {@link android.location.GnssCapabilities}.
|
||||
private static final long GNSS_CAPABILITY_LOW_POWER_MODE =
|
||||
1L << GnssCapabilities.LOW_POWER_MODE;
|
||||
private static final long GNSS_CAPABILITY_SATELLITE_BLACKLIST =
|
||||
1L << GnssCapabilities.SATELLITE_BLACKLIST;
|
||||
private static final long GNSS_CAPABILITY_GEOFENCING = 1L << GnssCapabilities.GEOFENCING;
|
||||
private static final long GNSS_CAPABILITY_MEASUREMENTS = 1L << GnssCapabilities.MEASUREMENTS;
|
||||
private static final long GNSS_CAPABILITY_NAV_MESSAGES = 1L << GnssCapabilities.NAV_MESSAGES;
|
||||
private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS =
|
||||
1L << GnssCapabilities.MEASUREMENT_CORRECTIONS;
|
||||
private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS =
|
||||
1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS;
|
||||
private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH =
|
||||
1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
|
||||
private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE =
|
||||
1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
|
||||
private static final long GNSS_CAPABILITIES_TOP_HAL =
|
||||
GNSS_CAPABILITY_LOW_POWER_MODE | GNSS_CAPABILITY_SATELLITE_BLACKLIST
|
||||
| GNSS_CAPABILITY_GEOFENCING | GNSS_CAPABILITY_MEASUREMENTS
|
||||
| GNSS_CAPABILITY_NAV_MESSAGES;
|
||||
GnssCapabilities.LOW_POWER_MODE | GnssCapabilities.SATELLITE_BLACKLIST
|
||||
| GnssCapabilities.GEOFENCING | GnssCapabilities.MEASUREMENTS
|
||||
| GnssCapabilities.NAV_MESSAGES;
|
||||
|
||||
private static final long GNSS_CAPABILITIES_SUB_HAL_MEASUREMENT_CORRECTIONS =
|
||||
GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS
|
||||
| GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS
|
||||
| GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH
|
||||
| GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
GnssCapabilities.MEASUREMENT_CORRECTIONS
|
||||
| GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS
|
||||
| GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH
|
||||
| GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
|
||||
// Capabilities in {@link android.location.GnssCapabilities} supported by GNSS chipset.
|
||||
@GuardedBy("this")
|
||||
@@ -79,20 +62,20 @@ public class GnssCapabilitiesProvider {
|
||||
long gnssCapabilities = 0;
|
||||
if (hasCapability(topHalCapabilities,
|
||||
GnssLocationProvider.GPS_CAPABILITY_LOW_POWER_MODE)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_LOW_POWER_MODE;
|
||||
gnssCapabilities |= GnssCapabilities.LOW_POWER_MODE;
|
||||
}
|
||||
if (hasCapability(topHalCapabilities,
|
||||
GnssLocationProvider.GPS_CAPABILITY_SATELLITE_BLACKLIST)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_SATELLITE_BLACKLIST;
|
||||
gnssCapabilities |= GnssCapabilities.SATELLITE_BLACKLIST;
|
||||
}
|
||||
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_GEOFENCING)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_GEOFENCING;
|
||||
gnssCapabilities |= GnssCapabilities.GEOFENCING;
|
||||
}
|
||||
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_MEASUREMENTS)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENTS;
|
||||
gnssCapabilities |= GnssCapabilities.MEASUREMENTS;
|
||||
}
|
||||
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_NAV_MESSAGES)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_NAV_MESSAGES;
|
||||
gnssCapabilities |= GnssCapabilities.NAV_MESSAGES;
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
@@ -110,18 +93,18 @@ public class GnssCapabilitiesProvider {
|
||||
* {@link android.location.GnssCapabilities}.
|
||||
*/
|
||||
void setSubHalMeasurementCorrectionsCapabilities(int measurementCorrectionsCapabilities) {
|
||||
long gnssCapabilities = GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS;
|
||||
long gnssCapabilities = GnssCapabilities.MEASUREMENT_CORRECTIONS;
|
||||
if (hasCapability(measurementCorrectionsCapabilities,
|
||||
GnssMeasurementCorrectionsProvider.CAPABILITY_LOS_SATS)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS;
|
||||
gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS;
|
||||
}
|
||||
if (hasCapability(measurementCorrectionsCapabilities,
|
||||
GnssMeasurementCorrectionsProvider.CAPABILITY_EXCESS_PATH_LENGTH)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
|
||||
gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
|
||||
}
|
||||
if (hasCapability(measurementCorrectionsCapabilities,
|
||||
GnssMeasurementCorrectionsProvider.CAPABILITY_REFLECTING_PLANE)) {
|
||||
gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
|
||||
@@ -2215,7 +2215,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
s.append("MEASUREMENT_CORRECTIONS ");
|
||||
}
|
||||
s.append(")\n");
|
||||
if (mGnssMeasurementCorrectionsProvider.isAvailableInPlatform()) {
|
||||
if (hasCapability(GPS_CAPABILITY_MEASUREMENT_CORRECTIONS)) {
|
||||
s.append(" SubHal=MEASUREMENT_CORRECTIONS[");
|
||||
s.append(mGnssMeasurementCorrectionsProvider.toStringCapabilities());
|
||||
s.append("]\n");
|
||||
|
||||
Reference in New Issue
Block a user