|
|
|
@ -11,8 +11,6 @@ import android.content.Intent;
|
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
import android.net.ConnectivityManager;
|
|
|
|
|
import android.net.Network;
|
|
|
|
|
import android.net.NetworkInfo;
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
import android.os.Build;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
@ -40,8 +38,10 @@ import org.json.JSONException;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -61,17 +61,19 @@ public class SimUtil {
|
|
|
|
|
// 自定义ACTION常数 作为广播的IntentFilter识别常数
|
|
|
|
|
public static String SMS_SEND_ACTION = "com.xypower.mpmaster.SMS_SEND_ACTION";
|
|
|
|
|
|
|
|
|
|
public static String SMSTYPE = "smstype";
|
|
|
|
|
|
|
|
|
|
public static String SMSIFCORRECT = "smsifcorrect";
|
|
|
|
|
public static String SMSRESTARTTYPE = "restartType";
|
|
|
|
|
|
|
|
|
|
private static int mRequestCode = 1;
|
|
|
|
|
private static String sendmessage = null;//要回复的短信
|
|
|
|
|
|
|
|
|
|
private static int restartType = -1;//重启类型
|
|
|
|
|
|
|
|
|
|
//短信解析
|
|
|
|
|
public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) {
|
|
|
|
|
sendmessage = null;
|
|
|
|
|
restartType = -1;
|
|
|
|
|
SmsMessageModel smsInfo = getSMSInfo(intent, smsMessage);
|
|
|
|
|
if (smsInfo != null) {
|
|
|
|
|
String packageName = context.getApplicationContext().getPackageName();
|
|
|
|
|
String content = smsInfo.getContent();
|
|
|
|
|
int pos = content.lastIndexOf("##");
|
|
|
|
|
if (pos != -1) {
|
|
|
|
@ -80,7 +82,6 @@ public class SimUtil {
|
|
|
|
|
int slot = smsInfo.getSlot();//那张卡收到的短信
|
|
|
|
|
String sender = smsInfo.getSender();//收到的短信的手机号
|
|
|
|
|
String sendmessage = "ERROR";//要回复的短信
|
|
|
|
|
String sendtype = "";//收到的短信类型
|
|
|
|
|
List<Integer> abslist = new ArrayList<>();//收到的短信内容拆分包装成数组
|
|
|
|
|
boolean ifmessageCorrect = false;//用来判断收到的短信内容是否正确
|
|
|
|
|
if (StringUtils.isEmpty(content)) {
|
|
|
|
@ -717,171 +718,282 @@ public class SimUtil {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void updateConfigFile(Context context, String content) {
|
|
|
|
|
String result = "";
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
int rebootMpApp = 0;
|
|
|
|
|
|
|
|
|
|
//修改配置文件中参数
|
|
|
|
|
private static void updateConfig(String content) {
|
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()));
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
int numberOfFields = 0;
|
|
|
|
|
|
|
|
|
|
String filePath = null;
|
|
|
|
|
String fileName = null;
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int pos = part.indexOf("=");
|
|
|
|
|
if (pos == -1) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String key = part.substring(0, pos);
|
|
|
|
|
String value = part.substring(pos + 1);
|
|
|
|
|
if (value.contains("&&")) {
|
|
|
|
|
value = value.replace("&&", ",");
|
|
|
|
|
}
|
|
|
|
|
if (TextUtils.equals(key, "f")) {
|
|
|
|
|
fileType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "c")) {
|
|
|
|
|
numberOfFields = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "r")) {
|
|
|
|
|
rebootMpApp = Integer.parseInt(value);
|
|
|
|
|
restartType = Integer.parseInt(value);
|
|
|
|
|
} else {
|
|
|
|
|
fields.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String filePath = null;
|
|
|
|
|
String fileName = null;
|
|
|
|
|
switch (fileType) {
|
|
|
|
|
case 1:
|
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/";
|
|
|
|
|
fileName = "App.json";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
filePath = MicroPhotoContext.buildMasterAppDir(context) + "/data/";
|
|
|
|
|
fileName = "Master.json";
|
|
|
|
|
break;
|
|
|
|
|
case 91:
|
|
|
|
|
case 92:
|
|
|
|
|
case 93:
|
|
|
|
|
case 94:
|
|
|
|
|
case 95:
|
|
|
|
|
case 96:
|
|
|
|
|
case 97:
|
|
|
|
|
case 98:
|
|
|
|
|
case 99:
|
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/channels/";
|
|
|
|
|
fileName = Integer.toString(fileType - 90) + ".json";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
if (!TextUtils.isEmpty(filePath) && !TextUtils.isEmpty(fileName) && numberOfFields > 0) {
|
|
|
|
|
for (int idx = 0; idx <= numberOfFields; idx++) {
|
|
|
|
|
for (int idx = 0; idx < numberOfFields; idx++) {
|
|
|
|
|
String idxStr = Integer.toString(idx);
|
|
|
|
|
// JSONObject jsonConfig = jsonConfigs.getJSONObject(idx);
|
|
|
|
|
String configName = fields.containsKey("n" + idxStr) ? fields.get("n" + idxStr) : null;
|
|
|
|
|
int configType = fields.containsKey("t" + idxStr) ? Integer.parseInt(fields.get("t" + idxStr)) : 0;
|
|
|
|
|
String configValue = fields.containsKey("v" + idxStr) ? fields.get("v" + idxStr) : null;
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(configValue)) {
|
|
|
|
|
if (configType == 0) { // Number
|
|
|
|
|
Long val = Long.parseLong(configValue);
|
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, val);
|
|
|
|
|
} else if (configType == 1) {
|
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue);
|
|
|
|
|
} else if (configType == 2) { // Float
|
|
|
|
|
Float val = Float.parseFloat(configValue);
|
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, val);
|
|
|
|
|
} else if (configType == 3) { //数组
|
|
|
|
|
JSONArray objects = new JSONArray(configValue);
|
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, objects);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue);
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rebootMpApp != 0) {
|
|
|
|
|
MicroPhotoContext.restartMpApp(context, "Config Updated From SMS");
|
|
|
|
|
// if (rebootMpApp != 0) {
|
|
|
|
|
// MicroPhotoContext.restartMpApp(context, "Config Updated From SMS");
|
|
|
|
|
// } else {
|
|
|
|
|
// Intent intent = new Intent();
|
|
|
|
|
// intent.setAction(MicroPhotoContext.ACTION_UPDATE_CONFIGS_MP);
|
|
|
|
|
// intent.setPackage(MicroPhotoContext.PACKAGE_NAME_MPAPP);
|
|
|
|
|
// context.sendBroadcast(intent);
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
intent.setAction(MicroPhotoContext.ACTION_UPDATE_CONFIGS_MP);
|
|
|
|
|
intent.setPackage(MicroPhotoContext.PACKAGE_NAME_MPAPP);
|
|
|
|
|
context.sendBroadcast(intent);
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
sendmessage = content + " OK";
|
|
|
|
|
} else {
|
|
|
|
|
sendmessage = content + " ERROR";
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String queryConfigFile(Context context, String content) {
|
|
|
|
|
String result = "ERR";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//替换配置文件
|
|
|
|
|
private static void updateFile(String content) {
|
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.UPD_FILE.value().length()));
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
int numberOfFields = 0;
|
|
|
|
|
String filePath = null;
|
|
|
|
|
|
|
|
|
|
String fileName = null;
|
|
|
|
|
String fileStr = null;
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int pos = part.indexOf("=");
|
|
|
|
|
if (pos == -1) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String key = part.substring(0, pos);
|
|
|
|
|
String value = part.substring(pos + 1);
|
|
|
|
|
if (TextUtils.equals(key, "f")) {
|
|
|
|
|
fileType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "v")) {
|
|
|
|
|
fileStr = value;
|
|
|
|
|
} else if (TextUtils.equals(key, "r")) {
|
|
|
|
|
restartType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "p")) {
|
|
|
|
|
filePath = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (fileType) {
|
|
|
|
|
case 1:
|
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/App.json";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
filePath = MicroPhotoContext.buildMasterAppDir(context) + "/data/Master.json";
|
|
|
|
|
break;
|
|
|
|
|
case 91:
|
|
|
|
|
case 92:
|
|
|
|
|
case 93:
|
|
|
|
|
case 94:
|
|
|
|
|
case 95:
|
|
|
|
|
case 96:
|
|
|
|
|
case 97:
|
|
|
|
|
case 98:
|
|
|
|
|
case 99:
|
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/channels/" + Integer.toString(fileType - 90) + ".json";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
if (StringUtils.isNotEmpty(fileStr)) {
|
|
|
|
|
if (StringUtils.isEmpty(filePath)) {
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
if (StringUtils.isEmpty(filePath) || StringUtils.isEmpty(fileName)) {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
} else {
|
|
|
|
|
filePath += fileName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(filePath)) {
|
|
|
|
|
byte[] decode = Base64.decode(fileStr, Base64.NO_WRAP);
|
|
|
|
|
FilesUtils.writeFile(filePath, decode);
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
sendmessage = content + " OK";
|
|
|
|
|
} else {
|
|
|
|
|
sendmessage = content + " ERROR";
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(filePath)) {
|
|
|
|
|
File file = new File(filePath);
|
|
|
|
|
//获取配置文件
|
|
|
|
|
private static void queryFile(String content) {
|
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
|
String result = null;
|
|
|
|
|
try {
|
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_FILE.value().length()));
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
String filePath = null;
|
|
|
|
|
String fileName = null;
|
|
|
|
|
String fileStr = null;
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
int pos = part.indexOf("=");
|
|
|
|
|
if (pos == -1) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String key = part.substring(0, pos);
|
|
|
|
|
String value = part.substring(pos + 1);
|
|
|
|
|
if (TextUtils.equals(key, "f")) {
|
|
|
|
|
fileType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "r")) {
|
|
|
|
|
restartType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "p")) {
|
|
|
|
|
filePath = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
if (!TextUtils.isEmpty(filePath + fileName)) {
|
|
|
|
|
File file = new File(filePath + fileName);
|
|
|
|
|
if (file.exists()) {
|
|
|
|
|
try {
|
|
|
|
|
result = Base64.encodeToString(FilesUtils.readAllBytes(file), Base64.NO_WRAP);
|
|
|
|
|
fileStr = Base64.encodeToString(FilesUtils.readAllBytes(file), Base64.NO_WRAP);
|
|
|
|
|
if (StringUtils.isEmpty(fileStr)) {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = "NOT Existed";
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
sendmessage = content + ",v=" + fileStr;
|
|
|
|
|
} else {
|
|
|
|
|
sendmessage = content + " ERROR";
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
//获取配置文件参数
|
|
|
|
|
private static void queryConfig(String content) {
|
|
|
|
|
boolean ifmessageCorrect = true;
|
|
|
|
|
try {
|
|
|
|
|
String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length()));
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
String filePath = null;
|
|
|
|
|
String fileName = null;
|
|
|
|
|
int numberOfFields = 0;
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
int pos = part.indexOf("=");
|
|
|
|
|
if (pos == -1) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String key = part.substring(0, pos);
|
|
|
|
|
String value = part.substring(pos + 1);
|
|
|
|
|
if (TextUtils.equals(key, "f")) {
|
|
|
|
|
fileType = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "c")) {
|
|
|
|
|
numberOfFields = Integer.parseInt(value);
|
|
|
|
|
} else if (TextUtils.equals(key, "p")) {
|
|
|
|
|
filePath = value;
|
|
|
|
|
} else if (TextUtils.equals(key, "r")) {
|
|
|
|
|
restartType = Integer.parseInt(value);
|
|
|
|
|
} else {
|
|
|
|
|
fields.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(fileType);
|
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONUtils.getConfigFile(filePath, fileName);
|
|
|
|
|
if (jsonObject != null) {
|
|
|
|
|
for (int idx = 0; idx < numberOfFields; idx++) {
|
|
|
|
|
String idxStr = Integer.toString(idx);
|
|
|
|
|
String configName = fields.containsKey("n" + idxStr) ? fields.get("n" + idxStr) : null;
|
|
|
|
|
if (StringUtils.isNotEmpty(configName)) {
|
|
|
|
|
Object o = jsonObject.get(configName);
|
|
|
|
|
if (o != null) {
|
|
|
|
|
int i = ValueTypeUtil.checkType(o);
|
|
|
|
|
content += (",t" + idxStr + "=" + i + "," + "v" + idxStr + "=" + o.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ifmessageCorrect = false;
|
|
|
|
|
}
|
|
|
|
|
if (ifmessageCorrect) {
|
|
|
|
|
sendmessage = content;
|
|
|
|
|
} else {
|
|
|
|
|
sendmessage = content + " ERROR";
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getSimStateName(int simState) {
|
|
|
|
|
switch (simState) {
|
|
|
|
|
case TelephonyManager.SIM_STATE_UNKNOWN:
|
|
|
|
@ -1043,7 +1155,7 @@ public class SimUtil {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//指定sim卡位置发送短信
|
|
|
|
|
public static void sendSms(Context mContext, int slot, String sender, String message, String value, boolean ifmessageCorrect) {
|
|
|
|
|
public static void sendSms(Context mContext, int slot, String sender, String message, int restartType) {
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
|
|
|
|
SubscriptionManager localSubscriptionManager = SubscriptionManager.from(mContext);
|
|
|
|
|
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
@ -1063,8 +1175,8 @@ public class SimUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Intent itSend = new Intent(SMS_SEND_ACTION);
|
|
|
|
|
itSend.putExtra(SMSTYPE, value);
|
|
|
|
|
itSend.putExtra(SMSIFCORRECT, ifmessageCorrect);
|
|
|
|
|
itSend.putExtra(SMSRESTARTTYPE, restartType);
|
|
|
|
|
// itSend.putExtra(SMSIFCORRECT, true);
|
|
|
|
|
// itSend.putExtra(SMSDATA, (Serializable) jsonArray);
|
|
|
|
|
//sendIntent参数为传送后接受的广播信息PendingIntent
|
|
|
|
|
PendingIntent sendPI = PendingIntent.getBroadcast(mContext, mRequestCode++, itSend, 0);
|
|
|
|
@ -1074,7 +1186,7 @@ public class SimUtil {
|
|
|
|
|
// PendingIntent deliverPI = PendingIntent.getBroadcast(mContext,0,itDeliver,0);
|
|
|
|
|
if (simInfoAnother != null) {
|
|
|
|
|
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(simInfoAnother.getSubscriptionId());
|
|
|
|
|
if (message.length() > 70) {
|
|
|
|
|
if (message != null && message.length() > 70) {
|
|
|
|
|
ArrayList<String> msgs = smsManager.divideMessage(message);
|
|
|
|
|
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
|
|
|
|
|
|
|
|
|
@ -1195,6 +1307,29 @@ public class SimUtil {
|
|
|
|
|
return getIcc(subID, getModelSlot(mContext));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public static int saveConfig(Context mContext) {
|
|
|
|
|
// JSONObject jsonObject = MicroPhotoContext.getJsonObject(mContext);
|
|
|
|
|
// Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// field.set(masterConfig, value);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// field.set(masterConfig, num.intValue());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// MicroPhotoContext.saveMasterConfig(mContext, masterConfig);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//获取对应的卡槽ID和iccID 关联
|
|
|
|
|
private static List<ModelSlotAndSub> getModelSlot(Context mContext) {
|
|
|
|
|
List<ModelSlotAndSub> data = new ArrayList<>();
|
|
|
|
|