version:1.2

fix:
add:
This commit is contained in:
2022-01-04 15:02:18 +08:00
parent 71e5516ab8
commit d9b05e54cc
23 changed files with 800 additions and 467 deletions

View File

@@ -2,6 +2,7 @@ package com.uiui.sn.manager;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@@ -34,9 +35,14 @@ public class ControlManager {
@SuppressLint("StaticFieldLeak")
private static ControlManager sInstance;
private Context mContext;
private ContentResolver resolver;
private ControlManager(Context mContext) {
if (mContext == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = mContext;
this.resolver = mContext.getContentResolver();
}
public static void init(Context mContext) {
@@ -52,27 +58,29 @@ public class ControlManager {
return sInstance;
}
private static int changeNum(int status) {
private int changeNum(int status) {
return status == 0 ? 1 : 0;
}
public void setSystemSetting(Context context, String jsonString) {
public void setSystemSetting(String jsonString) {
if (TextUtils.isEmpty(jsonString)) {
return;
}
SystemSettings settings = JSON.parseObject(jsonString, SystemSettings.class);
if (null != settings) {
setUSBstate(context, settings);
setPhoneList(context, settings);
setBluetooth(context, settings);
setHotspot(context, settings);
setBar(context, settings);
setCamera(context, settings);
setTF(context, settings);
setIcon(context, settings);
setCanReset(context, jsonString);
setDeveloperOptions(context, jsonString);
setSearchTopic(context, jsonString);
setUSBstate(settings);
setPhoneList(settings);
setBluetooth(settings);
setHotspot(settings);
setBar(settings);
setCamera(settings);
setTF(settings);
setIcon(settings);
setCanReset(settings);
setDeveloperOptions(jsonString);
setSearchTopic(jsonString);
setSOSNumber(settings);
JGYUtils.getInstance().updateForbidList();
}
}
@@ -101,10 +109,9 @@ public class ControlManager {
/**
* usb连接模式管控
*
* @param mContext
* @param settings
*/
private static void setUSBstate(Context mContext, SystemSettings settings) {
private void setUSBstate(SystemSettings settings) {
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
@@ -113,7 +120,7 @@ public class ControlManager {
Log.e("SystemSetting", "setting_usb:" + setting_usb);
if (!DeviceManager.isDebugMode()) {
try {
boolean qch_usb_choose = JGYUtils.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
boolean qch_usb_choose = JGYUtils.putString(resolver, "qch_usb_choose", setting_usb);
Log.e("SystemSetting", "qch_usb_choose:" + qch_usb_choose);
String usbStatus = "";
switch (setting_usb) {
@@ -150,7 +157,7 @@ public class ControlManager {
//Midi模式usb_midi
if (!DeviceManager.isDebugMode()) {
try {
boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", "usb_charge");
boolean qch_usb_choose = Settings.System.putString(resolver, "qch_usb_choose", "usb_charge");
Log.e(TAG, "qch_usb_choose:" + qch_usb_choose);
String usbStatus = "qch_action_usb_usb_charge";
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
@@ -161,46 +168,46 @@ public class ControlManager {
}
}
private static void setPhoneList(Context mContext, SystemSettings settings) {
private void setPhoneList(SystemSettings settings) {
//设置电话功能,电话白名单
int setting_call = changeNum(settings.getSetting_call());
boolean qch_call_forbid = JGYUtils.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
boolean qch_call_forbid = JGYUtils.putInt(resolver, "qch_call_forbid", setting_call);
Log.e("SystemSetting", "qch_call_forbid: " + setting_call);
int setting_phone = changeNum(settings.getSetting_phone());
boolean qch_white_list_on = JGYUtils.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
boolean qch_white_list_on = JGYUtils.putInt(resolver, "qch_white_list_on", setting_phone);
Log.e("SystemSetting", "qch_white_list_on: " + setting_phone);
String setting_phones = settings.getSetting_phones();
boolean qch_white_list_Array = JGYUtils.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
boolean qch_white_list_Array = JGYUtils.putString(resolver, "qch_white_list_Array", setting_phones);
Log.e("SystemSetting", "qch_white_list_Array: " + qch_white_list_Array + "=" + setting_phones);
int setting_memory = changeNum(settings.getSetting_memory());
boolean qch_sdcard_forbid_on = JGYUtils.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
boolean qch_sdcard_forbid_on = JGYUtils.putInt(resolver, "qch_sdcard_forbid_on", setting_memory);
Log.e("SystemSetting", "qch_sdcard_forbid_on: " + setting_memory);
}
private void setPhoneList(int state) {
try {
//设置电话功能,电话白名单
boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", state);
boolean qch_call_forbid = Settings.System.putInt(resolver, "qch_call_forbid", state);
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", state);
boolean qch_white_list_on = Settings.System.putInt(resolver, "qch_white_list_on", state);
Log.e(TAG, "qch_white_list_on:" + qch_white_list_on);
boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", "");
boolean qch_white_list_Array = Settings.System.putString(resolver, "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 qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", state);
boolean qch_sdcard_forbid_on = Settings.System.putInt(resolver, "qch_sdcard_forbid_on", state);
Log.e(TAG, "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
} catch (Exception e) {
Log.e(TAG, "setPhoneList: " + e.getMessage());
}
}
private static void setBluetooth(Context mContext, SystemSettings settings) {
private void setBluetooth(SystemSettings settings) {
try {
//蓝牙开关
int setting_bht = changeNum(settings.getSetting_bht());
@@ -209,7 +216,7 @@ public class ControlManager {
//蓝牙音频开关
int setting_bluetooth = changeNum(settings.getSetting_bluetooth());
//蓝牙传输开关
boolean qch_bht_forbid_on = JGYUtils.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);
boolean qch_bht_forbid_on = JGYUtils.putInt(resolver, "qch_bht_forbid_on", setting_bht);
//写入系统数据库
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -225,14 +232,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(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
JGYUtils.putString(resolver, "qch_bhtvideo_forbid_on", setting_context);
} else {
JGYUtils.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
JGYUtils.putString(resolver, "qch_bhtvideo_forbid_on", "Empty");
}
} else if (setting_bhtvideo == 1) {
JGYUtils.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
JGYUtils.putString(resolver, "qch_bhtvideo_forbid_on", "Empty");
}
JGYUtils.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
JGYUtils.putInt(resolver, "qch_bt_forbid_on", setting_bluetooth);
} else {
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
@@ -245,7 +252,7 @@ public class ControlManager {
private void setBluetooth(int state) {
try {
boolean qch_bht_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", state);
boolean qch_bht_forbid_on = Settings.System.putInt(resolver, "qch_bht_forbid_on", state);
//写入系统数据库
Log.e(TAG, "qch_bht_forbid_on:" + qch_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -256,8 +263,8 @@ public class ControlManager {
//获取默认蓝牙适配器
}
//蓝牙总开关开启
Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", state);
Settings.System.putString(resolver, "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putInt(resolver, "qch_bt_forbid_on", state);
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
}
@@ -266,7 +273,7 @@ public class ControlManager {
}
}
private static void setHotspot(Context mContext, SystemSettings settings) {
private void setHotspot(SystemSettings settings) {
try {
int setting_hotspot = changeNum(settings.getSetting_hotspot());//热点
if (setting_hotspot == 1) {
@@ -275,7 +282,7 @@ public class ControlManager {
intent.setPackage("com.android.settings");
mContext.sendStickyBroadcast(intent);
}
boolean qch_hotspot_forbid_on = JGYUtils.putInt(mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
boolean qch_hotspot_forbid_on = JGYUtils.putInt(resolver, "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);
} catch (Exception e) {
@@ -289,17 +296,17 @@ public class ControlManager {
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
mContext.sendStickyBroadcast(intent);
boolean qch_hotspot_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_hotspot_forbid_on", state);
boolean qch_hotspot_forbid_on = Settings.System.putInt(resolver, "qch_hotspot_forbid_on", state);
Log.e(TAG, "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
}
}
private static void setBar(Context mContext, SystemSettings settings) {
private void setBar(SystemSettings settings) {
//系统导航条显示开关
int setting_navigation = changeNum(settings.getSetting_navigation());
boolean qch_hide_navigationBar = JGYUtils.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
boolean qch_hide_navigationBar = JGYUtils.putInt(resolver, "qch_hide_NavigationBar", setting_navigation);
Log.e("SystemSetting", "qch_hide_navigationBar:" + qch_hide_navigationBar);
String navigationStatus = "";
@@ -317,9 +324,9 @@ public class ControlManager {
//状态栏显示开关
int setting_statusbar = changeNum(settings.getSetting_statusbar());
int oldNum = JGYUtils.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
int oldNum = JGYUtils.getInt(resolver, "qch_hide_statusBar", 0);
if (oldNum != setting_statusbar) {
boolean qch_hide_statusBar = JGYUtils.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
boolean qch_hide_statusBar = JGYUtils.putInt(resolver, "qch_hide_statusBar", setting_statusbar);
Log.e("SystemSetting", "qch_hide_statusBar:" + qch_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
@@ -335,11 +342,11 @@ public class ControlManager {
}
}
private static void setCamera(Context mContext, SystemSettings settings) {
private void setCamera(SystemSettings settings) {
try {
//摄像头开关
int setting_camera = changeNum(settings.getSetting_camera());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_camera", setting_camera);
JGYUtils.putInt(resolver, "qch_app_camera", setting_camera);
// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
Log.e("SystemSetting", "setting_camera:" + setting_camera);
String cameraStatus = "";
@@ -361,7 +368,7 @@ public class ControlManager {
private void setCamera(int state) {
try {
//摄像头开关
boolean qch_app_camera = Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", state);
boolean qch_app_camera = Settings.System.putInt(resolver, "qch_app_camera", state);
Log.e(TAG, "qch_app_camera1:" + state);
// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
Log.e(TAG, "setting_camera---------" + qch_app_camera);
@@ -382,10 +389,10 @@ public class ControlManager {
}
@SuppressLint("NewApi")
private static void setTF(Context mContext, SystemSettings settings) {
private void setTF(SystemSettings settings) {
//tfmedia开关
int setting_tfmedia = changeNum(settings.getSetting_tfmedia());
boolean qch_tfmedia_forbid = JGYUtils.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
boolean qch_tfmedia_forbid = JGYUtils.putInt(resolver, "qch_tfmedia_forbid", setting_tfmedia);
Log.e("SystemSetting", "setting_tfmedia:" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (setting_tfmedia) {
@@ -403,7 +410,7 @@ public class ControlManager {
if (setting_tfmedia == 1) {
String qch_tfmedia_filetypes = settings.getSetting_tfmedia_format();
if (TextUtils.isEmpty(qch_tfmedia_filetypes)) {
JGYUtils.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", "");//影音管控
JGYUtils.putString(resolver, "qch_tfmedia_filetypes", "");//影音管控
} else {
HashSet<String> types = new HashSet<>(Arrays.asList(qch_tfmedia_filetypes.split(",")));
types.removeIf(new Predicate<String>() {
@@ -413,11 +420,11 @@ public class ControlManager {
}
});
String typesString = String.join(",", types);
JGYUtils.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", typesString);//影音管控
JGYUtils.putString(resolver, "qch_tfmedia_filetypes", typesString);//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes :" + typesString);
}
} else {
JGYUtils.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
JGYUtils.putInt(resolver, "qch_tfmedia_forbid", 0);
}
}
@@ -425,7 +432,7 @@ public class ControlManager {
try {
//tfmedia开关
// int setting_tfmedia = 1;
boolean qch_tfmedia_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", state);
boolean qch_tfmedia_forbid = Settings.System.putInt(resolver, "qch_tfmedia_forbid", state);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (state) {
@@ -439,47 +446,47 @@ public class ControlManager {
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
mContext.sendBroadcast(tfmediaIntent);
if (state == 1) {
boolean qch_tfmedia_filetypes = Settings.System.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
boolean qch_tfmedia_filetypes = Settings.System.putString(resolver, "qch_tfmedia_filetypes", "Empty");//影音管控
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
} else {
Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
Settings.System.putInt(resolver, "qch_tfmedia_forbid", 0);
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
}
}
private static void setIcon(Context mContext, SystemSettings settings) {
private void setIcon(SystemSettings settings) {
try {
//added:2019.12.6
//设置5个app的开关
//时钟
int deskclock = changeNum(settings.getSetting_clock());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_deskclock", deskclock);
JGYUtils.putInt(resolver, "qch_app_deskclock", deskclock);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.deskclock");
Log.e("SystemSetting", "qch_app_deskclock:" + deskclock);
//录音机
int soundrecorder = changeNum(settings.getSetting_recording());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
JGYUtils.putInt(resolver, "qch_app_soundrecorder", soundrecorder);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.soundrecorder");
Log.e("SystemSetting", "qch_app_soundrecorder:" + soundrecorder);
//音乐
int music = changeNum(settings.getSetting_music());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_music", music);
JGYUtils.putInt(resolver, "qch_app_music", music);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.music");
Log.e("SystemSetting", "qch_app_music:" + music);
//图库
int gallery = changeNum(settings.getSetting_picture());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_gallery", gallery);
JGYUtils.putInt(resolver, "qch_app_gallery", gallery);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.gallery3d");
Log.e("SystemSetting", "qch_app_gallery:" + gallery);
//壁纸
int wallpaper = changeNum(settings.getSetting_wallpaper());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
JGYUtils.putInt(resolver, "qch_app_wallpaper", wallpaper);
Log.e("SystemSetting", "qch_app_wallpaper:" + wallpaper);
//文件管理器
int filemanager = changeNum(settings.getSetting_file());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_filemanager", filemanager);
JGYUtils.putInt(resolver, "qch_app_filemanager", filemanager);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.filemanager");
} else {
@@ -488,7 +495,7 @@ public class ControlManager {
Log.e("SystemSetting", "qch_app_filemanager:" + filemanager);
//浏览器
int browser = changeNum(settings.getSetting_browser());
JGYUtils.putInt(mContext.getContentResolver(), "qch_app_browser", browser);
JGYUtils.putInt(resolver, "qch_app_browser", browser);
Log.e(TAG, "qch_app_browser" + browser);
} catch (Exception e) {
Log.e(TAG, "setIcon: " + e.getMessage());
@@ -501,27 +508,27 @@ public class ControlManager {
//设置5个app的开关
//时钟
// int deskclock = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_deskclock", state);
Settings.System.putInt(resolver, "qch_app_deskclock", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.deskclock");
Log.e(TAG, "qch_app_deskclock" + state);
//录音机
// int soundrecorder = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", state);
Settings.System.putInt(resolver, "qch_app_soundrecorder", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.soundrecorder");
Log.e(TAG, "qch_app_soundrecorder" + state);
//音乐
// int music = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_music", state);
Settings.System.putInt(resolver, "qch_app_music", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.music");
Log.e(TAG, "qch_app_music" + state);
//图库
// int gallery = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_gallery", state);
Settings.System.putInt(resolver, "qch_app_gallery", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.gallery3d");
Log.e(TAG, "qch_app_gallery" + state);
//文件管理器
// int filemanager = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_filemanager", state);
Settings.System.putInt(resolver, "qch_app_filemanager", state);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.filemanager");
} else {
@@ -529,7 +536,7 @@ public class ControlManager {
}
Log.e(TAG, "qch_app_filemanager" + state);
//浏览器
Settings.System.putInt(mContext.getContentResolver(), "qch_app_browser", state);
Settings.System.putInt(resolver, "qch_app_browser", state);
Log.e(TAG, "qch_app_browser" + state);
} catch (Exception e) {
Log.e(TAG, "setIcon: " + e.getMessage());
@@ -539,23 +546,22 @@ public class ControlManager {
private void setWallpaper(int state) {
//壁纸
// int wallpaper = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_wallpaper", state);
Settings.System.putInt(resolver, "qch_app_wallpaper", state);
Log.e(TAG, "qch_app_wallpaper" + state);
}
private static void setCanReset(Context context, String jsonString) {
JSONObject jsonObject = JSON.parseObject(jsonString);
int mode = jsonObject.getIntValue("qch_restore");
private void setCanReset(SystemSettings settings) {
int mode = settings.getQch_restore();
if (mode == 1) {
Settings.System.putInt(context.getContentResolver(), "qch_restore_forbid_on", 0);
Settings.System.putInt(resolver, "qch_restore_forbid_on", 0);
} else {
Settings.System.putInt(context.getContentResolver(), "qch_restore_forbid_on", 1);
Settings.System.putInt(resolver, "qch_restore_forbid_on", 1);
}
Log.e(TAG, "qch_restore_forbid_on:" + mode);
}
private void setCanReset(int state) {
boolean qch_restore_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_restore_forbid_on", 0);
boolean qch_restore_forbid_on = Settings.System.putInt(resolver, "qch_restore_forbid_on", 0);
Log.e(TAG, "qch_restore_forbid_on:" + qch_restore_forbid_on);
//默认打开
}
@@ -566,20 +572,20 @@ public class ControlManager {
* @param state
*/
private void setBrowserInput(int state) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Browser_input", 0);
Settings.System.putInt(resolver, "qch_Browser_input", 0);
}
public void setDeveloperOptions(Context context, String jsonString) {
public void setDeveloperOptions(String jsonString) {
JSONObject jsonObject = JSON.parseObject(jsonString);
int dev_mode = changeNum(jsonObject.getIntValue("dev_mode"));
Log.e(TAG, "getDeveloper: " + dev_mode);
if (!DeviceManager.isDebugMode()) {
JGYUtils.putInt(context.getContentResolver(), "qch_Developeroptions", dev_mode);
JGYUtils.putInt(resolver, "qch_Developeroptions", dev_mode);
if (dev_mode == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
context.sendBroadcast(intent);
mContext.sendBroadcast(intent);
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
ToastUtil.debugShow("关闭开发者模式");
} else {
@@ -592,7 +598,7 @@ public class ControlManager {
public void setDeveloperOptions(int state) {
Log.e(TAG, "getDeveloper: " + state);
if (!DeviceManager.isDebugMode()) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
Settings.System.putInt(resolver, "qch_Developeroptions", state);
if (state == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
@@ -606,10 +612,10 @@ public class ControlManager {
}
}
public void setSearchTopic(Context context, String jsonString) {
public void setSearchTopic(String jsonString) {
JSONObject jsonObject = JSON.parseObject(jsonString);
int mode = jsonObject.getIntValue("search_topic");
SPUtils.put(context, "search_topic", mode);
SPUtils.put(mContext, "search_topic", mode);
Log.e(TAG, "search_topic:" + mode);
}
@@ -626,7 +632,7 @@ public class ControlManager {
//仅充电usb_charge
//MTP模式usb_mtp
//Midi模式usb_midi
String setting_usb = JGYUtils.getString(mContext.getContentResolver(), "qch_usb_choose");
String setting_usb = JGYUtils.getString(resolver, "qch_usb_choose");
Log.e("SystemSetting", "setting_usb:" + setting_usb);
String usbStatus = "";
if (TextUtils.isEmpty(setting_usb)) {
@@ -653,4 +659,20 @@ public class ControlManager {
mContext.sendBroadcast(usbIntent);
}
private void setSOSNumber(SystemSettings settings) {
String setting_sos = settings.getSetting_sos();
Settings.System.putString(resolver, "setting_sos", setting_sos);
Intent intent = new Intent("setting_sos");
intent.putExtra("setting_sos", setting_sos);
intent.setPackage("com.uiui.os");
mContext.sendBroadcast(intent);
}
private void setSetting(SystemSettings settings) {
int setting_volume = settings.getSetting_volume();
int setting_luminance = settings.getSetting_luminance();
String setting_typeface = settings.getSetting_typeface();
}
}