version:
bugfixes:使用jclasslib降级jar,对接全志酷比接口
This commit is contained in:
@@ -6,6 +6,7 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.cube.SuperPower;
|
||||
import android.cubemdm.cubemdmmanager.CubeMdmManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -183,11 +184,6 @@ public class SysSettingUtils {
|
||||
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+aole_white_list_Array+"---"+qch_call_forbid);
|
||||
Log.e(TAG, "aole_white_list_Array:" + aole_white_list_Array + "---" + setting_phones);
|
||||
}
|
||||
//存储卡
|
||||
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
|
||||
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, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setPhoneList: " + e.getMessage());
|
||||
}
|
||||
@@ -199,15 +195,35 @@ public class SysSettingUtils {
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
if (!BuildConfig.DEBUG) {
|
||||
try {
|
||||
if (JgyUtils.isCubeDevice()) {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setUsbStatus(state);
|
||||
Log.e(TAG, "setUSBstate: state = " + state);
|
||||
} else {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
mService.setUsbDataDisabled(true);
|
||||
}
|
||||
} 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");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
|
||||
Log.e(TAG, "aole_usb_choose:" + aole_usb_choose);
|
||||
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
|
||||
String usbStatus;
|
||||
switch (state) {
|
||||
default:
|
||||
case 0:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
JgyUtils.getInstance().setMtpEnable(false);
|
||||
break;
|
||||
case 1:
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
JgyUtils.getInstance().setMtpEnable(true);
|
||||
break;
|
||||
}
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform) {
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
}
|
||||
@@ -218,11 +234,6 @@ public class SysSettingUtils {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
context.sendBroadcast(usbIntent);
|
||||
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
mService.setUsbDataDisabled(true);
|
||||
} catch (NoClassDefFoundError | Exception e) {
|
||||
Log.e(TAG, "setUSBstate: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,15 +251,33 @@ public class SysSettingUtils {
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (JgyUtils.isCubeDevice()) {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
switch (setting_usb) {
|
||||
case "usb_charge":
|
||||
mService.setUsbDataDisabled(true);
|
||||
break;
|
||||
case "usb_mtp":
|
||||
mService.setUsbDataDisabled(false);
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
@@ -333,6 +362,10 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
JgyUtils.getInstance().setBluetoothEnable(state == 0);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setBluetoothEnable(state == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -391,7 +424,6 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int old_setting_bht = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, 1);
|
||||
Log.e(TAG, "setBluetooth: old_setting_bht = " + old_setting_bht);
|
||||
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
|
||||
@@ -436,6 +468,11 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
JgyUtils.getInstance().setBluetoothEnable(setting_bht == 0);
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setBluetoothEnable(setting_bht == 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setHotspot(Context context, int state) {
|
||||
@@ -446,6 +483,11 @@ public class SysSettingUtils {
|
||||
context.sendStickyBroadcast(intent);
|
||||
boolean aole_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, state);
|
||||
Log.e(TAG, "aole_hotspot_forbid_on:" + aole_hotspot_forbid_on);
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setWifiHotSpotStatus(state);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
}
|
||||
@@ -463,6 +505,11 @@ public class SysSettingUtils {
|
||||
boolean aole_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, setting_hotspot);
|
||||
Log.e(TAG, "aole_hotspot_forbid_on---------" + setting_hotspot);
|
||||
Log.e(TAG, "aole_hotspot_forbid_on---------" + aole_hotspot_forbid_on);
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setWifiHotSpotStatus(setting_hotspot);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
}
|
||||
@@ -516,6 +563,7 @@ public class SysSettingUtils {
|
||||
private static void setBar(Context context, JsonObject jsonObject) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(jsonObject.get("setting_navigation").getAsInt());
|
||||
Log.e(TAG, "setBar: setting_navigation = " + setting_navigation);
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_NavigationBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
|
||||
@@ -534,6 +582,11 @@ public class SysSettingUtils {
|
||||
Intent navIntent = new Intent(navigationStatus);
|
||||
context.sendBroadcast(navIntent);
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setNavigationStatus(setting_navigation == 0);
|
||||
Log.e(TAG, "setBar: setNavigationStatus = " + (setting_navigation == 0));
|
||||
}
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
|
||||
@@ -558,6 +611,12 @@ public class SysSettingUtils {
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(statusIntent);
|
||||
// }
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setStatusBarEnable(setting_statusbar == 0);
|
||||
Log.e(TAG, "setBar: setStatusBarEnable = " + (setting_statusbar == 0));
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCamera(Context context, int state) {
|
||||
@@ -609,6 +668,15 @@ 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);
|
||||
}
|
||||
|
||||
try {
|
||||
//tfmedia开关
|
||||
// int setting_tfmedia = 1;
|
||||
@@ -634,6 +702,8 @@ public class SysSettingUtils {
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -641,13 +711,23 @@ public class SysSettingUtils {
|
||||
* @param jsonObject tfmedia开关
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
@@ -700,6 +780,11 @@ public class SysSettingUtils {
|
||||
Log.e(TAG, "setCanReset: state = " + state);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, state);
|
||||
//默认打开
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setResetFactoryEnable(state == 0);
|
||||
Log.e(TAG, "setCanReset: setResetFactoryEnable = " + (state == 0));
|
||||
}
|
||||
}
|
||||
|
||||
//aole_restore_forbid_on=1,禁止恢复出厂设置
|
||||
@@ -712,6 +797,12 @@ public class SysSettingUtils {
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
|
||||
}
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setResetFactoryEnable(mode == 1);
|
||||
Log.e(TAG, "setCanReset: setResetFactoryEnable = " + (mode == 1));
|
||||
}
|
||||
}
|
||||
|
||||
//系统默认“使用网络提供时间”且不可点击
|
||||
@@ -866,10 +957,15 @@ public class SysSettingUtils {
|
||||
int is_app_install = appInstall.getAsInt();
|
||||
Log.e(TAG, "setAdminApp: is_app_install = " + is_app_install);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, is_app_install);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setInstallPackageEnable(is_app_install == 1);
|
||||
}
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
|
||||
}
|
||||
|
||||
|
||||
JsonElement adminApp = jsonObject.get("is_admin_app");
|
||||
if (adminApp != null) {
|
||||
int is_admin_app = adminApp.getAsInt();
|
||||
@@ -890,6 +986,10 @@ public class SysSettingUtils {
|
||||
|
||||
private static void setAdminApp(Context context, int state) {
|
||||
Log.e(TAG, "setAdminApp: state = " + state);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
|
||||
cubeMdmManager.setInstallPackageEnable(state == 0);
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, changeNum(state));
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", changeNum(state));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user