version:1.5.0719

bugfixes:
add:优化websocket,增加锁定显示,优化解锁加锁恢复出厂设置
This commit is contained in:
2025-07-23 14:32:46 +08:00
parent 81e4f050ca
commit a03e8b8613
12 changed files with 189 additions and 115 deletions

View File

@@ -115,11 +115,12 @@ public class SysSettingUtils {
*/
public static void setEnableSetting(Context context) {
Toaster.debugShow("打开所有功能");
Log.e(TAG, "setEnableSetting: ");
setPhoneList(context, 0);
if (JgyUtils.C2Tag.equalsIgnoreCase(JgyUtils.getInstance().getAppPlatform())) {
openMtp(context);
}
// setUSBstate(context, 0);
setUsbStatus(context, 0);
setBluetooth(context, 0);
setHotspot(context, 0);
setBar(context, 0);
@@ -191,19 +192,21 @@ public class SysSettingUtils {
}
private static void setUsbStatus(Context context, int state) {
Log.e(TAG, "setUsbStatus: " + state);
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
//Midi模式usb_midi
if (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) {
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setUsbStatus(state);
} else {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
mService.setUsbDataDisabled(true);
}
// if (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) {
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setUsbStatus(state);
} else {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
mService.setUsbDataDisabled(true);
}
} else {
if (state == 0) {
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if ("usb_charge".equals(oldUsb)) {
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
@@ -211,30 +214,35 @@ public class SysSettingUtils {
}
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
Log.e("setUsbStatus", "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;
}
Intent usbIntent = new Intent(usbStatus);
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
} else {
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_mtp");
Log.e("setUsbStatus", "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;
}
Intent usbIntent = new Intent(usbStatus);
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.seewoPlatform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
}
// }
}
private static void setUsbStatus(Context context, JsonObject jsonObject) {
@@ -867,6 +875,10 @@ public class SysSettingUtils {
}
what |= integer;
}
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setHomeEnable(home == 1);
AllwinnerCubeMdmManager.getInstance().setRecentsEnable(taskbar == 1);
}
StatusBarManager mStatusBarManager = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE);
mStatusBarManager.disable(what);
}
@@ -879,6 +891,10 @@ public class SysSettingUtils {
StatusBarManager mStatusBarManager = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE);
mStatusBarManager.disable(StatusBarManager.DISABLE_BACK | StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME);
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);//显示隐藏的虚拟按键
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setHomeEnable(true);
AllwinnerCubeMdmManager.getInstance().setRecentsEnable(true);
}
}
@@ -888,33 +904,19 @@ public class SysSettingUtils {
* @param context
* @param jsonObject
*/
// TODO: 2025/7/14 待优化,逻辑太差了
private static void setBrowserInput(Context context, JsonObject jsonObject) {
int state = 1;
try {
state = jsonObject.get("setting_browserInput").getAsInt();
Log.e(TAG, "setBrowserInput: setting_browserInput = " + state);
String json = jsonObject.get("setting_browserInput").getAsString();
if (TextUtils.isEmpty(json)) {
state = 1;
}
} catch (Exception e) {
Log.e(TAG, "setBrowserInput: e: " + e.getMessage());
}
Log.e(TAG, "setBrowserInput: " + state);
//后台没有这个选项默认打开
if (state == 0) {
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", 1);
} else {
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", 0);
}
if (jsonObject.get("is_browser_network") != null) {
int is_browser_network = jsonObject.get("is_browser_network").getAsInt();
Log.e(TAG, "setBrowserInput: is_browser_network = " + is_browser_network);
Settings.Global.putInt(context.getContentResolver(), "is_browser_network", is_browser_network);
}
if (jsonObject.get("setting_browserInput") != null) {
int qch_Browser_input = jsonObject.get("setting_browserInput").getAsInt();
Log.e(TAG, "setBrowserInput: qch_Browser_input = " + qch_Browser_input);
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", qch_Browser_input);
}
if (jsonObject.get("browser_down") != null) {
int browser_down = jsonObject.get("browser_down").getAsInt();
Settings.System.putInt(context.getContentResolver(), "aoleyun_browser_down", browser_down);
@@ -928,8 +930,8 @@ public class SysSettingUtils {
* @param state
*/
private static void setBrowserInput(Context context, int state) {
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", 0);
Settings.Global.putInt(context.getContentResolver(), "is_browser_network", changeNum(state));
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", state);
Settings.Global.putInt(context.getContentResolver(), "is_browser_network", state);
Settings.System.putInt(context.getContentResolver(), "aoleyun_browser_down", state);
}
@@ -1225,6 +1227,9 @@ public class SysSettingUtils {
break;
}
context.sendBroadcast(intent);
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setNotificationEnable(status == 1);
}
}
private static void setPanelShow(Context context, JsonObject jsonObject) {