package com.google.android.gms.location; import android.content.Intent; import android.location.Location; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.common.internal.Objects; import com.google.android.gms.common.internal.ReflectedParcelable; import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer; import java.util.Collections; import java.util.Iterator; import java.util.List; @SafeParcelable.Class(creator = "LocationResultCreator") @SafeParcelable.Reserved({1000}) /* loaded from: classes3.dex */ public final class LocationResult extends AbstractSafeParcelable implements ReflectedParcelable { @SafeParcelable.Field(defaultValueUnchecked = "LocationResult.DEFAULT_LOCATIONS", getter = "getLocations", id = 1) private final List zzb; static final List zza = Collections.EMPTY_LIST; public static final Parcelable.Creator CREATOR = new zzy(); @SafeParcelable.Constructor public LocationResult(@SafeParcelable.Param(id = 1) List list) { this.zzb = list; } public static LocationResult create(List list) { if (list == null) { list = zza; } return new LocationResult(list); } public static LocationResult extractResult(Intent intent) { if (!hasResult(intent)) { return null; } LocationResult locationResult = (LocationResult) SafeParcelableSerializer.deserializeFromIntentExtra(intent, "com.google.android.gms.location.EXTRA_LOCATION_RESULT_BYTES", CREATOR); return locationResult == null ? (LocationResult) intent.getParcelableExtra("com.google.android.gms.location.EXTRA_LOCATION_RESULT") : locationResult; } public static boolean hasResult(Intent intent) { if (intent == null) { return false; } return intent.hasExtra("com.google.android.gms.location.EXTRA_LOCATION_RESULT") || intent.hasExtra("com.google.android.gms.location.EXTRA_LOCATION_RESULT_BYTES"); } public boolean equals(Object obj) { if (!(obj instanceof LocationResult)) { return false; } LocationResult locationResult = (LocationResult) obj; if (Build.VERSION.SDK_INT >= 31) { return this.zzb.equals(locationResult.zzb); } if (this.zzb.size() != locationResult.zzb.size()) { return false; } Iterator it = locationResult.zzb.iterator(); for (Location location : this.zzb) { Location location2 = (Location) it.next(); if (Double.compare(location.getLatitude(), location2.getLatitude()) != 0 || Double.compare(location.getLongitude(), location2.getLongitude()) != 0 || location.getTime() != location2.getTime() || location.getElapsedRealtimeNanos() != location2.getElapsedRealtimeNanos() || !Objects.equal(location.getProvider(), location2.getProvider())) { return false; } } return true; } public Location getLastLocation() { int size = this.zzb.size(); if (size == 0) { return null; } return (Location) this.zzb.get(size - 1); } public List getLocations() { return this.zzb; } public int hashCode() { return Objects.hashCode(this.zzb); } public String toString() { return "LocationResult".concat(String.valueOf(this.zzb)); } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel); SafeParcelWriter.writeTypedList(parcel, 1, getLocations(), false); SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader); } }