version:6.4.0
fix: update:更换推送
This commit is contained in:
@@ -11,12 +11,12 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
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 com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,7 +41,7 @@ public class SysSettingUtils {
|
||||
if (null == context) {
|
||||
throw new RuntimeException("Context it's null");
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(jsonObj);
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(jsonObj);
|
||||
setPhoneList(context, jsonObject);
|
||||
setBluetooth(context, jsonObject);
|
||||
setHotspot(context, jsonObject);
|
||||
@@ -51,8 +51,8 @@ public class SysSettingUtils {
|
||||
setIcon(context, jsonObject);
|
||||
setCanReset(context, jsonObject);
|
||||
setAutoTime(context, jsonObject);
|
||||
JSONObject navJson = jsonObject.getJSONObject("setting_nav");
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
||||
JsonObject navJson = jsonObject.get("setting_nav").getAsJsonObject();
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.get("setting_nav").toString());
|
||||
setStatusBar(context, navJson);
|
||||
setBrowserInput(context, jsonObject);
|
||||
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
|
||||
@@ -123,15 +123,15 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setPhoneList(Context context, JSONObject jsonObject) {
|
||||
private static void setPhoneList(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//设置电话功能,电话白名单
|
||||
//电话通话开关
|
||||
int setting_call = changeNum(jsonObject.getInteger("setting_call"));
|
||||
int setting_call = changeNum(jsonObject.get("setting_call").getAsInt());
|
||||
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", setting_call);
|
||||
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
|
||||
//电话白名单开关
|
||||
int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
|
||||
int setting_phone = changeNum(jsonObject.get("setting_phone").getAsInt());
|
||||
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);
|
||||
//白名单列表
|
||||
@@ -140,13 +140,13 @@ public class SysSettingUtils {
|
||||
// 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");
|
||||
String setting_phones = jsonObject.get("setting_phones").getAsString();
|
||||
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"));
|
||||
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
|
||||
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) {
|
||||
@@ -174,12 +174,12 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setUSBstate(Context context, JSONObject jsonObject) {
|
||||
private static void setUSBstate(Context context, JsonObject jsonObject) {
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
String setting_usb = jsonObject.getString("setting_usb");
|
||||
String setting_usb = jsonObject.get("setting_usb").getAsString();
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (JGYUtils.isCubeDevice()) {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
@@ -237,14 +237,14 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBluetooth(Context context, JSONObject jsonObject) {
|
||||
private static void setBluetooth(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//蓝牙开关
|
||||
int setting_bht = changeNum(jsonObject.getInteger("setting_bht"));
|
||||
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
|
||||
//总开关
|
||||
int setting_bhtvideo = changeNum(jsonObject.getInteger("setting_bhtvideo"));
|
||||
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
|
||||
//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
|
||||
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
|
||||
//蓝牙传输开关
|
||||
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class SysSettingUtils {
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
//蓝牙总开关开启
|
||||
String setting_context = jsonObject.getString("setting_context");
|
||||
String setting_context = jsonObject.get("setting_context").getAsString();
|
||||
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);
|
||||
@@ -293,9 +293,9 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setHotspot(Context context, JSONObject jsonObject) {
|
||||
private static void setHotspot(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
int setting_hotspot = changeNum(jsonObject.getInteger("setting_hotspot"));//热点
|
||||
int setting_hotspot = changeNum(jsonObject.get("setting_hotspot").getAsInt());//热点
|
||||
if (setting_hotspot == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_hotspot_close");
|
||||
@@ -355,9 +355,9 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBar(Context context, JSONObject jsonObject) {
|
||||
private static void setBar(Context context, JsonObject jsonObject) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(jsonObject.getInteger("setting_navigation"));
|
||||
int setting_navigation = changeNum(jsonObject.get("setting_navigation").getAsInt());
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
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);
|
||||
@@ -378,7 +378,7 @@ public class SysSettingUtils {
|
||||
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(jsonObject.getInteger("setting_statusbar"));
|
||||
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
@@ -423,10 +423,10 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCamera(Context context, JSONObject jsonObject) {
|
||||
private static void setCamera(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//摄像头开关
|
||||
int setting_camera = changeNum(jsonObject.getInteger("setting_camera"));
|
||||
int setting_camera = changeNum(jsonObject.get("setting_camera").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_camera", setting_camera);
|
||||
Log.e(TAG, "qch_app_camera2:" + setting_camera);
|
||||
// ApkUtils.hideSystemSettingAPP(context, "com.mediatek.camera");
|
||||
@@ -479,9 +479,9 @@ public class SysSettingUtils {
|
||||
* @param context
|
||||
* @param jsonObject tfmedia开关
|
||||
*/
|
||||
private static void setTF(Context context, JSONObject jsonObject) {
|
||||
private static void setTF(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
int setting_tfmedia = jsonObject.getInteger("setting_tfmedia");
|
||||
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
|
||||
// if (JGYUtils.isOfficialVersion() ) {
|
||||
// setting_tfmedia = changeNum(setting_tfmedia);
|
||||
// }
|
||||
@@ -502,12 +502,11 @@ public class SysSettingUtils {
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (setting_tfmedia == 1) {
|
||||
JSONArray jSONArray = null;
|
||||
jSONArray = jsonObject.getJSONArray("setting_tfmedia_format");
|
||||
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < jSONArray.size(); i++) {
|
||||
stringBuffer.append(jSONArray.getString(i));
|
||||
stringBuffer.append(jSONArray.get(i).toString());
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
@@ -561,35 +560,35 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIcon(Context context, JSONObject jsonObject) {
|
||||
private static void setIcon(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//added:2019.12.6
|
||||
//设置5个app的开关
|
||||
//时钟
|
||||
int deskclock = changeNum(jsonObject.getInteger("setting_clock"));
|
||||
int deskclock = changeNum(jsonObject.get("setting_clock").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
|
||||
Log.e(TAG, "qch_app_deskclock" + deskclock);
|
||||
//录音机
|
||||
int soundrecorder = changeNum(jsonObject.getInteger("setting_recording"));
|
||||
int soundrecorder = changeNum(jsonObject.get("setting_recording").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
|
||||
Log.e(TAG, "qch_app_soundrecorder" + soundrecorder);
|
||||
//音乐
|
||||
int music = changeNum(jsonObject.getInteger("setting_music"));
|
||||
int music = changeNum(jsonObject.get("setting_music").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", music);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
|
||||
Log.e(TAG, "qch_app_music" + music);
|
||||
//图库
|
||||
int gallery = changeNum(jsonObject.getInteger("setting_picture"));
|
||||
int gallery = changeNum(jsonObject.get("setting_picture").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", gallery);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
|
||||
Log.e(TAG, "qch_app_gallery" + gallery);
|
||||
//壁纸
|
||||
int wallpaper = changeNum(jsonObject.getInteger("setting_wallpaper"));
|
||||
int wallpaper = changeNum(jsonObject.get("setting_wallpaper").getAsInt());
|
||||
setWallpaper(context, wallpaper);
|
||||
//文件管理器
|
||||
int filemanager = changeNum(jsonObject.getInteger("setting_file"));
|
||||
int filemanager = changeNum(jsonObject.get("setting_file").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
|
||||
@@ -598,11 +597,11 @@ public class SysSettingUtils {
|
||||
}
|
||||
Log.e(TAG, "qch_app_filemanager" + filemanager);
|
||||
//浏览器
|
||||
int browser = changeNum(jsonObject.getInteger("setting_browser"));
|
||||
int browser = changeNum(jsonObject.get("setting_browser").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", browser);
|
||||
Log.e(TAG, "qch_app_browser" + browser);
|
||||
//短信
|
||||
int setting_sms = changeNum(jsonObject.getInteger("setting_sms"));
|
||||
int setting_sms = changeNum(jsonObject.get("setting_sms").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", setting_sms);
|
||||
Log.e(TAG, "qch_app_sms" + setting_sms);
|
||||
} catch (Exception e) {
|
||||
@@ -625,8 +624,8 @@ public class SysSettingUtils {
|
||||
|
||||
//aole_restore_forbid_on=1,禁止恢复出厂设置
|
||||
//aole_restore_forbid_on=0,允许恢复出厂设置
|
||||
private static void setCanReset(Context context, JSONObject jsonObject) {
|
||||
int mode = jsonObject.getInteger("qch_restore");
|
||||
private static void setCanReset(Context context, JsonObject jsonObject) {
|
||||
int mode = jsonObject.get("qch_restore").getAsInt();
|
||||
if (mode == 1) {
|
||||
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);
|
||||
@@ -653,8 +652,8 @@ public class SysSettingUtils {
|
||||
//intent34.setPackage("com.android.settings");
|
||||
//sendBroadcast(intent34);
|
||||
|
||||
private static void setAutoTime(Context context, JSONObject jsonObject) {
|
||||
String autoTime = jsonObject.getString("setting_autotime");
|
||||
private static void setAutoTime(Context context, JsonObject jsonObject) {
|
||||
String autoTime = jsonObject.get("setting_autotime").getAsString();
|
||||
String action = "qch_autotime_network";
|
||||
if (TextUtils.isEmpty(autoTime)) {
|
||||
action = "qch_autotime_network";
|
||||
@@ -690,23 +689,23 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void setStatusBar(Context context, JSONObject jsonObject) {
|
||||
Log.e(TAG, "setStatusBar: " + jsonObject.toJSONString());
|
||||
public static void setStatusBar(Context context, JsonObject jsonObject) {
|
||||
Log.e(TAG, "setStatusBar: " + jsonObject.toString());
|
||||
if (null != jsonObject) {
|
||||
int whole = jsonObject.getInteger("whole");
|
||||
int whole = jsonObject.get("whole").getAsInt();
|
||||
if (whole == 1) {
|
||||
setStatusBar(context, 0);
|
||||
} else {
|
||||
List<Integer> disableWhat = new ArrayList<>();
|
||||
int home = jsonObject.getInteger("home");
|
||||
int home = jsonObject.get("home").getAsInt();
|
||||
if (home == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_HOME);
|
||||
}
|
||||
int returnKey = jsonObject.getInteger("returnKey");
|
||||
int returnKey = jsonObject.get("returnKey").getAsInt();
|
||||
if (returnKey == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_BACK);
|
||||
}
|
||||
int taskbar = jsonObject.getInteger("taskbar");
|
||||
int taskbar = jsonObject.get("taskbar").getAsInt();
|
||||
if (taskbar == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_RECENT);
|
||||
}
|
||||
@@ -737,12 +736,12 @@ public class SysSettingUtils {
|
||||
* @param context
|
||||
* @param jsonObject
|
||||
*/
|
||||
private static void setBrowserInput(Context context, JSONObject jsonObject) {
|
||||
private static void setBrowserInput(Context context, JsonObject jsonObject) {
|
||||
int state = 1;
|
||||
try {
|
||||
state = jsonObject.getInteger("setting_browserInput");
|
||||
state = jsonObject.get("setting_browserInput").getAsInt();
|
||||
Log.e(TAG, "setBrowserInput: " + state);
|
||||
String json = jsonObject.getString("setting_browserInput");
|
||||
String json = jsonObject.get("setting_browserInput").getAsString();
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user