和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1
以下内容为反编译后的 IncomingCallsReceiver.java 源代码,内容仅作参考
package com.chinamobile.contacts.im.receiver;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
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.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.aw;
import com.chinamobile.contacts.im.cloudserver.al;
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.aq;
import com.gmcc.mmeeting.sdk.ConferenceCommander;
import com.iflytek.cloud.ErrorCode;
import com.umeng.analytics.MobclickAgent;
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.Iterator;
public class IncomingCallsReceiver extends b implements com.chinamobile.contacts.im.e.d {
public static String f3141a;
public static String f3142b;
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<h> n = new HashSet<>();
long c = 0;
private boolean q = false;
private boolean r = false;
@SuppressLint({"HandlerLeak"})
private Handler s = new f(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);
aq.a("whj", "----进入----" + d);
m.c(context, this.h.getRingerMode());
if (m.o(context) || com.chinamobile.contacts.im.config.h.f1787a) {
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_S2014)) {
f3141a = intent.getStringExtra("incoming_number");
if (f3141a == null) {
f3141a = "";
}
f3141a = f3141a.replace(ContactAccessor.PHONE_PREFIX1, "");
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3141a)) {
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");
f3142b = stringExtra;
if (com.chinamobile.contacts.im.config.a.b(context)) {
System.out.println("----去电弹窗----");
((TelephonyManager) context.getSystemService(PhoneConstants.PHONE_KEY)).getCallState();
aw.a(context).a(stringExtra, 10);
MobclickAgent.onEvent(context, "cloudServer_incomingShow");
com.chinamobile.contacts.im.f.c.a.a().b().L();
}
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.pause();
}
aq.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();
aq.a("su", "sim1Callstate===>>>" + intValue);
aq.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(f3141a) || com.chinamobile.contacts.im.privacyspace.b.c.b(f3141a))) {
aq.d("su", "callstate===>>>1");
i = 1;
}
}
aq.a("su", "callstate===>>>" + i);
switch (i) {
case 0:
this.q = false;
f3141a = m.y(context);
if (d && com.aspire.strangecallssdk.h.c.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(f3141a)) {
this.h.setRingerMode(m.x(context));
}
if (com.chinamobile.contacts.im.config.a.b(context)) {
aw.a(context).a();
}
aq.d("su", "mStartTime-------->>" + System.currentTimeMillis() + "========" + j);
this.c = System.currentTimeMillis() - j;
j = 0L;
aq.d("su", "timeSpan---->" + this.c + d);
if (d) {
if (f3142b.equals("18818812590")) {
aq.d("king", "18818812590");
aw.a(context).b().cancel(ErrorCode.MSP_ERROR_TUV_GETHIDPARAM);
}
Main.f1278b.execute(new c(this, context));
}
if (d && !com.chinamobile.contacts.im.privacyspace.b.c.b(f3141a)) {
aq.a(" ", "CALL_STATE_IDLE:--->>" + f3141a);
b(context);
}
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.start();
}
f = 0;
aq.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 >= ConferenceCommander.DEFAULT_LOOPING_TIME) {
if (j == 0) {
j = System.currentTimeMillis();
}
aq.a("su", "mStartTime===>>>" + j);
this.c = 0L;
AddBlackDialogActivity.b();
k = System.currentTimeMillis();
f3141a = intent.getStringExtra("incoming_number");
a(context, f3141a);
aq.d("king", "incomingNumber22 " + f3141a);
if (f3141a == null) {
f3141a = "";
}
f3142b = f3141a;
try {
f3141a = f3141a.replace(ContactAccessor.PHONE_PREFIX1, "");
if (!TextUtils.isEmpty(f3141a)) {
e = f3141a;
}
m.k(context, f3141a);
if (com.chinamobile.contacts.im.config.a.b(context)) {
f3141a = intent.getStringExtra("incoming_number");
aw.a(context).a(f3141a, 11);
MobclickAgent.onEvent(context, "cloudServer_incomingShow");
com.chinamobile.contacts.im.f.c.a.a().b().J();
}
} catch (Exception e3) {
e3.printStackTrace();
}
if (com.chinamobile.contacts.im.privacyspace.b.c.b(f3141a)) {
aq.d("aaaaaa", "isExistPrivacyContact incomingNumber)");
return;
}
if (f != 2 || !com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3141a)) {
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3141a) && !this.r) {
this.h.setRingerMode(0);
if (this.g != null) {
this.g.endCall();
if (com.chinamobile.contacts.im.donotdisturbe.d.b.a(context).a(f3141a)) {
this.h.setRingerMode(m.x(context));
}
aq.a("iTelephony", "endcall=============");
c(context, 0);
return;
}
}
aq.a("mediaPlayer", "===========CALL_STATE_RINGING");
if (MediaManager.mediaPlayer != null) {
MediaManager.mediaPlayer.pause();
}
f = 1;
aq.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) {
aw.a(context).a();
}
f = 2;
aq.a(" ", "CALL_STATE_OFFHOOK:" + f3141a);
if (l == -1) {
l = System.currentTimeMillis();
}
aq.a("mediaPlayer", "===========CALL_STATE_OFFHOOK");
aq.a("aaaaaa", "lastetState: " + f);
break;
default:
aq.a("aaaaaa", "lastetState: " + f);
break;
}
}
} catch (Exception e4) {
e4.printStackTrace();
}
ThreadPoolMms.getOrCreateLower().execute(new d(this));
}
}
private void a(Context context, int i) {
long lastIncomingTypeCallId = ContactAccessor.getLastIncomingTypeCallId(context);
aq.d("king", "call_id " + lastIncomingTypeCallId);
j = 0L;
this.i = new com.chinamobile.contacts.im.donotdisturbe.b.d();
this.i.a(f3141a);
this.i.b(new Date().getTime());
this.i.g(0);
this.i.c((int) lastIncomingTypeCallId);
this.i.h(i);
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.b contactInfoForPhoneNumber = ContactAccessor.getInstance().getContactInfoForPhoneNumber(f3141a);
if (contactInfoForPhoneNumber != null) {
String f2 = contactInfoForPhoneNumber.f();
if (TextUtils.isEmpty(f2)) {
bVar.a(f3141a);
if (f3141a.indexOf(ContactAccessor.PHONE_PREFIX2) > -1 || f3141a.indexOf(ContactAccessor.PHONE_PREFIX3) > -1) {
findLoc = Jni.findLoc(f3141a.substring(5));
} else {
findLoc = Jni.findLoc(f3141a);
}
if (TextUtils.isEmpty(findLoc)) {
findLoc = "未知地方";
}
bVar.b(findLoc);
} else {
bVar.a(f2);
bVar.b(f3141a);
}
}
com.chinamobile.contacts.im.donotdisturbe.d.a.a(context, bVar);
}
public static void a(h hVar) {
synchronized (n) {
n.remove(hVar);
}
}
public static void b(h hVar) {
synchronized (n) {
n.add(hVar);
}
}
private void b(Context context) {
aq.d("su", "showAddBlackDialogIfNeeded---timeSpan->>" + this.c + "=====lastetState--->>" + f);
long d2 = ContactAccessor.getInstance().getContactInfoForPhoneNumber(f3141a).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(f3141a))) {
com.chinamobile.contacts.im.donotdisturbe.d.c.a(context, new Date().getTime());
context.startActivity(AddBlackDialogActivity.a(context, f3141a, 2));
}
if (l != -1 && !TextUtils.isEmpty(f3141a) && !"-1".equals(f3141a) && !"-2".equals(f3141a)) {
Main.f1278b.execute(new e(this, context));
return;
} else {
l = -1L;
return;
}
}
if (f == 1 && !TextUtils.isEmpty(f3141a) && d2 == 0) {
if (this.c < ConferenceCommander.DEFAULT_LOOPING_TIME) {
context.startActivity(AddBlackDialogActivity.a(context, f3141a, 1));
}
c(context);
l = -1L;
}
}
@Override
public void a(int i) {
if (i == 4) {
if (com.chinamobile.contacts.im.setting.c.g.a().a(2) && !TextUtils.isEmpty(f3142b)) {
com.chinamobile.contacts.im.privacyspace.d.a.a(App.a(), f3142b);
}
f3142b = "";
}
}
private void a(Context context, String str) {
if (!TextUtils.isEmpty(str) && BlackWhiteListDBManager.checkWhiteByNumber(str) <= 0) {
com.chinamobile.contacts.im.contacts.c.c a2 = com.chinamobile.contacts.im.contacts.c.c.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 b2 = com.chinamobile.contacts.im.call.b.h.a().b(str);
if (b2 != null) {
aq.d("king", "checkNumberInfo info.toString() " + b2.toString());
Message message = new Message();
message.what = 123211;
message.obj = b2;
this.s.sendMessage(message);
return;
}
Main.f1278b.execute(new g(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);
}
al.f1679a = true;
al.a().a(LocationClientOption.MIN_AUTO_NOTIFY_INTERVAL, true);
com.chinamobile.contacts.im.setting.c.g.a().d();
context.sendBroadcast(new Intent("notify_user"));
}
private void c(Context context) {
int i = 0;
try {
if (Long.valueOf(ContactAccessor.getInstance().getPersonId(f3141a)).longValue() == -1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
long time = simpleDateFormat.parse(simpleDateFormat.format(new Date())).getTime();
ArrayList<com.chinamobile.contacts.im.call.c.b> loadCallLogs = ContactAccessor.getInstance().loadCallLogs(this.p, f3141a);
if (loadCallLogs.size() > 3 || (loadCallLogs.size() == 3 && this.c < 3000)) {
Iterator<com.chinamobile.contacts.im.call.c.b> it = loadCallLogs.iterator();
while (it.hasNext()) {
com.chinamobile.contacts.im.call.c.b next = it.next();
i = (next.f() <= time || next.e() >= 3) ? i : i + 1;
}
}
if (i >= 3 && !com.chinamobile.contacts.im.config.a.f(this.p, f3141a)) {
com.aspire.strangecallssdk.a.b a2 = com.chinamobile.contacts.im.call.b.h.a().a(f3141a);
if (a2 == null) {
context.startActivity(MarkNumberDialogActivity.a(context, f3141a, 0));
} else {
context.startActivity(MarkNumberDialogActivity.b(context, f3141a, MarkNumberDialogActivity.f2255b, String.valueOf(a2.d), a2.f626b));
}
}
}
} catch (ParseException e2) {
e2.printStackTrace();
}
}
}