174 lines
6.1 KiB
Java
174 lines
6.1 KiB
Java
package com.google.android.gms.cloudmessaging;
|
|
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.util.Log;
|
|
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.firebase.messaging.Constants;
|
|
import java.lang.annotation.ElementType;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.annotation.Target;
|
|
import java.util.Map;
|
|
import s.j;
|
|
|
|
@SafeParcelable.Class(creator = "CloudMessageCreator")
|
|
/* loaded from: classes3.dex */
|
|
public final class CloudMessage extends AbstractSafeParcelable {
|
|
public static final Parcelable.Creator<CloudMessage> CREATOR = new zzb();
|
|
public static final int PRIORITY_HIGH = 1;
|
|
public static final int PRIORITY_NORMAL = 2;
|
|
public static final int PRIORITY_UNKNOWN = 0;
|
|
|
|
@SafeParcelable.Field(id = 1)
|
|
final Intent zza;
|
|
private Map zzb;
|
|
|
|
@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE})
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
/* loaded from: classes3.dex */
|
|
public @interface MessagePriority {
|
|
}
|
|
|
|
@SafeParcelable.Constructor
|
|
public CloudMessage(@SafeParcelable.Param(id = 1) Intent intent) {
|
|
this.zza = intent;
|
|
}
|
|
|
|
private static int zzb(String str) {
|
|
if (zza.zza(str, "high")) {
|
|
return 1;
|
|
}
|
|
return zza.zza(str, "normal") ? 2 : 0;
|
|
}
|
|
|
|
public String getCollapseKey() {
|
|
return this.zza.getStringExtra(Constants.MessagePayloadKeys.COLLAPSE_KEY);
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r1v0, types: [java.util.Map, s.j] */
|
|
public synchronized Map<String, String> getData() {
|
|
try {
|
|
if (this.zzb == null) {
|
|
Bundle extras = this.zza.getExtras();
|
|
?? jVar = new j(0);
|
|
if (extras != null) {
|
|
for (String str : extras.keySet()) {
|
|
Object obj = extras.get(str);
|
|
if (obj instanceof String) {
|
|
String str2 = (String) obj;
|
|
if (!str.startsWith(Constants.MessagePayloadKeys.RESERVED_PREFIX) && !str.equals(Constants.MessagePayloadKeys.FROM) && !str.equals(Constants.MessagePayloadKeys.MESSAGE_TYPE) && !str.equals(Constants.MessagePayloadKeys.COLLAPSE_KEY)) {
|
|
jVar.put(str, str2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.zzb = jVar;
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
return this.zzb;
|
|
}
|
|
|
|
public String getFrom() {
|
|
return this.zza.getStringExtra(Constants.MessagePayloadKeys.FROM);
|
|
}
|
|
|
|
public Intent getIntent() {
|
|
return this.zza;
|
|
}
|
|
|
|
public String getMessageId() {
|
|
String stringExtra = this.zza.getStringExtra(Constants.MessagePayloadKeys.MSGID);
|
|
return stringExtra == null ? this.zza.getStringExtra(Constants.MessagePayloadKeys.MSGID_SERVER) : stringExtra;
|
|
}
|
|
|
|
public String getMessageType() {
|
|
return this.zza.getStringExtra(Constants.MessagePayloadKeys.MESSAGE_TYPE);
|
|
}
|
|
|
|
public int getOriginalPriority() {
|
|
String stringExtra = this.zza.getStringExtra(Constants.MessagePayloadKeys.ORIGINAL_PRIORITY);
|
|
if (stringExtra == null) {
|
|
stringExtra = this.zza.getStringExtra(Constants.MessagePayloadKeys.PRIORITY_V19);
|
|
}
|
|
return zzb(stringExtra);
|
|
}
|
|
|
|
public int getPriority() {
|
|
String stringExtra = this.zza.getStringExtra(Constants.MessagePayloadKeys.DELIVERED_PRIORITY);
|
|
if (stringExtra == null) {
|
|
if (zza.zza(this.zza.getStringExtra(Constants.MessagePayloadKeys.PRIORITY_REDUCED_V19), "1")) {
|
|
return 2;
|
|
}
|
|
stringExtra = this.zza.getStringExtra(Constants.MessagePayloadKeys.PRIORITY_V19);
|
|
}
|
|
return zzb(stringExtra);
|
|
}
|
|
|
|
public byte[] getRawData() {
|
|
return this.zza.getByteArrayExtra(Constants.MessagePayloadKeys.RAW_DATA);
|
|
}
|
|
|
|
public String getSenderId() {
|
|
return this.zza.getStringExtra(Constants.MessagePayloadKeys.SENDER_ID);
|
|
}
|
|
|
|
public long getSentTime() {
|
|
Bundle extras = this.zza.getExtras();
|
|
Object obj = extras != null ? extras.get(Constants.MessagePayloadKeys.SENT_TIME) : null;
|
|
if (obj instanceof Long) {
|
|
return ((Long) obj).longValue();
|
|
}
|
|
if (!(obj instanceof String)) {
|
|
return 0L;
|
|
}
|
|
try {
|
|
return Long.parseLong((String) obj);
|
|
} catch (NumberFormatException unused) {
|
|
Log.w("CloudMessage", "Invalid sent time: ".concat(String.valueOf(obj)));
|
|
return 0L;
|
|
}
|
|
}
|
|
|
|
public String getTo() {
|
|
return this.zza.getStringExtra(Constants.MessagePayloadKeys.TO);
|
|
}
|
|
|
|
public int getTtl() {
|
|
Bundle extras = this.zza.getExtras();
|
|
Object obj = extras != null ? extras.get(Constants.MessagePayloadKeys.TTL) : null;
|
|
if (obj instanceof Integer) {
|
|
return ((Integer) obj).intValue();
|
|
}
|
|
if (!(obj instanceof String)) {
|
|
return 0;
|
|
}
|
|
try {
|
|
return Integer.parseInt((String) obj);
|
|
} catch (NumberFormatException unused) {
|
|
Log.w("CloudMessage", "Invalid TTL: ".concat(String.valueOf(obj)));
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
|
SafeParcelWriter.writeParcelable(parcel, 1, this.zza, i, false);
|
|
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
|
|
}
|
|
|
|
public final Integer zza() {
|
|
if (this.zza.hasExtra(Constants.MessagePayloadKeys.PRODUCT_ID)) {
|
|
return Integer.valueOf(this.zza.getIntExtra(Constants.MessagePayloadKeys.PRODUCT_ID, 0));
|
|
}
|
|
return null;
|
|
}
|
|
}
|