正在查看: Baubap v3.9.7 应用的 BrazePushReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Baubap v3.9.7 应用的 BrazePushReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.braze.push;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.app.NotificationManagerCompat;
import c40.d;
import com.braze.Braze;
import com.braze.BrazeInternal;
import com.braze.Constants;
import com.braze.configuration.BrazeConfigurationProvider;
import com.braze.coroutine.BrazeCoroutineScope;
import com.braze.models.push.BrazeNotificationPayload;
import com.braze.support.BrazeLogger;
import com.braze.ui.inappmessage.BrazeInAppMessageManager;
import com.bumptech.glide.c;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.f;
import xu.b;
public class BrazePushReceiver extends BroadcastReceiver {
private static final String ADM_ERROR_DESCRIPTION_KEY = "error_description";
private static final String ADM_ERROR_KEY = "error";
private static final String ADM_RECEIVE_INTENT_ACTION = "com.amazon.device.messaging.intent.RECEIVE";
private static final String ADM_REGISTRATION_ID_KEY = "registration_id";
private static final String ADM_REGISTRATION_INTENT_ACTION = "com.amazon.device.messaging.intent.REGISTRATION";
private static final String ADM_UNREGISTERED_KEY = "unregistered";
public static final Companion Companion = new Companion(null);
private static final String DELETED_MESSAGES_KEY = "deleted_messages";
public static final String FIREBASE_MESSAGING_SERVICE_ROUTING_ACTION = "firebase_messaging_service_routing_action";
public static final String HMS_PUSH_SERVICE_ROUTING_ACTION = "hms_push_service_routing_action";
private static final String MESSAGE_TYPE_KEY = "message_type";
private static final String NUMBER_OF_MESSAGES_DELETED_KEY = "total_deleted";
public static final class Companion {
private Companion() {
}
public Companion(f fVar) {
this();
}
public final void handlePush(Context context, Intent intent) {
Context applicationContext = context.getApplicationContext();
String action = intent.getAction();
try {
handlePush$performWork(action, applicationContext, intent, context);
} catch (Exception e) {
BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, new BrazePushReceiver$Companion$handlePush$1(action, intent));
}
}
private static final void handlePush$performWork(java.lang.String r9, android.content.Context r10, android.content.Intent r11, android.content.Context r12) {
throw new UnsupportedOperationException("Method not decompiled: com.braze.push.BrazePushReceiver.Companion.handlePush$performWork(java.lang.String, android.content.Context, android.content.Intent, android.content.Context):void");
}
public static void handleReceivedIntent$default(Companion companion, Context context, Intent intent, boolean z, int i, Object obj) {
if ((i & 4) != 0) {
z = true;
}
companion.handleReceivedIntent(context, intent, z);
}
public final BrazeNotificationPayload createPayload(Context context, BrazeConfigurationProvider brazeConfigurationProvider, Bundle bundle, Bundle bundle2) {
b.y(context, "context");
b.y(brazeConfigurationProvider, "appConfigurationProvider");
b.y(bundle, "notificationExtras");
b.y(bundle2, "brazeExtras");
return Constants.isAmazonDevice() ? new BrazeNotificationPayload(bundle, BrazeNotificationPayload.Companion.getAttachedBrazeExtras(bundle), context, brazeConfigurationProvider) : new BrazeNotificationPayload(bundle, bundle2, context, brazeConfigurationProvider);
}
public final boolean handleAdmRegistrationEventIfEnabled(BrazeConfigurationProvider brazeConfigurationProvider, Context context, Intent intent) {
b.y(brazeConfigurationProvider, "appConfigurationProvider");
b.y(context, "context");
b.y(intent, "intent");
BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$1(intent), 2, (Object) null);
if (!Constants.isAmazonDevice() || !brazeConfigurationProvider.isAdmMessagingRegistrationEnabled()) {
BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.W, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$3.INSTANCE, 2, (Object) null);
return false;
}
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$2.INSTANCE, 3, (Object) null);
handleAdmRegistrationIntent(context, intent);
return true;
}
public final boolean handleAdmRegistrationIntent(Context context, Intent intent) {
b.y(context, "context");
b.y(intent, "intent");
String stringExtra = intent.getStringExtra(BrazePushReceiver.ADM_ERROR_KEY);
String stringExtra2 = intent.getStringExtra(BrazePushReceiver.ADM_ERROR_DESCRIPTION_KEY);
String stringExtra3 = intent.getStringExtra(BrazePushReceiver.ADM_REGISTRATION_ID_KEY);
String stringExtra4 = intent.getStringExtra(BrazePushReceiver.ADM_UNREGISTERED_KEY);
if (stringExtra != null) {
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$1(stringExtra, stringExtra2), 2, (Object) null);
return true;
}
if (stringExtra3 != null) {
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$2(stringExtra3), 2, (Object) null);
Braze.Companion.getInstance(context).setRegisteredPushToken(stringExtra3);
return true;
}
if (stringExtra4 != null) {
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$3(stringExtra4), 2, (Object) null);
return true;
}
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationIntent$4.INSTANCE, 2, (Object) null);
return false;
}
public final boolean handlePushNotificationPayload(Context context, Intent intent) {
b.y(context, "context");
b.y(intent, "intent");
if (!BrazeNotificationUtils.isBrazePushMessage(intent)) {
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$1.INSTANCE, 3, (Object) null);
return false;
}
if (b.n(BrazePushReceiver.DELETED_MESSAGES_KEY, intent.getStringExtra(BrazePushReceiver.MESSAGE_TYPE_KEY))) {
BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$2(intent.getIntExtra(BrazePushReceiver.NUMBER_OF_MESSAGES_DELETED_KEY, -1)), 2, (Object) null);
return false;
}
Bundle extras = intent.getExtras();
if (extras == null) {
return false;
}
BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
BrazeLogger.Priority priority = BrazeLogger.Priority.I;
BrazeLogger.brazelog$default(brazeLogger, this, priority, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$3(extras), 2, (Object) null);
Bundle attachedBrazeExtras = BrazeNotificationPayload.Companion.getAttachedBrazeExtras(extras);
extras.putBundle(Constants.BRAZE_PUSH_EXTRAS_KEY, attachedBrazeExtras);
if (!extras.containsKey(Constants.BRAZE_PUSH_RECEIVED_TIMESTAMP_MILLIS)) {
extras.putLong(Constants.BRAZE_PUSH_RECEIVED_TIMESTAMP_MILLIS, System.currentTimeMillis());
}
BrazeInternal brazeInternal = BrazeInternal.INSTANCE;
BrazeConfigurationProvider configurationProvider = brazeInternal.getConfigurationProvider(context);
BrazeNotificationPayload createPayload = createPayload(context, configurationProvider, extras, attachedBrazeExtras);
if (createPayload.isUninstallTrackingPush()) {
BrazeLogger.brazelog$default(brazeLogger, this, priority, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$4.INSTANCE, 2, (Object) null);
return false;
}
String pushUniqueId = createPayload.getPushUniqueId();
if (pushUniqueId != null && !brazeInternal.validateAndStorePushId(context, pushUniqueId)) {
BrazeLogger.brazelog$default(brazeLogger, BrazePushReceiver.Companion, priority, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$5$1(pushUniqueId), 2, (Object) null);
return false;
}
BrazeNotificationUtils.handleContentCardsSerializedCardIfPresent(createPayload);
if (createPayload.getShouldFetchTestTriggers() && configurationProvider.isInAppMessageTestPushEagerDisplayEnabled() && BrazeInAppMessageManager.Companion.getInstance().getActivity() != null) {
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$6.INSTANCE, 3, (Object) null);
BrazeInternal.handleInAppMessageTestPush(context, intent);
return false;
}
if (!BrazeNotificationUtils.isNotificationMessage(intent)) {
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$14.INSTANCE, 3, (Object) null);
BrazeNotificationUtils.sendPushMessageReceivedBroadcast(context, extras, createPayload);
BrazeNotificationUtils.requestGeofenceRefreshIfAppropriate(createPayload);
BrazeNotificationUtils.refreshFeatureFlagsIfAppropriate(createPayload);
return false;
}
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$7.INSTANCE, 3, (Object) null);
int notificationId = BrazeNotificationUtils.getNotificationId(createPayload);
extras.putInt(Constants.BRAZE_PUSH_NOTIFICATION_ID, notificationId);
if (createPayload.isPushStory()) {
if (Constants.isAmazonDevice()) {
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$8.INSTANCE, 3, (Object) null);
return false;
}
if (!extras.containsKey(Constants.BRAZE_PUSH_STORY_IS_NEWLY_RECEIVED)) {
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$9.INSTANCE, 3, (Object) null);
extras.putBoolean(Constants.BRAZE_PUSH_STORY_IS_NEWLY_RECEIVED, true);
}
}
BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.V, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$10(createPayload), 2, (Object) null);
Notification createNotification = BrazeNotificationUtils.getActiveNotificationFactory().createNotification(createPayload);
if (createNotification == null) {
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$11.INSTANCE, 3, (Object) null);
return false;
}
NotificationManagerCompat from = NotificationManagerCompat.from(context);
b.x(from, "from(context)");
BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$12(from), 3, (Object) null);
from.notify(Constants.BRAZE_PUSH_NOTIFICATION_TAG, notificationId, createNotification);
BrazeNotificationUtils.sendPushMessageReceivedBroadcast(context, extras, createPayload);
BrazeNotificationUtils.wakeScreenIfAppropriate(context, configurationProvider, extras);
Integer pushDuration = createPayload.getPushDuration();
if (pushDuration != null) {
BrazeNotificationUtils.setNotificationDurationAlarm(context, BrazePushReceiver.class, notificationId, pushDuration.intValue());
}
logNotificationMetadata$android_sdk_ui_release(context, createPayload);
return true;
}
public final void handleReceivedIntent(Context context, Intent intent) {
b.y(context, "context");
b.y(intent, "intent");
handleReceivedIntent$default(this, context, intent, false, 4, null);
}
public final void logNotificationMetadata$android_sdk_ui_release(Context context, BrazeNotificationPayload brazeNotificationPayload) {
String campaignId;
b.y(context, "context");
b.y(brazeNotificationPayload, "payload");
if (brazeNotificationPayload.isPushDeliveryEnabled() && (campaignId = brazeNotificationPayload.getCampaignId()) != null) {
long D0 = c.D0(brazeNotificationPayload.getFlushMinMinutes(), 0L);
long D02 = c.D0(brazeNotificationPayload.getFlushMaxMinutes(), D0);
TimeUnit timeUnit = TimeUnit.MINUTES;
long millis = timeUnit.toMillis(D0);
if (D02 > D0) {
c40.c cVar = d.b;
long millis2 = timeUnit.toMillis(D02);
cVar.getClass();
millis = d.c.f(millis, millis2);
}
BrazeInternal.INSTANCE.logPushDelivery(context, campaignId, millis);
}
String campaignId2 = brazeNotificationPayload.getCampaignId();
if (campaignId2 != null) {
BrazeInternal.INSTANCE.logPushCampaign(context, campaignId2);
}
}
public final void handleReceivedIntent(Context context, Intent intent, boolean z) {
b.y(context, "context");
b.y(intent, "intent");
if (z) {
tx.b.X(BrazeCoroutineScope.INSTANCE, null, null, new BrazePushReceiver$Companion$handleReceivedIntent$1(context, intent, null), 3);
} else {
handlePush(context, intent);
}
}
}
public static final BrazeNotificationPayload createPayload(Context context, BrazeConfigurationProvider brazeConfigurationProvider, Bundle bundle, Bundle bundle2) {
return Companion.createPayload(context, brazeConfigurationProvider, bundle, bundle2);
}
public static final boolean handleAdmRegistrationEventIfEnabled(BrazeConfigurationProvider brazeConfigurationProvider, Context context, Intent intent) {
return Companion.handleAdmRegistrationEventIfEnabled(brazeConfigurationProvider, context, intent);
}
public static final boolean handleAdmRegistrationIntent(Context context, Intent intent) {
return Companion.handleAdmRegistrationIntent(context, intent);
}
public static final boolean handlePushNotificationPayload(Context context, Intent intent) {
return Companion.handlePushNotificationPayload(context, intent);
}
public static final void handleReceivedIntent(Context context, Intent intent) {
Companion.handleReceivedIntent(context, intent);
}
@Override
public void onReceive(Context context, Intent intent) {
b.y(context, "context");
b.y(intent, "intent");
Companion.handleReceivedIntent$default(Companion, context, intent, false, 4, null);
}
public static final void handleReceivedIntent(Context context, Intent intent, boolean z) {
Companion.handleReceivedIntent(context, intent, z);
}
}