diff options
author | Scott Lobdell <slobdell@google.com> | 2021-03-29 16:12:49 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2021-04-02 22:35:29 +0000 |
commit | 21cdef883cc867db55340b25d5c95e19b12ab383 (patch) | |
tree | 93d1444ebe783f53f5f0ae2647592723b27b3fb8 /location/java | |
parent | 7deab3736bb5f3a92be8ac820096926dce2366ad (diff) | |
parent | d1d45f856fdf68835f5b42eacecab44e6dfa8545 (diff) |
Merge SP1A.210329.001
Change-Id: I1e21c5890b5b2e2f2855f09960bc8eec8aa922bf
Diffstat (limited to 'location/java')
9 files changed, 85 insertions, 60 deletions
diff --git a/location/java/android/location/CorrelationVector.java b/location/java/android/location/CorrelationVector.java index 4b6e6882b50a..718977ff4296 100644 --- a/location/java/android/location/CorrelationVector.java +++ b/location/java/android/location/CorrelationVector.java @@ -77,6 +77,9 @@ public final class CorrelationVector implements Parcelable { * be encoded as signed 16 bit integer where 1 is represented by 32767 and -1 is represented * by -32768. * + * <p>The values are quantized using a 16bit integer to save on the data size since the array + * contains real data and it might grow. + * */ @NonNull public int[] getMagnitude() { diff --git a/location/java/android/location/GnssCapabilities.java b/location/java/android/location/GnssCapabilities.java index a5e28158ab78..fdf0f59c13dc 100644 --- a/location/java/android/location/GnssCapabilities.java +++ b/location/java/android/location/GnssCapabilities.java @@ -61,6 +61,8 @@ public final class GnssCapabilities implements Parcelable { public static final int TOP_HAL_CAPABILITY_CORRELATION_VECTOR = 4096; /** @hide */ public static final int TOP_HAL_CAPABILITY_SATELLITE_PVT = 8192; + /** @hide */ + public static final int TOP_HAL_CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384; /** @hide */ @IntDef(flag = true, prefix = {"TOP_HAL_CAPABILITY_"}, value = {TOP_HAL_CAPABILITY_SCHEDULING, @@ -69,7 +71,8 @@ public final class GnssCapabilities implements Parcelable { TOP_HAL_CAPABILITY_MEASUREMENTS, TOP_HAL_CAPABILITY_NAV_MESSAGES, TOP_HAL_CAPABILITY_LOW_POWER_MODE, TOP_HAL_CAPABILITY_SATELLITE_BLOCKLIST, TOP_HAL_CAPABILITY_MEASUREMENT_CORRECTIONS, TOP_HAL_CAPABILITY_ANTENNA_INFO, - TOP_HAL_CAPABILITY_CORRELATION_VECTOR, TOP_HAL_CAPABILITY_SATELLITE_PVT}) + TOP_HAL_CAPABILITY_CORRELATION_VECTOR, TOP_HAL_CAPABILITY_SATELLITE_PVT, + TOP_HAL_CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING}) @Retention(RetentionPolicy.SOURCE) public @interface TopHalCapabilityFlags {} @@ -351,6 +354,17 @@ public final class GnssCapabilities implements Parcelable { } /** + * Returns {@code true} if GNSS chipset will benefit from measurement corrections for driving + * use case if provided, {@code false} otherwise. + * + * @hide + */ + @SystemApi + public boolean hasMeasurementCorrectionsForDriving() { + return (mTopFlags & TOP_HAL_CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING) != 0; + } + + /** * Returns {@code true} if GNSS chipset supports line-of-sight satellite identification * measurement corrections, {@code false} otherwise. * @@ -550,6 +564,9 @@ public final class GnssCapabilities implements Parcelable { if (hasMeasurementCorrelationVectors()) { builder.append("MEASUREMENT_CORRELATION_VECTORS "); } + if (hasMeasurementCorrectionsForDriving()) { + builder.append("MEASUREMENT_CORRECTIONS_FOR_DRIVING "); + } if (hasMeasurementCorrectionsLosSats()) { builder.append("LOS_SATS "); } @@ -748,6 +765,18 @@ public final class GnssCapabilities implements Parcelable { } /** + * Sets measurement corrections for driving capability. + * + * @hide + */ + @SystemApi + public @NonNull Builder setHasMeasurementCorrectionsForDriving(boolean capable) { + mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING, + capable); + return this; + } + + /** * Sets measurement corrections line-of-sight satellites capabilitity. * * @hide diff --git a/location/java/android/location/GnssNavigationMessage.java b/location/java/android/location/GnssNavigationMessage.java index 84a363d25c63..dbf26214066e 100644 --- a/location/java/android/location/GnssNavigationMessage.java +++ b/location/java/android/location/GnssNavigationMessage.java @@ -363,10 +363,10 @@ public final class GnssNavigationMessage implements Parcelable { * <p>The bytes (or words) specified using big endian format (MSB first). * * <ul> - * <li>For GPS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit words. Each - * word (30 bits) should be fit into the last 30 bits in a 4-byte word (skip B31 and B32), with - * MSB first, for a total of 40 bytes, covering a time period of 6, 6, and 0.6 seconds, - * respectively.</li> + * <li>For GPS L1 C/A, IRNSS L5 C/A, Beidou D1 & Beidou D2, each subframe contains 10 + * 30-bit words. Each word (30 bits) should be fit into the last 30 bits in a 4-byte word (skip + * B31 and B32), with MSB first, for a total of 40 bytes, covering a time period of 6, 6, and + * 0.6 seconds, respectively.</li> * <li>For Glonass L1 C/A, each string contains 85 data bits, including the checksum. These * bits should be fit into 11 bytes, with MSB first (skip B86-B88), covering a time period of 2 * seconds.</li> diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java index 5e2e5595ba9c..5f8d795cd654 100644 --- a/location/java/android/location/Location.java +++ b/location/java/android/location/Location.java @@ -1246,20 +1246,42 @@ public class Location implements Parcelable { * Returns true if the Location came from a mock provider. * * @return true if this Location came from a mock provider, false otherwise + * @deprecated Prefer {@link #isMock()} instead. */ + @Deprecated public boolean isFromMockProvider() { - return (mFieldsMask & HAS_MOCK_PROVIDER_MASK) != 0; + return isMock(); } /** * Flag this Location as having come from a mock provider or not. * * @param isFromMockProvider true if this Location came from a mock provider, false otherwise + * @deprecated Prefer {@link #setMock(boolean)} instead. * @hide */ + @Deprecated @SystemApi public void setIsFromMockProvider(boolean isFromMockProvider) { - if (isFromMockProvider) { + setMock(isFromMockProvider); + } + + /** + * Returns true if this location is marked as a mock location. If this location comes from the + * Android framework, this indicates that the location was provided by a test location provider, + * and thus may not be related to the actual location of the device. + * + * @see LocationManager#addTestProvider + */ + public boolean isMock() { + return (mFieldsMask & HAS_MOCK_PROVIDER_MASK) != 0; + } + + /** + * Sets whether this location is marked as a mock location. + */ + public void setMock(boolean mock) { + if (mock) { mFieldsMask |= HAS_MOCK_PROVIDER_MASK; } else { mFieldsMask &= ~HAS_MOCK_PROVIDER_MASK; diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index d5b7ba4dcf73..137d417d57c8 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -346,43 +346,6 @@ public class LocationManager { */ public static final String EXTRA_GNSS_CAPABILITIES = "android.location.extra.GNSS_CAPABILITIES"; - /** - * Broadcast intent action for Settings app to inject a footer at the bottom of location - * settings. This is for use only by apps that are included in the system image. - * - * <p>To inject a footer to location settings, you must declare a broadcast receiver for - * this action in the manifest: - * <pre> - * <receiver android:name="com.example.android.footer.MyFooterInjector"> - * <intent-filter> - * <action android:name="com.android.settings.location.INJECT_FOOTER" /> - * </intent-filter> - * <meta-data - * android:name="com.android.settings.location.FOOTER_STRING" - * android:resource="@string/my_injected_footer_string" /> - * </receiver> - * </pre> - * - * <p>This broadcast receiver will never actually be invoked. See also - * {#METADATA_SETTINGS_FOOTER_STRING}. - * - * @hide - */ - public static final String SETTINGS_FOOTER_DISPLAYED_ACTION = - "com.android.settings.location.DISPLAYED_FOOTER"; - - /** - * Metadata name for {@link LocationManager#SETTINGS_FOOTER_DISPLAYED_ACTION} broadcast - * receivers to specify a string resource id as location settings footer text. This is for use - * only by apps that are included in the system image. - * - * <p>See {@link #SETTINGS_FOOTER_DISPLAYED_ACTION} for more detail on how to use. - * - * @hide - */ - public static final String METADATA_SETTINGS_FOOTER_STRING = - "com.android.settings.location.FOOTER_STRING"; - private static final long MAX_SINGLE_LOCATION_TIMEOUT_MS = 30 * 1000; private static final String CACHE_KEY_LOCATION_ENABLED_PROPERTY = diff --git a/location/java/android/location/SatellitePvt.java b/location/java/android/location/SatellitePvt.java index 144fa1341bd6..27c7eda1dae3 100644 --- a/location/java/android/location/SatellitePvt.java +++ b/location/java/android/location/SatellitePvt.java @@ -25,8 +25,9 @@ import android.os.Parcelable; /** * A class that contains GNSS satellite position, velocity and time information at the - * signal transmission time {@link GnssMeasurement#getReceivedSvTimeNanos()}. + * same signal transmission time {@link GnssMeasurement#getReceivedSvTimeNanos()}. * + * <p>The position and velocity must be in ECEF coordinates. * @hide */ @SystemApi @@ -39,6 +40,9 @@ public final class SatellitePvt implements Parcelable { /** * Class containing estimates of the satellite position fields in ECEF coordinate frame. + * + * <p>The satellite position must be defined at the time of transmission of the signal + * receivedSvTimeNs. */ public static final class PositionEcef implements Parcelable { private final double mXMeters; @@ -133,6 +137,9 @@ public final class SatellitePvt implements Parcelable { /** * Class containing estimates of the satellite velocity fields in the ECEF coordinate frame. + * + * <p>The satellite velocity must be defined at the time of transmission of the signal + * receivedSvTimeNs. */ public static final class VelocityEcef implements Parcelable { private final double mXMetersPerSecond; diff --git a/location/java/android/location/provider/ILocationProviderManager.aidl b/location/java/android/location/provider/ILocationProviderManager.aidl index 50ed046f09cd..092ec67ff146 100644 --- a/location/java/android/location/provider/ILocationProviderManager.aidl +++ b/location/java/android/location/provider/ILocationProviderManager.aidl @@ -24,7 +24,7 @@ import android.location.provider.ProviderProperties; * @hide */ interface ILocationProviderManager { - void onInitialize(boolean allowed, in ProviderProperties properties, @nullable String packageName, @nullable String attributionTag); + void onInitialize(boolean allowed, in ProviderProperties properties, @nullable String attributionTag); void onSetAllowed(boolean allowed); void onSetProperties(in ProviderProperties properties); diff --git a/location/java/android/location/provider/LocationProviderBase.java b/location/java/android/location/provider/LocationProviderBase.java index ae6395d5d12d..eada22cd94dc 100644 --- a/location/java/android/location/provider/LocationProviderBase.java +++ b/location/java/android/location/provider/LocationProviderBase.java @@ -96,7 +96,6 @@ public abstract class LocationProviderBase { "com.android.location.service.FusedLocationProvider"; private final String mTag; - private final @Nullable String mPackageName; private final @Nullable String mAttributionTag; private final IBinder mBinder; @@ -108,7 +107,6 @@ public abstract class LocationProviderBase { public LocationProviderBase(@NonNull Context context, @NonNull String tag, @NonNull ProviderProperties properties) { mTag = tag; - mPackageName = context.getPackageName(); mAttributionTag = context.getAttributionTag(); mBinder = new Service(); @@ -305,7 +303,7 @@ public abstract class LocationProviderBase { public void setLocationProviderManager(ILocationProviderManager manager) { synchronized (mBinder) { try { - manager.onInitialize(mAllowed, mProperties, mPackageName, mAttributionTag); + manager.onInitialize(mAllowed, mProperties, mAttributionTag); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } catch (RuntimeException e) { diff --git a/location/java/android/location/util/identity/CallerIdentity.java b/location/java/android/location/util/identity/CallerIdentity.java index 85a083ee84bc..ade0ea40e157 100644 --- a/location/java/android/location/util/identity/CallerIdentity.java +++ b/location/java/android/location/util/identity/CallerIdentity.java @@ -55,6 +55,20 @@ public final class CallerIdentity { } /** + * Returns a CallerIdentity with PID and listener ID information stripped. This is mostly + * useful for aggregating information for debug purposes, and should not be used in any API with + * security requirements. + */ + public static CallerIdentity forAggregation(CallerIdentity callerIdentity) { + if (callerIdentity.getPid() == 0 && callerIdentity.getListenerId() == null) { + return callerIdentity; + } + + return new CallerIdentity(callerIdentity.getUid(), 0, callerIdentity.getPackageName(), + callerIdentity.getAttributionTag(), null); + } + + /** * Creates a CallerIdentity for the current process and context. */ public static CallerIdentity fromContext(Context context) { @@ -180,17 +194,6 @@ public final class CallerIdentity { } } - /** - * Returns a CallerIdentity corrosponding to this CallerIdentity but with a null listener id. - */ - public CallerIdentity stripListenerId() { - if (mListenerId == null) { - return this; - } else { - return new CallerIdentity(mUid, mPid, mPackageName, mAttributionTag, null); - } - } - @Override public String toString() { int length = 10 + mPackageName.length(); |