和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518
以下内容为反编译后的 IncomingCallsReceiver.java 源代码,内容仅作参考
package com.chinamobile.contacts.im.receiver;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.media.AudioManager;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.CallLog;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.PhoneConstants;
import com.baidu.location.LocationClientOption;
import com.chinamobile.contacts.im.App;
import com.chinamobile.contacts.im.Main;
import com.chinamobile.contacts.im.call.view.ay;
import com.chinamobile.contacts.im.cloudserver.an;
import com.chinamobile.contacts.im.config.j;
import com.chinamobile.contacts.im.config.m;
import com.chinamobile.contacts.im.data.BlackWhiteListDBManager;
import com.chinamobile.contacts.im.data.ContactAccessor;
import com.chinamobile.contacts.im.data.KeyWordListDBManager;
import com.chinamobile.contacts.im.data.PhoneInterceptDBManager;
import com.chinamobile.contacts.im.data.simcard.MultiSimCardAccessor;
import com.chinamobile.contacts.im.donotdisturbe.AddBlackDialogActivity;
import com.chinamobile.contacts.im.donotdisturbe.MarkNumberDialogActivity;
import com.chinamobile.contacts.im.jni.Jni;
import com.chinamobile.contacts.im.mms2.model.SmilHelper;
import com.chinamobile.contacts.im.mms2.utils.ThreadPoolMms;
import com.chinamobile.contacts.im.ringtone.model.MediaManager;
import com.chinamobile.contacts.im.utils.bm;
import com.chinamobile.contacts.im.utils.ci;
import com.iflytek.cloud.ErrorCode;
import com.umeng.analytics.AspMobclickAgent;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
public class IncomingCallsReceiver extends b implements com.chinamobile.contacts.im.e.d {
public static String f3132a;
public static String f3133b;
private static int f;
private ITelephony g;
private AudioManager h;
private com.chinamobile.contacts.im.donotdisturbe.b.d i;
private boolean o;
private Context p;
private static boolean d = false;
private static String e = "";
private static long j = 0;
private static long k = 0;
private static long l = -1;
private static long m = -1;
private static HashSet<i> n = new HashSet<>();
long c = 0;
private boolean q = false;
private boolean r = false;
private boolean s = false;
@SuppressLint({"HandlerLeak"})
private Handler t = new g(this);
@Override
public void onReceive(Context context, Intent intent) {
int i;
this.p = context;
this.o = false;
this.h = (AudioManager) context.getSystemService(SmilHelper.ELEMENT_TAG_AUDIO);
bm.a("whj", "----进入----" + d);
m.c(context, this.h.getRingerMode());
if (m.o(context) || com.chinamobile.contacts.im.config.h.f1651a) {
try {
String str = Build.MODEL;
if (com.chinamobile.contacts.im.config.h.h || MultiSimCardAccessor.MODEL_GN715.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_E100_TL00M.equals(str) || MultiSimCardAccessor.MODEL_L1813.equals(str) || MultiSimCardAccessor.MODEL_HTC_802T.equals(str) || str.equals(MultiSimCardAccessor.MODEL_ZTE_NX506J) || str.equals(MultiSimCardAccessor.MODEL_ZTE_S2014)) {
f3132a = intent.getStringExtra("incoming_number");
if (f3132a == null) {
f3132a = "";
}
f3132a = f3132a.replace(ContactAccessor.PHONE_PREFIX1, "");
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a)) {
this.h.setRingerMode(0);
if (MultiSimCardAccessor.MODEL_HUAWEI_E100_TL00M.equals(str)) {
this.o = true;
} else {
Thread.sleep(500L);
}
}
}
com.chinamobile.contacts.im.e.g.i().a(this);
this.g = ITelephony.Stub.asInterface(ServiceManager.getService(PhoneConstants.PHONE_KEY));
this.h = (AudioManager) context.getSystemService(SmilHelper.ELEMENT_TAG_AUDIO);
if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
System.out.println("----去电状态----");
d = false;
String stringExtra = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
f3133b = stringExtra;
if (com.chinamobile.contacts.im.config.a.b(context)) {
System.out.println("----去电弹窗----");
((TelephonyManager) context.getSystemService(PhoneConstants.PHONE_KEY)).getCallState();
ay.a(context).a(stringExtra, 10);
AspMobclickAgent.onEvent(context, "cloudServer_incomingShow");
com.chinamobile.contacts.im.f.c.a.a().b().I();
}
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.pause();
}
bm.a("mediaPlayer", "===========ACTION_NEW_OUTGOING_CALL====>>" + stringExtra);
} else {
if (this.o || MultiSimCardAccessor.MODEL_DOOV_T35l.equals(str) || MultiSimCardAccessor.MODEL_VIVO_Y13L.equals(str) || MultiSimCardAccessor.MODEL_VIVO_Y27.equals(str) || MultiSimCardAccessor.MODEL_E551LT.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_G760_TL00.equals(str) || MultiSimCardAccessor.MODEL_SONY_M35c.equals(str) || MultiSimCardAccessor.MODEL_K_Touch_Tou_ch_7.equals(str) || MultiSimCardAccessor.MODEL_Che2_TL00M.equals(str) || MultiSimCardAccessor.MODEL_N918St.equals(str) || MultiSimCardAccessor.MODEL_vivo_Y28L.equals(str) || MultiSimCardAccessor.MODEL_vivo_Y23L.equals(str) || MultiSimCardAccessor.MODEL_OPPO_3007.equals(str) || MultiSimCardAccessor.MODEL_OPPO_R8207.equals(str) || MultiSimCardAccessor.MODEL_ZTE_N958St.equals(str) || MultiSimCardAccessor.MODEL_OPPO_6607.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_Y635_TL00.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_CHM_TL00.equals(str)) {
this.o = false;
try {
Method method = Class.forName("android.telephony.MSimTelephonyManager").getMethod("getCallState", Integer.TYPE);
Object systemService = context.getSystemService("phone_msim");
int intValue = ((Integer) method.invoke(systemService, 0)).intValue();
i = ((Integer) method.invoke(systemService, 1)).intValue();
bm.a("su", "sim1Callstate===>>>" + intValue);
bm.a("su", "sim2Callstate===>>>" + i);
if (intValue != 0) {
i = intValue;
} else if (i == 0) {
i = 0;
}
} catch (Exception e2) {
e2.printStackTrace();
i = 0;
}
} else {
i = ((TelephonyManager) context.getSystemService(PhoneConstants.PHONE_KEY)).getCallState();
if ((MultiSimCardAccessor.MODEL_HTC_T328w.equals(str) || MultiSimCardAccessor.MODEL_HTC_T329w.equals(str) || MultiSimCardAccessor.MODEL_HTC_T528w.equals(str) || MultiSimCardAccessor.MODEL_HTCHTC_D820t.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_G700_T00.equals(str) || MultiSimCardAccessor.MODEL_HUAWEI_ROCK_TL00.equals(str) || str.equals(MultiSimCardAccessor.MODEL_ZTE_S2014) || str.equals(MultiSimCardAccessor.MODEL_OPPO_A51T) || MultiSimCardAccessor.MODEL_L1813.equals(str) || MultiSimCardAccessor.MODEL_HTC_802T.equals(str)) && (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a) || com.chinamobile.contacts.im.privacyspace.b.c.b(f3132a))) {
bm.d("su", "callstate===>>>1");
i = 1;
}
}
bm.a("su", "callstate===>>>" + i);
switch (i) {
case 0:
this.q = false;
f3132a = m.x(context);
if (d && com.aspire.strangecallssdk.h.b.a(this.p) && !TextUtils.isEmpty(e)) {
Intent intent2 = new Intent();
intent2.putExtra("data", e);
intent2.setAction("com.calllogslistfragment.call.action");
this.p.sendBroadcast(intent2);
}
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a)) {
this.h.setRingerMode(m.w(context));
}
if (com.chinamobile.contacts.im.config.a.b(context)) {
ay.a(context).a();
}
bm.d("su", "mStartTime-------->>" + System.currentTimeMillis() + "========" + j);
this.c = System.currentTimeMillis() - j;
j = 0L;
bm.d("su", "timeSpan---->" + this.c + d);
if (d) {
Main.c.execute(new c(this, context));
if (f3133b.equals("18818812590")) {
bm.d("king", "18818812590");
ay.a(context).b().cancel(ErrorCode.MSP_ERROR_TUV_GETHIDPARAM);
}
Main.c.execute(new d(this, context));
}
if (d && !com.chinamobile.contacts.im.privacyspace.b.c.b(f3132a)) {
bm.a(" ", "CALL_STATE_IDLE:--->>" + f3132a);
b(context);
}
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.start();
}
f = 0;
bm.a("aaaaaa", "lastetState: " + f);
break;
case 1:
m = System.currentTimeMillis();
this.q = true;
d = true;
if (System.currentTimeMillis() < k) {
k = 0L;
}
if (System.currentTimeMillis() < j) {
j = 0L;
}
if (System.currentTimeMillis() - k >= 5000) {
if (j == 0) {
j = System.currentTimeMillis();
}
bm.a("su", "mStartTime===>>>" + j);
this.c = 0L;
AddBlackDialogActivity.b();
k = System.currentTimeMillis();
f3132a = intent.getStringExtra("incoming_number");
a(context, f3132a);
bm.d("king", "incomingNumber22 " + f3132a);
if (f3132a == null) {
f3132a = "";
}
f3133b = f3132a;
try {
f3132a = f3132a.replace(ContactAccessor.PHONE_PREFIX1, "");
if (!TextUtils.isEmpty(f3132a)) {
e = f3132a;
}
m.i(context, f3132a);
if (com.chinamobile.contacts.im.config.a.b(context)) {
f3132a = intent.getStringExtra("incoming_number");
ay.a(context).a(f3132a, 11);
AspMobclickAgent.onEvent(context, "cloudServer_incomingShow");
com.chinamobile.contacts.im.f.c.a.a().b().G();
}
} catch (Exception e3) {
e3.printStackTrace();
}
if (com.chinamobile.contacts.im.privacyspace.b.c.b(f3132a)) {
bm.d("aaaaaa", "isExistPrivacyContact incomingNumber)");
return;
}
if (f != 2 || !com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a)) {
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a) && !this.r) {
this.h.setRingerMode(0);
if (this.g != null) {
this.g.endCall();
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3132a)) {
this.h.setRingerMode(m.w(context));
}
bm.a("iTelephony", "endcall=============");
c(context, 0);
return;
}
}
bm.a("mediaPlayer", "===========CALL_STATE_RINGING");
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.pause();
}
f = 1;
bm.a("aaaaaa", "lastetState: " + f);
break;
} else {
return;
}
} else {
return;
}
break;
case 2:
Log.e("已接通", "已接通电话");
this.q = false;
if (com.chinamobile.contacts.im.config.a.b(context) && d) {
ay.a(context).a();
}
f = 2;
bm.a(" ", "CALL_STATE_OFFHOOK:" + f3132a);
if (l == -1) {
l = System.currentTimeMillis();
}
bm.a("mediaPlayer", "===========CALL_STATE_OFFHOOK");
bm.a("aaaaaa", "lastetState: " + f);
break;
default:
bm.a("aaaaaa", "lastetState: " + f);
break;
}
}
} catch (Exception e4) {
e4.printStackTrace();
}
ThreadPoolMms.getOrCreateLower().execute(new e(this));
}
}
private void a(Context context, int i) {
long lastIncomingTypeCallId = ContactAccessor.getLastIncomingTypeCallId(context);
bm.d("king", "call_id " + lastIncomingTypeCallId);
j = 0L;
this.i = new com.chinamobile.contacts.im.donotdisturbe.b.d();
this.i.a(f3132a);
this.i.b(new Date().getTime());
this.i.g(0);
this.i.c((int) lastIncomingTypeCallId);
this.i.h(i);
j.r(context, true);
PhoneInterceptDBManager.insertPhoneIntercept(this.i);
}
private void a(Context context) {
String findLoc;
com.chinamobile.contacts.im.donotdisturbe.b.b bVar = new com.chinamobile.contacts.im.donotdisturbe.b.b();
bVar.a(KeyWordListDBManager.getInterceptUnReadSmsCount());
bVar.b(PhoneInterceptDBManager.getPhoneInterceptUnReadCount());
bVar.c(1);
bVar.d(com.chinamobile.contacts.im.donotdisturbe.d.c.b(context));
com.chinamobile.contacts.im.contacts.c.c contactInfoForPhoneNumber = ContactAccessor.getInstance().getContactInfoForPhoneNumber(f3132a);
if (contactInfoForPhoneNumber != null) {
String f2 = contactInfoForPhoneNumber.f();
if (TextUtils.isEmpty(f2)) {
bVar.a(f3132a);
if (f3132a.indexOf(ContactAccessor.PHONE_PREFIX2) > -1 || f3132a.indexOf(ContactAccessor.PHONE_PREFIX3) > -1) {
findLoc = Jni.findLoc(f3132a.substring(5));
} else {
findLoc = Jni.findLoc(f3132a);
}
if (TextUtils.isEmpty(findLoc)) {
findLoc = "未知地方";
}
bVar.b(findLoc);
} else {
bVar.a(f2);
bVar.b(f3132a);
}
}
com.chinamobile.contacts.im.donotdisturbe.d.a.a(context, bVar);
}
public static void a(i iVar) {
synchronized (n) {
n.remove(iVar);
}
}
public static void b(i iVar) {
synchronized (n) {
n.add(iVar);
}
}
private void b(Context context) {
bm.d("su", "showAddBlackDialogIfNeeded---timeSpan->>" + this.c + "=====lastetState--->>" + f);
long d2 = ContactAccessor.getInstance().getContactInfoForPhoneNumber(f3132a).d();
if (f == 2 && d2 == 0) {
long e2 = com.chinamobile.contacts.im.donotdisturbe.d.c.e(context);
int hours = new Date().getHours();
if (e2 == -1 && (((hours >= 23 && hours <= 24) || (hours >= 0 && hours <= 6)) && com.chinamobile.contacts.im.donotdisturbe.d.c.b(context) != 4 && !com.chinamobile.contacts.im.privacyspace.b.c.b(f3132a))) {
com.chinamobile.contacts.im.donotdisturbe.d.c.a(context, new Date().getTime());
context.startActivity(AddBlackDialogActivity.a(context, f3132a, 2));
}
bm.a("AAAAAA", "INCOMING_CALL_OFFHOOK" + f);
if (l != -1 && !TextUtils.isEmpty(f3132a) && !"-1".equals(f3132a) && !"-2".equals(f3132a)) {
Main.c.execute(new f(this, context));
} else {
l = -1L;
}
} else if (f == 1 && !TextUtils.isEmpty(f3132a) && d2 == 0) {
if (!d(context, f3132a)) {
c(context);
}
l = -1L;
}
com.chinamobile.contacts.im.call.b.h.a().c(f3132a);
}
@Override
public void a(int i) {
if (i == 4) {
if (com.chinamobile.contacts.im.setting.c.g.a().a(2) && !TextUtils.isEmpty(f3133b)) {
com.chinamobile.contacts.im.privacyspace.d.a.a(App.a(), f3133b);
}
f3133b = "";
}
}
private void a(Context context, String str) {
if (!TextUtils.isEmpty(str) && BlackWhiteListDBManager.checkWhiteByNumber(str) <= 0) {
com.chinamobile.contacts.im.contacts.c.d a2 = com.chinamobile.contacts.im.contacts.c.d.a(str);
if (a2 == null || a2.i() == 0) {
if (com.chinamobile.contacts.im.donotdisturbe.d.c.l(context) || com.chinamobile.contacts.im.donotdisturbe.d.c.k(context) || com.chinamobile.contacts.im.donotdisturbe.d.c.i(context) || com.chinamobile.contacts.im.donotdisturbe.d.c.j(context)) {
com.chinamobile.contacts.im.call.c.c a3 = com.chinamobile.contacts.im.call.b.h.a().a(str);
if (a3 != null) {
bm.d("king", "checkNumberInfo info.toString() " + a3.toString());
Message message = new Message();
message.what = 123211;
message.obj = a3;
this.t.sendMessage(message);
return;
}
Main.c.execute(new h(this, str));
}
}
}
}
public void b(Context context, int i) {
if (this.q && !this.r && this.g != null) {
try {
this.g.endCall();
c(context, i);
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
}
private void c(Context context, int i) {
this.r = true;
try {
Thread.sleep(2000L);
} catch (Exception e2) {
e2.printStackTrace();
}
a(context, i);
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).b()) {
a(context);
}
an.f1605a = true;
j.r(this.p, true);
an.a().a(LocationClientOption.MIN_AUTO_NOTIFY_INTERVAL, true);
com.chinamobile.contacts.im.setting.c.g.a().d();
context.sendBroadcast(new Intent("notify_user"));
}
public boolean b(Context context, String str) {
bm.a("AAAAAA", "isNO---" + f3132a);
Long valueOf = Long.valueOf(ContactAccessor.getInstance().getPersonId(f3132a));
com.aspire.strangecallssdk.a.b a2 = com.chinamobile.contacts.im.call.b.h.a().a(f3132a, true);
if (valueOf.longValue() == -1 && ci.a().c().get(f3132a) == null && a2 == null) {
bm.a("AAAAAA", "isNO---true");
return true;
}
bm.a("AAAAAA", "isNO---false");
return false;
}
private void c(Context context) {
int i = 0;
try {
b(3);
Long valueOf = Long.valueOf(ContactAccessor.getInstance().getPersonId(f3132a));
if (!this.s && valueOf.longValue() == -1 && ci.a().c().get(f3132a) == null) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
long time = simpleDateFormat.parse(simpleDateFormat.format(new Date())).getTime();
List<com.chinamobile.contacts.im.call.c.a> c = c(this.p, f3132a);
bm.a("AAAAAA", c.size() + "");
if (c.size() > 3 || c.size() == 3) {
for (com.chinamobile.contacts.im.call.c.a aVar : c) {
bm.a("AAAAAA", aVar.d() + "");
i = (aVar.f() <= time || !(aVar.d() == 3 || aVar.d() == 5)) ? i : i + 1;
}
}
bm.a("AAAAAA", i + "");
if (i >= 3 && !com.chinamobile.contacts.im.config.a.f(this.p, f3132a) && b()) {
com.aspire.strangecallssdk.a.b a2 = com.chinamobile.contacts.im.call.b.h.a().a(f3132a, true);
if (a2 == null) {
context.startActivity(MarkNumberDialogActivity.a(context, f3132a, 0));
bm.a("AAAAAA", "aaaa");
} else {
context.startActivity(MarkNumberDialogActivity.b(context, f3132a, MarkNumberDialogActivity.f2197b, String.valueOf(a2.d), a2.f625b));
bm.a("AAAAAA", "bbbb");
}
}
}
} catch (ParseException e2) {
e2.printStackTrace();
}
}
public boolean b() {
return com.chinamobile.contacts.im.config.a.c(this.p);
}
private List<com.chinamobile.contacts.im.call.c.a> c(Context context, String str) {
Cursor cursor;
Cursor cursor2;
ArrayList arrayList = new ArrayList();
ContentResolver contentResolver = context.getContentResolver();
com.chinamobile.contacts.im.call.c.a aVar = new com.chinamobile.contacts.im.call.c.a();
Cursor cursor3 = null;
try {
try {
cursor = contentResolver.query(CallLog.Calls.CONTENT_URI, new String[]{"_id", "duration", "new", "type", "number", "date"}, "number = " + str, null, "_id DESC");
while (cursor.moveToNext()) {
try {
aVar.c(cursor.getInt(0));
aVar.a(cursor.getString(4));
aVar.d(cursor.getInt(3));
aVar.a(cursor.getLong(1));
aVar.a(cursor.getInt(2));
aVar.b(cursor.getLong(5));
arrayList.add(aVar);
} catch (Exception e2) {
e = e2;
bm.a("su", "更新出错了");
e.printStackTrace();
}
}
} catch (Throwable th) {
th = th;
cursor3 = cursor2;
if (cursor3 != null) {
cursor3.close();
}
throw th;
}
} catch (Exception e3) {
e = e3;
cursor = null;
} catch (Throwable th2) {
th = th2;
if (cursor3 != null) {
}
throw th;
}
}
public boolean d(Context context, String str) {
context.getContentResolver();
Cursor cursor = null;
try {
try {
com.chinamobile.contacts.im.call.c.a d2 = d(context);
bm.a("AAAAAA", d2.e() + "tong");
bm.a("AAAAAA", d2.a() + "tong");
bm.a("AAAAAA", d2.d() + "tong");
if (str.equals(d2.j()) && d2.d() == 1 && d2.a() == 1) {
if (d2.e() == 0) {
if (0 == 0) {
return true;
}
cursor.close();
return true;
}
}
} catch (Exception e2) {
bm.a("su", "更新出错了");
e2.printStackTrace();
}
} catch (Throwable th) {
if (0 != 0) {
cursor.close();
}
throw th;
}
}
public com.chinamobile.contacts.im.call.c.a d(Context context) {
Cursor cursor;
b(3);
ContentResolver contentResolver = context.getContentResolver();
com.chinamobile.contacts.im.call.c.a aVar = new com.chinamobile.contacts.im.call.c.a();
Cursor cursor2 = null;
try {
cursor = contentResolver.query(CallLog.Calls.CONTENT_URI, new String[]{"_id", "duration", "new", "type", "number"}, " date >" + (System.currentTimeMillis() - 60000), null, "_id DESC LIMIT 1");
if (cursor != null) {
try {
try {
if (cursor.moveToFirst()) {
aVar.c(cursor.getInt(0));
aVar.a(cursor.getString(4));
aVar.d(cursor.getInt(3));
aVar.a(cursor.getLong(1));
aVar.a(cursor.getInt(2));
}
} catch (Exception e2) {
e = e2;
bm.a("su", "更新出错了");
e.printStackTrace();
}
} catch (Throwable th) {
th = th;
cursor2 = cursor;
if (cursor2 != null) {
cursor2.close();
}
throw th;
}
}
} catch (Exception e3) {
e = e3;
cursor = null;
} catch (Throwable th2) {
th = th2;
if (cursor2 != null) {
}
throw th;
}
}
private void b(int i) {
try {
Thread.sleep(i * 1000);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
}
}