bugfixes:使用jclasslib降级jar,对接全志酷比接口
This commit is contained in:
2025-06-13 10:49:48 +08:00
parent 60dab59ef8
commit eb73796554
7 changed files with 171 additions and 27 deletions

View File

@@ -637,6 +637,8 @@ dependencies {
compileOnly files('libs/framework.jar') compileOnly files('libs/framework.jar')
compileOnly files('libs/cube_mdm.jar') compileOnly files('libs/cube_mdm.jar')
compileOnly files('libs/cube_sdk_v1.0.0.jar') compileOnly files('libs/cube_sdk_v1.0.0.jar')
//版本高了idea plugin 下载VisualClassBytes修改version jclasslib最好用
compileOnly files('libs/qz_cubemdm_sdk_v1.0.0_1.8.jar')
implementation files('libs/ebf_tools_v1.0.jar') implementation files('libs/ebf_tools_v1.0.jar')
implementation files('libs/vendor.mediatek.hardware.nvram-V1.0-java.jar') implementation files('libs/vendor.mediatek.hardware.nvram-V1.0-java.jar')
@@ -645,7 +647,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

Binary file not shown.

View File

@@ -10,6 +10,7 @@ import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.cubemdm.cubemdmmanager.CubeMdmManager;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.provider.Settings; import android.provider.Settings;
@@ -1222,6 +1223,10 @@ public class NetInterfaceManager {
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP,
String.join(",", forceApp)); String.join(",", forceApp));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app); Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(forceApp);
}
} }
callback.onComplete(); callback.onComplete();
} }
@@ -1264,10 +1269,18 @@ public class NetInterfaceManager {
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP,
String.join(",", forceApp)); String.join(",", forceApp));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app); Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(forceApp);
}
} else if (forceDownloadBean.code == -200) { } else if (forceDownloadBean.code == -200) {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, ""); cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid"); boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
Log.e("getForceDownload", "aole_force_app:" + aole_force_app); Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(new ArrayList<>());
}
} else { } else {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, ""); cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
Log.e("getForceDownload", forceDownloadBean.msg); Log.e("getForceDownload", forceDownloadBean.msg);

View File

@@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.cubemdm.cubemdmmanager.CubeMdmManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.AudioManager; import android.media.AudioManager;
@@ -715,9 +716,17 @@ public class PushManager {
List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(","))); List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(",")));
forceAppList.remove(pkg); forceAppList.remove(pkg);
if (forceAppList.size() != 0) { if (forceAppList.size() != 0) {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(forceAppList);
}
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList)); Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
} else { } else {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, ""); Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(new ArrayList<>());
}
} }
} }
ApkUtils.UninstallAPP(mContext, pkg); ApkUtils.UninstallAPP(mContext, pkg);

View File

@@ -242,7 +242,12 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
} }
if (null != client) { if (null != client) {
Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString()); Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString());
try {
client.send(jsonObject.toString()); client.send(jsonObject.toString());
} catch (Exception e) {
Log.e(TAG, "sendMsg: " + e.getMessage());
}
} }
} }

View File

