what-the-bank/sources/com/google/firebase/messaging/zzb.java

293 lines
12 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.messaging;
import android.R;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicInteger;
import o.C13001fNn;
import o.nMh;
import o.rvM;
/* loaded from: classes2.dex */
public final class zzb {
private static int a = 1;
private static int c;
private static byte e;
private static final AtomicInteger zza;
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: Multi-variable type inference failed */
public static zza zza(Context context, zzt zztVar) {
Uri defaultUri;
Intent launchIntentForPackage;
PendingIntent activity;
Bundle zza2 = zza(context.getPackageManager(), context.getPackageName());
String packageName = context.getPackageName();
String zzb = zzb(context, zztVar.zza("gcm.n.android_channel_id"), zza2);
Resources resources = context.getResources();
PackageManager packageManager = context.getPackageManager();
rvM.LWm lWm = new rvM.LWm(context, zzb);
CharSequence zza3 = zztVar.zza(resources, packageName, "gcm.n.title");
if (!TextUtils.isEmpty(zza3)) {
lWm.a(zza3);
}
CharSequence zza4 = zztVar.zza(resources, packageName, "gcm.n.body");
if (!TextUtils.isEmpty(zza4)) {
lWm.d(zza4);
lWm.d(new rvM.HBt().e(zza4));
}
lWm.c(zza(packageManager, resources, packageName, zztVar.zza("gcm.n.icon"), zza2));
String zzb2 = zztVar.zzb();
Integer num = null;
if (TextUtils.isEmpty(zzb2)) {
defaultUri = null;
} else if (!C13001fNn.DEFAULT_IDENTIFIER.equals(zzb2) && resources.getIdentifier(zzb2, "raw", packageName) != 0) {
StringBuilder sb = new StringBuilder(String.valueOf(packageName).length() + 24 + String.valueOf(zzb2).length());
sb.append("android.resource://");
sb.append(packageName);
sb.append("/raw/");
sb.append(zzb2);
defaultUri = Uri.parse(sb.toString());
} else {
defaultUri = RingtoneManager.getDefaultUri(2);
}
if (defaultUri != null) {
lWm.mT_(defaultUri);
}
String zza5 = zztVar.zza("gcm.n.click_action");
if (!TextUtils.isEmpty(zza5)) {
launchIntentForPackage = new Intent(zza5);
launchIntentForPackage.setPackage(packageName);
launchIntentForPackage.setFlags(268435456);
} else {
Uri zza6 = zztVar.zza();
if (zza6 != null) {
launchIntentForPackage = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL);
launchIntentForPackage.setPackage(packageName);
launchIntentForPackage.setData(zza6);
} else {
launchIntentForPackage = packageManager.getLaunchIntentForPackage(packageName);
}
}
if (launchIntentForPackage == null) {
activity = null;
} else {
launchIntentForPackage.addFlags(com.google.android.gms.internal.common.zzd.zza);
launchIntentForPackage.putExtras(zztVar.zze());
activity = PendingIntent.getActivity(context, zza.incrementAndGet(), launchIntentForPackage, 1073741824);
if (zztVar.zzb("google.c.a.e")) {
activity = zza(context, new Intent("com.google.firebase.messaging.NOTIFICATION_OPEN").putExtras(zztVar.zzf()).putExtra("pending_intent", activity));
}
}
lWm.mQ_(activity);
PendingIntent zza7 = !zztVar.zzb("google.c.a.e") ? null : zza(context, new Intent("com.google.firebase.messaging.NOTIFICATION_DISMISS").putExtras(zztVar.zzf()));
if (zza7 != null) {
lWm.mR_(zza7);
}
Integer zza8 = zza(context, zztVar.zza("gcm.n.color"), zza2);
if (zza8 != null) {
lWm.b(zza8.intValue());
}
lWm.e(!zztVar.zzb("gcm.n.sticky"));
lWm.c(zztVar.zzb("gcm.n.local_only"));
CharSequence zza9 = zztVar.zza("gcm.n.ticker");
if (zza9 != null) {
lWm.b(zza9);
}
Integer zzc = zztVar.zzc("gcm.n.notification_priority");
if (zzc == null || zzc.intValue() < -2 || zzc.intValue() > 2) {
zzc = null;
}
if (zzc != null) {
lWm.a(zzc.intValue());
}
Integer zzc2 = zztVar.zzc("gcm.n.visibility");
if (zzc2 == null || zzc2.intValue() < -1 || zzc2.intValue() > 1) {
zzc2 = null;
}
if (zzc2 != null) {
lWm.j(zzc2.intValue());
}
Integer zzc3 = zztVar.zzc("gcm.n.notification_count");
if (zzc3 != null && zzc3.intValue() >= 0) {
num = zzc3;
}
if (num != null) {
lWm.e(num.intValue());
}
Long zzd = zztVar.zzd("gcm.n.event_time");
if (zzd != null) {
lWm.b(true);
lWm.c(zzd.longValue());
}
long[] zzc4 = zztVar.zzc();
if (zzc4 != null) {
lWm.a(zzc4);
}
int[] zzd2 = zztVar.zzd();
if (zzd2 != null) {
lWm.c(zzd2[0], zzd2[1], zzd2[2]);
}
boolean zzb3 = zztVar.zzb("gcm.n.default_sound");
boolean z = zzb3;
if (zztVar.zzb("gcm.n.default_vibrate_timings")) {
z = (zzb3 ? 1 : 0) | 2;
}
int i = z;
if (zztVar.zzb("gcm.n.default_light_settings")) {
i = (z ? 1 : 0) | 4;
}
lWm.d(i);
String zza10 = zztVar.zza("gcm.n.tag");
if (TextUtils.isEmpty(zza10)) {
long uptimeMillis = SystemClock.uptimeMillis();
StringBuilder sb2 = new StringBuilder(37);
sb2.append("FCM-Notification:");
sb2.append(uptimeMillis);
zza10 = sb2.toString();
}
return new zza(lWm, zza10, 0);
}
private static void b(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ e);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
private static boolean zza(Resources resources, int i) {
if (Build.VERSION.SDK_INT != 26) {
return true;
}
try {
return !(resources.getDrawable(i, null) instanceof AdaptiveIconDrawable);
} catch (Resources.NotFoundException unused) {
return false;
}
}
private static int zza(PackageManager packageManager, Resources resources, String str, String str2, Bundle bundle) {
if (!TextUtils.isEmpty(str2)) {
int identifier = resources.getIdentifier(str2, "drawable", str);
if (identifier != 0 && zza(resources, identifier)) {
return identifier;
}
int identifier2 = resources.getIdentifier(str2, "mipmap", str);
if (identifier2 != 0 && zza(resources, identifier2)) {
return identifier2;
}
}
int i = bundle.getInt("com.google.firebase.messaging.default_notification_icon", 0);
if (i == 0 || !zza(resources, i)) {
try {
i = PackageItemInfo.class.getField("icon").getInt(packageManager.getApplicationInfo(str, 0));
} catch (PackageManager.NameNotFoundException unused) {
}
}
return (i == 0 || !zza(resources, i)) ? R.drawable.sym_def_app_icon : i;
}
private static Integer zza(Context context, String str, Bundle bundle) {
if (!TextUtils.isEmpty(str)) {
try {
return Integer.valueOf(Color.parseColor(str));
} catch (IllegalArgumentException unused) {
}
}
int i = bundle.getInt("com.google.firebase.messaging.default_notification_color", 0);
if (i == 0) {
return null;
}
try {
return Integer.valueOf(nMh.getColor(context, i));
} catch (Resources.NotFoundException unused2) {
return null;
}
}
private static Bundle zza(PackageManager packageManager, String str) {
try {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(str, 128);
if (applicationInfo != null && PackageItemInfo.class.getField("metaData").get(applicationInfo) != null) {
return (Bundle) PackageItemInfo.class.getField("metaData").get(applicationInfo);
}
} catch (PackageManager.NameNotFoundException unused) {
}
return Bundle.EMPTY;
}
private static String zzb(Context context, String str, Bundle bundle) {
int i = 2 % 2;
Object obj = null;
try {
if (context.getPackageManager().getApplicationInfo(context.getPackageName(), 0).targetSdkVersion < 26) {
int i2 = c + 41;
a = i2 % 128;
int i3 = i2 % 2;
return null;
}
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NotificationManager.class);
if (!TextUtils.isEmpty(str) && notificationManager.getNotificationChannel(str) != null) {
return str;
}
String string = bundle.getString("com.google.firebase.messaging.default_notification_channel_id");
if (!TextUtils.isEmpty(string) && notificationManager.getNotificationChannel(string) != null) {
int i4 = c + 87;
a = i4 % 128;
if (i4 % 2 != 0) {
return string;
}
obj.hashCode();
throw null;
}
if (notificationManager.getNotificationChannel("fcm_fallback_notification_channel") == null) {
String string2 = context.getString(com.scb.phone.R.string.fcm_fallback_notification_channel_label);
if (string2.startsWith(",*,)")) {
Object[] objArr = new Object[1];
b(string2.substring(4), objArr);
string2 = ((String) objArr[0]).intern();
}
notificationManager.createNotificationChannel(new NotificationChannel("fcm_fallback_notification_channel", string2, 3));
}
return "fcm_fallback_notification_channel";
} catch (PackageManager.NameNotFoundException unused) {
return null;
}
}
private static PendingIntent zza(Context context, Intent intent) {
return PendingIntent.getBroadcast(context, zza.incrementAndGet(), new Intent("com.google.firebase.MESSAGING_EVENT").setComponent(new ComponentName(context, "com.google.firebase.iid.FirebaseInstanceIdReceiver")).putExtra("wrapped_intent", intent), 1073741824);
}
static {
c();
zza = new AtomicInteger((int) SystemClock.elapsedRealtime());
}
static void c() {
e = (byte) 6;
}
}