- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
166 lines
5.7 KiB
Java
166 lines
5.7 KiB
Java
package com.google.firebase.messaging;
|
|
|
|
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.VisibleForTesting;
|
|
import androidx.annotation.WorkerThread;
|
|
import com.google.android.gms.cloudmessaging.CloudMessage;
|
|
import com.google.android.gms.cloudmessaging.Rpc;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Queue;
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class FirebaseMessagingService extends EnhancedIntentService {
|
|
public static final String ACTION_DIRECT_BOOT_REMOTE_INTENT = "com.google.firebase.messaging.RECEIVE_DIRECT_BOOT";
|
|
static final String ACTION_NEW_TOKEN = "com.google.firebase.messaging.NEW_TOKEN";
|
|
static final String ACTION_REMOTE_INTENT = "com.google.android.c2dm.intent.RECEIVE";
|
|
static final String EXTRA_TOKEN = "token";
|
|
private static final int RECENTLY_RECEIVED_MESSAGE_IDS_MAX_SIZE = 10;
|
|
private static final Queue<String> recentlyReceivedMessageIds = new ArrayDeque(10);
|
|
private Rpc rpc;
|
|
|
|
@WorkerThread
|
|
public void onDeletedMessages() {
|
|
}
|
|
|
|
public void onMessageReceived(RemoteMessage remoteMessage) {
|
|
}
|
|
|
|
@WorkerThread
|
|
public void onMessageSent(@NonNull String str) {
|
|
}
|
|
|
|
public void onNewToken(String str) {
|
|
}
|
|
|
|
@WorkerThread
|
|
public void onSendError(@NonNull String str, @NonNull Exception exc) {
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public void setRpcForTesting(Rpc rpc) {
|
|
this.rpc = rpc;
|
|
}
|
|
|
|
@Override // com.google.firebase.messaging.EnhancedIntentService
|
|
public Intent getStartCommandIntent(Intent intent) {
|
|
return ServiceStarter.getInstance().getMessagingEvent();
|
|
}
|
|
|
|
@Override // com.google.firebase.messaging.EnhancedIntentService
|
|
public void handleIntent(Intent intent) {
|
|
String action = intent.getAction();
|
|
if (ACTION_REMOTE_INTENT.equals(action) || ACTION_DIRECT_BOOT_REMOTE_INTENT.equals(action)) {
|
|
handleMessageIntent(intent);
|
|
} else {
|
|
if (ACTION_NEW_TOKEN.equals(action)) {
|
|
onNewToken(intent.getStringExtra("token"));
|
|
return;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Unknown intent action: ");
|
|
sb.append(intent.getAction());
|
|
}
|
|
}
|
|
|
|
public final void handleMessageIntent(Intent intent) {
|
|
if (!alreadyReceivedMessage(intent.getStringExtra("google.message_id"))) {
|
|
passMessageIntentToSdk(intent);
|
|
}
|
|
getRpc(this).messageHandled(new CloudMessage(intent));
|
|
}
|
|
|
|
public final void passMessageIntentToSdk(Intent intent) {
|
|
String stringExtra;
|
|
stringExtra = intent.getStringExtra("message_type");
|
|
if (stringExtra == null) {
|
|
stringExtra = "gcm";
|
|
}
|
|
switch (stringExtra) {
|
|
case "deleted_messages":
|
|
onDeletedMessages();
|
|
break;
|
|
case "gcm":
|
|
MessagingAnalytics.logNotificationReceived(intent);
|
|
dispatchMessage(intent);
|
|
break;
|
|
case "send_error":
|
|
onSendError(getMessageId(intent), new SendException(intent.getStringExtra("error")));
|
|
break;
|
|
case "send_event":
|
|
onMessageSent(intent.getStringExtra("google.message_id"));
|
|
break;
|
|
default:
|
|
Log.w("FirebaseMessaging", "Received message with unknown type: " + stringExtra);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public final void dispatchMessage(Intent intent) {
|
|
Bundle extras = intent.getExtras();
|
|
if (extras == null) {
|
|
extras = new Bundle();
|
|
}
|
|
extras.remove("androidx.content.wakelockid");
|
|
if (NotificationParams.isNotification(extras)) {
|
|
NotificationParams notificationParams = new NotificationParams(extras);
|
|
ExecutorService newNetworkIOExecutor = FcmExecutors.newNetworkIOExecutor();
|
|
try {
|
|
if (new DisplayNotification(this, notificationParams, newNetworkIOExecutor).handleNotification()) {
|
|
return;
|
|
}
|
|
newNetworkIOExecutor.shutdown();
|
|
if (MessagingAnalytics.shouldUploadScionMetrics(intent)) {
|
|
MessagingAnalytics.logNotificationForeground(intent);
|
|
}
|
|
} finally {
|
|
newNetworkIOExecutor.shutdown();
|
|
}
|
|
}
|
|
onMessageReceived(new RemoteMessage(extras));
|
|
}
|
|
|
|
public final boolean alreadyReceivedMessage(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return false;
|
|
}
|
|
Queue<String> queue = recentlyReceivedMessageIds;
|
|
if (queue.contains(str)) {
|
|
if (!Log.isLoggable("FirebaseMessaging", 3)) {
|
|
return true;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Received duplicate message: ");
|
|
sb.append(str);
|
|
return true;
|
|
}
|
|
if (queue.size() >= 10) {
|
|
queue.remove();
|
|
}
|
|
queue.add(str);
|
|
return false;
|
|
}
|
|
|
|
public final String getMessageId(Intent intent) {
|
|
String stringExtra = intent.getStringExtra("google.message_id");
|
|
return stringExtra == null ? intent.getStringExtra("message_id") : stringExtra;
|
|
}
|
|
|
|
public final Rpc getRpc(Context context) {
|
|
if (this.rpc == null) {
|
|
this.rpc = new Rpc(context.getApplicationContext());
|
|
}
|
|
return this.rpc;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public static void resetForTesting() {
|
|
recentlyReceivedMessageIds.clear();
|
|
}
|
|
}
|