增加远程获取sn,台电设备适配
This commit is contained in:
@@ -13,6 +13,7 @@ import android.util.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.config.CommonConfig;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
@@ -130,16 +131,16 @@ public class ControlManager {
|
||||
String usbStatus = "";
|
||||
switch (setting_usb) {
|
||||
case "usb_charge":
|
||||
usbStatus = "qch_action_usb_usb_charge";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
case "usb_mtp":
|
||||
usbStatus = "qch_action_usb_usb_mtp";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
break;
|
||||
// case "usb_midi":
|
||||
// usbStatus = "qch_action_usb_usb_midi";
|
||||
// usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
|
||||
// break;
|
||||
default:
|
||||
usbStatus = "qch_action_usb_usb_charge";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
}
|
||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||
@@ -164,7 +165,7 @@ public class ControlManager {
|
||||
try {
|
||||
boolean qch_usb_choose = Settings.System.putString(mResolver, "qch_usb_choose", "usb_charge");
|
||||
Log.e(TAG, "qch_usb_choose:" + qch_usb_choose);
|
||||
String usbStatus = "qch_action_usb_usb_charge";
|
||||
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(usbIntent);
|
||||
} catch (Exception e) {
|
||||
@@ -180,16 +181,16 @@ public class ControlManager {
|
||||
Log.e("SystemSetting", "qch_call_forbid: " + setting_call);
|
||||
|
||||
int setting_phone = changeNum(settings.getSetting_phone());
|
||||
boolean qch_white_list_on = JGYUtils.putInt(mResolver, "qch_white_list_on", setting_phone);
|
||||
Log.e("SystemSetting", "qch_white_list_on: " + setting_phone);
|
||||
boolean aole_white_list_on = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ON, setting_phone);
|
||||
Log.e("SystemSetting", "aole_white_list_on: " + setting_phone);
|
||||
|
||||
String setting_phones = settings.getSetting_phones();
|
||||
boolean qch_white_list_Array = JGYUtils.putString(mResolver, "qch_white_list_Array", setting_phones);
|
||||
Log.e("SystemSetting", "qch_white_list_Array: " + qch_white_list_Array + "=" + setting_phones);
|
||||
boolean aole_white_list_Array = JGYUtils.putString(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
|
||||
Log.e("SystemSetting", "aole_white_list_Array: " + aole_white_list_Array + "=" + setting_phones);
|
||||
|
||||
int setting_memory = changeNum(settings.getSetting_memory());
|
||||
boolean qch_sdcard_forbid_on = JGYUtils.putInt(mResolver, "qch_sdcard_forbid_on", setting_memory);
|
||||
Log.e("SystemSetting", "qch_sdcard_forbid_on: " + setting_memory);
|
||||
boolean aole_sdcard_forbid_on = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
Log.e("SystemSetting", "aole_sdcard_forbid_on: " + setting_memory);
|
||||
}
|
||||
|
||||
private void setPhoneList(int state) {
|
||||
@@ -198,15 +199,15 @@ public class ControlManager {
|
||||
boolean qch_call_forbid = Settings.System.putInt(mResolver, "qch_call_forbid", state);
|
||||
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
|
||||
|
||||
boolean qch_white_list_on = Settings.System.putInt(mResolver, "qch_white_list_on", state);
|
||||
Log.e(TAG, "qch_white_list_on:" + qch_white_list_on);
|
||||
boolean aole_white_list_on = Settings.System.putInt(mResolver, 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(mResolver, "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(mResolver, 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 + "---" + aole_white_list_Array);
|
||||
|
||||
boolean qch_sdcard_forbid_on = Settings.System.putInt(mResolver, "qch_sdcard_forbid_on", state);
|
||||
Log.e(TAG, "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, 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());
|
||||
}
|
||||
@@ -221,11 +222,11 @@ public class ControlManager {
|
||||
//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(settings.getSetting_bluetooth());
|
||||
//蓝牙传输开关
|
||||
boolean qch_bht_forbid_on = JGYUtils.putInt(mResolver, "qch_bht_forbid_on", setting_bht);
|
||||
boolean aole_bht_forbid_on = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
//写入系统数据库
|
||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
||||
Log.e("SystemSetting", "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();
|
||||
@@ -237,14 +238,14 @@ public class ControlManager {
|
||||
if (setting_bhtvideo == 0) {
|
||||
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
|
||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
||||
JGYUtils.putString(mResolver, "qch_bhtvideo_forbid_on", setting_context);
|
||||
JGYUtils.putString(mResolver, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
|
||||
} else {
|
||||
JGYUtils.putString(mResolver, "qch_bhtvideo_forbid_on", "Empty");
|
||||
JGYUtils.putString(mResolver, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
JGYUtils.putString(mResolver, "qch_bhtvideo_forbid_on", "Empty");
|
||||
JGYUtils.putString(mResolver, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
JGYUtils.putInt(mResolver, "qch_bt_forbid_on", setting_bluetooth);
|
||||
JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
|
||||
} else {
|
||||
mBluetoothAdapter.disable();
|
||||
//设置关闭时关闭蓝牙
|
||||
@@ -257,19 +258,19 @@ public class ControlManager {
|
||||
|
||||
private void setBluetooth(int state) {
|
||||
try {
|
||||
boolean qch_bht_forbid_on = Settings.System.putInt(mResolver, "qch_bht_forbid_on", state);
|
||||
boolean aole_bht_forbid_on = Settings.System.putInt(mResolver, 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(mResolver, "qch_bhtvideo_forbid_on", "Empty");
|
||||
Settings.System.putInt(mResolver, "qch_bt_forbid_on", state);
|
||||
Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
mBluetoothAdapter.disable();
|
||||
//设置关闭时关闭蓝牙
|
||||
}
|
||||
@@ -287,9 +288,9 @@ public class ControlManager {
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendStickyBroadcast(intent);
|
||||
}
|
||||
boolean qch_hotspot_forbid_on = JGYUtils.putInt(mResolver, "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
|
||||
Log.e("SystemSetting", "qch_hotspot_forbid_on:" + setting_hotspot);
|
||||
Log.e("SystemSetting", "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
|
||||
boolean aole_hotspot_forbid_on = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, setting_hotspot);//写入系统数据库
|
||||
Log.e("SystemSetting", "aole_hotspot_forbid_on:" + setting_hotspot);
|
||||
Log.e("SystemSetting", "aole_hotspot_forbid_on:" + aole_hotspot_forbid_on);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
}
|
||||
@@ -301,8 +302,8 @@ public class ControlManager {
|
||||
intent.setAction("qch_hotspot_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendStickyBroadcast(intent);
|
||||
boolean qch_hotspot_forbid_on = Settings.System.putInt(mResolver, "qch_hotspot_forbid_on", state);
|
||||
Log.e(TAG, "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
|
||||
boolean aole_hotspot_forbid_on = Settings.System.putInt(mResolver, 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());
|
||||
}
|
||||
@@ -311,36 +312,37 @@ public class ControlManager {
|
||||
private void setBar(SystemSettings settings) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(settings.getSetting_navigation());
|
||||
boolean qch_hide_navigationBar = JGYUtils.putInt(mResolver, "qch_hide_NavigationBar", setting_navigation);
|
||||
Log.e("SystemSetting", "qch_hide_navigationBar:" + qch_hide_navigationBar);
|
||||
boolean aole_hide_NavigationBar = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
Log.e("SystemSetting", "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;
|
||||
|
||||
default:
|
||||
}
|
||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
mContext.sendBroadcast(navIntent);
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(settings.getSetting_statusbar());
|
||||
int oldNum = JGYUtils.getInt(mResolver, "qch_hide_statusBar", 0);
|
||||
int oldNum = JGYUtils.getInt(mResolver, CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
boolean qch_hide_statusBar = JGYUtils.putInt(mResolver, "qch_hide_statusBar", setting_statusbar);
|
||||
Log.e("SystemSetting", "qch_hide_statusBar:" + qch_hide_statusBar);
|
||||
boolean aole_hide_statusBar = JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
Log.e("SystemSetting", "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;
|
||||
default:
|
||||
}
|
||||
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
mContext.sendBroadcast(statusIntent);
|
||||
@@ -558,16 +560,16 @@ public class ControlManager {
|
||||
private void setCanReset(SystemSettings settings) {
|
||||
int mode = settings.getQch_restore();
|
||||
if (mode == 1) {
|
||||
Settings.System.putInt(mResolver, "qch_restore_forbid_on", 0);
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
} else {
|
||||
Settings.System.putInt(mResolver, "qch_restore_forbid_on", 1);
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
|
||||
}
|
||||
Log.e(TAG, "qch_restore_forbid_on:" + mode);
|
||||
Log.e(TAG, "aole_restore_forbid_on:" + mode);
|
||||
}
|
||||
|
||||
private void setCanReset(int state) {
|
||||
boolean qch_restore_forbid_on = Settings.System.putInt(mResolver, "qch_restore_forbid_on", 0);
|
||||
Log.e(TAG, "qch_restore_forbid_on:" + qch_restore_forbid_on);
|
||||
boolean aole_restore_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
Log.e(TAG, "aole_restore_forbid_on:" + aole_restore_forbid_on);
|
||||
//默认打开
|
||||
}
|
||||
|
||||
@@ -585,7 +587,7 @@ public class ControlManager {
|
||||
int dev_mode = changeNum(jsonObject.getIntValue("dev_mode"));
|
||||
Log.e(TAG, "getDeveloper: " + dev_mode);
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
JGYUtils.putInt(mResolver, "qch_Developeroptions", dev_mode);
|
||||
JGYUtils.putInt(mResolver, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, dev_mode);
|
||||
if (dev_mode == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
@@ -603,7 +605,7 @@ public class ControlManager {
|
||||
public void setDeveloperOptions(int state) {
|
||||
Log.e(TAG, "getDeveloper: " + state);
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
Settings.System.putInt(mResolver, "qch_Developeroptions", state);
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
if (state == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
@@ -641,21 +643,21 @@ public class ControlManager {
|
||||
Log.e("SystemSetting", "setting_usb:" + setting_usb);
|
||||
String usbStatus = "";
|
||||
if (TextUtils.isEmpty(setting_usb)) {
|
||||
usbStatus = "qch_action_usb_usb_charge";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
} else {
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
switch (setting_usb) {
|
||||
case "usb_charge":
|
||||
usbStatus = "qch_action_usb_usb_charge";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
case "usb_mtp":
|
||||
usbStatus = "qch_action_usb_usb_mtp";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
|
||||
break;
|
||||
// case "usb_midi":
|
||||
// usbStatus = "qch_action_usb_usb_midi";
|
||||
// usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
|
||||
// break;
|
||||
default:
|
||||
usbStatus = "qch_action_usb_usb_charge";
|
||||
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user