百度手机卫士 v8.1.5版本的 MD5 值为:15af71eae74e2f2b5b9f845fe77a4804
以下内容为反编译后的 bgc.java 源代码,内容仅作参考
package dxoptimizer;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.RemoteException;
import android.os.StrictMode;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.security.plugin.alarm.AlarmUtil;
import com.dianxinos.optimizer.engine.antispam.AntiSpamConstants;
import com.dianxinos.optimizer.engine.antispam.SmsReceiver;
import com.dianxinos.optimizer.engine.antispam.utils.Report;
import com.dianxinos.optimizer.engine.impl.LibModuleConfigs;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.zip.CRC32;
import org.json.JSONException;
import org.json.JSONObject;
public class bgc implements bej {
private static bgc c;
private Context d;
private SmsReceiver e;
private bge f;
private ben g;
private String j = null;
private long k = -1;
private static boolean a = false;
private static long b = 0;
private static big h = null;
private static bif i = null;
private bgc(Context context) {
this.d = context;
}
public static synchronized bgc a(Context context) {
bgc bgcVar;
synchronized (bgc.class) {
if (c == null) {
c = new bgc(context.getApplicationContext());
}
bgcVar = c;
}
return bgcVar;
}
private static final big c(Context context) {
if (h == null) {
h = bib.a(context);
}
return h;
}
private static final bif d(Context context) {
if (i == null) {
i = bhy.a(context);
}
return i;
}
public static void b(Context context) {
try {
bhr.a(context).c();
} catch (IOException e) {
}
if (LibModuleConfigs.a(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM)) {
e(context);
f(context);
g(context);
c(context);
d(context);
bep.a(context);
bio.b(context);
bga.a(context).a(AlarmUtil.WEEK);
if (bin.a(context).t()) {
bgj.a(context).a(AlarmUtil.DAY);
}
if (bin.a(context).y()) {
bgk.a(context).a(AlarmUtil.DAY);
}
}
}
public void i() {
n();
o();
}
public boolean a(String str, String str2, String str3) {
bhp bhpVar;
String str4;
int i2;
if (!u()) {
return false;
}
bhm bhmVar = new bhm(str, str2);
boolean f = beb.a(this.d).f();
boolean g = beb.a(this.d).g();
String a2 = bee.a(str);
boolean z = bio.c(this.d, str) || bio.c(this.d, a2);
bhp bhpVar2 = null;
bgg bggVar = new bgg(this, a2, str2);
bggVar.a = str2;
if (a(z, f, g)) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "scan sms by cloud engine");
}
bhmVar.h = 2;
bhpVar2 = a(bhmVar);
}
if (f) {
if (bhpVar2 != null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamInfo:[isSpam=" + bhpVar2.b + ",reason=" + bhpVar2.c + "]");
}
if (1 != bhpVar2.b || 4 != bhpVar2.f) {
if (1 == bhpVar2.b) {
bggVar.d = str3;
bggVar.g = 60;
a(null, bggVar, null, 3, null, true);
return true;
}
} else {
bggVar.d = str3;
bggVar.g = 61;
a(null, bggVar, null, 3, null, true);
return true;
}
} else {
if (z) {
bhpVar = null;
} else {
bhpVar = a(a2, str2);
}
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamInfo:[isSpam=" + bhpVar.b + ",reason=" + bhpVar.c + "]");
}
if (bhpVar != null && bhpVar.b == 1) {
bggVar.d = str3;
bggVar.g = bhpVar.c;
a(null, bggVar, null, 3, null, false);
return true;
}
}
if (a) {
blc.a("AntiSpamSmsMangerImpl", "DEBUG TEST INFO: address" + str + ", content: " + str2);
if ((str.contains("13716024194") || str.contains("18611907254")) && str2.contains("彩信")) {
if (!str2.contains("垃圾彩信")) {
if (str2.contains("疑似伪基站彩信")) {
bggVar.g = 61;
}
} else {
bggVar.g = 52;
}
bggVar.d = str3;
if (a) {
StringBuilder append = new StringBuilder().append("smsMessage.messageBody: ");
str4 = bggVar.d;
StringBuilder append2 = append.append(str4).append(", smsMessage.reason: ");
i2 = bggVar.g;
blc.a("AntiSpamSmsMangerImpl", append2.append(i2).append(", pduStr: ").append(str3).toString());
}
a(null, bggVar, null, 3, null, false);
return true;
}
}
}
return false;
}
@Override
public void a(ben benVar) {
if (benVar == null) {
throw new IllegalArgumentException("callback should not be null");
}
this.g = benVar;
}
@SuppressLint({"MyBroadcastHelper"})
private void n() {
try {
if (this.e == null) {
this.e = new SmsReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.provider.Telephony.SMS_RECEIVED");
intentFilter.setPriority(Integer.MAX_VALUE);
Intent registerReceiver = this.d.registerReceiver(this.e, intentFilter, a ? null : "android.permission.BROADCAST_SMS", null);
if (a) {
blc.b("AntiSpamSmsMangerImpl", "stick receiver ===== " + registerReceiver);
}
}
} catch (Exception e) {
if (a) {
e.printStackTrace();
}
}
}
private void o() {
Uri uri;
if (this.f == null) {
this.f = new bge(this, new Handler());
if (a) {
blc.b("AntiSpamSmsMangerImpl", "register SmsContentObserver ===== ");
}
}
ContentResolver contentResolver = this.d.getContentResolver();
uri = bgi.a;
contentResolver.registerContentObserver(uri, true, this.f);
}
@Override
public ArrayList b() {
ArrayList a2 = bet.a(this.d).a(30, 0L, (String) null, 0, true);
ArrayList arrayList = new ArrayList();
bhr a3 = bhr.a(this.d);
HashMap hashMap = new HashMap();
Iterator it = a2.iterator();
while (it.hasNext()) {
bhm bhmVar = (bhm) it.next();
if (!hashMap.containsKey(bhmVar.c)) {
hashMap.put(bhmVar.c, Boolean.valueOf(bio.d(this.d, bhmVar.c)));
}
if (!((Boolean) hashMap.get(bhmVar.c)).booleanValue() && TextUtils.isEmpty(a3.b(bee.a(bhmVar.c)))) {
arrayList.add(bhmVar);
}
}
return arrayList;
}
@Override
public bhp a(String str, String str2) {
return c(this.d).a(str, str2);
}
public bhp a(bhm bhmVar) {
double d;
if (bhmVar != null) {
long currentTimeMillis = System.currentTimeMillis();
bon.a(12298);
bhp a2 = bih.a(this.d, bhmVar);
bon.a();
try {
d = Double.valueOf(new DecimalFormat("#.##").format((System.currentTimeMillis() - currentTimeMillis) / 1000.0d)).doubleValue();
} catch (NumberFormatException e) {
if (a) {
e.printStackTrace();
}
d = -1.0d;
} catch (Exception e2) {
if (a) {
e2.printStackTrace();
}
d = -1.0d;
}
if (d > -1.0d) {
int a3 = hki.a(this.d);
if (a3 == 1) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_wst", Double.valueOf(d));
return a2;
}
if (a3 == 3) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_3gst", Double.valueOf(d));
return a2;
}
if (a3 == 5) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_4gst", Double.valueOf(d));
return a2;
}
return a2;
}
return a2;
}
return null;
}
@Override
public int f() {
return bin.a(this.d).e();
}
@Override
public void g() {
bin.a(this.d).f();
}
@Override
public List c() {
bio.a();
ArrayList b2 = bet.a(this.d).b();
Iterator it = b2.iterator();
while (it.hasNext()) {
bhj bhjVar = (bhj) it.next();
bhjVar.k = bio.b(this.d, bhjVar.c);
bhjVar.a(bhr.a(this.d).a(bhjVar.c));
}
return b2;
}
@Override
public boolean d() {
return bet.a(this.d).c() > 0;
}
@Override
public boolean a(long j) {
return bet.a(this.d).b(j) > 0;
}
@Override
public List a(String str) {
ArrayList a2;
bio.a();
if ("all".equals(str)) {
a2 = bet.a(this.d).a("findordelall");
} else {
a2 = bet.a(this.d).a(str);
}
Iterator it = a2.iterator();
while (it.hasNext()) {
bhj bhjVar = (bhj) it.next();
bhjVar.k = bio.b(this.d, bhjVar.c);
bhjVar.a(bhr.a(this.d).a(bhjVar.c));
}
return a2;
}
@Override
public boolean b(String str) {
int b2;
if ("all".equals(str)) {
b2 = bet.a(this.d).b("findordelall");
} else {
b2 = bet.a(this.d).b(str);
}
return b2 > 0;
}
@Override
public ArrayList e() {
ArrayList a2 = bet.a(this.d).a(0, 0L, (String) null, 0, true);
ArrayList arrayList = new ArrayList();
int size = a2.size();
for (int i2 = 0; i2 < size; i2++) {
bhm bhmVar = (bhm) a2.get(i2);
if (!beo.a(bhmVar.c)) {
arrayList.add(bhmVar);
}
}
return arrayList;
}
@Override
public void a(List list) {
if (list != null && !list.isEmpty()) {
Iterator it = list.iterator();
while (it.hasNext()) {
bhm bhmVar = (bhm) it.next();
if (a(bhmVar.a, (String) null)) {
bix bixVar = new bix(bhmVar, 3);
bixVar.u = bhmVar.h;
bixVar.g = bio.a(this.d);
bet.a(this.d).a(bixVar);
}
}
bih.a(this.d, (bix) null, (Report.ReportUpload) null);
}
}
public void a(BroadcastReceiver broadcastReceiver, Intent intent, int i2) {
try {
if (Build.VERSION.SDK_INT >= 11) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitNetwork().build());
}
} catch (Exception e) {
if (a) {
e.printStackTrace();
}
}
if (!LibModuleConfigs.a(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM)) {
if (a) {
StrictMode.ThreadPolicy.Builder builder = new StrictMode.ThreadPolicy.Builder();
builder.detectNetwork().penaltyLog().penaltyDeathOnNetwork();
StrictMode.setThreadPolicy(builder.build());
return;
}
return;
}
if (1 == i2) {
a(broadcastReceiver, intent);
} else if (2 == i2) {
p();
}
if (beb.a(this.d).B()) {
try {
bhu.a(this.d).g();
} catch (RemoteException e2) {
if (a) {
e2.printStackTrace();
}
}
}
if (a) {
StrictMode.ThreadPolicy.Builder builder2 = new StrictMode.ThreadPolicy.Builder();
builder2.detectNetwork().penaltyLog().penaltyDeathOnNetwork();
StrictMode.setThreadPolicy(builder2.build());
}
}
private void p() {
Cursor cursor;
Exception exc;
Cursor cursor2;
int i2;
int i3;
Uri uri;
String string;
String string2;
long j;
int i4;
String string3;
Uri uri2;
int i5 = -1;
String[] strArr = {"_id", "address", "body", "date", "read", "type", "service_center"};
try {
ContentResolver contentResolver = this.d.getContentResolver();
uri = bgi.a;
cursor = contentResolver.query(uri, strArr, null, null, "_id desc limit 1");
} catch (Exception e) {
exc = e;
cursor2 = null;
i2 = -1;
i3 = -1;
} catch (Throwable th) {
th = th;
cursor = null;
}
if (cursor != null) {
try {
try {
} catch (Exception e2) {
exc = e2;
cursor2 = cursor;
i2 = -1;
i3 = -1;
try {
if (a) {
exc.printStackTrace();
}
bil.a(cursor2);
if (a) {
}
} catch (Throwable th2) {
th = th2;
cursor = cursor2;
bil.a(cursor);
throw th;
}
}
if (cursor.moveToFirst()) {
string = cursor.getString(1);
string2 = cursor.getString(2);
j = cursor.getLong(3);
i4 = cursor.getInt(4);
try {
i5 = cursor.getInt(5);
string3 = cursor.getString(6);
} catch (Exception e3) {
exc = e3;
cursor2 = cursor;
i2 = i4;
i3 = i5;
if (a) {
}
bil.a(cursor2);
if (a) {
}
}
if (!TextUtils.isEmpty(string)) {
bil.a(cursor);
return;
}
long currentTimeMillis = System.currentTimeMillis() - this.k;
if (string.equals(this.j) && currentTimeMillis < 4000) {
bil.a(cursor);
return;
}
if (i4 == 0 && i5 == 1) {
long j2 = cursor.getLong(0);
uri2 = bgi.a;
Uri withAppendedId = ContentUris.withAppendedId(uri2, j2);
bgg bggVar = new bgg(this, string, string2, j);
bggVar.a(string3);
a(withAppendedId, bggVar, (BroadcastReceiver) null, (Intent) null, 2);
}
bil.a(cursor);
i3 = i5;
i2 = i4;
if (a) {
blc.b("AntiSpamSmsMangerImpl", "AntiSpamUtils interceptSmsFromInbox: sms{read: " + i2 + " type: " + i3 + "}");
return;
}
return;
}
} catch (Throwable th3) {
th = th3;
bil.a(cursor);
throw th;
}
}
j = 0;
string2 = "";
string = "";
string3 = "";
i4 = -1;
if (!TextUtils.isEmpty(string)) {
}
}
private void a(BroadcastReceiver broadcastReceiver, Intent intent) {
String str;
String str2;
String str3;
long currentTimeMillis = System.currentTimeMillis();
if (intent != null) {
String action = intent.getAction();
if (!TextUtils.isEmpty(action) && hkd.a(this.d, action)) {
Serializable d = hnd.d(intent, "pdus");
long a2 = a(d);
if (b != a2) {
b = a2;
bgg[] a3 = a(hma.a(d, hnd.b(intent, "format")));
if (a3 == null || a3.length == 0) {
return;
}
str = a3[0].c;
this.j = str;
this.k = System.currentTimeMillis();
for (bgg bggVar : a3) {
if (a) {
StringBuilder append = new StringBuilder().append("spam message:");
str2 = bggVar.c;
StringBuilder append2 = append.append(str2).append("->");
str3 = bggVar.d;
blc.c("AntiSpamSmsMangerImpl", append2.append(str3).toString());
}
a((Uri) null, bggVar, broadcastReceiver, intent, 1);
}
if (broadcastReceiver != null && s()) {
if (a) {
blc.b("AntiSpamSmsMangerImpl", "need abort broadcast for delivery message");
}
broadcastReceiver.abortBroadcast();
} else if (a) {
blc.b("AntiSpamSmsMangerImpl", "not need abort broadcast for delivery message, Because smsReceiver is " + broadcastReceiver + " or sms enabled is " + hkd.a(this.d));
}
int currentTimeMillis2 = ((int) (System.currentTimeMillis() - currentTimeMillis)) / 1000;
if (beb.a(this.d).B()) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_lkhrct", Integer.valueOf(currentTimeMillis2));
if (currentTimeMillis2 >= 5) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_lkhrcto5", Integer.valueOf(currentTimeMillis2));
return;
}
return;
}
ble.a(this.d).b("ye_as_ctg", "as_sdk_hrct", Integer.valueOf(currentTimeMillis2));
if (currentTimeMillis2 >= 5) {
ble.a(this.d).b("ye_as_ctg", "as_sdk_hrcto5", Integer.valueOf(currentTimeMillis2));
}
}
}
}
}
private void a(Uri uri, bgg bggVar, BroadcastReceiver broadcastReceiver, Intent intent, int i2) {
boolean f;
boolean h2;
boolean i3;
boolean j;
boolean k;
boolean l;
boolean g;
boolean z;
boolean z2;
boolean z3;
boolean z4;
boolean z5;
String str;
String str2;
String a2;
boolean z6;
bhm bhmVar;
bhp bhpVar;
bhe bheVar;
bhp bhpVar2;
String str3;
int i4;
if (1 == i2 && broadcastReceiver == null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "smsReceiver should not be null when the para from is LibAntiSpamContants.INTERCEPTSMS_FROM_RECEIVER");
return;
}
return;
}
if (2 == i2 && uri == null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "uri is should not be null when the para from is LibAntiSpamContants.INTERCEPTSMS_FROM_RECEIVER");
return;
}
return;
}
if (bio.a(this.d, new GregorianCalendar())) {
f = beb.a(this.d).m();
h2 = beb.a(this.d).o();
i3 = beb.a(this.d).p();
j = beb.a(this.d).q();
k = beb.a(this.d).r();
l = beb.a(this.d).x();
g = beb.a(this.d).n();
if (a) {
blc.c("AntiSpamSmsMangerImpl", "timer block");
z = l;
z2 = k;
z3 = j;
z4 = h2;
z5 = f;
str = bggVar.c;
str2 = bggVar.d;
a2 = bee.a(str);
if (a) {
blc.c("AntiSpamSmsMangerImpl", "isSmartInterceptMode:" + z5 + ", isBlackListInterceptMode:" + z4 + ", isWhiteListInterceptMode:" + i3 + ", isStrangerInterceptMode:" + z3 + ", isContactInterceptMode:" + z2 + ", address:" + str + ", strippedAddress:" + a2);
}
z6 = !bio.c(this.d, str) || bio.c(this.d, a2);
if (LibModuleConfigs.a(this.d).b(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM)) {
if (!z6) {
ble.a(this.d).a("ye_as_ctg", "as_sdk_rssc", 1);
if (bee.c(a2)) {
if (a) {
blc.c("AntiSpamSmsMangerImpl", "is public number");
}
if (a2.startsWith("10086") || a2.startsWith("10010") || a2.startsWith("10000")) {
if (a) {
blc.c("AntiSpamSmsMangerImpl", "is carrieroperator number");
}
ble.a(this.d).a("ye_as_ctg", "as_sdk_rcosc", 1);
}
ble.a(this.d).a("ye_as_ctg", "as_sdk_rpsc", 1);
}
} else {
ble.a(this.d).a("ye_as_ctg", "as_sdk_rcsc", 1);
}
}
bhmVar = new bhm(str, str2);
bhmVar.g = bggVar.a();
if (!a(z6, str, z5, g, i3)) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "scan sms by cloud engine");
}
bhmVar.h = 1;
bhp a3 = a(bhmVar);
if (a3 != null) {
if (a(uri, bggVar, broadcastReceiver, i2, a2, z6, a3.e, a3, true)) {
return;
} else {
bhpVar = a3;
}
} else {
bhpVar = a3;
}
} else {
if (!l()) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "sms can't do cloud scan, store it");
}
bet.a(this.d).a(bhmVar, (String) null);
}
bhpVar = null;
}
bheVar = null;
bhpVar2 = null;
if (bhpVar == null && !z6 && (!beo.k(str) || !i3)) {
bheVar = d(this.d).a(bhmVar);
bhpVar2 = a(a2, str2);
}
if (a(uri, bggVar, broadcastReceiver, i2, str, z6, bheVar, bhpVar2, false)) {
if (!u()) {
a(intent, z5, g, i3, a2, z6, bhmVar, bhpVar, bheVar);
return;
}
if (i3 && beo.k(str)) {
if (LibModuleConfigs.a(this.d).b(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM) && !z6) {
ble.a(this.d).a("ye_as_ctg", "as_sdk_dsbwc", 1);
}
a(intent, z5, g, i3, a2, z6, bhmVar, bhpVar, bheVar);
return;
}
if (!z4 || (!beo.g(str) && !beo.b(this.d, str) && (z6 || !beo.i(str)))) {
if (z6) {
if (!z2) {
a(intent, z5, g, i3, a2, z6, bhmVar, bhpVar, bheVar);
return;
} else {
bggVar.g = 56;
a(uri, bggVar, broadcastReceiver, i2, null, false);
return;
}
}
if (!z3 || z6) {
if (!z || !bep.a(str2)) {
if (z5) {
if (!bhr.a(this.d).d() || f(a2)) {
a(intent, z5, g, i3, a2, z6, bhmVar, bhpVar, bheVar);
return;
}
if (bhpVar != null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamInfo:[isSpam=" + bhpVar.b + ",reason=" + bhpVar.c + "]");
}
if (bhpVar.b != 1 || bhpVar.f != 4) {
if (bhpVar.b == 1) {
bggVar.g = 60;
a(uri, bggVar, broadcastReceiver, i2, null, true);
return;
}
} else {
bggVar.g = 61;
a(uri, bggVar, broadcastReceiver, i2, null, true);
return;
}
} else if (bhpVar2 != null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamInfo:[isSpam=" + bhpVar2.b + ",reason=" + bhpVar2.c + "]");
}
if (bhpVar2.b == 1) {
bggVar.g = bhpVar2.c;
a(uri, bggVar, broadcastReceiver, i2, null, false);
return;
}
}
}
if (a) {
blc.a("AntiSpamSmsMangerImpl", "DEBUG TEST INFO: address" + str + ", content: " + str2);
if ((str.contains("13716024194") || str.contains("18611907254")) && str2.contains("短信")) {
bhe bheVar2 = null;
if (!str2.contains("诈骗短信")) {
if (str2.contains("伪基站短信")) {
bheVar2 = new bhe("pseudobase", "伪基站短信");
bggVar.g = 59;
}
} else {
bggVar.g = 59;
bheVar2 = new bhe("cheat", "诈骗短信");
}
bggVar.d = str2;
if (a) {
StringBuilder append = new StringBuilder().append("smsMessage.messageBody: ");
str3 = bggVar.d;
StringBuilder append2 = append.append(str3).append(", smsMessage.reason: ");
i4 = bggVar.g;
blc.a("AntiSpamSmsMangerImpl", append2.append(i4).append(", pduStr: ").append(str2).toString());
}
a(uri, bggVar, broadcastReceiver, i2, bheVar2, false);
return;
}
}
a(intent, z5, g, i3, a2, z6, bhmVar, bhpVar, bheVar);
return;
}
bggVar.g = 58;
a(uri, bggVar, broadcastReceiver, i2, null, false);
return;
}
bggVar.g = 57;
a(uri, bggVar, broadcastReceiver, i2, null, false);
return;
}
bggVar.g = 55;
a(uri, bggVar, broadcastReceiver, i2, null, false);
return;
}
return;
}
} else {
f = beb.a(this.d).f();
h2 = beb.a(this.d).h();
i3 = beb.a(this.d).i();
j = beb.a(this.d).j();
k = beb.a(this.d).k();
l = beb.a(this.d).l();
g = beb.a(this.d).g();
if (a) {
blc.c("AntiSpamSmsMangerImpl", "normal block");
}
}
z = l;
z2 = k;
z3 = j;
z4 = h2;
z5 = f;
str = bggVar.c;
str2 = bggVar.d;
a2 = bee.a(str);
if (a) {
}
if (bio.c(this.d, str)) {
}
if (LibModuleConfigs.a(this.d).b(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM)) {
}
bhmVar = new bhm(str, str2);
bhmVar.g = bggVar.a();
if (!a(z6, str, z5, g, i3)) {
}
bheVar = null;
bhpVar2 = null;
if (bhpVar == null) {
bheVar = d(this.d).a(bhmVar);
bhpVar2 = a(a2, str2);
}
if (a(uri, bggVar, broadcastReceiver, i2, str, z6, bheVar, bhpVar2, false)) {
}
}
private void a(Intent intent, boolean z, boolean z2, boolean z3, String str, boolean z4, bhm bhmVar, bhp bhpVar, bhe bheVar) {
bhp bhpVar2;
if (!q() && !r()) {
if (a) {
blc.b("AntiSpamSmsMangerImpl", "not delivery mms");
return;
}
return;
}
if (!a(z4, str, z, z2, z3) || !beb.a(this.d).s()) {
if (b(bhmVar)) {
bhmVar.h = 1;
if (z4) {
String e = e(bhmVar.b);
if (TextUtils.isEmpty(e)) {
bhpVar2 = null;
} else {
bhmVar.b = e;
bhpVar2 = a(bhmVar);
}
bhpVar = bhpVar2;
} else {
bhpVar = a(bhmVar);
}
} else if (bheVar != null) {
bhpVar = new bhp(bheVar, (bhm) null);
} else {
bhpVar = new bhp(d(this.d).a(bhmVar), (bhm) null);
}
}
if (intent != null) {
bio.a(this.d, intent, bhpVar);
}
}
public static String e(String str) {
if (!TextUtils.isEmpty(str)) {
Matcher matcher = AntiSpamConstants.b.matcher(str);
if (matcher.find()) {
HashSet hashSet = new HashSet();
hashSet.add(matcher.group());
while (matcher.find()) {
hashSet.add(matcher.group());
}
return TextUtils.join(",", hashSet);
}
}
return null;
}
private boolean q() {
return Build.VERSION.SDK_INT < 19 && hkd.a() && bio.k(this.d);
}
private boolean r() {
return Build.VERSION.SDK_INT >= 19 && hkd.a(this.d);
}
private boolean s() {
return hkd.a() && hkd.a(this.d) && beb.a(this.d).t() && bio.k(this.d);
}
private boolean b(bhm bhmVar) {
return beb.a(this.d).s() && c(bhmVar) && t() && s();
}
private boolean t() {
int a2 = hki.a(this.d);
return 1 == a2 || 3 == a2 || 5 == a2;
}
private boolean c(bhm bhmVar) {
String str = bhmVar.b;
if (!TextUtils.isEmpty(str)) {
Matcher matcher = AntiSpamConstants.c.matcher(str);
if (matcher.find()) {
int length = matcher.group().length();
if (a) {
blc.a("AntiSpamSmsMangerImpl", "len: " + length);
}
if (length >= 7 && length <= 14) {
return true;
}
}
if (AntiSpamConstants.b.matcher(str).find()) {
return true;
}
}
return false;
}
private boolean a(boolean z, boolean z2, boolean z3) {
return !z && u() && z2 && z3;
}
private boolean a(boolean z, String str, boolean z2, boolean z3, boolean z4) {
return !z && l() && u() && z2 && z3 && !(beo.k(str) && z4);
}
public boolean l() {
int a2 = hki.a(this.d);
if (a2 != 1) {
switch (beb.a(this.d).C()) {
case 3:
return a2 == 3;
case 4:
if (a2 == 5) {
return true;
}
break;
case 34:
if (a2 == 3 || a2 == 5) {
return true;
}
break;
}
} else {
return true;
}
}
public boolean u() {
boolean a2 = LibModuleConfigs.a(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM);
boolean a3 = beb.a(this.d).a();
boolean c2 = beb.c(this.d);
boolean a4 = hkd.a(this.d);
if (!c2 && !a4) {
a4 = true;
}
return a2 && a3 && a4;
}
private boolean a(Uri uri, bgg bggVar, BroadcastReceiver broadcastReceiver, int i2, String str, boolean z, bhe bheVar, bhp bhpVar, boolean z2) {
boolean z3;
bhe bheVar2;
if (!beb.a(this.d).f()) {
return false;
}
if (bhpVar != null && 1 == bhpVar.b && 4 == bhpVar.f && bheVar != null && bheVar.c().equals("cheat")) {
bhe bheVar3 = new bhe("pseudobase", "伪基站短信");
bggVar.g = 59;
a(uri, bggVar, broadcastReceiver, i2, bheVar3, z2);
return true;
}
if (a(bhpVar, bheVar)) {
if (a(bggVar)) {
bheVar2 = new bhe("pseudobase", "伪基站短信");
z3 = false;
} else {
z3 = z2;
bheVar2 = bheVar;
}
bggVar.g = 59;
a(uri, bggVar, broadcastReceiver, i2, bheVar2, z3);
return true;
}
return false;
}
private boolean a(bhp bhpVar, bhe bheVar) {
if (bheVar == null || bhpVar == null) {
return false;
}
return TextUtils.equals(bheVar.c(), "cheat") && bhpVar.b == 1;
}
public boolean a(bhp bhpVar) {
boolean f;
boolean h2;
boolean i2;
boolean j;
boolean k;
boolean l;
if (bhpVar == null || bhpVar.d == null) {
return false;
}
if (bio.a(this.d, new GregorianCalendar())) {
f = beb.a(this.d).m();
h2 = beb.a(this.d).o();
i2 = beb.a(this.d).p();
j = beb.a(this.d).q();
k = beb.a(this.d).r();
l = beb.a(this.d).x();
if (a) {
blc.c("AntiSpamSmsMangerImpl", "timer block");
}
} else {
f = beb.a(this.d).f();
h2 = beb.a(this.d).h();
i2 = beb.a(this.d).i();
j = beb.a(this.d).j();
k = beb.a(this.d).k();
l = beb.a(this.d).l();
if (a) {
blc.c("AntiSpamSmsMangerImpl", "normal block");
}
}
String str = bhpVar.d.c;
String str2 = bhpVar.d.b;
String a2 = bee.a(str);
if (a) {
blc.c("AntiSpamSmsMangerImpl", "isSmartBlock:" + f + "\nisBlackList:" + h2 + "\nisWhiteList:" + i2 + "\nisStranger:" + j + "\nisContact:" + k + "\naddress:" + str + "\nstrippedAddress:" + a2);
}
if (i2 && beo.k(str)) {
return false;
}
boolean z = bio.c(this.d, str) || bio.c(this.d, a2);
if (h2 && (beo.g(str) || beo.b(this.d, str) || (!k && beo.i(str)))) {
bhpVar.c = 55;
a(bhpVar, false);
return true;
}
if (z) {
if (!k) {
return false;
}
bhpVar.c = 56;
a(bhpVar, false);
return true;
}
if (j && !z) {
bhpVar.c = 57;
a(bhpVar, false);
return true;
}
if (l && bep.a(str2)) {
bhpVar.c = 58;
a(bhpVar, false);
return true;
}
if (f) {
bhp a3 = a(a2, str2);
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamInfo:[isSpam=" + a3.b + ",reason=" + a3.c + "]");
}
if (!bhr.a(this.d).d() || f(a2)) {
return false;
}
if (a3.b == 1) {
bhpVar.c = a3.c;
a(bhpVar, false);
return true;
}
}
return false;
}
private void a(Uri uri, bgg bggVar, BroadcastReceiver broadcastReceiver, int i2, bhe bheVar, boolean z) {
String str;
String str2;
int i3;
bhp bhpVar;
int i4;
int i5;
if (1 == i2) {
broadcastReceiver.abortBroadcast();
} else if (2 == i2) {
this.d.getContentResolver().delete(uri, null, null);
}
str = bggVar.c;
str2 = bggVar.d;
bhm bhmVar = new bhm(str, str2);
bhmVar.d = System.currentTimeMillis();
bhmVar.f = bio.c(this.d);
bhmVar.g = bggVar.a();
bhmVar.j = bggVar.a;
if (i2 == 1 || i2 == 2) {
i3 = 1;
} else {
i3 = i2 == 3 ? 2 : 1;
}
if (bheVar != null) {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "高危诈骗短信拦截");
}
bhpVar = new bhp(bheVar, bhmVar);
i5 = bggVar.g;
bhpVar.c = i5;
bhpVar.a = i3;
a(bhpVar, z);
} else {
if (a) {
blc.a("AntiSpamSmsMangerImpl", "普通垃圾短信拦截");
}
i4 = bggVar.g;
bhpVar = new bhp(1, i4, bhmVar);
bhpVar.a = i3;
bio.a(this.d, bhpVar, z);
}
if (a) {
blc.a("AntiSpamSmsMangerImpl", "spamSmsInfo.msg_type: " + bhpVar.a);
}
}
private boolean f(String str) {
return bhr.a(this.d).b(str) != null;
}
private boolean a(bgg bggVar) {
String str;
String str2;
String str3;
String str4;
if (bggVar != null) {
str4 = bggVar.c;
if (f(str4)) {
return true;
}
}
if (bggVar == null) {
return false;
}
str = bggVar.c;
if (str == null) {
return false;
}
str2 = bggVar.c;
if (str2.length() < 5) {
return false;
}
str3 = bggVar.c;
String substring = str3.substring(0, 5);
int length = str3.length();
String substring2 = str3.substring(length - 5, length);
if (a) {
blc.a("AntiSpamSmsMangerImpl", "addressPrefix: " + substring + " addressSuffix: " + substring2);
}
return f(substring) || f(substring2);
}
public void a(bhp bhpVar, boolean z) {
bgt.a(this.d).a(bhpVar, z);
}
public void b(bhp bhpVar, boolean z) {
if (bhpVar != null && bhpVar.d != null) {
b(bhpVar);
if (this.g != null) {
this.g.a(bhpVar);
}
if (!z && bla.a(this.d).b() && (bio.a(bhpVar.c) || bio.a(bhpVar) || bio.b(bhpVar))) {
bix bixVar = new bix();
bixVar.a = bhpVar.d.c;
int i2 = bhpVar.a;
if (2 == i2) {
bixVar.b = bhpVar.d.j;
} else if (1 == i2) {
bixVar.b = bhpVar.d.b;
}
bixVar.u = i2;
bixVar.c = bhpVar.d.d;
bixVar.d = 5;
bixVar.g = bio.a(this.d);
bhe bheVar = bhpVar.e;
if (bheVar != null && !TextUtils.isEmpty(bheVar.c())) {
bixVar.f = bheVar.c();
}
bixVar.h = bhpVar.d.f;
bixVar.j = bhpVar.d.g;
bixVar.k = hma.b(this.d);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("scan_time", bin.a(this.d).M());
jSONObject.put("refresh_time", bin.a(this.d).L());
jSONObject.put("longitude", bin.a(this.d).G());
jSONObject.put("latitude", bin.a(this.d).F());
jSONObject.put("wf", bio.h(this.d));
String g = bio.g(this.d);
if (g != null) {
jSONObject.put("cwf", g);
}
biv a2 = bio.a(this.d, bio.i(this.d));
jSONObject.put("mcc", a2.a);
jSONObject.put("mnc", a2.b);
jSONObject.put("lac", a2.e);
jSONObject.put("cellId", a2.d);
} catch (JSONException e) {
if (a) {
e.printStackTrace();
}
} catch (Exception e2) {
if (a) {
e2.printStackTrace();
}
}
bixVar.m = jSONObject;
bih.a(this.d, bixVar, (Report.ReportUpload) null);
}
if (LibModuleConfigs.a(this.d).b(LibModuleConfigs.ModuleId.MODULE_ID_ANTI_SPAM)) {
if (z) {
if (!a(bhpVar, bhpVar.e)) {
ble.a(this.d).a("ye_as_ctg", "as_sdk_bssbcc", 1);
return;
} else {
ble.a(this.d).a("ye_as_ctg", "as_sdk_bcsbcc", 1);
return;
}
}
switch (bhpVar.c) {
case com.baidu.location.b.g.M:
case com.baidu.location.b.g.G:
case com.baidu.location.b.g.r:
ble.a(this.d).a("ye_as_ctg", "as_sdk_bsbbc", 1);
break;
case 58:
ble.a(this.d).a("ye_as_ctg", "as_sdk_bsbkc", 1);
break;
}
if (bio.b(bhpVar)) {
ble.a(this.d).a("ye_as_ctg", "as_sdk_bpbsbcc", 1);
}
}
}
}
private final dxoptimizer.bgg[] a(android.telephony.SmsMessage[] r13) {
throw new UnsupportedOperationException("Method not decompiled: dxoptimizer.bgc.a(android.telephony.SmsMessage[]):dxoptimizer.bgg[]");
}
private static final long a(Serializable serializable) {
ObjectOutputStream objectOutputStream;
Throwable th;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream2 = null;
try {
objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
} catch (IOException e) {
} catch (Throwable th2) {
objectOutputStream = null;
th = th2;
}
try {
objectOutputStream.writeObject(serializable);
byte[] byteArray = byteArrayOutputStream.toByteArray();
CRC32 crc32 = new CRC32();
crc32.update(byteArray);
long value = crc32.getValue();
try {
objectOutputStream.close();
byteArrayOutputStream.close();
return value;
} catch (IOException e2) {
return value;
}
} catch (IOException e3) {
objectOutputStream2 = objectOutputStream;
try {
objectOutputStream2.close();
byteArrayOutputStream.close();
} catch (IOException e4) {
}
return 0L;
} catch (Throwable th3) {
th = th3;
try {
objectOutputStream.close();
byteArrayOutputStream.close();
} catch (IOException e5) {
}
throw th;
}
}
private bhm b(long j) {
ArrayList a2 = bet.a(this.d).a(0, j, (String) null, 0, true);
if (a2.isEmpty()) {
return null;
}
return (bhm) a2.get(0);
}
public void b(bhp bhpVar) {
String str = bhpVar.d.c;
String str2 = bhpVar.d.b;
long j = bhpVar.d.d;
int i2 = bhpVar.c;
bhe bheVar = bhpVar.e;
int i3 = bhpVar.d.f;
String str3 = bhpVar.d.g;
int i4 = bhpVar.a;
if (a) {
Log.d("AntiSpamSmsMangerImpl", "addSpamSmsMessage category: " + bheVar);
}
if (bheVar == null || (!bheVar.c().equals("cheat") && !bheVar.c().equals("pseudobase"))) {
bhpVar.d.a = a(str, str2, j, i2, j, i3, str3, i4);
} else {
bhpVar.d.a = a(str, str2, j, i2, j, bheVar.c(), i3, str3, i4);
}
}
private long a(String str, String str2, long j, int i2, long j2, int i3, String str3, int i4) {
if (str == null) {
return -1L;
}
long a2 = bet.a(this.d).a(str.trim(), str2, j, i2, null, j2, bio.f(this.d, str), false, false, i3, str3, i4);
if (a2 > -1) {
v();
return a2;
}
return a2;
}
private void v() {
bin.a(this.d).b(bin.a(this.d).e() + 1);
}
private long a(String str, String str2, long j, int i2, long j2, String str3, int i3, String str4, int i4) {
if (str == null) {
return -1L;
}
long a2 = bet.a(this.d).a(str.trim(), str2, j, i2, null, j2, bio.f(this.d, str), false, false, str3, i3, str4, i4);
if (a2 > -1) {
v();
return a2;
}
return a2;
}
private boolean a(long j, String str) {
boolean z = false;
bhm b2 = b(j);
if (b2 != null) {
z = bet.a(this.d).a(b2.c, b2.b, b2.d, 0, str, System.currentTimeMillis(), bio.f(this.d, b2.c), true, true) != -1;
if (z) {
bet.a(this.d).b(j, (ArrayList) null);
}
}
return z;
}
@Override
public boolean c(String str) {
if (str == null || TextUtils.isEmpty(str.trim())) {
return false;
}
return bep.b(str) ? bet.a(this.d).c(str, str) > 0 : bet.a(this.d).n(str) > 0;
}
@Override
public boolean d(String str) {
return str != null && !TextUtils.isEmpty(str.trim()) && bep.b(str) && bet.a(this.d).o(str) > 0;
}
@Override
public boolean b(String str, String str2) {
if (str2 == null || TextUtils.isEmpty(str2.trim())) {
return false;
}
if (bep.b(str2)) {
return ((bet.a(this.d).o(str2) > 0L ? 1 : (bet.a(this.d).o(str2) == 0L ? 0 : -1)) > 0) && bet.a(this.d).c(str, str2) > 0;
}
return bet.a(this.d).c(str, str2) > 0;
}
@Override
public ArrayList h() {
return bet.a(this.d).k();
}
@Override
public void a() {
try {
bht.a(this.d).g();
} catch (RemoteException e) {
if (a) {
e.printStackTrace();
}
}
}
private static void e(Context context) {
int c2 = boh.c(context, "antispam_keywords", -1);
int a2 = boh.a(context, "antispam_keywords", 0);
if (c2 != 1 || a2 < 201504120) {
bok.a(context, "model.db", "ye_antispam" + File.separator + "ye_model.db");
boh.d(context, "antispam_keywords", 1);
boh.b(context, "antispam_keywords", 201504120);
}
}
private static void f(Context context) {
int c2 = boh.c(context, "antispam_nbc", -1);
int a2 = boh.a(context, "antispam_nbc", 0);
if (c2 != 2 || a2 < 201408250) {
bok.a(context, "nbc.db", "ye_antispam" + File.separator + "ye_nbc.db");
boh.d(context, "antispam_nbc", 2);
boh.b(context, "antispam_nbc", 201408250);
}
}
private static void g(Context context) {
int c2 = boh.c(context, "antispam_profiles", -1);
int a2 = boh.a(context, "antispam_profiles", 0);
if (c2 != 1 || a2 < 201312010) {
bok.a(context, "antispam_profiles.db", "ye_antispam" + File.separator + "antispam_profiles.db");
boh.d(context, "antispam_profiles", 1);
boh.b(context, "antispam_profiles", 201312010);
}
}
}