|
@@ -97,14 +97,30 @@ public class PhoneStateReceiver extends BroadcastReceiver {
|
|
Constants.Companion.setPhoneState(Constants.PHONE_CALLING);
|
|
Constants.Companion.setPhoneState(Constants.PHONE_CALLING);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//非白名单号码拦截并删除记录
|
|
//非白名单号码拦截并删除记录
|
|
- if (!Constants.Companion.getPhoneWhiteList().contains(extraIncomingNumber)) {
|
|
|
|
- showMessage("非法号码!");
|
|
|
|
|
|
+ if (Constants.Companion.getPhoneWhiteList() != null) {
|
|
|
|
+ for (String s : Constants.Companion.getPhoneWhiteList()) {
|
|
|
|
+ if (s.contains(extraIncomingNumber)) { //号码在白名单内修改通话状态,并退出方法
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //循环结束,说明来电号码不在白名单内,挂断来电
|
|
|
|
+ showMessage("非法来电:" + extraIncomingNumber);
|
|
Constants.Companion.setPhoneState(Constants.PHONE_IDLE);
|
|
Constants.Companion.setPhoneState(Constants.PHONE_IDLE);
|
|
boolean res = PhoneCallUtil.endCall(context);
|
|
boolean res = PhoneCallUtil.endCall(context);
|
|
- Log.d(TAG, "end call result22222: " + res);
|
|
|
|
|
|
+ Log.d(TAG, "end call result: " + res);
|
|
PhoneCallUtil.deleteCallLog(context, extraIncomingNumber);
|
|
PhoneCallUtil.deleteCallLog(context, extraIncomingNumber);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// //非白名单号码拦截并删除记录
|
|
|
|
+// if (!Constants.Companion.getPhoneWhiteList().contains(extraIncomingNumber)) {
|
|
|
|
+// showMessage("非法来电!");
|
|
|
|
+// Constants.Companion.setPhoneState(Constants.PHONE_IDLE);
|
|
|
|
+// boolean res = PhoneCallUtil.endCall(context);
|
|
|
|
+// Log.d(TAG, "end call result22222: " + res);
|
|
|
|
+// PhoneCallUtil.deleteCallLog(context, extraIncomingNumber);
|
|
|
|
+// }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|