时间表代码优化

serial
liuguijing 1 year ago
parent 15a47c5f2c
commit 7fdde50837

@ -17,6 +17,7 @@ import android.text.TextUtils;
import androidx.core.app.ActivityCompat;
import com.dev.devapi.api.SysApi;
import com.xypower.common.RegexUtil;
import java.text.SimpleDateFormat;
@ -62,11 +63,11 @@ public class SimUtil {
if (content.contains(SmsTypeEnum.REBOOT1.value())) {
ifmessageCorrect = true;
sendtype = SmsTypeEnum.REBOOT1.value();
sendmessage = content + " OK";
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.REBOOT2.value())) {
ifmessageCorrect = true;
sendtype = SmsTypeEnum.REBOOT2.value();
sendmessage = content + " OK";
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.SET_YW_SCHEDULE.value())) {
ifmessageCorrect = true;
String[] split1 = StringUtils.splitString1(content);
@ -112,14 +113,8 @@ public class SimUtil {
}
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendtype = SmsTypeEnum.SET_YW_SCHEDULE.value();
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_YW_SCHEDULE.value())) {
ifmessageCorrect = true;
List<Integer> absHeartbeats = UpdateSysConfigUtil.getAbsHeartbeats(context);
@ -149,13 +144,7 @@ public class SimUtil {
}
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_OPERATE.value())) {
sendtype = SmsTypeEnum.GET_OPERATE.value();
ifmessageCorrect = true;
@ -180,13 +169,7 @@ public class SimUtil {
}
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_OPERATE_URL.value())) {
sendtype = SmsTypeEnum.GET_OPERATE_URL.value();
ifmessageCorrect = true;
@ -200,13 +183,7 @@ public class SimUtil {
String s = split1[1];
DownloadUtils downloadUtils = new DownloadUtils(context.getApplicationContext(), s, "test.app");
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.SET_CMDID.value())) {
sendtype = SmsTypeEnum.SET_CMDID.value();
String[] split1 = StringUtils.splitString1(content);
@ -215,13 +192,7 @@ public class SimUtil {
String cmdid = split1[1];
UpdateSysConfigUtil.setCmdid(context, cmdid);
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_CMDID.value())) {
sendtype = SmsTypeEnum.GET_CMDID.value();
ifmessageCorrect = true;
@ -253,13 +224,7 @@ public class SimUtil {
}
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_IP.value())) {
sendtype = SmsTypeEnum.GET_IP.value();
ifmessageCorrect = true;
@ -268,13 +233,7 @@ public class SimUtil {
} else if (content.contains(SmsTypeEnum.SET_OSD.value())) {
sendtype = SmsTypeEnum.SET_OSD.value();
String[] split1 = StringUtils.splitString1(content);
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
if (split1 != null && split1.length == 2) {
ifmessageCorrect = true;
HashMap<String, String> osdmap = new HashMap<>();
@ -357,13 +316,7 @@ public class SimUtil {
if (split2 != null && split2.length == 2) {
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value())) {
sendtype = SmsTypeEnum.GET_PHOTO_SCHEDULE_LIST.value();
ifmessageCorrect = true;
@ -386,13 +339,7 @@ public class SimUtil {
}
}
}
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.GET_RESOLUTION.value())) {
sendtype = SmsTypeEnum.GET_RESOLUTION.value();
ifmessageCorrect = true;
@ -473,36 +420,18 @@ public class SimUtil {
sendtype = SmsTypeEnum.CLEAR_PHOTO.value();
ifmessageCorrect = true;
UpdateSysConfigUtil.clearHistoryPic(context);
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.CLEAR_LOG.value())) {
sendtype = SmsTypeEnum.CLEAR_LOG.value();
ifmessageCorrect = true;
UpdateSysConfigUtil.clearHistoryLogs(context);
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
} else if (content.contains(SmsTypeEnum.CLEAR_ALL.value())) {
sendtype = SmsTypeEnum.CLEAR_ALL.value();
ifmessageCorrect = true;
UpdateSysConfigUtil.clearHistoryPic(context);
UpdateSysConfigUtil.clearHistoryLogs(context);
String menssageBack = "";
if (ifmessageCorrect) {
menssageBack = " OK";
} else {
menssageBack = " ERROR";
}
sendmessage = content + menssageBack;
sendmessage = getSendString(content, ifmessageCorrect);
}
sendSms(context, slot, sender, sendmessage, sendtype, ifmessageCorrect);
}
@ -611,14 +540,18 @@ public class SimUtil {
}
if (localSubscriptionManager.getActiveSubscriptionInfoCount() > 1) {
List localList = localSubscriptionManager.getActiveSubscriptionInfoList();
SubscriptionInfo simInfo1 = (SubscriptionInfo) localList.get(0);
SubscriptionInfo simInfo2 = (SubscriptionInfo) localList.get(1);
SubscriptionInfo simInfoAnother;
if (slot == 0) {
simInfoAnother = simInfo1;
} else {
simInfoAnother = simInfo2;
boolean doubleSim = isDoubleSim(mContext);
SubscriptionInfo simInfoAnother = null;
if (doubleSim) {
if (localList != null && localList.size() > 1) {
SubscriptionInfo simInfo1 = (SubscriptionInfo) localList.get(0);
SubscriptionInfo simInfo2 = (SubscriptionInfo) localList.get(1);
if (slot == 0) {
simInfoAnother = simInfo1;
} else {
simInfoAnother = simInfo2;
}
}
}
Intent itSend = new Intent(SMS_SEND_ACTION);
itSend.putExtra(SMSTYPE, value);
@ -630,7 +563,9 @@ public class SimUtil {
// Intent itDeliver = new Intent(SMS_DELIVERED_ACTION);
//deliveryIntent参数为传送后接受的广播信息PendingIntent
// PendingIntent deliverPI = PendingIntent.getBroadcast(mContext,0,itDeliver,0);
SmsManager.getSmsManagerForSubscriptionId(simInfoAnother.getSubscriptionId()).sendTextMessage(sender, null, message, sendPI, null);
if (simInfoAnother != null) {
SmsManager.getSmsManagerForSubscriptionId(simInfoAnother.getSubscriptionId()).sendTextMessage(sender, null, message, sendPI, null);
}
}
}
}

@ -44,13 +44,6 @@ public class SmsSendReceiver extends BroadcastReceiver {
UpdateSysConfigUtil.restartApp(context);
} else if (type.contains(SmsTypeEnum.SET_PACKAGE.value())) {
UpdateSysConfigUtil.restartApp(context);
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
} else if (type.contains(SmsTypeEnum.REBOOT2.value())) {
}
}
}

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Environment;
import com.dev.devapi.api.SysApi;
import com.xypower.common.FileUtils;
import com.xypower.common.JSONUtils;
import com.xypower.common.MicroPhotoContext;

Loading…
Cancel
Save