- 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
127 lines
5.2 KiB
Java
127 lines
5.2 KiB
Java
package com.google.firebase.messaging;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.ResolveInfo;
|
|
import android.content.pm.ServiceInfo;
|
|
import android.util.Log;
|
|
import csdk.gluads.Consts;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Queue;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class ServiceStarter {
|
|
public static ServiceStarter instance;
|
|
public String firebaseMessagingServiceClassName = null;
|
|
public Boolean hasWakeLockPermission = null;
|
|
public Boolean hasAccessNetworkStatePermission = null;
|
|
public final Queue messagingEvents = new ArrayDeque();
|
|
|
|
public static synchronized ServiceStarter getInstance() {
|
|
ServiceStarter serviceStarter;
|
|
synchronized (ServiceStarter.class) {
|
|
try {
|
|
if (instance == null) {
|
|
instance = new ServiceStarter();
|
|
}
|
|
serviceStarter = instance;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return serviceStarter;
|
|
}
|
|
|
|
public Intent getMessagingEvent() {
|
|
return (Intent) this.messagingEvents.poll();
|
|
}
|
|
|
|
public int startMessagingService(Context context, Intent intent) {
|
|
Log.isLoggable("FirebaseMessaging", 3);
|
|
this.messagingEvents.offer(intent);
|
|
Intent intent2 = new Intent("com.google.firebase.MESSAGING_EVENT");
|
|
intent2.setPackage(context.getPackageName());
|
|
return doStartService(context, intent2);
|
|
}
|
|
|
|
public final int doStartService(Context context, Intent intent) {
|
|
ComponentName startService;
|
|
String resolveServiceClassName = resolveServiceClassName(context, intent);
|
|
if (resolveServiceClassName != null) {
|
|
if (Log.isLoggable("FirebaseMessaging", 3)) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Restricting intent to a specific service: ");
|
|
sb.append(resolveServiceClassName);
|
|
}
|
|
intent.setClassName(context.getPackageName(), resolveServiceClassName);
|
|
}
|
|
try {
|
|
if (hasWakeLockPermission(context)) {
|
|
startService = WakeLockHolder.startWakefulService(context, intent);
|
|
} else {
|
|
startService = context.startService(intent);
|
|
}
|
|
if (startService != null) {
|
|
return -1;
|
|
}
|
|
Log.e("FirebaseMessaging", "Error while delivering the message: ServiceIntent not found.");
|
|
return 404;
|
|
} catch (IllegalStateException e) {
|
|
Log.e("FirebaseMessaging", "Failed to start service while in background: " + e);
|
|
return 402;
|
|
} catch (SecurityException e2) {
|
|
Log.e("FirebaseMessaging", "Error while delivering the message to the serviceIntent", e2);
|
|
return 401;
|
|
}
|
|
}
|
|
|
|
public final synchronized String resolveServiceClassName(Context context, Intent intent) {
|
|
ServiceInfo serviceInfo;
|
|
String str;
|
|
try {
|
|
String str2 = this.firebaseMessagingServiceClassName;
|
|
if (str2 != null) {
|
|
return str2;
|
|
}
|
|
ResolveInfo resolveService = context.getPackageManager().resolveService(intent, 0);
|
|
if (resolveService != null && (serviceInfo = resolveService.serviceInfo) != null) {
|
|
if (context.getPackageName().equals(serviceInfo.packageName) && (str = serviceInfo.name) != null) {
|
|
if (str.startsWith(Consts.STRING_PERIOD)) {
|
|
this.firebaseMessagingServiceClassName = context.getPackageName() + serviceInfo.name;
|
|
} else {
|
|
this.firebaseMessagingServiceClassName = serviceInfo.name;
|
|
}
|
|
return this.firebaseMessagingServiceClassName;
|
|
}
|
|
Log.e("FirebaseMessaging", "Error resolving target intent service, skipping classname enforcement. Resolved service was: " + serviceInfo.packageName + "/" + serviceInfo.name);
|
|
return null;
|
|
}
|
|
Log.e("FirebaseMessaging", "Failed to resolve target intent service, skipping classname enforcement");
|
|
return null;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public boolean hasWakeLockPermission(Context context) {
|
|
if (this.hasWakeLockPermission == null) {
|
|
this.hasWakeLockPermission = Boolean.valueOf(context.checkCallingOrSelfPermission("android.permission.WAKE_LOCK") == 0);
|
|
}
|
|
if (!this.hasWakeLockPermission.booleanValue()) {
|
|
Log.isLoggable("FirebaseMessaging", 3);
|
|
}
|
|
return this.hasWakeLockPermission.booleanValue();
|
|
}
|
|
|
|
public boolean hasAccessNetworkStatePermission(Context context) {
|
|
if (this.hasAccessNetworkStatePermission == null) {
|
|
this.hasAccessNetworkStatePermission = Boolean.valueOf(context.checkCallingOrSelfPermission("android.permission.ACCESS_NETWORK_STATE") == 0);
|
|
}
|
|
if (!this.hasWakeLockPermission.booleanValue()) {
|
|
Log.isLoggable("FirebaseMessaging", 3);
|
|
}
|
|
return this.hasAccessNetworkStatePermission.booleanValue();
|
|
}
|
|
}
|