|
@@ -85,21 +85,24 @@ public class PhoneStateReceiver extends BroadcastReceiver {
|
|
|
//待机中
|
|
|
//Log.d(TAG, "PhoneStateReceiver idle");
|
|
|
if (Constants.Companion.getPhoneState() != Constants.PHONE_IDLE) {
|
|
|
- //发送tcp
|
|
|
- /*if (Constants.Companion.getPhoneDataVO() != null) {
|
|
|
- TcpModel tcpModel = PhoneUtil.phoneHandoff(Constants.Companion.getDeviceId(), Constants.Companion.getPhoneDataVO());
|
|
|
- NettyClient.Companion.getInstance().sendMsg(tcpModel.toJson()).subscribe(it -> {
|
|
|
- if (it) {
|
|
|
- Log.d(TAG, "TCP.发送消息完成");
|
|
|
- } else {
|
|
|
- Log.e(TAG, "TCP.发送消息失败");
|
|
|
- HandleTcpConnect.Companion.getInstance().tcpReConnectWithMsgShow();
|
|
|
- }
|
|
|
- });
|
|
|
- }*/
|
|
|
-
|
|
|
- //通话结束,上传通话记录
|
|
|
- EventBus.getDefault().post(new MessageEvent("call_end", Constants.EVENT_CALL_END));
|
|
|
+ if (!Constants.uploadCalllog) {
|
|
|
+ //发送tcp
|
|
|
+ if (Constants.Companion.getPhoneDataVO() != null) {
|
|
|
+ TcpModel tcpModel = PhoneUtil.phoneHandoff(Constants.Companion.getDeviceId(), Constants.Companion.getPhoneDataVO());
|
|
|
+ NettyClient.Companion.getInstance().sendMsg(tcpModel.toJson()).subscribe(it -> {
|
|
|
+ if (it) {
|
|
|
+ Log.d(TAG, "TCP.发送消息完成");
|
|
|
+ } else {
|
|
|
+ Log.e(TAG, "TCP.发送消息失败");
|
|
|
+ HandleTcpConnect.Companion.getInstance().tcpReConnectWithMsgShow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Constants.Companion.setPhoneDataVO(null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //通话结束,上传通话记录
|
|
|
+ EventBus.getDefault().post(new MessageEvent("call_end", Constants.EVENT_CALL_END));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
DeviceChannel.calling = false;
|
|
@@ -152,18 +155,20 @@ public class PhoneStateReceiver extends BroadcastReceiver {
|
|
|
RecordHelper.getInstance().stopCancelRecordByOther(true);
|
|
|
EventBus.getDefault().post(new MessageEvent(true, Constants.EVENT_CLEAR_IM));
|
|
|
if (Constants.Companion.getPhoneState() == Constants.PHONE_INCOMING) {
|
|
|
- //发送tcp
|
|
|
- /*if (Constants.Companion.getPhoneDataVO() != null) {
|
|
|
- TcpModel tcpModel = PhoneUtil.phoneAccept(Constants.Companion.getDeviceId(), Constants.Companion.getPhoneDataVO());
|
|
|
- NettyClient.Companion.getInstance().sendMsg(tcpModel.toJson()).subscribe(it -> {
|
|
|
- if (it) {
|
|
|
- Log.d(TAG, "TCP.发送消息完成");
|
|
|
- } else {
|
|
|
- Log.e(TAG, "TCP.发送消息失败");
|
|
|
- HandleTcpConnect.Companion.getInstance().tcpReConnectWithMsgShow();
|
|
|
- }
|
|
|
- });
|
|
|
- }*/
|
|
|
+ if (!Constants.uploadCalllog) {
|
|
|
+ //发送tcp
|
|
|
+ if (Constants.Companion.getPhoneDataVO() != null) {
|
|
|
+ TcpModel tcpModel = PhoneUtil.phoneAccept(Constants.Companion.getDeviceId(), Constants.Companion.getPhoneDataVO());
|
|
|
+ NettyClient.Companion.getInstance().sendMsg(tcpModel.toJson()).subscribe(it -> {
|
|
|
+ if (it) {
|
|
|
+ Log.d(TAG, "TCP.发送消息完成");
|
|
|
+ } else {
|
|
|
+ Log.e(TAG, "TCP.发送消息失败");
|
|
|
+ HandleTcpConnect.Companion.getInstance().tcpReConnectWithMsgShow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
} else if (Constants.Companion.getPhoneState() == Constants.PHONE_IDLE) {
|
|
|
Constants.Companion.setPhoneState(Constants.PHONE_OUTGOING);
|
|
|
} else {
|