|
|
|
@ -449,6 +449,10 @@ public class SimUtil {
|
|
|
|
|
sendtype = SmsTypeEnum.SIMCARD.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
sendmessage = getSimcardInfo(context);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_AUTO_TIME.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.SIMCARD.value();
|
|
|
|
|
ifmessageCorrect = true;
|
|
|
|
|
sendmessage = setAutoTime(context, content);
|
|
|
|
|
} else if (content.contains(SmsTypeEnum.SET_TP.value())) {
|
|
|
|
|
sendtype = SmsTypeEnum.SET_TP.value();
|
|
|
|
|
String[] split1 = StringUtils.splitString1(content);
|
|
|
|
@ -620,6 +624,64 @@ public class SimUtil {
|
|
|
|
|
return result.toString().trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String setAutoTime(Context context, String content) {
|
|
|
|
|
String result;
|
|
|
|
|
try {
|
|
|
|
|
String[] parts = TextUtils.split(content.substring(SmsTypeEnum.SET_AUTO_TIME.value().length()), "(\\s|,|,)");
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
int autoTimeType = 0;
|
|
|
|
|
boolean onOff = false;
|
|
|
|
|
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, "act")) {
|
|
|
|
|
if (TextUtils.equals(value, "on")) {
|
|
|
|
|
onOff = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TextUtils.equals(key, "type")) {
|
|
|
|
|
if (TextUtils.equals(value, "net")) {
|
|
|
|
|
autoTimeType = 1;
|
|
|
|
|
} else if (TextUtils.equals(value, "gps")) {
|
|
|
|
|
autoTimeType = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (autoTimeType != 0) {
|
|
|
|
|
if (autoTimeType == 1) {
|
|
|
|
|
SysApi.setGlobalInt(context, "auto_time", onOff ? 1 : 0);
|
|
|
|
|
} else if (autoTimeType == 2) {
|
|
|
|
|
SysApi.setGlobalInt(context, "auto_time_gps", onOff ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// query the value
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
int autoTime = SysApi.getGlobalInt(context, "auto_time");
|
|
|
|
|
int autoTimeGps = SysApi.getGlobalInt(context, "auto_time_gps");
|
|
|
|
|
|
|
|
|
|
result = "auto_time=" + Integer.toString(autoTime) + " auto_time_gps" + Integer.toString(autoTimeGps);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getSimStateName(int simState) {
|
|
|
|
|
switch (simState) {
|
|
|
|
|
case TelephonyManager.SIM_STATE_UNKNOWN:
|
|
|
|
|