@@ -18,6 +18,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.cubemdm.cubemdmmanager.CubeMdmManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
@@ -2067,6 +2068,10 @@ public class JgyUtils {
if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) { if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state); Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
} }
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setDeveloperEnable(state == 1);
}
} }
} }
@@ -2735,6 +2740,11 @@ public class JgyUtils {
// } // }
intent.setPackage("com.android.settings"); intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent); mContext.sendBroadcast(intent);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setDefaultLauncher(pkg);
}
// ApkUtils.openPackage(mContext, pkg); // ApkUtils.openPackage(mContext, pkg);
Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className); Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className);
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname")); Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname"));
@@ -3053,6 +3063,11 @@ public class JgyUtils {
return getHardware().startsWith(UNISOC_HARDWARE) && Build.BRAND.equalsIgnoreCase(CUBE_BRAND); return getHardware().startsWith(UNISOC_HARDWARE) && Build.BRAND.equalsIgnoreCase(CUBE_BRAND);
} }
public static boolean isAllWinnerDevice() {
return JgyUtils.getInstance().checkAppPlatform() == U1302Platform;
}
public boolean isScreenOn() { public boolean isScreenOn() {
PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
//true为打开false为关闭 //true为打开false为关闭

View File

@@ -6,6 +6,7 @@ import android.bluetooth.BluetoothAdapter;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.cube.SuperPower; import android.cube.SuperPower;
import android.cubemdm.cubemdmmanager.CubeMdmManager;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; 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); // 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); 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) { } catch (Exception e) {
Log.e(TAG, "setPhoneList: " + e.getMessage()); Log.e(TAG, "setPhoneList: " + e.getMessage());
} }
@@ -199,15 +195,35 @@ public class SysSettingUtils {
//MTP模式usb_mtp //MTP模式usb_mtp
//Midi模式usb_midi //Midi模式usb_midi
if (!BuildConfig.DEBUG) { 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"); String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if ("usb_charge".equals(oldUsb)) { if ("usb_charge".equals(oldUsb)) {
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip"); Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
return; return;
} }
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge"); boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
Log.e(TAG, "aole_usb_choose:" + aole_usb_choose); Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE; 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) { if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform) {
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP; usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
} }
@@ -218,11 +234,6 @@ public class SysSettingUtils {
usbIntent.setPackage("com.android.settings"); usbIntent.setPackage("com.android.settings");
} }
context.sendBroadcast(usbIntent); 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 (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) { if (JgyUtils.isCubeDevice()) {
SuperPower mService = (SuperPower) context.getSystemService("mdm"); if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
switch (setting_usb) { switch (setting_usb) {
case "usb_charge": case "usb_charge":
mService.setUsbDataDisabled(true); cubeMdmManager.setUsbStatus(0);
break; 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": case "usb_mtp":
mService.setUsbDataDisabled(false); mService.setUsbDataDisabled(false);
break; break;
default: default:
case "usb_midi":
case "usb_charge":
mService.setUsbDataDisabled(true);
break;
}
} }
} else { } else {
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb); 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); 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); 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); 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); 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); 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) { private static void setHotspot(Context context, int state) {
@@ -446,6 +483,11 @@ public class SysSettingUtils {
context.sendStickyBroadcast(intent); context.sendStickyBroadcast(intent);
boolean aole_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, state); 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); 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) { } catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage()); 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); 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---------" + setting_hotspot);
Log.e(TAG, "aole_hotspot_forbid_on---------" + aole_hotspot_forbid_on); 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) { } catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage()); Log.e(TAG, "setHotspot: " + e.getMessage());
} }
@@ -516,6 +563,7 @@ public class SysSettingUtils {
private static void setBar(Context context, JsonObject jsonObject) { private static void setBar(Context context, JsonObject jsonObject) {
//系统导航条显示开关 //系统导航条显示开关
int setting_navigation = changeNum(jsonObject.get("setting_navigation").getAsInt()); 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); 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); Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
@@ -534,6 +582,11 @@ public class SysSettingUtils {
Intent navIntent = new Intent(navigationStatus); Intent navIntent = new Intent(navigationStatus);
context.sendBroadcast(navIntent); 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()); 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"); // Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
context.sendBroadcast(statusIntent); 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) { private static void setCamera(Context context, int state) {
@@ -609,6 +668,15 @@ public class SysSettingUtils {
} }
private static void setTF(Context context, int state) { 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 { try {
//tfmedia开关 //tfmedia开关
// int setting_tfmedia = 1; // int setting_tfmedia = 1;
@@ -634,6 +702,8 @@ public class SysSettingUtils {
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage()); Log.e(TAG, "setTF: " + e.getMessage());
} }
} }
/** /**
@@ -641,13 +711,23 @@ public class SysSettingUtils {
* @param jsonObject tfmedia开关 * @param jsonObject tfmedia开关
*/ */
private static void setTF(Context context, JsonObject jsonObject) { 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 { try {
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt(); int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
// if (JgyUtils.isOfficialVersion() ) { // if (JgyUtils.isOfficialVersion() ) {
// setting_tfmedia = changeNum(setting_tfmedia); // setting_tfmedia = changeNum(setting_tfmedia);
// } // }
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
"qch_tfmedia_forbid", setting_tfmedia);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid); Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = ""; String tfmediaStatus = "";
switch (setting_tfmedia) { switch (setting_tfmedia) {
@@ -700,6 +780,11 @@ public class SysSettingUtils {
Log.e(TAG, "setCanReset: state = " + state); Log.e(TAG, "setCanReset: state = " + state);
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 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禁止恢复出厂设置 //aole_restore_forbid_on=1禁止恢复出厂设置
@@ -712,6 +797,12 @@ public class SysSettingUtils {
} else { } else {
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1); 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(); int is_app_install = appInstall.getAsInt();
Log.e(TAG, "setAdminApp: is_app_install = " + is_app_install); Log.e(TAG, "setAdminApp: is_app_install = " + is_app_install);
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_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 { } else {
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0); Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
} }
JsonElement adminApp = jsonObject.get("is_admin_app"); JsonElement adminApp = jsonObject.get("is_admin_app");
if (adminApp != null) { if (adminApp != null) {
int is_admin_app = adminApp.getAsInt(); int is_admin_app = adminApp.getAsInt();
@@ -890,6 +986,10 @@ public class SysSettingUtils {
private static void setAdminApp(Context context, int state) { private static void setAdminApp(Context context, int state) {
Log.e(TAG, "setAdminApp: state = " + 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.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, changeNum(state));
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", changeNum(state)); Settings.Global.putInt(context.getContentResolver(), "is_admin_app", changeNum(state));
} }