what-the-bank/sources/com/google/android/gms/location/SleepSegmentEvent.java

116 lines
4.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.location;
import android.content.Intent;
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.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* loaded from: classes2.dex */
public class SleepSegmentEvent extends AbstractSafeParcelable {
public static final Parcelable.Creator<SleepSegmentEvent> CREATOR = new zzcc();
public static final int STATUS_MISSING_DATA = 1;
public static final int STATUS_NOT_DETECTED = 2;
public static final int STATUS_SUCCESSFUL = 0;
private final long zza;
private final long zzb;
private final int zzc;
private final int zzd;
private final int zze;
public SleepSegmentEvent(long j, long j2, int i, int i2, int i3) {
Preconditions.checkArgument(j <= j2, "endTimeMillis must be greater than or equal to startTimeMillis");
this.zza = j;
this.zzb = j2;
this.zzc = i;
this.zzd = i2;
this.zze = i3;
}
public static List<SleepSegmentEvent> extractEvents(Intent intent) {
Preconditions.checkNotNull(intent);
if (!hasEvents(intent)) {
return Collections.emptyList();
}
ArrayList arrayList = (ArrayList) intent.getSerializableExtra("com.google.android.location.internal.EXTRA_SLEEP_SEGMENT_RESULT");
if (arrayList == null) {
return Collections.emptyList();
}
ArrayList arrayList2 = new ArrayList(arrayList.size());
int size = arrayList.size();
for (int i = 0; i < size; i++) {
byte[] bArr = (byte[]) arrayList.get(i);
Preconditions.checkNotNull(bArr);
arrayList2.add((SleepSegmentEvent) SafeParcelableSerializer.deserializeFromBytes(bArr, CREATOR));
}
return Collections.unmodifiableList(arrayList2);
}
public static boolean hasEvents(Intent intent) {
if (intent == null) {
return false;
}
return intent.hasExtra("com.google.android.location.internal.EXTRA_SLEEP_SEGMENT_RESULT");
}
public boolean equals(Object obj) {
if (!(obj instanceof SleepSegmentEvent)) {
return false;
}
SleepSegmentEvent sleepSegmentEvent = (SleepSegmentEvent) obj;
return this.zza == sleepSegmentEvent.getStartTimeMillis() && this.zzb == sleepSegmentEvent.getEndTimeMillis() && this.zzc == sleepSegmentEvent.getStatus() && this.zzd == sleepSegmentEvent.zzd && this.zze == sleepSegmentEvent.zze;
}
public int hashCode() {
return Objects.hashCode(Long.valueOf(this.zza), Long.valueOf(this.zzb), Integer.valueOf(this.zzc));
}
public String toString() {
long j = this.zza;
long j2 = this.zzb;
int i = this.zzc;
StringBuilder sb = new StringBuilder(84);
sb.append("startMillis=");
sb.append(j);
sb.append(", endMillis=");
sb.append(j2);
sb.append(", status=");
sb.append(i);
return sb.toString();
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
Preconditions.checkNotNull(parcel);
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
SafeParcelWriter.writeLong(parcel, 1, getStartTimeMillis());
SafeParcelWriter.writeLong(parcel, 2, getEndTimeMillis());
SafeParcelWriter.writeInt(parcel, 3, getStatus());
SafeParcelWriter.writeInt(parcel, 4, this.zzd);
SafeParcelWriter.writeInt(parcel, 5, this.zze);
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
}
public int getStatus() {
return this.zzc;
}
public long getStartTimeMillis() {
return this.zza;
}
public long getSegmentDurationMillis() {
return this.zzb - this.zza;
}
public long getEndTimeMillis() {
return this.zzb;
}
}