113 lines
4.5 KiB
Java
113 lines
4.5 KiB
Java
package c.i.a.f.d;
|
|
|
|
import android.app.PendingIntent;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.WorkerThread;
|
|
import c.i.a.f.e.o.c;
|
|
import c.i.c.s.f;
|
|
import com.google.android.gms.cloudmessaging.CloudMessage;
|
|
import com.google.android.gms.tasks.Task;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeoutException;
|
|
/* compiled from: com.google.android.gms:play-services-cloud-messaging@@16.0.0 */
|
|
public abstract class a extends BroadcastReceiver {
|
|
public final ExecutorService a;
|
|
|
|
public a() {
|
|
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), new c.i.a.f.e.o.j.a("firebase-iid-executor"));
|
|
threadPoolExecutor.allowCoreThreadTimeOut(true);
|
|
this.a = Executors.unconfigurableExecutorService(threadPoolExecutor);
|
|
}
|
|
|
|
@WorkerThread
|
|
public final int a(@NonNull Context context, @NonNull Intent intent) {
|
|
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra("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("pending_intent");
|
|
} else {
|
|
extras = new Bundle();
|
|
}
|
|
if ("com.google.firebase.messaging.NOTIFICATION_OPEN".equals(intent.getAction())) {
|
|
try {
|
|
c.c(new f(context).b(new Intent("com.google.firebase.messaging.NOTIFICATION_OPEN").putExtras(extras)));
|
|
return -1;
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
Log.e("FirebaseInstanceId", "Failed to send notification open event to service.", e);
|
|
return -1;
|
|
}
|
|
} else if ("com.google.firebase.messaging.NOTIFICATION_DISMISS".equals(intent.getAction())) {
|
|
try {
|
|
c.c(new f(context).b(new Intent("com.google.firebase.messaging.NOTIFICATION_DISMISS").putExtras(extras)));
|
|
return -1;
|
|
} catch (InterruptedException | ExecutionException e2) {
|
|
Log.e("FirebaseInstanceId", "Failed to send notification dismissed event to service.", e2);
|
|
return -1;
|
|
}
|
|
} else {
|
|
Log.e("CloudMessagingReceiver", "Unknown notification action");
|
|
return 500;
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final int b(@NonNull Context context, @NonNull Intent intent) {
|
|
Task task;
|
|
int i;
|
|
int i2 = 500;
|
|
if (intent.getExtras() == null) {
|
|
return 500;
|
|
}
|
|
String stringExtra = intent.getStringExtra("google.message_id");
|
|
if (TextUtils.isEmpty(stringExtra)) {
|
|
task = c.F(null);
|
|
} else {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString("google.message_id", stringExtra);
|
|
f a = f.a(context);
|
|
synchronized (a) {
|
|
i = a.e;
|
|
a.e = i + 1;
|
|
}
|
|
task = a.b(new o(i, bundle));
|
|
}
|
|
try {
|
|
i2 = ((Integer) c.c(new f(context).b(new CloudMessage(intent).i))).intValue();
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
Log.e("FirebaseInstanceId", "Failed to send message to service.", e);
|
|
}
|
|
try {
|
|
c.d(task, TimeUnit.SECONDS.toMillis(1), TimeUnit.MILLISECONDS);
|
|
} catch (InterruptedException | ExecutionException | TimeoutException e2) {
|
|
String valueOf = String.valueOf(e2);
|
|
c.d.b.a.a.Y(valueOf.length() + 20, "Message ack failed: ", valueOf, "CloudMessagingReceiver");
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
@Override // android.content.BroadcastReceiver
|
|
public final void onReceive(@NonNull Context context, @NonNull Intent intent) {
|
|
if (intent != null) {
|
|
this.a.execute(new e(this, intent, context, isOrderedBroadcast(), goAsync()));
|
|
}
|
|
}
|
|
}
|