1.4.0705 优化后台,增加全局黑名单

This commit is contained in:
2024-07-08 10:32:45 +08:00
parent 526914c64c
commit 343700837e
22 changed files with 524 additions and 106 deletions

View File

@@ -6,27 +6,29 @@ import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.cube.SuperPower;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.activity.main.MainActivity;
import com.aoleyun.sn.bean.BluetoothType;
import com.aoleyun.sn.bean.SnSetting;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.gson.GsonUtils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class SysSettingUtils {
@@ -348,6 +350,46 @@ public class SysSettingUtils {
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
Log.e(TAG, "setBluetooth: setting_bhtvideo = " + setting_bhtvideo);
//蓝牙设备连接类型开关
int setting_bluetooth_type = changeNum(jsonObject.get("setting_bluetooth_type").getAsInt());
Log.e(TAG, "setBluetooth: setting_bluetooth_type = " + setting_bluetooth_type);
if (setting_bluetooth_type == 1) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
} else {
String bluetooth_type_control = jsonObject.get("bluetooth_type_control").getAsString();
Log.e(TAG, "setBluetooth: bluetooth_type_control = " + bluetooth_type_control);
if (TextUtils.isEmpty(bluetooth_type_control)) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
} else {
Gson gson = new Gson();
Type listType = new TypeToken<BluetoothType>() {
}.getType();
BluetoothType bluetoothType = gson.fromJson(bluetooth_type_control, listType);
if (bluetoothType == null) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
} else {
List<String> typeList = new ArrayList<>();
if (bluetoothType.getHeadset() == 1) {
typeList.add(CommonConfig.AOLE_BT_HEADSET_KEY);
}
if (bluetoothType.getSound() == 1) {
typeList.add(CommonConfig.AOLE_BT_BOX_KEY);
}
if (bluetoothType.getMobile() == 1) {
typeList.add(CommonConfig.AOLE_BT_PHONE_KEY);
}
if (bluetoothType.getComputer() == 1) {
typeList.add(CommonConfig.AOLE_BT_COMPUTER_KEY);
}
if (bluetoothType.getKeyboard() == 1) {
typeList.add(CommonConfig.AOLE_BT_KEYBOARD_KEY);
}
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, String.join(",", typeList));
}
}
}
int old_setting_bht = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, 1);
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
int old_setting_bhtvideo = mmkv.decodeInt(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, 1);
@@ -895,6 +937,11 @@ public class SysSettingUtils {
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", 0);
}
Intent intent = new Intent("BrowserInternetControlKey");
intent.setPackage("com.aoleyun.browser");
context.sendBroadcast(intent);
JsonElement smsCategory = jsonObject.get("setting_sms");
if (smsCategory != null && !smsCategory.isJsonNull()) {
int setting_sms = smsCategory.getAsInt();