version: cude 5.1

fix:
update:适配台电
This commit is contained in:
2022-06-11 17:58:04 +08:00
parent b917401e86
commit cdaaaaed91
14 changed files with 323 additions and 240 deletions

View File

@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import java.util.ArrayList;
@@ -108,14 +109,14 @@ public class SysSettingUtils {
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", state);
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
boolean qch_white_list_on = Settings.System.putInt(context.getContentResolver(), "qch_white_list_on", state);
Log.e(TAG, "qch_white_list_on:" + qch_white_list_on);
boolean aole_white_list_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ON, state);
Log.e(TAG, "aole_white_list_on:" + aole_white_list_on);
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", "");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e(TAG, "qch_white_list_Array:" + qch_white_list_Array + "---" + qch_white_list_Array);
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "");
// 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);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), "aole_sdcard_forbid_on", state);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
Log.e(TAG, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
} catch (Exception e) {
Log.e(TAG, "setPhoneList: " + e.getMessage());
@@ -131,22 +132,22 @@ public class SysSettingUtils {
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
//电话白名单开关
int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
boolean qch_white_list_on = Settings.System.putInt(context.getContentResolver(), "qch_white_list_on", setting_phone);
Log.e(TAG, "qch_white_list_on:" + qch_white_list_on);
boolean aole_white_list_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ON, setting_phone);
Log.e(TAG, "aole_white_list_on:" + aole_white_list_on);
//白名单列表
if (setting_phone == 1) {
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", "empty");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e(TAG, "qch_white_list_Array:" + qch_white_list_Array);
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "empty");
// 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);
} else {
String setting_phones = jsonObject.getString("setting_phones");
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", setting_phones);
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e(TAG, "qch_white_list_Array:" + qch_white_list_Array + "---" + setting_phones);
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
// 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.getInteger("setting_memory"));
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), "aole_sdcard_forbid_on", setting_memory);
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());
@@ -164,7 +165,7 @@ public class SysSettingUtils {
mService.setUSBDataDisabled(true);
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 = "aole_action_usb_usb_charge";
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
context.sendBroadcast(usbIntent);
} catch (NoClassDefFoundError | Exception e) {
@@ -193,17 +194,17 @@ public class SysSettingUtils {
}
} 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 = "aole_action_usb_usb_charge";
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
switch (setting_usb) {
case "usb_charge":
usbStatus = "aole_action_usb_usb_charge";
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
break;
case "usb_mtp":
usbStatus = "aole_action_usb_usb_mtp";
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
break;
case "usb_midi":
usbStatus = "aole_action_usb_usb_midi";
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
break;
default:
}
@@ -215,19 +216,19 @@ public class SysSettingUtils {
private static void setBluetooth(Context context, int state) {
try {
boolean qch_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_bht_forbid_on", state);
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
//写入系统数据库
Log.e(TAG, "qch_bht_forbid_on:" + qch_bht_forbid_on);
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (qch_bht_forbid_on) {
if (aole_bht_forbid_on) {
//成功
if (null == mBluetoothAdapter) {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
//获取默认蓝牙适配器
}
//蓝牙总开关开启
Settings.System.putString(context.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putInt(context.getContentResolver(), "qch_bt_forbid_on", state);
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
}
@@ -245,11 +246,11 @@ public class SysSettingUtils {
//蓝牙音频开关
int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
//蓝牙传输开关
boolean qch_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_bht_forbid_on", setting_bht);
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
Log.e(TAG, "qch_bht_forbid_on:" + qch_bht_forbid_on);
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (qch_bht_forbid_on) {
if (aole_bht_forbid_on) {
//成功
if (null == mBluetoothAdapter) {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -261,14 +262,14 @@ public class SysSettingUtils {
if (setting_bhtvideo == 0) {
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
Log.e(TAG, "setting_context:" + setting_context);
Settings.System.putString(context.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
} else {
Settings.System.putString(context.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
} else if (setting_bhtvideo == 1) {
Settings.System.putString(context.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
Settings.System.putInt(context.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
} else {
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
@@ -285,8 +286,8 @@ public class SysSettingUtils {
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
context.sendStickyBroadcast(intent);
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", state);
Log.e(TAG, "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
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);
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
}
@@ -301,9 +302,9 @@ public class SysSettingUtils {
intent.setPackage("com.android.settings");
context.sendStickyBroadcast(intent);
}
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);
Log.e(TAG, "qch_hotspot_forbid_on---------" + setting_hotspot);
Log.e(TAG, "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
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);
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
}
@@ -313,16 +314,16 @@ public class SysSettingUtils {
//系统导航条显示开关
int setting_navigation = 0;
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean qch_hide_navigationBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
Log.e(TAG, "qch_hide_navigationBar---------" + qch_hide_navigationBar);
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);
String navigationStatus = "";
switch (setting_navigation) {
case 0:
navigationStatus = "qch_show_NavigationBar";
navigationStatus = CommonConfig.AOLE_ACTION_SHOW_NAVIGATION_BAR;
break;
case 1:
navigationStatus = "qch_hide_NavigationBar";
navigationStatus = CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR;
break;
}
@@ -332,18 +333,18 @@ public class SysSettingUtils {
//状态栏显示开关
int setting_statusbar = 0;
int oldNum = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
if (oldNum != setting_statusbar) {
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean qch_hide_statusBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
Log.e(TAG, "qch_hide_statusBar---------" + qch_hide_statusBar);
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = "qch_show_statusBar";
statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
break;
case 1:
statusbarStatus = "qch_hide_statusBar";
statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
break;
}
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
@@ -355,16 +356,16 @@ public class SysSettingUtils {
//系统导航条显示开关
int setting_navigation = changeNum(jsonObject.getInteger("setting_navigation"));
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean qch_hide_navigationBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
Log.e(TAG, "qch_hide_navigationBar---------" + qch_hide_navigationBar);
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);
String navigationStatus = "";
switch (setting_navigation) {
case 0:
navigationStatus = "qch_show_NavigationBar";
navigationStatus = CommonConfig.AOLE_ACTION_SHOW_NAVIGATION_BAR;
break;
case 1:
navigationStatus = "qch_hide_NavigationBar";
navigationStatus = CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR;
break;
}
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
@@ -373,18 +374,18 @@ public class SysSettingUtils {
//状态栏显示开关
int setting_statusbar = changeNum(jsonObject.getInteger("setting_statusbar"));
int oldNum = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
if (oldNum != setting_statusbar) {
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean qch_hide_statusBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
Log.e(TAG, "qch_hide_statusBar---------" + qch_hide_statusBar);
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = "qch_show_statusBar";
statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
break;
case 1:
statusbarStatus = "qch_hide_statusBar";
statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
break;
}
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
@@ -607,8 +608,8 @@ public class SysSettingUtils {
}
private static void setCanReset(Context context, int state) {
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), "aole_restore_forbid_on", 0);
Log.e(TAG, "aole_restore_forbid_on:" + aole_restore_forbid_on);
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
Log.e(TAG, "aole_restore_forbid_on: " + aole_restore_forbid_on);
//默认打开
}
@@ -617,11 +618,11 @@ public class SysSettingUtils {
private static void setCanReset(Context context, JSONObject jsonObject) {
int mode = jsonObject.getInteger("qch_restore");
if (mode == 1) {
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), "aole_restore_forbid_on", 0);
Log.e(TAG, "aole_restore_forbid_on:" + aole_restore_forbid_on);
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
Log.e(TAG, "aole_restore_forbid_on: " + aole_restore_forbid_on);
} else {
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), "aole_restore_forbid_on", 1);
Log.e(TAG, "aole_restore_forbid_on:" + aole_restore_forbid_on);
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
Log.e(TAG, "aole_restore_forbid_on: " + aole_restore_forbid_on);
}
}