|
|
@ -70,7 +70,6 @@ public class SimUtil {
|
|
|
|
public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) {
|
|
|
|
public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) {
|
|
|
|
SmsMessageModel smsInfo = getSMSInfo(intent, smsMessage);
|
|
|
|
SmsMessageModel smsInfo = getSMSInfo(intent, smsMessage);
|
|
|
|
if (smsInfo != null) {
|
|
|
|
if (smsInfo != null) {
|
|
|
|
String packageName = context.getApplicationContext().getPackageName();
|
|
|
|
|
|
|
|
String content = smsInfo.getContent();
|
|
|
|
String content = smsInfo.getContent();
|
|
|
|
int pos = content.lastIndexOf("##");
|
|
|
|
int pos = content.lastIndexOf("##");
|
|
|
|
if (pos != -1) {
|
|
|
|
if (pos != -1) {
|
|
|
@ -85,53 +84,66 @@ public class SimUtil {
|
|
|
|
if (StringUtils.isEmpty(content)) {
|
|
|
|
if (StringUtils.isEmpty(content)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.CFG.value().toLowerCase())) {
|
|
|
|
|
|
|
|
String[] cmdSpilt = StringUtils.splitString2(content);
|
|
|
|
|
|
|
|
if (cmdSpilt != null && cmdSpilt.length > 1) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String actType = null;
|
|
|
|
|
|
|
|
String restartType = null;
|
|
|
|
|
|
|
|
ArrayList<HashMap> list = new ArrayList<>();
|
|
|
|
|
|
|
|
for (int i = 0; i < cmdSpilt.length; i++) {
|
|
|
|
|
|
|
|
String cmd = cmdSpilt[i];
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(cmd)) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String[] actSpilt = StringUtils.splitString1(cmd);
|
|
|
|
|
|
|
|
if (actSpilt == null || actSpilt.length != 2) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String key = actSpilt[0];
|
|
|
|
|
|
|
|
String value = actSpilt[1];
|
|
|
|
|
|
|
|
if (cmd.toLowerCase().contains(SmsTypeEnum.ACT.value().toLowerCase())) {
|
|
|
|
|
|
|
|
if (value.toLowerCase().contains(SmsTypeEnum.SET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.SETFILE.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GETFILE.value().toLowerCase())) {
|
|
|
|
|
|
|
|
actType = value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (cmd.toLowerCase().contains(SmsTypeEnum.CFG.value().toLowerCase())) {
|
|
|
|
|
|
|
|
if (value.toLowerCase().contains(SmsTypeEnum.MASTER.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.APP.value().toLowerCase())) {
|
|
|
|
|
|
|
|
HashMap<Object, Object> hashMap = new HashMap<>();
|
|
|
|
|
|
|
|
hashMap.put(SmsTypeEnum.CFGFILE.value(), value);
|
|
|
|
|
|
|
|
list.add(hashMap);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (cmd.toLowerCase().contains(SmsTypeEnum.RESTART.value().toLowerCase())) {
|
|
|
|
|
|
|
|
restartType = value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
|
|
|
HashMap hashMap = list.get(list.size() - 1);
|
|
|
|
|
|
|
|
hashMap.put(key, value);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
if (content.toLowerCase().contains(SmsTypeEnum.UPD_CFG_FILE.value().toLowerCase())) { //修改配置文件中参数
|
|
|
|
UpdateSysConfigUtil.setCommon(context, actType, list, restartType);
|
|
|
|
updateConfigFile(ifmessageCorrect, context, content);
|
|
|
|
}
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_CFG_FILE.value().toLowerCase())) {//获取配置文件中参数
|
|
|
|
|
|
|
|
queryConfig(ifmessageCorrect, context, content);
|
|
|
|
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.UPD_FILE.value().toLowerCase())) {//替换配置文件
|
|
|
|
|
|
|
|
setConfigFile(ifmessageCorrect, context, content);
|
|
|
|
|
|
|
|
} else if (content.toLowerCase().contains(SmsTypeEnum.GET_FILE.value().toLowerCase())) {//获取整个配置文件
|
|
|
|
|
|
|
|
queryConfigFile(ifmessageCorrect, context, content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sendSms(context, slot, sender, sendmessage, sendtype, ifmessageCorrect);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (content.toLowerCase().contains(SmsTypeEnum.ACT.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// String[] cmdSpilt = StringUtils.splitString2(content);
|
|
|
|
|
|
|
|
// if (cmdSpilt != null && cmdSpilt.length > 1) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// String actType = null;
|
|
|
|
|
|
|
|
// String restartType = null;
|
|
|
|
|
|
|
|
// ArrayList<HashMap> list = new ArrayList<>();
|
|
|
|
|
|
|
|
// for (int i = 0; i < cmdSpilt.length; i++) {
|
|
|
|
|
|
|
|
// String cmd = cmdSpilt[i];
|
|
|
|
|
|
|
|
// if (StringUtils.isEmpty(cmd)) {
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// String[] actSpilt = StringUtils.splitString1(cmd);
|
|
|
|
|
|
|
|
// if (actSpilt == null || actSpilt.length != 2) {
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// String key = actSpilt[0];
|
|
|
|
|
|
|
|
// String value = actSpilt[1];
|
|
|
|
|
|
|
|
// if (cmd.toLowerCase().contains(SmsTypeEnum.ACT.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// if (value.toLowerCase().contains(SmsTypeEnum.SET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GET.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.SETFILE.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.GETFILE.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// actType = value;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (cmd.toLowerCase().contains(SmsTypeEnum.CFG.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// if (value.toLowerCase().contains(SmsTypeEnum.MASTER.value().toLowerCase()) || value.toLowerCase().contains(SmsTypeEnum.APP.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// HashMap<Object, Object> hashMap = new HashMap<>();
|
|
|
|
|
|
|
|
// hashMap.put(SmsTypeEnum.CFGFILE.value(), value);
|
|
|
|
|
|
|
|
// list.add(hashMap);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (cmd.toLowerCase().contains(SmsTypeEnum.RESTART.value().toLowerCase())) {
|
|
|
|
|
|
|
|
// restartType = value;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// if (list.size() > 0) {
|
|
|
|
|
|
|
|
// HashMap hashMap = list.get(list.size() - 1);
|
|
|
|
|
|
|
|
// hashMap.put(key, value);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// UpdateSysConfigUtil.setCommon(context, actType, list, restartType);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (content.contains(SmsTypeEnum.REBOOT1.value())) {
|
|
|
|
// if (content.contains(SmsTypeEnum.REBOOT1.value())) {
|
|
|
@ -798,16 +810,15 @@ public class SimUtil {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void updateConfigFile(Context context, String content) {
|
|
|
|
private static void updateConfigFile(boolean ifmessageCorrect, Context context, String content) {
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
int rebootMpApp = 0;
|
|
|
|
int rebootMpApp = 0;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
String[] parts = StringUtils.splitStringByDh(SmsTypeEnum.UPD_CFG_FILE.value(), content);
|
|
|
|
int fileType = 0;
|
|
|
|
int fileType = 0;
|
|
|
|
int numberOfFields = 0;
|
|
|
|
int numberOfFields = 0;
|
|
|
|
|
|
|
|
String filePath = null;
|
|
|
|
|
|
|
|
String fileName = null;
|
|
|
|
if (parts != null) {
|
|
|
|
if (parts != null) {
|
|
|
|
for (String part : parts) {
|
|
|
|
for (String part : parts) {
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
|
if (TextUtils.isEmpty(part)) {
|
|
|
@ -832,33 +843,9 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String filePath = null;
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
String fileName = null;
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
switch (fileType) {
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(filePath) && !TextUtils.isEmpty(fileName) && numberOfFields > 0) {
|
|
|
|
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);
|
|
|
|
String idxStr = Integer.toString(idx);
|
|
|
@ -877,7 +864,6 @@ public class SimUtil {
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue);
|
|
|
|
JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rebootMpApp != 0) {
|
|
|
|
if (rebootMpApp != 0) {
|
|
|
|
MicroPhotoContext.restartMpApp(context, "Config Updated From SMS");
|
|
|
|
MicroPhotoContext.restartMpApp(context, "Config Updated From SMS");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -888,18 +874,62 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (
|
|
|
|
|
|
|
|
Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void setConfigFile(boolean ifmessageCorrect, Context context, String content) {
|
|
|
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
|
|
|
int rebootMpApp = 0;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
|
|
|
|
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, "p")) {
|
|
|
|
|
|
|
|
filePath = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
|
|
|
|
byte[] decode = Base64.decode(fileStr, Base64.NO_WRAP);
|
|
|
|
|
|
|
|
FilesUtils.writeFile(filePath + fileName, decode);
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static String queryConfigFile(Context context, String content) {
|
|
|
|
private static String queryConfigFile(boolean ifmessageCorrect, Context context, String content) {
|
|
|
|
String result = "ERR";
|
|
|
|
String result = "ERR";
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
int fileType = 0;
|
|
|
|
int fileType = 0;
|
|
|
|
String filePath = null;
|
|
|
|
String filePath = null;
|
|
|
|
|
|
|
|
String fileName = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (parts != null) {
|
|
|
|
if (parts != null) {
|
|
|
|
for (String part : parts) {
|
|
|
|
for (String part : parts) {
|
|
|
@ -921,28 +951,84 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (fileType) {
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, fileType);
|
|
|
|
case 1:
|
|
|
|
filePath = hashMap.get(UpdateSysConfigUtil.FILEPATH);
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/App.json";
|
|
|
|
fileName = hashMap.get(UpdateSysConfigUtil.FILENAME);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if (!TextUtils.isEmpty(filePath + fileName)) {
|
|
|
|
filePath = MicroPhotoContext.buildMasterAppDir(context) + "/data/Master.json";
|
|
|
|
File file = new File(filePath + fileName);
|
|
|
|
break;
|
|
|
|
if (file.exists()) {
|
|
|
|
case 91:
|
|
|
|
try {
|
|
|
|
case 92:
|
|
|
|
result = Base64.encodeToString(FilesUtils.readAllBytes(file), Base64.NO_WRAP);
|
|
|
|
case 93:
|
|
|
|
} catch (Exception ex) {
|
|
|
|
case 94:
|
|
|
|
ex.printStackTrace();
|
|
|
|
case 95:
|
|
|
|
}
|
|
|
|
case 96:
|
|
|
|
} else {
|
|
|
|
case 97:
|
|
|
|
result = "NOT Existed";
|
|
|
|
case 98:
|
|
|
|
}
|
|
|
|
case 99:
|
|
|
|
|
|
|
|
filePath = MicroPhotoContext.buildMpAppDir(context) + "/data/channels/" + Integer.toString(fileType - 90) + ".json";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String queryConfig(boolean ifmessageCorrect, Context context, String content) {
|
|
|
|
|
|
|
|
String result = "ERR";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
|
|
|
String filePath = null;
|
|
|
|
|
|
|
|
String fileName = null;
|
|
|
|
|
|
|
|
int numberOfFields = 0;
|
|
|
|
|
|
|
|
Map<String, String> fields = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, String> outfields = 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 {
|
|
|
|
|
|
|
|
fields.put(key, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> hashMap = ValueTypeUtil.checkFilePathAndName(context, 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);
|
|
|
|
|
|
|
|
outfields.put("n" + idxStr, configName);
|
|
|
|
|
|
|
|
outfields.put("t" + idxStr, i + "");
|
|
|
|
|
|
|
|
outfields.put("v" + idxStr, o.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!TextUtils.isEmpty(filePath)) {
|
|
|
|
if (!TextUtils.isEmpty(filePath)) {
|
|
|
|
File file = new File(filePath);
|
|
|
|
File file = new File(filePath);
|
|
|
|
if (file.exists()) {
|
|
|
|
if (file.exists()) {
|
|
|
@ -959,10 +1045,10 @@ public class SimUtil {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getSimStateName(int simState) {
|
|
|
|
public static String getSimStateName(int simState) {
|
|
|
|
switch (simState) {
|
|
|
|
switch (simState) {
|
|
|
|
case TelephonyManager.SIM_STATE_UNKNOWN:
|
|
|
|
case TelephonyManager.SIM_STATE_UNKNOWN:
|
|
|
|