version:1.5.0705
bugfixes:优化报错和网络优化
This commit is contained in:
@@ -67,7 +67,7 @@ public class SysSettingUtils {
|
||||
setStatusBar(context, navJson);
|
||||
setBrowserInput(context, jsonObject);
|
||||
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
|
||||
setUSBstate(context, jsonObject);
|
||||
setUsbStatus(context, jsonObject);
|
||||
setAdminApp(context, jsonObject);
|
||||
setSystemAppDisable(context, jsonObject);
|
||||
setNotification(context, jsonObject);
|
||||
@@ -82,7 +82,7 @@ public class SysSettingUtils {
|
||||
Toaster.debugShow("关闭所有功能");
|
||||
Log.e("setDisableSetting", "Close all settings: ");
|
||||
setPhoneList(context, 1);
|
||||
setUSBstate(context, 1);
|
||||
setUsbStatus(context, 1);
|
||||
if (JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.YXPD1TAG)
|
||||
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.C2Tag)
|
||||
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.ZR6016Tag)
|
||||
@@ -189,7 +189,7 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setUSBstate(Context context, int state) {
|
||||
private static void setUsbStatus(Context context, int state) {
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
@@ -199,7 +199,7 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setUsbStatus(state);
|
||||
Log.e(TAG, "setUSBstate: state = " + state);
|
||||
Log.e(TAG, "setUsbStatus: state = " + state);
|
||||
} else {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
mService.setUsbDataDisabled(true);
|
||||
@@ -207,11 +207,11 @@ public class SysSettingUtils {
|
||||
} else {
|
||||
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
|
||||
if ("usb_charge".equals(oldUsb)) {
|
||||
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
|
||||
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
|
||||
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
|
||||
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
|
||||
String usbStatus;
|
||||
switch (state) {
|
||||
default:
|
||||
@@ -238,75 +238,74 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setUSBstate(Context context, JsonObject jsonObject) {
|
||||
private static void setUsbStatus(Context context, JsonObject jsonObject) {
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
String setting_usb = jsonObject.get("setting_usb").getAsString();
|
||||
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
|
||||
if (setting_usb.equals(oldUsb)) {
|
||||
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (JgyUtils.isCubeDevice()) {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
switch (setting_usb) {
|
||||
case "usb_charge":
|
||||
cubeMdmManager.setUsbStatus(0);
|
||||
break;
|
||||
case "usb_mtp":
|
||||
cubeMdmManager.setUsbStatus(1);
|
||||
break;
|
||||
case "usb_midi":
|
||||
cubeMdmManager.setUsbStatus(2);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
Log.e(TAG, "setUSBstate: setting_usb = " + setting_usb);
|
||||
} else {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
switch (setting_usb) {
|
||||
case "usb_mtp":
|
||||
mService.setUsbDataDisabled(false);
|
||||
break;
|
||||
default:
|
||||
case "usb_midi":
|
||||
case "usb_charge":
|
||||
mService.setUsbDataDisabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
|
||||
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
|
||||
String usbStatus;
|
||||
switch (setting_usb) {
|
||||
default:
|
||||
case "usb_charge":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
JgyUtils.getInstance().setMtpEnable(false);
|
||||
break;
|
||||
case "usb_mtp":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
JgyUtils.getInstance().setMtpEnable(true);
|
||||
break;
|
||||
case "usb_midi":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
|
||||
JgyUtils.getInstance().setMtpEnable(false);
|
||||
break;
|
||||
}
|
||||
Intent usbIntent = new Intent(usbStatus);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
context.sendBroadcast(usbIntent);
|
||||
|
||||
// if (!BuildConfig.DEBUG) {
|
||||
if (JgyUtils.isCubeDevice()) {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
switch (setting_usb) {
|
||||
case "usb_mtp":
|
||||
mService.setUsbDataDisabled(false);
|
||||
break;
|
||||
default:
|
||||
case "usb_midi":
|
||||
case "usb_charge":
|
||||
mService.setUsbDataDisabled(true);
|
||||
break;
|
||||
}
|
||||
} else if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
switch (setting_usb) {
|
||||
case "usb_charge":
|
||||
cubeMdmManager.setUsbStatus(0);
|
||||
break;
|
||||
case "usb_mtp":
|
||||
cubeMdmManager.setUsbStatus(1);
|
||||
break;
|
||||
case "usb_midi":
|
||||
cubeMdmManager.setUsbStatus(2);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
Log.e(TAG, "setUsbStatus: setting_usb = " + setting_usb);
|
||||
} else {
|
||||
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
|
||||
if (setting_usb.equals(oldUsb)) {
|
||||
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
|
||||
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
|
||||
String usbStatus;
|
||||
switch (setting_usb) {
|
||||
default:
|
||||
case "usb_charge":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
JgyUtils.getInstance().setMtpEnable(false);
|
||||
break;
|
||||
case "usb_mtp":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
JgyUtils.getInstance().setMtpEnable(true);
|
||||
break;
|
||||
case "usb_midi":
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
|
||||
JgyUtils.getInstance().setMtpEnable(false);
|
||||
break;
|
||||
}
|
||||
Intent usbIntent = new Intent(usbStatus);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
context.sendBroadcast(usbIntent);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,6 +364,7 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setBluetoothEnable(state == 0);
|
||||
Log.e(TAG, "setBluetoothEnable: " + (state == 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,6 +472,7 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setBluetoothEnable(setting_bht == 0);
|
||||
Log.e(TAG, "setBluetoothEnable: " + (setting_bht == 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,6 +488,7 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setWifiHotSpotStatus(state);
|
||||
Log.e(TAG, "setWifiHotSpotStatus: " + state);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
@@ -509,6 +511,7 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setWifiHotSpotStatus(setting_hotspot);
|
||||
Log.e(TAG, "setWifiHotSpotStatus: " + setting_hotspot);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
@@ -669,41 +672,41 @@ public class SysSettingUtils {
|
||||
|
||||
private static void setTF(Context context, int state) {
|
||||
//存储卡
|
||||
JgyUtils.getInstance().setSDOTGEnable(state == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setSDEnable(state == 0);
|
||||
}
|
||||
Log.e(TAG, "setTF: setSDEnable = " + (state == 0));
|
||||
} else {
|
||||
JgyUtils.getInstance().setSDOTGEnable(state == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
|
||||
try {
|
||||
//tfmedia开关
|
||||
try {
|
||||
//tfmedia开关
|
||||
// int setting_tfmedia = 1;
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (state) {
|
||||
case 0:
|
||||
tfmediaStatus = "qch_tfmedia_open";
|
||||
break;
|
||||
case 1:
|
||||
tfmediaStatus = "qch_tfmedia_forbid";
|
||||
break;
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (state) {
|
||||
case 0:
|
||||
tfmediaStatus = "qch_tfmedia_open";
|
||||
break;
|
||||
case 1:
|
||||
tfmediaStatus = "qch_tfmedia_forbid";
|
||||
break;
|
||||
}
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (state == 1) {
|
||||
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (state == 1) {
|
||||
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,51 +716,53 @@ public class SysSettingUtils {
|
||||
private static void setTF(Context context, JsonObject jsonObject) {
|
||||
//存储卡
|
||||
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
|
||||
Log.e(TAG, "setTF: setting_memory = " + setting_memory);
|
||||
JgyUtils.getInstance().setSDOTGEnable(setting_memory == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setSDEnable(setting_memory == 0);
|
||||
}
|
||||
Log.e(TAG, "setTF: setSDEnable = " + (setting_memory == 0));
|
||||
} else {
|
||||
Log.e(TAG, "setTF: setting_memory = " + setting_memory);
|
||||
JgyUtils.getInstance().setSDOTGEnable(setting_memory == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
|
||||
try {
|
||||
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
|
||||
try {
|
||||
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
|
||||
// if (JgyUtils.isOfficialVersion() ) {
|
||||
// setting_tfmedia = changeNum(setting_tfmedia);
|
||||
// }
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (setting_tfmedia) {
|
||||
case 0:
|
||||
Log.e(TAG, "setting_tfmedia: " + "打开");
|
||||
tfmediaStatus = "qch_tfmedia_open";
|
||||
break;
|
||||
case 1:
|
||||
Log.e(TAG, "setting_tfmedia: " + "禁止");
|
||||
tfmediaStatus = "qch_tfmedia_forbid";
|
||||
break;
|
||||
}
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (setting_tfmedia == 1) {
|
||||
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < jSONArray.size(); i++) {
|
||||
stringBuffer.append(jSONArray.get(i).toString());
|
||||
stringBuffer.append(",");
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (setting_tfmedia) {
|
||||
case 0:
|
||||
Log.e(TAG, "setting_tfmedia: " + "打开");
|
||||
tfmediaStatus = "qch_tfmedia_open";
|
||||
break;
|
||||
case 1:
|
||||
Log.e(TAG, "setting_tfmedia: " + "禁止");
|
||||
tfmediaStatus = "qch_tfmedia_forbid";
|
||||
break;
|
||||
}
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes---------" + stringBuffer.toString());
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (setting_tfmedia == 1) {
|
||||
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < jSONArray.size(); i++) {
|
||||
stringBuffer.append(jSONArray.get(i).toString());
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes---------" + stringBuffer.toString());
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user