Files
rr3-apk/decompiled-community/sources/com/ea/eadp/pushnotification/forwarding/FCMMessageService.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- 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
2026-02-18 15:48:36 -08:00

249 lines
11 KiB
Java

package com.ea.eadp.pushnotification.forwarding;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import androidx.core.app.NotificationCompat;
import com.ea.eadp.http.services.HttpService;
import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
import com.ea.eadp.pushnotification.services.IPushService;
import com.ea.nimble.Global;
import com.ea.nimble.Log;
import com.ea.nimble.Utility;
import com.facebook.internal.NativeProtocol;
import java.util.List;
/* loaded from: classes2.dex */
public class FCMMessageService extends JobIntentService {
protected static final int JOB_ID = 5566;
private static final String LOG_TAG = "FCMMessageService";
private IPushService pushManager;
public interface EnsEventFlags {
public static final int ALL_DISABLED = 0;
public static final int ALL_ENABLED = 3;
public static final int CLICK_ENABLED = 1;
public static final int RECEIVED_ENABLED = 2;
}
public interface PushIntentExtraKeys {
public static final String ALERT = "alert";
public static final String COLLAPSE_KEY = "collapse_key";
public static final String DEEP_LINK_URL = "deepLinkUrl";
public static final String ENS_EVENTS = "ensEvents";
public static final String PN_TYPE = "pnType";
public static final String PUSH_ID = "pushId";
}
public boolean displayNotification(Bundle bundle) {
return true;
}
public HttpService getHttpService() {
return null;
}
public static void enqueueWork(Context context, String str, Intent intent) {
try {
JobIntentService.enqueueWork(context, Class.forName(str), JOB_ID, intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
@Override // androidx.core.app.JobIntentService
public void onHandleWork(@NonNull Intent intent) {
if (intent.getExtras() == null) {
Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
} else {
onHandleMessage(intent);
}
}
/* JADX WARN: Removed duplicated region for block: B:14:0x0051 */
/* JADX WARN: Removed duplicated region for block: B:27:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onHandleMessage(android.content.Intent r5) {
/*
r4 = this;
android.os.Bundle r5 = r5.getExtras()
r0 = 0
if (r5 != 0) goto Lf
java.lang.String r5 = "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle."
java.lang.Object[] r0 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGE(r4, r5, r0)
return
Lf:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
java.lang.String r2 = "Message received: "
r1.append(r2)
r1.append(r5)
java.lang.String r1 = r1.toString()
java.lang.Object[] r2 = new java.lang.Object[r0]
java.lang.String r3 = "FCMMessageService"
com.ea.nimble.Log.Helper.LOGIS(r3, r1, r2)
boolean r1 = r4.displayNotification(r5)
if (r1 == 0) goto L34
android.content.Context r1 = r4.getApplicationContext()
r4.postNotification(r1, r5)
L34:
java.lang.String r1 = "ensEvents"
java.lang.String r1 = r5.getString(r1)
if (r1 == 0) goto L48
int r0 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L41
goto L49
L41:
java.lang.String r1 = "ensEvents flag found but not parseable as integer"
java.lang.Object[] r0 = new java.lang.Object[r0]
com.ea.nimble.Log.Helper.LOGWS(r3, r1, r0)
L48:
r0 = 3
L49:
java.lang.String r1 = "pushId"
boolean r2 = r5.containsKey(r1)
if (r2 == 0) goto L8e
r2 = 2
if (r0 >= r2) goto L56
if (r0 >= 0) goto L8e
L56:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
if (r0 != 0) goto L69
com.ea.eadp.pushnotification.services.AndroidPushService r0 = new com.ea.eadp.pushnotification.services.AndroidPushService
android.content.Context r2 = r4.getApplicationContext()
com.ea.eadp.http.services.HttpService r3 = r4.getHttpService()
r0.<init>(r2, r3)
r4.pushManager = r0
L69:
boolean r0 = com.ea.nimble.ApplicationEnvironment.isMainApplicationRunning()
java.lang.String r2 = "NOTIFICATION_RECEIVED"
java.lang.String r3 = "pnType"
if (r0 == 0) goto L81
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r5.getString(r1)
java.lang.String r5 = r5.getString(r3)
r0.sendTrackingEvent(r1, r5, r2)
goto L8e
L81:
com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
java.lang.String r1 = r5.getString(r1)
java.lang.String r5 = r5.getString(r3)
r0.persistTrackingEvent(r1, r5, r2)
L8e:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.eadp.pushnotification.forwarding.FCMMessageService.onHandleMessage(android.content.Intent):void");
}
@SuppressLint({"InlinedApi"})
private void postNotification(Context context, Bundle bundle) {
Intent intent = new Intent();
intent.addFlags(32);
intent.putExtras(bundle);
intent.setPackage(context.getPackageName());
ComponentName broadcastForwarderComponent = getBroadcastForwarderComponent();
if (isInForeground()) {
if (broadcastForwarderComponent != null) {
intent.setComponent(broadcastForwarderComponent);
sendBroadcast(intent);
return;
} else {
Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not sending broadcast", new Object[0]);
return;
}
}
String string = bundle.getString(PushIntentExtraKeys.PUSH_ID);
int hashCode = string != null ? string.hashCode() : 0;
ApplicationInfo applicationInfo = Utility.getApplicationInfo(128);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, (applicationInfo == null || !applicationInfo.metaData.containsKey(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) ? Global.NOTIFICATION_CHANNEL_DEFAULT_ID : applicationInfo.metaData.getString(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY));
if (broadcastForwarderComponent != null) {
String string2 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
if (string2 != null && !string2.equalsIgnoreCase("do_not_collapse")) {
intent.putExtra(PushIntentExtraKeys.COLLAPSE_KEY, string2);
}
intent.setComponent(broadcastForwarderComponent);
customizeNotification(builder, bundle);
intent.putExtra("notification", builder.build());
PendingIntent broadcast = PendingIntent.getBroadcast(context, hashCode, intent, 201326592);
if (broadcast != null) {
builder.setContentIntent(broadcast);
try {
broadcast.send();
return;
} catch (PendingIntent.CanceledException e) {
Log.Helper.LOGE(LOG_TAG, "[CanceledException] Could not launch PendingIntent for PN " + e, new Object[0]);
return;
}
}
Log.Helper.LOGE(LOG_TAG, "Unable to query PendingIntent", new Object[0]);
return;
}
Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not setting ContentIntent", new Object[0]);
customizeNotification(builder, bundle);
NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
if (notificationManager != null) {
String string3 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
if (string3 != null && !string3.equalsIgnoreCase("do_not_collapse")) {
notificationManager.notify(string3, 0, builder.build());
return;
} else {
notificationManager.notify(hashCode, builder.build());
return;
}
}
Log.Helper.LOGE(this, "Notification Manager is not available or is inaccessible. Skipping Notification formatting.", new Object[0]);
}
public boolean isInForeground() {
return PushLifecycleCallbacks.inForeground;
}
public void customizeNotification(NotificationCompat.Builder builder, Bundle bundle) {
String string = bundle.getString(PushIntentExtraKeys.ALERT);
Resources resources = getApplicationContext().getResources();
String packageName = getApplicationContext().getPackageName();
String string2 = getApplicationContext().getResources().getString(resources.getIdentifier(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, "string", packageName));
try {
builder.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
} catch (Exception e) {
Log.Helper.LOGE(LOG_TAG, "PN NOT DISPLAYED: Unable to set application icon due to exception: " + e, new Object[0]);
}
builder.setContentTitle(string2).setStyle(new NotificationCompat.BigTextStyle().bigText(string)).setContentText(string).setAutoCancel(true).setDefaults(getApplicationContext().checkCallingOrSelfPermission("android.permission.VIBRATE") == 0 ? 7 : 5);
}
public ComponentName getBroadcastForwarderComponent() {
List<ResolveInfo> queryBroadcastReceivers;
PackageManager.ResolveInfoFlags of;
Log.Helper.LOGFUNC(this);
PackageManager packageManager = getApplicationContext().getPackageManager();
Intent intent = new Intent("com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST");
intent.setPackage(getApplicationContext().getPackageName());
if (Build.VERSION.SDK_INT >= 33) {
of = PackageManager.ResolveInfoFlags.of(0L);
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, of);
} else {
queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
}
if (queryBroadcastReceivers.isEmpty()) {
return null;
}
ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
return new ComponentName(activityInfo.packageName, activityInfo.name);
}
}