220 lines
8.5 KiB
Java
220 lines
8.5 KiB
Java
package com.google.android.gms.location;
|
|
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import com.google.android.gms.common.internal.Objects;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
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.SafeParcelableSerializer;
|
|
import java.lang.reflect.Array;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ActivityRecognitionResult extends AbstractSafeParcelable implements ReflectedParcelable {
|
|
public static final Parcelable.Creator<ActivityRecognitionResult> CREATOR = new zzn();
|
|
List zza;
|
|
long zzb;
|
|
long zzc;
|
|
int zzd;
|
|
Bundle zze;
|
|
|
|
public ActivityRecognitionResult(DetectedActivity detectedActivity, long j, long j2) {
|
|
this(Collections.singletonList(detectedActivity), j, j2, 0, null);
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:11:0x002e */
|
|
/* JADX WARN: Removed duplicated region for block: B:9:0x002d A[RETURN] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public static com.google.android.gms.location.ActivityRecognitionResult extractResult(android.content.Intent r3) {
|
|
/*
|
|
boolean r0 = hasResult(r3)
|
|
r1 = 0
|
|
if (r0 != 0) goto L8
|
|
goto L2a
|
|
L8:
|
|
android.os.Bundle r0 = r3.getExtras()
|
|
if (r0 == 0) goto L2a
|
|
java.lang.String r2 = "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT"
|
|
java.lang.Object r0 = r0.get(r2)
|
|
boolean r2 = r0 instanceof byte[]
|
|
if (r2 == 0) goto L23
|
|
byte[] r0 = (byte[]) r0
|
|
android.os.Parcelable$Creator<com.google.android.gms.location.ActivityRecognitionResult> r2 = com.google.android.gms.location.ActivityRecognitionResult.CREATOR
|
|
com.google.android.gms.common.internal.safeparcel.SafeParcelable r0 = com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer.deserializeFromBytes(r0, r2)
|
|
com.google.android.gms.location.ActivityRecognitionResult r0 = (com.google.android.gms.location.ActivityRecognitionResult) r0
|
|
goto L2b
|
|
L23:
|
|
boolean r2 = r0 instanceof com.google.android.gms.location.ActivityRecognitionResult
|
|
if (r2 == 0) goto L2a
|
|
com.google.android.gms.location.ActivityRecognitionResult r0 = (com.google.android.gms.location.ActivityRecognitionResult) r0
|
|
goto L2b
|
|
L2a:
|
|
r0 = r1
|
|
L2b:
|
|
if (r0 == 0) goto L2e
|
|
return r0
|
|
L2e:
|
|
java.util.List r3 = zza(r3)
|
|
if (r3 == 0) goto L47
|
|
boolean r0 = r3.isEmpty()
|
|
if (r0 != 0) goto L47
|
|
int r0 = r3.size()
|
|
int r0 = r0 + (-1)
|
|
java.lang.Object r3 = r3.get(r0)
|
|
com.google.android.gms.location.ActivityRecognitionResult r3 = (com.google.android.gms.location.ActivityRecognitionResult) r3
|
|
return r3
|
|
L47:
|
|
return r1
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.location.ActivityRecognitionResult.extractResult(android.content.Intent):com.google.android.gms.location.ActivityRecognitionResult");
|
|
}
|
|
|
|
public static boolean hasResult(Intent intent) {
|
|
if (intent == null) {
|
|
return false;
|
|
}
|
|
if (intent.hasExtra("com.google.android.location.internal.EXTRA_ACTIVITY_RESULT")) {
|
|
return true;
|
|
}
|
|
List zza = zza(intent);
|
|
return (zza == null || zza.isEmpty()) ? false : true;
|
|
}
|
|
|
|
public static List zza(Intent intent) {
|
|
if (intent == null || !intent.hasExtra("com.google.android.location.internal.EXTRA_ACTIVITY_RESULT_LIST")) {
|
|
return null;
|
|
}
|
|
return SafeParcelableSerializer.deserializeIterableFromIntentExtra(intent, "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT_LIST", CREATOR);
|
|
}
|
|
|
|
private static boolean zzb(Bundle bundle, Bundle bundle2) {
|
|
int length;
|
|
if (bundle == null) {
|
|
return bundle2 == null;
|
|
}
|
|
if (bundle2 == null || bundle.size() != bundle2.size()) {
|
|
return false;
|
|
}
|
|
for (String str : bundle.keySet()) {
|
|
if (!bundle2.containsKey(str)) {
|
|
return false;
|
|
}
|
|
Object obj = bundle.get(str);
|
|
Object obj2 = bundle2.get(str);
|
|
if (obj == null) {
|
|
if (obj2 != null) {
|
|
return false;
|
|
}
|
|
} else if (obj instanceof Bundle) {
|
|
if (!zzb(bundle.getBundle(str), bundle2.getBundle(str))) {
|
|
return false;
|
|
}
|
|
} else if (!obj.getClass().isArray()) {
|
|
if (!obj.equals(obj2)) {
|
|
return false;
|
|
}
|
|
} else {
|
|
if (obj2 != null && obj2.getClass().isArray() && (length = Array.getLength(obj)) == Array.getLength(obj2)) {
|
|
for (int i = 0; i < length; i++) {
|
|
if (Objects.equal(Array.get(obj, i), Array.get(obj2, i))) {
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null || getClass() != obj.getClass()) {
|
|
return false;
|
|
}
|
|
ActivityRecognitionResult activityRecognitionResult = (ActivityRecognitionResult) obj;
|
|
return this.zzb == activityRecognitionResult.zzb && this.zzc == activityRecognitionResult.zzc && this.zzd == activityRecognitionResult.zzd && Objects.equal(this.zza, activityRecognitionResult.zza) && zzb(this.zze, activityRecognitionResult.zze);
|
|
}
|
|
|
|
public int getActivityConfidence(int i) {
|
|
for (DetectedActivity detectedActivity : this.zza) {
|
|
if (detectedActivity.getType() == i) {
|
|
return detectedActivity.getConfidence();
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public DetectedActivity getMostProbableActivity() {
|
|
return (DetectedActivity) this.zza.get(0);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
long j = this.zzb;
|
|
long j2 = this.zzc;
|
|
int i = this.zzd;
|
|
return Objects.hashCode(Long.valueOf(j), Long.valueOf(j2), Integer.valueOf(i), this.zza, this.zze);
|
|
}
|
|
|
|
public String toString() {
|
|
String valueOf = String.valueOf(this.zza);
|
|
long j = this.zzb;
|
|
long j2 = this.zzc;
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 124);
|
|
sb.append("ActivityRecognitionResult [probableActivities=");
|
|
sb.append(valueOf);
|
|
sb.append(", timeMillis=");
|
|
sb.append(j);
|
|
sb.append(", elapsedRealtimeMillis=");
|
|
sb.append(j2);
|
|
sb.append("]");
|
|
return sb.toString();
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
|
SafeParcelWriter.writeTypedList(parcel, 1, this.zza, false);
|
|
SafeParcelWriter.writeLong(parcel, 2, this.zzb);
|
|
SafeParcelWriter.writeLong(parcel, 3, this.zzc);
|
|
SafeParcelWriter.writeInt(parcel, 4, this.zzd);
|
|
SafeParcelWriter.writeBundle(parcel, 5, this.zze, false);
|
|
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
|
|
}
|
|
|
|
public ActivityRecognitionResult(List<DetectedActivity> list, long j, long j2) {
|
|
this(list, j, j2, 0, null);
|
|
}
|
|
|
|
public ActivityRecognitionResult(List list, long j, long j2, int i, Bundle bundle) {
|
|
Preconditions.checkArgument(list != null && list.size() > 0, "Must have at least 1 detected activity");
|
|
Preconditions.checkArgument(j > 0 && j2 > 0, "Must set times");
|
|
this.zza = list;
|
|
this.zzb = j;
|
|
this.zzc = j2;
|
|
this.zzd = i;
|
|
this.zze = bundle;
|
|
}
|
|
|
|
public long getTime() {
|
|
return this.zzb;
|
|
}
|
|
|
|
public List<DetectedActivity> getProbableActivities() {
|
|
return this.zza;
|
|
}
|
|
|
|
public long getElapsedRealtimeMillis() {
|
|
return this.zzc;
|
|
}
|
|
}
|