ADD week 5
This commit is contained in:
@ -0,0 +1,73 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.GnssStatus;
|
||||
import android.location.GpsStatus;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class GnssStatusCompat {
|
||||
public static final int CONSTELLATION_BEIDOU = 5;
|
||||
public static final int CONSTELLATION_GALILEO = 6;
|
||||
public static final int CONSTELLATION_GLONASS = 3;
|
||||
public static final int CONSTELLATION_GPS = 1;
|
||||
public static final int CONSTELLATION_IRNSS = 7;
|
||||
public static final int CONSTELLATION_QZSS = 4;
|
||||
public static final int CONSTELLATION_SBAS = 2;
|
||||
public static final int CONSTELLATION_UNKNOWN = 0;
|
||||
|
||||
public static abstract class Callback {
|
||||
public void onFirstFix(int i) {
|
||||
}
|
||||
|
||||
public void onSatelliteStatusChanged(GnssStatusCompat gnssStatusCompat) {
|
||||
}
|
||||
|
||||
public void onStarted() {
|
||||
}
|
||||
|
||||
public void onStopped() {
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ConstellationType {
|
||||
}
|
||||
|
||||
public abstract float getAzimuthDegrees(int i);
|
||||
|
||||
public abstract float getBasebandCn0DbHz(int i);
|
||||
|
||||
public abstract float getCarrierFrequencyHz(int i);
|
||||
|
||||
public abstract float getCn0DbHz(int i);
|
||||
|
||||
public abstract int getConstellationType(int i);
|
||||
|
||||
public abstract float getElevationDegrees(int i);
|
||||
|
||||
public abstract int getSatelliteCount();
|
||||
|
||||
public abstract int getSvid(int i);
|
||||
|
||||
public abstract boolean hasAlmanacData(int i);
|
||||
|
||||
public abstract boolean hasBasebandCn0DbHz(int i);
|
||||
|
||||
public abstract boolean hasCarrierFrequencyHz(int i);
|
||||
|
||||
public abstract boolean hasEphemerisData(int i);
|
||||
|
||||
public abstract boolean usedInFix(int i);
|
||||
|
||||
public static GnssStatusCompat wrap(GnssStatus gnssStatus) {
|
||||
return new GnssStatusWrapper(gnssStatus);
|
||||
}
|
||||
|
||||
public static GnssStatusCompat wrap(GpsStatus gpsStatus) {
|
||||
return new GpsStatusWrapper(gpsStatus);
|
||||
}
|
||||
|
||||
GnssStatusCompat() {
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.GnssStatus;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.ColorKt$$ExternalSyntheticApiModelOutline0;
|
||||
import androidx.core.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GnssStatusWrapper extends GnssStatusCompat {
|
||||
private final GnssStatus mWrapped;
|
||||
|
||||
GnssStatusWrapper(Object obj) {
|
||||
this.mWrapped = ColorKt$$ExternalSyntheticApiModelOutline0.m89m(Preconditions.checkNotNull(ColorKt$$ExternalSyntheticApiModelOutline0.m89m(obj)));
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getSatelliteCount() {
|
||||
int satelliteCount;
|
||||
satelliteCount = this.mWrapped.getSatelliteCount();
|
||||
return satelliteCount;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getConstellationType(int i) {
|
||||
int constellationType;
|
||||
constellationType = this.mWrapped.getConstellationType(i);
|
||||
return constellationType;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getSvid(int i) {
|
||||
int svid;
|
||||
svid = this.mWrapped.getSvid(i);
|
||||
return svid;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getCn0DbHz(int i) {
|
||||
float cn0DbHz;
|
||||
cn0DbHz = this.mWrapped.getCn0DbHz(i);
|
||||
return cn0DbHz;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getElevationDegrees(int i) {
|
||||
float elevationDegrees;
|
||||
elevationDegrees = this.mWrapped.getElevationDegrees(i);
|
||||
return elevationDegrees;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getAzimuthDegrees(int i) {
|
||||
float azimuthDegrees;
|
||||
azimuthDegrees = this.mWrapped.getAzimuthDegrees(i);
|
||||
return azimuthDegrees;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasEphemerisData(int i) {
|
||||
boolean hasEphemerisData;
|
||||
hasEphemerisData = this.mWrapped.hasEphemerisData(i);
|
||||
return hasEphemerisData;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasAlmanacData(int i) {
|
||||
boolean hasAlmanacData;
|
||||
hasAlmanacData = this.mWrapped.hasAlmanacData(i);
|
||||
return hasAlmanacData;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean usedInFix(int i) {
|
||||
boolean usedInFix;
|
||||
usedInFix = this.mWrapped.usedInFix(i);
|
||||
return usedInFix;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasCarrierFrequencyHz(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.hasCarrierFrequencyHz(this.mWrapped, i);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getCarrierFrequencyHz(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.getCarrierFrequencyHz(this.mWrapped, i);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasBasebandCn0DbHz(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
return Api30Impl.hasBasebandCn0DbHz(this.mWrapped, i);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getBasebandCn0DbHz(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
return Api30Impl.getBasebandCn0DbHz(this.mWrapped, i);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
boolean equals;
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof GnssStatusWrapper)) {
|
||||
return false;
|
||||
}
|
||||
equals = this.mWrapped.equals(((GnssStatusWrapper) obj).mWrapped);
|
||||
return equals;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hashCode;
|
||||
hashCode = this.mWrapped.hashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static float getCarrierFrequencyHz(GnssStatus gnssStatus, int i) {
|
||||
return gnssStatus.getCarrierFrequencyHz(i);
|
||||
}
|
||||
|
||||
static boolean hasCarrierFrequencyHz(GnssStatus gnssStatus, int i) {
|
||||
return gnssStatus.hasCarrierFrequencyHz(i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api30Impl {
|
||||
private Api30Impl() {
|
||||
}
|
||||
|
||||
static boolean hasBasebandCn0DbHz(GnssStatus gnssStatus, int i) {
|
||||
return gnssStatus.hasBasebandCn0DbHz(i);
|
||||
}
|
||||
|
||||
static float getBasebandCn0DbHz(GnssStatus gnssStatus, int i) {
|
||||
return gnssStatus.getBasebandCn0DbHz(i);
|
||||
}
|
||||
}
|
||||
}
|
176
02-Easy5/E5/sources/androidx/core/location/GpsStatusWrapper.java
Normal file
176
02-Easy5/E5/sources/androidx/core/location/GpsStatusWrapper.java
Normal file
@ -0,0 +1,176 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.GpsSatellite;
|
||||
import android.location.GpsStatus;
|
||||
import android.os.Build;
|
||||
import androidx.core.util.Preconditions;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GpsStatusWrapper extends GnssStatusCompat {
|
||||
private static final int BEIDOU_PRN_COUNT = 35;
|
||||
private static final int BEIDOU_PRN_OFFSET = 200;
|
||||
private static final int GLONASS_PRN_COUNT = 24;
|
||||
private static final int GLONASS_PRN_OFFSET = 64;
|
||||
private static final int GPS_PRN_COUNT = 32;
|
||||
private static final int GPS_PRN_OFFSET = 0;
|
||||
private static final int QZSS_SVID_MAX = 200;
|
||||
private static final int QZSS_SVID_MIN = 193;
|
||||
private static final int SBAS_PRN_MAX = 64;
|
||||
private static final int SBAS_PRN_MIN = 33;
|
||||
private static final int SBAS_PRN_OFFSET = -87;
|
||||
private Iterator<GpsSatellite> mCachedIterator;
|
||||
private int mCachedIteratorPosition;
|
||||
private GpsSatellite mCachedSatellite;
|
||||
private int mCachedSatelliteCount;
|
||||
private final GpsStatus mWrapped;
|
||||
|
||||
private static int getConstellationFromPrn(int i) {
|
||||
if (i > 0 && i <= 32) {
|
||||
return 1;
|
||||
}
|
||||
if (i >= 33 && i <= 64) {
|
||||
return 2;
|
||||
}
|
||||
if (i > 64 && i <= 88) {
|
||||
return 3;
|
||||
}
|
||||
if (i <= 200 || i > 235) {
|
||||
return (i < QZSS_SVID_MIN || i > 200) ? 0 : 4;
|
||||
}
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasBasebandCn0DbHz(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasCarrierFrequencyHz(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GpsStatusWrapper(GpsStatus gpsStatus) {
|
||||
GpsStatus gpsStatus2 = (GpsStatus) Preconditions.checkNotNull(gpsStatus);
|
||||
this.mWrapped = gpsStatus2;
|
||||
this.mCachedSatelliteCount = -1;
|
||||
this.mCachedIterator = gpsStatus2.getSatellites().iterator();
|
||||
this.mCachedIteratorPosition = -1;
|
||||
this.mCachedSatellite = null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getSatelliteCount() {
|
||||
int i;
|
||||
synchronized (this.mWrapped) {
|
||||
if (this.mCachedSatelliteCount == -1) {
|
||||
for (GpsSatellite gpsSatellite : this.mWrapped.getSatellites()) {
|
||||
this.mCachedSatelliteCount++;
|
||||
}
|
||||
this.mCachedSatelliteCount++;
|
||||
}
|
||||
i = this.mCachedSatelliteCount;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getConstellationType(int i) {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
return 1;
|
||||
}
|
||||
return getConstellationFromPrn(getSatellite(i).getPrn());
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public int getSvid(int i) {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
return getSatellite(i).getPrn();
|
||||
}
|
||||
return getSvidFromPrn(getSatellite(i).getPrn());
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getCn0DbHz(int i) {
|
||||
return getSatellite(i).getSnr();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getElevationDegrees(int i) {
|
||||
return getSatellite(i).getElevation();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getAzimuthDegrees(int i) {
|
||||
return getSatellite(i).getAzimuth();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasEphemerisData(int i) {
|
||||
return getSatellite(i).hasEphemeris();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean hasAlmanacData(int i) {
|
||||
return getSatellite(i).hasAlmanac();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public boolean usedInFix(int i) {
|
||||
return getSatellite(i).usedInFix();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getCarrierFrequencyHz(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.location.GnssStatusCompat
|
||||
public float getBasebandCn0DbHz(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private GpsSatellite getSatellite(int i) {
|
||||
GpsSatellite gpsSatellite;
|
||||
synchronized (this.mWrapped) {
|
||||
if (i < this.mCachedIteratorPosition) {
|
||||
this.mCachedIterator = this.mWrapped.getSatellites().iterator();
|
||||
this.mCachedIteratorPosition = -1;
|
||||
}
|
||||
while (true) {
|
||||
int i2 = this.mCachedIteratorPosition;
|
||||
if (i2 >= i) {
|
||||
break;
|
||||
}
|
||||
this.mCachedIteratorPosition = i2 + 1;
|
||||
if (!this.mCachedIterator.hasNext()) {
|
||||
this.mCachedSatellite = null;
|
||||
break;
|
||||
}
|
||||
this.mCachedSatellite = this.mCachedIterator.next();
|
||||
}
|
||||
gpsSatellite = this.mCachedSatellite;
|
||||
}
|
||||
return (GpsSatellite) Preconditions.checkNotNull(gpsSatellite);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof GpsStatusWrapper) {
|
||||
return this.mWrapped.equals(((GpsStatusWrapper) obj).mWrapped);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.mWrapped.hashCode();
|
||||
}
|
||||
|
||||
private static int getSvidFromPrn(int i) {
|
||||
int constellationFromPrn = getConstellationFromPrn(i);
|
||||
return constellationFromPrn != 2 ? constellationFromPrn != 3 ? constellationFromPrn != 5 ? i : i - 200 : i - 64 : i + 87;
|
||||
}
|
||||
}
|
255
02-Easy5/E5/sources/androidx/core/location/LocationCompat.java
Normal file
255
02-Easy5/E5/sources/androidx/core/location/LocationCompat.java
Normal file
@ -0,0 +1,255 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.util.Preconditions;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LocationCompat {
|
||||
public static final String EXTRA_BEARING_ACCURACY = "bearingAccuracy";
|
||||
public static final String EXTRA_IS_MOCK = "mockLocation";
|
||||
public static final String EXTRA_MSL_ALTITUDE = "androidx.core.location.extra.MSL_ALTITUDE";
|
||||
public static final String EXTRA_MSL_ALTITUDE_ACCURACY = "androidx.core.location.extra.MSL_ALTITUDE_ACCURACY";
|
||||
public static final String EXTRA_SPEED_ACCURACY = "speedAccuracy";
|
||||
public static final String EXTRA_VERTICAL_ACCURACY = "verticalAccuracy";
|
||||
private static Method sSetIsFromMockProviderMethod;
|
||||
|
||||
private LocationCompat() {
|
||||
}
|
||||
|
||||
public static long getElapsedRealtimeNanos(Location location) {
|
||||
return Api17Impl.getElapsedRealtimeNanos(location);
|
||||
}
|
||||
|
||||
public static long getElapsedRealtimeMillis(Location location) {
|
||||
return TimeUnit.NANOSECONDS.toMillis(Api17Impl.getElapsedRealtimeNanos(location));
|
||||
}
|
||||
|
||||
public static boolean hasVerticalAccuracy(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.hasVerticalAccuracy(location);
|
||||
}
|
||||
return containsExtra(location, EXTRA_VERTICAL_ACCURACY);
|
||||
}
|
||||
|
||||
public static float getVerticalAccuracyMeters(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.getVerticalAccuracyMeters(location);
|
||||
}
|
||||
Bundle extras = location.getExtras();
|
||||
if (extras == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
return extras.getFloat(EXTRA_VERTICAL_ACCURACY, 0.0f);
|
||||
}
|
||||
|
||||
public static void setVerticalAccuracyMeters(Location location, float f) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
Api26Impl.setVerticalAccuracyMeters(location, f);
|
||||
} else {
|
||||
getOrCreateExtras(location).putFloat(EXTRA_VERTICAL_ACCURACY, f);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasSpeedAccuracy(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.hasSpeedAccuracy(location);
|
||||
}
|
||||
return containsExtra(location, EXTRA_SPEED_ACCURACY);
|
||||
}
|
||||
|
||||
public static float getSpeedAccuracyMetersPerSecond(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.getSpeedAccuracyMetersPerSecond(location);
|
||||
}
|
||||
Bundle extras = location.getExtras();
|
||||
if (extras == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
return extras.getFloat(EXTRA_SPEED_ACCURACY, 0.0f);
|
||||
}
|
||||
|
||||
public static void setSpeedAccuracyMetersPerSecond(Location location, float f) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
Api26Impl.setSpeedAccuracyMetersPerSecond(location, f);
|
||||
} else {
|
||||
getOrCreateExtras(location).putFloat(EXTRA_SPEED_ACCURACY, f);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasBearingAccuracy(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.hasBearingAccuracy(location);
|
||||
}
|
||||
return containsExtra(location, EXTRA_BEARING_ACCURACY);
|
||||
}
|
||||
|
||||
public static float getBearingAccuracyDegrees(Location location) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.getBearingAccuracyDegrees(location);
|
||||
}
|
||||
Bundle extras = location.getExtras();
|
||||
if (extras == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
return extras.getFloat(EXTRA_BEARING_ACCURACY, 0.0f);
|
||||
}
|
||||
|
||||
public static void setBearingAccuracyDegrees(Location location, float f) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
Api26Impl.setBearingAccuracyDegrees(location, f);
|
||||
} else {
|
||||
getOrCreateExtras(location).putFloat(EXTRA_BEARING_ACCURACY, f);
|
||||
}
|
||||
}
|
||||
|
||||
public static double getMslAltitudeMeters(Location location) {
|
||||
Preconditions.checkState(hasMslAltitude(location), "The Mean Sea Level altitude of the location is not set.");
|
||||
return getOrCreateExtras(location).getDouble(EXTRA_MSL_ALTITUDE);
|
||||
}
|
||||
|
||||
public static void setMslAltitudeMeters(Location location, double d) {
|
||||
getOrCreateExtras(location).putDouble(EXTRA_MSL_ALTITUDE, d);
|
||||
}
|
||||
|
||||
public static boolean hasMslAltitude(Location location) {
|
||||
return containsExtra(location, EXTRA_MSL_ALTITUDE);
|
||||
}
|
||||
|
||||
public static void removeMslAltitude(Location location) {
|
||||
removeExtra(location, EXTRA_MSL_ALTITUDE);
|
||||
}
|
||||
|
||||
public static float getMslAltitudeAccuracyMeters(Location location) {
|
||||
Preconditions.checkState(hasMslAltitudeAccuracy(location), "The Mean Sea Level altitude accuracy of the location is not set.");
|
||||
return getOrCreateExtras(location).getFloat(EXTRA_MSL_ALTITUDE_ACCURACY);
|
||||
}
|
||||
|
||||
public static void setMslAltitudeAccuracyMeters(Location location, float f) {
|
||||
getOrCreateExtras(location).putFloat(EXTRA_MSL_ALTITUDE_ACCURACY, f);
|
||||
}
|
||||
|
||||
public static boolean hasMslAltitudeAccuracy(Location location) {
|
||||
return containsExtra(location, EXTRA_MSL_ALTITUDE_ACCURACY);
|
||||
}
|
||||
|
||||
public static void removeMslAltitudeAccuracy(Location location) {
|
||||
removeExtra(location, EXTRA_MSL_ALTITUDE_ACCURACY);
|
||||
}
|
||||
|
||||
public static boolean isMock(Location location) {
|
||||
return Api18Impl.isMock(location);
|
||||
}
|
||||
|
||||
public static void setMock(Location location, boolean z) {
|
||||
try {
|
||||
getSetIsFromMockProviderMethod().invoke(location, Boolean.valueOf(z));
|
||||
} catch (IllegalAccessException e) {
|
||||
IllegalAccessError illegalAccessError = new IllegalAccessError();
|
||||
illegalAccessError.initCause(e);
|
||||
throw illegalAccessError;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
NoSuchMethodError noSuchMethodError = new NoSuchMethodError();
|
||||
noSuchMethodError.initCause(e2);
|
||||
throw noSuchMethodError;
|
||||
} catch (InvocationTargetException e3) {
|
||||
throw new RuntimeException(e3);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static boolean hasVerticalAccuracy(Location location) {
|
||||
return location.hasVerticalAccuracy();
|
||||
}
|
||||
|
||||
static float getVerticalAccuracyMeters(Location location) {
|
||||
return location.getVerticalAccuracyMeters();
|
||||
}
|
||||
|
||||
static void setVerticalAccuracyMeters(Location location, float f) {
|
||||
location.setVerticalAccuracyMeters(f);
|
||||
}
|
||||
|
||||
static boolean hasSpeedAccuracy(Location location) {
|
||||
return location.hasSpeedAccuracy();
|
||||
}
|
||||
|
||||
static float getSpeedAccuracyMetersPerSecond(Location location) {
|
||||
return location.getSpeedAccuracyMetersPerSecond();
|
||||
}
|
||||
|
||||
static void setSpeedAccuracyMetersPerSecond(Location location, float f) {
|
||||
location.setSpeedAccuracyMetersPerSecond(f);
|
||||
}
|
||||
|
||||
static boolean hasBearingAccuracy(Location location) {
|
||||
return location.hasBearingAccuracy();
|
||||
}
|
||||
|
||||
static float getBearingAccuracyDegrees(Location location) {
|
||||
return location.getBearingAccuracyDegrees();
|
||||
}
|
||||
|
||||
static void setBearingAccuracyDegrees(Location location, float f) {
|
||||
location.setBearingAccuracyDegrees(f);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api18Impl {
|
||||
private Api18Impl() {
|
||||
}
|
||||
|
||||
static boolean isMock(Location location) {
|
||||
return location.isFromMockProvider();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static long getElapsedRealtimeNanos(Location location) {
|
||||
return location.getElapsedRealtimeNanos();
|
||||
}
|
||||
}
|
||||
|
||||
private static Method getSetIsFromMockProviderMethod() throws NoSuchMethodException {
|
||||
if (sSetIsFromMockProviderMethod == null) {
|
||||
Method declaredMethod = Location.class.getDeclaredMethod("setIsFromMockProvider", Boolean.TYPE);
|
||||
sSetIsFromMockProviderMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
return sSetIsFromMockProviderMethod;
|
||||
}
|
||||
|
||||
private static Bundle getOrCreateExtras(Location location) {
|
||||
Bundle extras = location.getExtras();
|
||||
if (extras != null) {
|
||||
return extras;
|
||||
}
|
||||
location.setExtras(new Bundle());
|
||||
return location.getExtras();
|
||||
}
|
||||
|
||||
private static boolean containsExtra(Location location, String str) {
|
||||
Bundle extras = location.getExtras();
|
||||
return extras != null && extras.containsKey(str);
|
||||
}
|
||||
|
||||
private static void removeExtra(Location location, String str) {
|
||||
Bundle extras = location.getExtras();
|
||||
if (extras != null) {
|
||||
extras.remove(str);
|
||||
if (extras.isEmpty()) {
|
||||
location.setExtras(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
02-Easy5/E5/sources/androidx/core/location/LocationKt.java
Normal file
20
02-Easy5/E5/sources/androidx/core/location/LocationKt.java
Normal file
@ -0,0 +1,20 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.Location;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Location.kt */
|
||||
@Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0086\n\u001a\r\u0010\u0003\u001a\u00020\u0001*\u00020\u0002H\u0086\n¨\u0006\u0004"}, d2 = {"component1", "", "Landroid/location/Location;", "component2", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class LocationKt {
|
||||
public static final double component1(Location location) {
|
||||
Intrinsics.checkNotNullParameter(location, "<this>");
|
||||
return location.getLatitude();
|
||||
}
|
||||
|
||||
public static final double component2(Location location) {
|
||||
Intrinsics.checkNotNullParameter(location, "<this>");
|
||||
return location.getLongitude();
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.os.Bundle;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface LocationListenerCompat extends LocationListener {
|
||||
@Override // android.location.LocationListener
|
||||
void onFlushComplete(int i);
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
void onLocationChanged(List<Location> list);
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
void onProviderDisabled(String str);
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
void onProviderEnabled(String str);
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
void onStatusChanged(String str, int i, Bundle bundle);
|
||||
|
||||
/* renamed from: androidx.core.location.LocationListenerCompat$-CC, reason: invalid class name */
|
||||
public final /* synthetic */ class CC {
|
||||
public static void $default$onFlushComplete(LocationListenerCompat _this, int i) {
|
||||
}
|
||||
|
||||
public static void $default$onProviderDisabled(LocationListenerCompat _this, String str) {
|
||||
}
|
||||
|
||||
public static void $default$onProviderEnabled(LocationListenerCompat _this, String str) {
|
||||
}
|
||||
|
||||
public static void $default$onStatusChanged(LocationListenerCompat _this, String str, int i, Bundle bundle) {
|
||||
}
|
||||
|
||||
public static void $default$onLocationChanged(LocationListenerCompat _this, List list) {
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
_this.onLocationChanged((Location) list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,987 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.GnssMeasurementsEvent;
|
||||
import android.location.GnssStatus;
|
||||
import android.location.GpsStatus;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.location.LocationRequest;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.graphics.ColorKt$$ExternalSyntheticApiModelOutline0;
|
||||
import androidx.core.location.GnssStatusCompat;
|
||||
import androidx.core.location.LocationManagerCompat;
|
||||
import androidx.core.os.CancellationSignal;
|
||||
import androidx.core.os.ExecutorCompat;
|
||||
import androidx.core.util.Consumer;
|
||||
import androidx.core.util.ObjectsCompat;
|
||||
import androidx.core.util.Preconditions;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LocationManagerCompat {
|
||||
private static final long GET_CURRENT_LOCATION_TIMEOUT_MS = 30000;
|
||||
private static final long MAX_CURRENT_LOCATION_AGE_MS = 10000;
|
||||
private static final long PRE_N_LOOPER_TIMEOUT_S = 5;
|
||||
private static Field sContextField;
|
||||
private static Method sGnssRequestBuilderBuildMethod;
|
||||
private static Class<?> sGnssRequestBuilderClass;
|
||||
static final WeakHashMap<LocationListenerKey, WeakReference<LocationListenerTransport>> sLocationListeners = new WeakHashMap<>();
|
||||
private static Method sRegisterGnssMeasurementsCallbackMethod;
|
||||
|
||||
public static boolean isLocationEnabled(LocationManager locationManager) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.isLocationEnabled(locationManager);
|
||||
}
|
||||
return locationManager.isProviderEnabled("network") || locationManager.isProviderEnabled("gps");
|
||||
}
|
||||
|
||||
public static boolean hasProvider(LocationManager locationManager, String str) {
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
return Api31Impl.hasProvider(locationManager, str);
|
||||
}
|
||||
if (locationManager.getAllProviders().contains(str)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
return locationManager.getProvider(str) != null;
|
||||
} catch (SecurityException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void getCurrentLocation(LocationManager locationManager, String str, CancellationSignal cancellationSignal, Executor executor, final Consumer<Location> consumer) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
Api30Impl.getCurrentLocation(locationManager, str, cancellationSignal, executor, consumer);
|
||||
return;
|
||||
}
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
final Location lastKnownLocation = locationManager.getLastKnownLocation(str);
|
||||
if (lastKnownLocation != null && SystemClock.elapsedRealtime() - LocationCompat.getElapsedRealtimeMillis(lastKnownLocation) < MAX_CURRENT_LOCATION_AGE_MS) {
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$$ExternalSyntheticLambda2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
Consumer.this.accept(lastKnownLocation);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
final CancellableLocationListener cancellableLocationListener = new CancellableLocationListener(locationManager, executor, consumer);
|
||||
locationManager.requestLocationUpdates(str, 0L, 0.0f, cancellableLocationListener, Looper.getMainLooper());
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() { // from class: androidx.core.location.LocationManagerCompat$$ExternalSyntheticLambda3
|
||||
@Override // androidx.core.os.CancellationSignal.OnCancelListener
|
||||
public final void onCancel() {
|
||||
LocationManagerCompat.CancellableLocationListener.this.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
cancellableLocationListener.startTimeout(GET_CURRENT_LOCATION_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
public static void requestLocationUpdates(LocationManager locationManager, String str, LocationRequestCompat locationRequestCompat, Executor executor, LocationListenerCompat locationListenerCompat) {
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
Api31Impl.requestLocationUpdates(locationManager, str, locationRequestCompat.toLocationRequest(), executor, locationListenerCompat);
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 30 || !Api30Impl.tryRequestLocationUpdates(locationManager, str, locationRequestCompat, executor, locationListenerCompat)) {
|
||||
LocationListenerTransport locationListenerTransport = new LocationListenerTransport(new LocationListenerKey(str, locationListenerCompat), executor);
|
||||
if (Api19Impl.tryRequestLocationUpdates(locationManager, str, locationRequestCompat, locationListenerTransport)) {
|
||||
return;
|
||||
}
|
||||
synchronized (sLocationListeners) {
|
||||
locationManager.requestLocationUpdates(str, locationRequestCompat.getIntervalMillis(), locationRequestCompat.getMinUpdateDistanceMeters(), locationListenerTransport, Looper.getMainLooper());
|
||||
registerLocationListenerTransport(locationManager, locationListenerTransport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void registerLocationListenerTransport(LocationManager locationManager, LocationListenerTransport locationListenerTransport) {
|
||||
WeakReference<LocationListenerTransport> put = sLocationListeners.put(locationListenerTransport.getKey(), new WeakReference<>(locationListenerTransport));
|
||||
LocationListenerTransport locationListenerTransport2 = put != null ? put.get() : null;
|
||||
if (locationListenerTransport2 != null) {
|
||||
locationListenerTransport2.unregister();
|
||||
locationManager.removeUpdates(locationListenerTransport2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void requestLocationUpdates(LocationManager locationManager, String str, LocationRequestCompat locationRequestCompat, LocationListenerCompat locationListenerCompat, Looper looper) {
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
Api31Impl.requestLocationUpdates(locationManager, str, locationRequestCompat.toLocationRequest(), ExecutorCompat.create(new Handler(looper)), locationListenerCompat);
|
||||
} else {
|
||||
if (Api19Impl.tryRequestLocationUpdates(locationManager, str, locationRequestCompat, locationListenerCompat, looper)) {
|
||||
return;
|
||||
}
|
||||
locationManager.requestLocationUpdates(str, locationRequestCompat.getIntervalMillis(), locationRequestCompat.getMinUpdateDistanceMeters(), locationListenerCompat, looper);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeUpdates(LocationManager locationManager, LocationListenerCompat locationListenerCompat) {
|
||||
WeakHashMap<LocationListenerKey, WeakReference<LocationListenerTransport>> weakHashMap = sLocationListeners;
|
||||
synchronized (weakHashMap) {
|
||||
Iterator<WeakReference<LocationListenerTransport>> it = weakHashMap.values().iterator();
|
||||
ArrayList arrayList = null;
|
||||
while (it.hasNext()) {
|
||||
LocationListenerTransport locationListenerTransport = it.next().get();
|
||||
if (locationListenerTransport != null) {
|
||||
LocationListenerKey key = locationListenerTransport.getKey();
|
||||
if (key.mListener == locationListenerCompat) {
|
||||
if (arrayList == null) {
|
||||
arrayList = new ArrayList();
|
||||
}
|
||||
arrayList.add(key);
|
||||
locationListenerTransport.unregister();
|
||||
locationManager.removeUpdates(locationListenerTransport);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arrayList != null) {
|
||||
Iterator it2 = arrayList.iterator();
|
||||
while (it2.hasNext()) {
|
||||
sLocationListeners.remove((LocationListenerKey) it2.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
locationManager.removeUpdates(locationListenerCompat);
|
||||
}
|
||||
|
||||
public static String getGnssHardwareModelName(LocationManager locationManager) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getGnssHardwareModelName(locationManager);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getGnssYearOfHardware(LocationManager locationManager) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getGnssYearOfHardware(locationManager);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static class GnssListenersHolder {
|
||||
static final SimpleArrayMap<Object, Object> sGnssStatusListeners = new SimpleArrayMap<>();
|
||||
|
||||
private GnssListenersHolder() {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean registerGnssMeasurementsCallback(LocationManager locationManager, GnssMeasurementsEvent.Callback callback, Handler handler) {
|
||||
if (Build.VERSION.SDK_INT != 30) {
|
||||
return Api24Impl.registerGnssMeasurementsCallback(locationManager, callback, handler);
|
||||
}
|
||||
return registerGnssMeasurementsCallbackOnR(locationManager, ExecutorCompat.create(handler), callback);
|
||||
}
|
||||
|
||||
public static boolean registerGnssMeasurementsCallback(LocationManager locationManager, Executor executor, GnssMeasurementsEvent.Callback callback) {
|
||||
if (Build.VERSION.SDK_INT > 30) {
|
||||
return Api31Impl.registerGnssMeasurementsCallback(locationManager, executor, callback);
|
||||
}
|
||||
return registerGnssMeasurementsCallbackOnR(locationManager, executor, callback);
|
||||
}
|
||||
|
||||
public static void unregisterGnssMeasurementsCallback(LocationManager locationManager, GnssMeasurementsEvent.Callback callback) {
|
||||
Api24Impl.unregisterGnssMeasurementsCallback(locationManager, callback);
|
||||
}
|
||||
|
||||
private static boolean registerGnssMeasurementsCallbackOnR(LocationManager locationManager, Executor executor, GnssMeasurementsEvent.Callback callback) {
|
||||
if (Build.VERSION.SDK_INT == 30) {
|
||||
try {
|
||||
if (sGnssRequestBuilderClass == null) {
|
||||
sGnssRequestBuilderClass = Class.forName("android.location.GnssRequest$Builder");
|
||||
}
|
||||
if (sGnssRequestBuilderBuildMethod == null) {
|
||||
Method declaredMethod = sGnssRequestBuilderClass.getDeclaredMethod("build", new Class[0]);
|
||||
sGnssRequestBuilderBuildMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
if (sRegisterGnssMeasurementsCallbackMethod == null) {
|
||||
Method declaredMethod2 = LocationManager.class.getDeclaredMethod("registerGnssMeasurementsCallback", Class.forName("android.location.GnssRequest"), Executor.class, ColorKt$$ExternalSyntheticApiModelOutline0.m98m());
|
||||
sRegisterGnssMeasurementsCallbackMethod = declaredMethod2;
|
||||
declaredMethod2.setAccessible(true);
|
||||
}
|
||||
Object invoke = sRegisterGnssMeasurementsCallbackMethod.invoke(locationManager, sGnssRequestBuilderBuildMethod.invoke(sGnssRequestBuilderClass.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]), new Object[0]), executor, callback);
|
||||
if (invoke != null) {
|
||||
return ((Boolean) invoke).booleanValue();
|
||||
}
|
||||
return false;
|
||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public static boolean registerGnssStatusCallback(LocationManager locationManager, GnssStatusCompat.Callback callback, Handler handler) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
return registerGnssStatusCallback(locationManager, ExecutorCompat.create(handler), callback);
|
||||
}
|
||||
return registerGnssStatusCallback(locationManager, new InlineHandlerExecutor(handler), callback);
|
||||
}
|
||||
|
||||
public static boolean registerGnssStatusCallback(LocationManager locationManager, Executor executor, GnssStatusCompat.Callback callback) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
return registerGnssStatusCallback(locationManager, null, executor, callback);
|
||||
}
|
||||
Looper myLooper = Looper.myLooper();
|
||||
if (myLooper == null) {
|
||||
myLooper = Looper.getMainLooper();
|
||||
}
|
||||
return registerGnssStatusCallback(locationManager, new Handler(myLooper), executor, callback);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:47:0x00c9 A[Catch: all -> 0x00e5, TryCatch #3 {all -> 0x00e5, blocks: (B:57:0x00a8, B:58:0x00be, B:45:0x00c1, B:47:0x00c9, B:49:0x00d1, B:50:0x00d7, B:51:0x00d8, B:52:0x00dd, B:53:0x00de, B:54:0x00e4, B:40:0x0097), top: B:22:0x0057 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:53:0x00de A[Catch: all -> 0x00e5, TryCatch #3 {all -> 0x00e5, blocks: (B:57:0x00a8, B:58:0x00be, B:45:0x00c1, B:47:0x00c9, B:49:0x00d1, B:50:0x00d7, B:51:0x00d8, B:52:0x00dd, B:53:0x00de, B:54:0x00e4, B:40:0x0097), top: B:22:0x0057 }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private static boolean registerGnssStatusCallback(final android.location.LocationManager r9, android.os.Handler r10, java.util.concurrent.Executor r11, androidx.core.location.GnssStatusCompat.Callback r12) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 266
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.core.location.LocationManagerCompat.registerGnssStatusCallback(android.location.LocationManager, android.os.Handler, java.util.concurrent.Executor, androidx.core.location.GnssStatusCompat$Callback):boolean");
|
||||
}
|
||||
|
||||
public static void unregisterGnssStatusCallback(LocationManager locationManager, GnssStatusCompat.Callback callback) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
synchronized (GnssListenersHolder.sGnssStatusListeners) {
|
||||
Object remove = GnssListenersHolder.sGnssStatusListeners.remove(callback);
|
||||
if (remove != null) {
|
||||
Api24Impl.unregisterGnssStatusCallback(locationManager, remove);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
synchronized (GnssListenersHolder.sGnssStatusListeners) {
|
||||
GpsStatusTransport gpsStatusTransport = (GpsStatusTransport) GnssListenersHolder.sGnssStatusListeners.remove(callback);
|
||||
if (gpsStatusTransport != null) {
|
||||
gpsStatusTransport.unregister();
|
||||
locationManager.removeGpsStatusListener(gpsStatusTransport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LocationManagerCompat() {
|
||||
}
|
||||
|
||||
private static class LocationListenerKey {
|
||||
final LocationListenerCompat mListener;
|
||||
final String mProvider;
|
||||
|
||||
LocationListenerKey(String str, LocationListenerCompat locationListenerCompat) {
|
||||
this.mProvider = (String) ObjectsCompat.requireNonNull(str, "invalid null provider");
|
||||
this.mListener = (LocationListenerCompat) ObjectsCompat.requireNonNull(locationListenerCompat, "invalid null listener");
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof LocationListenerKey)) {
|
||||
return false;
|
||||
}
|
||||
LocationListenerKey locationListenerKey = (LocationListenerKey) obj;
|
||||
return this.mProvider.equals(locationListenerKey.mProvider) && this.mListener.equals(locationListenerKey.mListener);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectsCompat.hash(this.mProvider, this.mListener);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
static class LocationListenerTransport implements LocationListener {
|
||||
final Executor mExecutor;
|
||||
volatile LocationListenerKey mKey;
|
||||
|
||||
public void unregister() {
|
||||
this.mKey = null;
|
||||
}
|
||||
|
||||
LocationListenerTransport(LocationListenerKey locationListenerKey, Executor executor) {
|
||||
this.mKey = locationListenerKey;
|
||||
this.mExecutor = executor;
|
||||
}
|
||||
|
||||
public LocationListenerKey getKey() {
|
||||
return (LocationListenerKey) ObjectsCompat.requireNonNull(this.mKey);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onLocationChanged(final Location location) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda4
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m124xa8d50b3d(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onLocationChanged$0$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m124xa8d50b3d(Location location) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onLocationChanged(final List<Location> list) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m125x2b1fc01c(list);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onLocationChanged$1$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m125x2b1fc01c(List list) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onLocationChanged((List<Location>) list);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onFlushComplete(final int i) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m123xf04cfe9d(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onFlushComplete$2$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m123xf04cfe9d(int i) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onFlushComplete(i);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onStatusChanged(final String str, final int i, final Bundle bundle) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda5
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m128xdbe6a717(str, i, bundle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onStatusChanged$3$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m128xdbe6a717(String str, int i, Bundle bundle) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onStatusChanged(str, i, bundle);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onProviderEnabled(final String str) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m127x5a2a7b08(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onProviderEnabled$4$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m127x5a2a7b08(String str) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onProviderEnabled(str);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onProviderDisabled(final String str) {
|
||||
if (this.mKey == null) {
|
||||
return;
|
||||
}
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$LocationListenerTransport$$ExternalSyntheticLambda3
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.LocationListenerTransport.this.m126x442abc92(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onProviderDisabled$5$androidx-core-location-LocationManagerCompat$LocationListenerTransport, reason: not valid java name */
|
||||
/* synthetic */ void m126x442abc92(String str) {
|
||||
LocationListenerKey locationListenerKey = this.mKey;
|
||||
if (locationListenerKey == null) {
|
||||
return;
|
||||
}
|
||||
locationListenerKey.mListener.onProviderDisabled(str);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GnssStatusTransport extends GnssStatus.Callback {
|
||||
final GnssStatusCompat.Callback mCallback;
|
||||
|
||||
GnssStatusTransport(GnssStatusCompat.Callback callback) {
|
||||
Preconditions.checkArgument(callback != null, "invalid null callback");
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onStarted() {
|
||||
this.mCallback.onStarted();
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onStopped() {
|
||||
this.mCallback.onStopped();
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onFirstFix(int i) {
|
||||
this.mCallback.onFirstFix(i);
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onSatelliteStatusChanged(GnssStatus gnssStatus) {
|
||||
this.mCallback.onSatelliteStatusChanged(GnssStatusCompat.wrap(gnssStatus));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
static class PreRGnssStatusTransport extends GnssStatus.Callback {
|
||||
final GnssStatusCompat.Callback mCallback;
|
||||
volatile Executor mExecutor;
|
||||
|
||||
public void unregister() {
|
||||
this.mExecutor = null;
|
||||
}
|
||||
|
||||
PreRGnssStatusTransport(GnssStatusCompat.Callback callback) {
|
||||
Preconditions.checkArgument(callback != null, "invalid null callback");
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
public void register(Executor executor) {
|
||||
Preconditions.checkArgument(executor != null, "invalid null executor");
|
||||
Preconditions.checkState(this.mExecutor == null);
|
||||
this.mExecutor = executor;
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onStarted() {
|
||||
final Executor executor = this.mExecutor;
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$PreRGnssStatusTransport$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.PreRGnssStatusTransport.this.m131x7ba12b9c(executor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onStarted$0$androidx-core-location-LocationManagerCompat$PreRGnssStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m131x7ba12b9c(Executor executor) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onStarted();
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onStopped() {
|
||||
final Executor executor = this.mExecutor;
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$PreRGnssStatusTransport$$ExternalSyntheticLambda3
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.PreRGnssStatusTransport.this.m132x80a5cd6f(executor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onStopped$1$androidx-core-location-LocationManagerCompat$PreRGnssStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m132x80a5cd6f(Executor executor) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onStopped();
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onFirstFix(final int i) {
|
||||
final Executor executor = this.mExecutor;
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$PreRGnssStatusTransport$$ExternalSyntheticLambda2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.PreRGnssStatusTransport.this.m129x4191f1e(executor, i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onFirstFix$2$androidx-core-location-LocationManagerCompat$PreRGnssStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m129x4191f1e(Executor executor, int i) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onFirstFix(i);
|
||||
}
|
||||
|
||||
@Override // android.location.GnssStatus.Callback
|
||||
public void onSatelliteStatusChanged(final GnssStatus gnssStatus) {
|
||||
final Executor executor = this.mExecutor;
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$PreRGnssStatusTransport$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.PreRGnssStatusTransport.this.m130xdecf6cdb(executor, gnssStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onSatelliteStatusChanged$3$androidx-core-location-LocationManagerCompat$PreRGnssStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m130xdecf6cdb(Executor executor, GnssStatus gnssStatus) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onSatelliteStatusChanged(GnssStatusCompat.wrap(gnssStatus));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
static class GpsStatusTransport implements GpsStatus.Listener {
|
||||
final GnssStatusCompat.Callback mCallback;
|
||||
volatile Executor mExecutor;
|
||||
private final LocationManager mLocationManager;
|
||||
|
||||
public void unregister() {
|
||||
this.mExecutor = null;
|
||||
}
|
||||
|
||||
GpsStatusTransport(LocationManager locationManager, GnssStatusCompat.Callback callback) {
|
||||
Preconditions.checkArgument(callback != null, "invalid null callback");
|
||||
this.mLocationManager = locationManager;
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
public void register(Executor executor) {
|
||||
Preconditions.checkState(this.mExecutor == null);
|
||||
this.mExecutor = executor;
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onGpsStatusChanged$0$androidx-core-location-LocationManagerCompat$GpsStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m119x75e92221(Executor executor) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onStarted();
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onGpsStatusChanged$1$androidx-core-location-LocationManagerCompat$GpsStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m120xc3a89a22(Executor executor) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onStopped();
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onGpsStatusChanged$2$androidx-core-location-LocationManagerCompat$GpsStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m121x11681223(Executor executor, int i) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onFirstFix(i);
|
||||
}
|
||||
|
||||
@Override // android.location.GpsStatus.Listener
|
||||
public void onGpsStatusChanged(int i) {
|
||||
GpsStatus gpsStatus;
|
||||
final Executor executor = this.mExecutor;
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$GpsStatusTransport$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.GpsStatusTransport.this.m119x75e92221(executor);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (i == 2) {
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$GpsStatusTransport$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.GpsStatusTransport.this.m120xc3a89a22(executor);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (i != 3) {
|
||||
if (i == 4 && (gpsStatus = this.mLocationManager.getGpsStatus(null)) != null) {
|
||||
final GnssStatusCompat wrap = GnssStatusCompat.wrap(gpsStatus);
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$GpsStatusTransport$$ExternalSyntheticLambda3
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.GpsStatusTransport.this.m122x5f278a24(executor, wrap);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
GpsStatus gpsStatus2 = this.mLocationManager.getGpsStatus(null);
|
||||
if (gpsStatus2 != null) {
|
||||
final int timeToFirstFix = gpsStatus2.getTimeToFirstFix();
|
||||
executor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$GpsStatusTransport$$ExternalSyntheticLambda2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.GpsStatusTransport.this.m121x11681223(executor, timeToFirstFix);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: lambda$onGpsStatusChanged$3$androidx-core-location-LocationManagerCompat$GpsStatusTransport, reason: not valid java name */
|
||||
/* synthetic */ void m122x5f278a24(Executor executor, GnssStatusCompat gnssStatusCompat) {
|
||||
if (this.mExecutor != executor) {
|
||||
return;
|
||||
}
|
||||
this.mCallback.onSatelliteStatusChanged(gnssStatusCompat);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
static final class CancellableLocationListener implements LocationListener {
|
||||
private Consumer<Location> mConsumer;
|
||||
private final Executor mExecutor;
|
||||
private final LocationManager mLocationManager;
|
||||
private final Handler mTimeoutHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable mTimeoutRunnable;
|
||||
private boolean mTriggered;
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onProviderEnabled(String str) {
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onStatusChanged(String str, int i, Bundle bundle) {
|
||||
}
|
||||
|
||||
CancellableLocationListener(LocationManager locationManager, Executor executor, Consumer<Location> consumer) {
|
||||
this.mLocationManager = locationManager;
|
||||
this.mExecutor = executor;
|
||||
this.mConsumer = consumer;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
synchronized (this) {
|
||||
if (this.mTriggered) {
|
||||
return;
|
||||
}
|
||||
this.mTriggered = true;
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void startTimeout(long j) {
|
||||
synchronized (this) {
|
||||
if (this.mTriggered) {
|
||||
return;
|
||||
}
|
||||
Runnable runnable = new Runnable() { // from class: androidx.core.location.LocationManagerCompat$CancellableLocationListener$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
LocationManagerCompat.CancellableLocationListener.this.m118x40ccd759();
|
||||
}
|
||||
};
|
||||
this.mTimeoutRunnable = runnable;
|
||||
this.mTimeoutHandler.postDelayed(runnable, j);
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: lambda$startTimeout$0$androidx-core-location-LocationManagerCompat$CancellableLocationListener, reason: not valid java name */
|
||||
/* synthetic */ void m118x40ccd759() {
|
||||
this.mTimeoutRunnable = null;
|
||||
onLocationChanged((Location) null);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onProviderDisabled(String str) {
|
||||
onLocationChanged((Location) null);
|
||||
}
|
||||
|
||||
@Override // android.location.LocationListener
|
||||
public void onLocationChanged(final Location location) {
|
||||
synchronized (this) {
|
||||
if (this.mTriggered) {
|
||||
return;
|
||||
}
|
||||
this.mTriggered = true;
|
||||
final Consumer<Location> consumer = this.mConsumer;
|
||||
this.mExecutor.execute(new Runnable() { // from class: androidx.core.location.LocationManagerCompat$CancellableLocationListener$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
Consumer.this.accept(location);
|
||||
}
|
||||
});
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanup() {
|
||||
this.mConsumer = null;
|
||||
this.mLocationManager.removeUpdates(this);
|
||||
Runnable runnable = this.mTimeoutRunnable;
|
||||
if (runnable != null) {
|
||||
this.mTimeoutHandler.removeCallbacks(runnable);
|
||||
this.mTimeoutRunnable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class InlineHandlerExecutor implements Executor {
|
||||
private final Handler mHandler;
|
||||
|
||||
InlineHandlerExecutor(Handler handler) {
|
||||
this.mHandler = (Handler) Preconditions.checkNotNull(handler);
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(Runnable runnable) {
|
||||
if (Looper.myLooper() == this.mHandler.getLooper()) {
|
||||
runnable.run();
|
||||
} else {
|
||||
if (this.mHandler.post((Runnable) Preconditions.checkNotNull(runnable))) {
|
||||
return;
|
||||
}
|
||||
throw new RejectedExecutionException(this.mHandler + " is shutting down");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api31Impl {
|
||||
private Api31Impl() {
|
||||
}
|
||||
|
||||
static boolean hasProvider(LocationManager locationManager, String str) {
|
||||
return locationManager.hasProvider(str);
|
||||
}
|
||||
|
||||
static void requestLocationUpdates(LocationManager locationManager, String str, LocationRequest locationRequest, Executor executor, LocationListener locationListener) {
|
||||
locationManager.requestLocationUpdates(str, locationRequest, executor, locationListener);
|
||||
}
|
||||
|
||||
static boolean registerGnssMeasurementsCallback(LocationManager locationManager, Executor executor, GnssMeasurementsEvent.Callback callback) {
|
||||
return locationManager.registerGnssMeasurementsCallback(executor, callback);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api30Impl {
|
||||
private static Class<?> sLocationRequestClass;
|
||||
private static Method sRequestLocationUpdatesExecutorMethod;
|
||||
|
||||
private Api30Impl() {
|
||||
}
|
||||
|
||||
static void getCurrentLocation(LocationManager locationManager, String str, CancellationSignal cancellationSignal, Executor executor, final Consumer<Location> consumer) {
|
||||
android.os.CancellationSignal cancellationSignal2 = cancellationSignal != null ? (android.os.CancellationSignal) cancellationSignal.getCancellationSignalObject() : null;
|
||||
Objects.requireNonNull(consumer);
|
||||
locationManager.getCurrentLocation(str, cancellationSignal2, executor, new java.util.function.Consumer() { // from class: androidx.core.location.LocationManagerCompat$Api30Impl$$ExternalSyntheticLambda0
|
||||
@Override // java.util.function.Consumer
|
||||
public final void accept(Object obj) {
|
||||
Consumer.this.accept((Location) obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean tryRequestLocationUpdates(LocationManager locationManager, String str, LocationRequestCompat locationRequestCompat, Executor executor, LocationListenerCompat locationListenerCompat) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
try {
|
||||
if (sLocationRequestClass == null) {
|
||||
sLocationRequestClass = Class.forName("android.location.LocationRequest");
|
||||
}
|
||||
if (sRequestLocationUpdatesExecutorMethod == null) {
|
||||
Method declaredMethod = LocationManager.class.getDeclaredMethod("requestLocationUpdates", sLocationRequestClass, Executor.class, LocationListener.class);
|
||||
sRequestLocationUpdatesExecutorMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
LocationRequest locationRequest = locationRequestCompat.toLocationRequest(str);
|
||||
if (locationRequest != null) {
|
||||
sRequestLocationUpdatesExecutorMethod.invoke(locationManager, locationRequest, executor, locationListenerCompat);
|
||||
return true;
|
||||
}
|
||||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | UnsupportedOperationException | InvocationTargetException unused) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean registerGnssStatusCallback(LocationManager locationManager, Handler handler, Executor executor, GnssStatusCompat.Callback callback) {
|
||||
synchronized (GnssListenersHolder.sGnssStatusListeners) {
|
||||
GnssStatusTransport gnssStatusTransport = (GnssStatusTransport) GnssListenersHolder.sGnssStatusListeners.get(callback);
|
||||
if (gnssStatusTransport == null) {
|
||||
gnssStatusTransport = new GnssStatusTransport(callback);
|
||||
}
|
||||
if (!locationManager.registerGnssStatusCallback(executor, gnssStatusTransport)) {
|
||||
return false;
|
||||
}
|
||||
GnssListenersHolder.sGnssStatusListeners.put(callback, gnssStatusTransport);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static boolean isLocationEnabled(LocationManager locationManager) {
|
||||
return locationManager.isLocationEnabled();
|
||||
}
|
||||
|
||||
static String getGnssHardwareModelName(LocationManager locationManager) {
|
||||
return locationManager.getGnssHardwareModelName();
|
||||
}
|
||||
|
||||
static int getGnssYearOfHardware(LocationManager locationManager) {
|
||||
return locationManager.getGnssYearOfHardware();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api19Impl {
|
||||
private static Class<?> sLocationRequestClass;
|
||||
private static Method sRequestLocationUpdatesLooperMethod;
|
||||
|
||||
private Api19Impl() {
|
||||
}
|
||||
|
||||
static boolean tryRequestLocationUpdates(LocationManager locationManager, String str, LocationRequestCompat locationRequestCompat, LocationListenerTransport locationListenerTransport) {
|
||||
try {
|
||||
if (sLocationRequestClass == null) {
|
||||
sLocationRequestClass = Class.forName("android.location.LocationRequest");
|
||||
}
|
||||
if (sRequestLocationUpdatesLooperMethod == null) {
|
||||
Method declaredMethod = LocationManager.class.getDeclaredMethod("requestLocationUpdates", sLocationRequestClass, LocationListener.class, Looper.class);
|
||||
sRequestLocationUpdatesLooperMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
LocationRequest locationRequest = locationRequestCompat.toLocationRequest(str);
|
||||
if (locationRequest != null) {
|
||||
synchronized (LocationManagerCompat.sLocationListeners) {
|
||||
sRequestLocationUpdatesLooperMethod.invoke(locationManager, locationRequest, locationListenerTransport, Looper.getMainLooper());
|
||||
LocationManagerCompat.registerLocationListenerTransport(locationManager, locationListenerTransport);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | UnsupportedOperationException | InvocationTargetException unused) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean tryRequestLocationUpdates(LocationManager locationManager, String str, LocationRequestCompat locationRequestCompat, LocationListenerCompat locationListenerCompat, Looper looper) {
|
||||
try {
|
||||
if (sLocationRequestClass == null) {
|
||||
sLocationRequestClass = Class.forName("android.location.LocationRequest");
|
||||
}
|
||||
if (sRequestLocationUpdatesLooperMethod == null) {
|
||||
Method declaredMethod = LocationManager.class.getDeclaredMethod("requestLocationUpdates", sLocationRequestClass, LocationListener.class, Looper.class);
|
||||
sRequestLocationUpdatesLooperMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
LocationRequest locationRequest = locationRequestCompat.toLocationRequest(str);
|
||||
if (locationRequest != null) {
|
||||
sRequestLocationUpdatesLooperMethod.invoke(locationManager, locationRequest, locationListenerCompat, looper);
|
||||
return true;
|
||||
}
|
||||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | UnsupportedOperationException | InvocationTargetException unused) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static boolean registerGnssMeasurementsCallback(LocationManager locationManager, GnssMeasurementsEvent.Callback callback, Handler handler) {
|
||||
return locationManager.registerGnssMeasurementsCallback(callback, handler);
|
||||
}
|
||||
|
||||
static void unregisterGnssMeasurementsCallback(LocationManager locationManager, GnssMeasurementsEvent.Callback callback) {
|
||||
locationManager.unregisterGnssMeasurementsCallback(callback);
|
||||
}
|
||||
|
||||
static boolean registerGnssStatusCallback(LocationManager locationManager, Handler handler, Executor executor, GnssStatusCompat.Callback callback) {
|
||||
Preconditions.checkArgument(handler != null);
|
||||
synchronized (GnssListenersHolder.sGnssStatusListeners) {
|
||||
PreRGnssStatusTransport preRGnssStatusTransport = (PreRGnssStatusTransport) GnssListenersHolder.sGnssStatusListeners.get(callback);
|
||||
if (preRGnssStatusTransport == null) {
|
||||
preRGnssStatusTransport = new PreRGnssStatusTransport(callback);
|
||||
} else {
|
||||
preRGnssStatusTransport.unregister();
|
||||
}
|
||||
preRGnssStatusTransport.register(executor);
|
||||
if (!locationManager.registerGnssStatusCallback(preRGnssStatusTransport, handler)) {
|
||||
return false;
|
||||
}
|
||||
GnssListenersHolder.sGnssStatusListeners.put(callback, preRGnssStatusTransport);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static void unregisterGnssStatusCallback(LocationManager locationManager, Object obj) {
|
||||
if (obj instanceof PreRGnssStatusTransport) {
|
||||
((PreRGnssStatusTransport) obj).unregister();
|
||||
}
|
||||
locationManager.unregisterGnssStatusCallback((GnssStatus.Callback) obj);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,290 @@
|
||||
package androidx.core.location;
|
||||
|
||||
import android.location.LocationRequest;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.ColorKt$$ExternalSyntheticApiModelOutline0;
|
||||
import androidx.core.util.Preconditions;
|
||||
import androidx.core.util.TimeUtils;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LocationRequestCompat {
|
||||
private static final long IMPLICIT_MIN_UPDATE_INTERVAL = -1;
|
||||
public static final long PASSIVE_INTERVAL = Long.MAX_VALUE;
|
||||
public static final int QUALITY_BALANCED_POWER_ACCURACY = 102;
|
||||
public static final int QUALITY_HIGH_ACCURACY = 100;
|
||||
public static final int QUALITY_LOW_POWER = 104;
|
||||
final long mDurationMillis;
|
||||
final long mIntervalMillis;
|
||||
final long mMaxUpdateDelayMillis;
|
||||
final int mMaxUpdates;
|
||||
final float mMinUpdateDistanceMeters;
|
||||
final long mMinUpdateIntervalMillis;
|
||||
final int mQuality;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Quality {
|
||||
}
|
||||
|
||||
public long getDurationMillis() {
|
||||
return this.mDurationMillis;
|
||||
}
|
||||
|
||||
public long getIntervalMillis() {
|
||||
return this.mIntervalMillis;
|
||||
}
|
||||
|
||||
public long getMaxUpdateDelayMillis() {
|
||||
return this.mMaxUpdateDelayMillis;
|
||||
}
|
||||
|
||||
public int getMaxUpdates() {
|
||||
return this.mMaxUpdates;
|
||||
}
|
||||
|
||||
public float getMinUpdateDistanceMeters() {
|
||||
return this.mMinUpdateDistanceMeters;
|
||||
}
|
||||
|
||||
public long getMinUpdateIntervalMillis() {
|
||||
long j = this.mMinUpdateIntervalMillis;
|
||||
return j == -1 ? this.mIntervalMillis : j;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return this.mQuality;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = this.mQuality * 31;
|
||||
long j = this.mIntervalMillis;
|
||||
int i2 = (i + ((int) (j ^ (j >>> 32)))) * 31;
|
||||
long j2 = this.mMinUpdateIntervalMillis;
|
||||
return i2 + ((int) (j2 ^ (j2 >>> 32)));
|
||||
}
|
||||
|
||||
LocationRequestCompat(long j, int i, long j2, int i2, long j3, float f, long j4) {
|
||||
this.mIntervalMillis = j;
|
||||
this.mQuality = i;
|
||||
this.mMinUpdateIntervalMillis = j3;
|
||||
this.mDurationMillis = j2;
|
||||
this.mMaxUpdates = i2;
|
||||
this.mMinUpdateDistanceMeters = f;
|
||||
this.mMaxUpdateDelayMillis = j4;
|
||||
}
|
||||
|
||||
public LocationRequest toLocationRequest() {
|
||||
return Api31Impl.toLocationRequest(this);
|
||||
}
|
||||
|
||||
public LocationRequest toLocationRequest(String str) {
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
return toLocationRequest();
|
||||
}
|
||||
return ColorKt$$ExternalSyntheticApiModelOutline0.m90m(Api19Impl.toLocationRequest(this, str));
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof LocationRequestCompat)) {
|
||||
return false;
|
||||
}
|
||||
LocationRequestCompat locationRequestCompat = (LocationRequestCompat) obj;
|
||||
return this.mQuality == locationRequestCompat.mQuality && this.mIntervalMillis == locationRequestCompat.mIntervalMillis && this.mMinUpdateIntervalMillis == locationRequestCompat.mMinUpdateIntervalMillis && this.mDurationMillis == locationRequestCompat.mDurationMillis && this.mMaxUpdates == locationRequestCompat.mMaxUpdates && Float.compare(locationRequestCompat.mMinUpdateDistanceMeters, this.mMinUpdateDistanceMeters) == 0 && this.mMaxUpdateDelayMillis == locationRequestCompat.mMaxUpdateDelayMillis;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Request[");
|
||||
if (this.mIntervalMillis != Long.MAX_VALUE) {
|
||||
sb.append("@");
|
||||
TimeUtils.formatDuration(this.mIntervalMillis, sb);
|
||||
int i = this.mQuality;
|
||||
if (i == 100) {
|
||||
sb.append(" HIGH_ACCURACY");
|
||||
} else if (i == 102) {
|
||||
sb.append(" BALANCED");
|
||||
} else if (i == 104) {
|
||||
sb.append(" LOW_POWER");
|
||||
}
|
||||
} else {
|
||||
sb.append("PASSIVE");
|
||||
}
|
||||
if (this.mDurationMillis != Long.MAX_VALUE) {
|
||||
sb.append(", duration=");
|
||||
TimeUtils.formatDuration(this.mDurationMillis, sb);
|
||||
}
|
||||
if (this.mMaxUpdates != Integer.MAX_VALUE) {
|
||||
sb.append(", maxUpdates=");
|
||||
sb.append(this.mMaxUpdates);
|
||||
}
|
||||
long j = this.mMinUpdateIntervalMillis;
|
||||
if (j != -1 && j < this.mIntervalMillis) {
|
||||
sb.append(", minUpdateInterval=");
|
||||
TimeUtils.formatDuration(this.mMinUpdateIntervalMillis, sb);
|
||||
}
|
||||
if (this.mMinUpdateDistanceMeters > 0.0d) {
|
||||
sb.append(", minUpdateDistance=");
|
||||
sb.append(this.mMinUpdateDistanceMeters);
|
||||
}
|
||||
if (this.mMaxUpdateDelayMillis / 2 > this.mIntervalMillis) {
|
||||
sb.append(", maxUpdateDelay=");
|
||||
TimeUtils.formatDuration(this.mMaxUpdateDelayMillis, sb);
|
||||
}
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private long mDurationMillis;
|
||||
private long mIntervalMillis;
|
||||
private long mMaxUpdateDelayMillis;
|
||||
private int mMaxUpdates;
|
||||
private float mMinUpdateDistanceMeters;
|
||||
private long mMinUpdateIntervalMillis;
|
||||
private int mQuality;
|
||||
|
||||
public Builder clearMinUpdateIntervalMillis() {
|
||||
this.mMinUpdateIntervalMillis = -1L;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder(long j) {
|
||||
setIntervalMillis(j);
|
||||
this.mQuality = 102;
|
||||
this.mDurationMillis = Long.MAX_VALUE;
|
||||
this.mMaxUpdates = Integer.MAX_VALUE;
|
||||
this.mMinUpdateIntervalMillis = -1L;
|
||||
this.mMinUpdateDistanceMeters = 0.0f;
|
||||
this.mMaxUpdateDelayMillis = 0L;
|
||||
}
|
||||
|
||||
public Builder(LocationRequestCompat locationRequestCompat) {
|
||||
this.mIntervalMillis = locationRequestCompat.mIntervalMillis;
|
||||
this.mQuality = locationRequestCompat.mQuality;
|
||||
this.mDurationMillis = locationRequestCompat.mDurationMillis;
|
||||
this.mMaxUpdates = locationRequestCompat.mMaxUpdates;
|
||||
this.mMinUpdateIntervalMillis = locationRequestCompat.mMinUpdateIntervalMillis;
|
||||
this.mMinUpdateDistanceMeters = locationRequestCompat.mMinUpdateDistanceMeters;
|
||||
this.mMaxUpdateDelayMillis = locationRequestCompat.mMaxUpdateDelayMillis;
|
||||
}
|
||||
|
||||
public Builder setIntervalMillis(long j) {
|
||||
this.mIntervalMillis = Preconditions.checkArgumentInRange(j, 0L, Long.MAX_VALUE, "intervalMillis");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setQuality(int i) {
|
||||
Preconditions.checkArgument(i == 104 || i == 102 || i == 100, "quality must be a defined QUALITY constant, not %d", Integer.valueOf(i));
|
||||
this.mQuality = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDurationMillis(long j) {
|
||||
this.mDurationMillis = Preconditions.checkArgumentInRange(j, 1L, Long.MAX_VALUE, "durationMillis");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxUpdates(int i) {
|
||||
this.mMaxUpdates = Preconditions.checkArgumentInRange(i, 1, Integer.MAX_VALUE, "maxUpdates");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinUpdateIntervalMillis(long j) {
|
||||
this.mMinUpdateIntervalMillis = Preconditions.checkArgumentInRange(j, 0L, Long.MAX_VALUE, "minUpdateIntervalMillis");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinUpdateDistanceMeters(float f) {
|
||||
this.mMinUpdateDistanceMeters = f;
|
||||
this.mMinUpdateDistanceMeters = Preconditions.checkArgumentInRange(f, 0.0f, Float.MAX_VALUE, "minUpdateDistanceMeters");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxUpdateDelayMillis(long j) {
|
||||
this.mMaxUpdateDelayMillis = j;
|
||||
this.mMaxUpdateDelayMillis = Preconditions.checkArgumentInRange(j, 0L, Long.MAX_VALUE, "maxUpdateDelayMillis");
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocationRequestCompat build() {
|
||||
Preconditions.checkState((this.mIntervalMillis == Long.MAX_VALUE && this.mMinUpdateIntervalMillis == -1) ? false : true, "passive location requests must have an explicit minimum update interval");
|
||||
long j = this.mIntervalMillis;
|
||||
return new LocationRequestCompat(j, this.mQuality, this.mDurationMillis, this.mMaxUpdates, Math.min(this.mMinUpdateIntervalMillis, j), this.mMinUpdateDistanceMeters, this.mMaxUpdateDelayMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api31Impl {
|
||||
private Api31Impl() {
|
||||
}
|
||||
|
||||
public static LocationRequest toLocationRequest(LocationRequestCompat locationRequestCompat) {
|
||||
return new LocationRequest.Builder(locationRequestCompat.getIntervalMillis()).setQuality(locationRequestCompat.getQuality()).setMinUpdateIntervalMillis(locationRequestCompat.getMinUpdateIntervalMillis()).setDurationMillis(locationRequestCompat.getDurationMillis()).setMaxUpdates(locationRequestCompat.getMaxUpdates()).setMinUpdateDistanceMeters(locationRequestCompat.getMinUpdateDistanceMeters()).setMaxUpdateDelayMillis(locationRequestCompat.getMaxUpdateDelayMillis()).build();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api19Impl {
|
||||
private static Method sCreateFromDeprecatedProviderMethod;
|
||||
private static Class<?> sLocationRequestClass;
|
||||
private static Method sSetExpireInMethod;
|
||||
private static Method sSetFastestIntervalMethod;
|
||||
private static Method sSetNumUpdatesMethod;
|
||||
private static Method sSetQualityMethod;
|
||||
|
||||
private Api19Impl() {
|
||||
}
|
||||
|
||||
public static Object toLocationRequest(LocationRequestCompat locationRequestCompat, String str) {
|
||||
try {
|
||||
if (sLocationRequestClass == null) {
|
||||
sLocationRequestClass = Class.forName("android.location.LocationRequest");
|
||||
}
|
||||
if (sCreateFromDeprecatedProviderMethod == null) {
|
||||
Method declaredMethod = sLocationRequestClass.getDeclaredMethod("createFromDeprecatedProvider", String.class, Long.TYPE, Float.TYPE, Boolean.TYPE);
|
||||
sCreateFromDeprecatedProviderMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
}
|
||||
Object invoke = sCreateFromDeprecatedProviderMethod.invoke(null, str, Long.valueOf(locationRequestCompat.getIntervalMillis()), Float.valueOf(locationRequestCompat.getMinUpdateDistanceMeters()), false);
|
||||
if (invoke == null) {
|
||||
return null;
|
||||
}
|
||||
if (sSetQualityMethod == null) {
|
||||
Method declaredMethod2 = sLocationRequestClass.getDeclaredMethod("setQuality", Integer.TYPE);
|
||||
sSetQualityMethod = declaredMethod2;
|
||||
declaredMethod2.setAccessible(true);
|
||||
}
|
||||
sSetQualityMethod.invoke(invoke, Integer.valueOf(locationRequestCompat.getQuality()));
|
||||
if (sSetFastestIntervalMethod == null) {
|
||||
Method declaredMethod3 = sLocationRequestClass.getDeclaredMethod("setFastestInterval", Long.TYPE);
|
||||
sSetFastestIntervalMethod = declaredMethod3;
|
||||
declaredMethod3.setAccessible(true);
|
||||
}
|
||||
sSetFastestIntervalMethod.invoke(invoke, Long.valueOf(locationRequestCompat.getMinUpdateIntervalMillis()));
|
||||
if (locationRequestCompat.getMaxUpdates() < Integer.MAX_VALUE) {
|
||||
if (sSetNumUpdatesMethod == null) {
|
||||
Method declaredMethod4 = sLocationRequestClass.getDeclaredMethod("setNumUpdates", Integer.TYPE);
|
||||
sSetNumUpdatesMethod = declaredMethod4;
|
||||
declaredMethod4.setAccessible(true);
|
||||
}
|
||||
sSetNumUpdatesMethod.invoke(invoke, Integer.valueOf(locationRequestCompat.getMaxUpdates()));
|
||||
}
|
||||
if (locationRequestCompat.getDurationMillis() < Long.MAX_VALUE) {
|
||||
if (sSetExpireInMethod == null) {
|
||||
Method declaredMethod5 = sLocationRequestClass.getDeclaredMethod("setExpireIn", Long.TYPE);
|
||||
sSetExpireInMethod = declaredMethod5;
|
||||
declaredMethod5.setAccessible(true);
|
||||
}
|
||||
sSetExpireInMethod.invoke(invoke, Long.valueOf(locationRequestCompat.getDurationMillis()));
|
||||
}
|
||||
return invoke;
|
||||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user