Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.util.concurrent.NamedThreadFactory;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.gms.tasks.Tasks;
|
||||
import com.google.firebase.messaging.Constants;
|
||||
import com.google.firebase.messaging.ServiceStarter;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class CloudMessagingReceiver extends BroadcastReceiver {
|
||||
private static SoftReference zza;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class IntentActionKeys {
|
||||
public static final String NOTIFICATION_DISMISS = "com.google.firebase.messaging.NOTIFICATION_DISMISS";
|
||||
public static final String NOTIFICATION_OPEN = "com.google.firebase.messaging.NOTIFICATION_OPEN";
|
||||
|
||||
private IntentActionKeys() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class IntentKeys {
|
||||
public static final String PENDING_INTENT = "pending_intent";
|
||||
public static final String WRAPPED_INTENT = "wrapped_intent";
|
||||
|
||||
private IntentKeys() {
|
||||
}
|
||||
}
|
||||
|
||||
private final int zzb(Context context, Intent intent) {
|
||||
Task zzc;
|
||||
if (intent.getExtras() == null) {
|
||||
return ServiceStarter.ERROR_UNKNOWN;
|
||||
}
|
||||
CloudMessage cloudMessage = new CloudMessage(intent);
|
||||
if (TextUtils.isEmpty(cloudMessage.getMessageId())) {
|
||||
zzc = Tasks.forResult(null);
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.MessagePayloadKeys.MSGID, cloudMessage.getMessageId());
|
||||
Integer zza2 = cloudMessage.zza();
|
||||
if (zza2 != null) {
|
||||
bundle.putInt(Constants.MessagePayloadKeys.PRODUCT_ID, zza2.intValue());
|
||||
}
|
||||
bundle.putBoolean("supports_message_handled", true);
|
||||
zzc = zzu.zzb(context).zzc(2, bundle);
|
||||
}
|
||||
int onMessageReceive = onMessageReceive(context, cloudMessage);
|
||||
try {
|
||||
Tasks.await(zzc, TimeUnit.SECONDS.toMillis(1L), TimeUnit.MILLISECONDS);
|
||||
return onMessageReceive;
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e4) {
|
||||
Log.w("CloudMessagingReceiver", "Message ack failed: ".concat(e4.toString()));
|
||||
return onMessageReceive;
|
||||
}
|
||||
}
|
||||
|
||||
private final int zzc(Context context, Intent intent) {
|
||||
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(IntentKeys.PENDING_INTENT);
|
||||
if (pendingIntent != null) {
|
||||
try {
|
||||
pendingIntent.send();
|
||||
} catch (PendingIntent.CanceledException unused) {
|
||||
Log.e("CloudMessagingReceiver", "Notification pending intent canceled");
|
||||
}
|
||||
}
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras != null) {
|
||||
extras.remove(IntentKeys.PENDING_INTENT);
|
||||
} else {
|
||||
extras = new Bundle();
|
||||
}
|
||||
String action = intent.getAction();
|
||||
if (action == IntentActionKeys.NOTIFICATION_DISMISS || (action != null && action.equals(IntentActionKeys.NOTIFICATION_DISMISS))) {
|
||||
onNotificationDismissed(context, extras);
|
||||
return -1;
|
||||
}
|
||||
Log.e("CloudMessagingReceiver", "Unknown notification action");
|
||||
return ServiceStarter.ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
public Executor getBroadcastExecutor() {
|
||||
ExecutorService executorService;
|
||||
synchronized (CloudMessagingReceiver.class) {
|
||||
try {
|
||||
SoftReference softReference = zza;
|
||||
executorService = softReference != null ? (ExecutorService) softReference.get() : null;
|
||||
if (executorService == null) {
|
||||
com.google.android.gms.internal.cloudmessaging.zze.zza();
|
||||
executorService = Executors.unconfigurableExecutorService(Executors.newCachedThreadPool(new NamedThreadFactory("firebase-iid-executor")));
|
||||
zza = new SoftReference(executorService);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
return executorService;
|
||||
}
|
||||
|
||||
public abstract int onMessageReceive(Context context, CloudMessage cloudMessage);
|
||||
|
||||
public void onNotificationDismissed(Context context, Bundle bundle) {
|
||||
}
|
||||
|
||||
@Override // android.content.BroadcastReceiver
|
||||
public final void onReceive(final Context context, final Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
final boolean isOrderedBroadcast = isOrderedBroadcast();
|
||||
final BroadcastReceiver.PendingResult goAsync = goAsync();
|
||||
getBroadcastExecutor().execute(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzf
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
CloudMessagingReceiver.this.zza(intent, context, isOrderedBroadcast, goAsync);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final /* synthetic */ void zza(Intent intent, Context context, boolean z3, BroadcastReceiver.PendingResult pendingResult) {
|
||||
try {
|
||||
Parcelable parcelableExtra = intent.getParcelableExtra(IntentKeys.WRAPPED_INTENT);
|
||||
Intent intent2 = parcelableExtra instanceof Intent ? (Intent) parcelableExtra : null;
|
||||
int zzc = intent2 != null ? zzc(context, intent2) : zzb(context, intent);
|
||||
if (z3) {
|
||||
pendingResult.setResultCode(zzc);
|
||||
}
|
||||
pendingResult.finish();
|
||||
} catch (Throwable th) {
|
||||
pendingResult.finish();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Message;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
interface IMessengerCompat extends IInterface {
|
||||
public static final String DESCRIPTOR = "com.google.android.gms.iid.IMessengerCompat";
|
||||
public static final int TRANSACTION_SEND = 1;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class Impl extends Binder implements IMessengerCompat {
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
@Override // android.os.Binder
|
||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i4) throws RemoteException {
|
||||
throw null;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.IMessengerCompat
|
||||
public void send(Message message) throws RemoteException {
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class Proxy implements IMessengerCompat {
|
||||
private final IBinder zza;
|
||||
|
||||
public Proxy(IBinder iBinder) {
|
||||
this.zza = iBinder;
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this.zza;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.IMessengerCompat
|
||||
public void send(Message message) throws RemoteException {
|
||||
Parcel obtain = Parcel.obtain();
|
||||
obtain.writeInterfaceToken(IMessengerCompat.DESCRIPTOR);
|
||||
obtain.writeInt(1);
|
||||
message.writeToParcel(obtain, 0);
|
||||
try {
|
||||
this.zza.transact(1, obtain, null, 1);
|
||||
} finally {
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void send(Message message) throws RemoteException;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class R {
|
||||
private R() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.tasks.Continuation;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.SuccessContinuation;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.android.gms.tasks.Tasks;
|
||||
import com.google.firebase.messaging.Constants;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import s.j;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class Rpc {
|
||||
private static int zza;
|
||||
private static PendingIntent zzb;
|
||||
private static final Executor zzc = new Executor() { // from class: com.google.android.gms.cloudmessaging.zzy
|
||||
@Override // java.util.concurrent.Executor
|
||||
public final void execute(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
};
|
||||
private static final Pattern zzd = Pattern.compile("\\|ID\\|([^|]+)\\|:?+(.*)");
|
||||
private final Context zzf;
|
||||
private final zzv zzg;
|
||||
private final ScheduledExecutorService zzh;
|
||||
private Messenger zzj;
|
||||
private zze zzk;
|
||||
private final j zze = new j(0);
|
||||
private final Messenger zzi = new Messenger(new zzad(this, Looper.getMainLooper()));
|
||||
|
||||
public Rpc(Context context) {
|
||||
this.zzf = context;
|
||||
this.zzg = new zzv(context);
|
||||
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
|
||||
scheduledThreadPoolExecutor.setKeepAliveTime(60L, TimeUnit.SECONDS);
|
||||
scheduledThreadPoolExecutor.allowCoreThreadTimeOut(true);
|
||||
this.zzh = scheduledThreadPoolExecutor;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Task zza(Bundle bundle) throws Exception {
|
||||
return zzi(bundle) ? Tasks.forResult(null) : Tasks.forResult(bundle);
|
||||
}
|
||||
|
||||
public static void zzc(Rpc rpc, Message message) {
|
||||
if (message != null) {
|
||||
Object obj = message.obj;
|
||||
if (obj instanceof Intent) {
|
||||
Intent intent = (Intent) obj;
|
||||
intent.setExtrasClassLoader(new zzd());
|
||||
if (intent.hasExtra("google.messenger")) {
|
||||
Parcelable parcelableExtra = intent.getParcelableExtra("google.messenger");
|
||||
if (parcelableExtra instanceof zze) {
|
||||
rpc.zzk = (zze) parcelableExtra;
|
||||
}
|
||||
if (parcelableExtra instanceof Messenger) {
|
||||
rpc.zzj = (Messenger) parcelableExtra;
|
||||
}
|
||||
}
|
||||
Intent intent2 = (Intent) message.obj;
|
||||
String action = intent2.getAction();
|
||||
if (!zzw.zza(action, "com.google.android.c2dm.intent.REGISTRATION")) {
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Unexpected response action: ".concat(String.valueOf(action)));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
String stringExtra = intent2.getStringExtra("registration_id");
|
||||
if (stringExtra == null) {
|
||||
stringExtra = intent2.getStringExtra("unregistered");
|
||||
}
|
||||
if (stringExtra != null) {
|
||||
Matcher matcher = zzd.matcher(stringExtra);
|
||||
if (!matcher.matches()) {
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Unexpected response string: ".concat(stringExtra));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
String group = matcher.group(1);
|
||||
String group2 = matcher.group(2);
|
||||
if (group != null) {
|
||||
Bundle extras = intent2.getExtras();
|
||||
extras.putString("registration_id", group2);
|
||||
rpc.zzh(group, extras);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
String stringExtra2 = intent2.getStringExtra(Constants.IPC_BUNDLE_KEY_SEND_ERROR);
|
||||
if (stringExtra2 == null) {
|
||||
Log.w("Rpc", "Unexpected response, no error or registration id ".concat(String.valueOf(intent2.getExtras())));
|
||||
return;
|
||||
}
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Received InstanceID error ".concat(stringExtra2));
|
||||
}
|
||||
if (!stringExtra2.startsWith("|")) {
|
||||
synchronized (rpc.zze) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
try {
|
||||
j jVar = rpc.zze;
|
||||
if (i < jVar.f8352c) {
|
||||
rpc.zzh((String) jVar.f(i), intent2.getExtras());
|
||||
i++;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
String[] split = stringExtra2.split("\\|");
|
||||
if (split.length <= 2 || !zzw.zza(split[1], "ID")) {
|
||||
Log.w("Rpc", "Unexpected structured response ".concat(stringExtra2));
|
||||
return;
|
||||
}
|
||||
String str = split[2];
|
||||
String str2 = split[3];
|
||||
if (str2.startsWith(":")) {
|
||||
str2 = str2.substring(1);
|
||||
}
|
||||
rpc.zzh(str, intent2.putExtra(Constants.IPC_BUNDLE_KEY_SEND_ERROR, str2).getExtras());
|
||||
return;
|
||||
}
|
||||
}
|
||||
Log.w("Rpc", "Dropping invalid message");
|
||||
}
|
||||
|
||||
private final Task zze(Bundle bundle) {
|
||||
final String zzf = zzf();
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
synchronized (this.zze) {
|
||||
this.zze.put(zzf, taskCompletionSource);
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setPackage("com.google.android.gms");
|
||||
if (this.zzg.zzb() == 2) {
|
||||
intent.setAction("com.google.iid.TOKEN_REQUEST");
|
||||
} else {
|
||||
intent.setAction("com.google.android.c2dm.intent.REGISTER");
|
||||
}
|
||||
intent.putExtras(bundle);
|
||||
zzg(this.zzf, intent);
|
||||
intent.putExtra("kid", "|ID|" + zzf + "|");
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Sending ".concat(String.valueOf(intent.getExtras())));
|
||||
}
|
||||
intent.putExtra("google.messenger", this.zzi);
|
||||
if (this.zzj != null || this.zzk != null) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.obj = intent;
|
||||
try {
|
||||
Messenger messenger = this.zzj;
|
||||
if (messenger != null) {
|
||||
messenger.send(obtain);
|
||||
} else {
|
||||
this.zzk.zzb(obtain);
|
||||
}
|
||||
} catch (RemoteException unused) {
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Messenger failed, fallback to startService");
|
||||
}
|
||||
}
|
||||
final ScheduledFuture<?> schedule = this.zzh.schedule(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzab
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
if (TaskCompletionSource.this.trySetException(new IOException("TIMEOUT"))) {
|
||||
Log.w("Rpc", "No response");
|
||||
}
|
||||
}
|
||||
}, 30L, TimeUnit.SECONDS);
|
||||
taskCompletionSource.getTask().addOnCompleteListener(zzc, new OnCompleteListener() { // from class: com.google.android.gms.cloudmessaging.zzac
|
||||
@Override // com.google.android.gms.tasks.OnCompleteListener
|
||||
public final void onComplete(Task task) {
|
||||
Rpc.this.zzd(zzf, schedule, task);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
if (this.zzg.zzb() == 2) {
|
||||
this.zzf.sendBroadcast(intent);
|
||||
} else {
|
||||
this.zzf.startService(intent);
|
||||
}
|
||||
final ScheduledFuture schedule2 = this.zzh.schedule(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzab
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
if (TaskCompletionSource.this.trySetException(new IOException("TIMEOUT"))) {
|
||||
Log.w("Rpc", "No response");
|
||||
}
|
||||
}
|
||||
}, 30L, TimeUnit.SECONDS);
|
||||
taskCompletionSource.getTask().addOnCompleteListener(zzc, new OnCompleteListener() { // from class: com.google.android.gms.cloudmessaging.zzac
|
||||
@Override // com.google.android.gms.tasks.OnCompleteListener
|
||||
public final void onComplete(Task task) {
|
||||
Rpc.this.zzd(zzf, schedule2, task);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
private static synchronized String zzf() {
|
||||
String num;
|
||||
synchronized (Rpc.class) {
|
||||
int i = zza;
|
||||
zza = i + 1;
|
||||
num = Integer.toString(i);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static synchronized void zzg(Context context, Intent intent) {
|
||||
synchronized (Rpc.class) {
|
||||
try {
|
||||
if (zzb == null) {
|
||||
Intent intent2 = new Intent();
|
||||
intent2.setPackage("com.google.example.invalidpackage");
|
||||
zzb = PendingIntent.getBroadcast(context, 0, intent2, com.google.android.gms.internal.cloudmessaging.zza.zza);
|
||||
}
|
||||
intent.putExtra("app", zzb);
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void zzh(String str, Bundle bundle) {
|
||||
synchronized (this.zze) {
|
||||
try {
|
||||
TaskCompletionSource taskCompletionSource = (TaskCompletionSource) this.zze.remove(str);
|
||||
if (taskCompletionSource != null) {
|
||||
taskCompletionSource.setResult(bundle);
|
||||
return;
|
||||
}
|
||||
Log.w("Rpc", "Missing callback for " + str);
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean zzi(Bundle bundle) {
|
||||
return bundle != null && bundle.containsKey("google.messenger");
|
||||
}
|
||||
|
||||
public Task<Void> messageHandled(CloudMessage cloudMessage) {
|
||||
if (this.zzg.zza() < 233700000) {
|
||||
return Tasks.forException(new IOException("SERVICE_NOT_AVAILABLE"));
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.MessagePayloadKeys.MSGID, cloudMessage.getMessageId());
|
||||
Integer zza2 = cloudMessage.zza();
|
||||
if (zza2 != null) {
|
||||
bundle.putInt(Constants.MessagePayloadKeys.PRODUCT_ID, zza2.intValue());
|
||||
}
|
||||
return zzu.zzb(this.zzf).zzc(3, bundle);
|
||||
}
|
||||
|
||||
public Task<Bundle> send(final Bundle bundle) {
|
||||
return this.zzg.zza() < 12000000 ? this.zzg.zzb() != 0 ? zze(bundle).continueWithTask(zzc, new Continuation() { // from class: com.google.android.gms.cloudmessaging.zzz
|
||||
@Override // com.google.android.gms.tasks.Continuation
|
||||
public final Object then(Task task) {
|
||||
return Rpc.this.zzb(bundle, task);
|
||||
}
|
||||
}) : Tasks.forException(new IOException("MISSING_INSTANCEID_SERVICE")) : zzu.zzb(this.zzf).zzd(1, bundle).continueWith(zzc, new Continuation() { // from class: com.google.android.gms.cloudmessaging.zzaa
|
||||
@Override // com.google.android.gms.tasks.Continuation
|
||||
public final Object then(Task task) {
|
||||
if (task.isSuccessful()) {
|
||||
return (Bundle) task.getResult();
|
||||
}
|
||||
if (Log.isLoggable("Rpc", 3)) {
|
||||
Log.d("Rpc", "Error making request: ".concat(String.valueOf(task.getException())));
|
||||
}
|
||||
throw new IOException("SERVICE_NOT_AVAILABLE", task.getException());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final /* synthetic */ Task zzb(Bundle bundle, Task task) throws Exception {
|
||||
return (task.isSuccessful() && zzi((Bundle) task.getResult())) ? zze(bundle).onSuccessTask(zzc, new SuccessContinuation() { // from class: com.google.android.gms.cloudmessaging.zzx
|
||||
@Override // com.google.android.gms.tasks.SuccessContinuation
|
||||
public final Task then(Object obj) {
|
||||
return Rpc.zza((Bundle) obj);
|
||||
}
|
||||
}) : task;
|
||||
}
|
||||
|
||||
public final /* synthetic */ void zzd(String str, ScheduledFuture scheduledFuture, Task task) {
|
||||
synchronized (this.zze) {
|
||||
this.zze.remove(str);
|
||||
}
|
||||
scheduledFuture.cancel(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class zza {
|
||||
public static /* synthetic */ boolean zza(Object obj, Object obj2) {
|
||||
if (obj != obj2) {
|
||||
return obj != null && obj.equals(obj2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class zzad extends com.google.android.gms.internal.cloudmessaging.zzf {
|
||||
final /* synthetic */ Rpc zza;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public zzad(Rpc rpc, Looper looper) {
|
||||
super(looper);
|
||||
this.zza = rpc;
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public final void handleMessage(Message message) {
|
||||
Rpc.zzc(this.zza, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzb implements Parcelable.Creator {
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ Object createFromParcel(Parcel parcel) {
|
||||
int validateObjectHeader = SafeParcelReader.validateObjectHeader(parcel);
|
||||
Intent intent = null;
|
||||
while (parcel.dataPosition() < validateObjectHeader) {
|
||||
int readHeader = SafeParcelReader.readHeader(parcel);
|
||||
if (SafeParcelReader.getFieldId(readHeader) != 1) {
|
||||
SafeParcelReader.skipUnknownField(parcel, readHeader);
|
||||
} else {
|
||||
intent = (Intent) SafeParcelReader.createParcelable(parcel, readHeader, Intent.CREATOR);
|
||||
}
|
||||
}
|
||||
SafeParcelReader.ensureAtEnd(parcel, validateObjectHeader);
|
||||
return new CloudMessage(intent);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ Object[] newArray(int i) {
|
||||
return new CloudMessage[i];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class zzc implements Parcelable.Creator {
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ Object createFromParcel(Parcel parcel) {
|
||||
return new zze(parcel.readStrongBinder());
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ Object[] newArray(int i) {
|
||||
return new zze[i];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzd extends ClassLoader {
|
||||
@Override // java.lang.ClassLoader
|
||||
public final Class loadClass(String str, boolean z3) throws ClassNotFoundException {
|
||||
if (str != "com.google.android.gms.iid.MessengerCompat" && (str == null || !str.equals("com.google.android.gms.iid.MessengerCompat"))) {
|
||||
return super.loadClass(str, z3);
|
||||
}
|
||||
if (!Log.isLoggable("CloudMessengerCompat", 3)) {
|
||||
return zze.class;
|
||||
}
|
||||
Log.d("CloudMessengerCompat", "Using renamed FirebaseIidMessengerCompat class");
|
||||
return zze.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zze implements Parcelable {
|
||||
public static final Parcelable.Creator<zze> CREATOR = new zzc();
|
||||
Messenger zza;
|
||||
IMessengerCompat zzb;
|
||||
|
||||
public zze(IBinder iBinder) {
|
||||
this.zza = new Messenger(iBinder);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public final int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return zza().equals(((zze) obj).zza());
|
||||
} catch (ClassCastException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return zza().hashCode();
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public final void writeToParcel(Parcel parcel, int i) {
|
||||
Messenger messenger = this.zza;
|
||||
if (messenger != null) {
|
||||
parcel.writeStrongBinder(messenger.getBinder());
|
||||
} else {
|
||||
parcel.writeStrongBinder(this.zzb.asBinder());
|
||||
}
|
||||
}
|
||||
|
||||
public final IBinder zza() {
|
||||
Messenger messenger = this.zza;
|
||||
return messenger != null ? messenger.getBinder() : this.zzb.asBinder();
|
||||
}
|
||||
|
||||
public final void zzb(Message message) throws RemoteException {
|
||||
Messenger messenger = this.zza;
|
||||
if (messenger != null) {
|
||||
messenger.send(message);
|
||||
} else {
|
||||
this.zzb.send(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.common.stats.ConnectionTracker;
|
||||
import com.google.firebase.messaging.Constants;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Iterator;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzn implements ServiceConnection {
|
||||
zzp zzc;
|
||||
final /* synthetic */ zzu zzf;
|
||||
int zza = 0;
|
||||
final Messenger zzb = new Messenger(new com.google.android.gms.internal.cloudmessaging.zzf(Looper.getMainLooper(), new Handler.Callback() { // from class: com.google.android.gms.cloudmessaging.zzk
|
||||
@Override // android.os.Handler.Callback
|
||||
public final boolean handleMessage(Message message) {
|
||||
int i = message.arg1;
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Received response to request: " + i);
|
||||
}
|
||||
zzn zznVar = zzn.this;
|
||||
synchronized (zznVar) {
|
||||
try {
|
||||
zzr zzrVar = (zzr) zznVar.zze.get(i);
|
||||
if (zzrVar == null) {
|
||||
Log.w("MessengerIpcClient", "Received response for unknown request: " + i);
|
||||
return true;
|
||||
}
|
||||
zznVar.zze.remove(i);
|
||||
zznVar.zzf();
|
||||
Bundle data = message.getData();
|
||||
if (data.getBoolean("unsupported", false)) {
|
||||
zzrVar.zzc(new zzs(4, "Not supported by GmsCore", null));
|
||||
return true;
|
||||
}
|
||||
zzrVar.zza(data);
|
||||
return true;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
final Queue zzd = new ArrayDeque();
|
||||
final SparseArray zze = new SparseArray();
|
||||
|
||||
public /* synthetic */ zzn(zzu zzuVar, zzm zzmVar) {
|
||||
this.zzf = zzuVar;
|
||||
}
|
||||
|
||||
@Override // android.content.ServiceConnection
|
||||
public final void onServiceConnected(ComponentName componentName, final IBinder iBinder) {
|
||||
if (Log.isLoggable("MessengerIpcClient", 2)) {
|
||||
Log.v("MessengerIpcClient", "Service connected");
|
||||
}
|
||||
zzu.zze(this.zzf).execute(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzg
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
zzn zznVar = zzn.this;
|
||||
IBinder iBinder2 = iBinder;
|
||||
synchronized (zznVar) {
|
||||
if (iBinder2 == null) {
|
||||
zznVar.zza(0, "Null service connection");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
zznVar.zzc = new zzp(iBinder2);
|
||||
zznVar.zza = 2;
|
||||
zznVar.zzc();
|
||||
} catch (RemoteException e4) {
|
||||
zznVar.zza(0, e4.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.content.ServiceConnection
|
||||
public final void onServiceDisconnected(ComponentName componentName) {
|
||||
if (Log.isLoggable("MessengerIpcClient", 2)) {
|
||||
Log.v("MessengerIpcClient", "Service disconnected");
|
||||
}
|
||||
zzu.zze(this.zzf).execute(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzj
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
zzn.this.zza(2, "Service disconnected");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final synchronized void zza(int i, String str) {
|
||||
zzb(i, str, null);
|
||||
}
|
||||
|
||||
public final synchronized void zzb(int i, String str, Throwable th) {
|
||||
try {
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Disconnected: ".concat(String.valueOf(str)));
|
||||
}
|
||||
int i4 = this.zza;
|
||||
if (i4 == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (i4 != 1 && i4 != 2) {
|
||||
if (i4 != 3) {
|
||||
return;
|
||||
}
|
||||
this.zza = 4;
|
||||
return;
|
||||
}
|
||||
if (Log.isLoggable("MessengerIpcClient", 2)) {
|
||||
Log.v("MessengerIpcClient", "Unbinding service");
|
||||
}
|
||||
this.zza = 4;
|
||||
ConnectionTracker.getInstance().unbindService(zzu.zza(this.zzf), this);
|
||||
zzs zzsVar = new zzs(i, str, th);
|
||||
Iterator it = this.zzd.iterator();
|
||||
while (it.hasNext()) {
|
||||
((zzr) it.next()).zzc(zzsVar);
|
||||
}
|
||||
this.zzd.clear();
|
||||
for (int i5 = 0; i5 < this.zze.size(); i5++) {
|
||||
((zzr) this.zze.valueAt(i5)).zzc(zzsVar);
|
||||
}
|
||||
this.zze.clear();
|
||||
} catch (Throwable th2) {
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
|
||||
public final void zzc() {
|
||||
zzu.zze(this.zzf).execute(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzh
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
final zzr zzrVar;
|
||||
while (true) {
|
||||
final zzn zznVar = zzn.this;
|
||||
synchronized (zznVar) {
|
||||
try {
|
||||
if (zznVar.zza != 2) {
|
||||
return;
|
||||
}
|
||||
if (zznVar.zzd.isEmpty()) {
|
||||
zznVar.zzf();
|
||||
return;
|
||||
} else {
|
||||
zzrVar = (zzr) zznVar.zzd.poll();
|
||||
zznVar.zze.put(zzrVar.zza, zzrVar);
|
||||
zzu.zze(zznVar.zzf).schedule(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzl
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
zzn.this.zze(zzrVar.zza);
|
||||
}
|
||||
}, 30L, TimeUnit.SECONDS);
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Sending ".concat(String.valueOf(zzrVar)));
|
||||
}
|
||||
zzu zzuVar = zznVar.zzf;
|
||||
Messenger messenger = zznVar.zzb;
|
||||
int i = zzrVar.zzc;
|
||||
Context zza = zzu.zza(zzuVar);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = i;
|
||||
obtain.arg1 = zzrVar.zza;
|
||||
obtain.replyTo = messenger;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("oneWay", zzrVar.zzb());
|
||||
bundle.putString("pkg", zza.getPackageName());
|
||||
bundle.putBundle(Constants.ScionAnalytics.MessageType.DATA_MESSAGE, zzrVar.zzd);
|
||||
obtain.setData(bundle);
|
||||
try {
|
||||
zznVar.zzc.zza(obtain);
|
||||
} catch (RemoteException e4) {
|
||||
zznVar.zza(2, e4.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final synchronized void zzd() {
|
||||
if (this.zza == 1) {
|
||||
zza(1, "Timed out while binding");
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void zze(int i) {
|
||||
zzr zzrVar = (zzr) this.zze.get(i);
|
||||
if (zzrVar != null) {
|
||||
Log.w("MessengerIpcClient", "Timing out request: " + i);
|
||||
this.zze.remove(i);
|
||||
zzrVar.zzc(new zzs(3, "Timed out waiting for response", null));
|
||||
zzf();
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void zzf() {
|
||||
try {
|
||||
if (this.zza == 2 && this.zzd.isEmpty() && this.zze.size() == 0) {
|
||||
if (Log.isLoggable("MessengerIpcClient", 2)) {
|
||||
Log.v("MessengerIpcClient", "Finished handling requests, unbinding");
|
||||
}
|
||||
this.zza = 3;
|
||||
ConnectionTracker.getInstance().unbindService(zzu.zza(this.zzf), this);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized boolean zzg(zzr zzrVar) {
|
||||
int i = this.zza;
|
||||
if (i != 0) {
|
||||
if (i == 1) {
|
||||
this.zzd.add(zzrVar);
|
||||
return true;
|
||||
}
|
||||
if (i != 2) {
|
||||
return false;
|
||||
}
|
||||
this.zzd.add(zzrVar);
|
||||
zzc();
|
||||
return true;
|
||||
}
|
||||
this.zzd.add(zzrVar);
|
||||
Preconditions.checkState(this.zza == 0);
|
||||
if (Log.isLoggable("MessengerIpcClient", 2)) {
|
||||
Log.v("MessengerIpcClient", "Starting bind to GmsCore");
|
||||
}
|
||||
this.zza = 1;
|
||||
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
|
||||
intent.setPackage("com.google.android.gms");
|
||||
try {
|
||||
if (ConnectionTracker.getInstance().bindService(zzu.zza(this.zzf), intent, this, 1)) {
|
||||
zzu.zze(this.zzf).schedule(new Runnable() { // from class: com.google.android.gms.cloudmessaging.zzi
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
zzn.this.zzd();
|
||||
}
|
||||
}, 30L, TimeUnit.SECONDS);
|
||||
} else {
|
||||
zza(0, "Unable to bind to service");
|
||||
}
|
||||
} catch (SecurityException e4) {
|
||||
zzb(0, "Unable to bind to service", e4);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class zzo {
|
||||
public static /* synthetic */ boolean zza(Object obj, Object obj2) {
|
||||
if (obj != obj2) {
|
||||
return obj != null && obj.equals(obj2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class zzp {
|
||||
private final Messenger zza;
|
||||
private final zze zzb;
|
||||
|
||||
public zzp(IBinder iBinder) throws RemoteException {
|
||||
String interfaceDescriptor = iBinder.getInterfaceDescriptor();
|
||||
if (zzo.zza(interfaceDescriptor, "android.os.IMessenger")) {
|
||||
this.zza = new Messenger(iBinder);
|
||||
this.zzb = null;
|
||||
} else {
|
||||
if (!zzo.zza(interfaceDescriptor, IMessengerCompat.DESCRIPTOR)) {
|
||||
Log.w("MessengerIpcClient", "Invalid interface descriptor: ".concat(String.valueOf(interfaceDescriptor)));
|
||||
throw new RemoteException();
|
||||
}
|
||||
this.zzb = new zze(iBinder);
|
||||
this.zza = null;
|
||||
}
|
||||
}
|
||||
|
||||
public final void zza(Message message) throws RemoteException {
|
||||
Messenger messenger = this.zza;
|
||||
if (messenger != null) {
|
||||
messenger.send(message);
|
||||
return;
|
||||
}
|
||||
zze zzeVar = this.zzb;
|
||||
if (zzeVar == null) {
|
||||
throw new IllegalStateException("Both messengers are null");
|
||||
}
|
||||
zzeVar.zzb(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class zzq extends zzr {
|
||||
public zzq(int i, int i4, Bundle bundle) {
|
||||
super(i, i4, bundle);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.zzr
|
||||
public final void zza(Bundle bundle) {
|
||||
if (bundle.getBoolean("ack", false)) {
|
||||
zzd(null);
|
||||
} else {
|
||||
zzc(new zzs(4, "Invalid response to one way request", null));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.zzr
|
||||
public final boolean zzb() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class zzr {
|
||||
final int zza;
|
||||
final TaskCompletionSource zzb = new TaskCompletionSource();
|
||||
final int zzc;
|
||||
final Bundle zzd;
|
||||
|
||||
public zzr(int i, int i4, Bundle bundle) {
|
||||
this.zza = i;
|
||||
this.zzc = i4;
|
||||
this.zzd = bundle;
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return "Request { what=" + this.zzc + " id=" + this.zza + " oneWay=" + zzb() + "}";
|
||||
}
|
||||
|
||||
public abstract void zza(Bundle bundle);
|
||||
|
||||
public abstract boolean zzb();
|
||||
|
||||
public final void zzc(zzs zzsVar) {
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Failing " + toString() + " with " + zzsVar.toString());
|
||||
}
|
||||
this.zzb.setException(zzsVar);
|
||||
}
|
||||
|
||||
public final void zzd(Object obj) {
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Finishing " + toString() + " with " + String.valueOf(obj));
|
||||
}
|
||||
this.zzb.setResult(obj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzs extends Exception {
|
||||
public zzs(int i, String str, Throwable th) {
|
||||
super(str, th);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.google.firebase.messaging.Constants;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class zzt extends zzr {
|
||||
public zzt(int i, int i4, Bundle bundle) {
|
||||
super(i, 1, bundle);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.zzr
|
||||
public final void zza(Bundle bundle) {
|
||||
Bundle bundle2 = bundle.getBundle(Constants.ScionAnalytics.MessageType.DATA_MESSAGE);
|
||||
if (bundle2 == null) {
|
||||
bundle2 = Bundle.EMPTY;
|
||||
}
|
||||
zzd(bundle2);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.cloudmessaging.zzr
|
||||
public final boolean zzb() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.util.concurrent.NamedThreadFactory;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzu {
|
||||
private static zzu zza;
|
||||
private final Context zzb;
|
||||
private final ScheduledExecutorService zzc;
|
||||
private zzn zzd = new zzn(this, null);
|
||||
private int zze = 1;
|
||||
|
||||
public zzu(Context context, ScheduledExecutorService scheduledExecutorService) {
|
||||
this.zzc = scheduledExecutorService;
|
||||
this.zzb = context.getApplicationContext();
|
||||
}
|
||||
|
||||
public static /* bridge */ /* synthetic */ Context zza(zzu zzuVar) {
|
||||
return zzuVar.zzb;
|
||||
}
|
||||
|
||||
public static synchronized zzu zzb(Context context) {
|
||||
zzu zzuVar;
|
||||
synchronized (zzu.class) {
|
||||
try {
|
||||
if (zza == null) {
|
||||
com.google.android.gms.internal.cloudmessaging.zze.zza();
|
||||
zza = new zzu(context, Executors.unconfigurableScheduledExecutorService(Executors.newScheduledThreadPool(1, new NamedThreadFactory("MessengerIpcClient"))));
|
||||
}
|
||||
zzuVar = zza;
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
return zzuVar;
|
||||
}
|
||||
|
||||
public static /* bridge */ /* synthetic */ ScheduledExecutorService zze(zzu zzuVar) {
|
||||
return zzuVar.zzc;
|
||||
}
|
||||
|
||||
private final synchronized int zzf() {
|
||||
int i;
|
||||
i = this.zze;
|
||||
this.zze = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
private final synchronized Task zzg(zzr zzrVar) {
|
||||
try {
|
||||
if (Log.isLoggable("MessengerIpcClient", 3)) {
|
||||
Log.d("MessengerIpcClient", "Queueing ".concat(zzrVar.toString()));
|
||||
}
|
||||
if (!this.zzd.zzg(zzrVar)) {
|
||||
zzn zznVar = new zzn(this, null);
|
||||
this.zzd = zznVar;
|
||||
zznVar.zzg(zzrVar);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
return zzrVar.zzb.getTask();
|
||||
}
|
||||
|
||||
public final Task zzc(int i, Bundle bundle) {
|
||||
return zzg(new zzq(zzf(), i, bundle));
|
||||
}
|
||||
|
||||
public final Task zzd(int i, Bundle bundle) {
|
||||
return zzg(new zzt(zzf(), 1, bundle));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.util.PlatformVersion;
|
||||
import com.google.android.gms.common.wrappers.Wrappers;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class zzv {
|
||||
private final Context zza;
|
||||
private int zzb;
|
||||
private int zzc = 0;
|
||||
|
||||
public zzv(Context context) {
|
||||
this.zza = context;
|
||||
}
|
||||
|
||||
public final synchronized int zza() {
|
||||
PackageInfo packageInfo;
|
||||
if (this.zzb == 0) {
|
||||
try {
|
||||
packageInfo = Wrappers.packageManager(this.zza).getPackageInfo("com.google.android.gms", 0);
|
||||
} catch (PackageManager.NameNotFoundException e4) {
|
||||
Log.w("Metadata", "Failed to find package ".concat(e4.toString()));
|
||||
packageInfo = null;
|
||||
}
|
||||
if (packageInfo != null) {
|
||||
this.zzb = packageInfo.versionCode;
|
||||
}
|
||||
}
|
||||
return this.zzb;
|
||||
}
|
||||
|
||||
public final synchronized int zzb() {
|
||||
int i = this.zzc;
|
||||
if (i != 0) {
|
||||
return i;
|
||||
}
|
||||
Context context = this.zza;
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (Wrappers.packageManager(context).checkPermission("com.google.android.c2dm.permission.SEND", "com.google.android.gms") == -1) {
|
||||
Log.e("Metadata", "Google Play services missing or without correct permission.");
|
||||
return 0;
|
||||
}
|
||||
int i4 = 1;
|
||||
if (!PlatformVersion.isAtLeastO()) {
|
||||
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
|
||||
intent.setPackage("com.google.android.gms");
|
||||
List<ResolveInfo> queryIntentServices = packageManager.queryIntentServices(intent, 0);
|
||||
if (queryIntentServices != null && !queryIntentServices.isEmpty()) {
|
||||
this.zzc = i4;
|
||||
return i4;
|
||||
}
|
||||
}
|
||||
Intent intent2 = new Intent("com.google.iid.TOKEN_REQUEST");
|
||||
intent2.setPackage("com.google.android.gms");
|
||||
List<ResolveInfo> queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent2, 0);
|
||||
if (queryBroadcastReceivers != null && !queryBroadcastReceivers.isEmpty()) {
|
||||
i4 = 2;
|
||||
this.zzc = i4;
|
||||
return i4;
|
||||
}
|
||||
Log.w("Metadata", "Failed to resolve IID implementation package, falling back");
|
||||
if (true == PlatformVersion.isAtLeastO()) {
|
||||
i4 = 2;
|
||||
}
|
||||
this.zzc = i4;
|
||||
return i4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.google.android.gms.cloudmessaging;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class zzw {
|
||||
public static /* synthetic */ boolean zza(Object obj, Object obj2) {
|
||||
if (obj != obj2) {
|
||||
return obj != null && obj.equals(obj2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user