|
|
@ -23,6 +23,7 @@ import android.telephony.SubscriptionManager;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
import android.util.Base64;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.core.app.ActivityCompat;
|
|
|
|
import androidx.core.app.ActivityCompat;
|
|
|
|
|
|
|
|
|
|
|
@ -34,19 +35,15 @@ import com.xypower.common.NetworkUtils;
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
import com.xypower.common.RegexUtil;
|
|
|
|
import com.xypower.mpmaster.MpMasterService;
|
|
|
|
import com.xypower.mpmaster.MpMasterService;
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.TimeZone;
|
|
|
|
import java.util.TimeZone;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -466,6 +463,10 @@ public class SimUtil {
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
sendmessage = " OK";
|
|
|
|
sendmessage = " OK";
|
|
|
|
updateConfigFile(context, content);
|
|
|
|
updateConfigFile(context, content);
|
|
|
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.GET_CFG_FILE.value())) {
|
|
|
|
|
|
|
|
sendtype = SmsTypeEnum.GET_CFG_FILE.value();
|
|
|
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
|
|
|
sendmessage = queryConfigFile(context, content);
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_TP.value())) {
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_TP.value())) {
|
|
|
|
sendtype = SmsTypeEnum.SET_TP.value();
|
|
|
|
sendtype = SmsTypeEnum.SET_TP.value();
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
@ -790,6 +791,76 @@ public class SimUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String queryConfigFile(Context context, String content) {
|
|
|
|
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length()), "(\\s|,|,)");
|
|
|
|
|
|
|
|
int fileType = 0;
|
|
|
|
|
|
|
|
String filePath = 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, "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 (!TextUtils.isEmpty(filePath)) {
|
|
|
|
|
|
|
|
File file = new File(filePath);
|
|
|
|
|
|
|
|
if (file.exists()) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
result = Base64.encodeToString(FilesUtils.readAllBytes(file), Base64.NO_WRAP);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
result = "NOT Existed";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|