refactor(app): 统一系统设置写入至 AndroidSettingsWriter 工具类
This commit is contained in:
1 parent
e757160ef2
commit
8a3ac6f5b4
13 files changed
+339
-289
No files matched your search
@@ -14,6 +14,7 @@ import com.aoleyun.sn.databinding.ActivityEyeProtectionBinding;
|
||||
import com.aoleyun.sn.detection.SensorCheckUtil;
|
||||
import com.aoleyun.sn.service.DetectionService;
|
||||
import com.aoleyun.sn.service.ShakeDetectionService;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.view.ToggleButton;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
@@ -42,14 +43,14 @@ public class EyeProtectionActivity extends BaseDataBindingActivity {
|
||||
mBinding.toggleButton1.setOnToggleChanged(new ToggleButton.OnToggleChanged() {
|
||||
@Override
|
||||
public void onToggle(boolean on) {
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.NIGHT_DISPLAY_ACTIVATED, on ? 1 : 0);
|
||||
AndroidSettingsWriter.putInt(EyeProtectionActivity.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.NIGHT_DISPLAY_ACTIVATED, on ? 1 : 0);
|
||||
}
|
||||
});
|
||||
mBinding.toggleButton2.setOnToggleChanged(new ToggleButton.OnToggleChanged() {
|
||||
@Override
|
||||
public void onToggle(boolean on) {
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, on ? 1 : 0);
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, on ? 0 : 1);
|
||||
AndroidSettingsWriter.putInt(EyeProtectionActivity.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, on ? 1 : 0);
|
||||
AndroidSettingsWriter.putInt(EyeProtectionActivity.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, on ? 0 : 1);
|
||||
}
|
||||
});
|
||||
mBinding.toggleButton3.setDisable(true);
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.aoleyun.sn.base.mvvm.BaseMvvmActivity;
|
||||
import com.aoleyun.sn.databinding.ActivityDebugBinding;
|
||||
import com.aoleyun.sn.manager.AllwinnerCubeMdmManager;
|
||||
import com.aoleyun.sn.receiver.ShortcutReceiver;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.JgyUtils;
|
||||
import com.hjq.toast.Toaster;
|
||||
@@ -159,16 +160,16 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setDeveloperOptions(int state) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_Developeroptions", state);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_Developeroptions", state);
|
||||
|
||||
Log.e(TAG, "setDeveloperOptions: " + state);
|
||||
Settings.System.putInt(getContentResolver(), "aole_Developeroptions", state);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_Developeroptions", state);
|
||||
int old_dev_enabled = Settings.Global.getInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
Log.e(TAG, "setDeveloperOptions: old_dev_enabled = " + old_dev_enabled);
|
||||
int new_state = (state == 1 ? 0 : 1);
|
||||
if (old_dev_enabled != new_state) {
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.ADB_ENABLED, new_state);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_GLOBAL, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_GLOBAL, Settings.Global.ADB_ENABLED, new_state);
|
||||
}
|
||||
if (state == 1) {
|
||||
// Intent intent = new Intent();
|
||||
@@ -189,7 +190,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setUsbSettings(View view) {
|
||||
Settings.System.putString(getContentResolver(), "app_view_click_disabled",
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "app_view_click_disabled",
|
||||
"com.android.gallery3d:12345,78901;com.android.settings:9876543,12346");
|
||||
}
|
||||
|
||||
@@ -234,11 +235,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setAllowAppInstallOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_app_allow_install", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_allow_install", 0);
|
||||
}
|
||||
|
||||
public void setAllowAppInstallOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_app_allow_install", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_allow_install", 1);
|
||||
}
|
||||
|
||||
public void getAllowInstallList(View view) {
|
||||
@@ -249,11 +250,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setAllowAppInstallStatus(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_app_forbid", BuildConfig.APPLICATION_ID);
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_forbid", BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
|
||||
public void cleanAllowAppInstallStatus(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_app_forbid", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_forbid", "");
|
||||
}
|
||||
|
||||
public void getForceInstallList(View view) {
|
||||
@@ -264,11 +265,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setForceAppInstallStatus(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_force_app", BuildConfig.APPLICATION_ID);
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_force_app", BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
|
||||
public void cleanForceAppInstallStatus(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_force_app", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_force_app", "");
|
||||
}
|
||||
|
||||
public void getAutoRunAppList(View view) {
|
||||
@@ -279,11 +280,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setAutoRunAppList(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_app_power_on", BuildConfig.APPLICATION_ID);
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_power_on", BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
|
||||
public void cleanAutoRunAppList(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_app_power_on", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_power_on", "");
|
||||
}
|
||||
|
||||
public void goLauncher(View view) {
|
||||
@@ -344,14 +345,14 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setSdOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_sdcard_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_sdcard_forbid_on", 0);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setSDEnable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSdOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_sdcard_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_sdcard_forbid_on", 1);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setSDEnable(false);
|
||||
}
|
||||
@@ -384,11 +385,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setAutoRotationOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_auto_rotation", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_auto_rotation", 0);
|
||||
}
|
||||
|
||||
public void setAutoRotationOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_auto_rotation", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_auto_rotation", 1);
|
||||
}
|
||||
|
||||
public void getBatterySaverStatus(View view) {
|
||||
@@ -398,11 +399,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setBatterySaverOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_setting_battery_saver", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_setting_battery_saver", 0);
|
||||
}
|
||||
|
||||
public void setBatterySaverOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_setting_battery_saver", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_setting_battery_saver", 1);
|
||||
}
|
||||
|
||||
public void getNavigationStatus(View view) {
|
||||
@@ -480,11 +481,11 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
// StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE2_NOTIFICATION_SHADE);
|
||||
Settings.Global.putInt(getContentResolver(), "PULLDOWN_MENU_ENABLED", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_GLOBAL, "PULLDOWN_MENU_ENABLED", 1);
|
||||
}
|
||||
|
||||
public void setCollapseOff(View view) {
|
||||
Settings.Global.putInt(getContentResolver(), "PULLDOWN_MENU_ENABLED", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_GLOBAL, "PULLDOWN_MENU_ENABLED", 0);
|
||||
// StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE2_NONE);
|
||||
@@ -496,14 +497,14 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setHotspotOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_hotspot_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_hotspot_forbid_on", 0);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setWifiHotSpotStatus(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHotspotOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_hotspot_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_hotspot_forbid_on", 1);
|
||||
Intent intent = new Intent("aole_hotspot_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
sendStickyBroadcast(intent);
|
||||
@@ -518,33 +519,33 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setBhtOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bht_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bht_forbid_on", 0);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setBluetoothEnable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBhtOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bht_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bht_forbid_on", 1);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setBluetoothEnable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBtOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bt_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bt_forbid_on", 0);
|
||||
}
|
||||
|
||||
public void setBtOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bt_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bt_forbid_on", 1);
|
||||
}
|
||||
|
||||
public void setBhtvideoOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bhtvideo_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bhtvideo_forbid_on", 0);
|
||||
}
|
||||
|
||||
public void setBhtvideoOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_bhtvideo_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_bhtvideo_forbid_on", 1);
|
||||
}
|
||||
|
||||
public void getResetStatus(View view) {
|
||||
@@ -553,14 +554,14 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setResetOn(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_restore_forbid_on", 0);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_restore_forbid_on", 0);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setResetFactoryEnable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setResetOff(View view) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_restore_forbid_on", 1);
|
||||
AndroidSettingsWriter.putInt(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_restore_forbid_on", 1);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setResetFactoryEnable(false);
|
||||
}
|
||||
@@ -588,12 +589,12 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}};
|
||||
|
||||
public void setMenuList(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_settings_disallow", String.join(",", menuList));
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_settings_disallow", String.join(",", menuList));
|
||||
|
||||
}
|
||||
|
||||
public void cleanMenuList(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_settings_disallow", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_settings_disallow", "");
|
||||
}
|
||||
|
||||
public void listInputMeth(View view) {
|
||||
@@ -680,7 +681,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
|
||||
|
||||
public void setAppOn(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_network_disallow", "com.quark.browser");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_network_disallow", "com.quark.browser");
|
||||
List<String> appBlackNet = new ArrayList<>();
|
||||
appBlackNet.add("com.quark.browser");
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
@@ -689,7 +690,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setAppOnDuo(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_network_disallow", "com.quark.browser");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_network_disallow", "com.quark.browser");
|
||||
List<String> appBlackNet = new ArrayList<>();
|
||||
appBlackNet.add("com.quark.browser");
|
||||
appBlackNet.add("com.tencent.mtt");
|
||||
@@ -700,7 +701,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
|
||||
|
||||
public void setAppOff(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_network_disallow", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_network_disallow", "");
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setBlackNetApp(new ArrayList<>());
|
||||
}
|
||||
@@ -758,7 +759,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setNotiBlackList(View view) {
|
||||
Settings.System.putString(getContentResolver(), "aole_app_info", BuildConfig.APPLICATION_ID);
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_info", BuildConfig.APPLICATION_ID);
|
||||
Log.e("bt_noti_black", "onClick: " + Settings.System.getString(getContentResolver(), "aole_app_info"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.aoleyun.sn.databinding.ActivityMainBinding;
|
||||
import com.aoleyun.sn.dialog.UpdateDialog;
|
||||
import com.aoleyun.sn.dialog.UserDebugDialog;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.GlideLoadUtils;
|
||||
import com.aoleyun.sn.utils.JgyUtils;
|
||||
@@ -206,7 +207,7 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
Log.e(TAG, "initView: defaultLauncher = " + defaultLauncher);
|
||||
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.YXPD1Platform) {
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, Utils.getSerial(this));
|
||||
AndroidSettingsWriter.putString(MainActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.ACTIVATIONBEAN_CODE_KEY, Utils.getSerial(this));
|
||||
}
|
||||
|
||||
Log.e(TAG, "initView: Build.MODEL = " + Build.MODEL);
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.bean.ElectronicFenceInfo;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
@@ -266,17 +267,17 @@ public class MapManager {
|
||||
//先置位,避免部分写入失败时漏还原
|
||||
mSettingsApplied = true;
|
||||
try {
|
||||
Settings.Secure.putInt(resolver, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "recordLocationSettings: 开启 LOCATION_MODE 失败: " + e.getMessage(), e);
|
||||
}
|
||||
try {
|
||||
Settings.Global.putInt(resolver, KEY_ASSISTED_GPS_ENABLED, 1);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, KEY_ASSISTED_GPS_ENABLED, 1);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "recordLocationSettings: 开启 ASSISTED_GPS_ENABLED 失败: " + e.getMessage(), e);
|
||||
}
|
||||
try {
|
||||
Settings.Secure.putString(resolver, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps,+network");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps,+network");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "recordLocationSettings: 开启 LOCATION_PROVIDERS_ALLOWED 失败: " + e.getMessage(), e);
|
||||
}
|
||||
@@ -302,18 +303,18 @@ public class MapManager {
|
||||
ContentResolver resolver = mContext.getContentResolver();
|
||||
if (snapshot.locationModeValid) {
|
||||
try {
|
||||
Settings.Secure.putInt(resolver, Settings.Secure.LOCATION_MODE, snapshot.locationMode);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.LOCATION_MODE, snapshot.locationMode);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "restoreLocationSettings: 还原 LOCATION_MODE 失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Settings.Global.putInt(resolver, KEY_ASSISTED_GPS_ENABLED, snapshot.assistedGpsEnabled);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, KEY_ASSISTED_GPS_ENABLED, snapshot.assistedGpsEnabled);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "restoreLocationSettings: 还原 ASSISTED_GPS_ENABLED 失败: " + e.getMessage(), e);
|
||||
}
|
||||
try {
|
||||
Settings.Secure.putString(resolver, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
|
||||
snapshot.providersAllowed == null ? "" : snapshot.providersAllowed);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "restoreLocationSettings: 还原 LOCATION_PROVIDERS_ALLOWED 失败: " + e.getMessage(), e);
|
||||
|
||||
@@ -91,6 +91,7 @@ import com.aoleyun.sn.service.LogcatService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.statistics.AppInformation;
|
||||
import com.aoleyun.sn.statistics.StatisticsInfo;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.BitmapUtils;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
@@ -1461,10 +1462,10 @@ public class NetInterfaceManager {
|
||||
if (baseResponse.isSuccess()) {
|
||||
CustomROMApp customROMApp = baseResponse.data;
|
||||
String packageName = customROMApp.getPackage_name();
|
||||
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", packageName);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "jgy_customromapp", packageName);
|
||||
} else {
|
||||
Log.e("getROMApp", "onNext: " + baseResponse.msg);
|
||||
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", " ");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "jgy_customromapp", " ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1504,10 +1505,10 @@ public class NetInterfaceManager {
|
||||
String hideString = TextUtils.join(",", hidePkgs);
|
||||
String showString = TextUtils.join(",", showPkgs);
|
||||
Log.e("getIconControl", "applyIconControl: disable = " + hideString + ", show = " + showString);
|
||||
Settings.Global.putString(mContext.getContentResolver(),
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
CommonConfig.AOLE_ACTION_HIDE_DESKTOP_ICON,
|
||||
TextUtils.isEmpty(hideString) ? "null" : hideString);
|
||||
Settings.Global.putString(mContext.getContentResolver(),
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
CommonConfig.AOLE_ACTION_SHOW_DESKTOP_ICON,
|
||||
TextUtils.isEmpty(showString) ? "null" : showString);
|
||||
//2、按清单禁用
|
||||
@@ -1698,16 +1699,16 @@ public class NetInterfaceManager {
|
||||
// TODO: 2025/11/21 高木g104不需要id管控
|
||||
if ("G104".equals(Build.MODEL) || "HT01".equals(Build.MODEL)) {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.APP_VIEW_CLICK_DISABLED, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled");
|
||||
Log.e(TAG, "getAppIDControl: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if ("G10".equals(Build.MODEL) || "D1".equals(Build.MODEL) || "Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.ttstd.utils:12345");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.APP_VIEW_CLICK_DISABLED, "com.ttstd.utils:12345");
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.arivoc.wordhd:2131624676,2131624689;com.ttstd.utils:12345");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.APP_VIEW_CLICK_DISABLED, "com.arivoc.wordhd:2131624676,2131624689;com.ttstd.utils:12345");
|
||||
}
|
||||
if (baseResponse.isSuccess()) {
|
||||
List<AppID> appIDList = baseResponse.data;
|
||||
@@ -1794,7 +1795,7 @@ public class NetInterfaceManager {
|
||||
//且没有被其他管控来源要求禁用的应用
|
||||
Log.e("getSnAppAttr", "onNext: appAttrList is empty");
|
||||
showAppWithoutOtherSource(oldPkgs);
|
||||
Settings.Global.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DISABLE_APP, "null");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.AOLE_ACTION_DISABLE_APP, "null");
|
||||
} else {
|
||||
showAppWithoutOtherSource(oldPkgs);
|
||||
for (AppAttr appAttr : appAttrList) {
|
||||
@@ -1807,7 +1808,7 @@ public class NetInterfaceManager {
|
||||
.map(AppAttr::getApp_package)
|
||||
.collect(Collectors.joining(","));
|
||||
Log.e("getSnAppAttr", "onNext: disableApp = " + disableApp);
|
||||
Settings.Global.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DISABLE_APP, disableApp);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.AOLE_ACTION_DISABLE_APP, disableApp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1906,15 +1907,15 @@ public class NetInterfaceManager {
|
||||
if (baseResponse.isSuccess()) {
|
||||
EBagCode eBagCode = baseResponse.data;
|
||||
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.YXPD1Platform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, eBagCode.getEbagCode());
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.ACTIVATIONBEAN_CODE_KEY, eBagCode.getEbagCode());
|
||||
}
|
||||
String ebagCode = eBagCode.getEbagCode();
|
||||
mMMKV.encode("ebagCode", ebagCode);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 1);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.UIUI_ACTIVATION_KEY, 1);
|
||||
JgyUtils.getInstance().checkLocalExternalFiles();
|
||||
} else {
|
||||
Log.e("getEBagCode", "onNext: " + baseResponse.data);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2167,7 +2168,7 @@ public class NetInterfaceManager {
|
||||
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) {
|
||||
JgyUtils.getInstance().setDefaultDesktop("com.aly.os");
|
||||
}
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
// Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
|
||||
} else if (locked == JGYActions.NET_CODE_UNLOCKED) {
|
||||
// SysSettingUtils.setEnableSetting(mContext);
|
||||
@@ -2185,15 +2186,15 @@ public class NetInterfaceManager {
|
||||
StatusBarManager mStatusBarManager = (StatusBarManager) mContext.getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
|
||||
}
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_UNLOCKED);
|
||||
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 1);
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_UNLOCKED);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_ALLOW_INSTALL, 1);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
JgyUtils.getInstance().addAppInstallWhiteList(new ArrayList<>());
|
||||
JgyUtils.getInstance().setAppRestriction(0);
|
||||
JgyUtils.getInstance().setDeveloperOptions(1);
|
||||
}
|
||||
} else if (response.code == -300) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
Log.e("getLockedState", "locked: " + false);
|
||||
}
|
||||
}
|
||||
@@ -2852,7 +2853,7 @@ public class NetInterfaceManager {
|
||||
Log.e(TAG, "setHomepagtag: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
boolean home = Settings.System.putString(mContext.getContentResolver(), "homepagURL", homepagURL);
|
||||
boolean home = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "homepagURL", homepagURL);
|
||||
Log.e("getHomePageBookmarks", "onNext: homepagURL: save homepagURL = " + home);
|
||||
String whitelist = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
|
||||
Log.e("getHomePageBookmarks ", "whitelist: " + whitelist);
|
||||
@@ -2913,7 +2914,7 @@ public class NetInterfaceManager {
|
||||
intent1.putExtra("homepage", "Invalid");
|
||||
mContext.sendBroadcast(intent1);
|
||||
|
||||
Settings.System.putString(mContext.getContentResolver(), "homepagURL", " ");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "homepagURL", " ");
|
||||
Intent intent2 = new Intent("qch_app_brower_website");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent2.setPackage("com.android.settings")
|
||||
@@ -2933,21 +2934,21 @@ public class NetInterfaceManager {
|
||||
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
|
||||
white += "," + homePage;
|
||||
}
|
||||
boolean DeselectBrowserArray = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", white);
|
||||
boolean DeselectBrowserArray = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", white);
|
||||
Log.e("setBrowserBlackList", "setBrowserList white = " + white + ":" + DeselectBrowserArray);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", homePage);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", homePage);
|
||||
}
|
||||
String black = browserData.getBlack();
|
||||
if (!TextUtils.isEmpty(black)) {
|
||||
boolean qch_webblack_url = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", black);
|
||||
boolean qch_webblack_url = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_webblack_url", black);
|
||||
Log.e("setBrowserBlackList", "setBrowserList black = " + black + ":" + qch_webblack_url);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
List<String> componentNames = new ArrayList<>(Arrays.asList(black.split(",")));
|
||||
AllwinnerCubeMdmManager.getInstance().setComponentDisable(componentNames, true);
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_webblack_url", " ");
|
||||
}
|
||||
String white_ip = browserData.getWhite_ip();
|
||||
if (!TextUtils.isEmpty(white_ip)) {
|
||||
@@ -2962,8 +2963,8 @@ public class NetInterfaceManager {
|
||||
mMMKV.encode("black_ip", " ");
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", homePage);
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", homePage);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_webblack_url", " ");
|
||||
mMMKV.encode("white_ip", " ");
|
||||
mMMKV.encode("black_ip", " ");
|
||||
}
|
||||
@@ -3173,7 +3174,7 @@ public class NetInterfaceManager {
|
||||
if (forceApp != null) {
|
||||
forceAppSet.addAll(forceApp);
|
||||
}
|
||||
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppSet));
|
||||
boolean aole_force_app = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppSet));
|
||||
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
|
||||
}
|
||||
|
||||
@@ -3742,14 +3743,14 @@ public class NetInterfaceManager {
|
||||
if (response.isSuccess()) {
|
||||
String app_package = response.data.getApp_package();
|
||||
ForegroundAppUtil.setTopAppClass(mContext, app_package);
|
||||
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, app_package);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, ForegroundAppUtil.TOPAPP_KEY, app_package);
|
||||
ForegroundAppUtil.openTopApp(mContext);
|
||||
} else {
|
||||
if ("YX-T01".equalsIgnoreCase(Build.MODEL)) {
|
||||
JgyUtils.getInstance().setTongyiAppTop();
|
||||
} else {
|
||||
ForegroundAppUtil.setTopAppClass(mContext, "");
|
||||
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, ForegroundAppUtil.TOPAPP_KEY, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4349,7 +4350,7 @@ public class NetInterfaceManager {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_black_list");
|
||||
Log.e(TAG, "getBlackList: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -4360,23 +4361,23 @@ public class NetInterfaceManager {
|
||||
BlacklistBean blacklistBean = blacklistBeanBaseResponse.data;
|
||||
if (blacklistBean == null) {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
} else {
|
||||
List<String> strings = blacklistBean.getBlacklist();
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
} else {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", strings));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", strings));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4425,7 +4426,7 @@ public class NetInterfaceManager {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_white_list");
|
||||
Log.e(TAG, "getWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -4436,46 +4437,46 @@ public class NetInterfaceManager {
|
||||
WhitelistBean whitelistBean = blacklistBeanBaseResponse.data;
|
||||
if (whitelistBean == null) {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
} else {
|
||||
if (("Ebox201w".equals(Build.MODEL) && JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT8768Platform)
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<String> strings = whitelistBean.getWhitelist();
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
} else {
|
||||
if (("Ebox201w".equals(Build.MODEL) && JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT8768Platform)
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
strings.add("ttstd.com");
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
strings.remove("ttstd.com");
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
} else {
|
||||
if (("Ebox201w".equals(Build.MODEL) && JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT8768Platform)
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
} else {
|
||||
if (("Ebox201w".equals(Build.MODEL) && JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT8768Platform)
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.network.RetryCallback;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.BatteryUtils;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
@@ -322,8 +323,8 @@ public class PushManager {
|
||||
JgyUtils.getInstance().wakeUpAoleyunAPP();
|
||||
NetInterfaceManager.getInstance().getPushAndPubAppTag();
|
||||
NetInterfaceManager.clearAllCache();
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
sendRefreshBroadcast(mContext);
|
||||
SysSettingUtils.setDisableSetting(mContext);
|
||||
break;
|
||||
@@ -772,9 +773,9 @@ public class PushManager {
|
||||
List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(",")));
|
||||
forceAppList.remove(pkg);
|
||||
if (forceAppList.size() != 0) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
}
|
||||
}
|
||||
ApkUtils.UninstallAPP(mContext, pkg);
|
||||
@@ -911,10 +912,10 @@ public class PushManager {
|
||||
Log.e("fht", "aole_disable_slide: " + aole_disable_slide);
|
||||
|
||||
if (!TextUtils.isEmpty(strban)) {
|
||||
Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, strban);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, strban);
|
||||
Log.e("fht", "sendban::" + strban);
|
||||
} else {
|
||||
Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
}
|
||||
Log.e("fht", "aole_disable_slide::" + Settings.System.getString(mResolver, CommonConfig.AOLE_ACTION_DISABLE_SLIDE));
|
||||
}
|
||||
@@ -989,15 +990,15 @@ public class PushManager {
|
||||
Log.e(TAG, "settingPowerOn: aole_app_power_on = " + not);
|
||||
if (TextUtils.isEmpty(not)) {
|
||||
//当 qch_app_power_on 的值为空时,会造成系统所有应用断网
|
||||
Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
} else {
|
||||
Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_APP_POWER_ON, not);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, not);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void writeDeselectBrowserIDtoSystem(String s) {
|
||||
boolean bool = Settings.System.putString(mResolver, "DeselectBrowserArray", s);
|
||||
boolean bool = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", s);
|
||||
Log.e("SystemSetting", "DeselectBrowserArray---------" + s);
|
||||
Log.e("SystemSetting", "DeselectBrowserArray---------" + bool);
|
||||
}
|
||||
@@ -1028,7 +1029,7 @@ public class PushManager {
|
||||
}
|
||||
JsonObject jSONObject = GsonUtils.getJsonObject(s);
|
||||
int i = changeNum(jSONObject.get("lock").getAsInt());
|
||||
Settings.System.putInt(mResolver, JGYActions.ACTION_QCH_UNLOCK_IPAD, i);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, JGYActions.ACTION_QCH_UNLOCK_IPAD, i);
|
||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
|
||||
if (getBatteryLevel() >= CommonConfig.MIN_POWER) {
|
||||
@@ -1167,10 +1168,10 @@ public class PushManager {
|
||||
|
||||
String packageName = jsonObject.get("app_package").getAsString();
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
Settings.Global.putString(mResolver, ForegroundAppUtil.TOPAPP_KEY, "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, ForegroundAppUtil.TOPAPP_KEY, "");
|
||||
ForegroundAppUtil.setTopAppClass(mContext, "");
|
||||
} else {
|
||||
Settings.Global.putString(mResolver, ForegroundAppUtil.TOPAPP_KEY, packageName);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, ForegroundAppUtil.TOPAPP_KEY, packageName);
|
||||
ForegroundAppUtil.setTopAppClass(mContext, packageName);
|
||||
ForegroundAppUtil.openTopApp(mContext);
|
||||
}
|
||||
@@ -1394,14 +1395,14 @@ public class PushManager {
|
||||
Log.e(TAG, "setEbagCode: " + "ebagCode is empty");
|
||||
mMMKV.encode("ebagCode", "");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.YXPD1Platform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, "");
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.ACTIVATIONBEAN_CODE_KEY, "");
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
}
|
||||
} else {
|
||||
mMMKV.encode("ebagCode", ebagCode);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.YXPD1Platform) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, ebagCode);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 1);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.ACTIVATIONBEAN_CODE_KEY, ebagCode);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, CommonConfig.UIUI_ACTIVATION_KEY, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.rlog.LogDBManager;
|
||||
import com.aoleyun.sn.service.DetectionService;
|
||||
import com.aoleyun.sn.service.ShakeDetectionService;
|
||||
import com.aoleyun.sn.utils.AndroidSettingsWriter;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
@@ -459,7 +460,7 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
try {
|
||||
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 0) == 0) {
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.DX11Platform) {
|
||||
Settings.System.putInt(getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
AndroidSettingsWriter.putInt(MainService.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
}
|
||||
if (!checkAoleyunApp()) {
|
||||
Log.e(TAG, "onStartCommand: " + "checkAoleyunApp");
|
||||
@@ -479,7 +480,7 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
JgyUtils.getInstance().setTongyiAppTop();
|
||||
}
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.YXPD1Platform) {
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, Utils.getSerial(this));
|
||||
AndroidSettingsWriter.putString(MainService.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.ACTIVATIONBEAN_CODE_KEY, Utils.getSerial(this));
|
||||
if (ApkUtils.isAvailable(this, JgyUtils.JXW_LAUNCHER_PACKAGE_NAME)) {
|
||||
Intent intent2 = new Intent(Intent.ACTION_VIEW);
|
||||
intent2.setPackage(JgyUtils.JXW_LAUNCHER_PACKAGE_NAME);
|
||||
@@ -496,7 +497,7 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
Log.e(TAG, "initOnBackground: " + launcherPkg);
|
||||
JgyUtils.getInstance().checkDefaultDesktop(launcherPkg);
|
||||
|
||||
Settings.Global.putString(getContentResolver(), "AOLE_SERIAL", Utils.getSerial(MainService.this));
|
||||
AndroidSettingsWriter.putString(MainService.this, AndroidSettingsWriter.NAMESPACE_GLOBAL, "AOLE_SERIAL", Utils.getSerial(MainService.this));
|
||||
|
||||
PackageManager pm = getPackageManager();
|
||||
try {
|
||||
@@ -552,7 +553,7 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
|
||||
String allowAppList = Settings.System.getString(getContentResolver(), CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST);
|
||||
if (TextUtils.isEmpty(allowAppList)) {
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", JgyUtils.DEFAULT_APP_SOURCE_WHITE_LIST));
|
||||
AndroidSettingsWriter.putString(MainService.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", JgyUtils.DEFAULT_APP_SOURCE_WHITE_LIST));
|
||||
}
|
||||
|
||||
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
|
||||
@@ -608,7 +609,7 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
//没有批次就没有管控
|
||||
Log.e(TAG, "setTagsFinish: not set tag");
|
||||
// SysSettingUtils.setEnableSetting(this);
|
||||
Settings.System.putString(getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
AndroidSettingsWriter.putString(MainService.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
} else {
|
||||
mServiceModel.getForceDownload();
|
||||
mServiceModel.getWallpaper();
|
||||
@@ -1168,16 +1169,16 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
switch (action) {
|
||||
case NIGHT_DISPLAY_ENABLED:
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.NIGHT_DISPLAY_ACTIVATED, 1);
|
||||
AndroidSettingsWriter.putInt(MainService.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.NIGHT_DISPLAY_ACTIVATED, 1);
|
||||
break;
|
||||
case NIGHT_DISPLAY_DISABLED:
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.NIGHT_DISPLAY_ACTIVATED, 0);
|
||||
AndroidSettingsWriter.putInt(MainService.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.NIGHT_DISPLAY_ACTIVATED, 0);
|
||||
break;
|
||||
case READ_MODEL_ENABLED:
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 1);
|
||||
AndroidSettingsWriter.putInt(MainService.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 1);
|
||||
break;
|
||||
case READ_MODEL_DISABLED:
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0);
|
||||
AndroidSettingsWriter.putInt(MainService.this, AndroidSettingsWriter.NAMESPACE_SECURE, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -12,14 +12,17 @@ import android.util.Log;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 以 "android" 包名记账写 Settings.System(system uid + platform 签名前提)。
|
||||
* 逻辑自 JgyUtils.androidSettingsPutString 原样抽出,未做任何改动。
|
||||
* 以 "android" 包名记账写 Settings.System/Secure/Global(system uid + platform 签名前提),
|
||||
* 模拟写入未被确认时退回直接 Settings 写。
|
||||
*/
|
||||
public final class AndroidSettingsWriter {
|
||||
|
||||
private static final String TAG = "AndroidSettingsWriter";
|
||||
|
||||
private static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
|
||||
public static final String NAMESPACE_SYSTEM = "system";
|
||||
public static final String NAMESPACE_SECURE = "secure";
|
||||
public static final String NAMESPACE_GLOBAL = "global";
|
||||
|
||||
private static final String CALL_METHOD_USER_KEY = "_user";
|
||||
|
||||
private static final String SETTINGS_AUTHORITY = "settings";
|
||||
@@ -42,17 +45,24 @@ public final class AndroidSettingsWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容旧调用:等同于 {@code putString(context, NAMESPACE_SYSTEM, name, value)}。
|
||||
*/
|
||||
public static boolean androidSettingsPutString(Context context, String name, String value) {
|
||||
return putString(context, NAMESPACE_SYSTEM, name, value);
|
||||
}
|
||||
|
||||
public static boolean putString(Context context, String namespace, String name, String value) {
|
||||
Context targetContext = context;
|
||||
if (targetContext == null) {
|
||||
targetContext = sAppContext;
|
||||
}
|
||||
if (targetContext == null) {
|
||||
Log.e(TAG, "androidSettingsPutString: Context is null");
|
||||
Log.e(TAG, "putString: Context is null");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
Log.e(TAG, "androidSettingsPutString: name is empty");
|
||||
Log.e(TAG, "putString: name is empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,25 +74,56 @@ public final class AndroidSettingsWriter {
|
||||
// 注意:发起方进程绝不能 clearCallingIdentity——它会篡改本进程事务携带的
|
||||
// 调用身份,SettingsProvider 侧校验 calling pid 会直接拒绝("doesn't match source pid")。
|
||||
// 那个手法只适用于服务端(代理进程处理入站 binder 调用时)。
|
||||
Bundle result = callSettingsPut(targetContext, arg, name);
|
||||
Bundle result = callSettingsPut(targetContext, namespace, arg, name);
|
||||
boolean bundleOk = isOk(result);
|
||||
// 该厂商 SettingsProvider 对 PUT_system 静默返回 null(不抛异常也不回 Bundle),
|
||||
// 该厂商 SettingsProvider 对 PUT_* 静默返回 null(不抛异常也不回 Bundle),
|
||||
// 成败以写后读回为准。
|
||||
String readBack = null;
|
||||
try {
|
||||
readBack = Settings.System.getString(targetContext.getContentResolver(), name);
|
||||
} catch (Throwable t) {
|
||||
Log.w(TAG, "androidSettingsPutString: read back failed for " + name + ": " + t);
|
||||
}
|
||||
String readBack = readSetting(targetContext.getContentResolver(), namespace, name);
|
||||
boolean verified = TextUtils.equals(readBack, value);
|
||||
if (!bundleOk && !verified) {
|
||||
Log.w(TAG, "androidSettingsPutString: failed for " + name
|
||||
+ " (result=" + result + ", readBack=" + readBack + ")");
|
||||
return false;
|
||||
if (bundleOk || verified) {
|
||||
Log.d(TAG, "putString succeeded for " + namespace + "/" + name
|
||||
+ " (bundleOk=" + bundleOk + ", verified=" + verified + ")");
|
||||
return true;
|
||||
}
|
||||
Log.w(TAG, "putString failed for " + namespace + "/" + name
|
||||
+ " (result=" + result + ", readBack=" + readBack + "), fallback to direct put");
|
||||
return directPutString(targetContext.getContentResolver(), namespace, name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings 各表内部都按字符串落库(putInt == putString(String.valueOf(int))),
|
||||
* 所以类型写入与字符串写入同一条路径,直接调用兜底也落在对应表的 putString 上。
|
||||
*/
|
||||
public static boolean putInt(Context context, String namespace, String name, int value) {
|
||||
return putString(context, namespace, name, String.valueOf(value));
|
||||
}
|
||||
|
||||
private static String readSetting(ContentResolver cr, String namespace, String name) {
|
||||
try {
|
||||
switch (namespace) {
|
||||
case NAMESPACE_SECURE:
|
||||
return Settings.Secure.getString(cr, name);
|
||||
case NAMESPACE_GLOBAL:
|
||||
return Settings.Global.getString(cr, name);
|
||||
default:
|
||||
return Settings.System.getString(cr, name);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Log.w(TAG, "readSetting failed for " + namespace + "/" + name + ": " + t);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean directPutString(ContentResolver cr, String namespace, String name,
|
||||
String value) {
|
||||
switch (namespace) {
|
||||
case NAMESPACE_SECURE:
|
||||
return Settings.Secure.putString(cr, name, value);
|
||||
case NAMESPACE_GLOBAL:
|
||||
return Settings.Global.putString(cr, name, value);
|
||||
default:
|
||||
return Settings.System.putString(cr, name, value);
|
||||
}
|
||||
Log.d(TAG, "androidSettingsPutString succeeded for " + name
|
||||
+ " (bundleOk=" + bundleOk + ", verified=" + verified + ")");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,18 +132,18 @@ public final class AndroidSettingsWriter {
|
||||
* 事务由设备框架自己生成的 Proxy 写出,事务码/布局永远和 ROM 匹配。
|
||||
* 前提:android.uid.system + platform 签名。
|
||||
*/
|
||||
private static Bundle callSettingsPut(Context context, Bundle arg, String name) {
|
||||
private static Bundle callSettingsPut(Context context, String namespace, Bundle arg, String name) {
|
||||
Object provider = getSettingsProvider(context);
|
||||
if (provider == null) {
|
||||
return null;
|
||||
}
|
||||
Bundle result = invokeProviderCall(provider, arg, name);
|
||||
Bundle result = invokeProviderCall(provider, namespace, arg, name);
|
||||
if (result == null) {
|
||||
// 可能 binder 已死亡,清缓存重取再试一次
|
||||
sSettingsProvider = null;
|
||||
provider = getSettingsProvider(context);
|
||||
if (provider != null) {
|
||||
result = invokeProviderCall(provider, arg, name);
|
||||
result = invokeProviderCall(provider, namespace, arg, name);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -115,12 +156,14 @@ public final class AndroidSettingsWriter {
|
||||
* 本 App 就是 uid 1000,enforceCallingUid 校验通过;"android" 包属于 uid 1000,
|
||||
* attribution 链校验也通过。旧 4 参 call 无包名槽位(会记真实包名),不用。
|
||||
*/
|
||||
private static Bundle invokeProviderCall(Object provider, Bundle arg, String name) {
|
||||
private static Bundle invokeProviderCall(Object provider, String namespace, Bundle arg,
|
||||
String name) {
|
||||
Object attribution = buildAndroidAttributionSource();
|
||||
if (attribution == null) {
|
||||
Log.e(TAG, "androidSettingsPutString: attribution source is null, abort");
|
||||
Log.e(TAG, "putString: attribution source is null, abort");
|
||||
return null;
|
||||
}
|
||||
String callMethod = "PUT_" + namespace;
|
||||
for (Method m : provider.getClass().getMethods()) {
|
||||
if (!"call".equals(m.getName())) {
|
||||
continue;
|
||||
@@ -130,20 +173,20 @@ public final class AndroidSettingsWriter {
|
||||
&& p[0].getName().equals("android.content.AttributionSource")) {
|
||||
try {
|
||||
Bundle r = (Bundle) m.invoke(provider, attribution, SETTINGS_AUTHORITY,
|
||||
CALL_METHOD_PUT_SYSTEM, name, arg);
|
||||
Log.d(TAG, "androidSettingsPutString: invoked call"
|
||||
callMethod, name, arg);
|
||||
Log.d(TAG, "putString: invoked " + callMethod + " "
|
||||
+ java.util.Arrays.toString(p) + " -> "
|
||||
+ (r == null ? "null" : r.toString()));
|
||||
return r;
|
||||
} catch (Throwable t) {
|
||||
Throwable root = t instanceof java.lang.reflect.InvocationTargetException
|
||||
&& t.getCause() != null ? t.getCause() : t;
|
||||
Log.w(TAG, "androidSettingsPutString: provider call failed: " + root);
|
||||
Log.w(TAG, "putString: provider call failed: " + root);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.w(TAG, "androidSettingsPutString: no AttributionSource call overload on "
|
||||
Log.w(TAG, "putString: no AttributionSource call overload on "
|
||||
+ provider.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
@@ -158,7 +201,7 @@ public final class AndroidSettingsWriter {
|
||||
builder.getMethod("setPackageName", String.class).invoke(b, "android");
|
||||
return builder.getMethod("build").invoke(b);
|
||||
} catch (Throwable t) {
|
||||
Log.e(TAG, "androidSettingsPutString: build AttributionSource failed: " + t);
|
||||
Log.e(TAG, "putString: build AttributionSource failed: " + t);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +243,7 @@ public final class AndroidSettingsWriter {
|
||||
}
|
||||
}
|
||||
if (sSettingsProvider == null) {
|
||||
Log.e(TAG, "androidSettingsPutString: settings provider unavailable");
|
||||
Log.e(TAG, "putString: settings provider unavailable");
|
||||
}
|
||||
return sSettingsProvider;
|
||||
}
|
||||
@@ -237,14 +280,14 @@ public final class AndroidSettingsWriter {
|
||||
m.setAccessible(true);
|
||||
Object provider = m.invoke(cr, args);
|
||||
if (provider != null) {
|
||||
Log.d(TAG, "androidSettingsPutString: acquired via " + m.getName()
|
||||
Log.d(TAG, "putString: acquired via " + m.getName()
|
||||
+ java.util.Arrays.toString(types) + " slots=" + combo[0] + "/" + combo[1]);
|
||||
return provider;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Throwable root = t instanceof java.lang.reflect.InvocationTargetException
|
||||
&& t.getCause() != null ? t.getCause() : t;
|
||||
Log.w(TAG, "androidSettingsPutString: " + m.getName() + " slots=" + combo[0]
|
||||
Log.w(TAG, "putString: " + m.getName() + " slots=" + combo[0]
|
||||
+ "/" + combo[1] + " failed: " + root);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ public class ForegroundAppUtil {
|
||||
|
||||
public static void setTopAppClass(Context context, String pkg) {
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
boolean always_top_packagename = Settings.System.putString(context.getContentResolver(), "always_top_packagename", "Invalid");
|
||||
boolean always_top_classname = Settings.System.putString(context.getContentResolver(), "always_top_classname", "Invalid");
|
||||
boolean always_top_packagename = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "always_top_packagename", "Invalid");
|
||||
boolean always_top_classname = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "always_top_classname", "Invalid");
|
||||
Log.e(TAG, "setTopAppClass: always_top_packagename = " + always_top_packagename);
|
||||
Log.e(TAG, "setTopAppClass: always_top_classname = " + always_top_classname);
|
||||
} else {
|
||||
@@ -67,8 +67,8 @@ public class ForegroundAppUtil {
|
||||
}
|
||||
|
||||
public static void setTopAppClass(Context context, String pkg, String ClassName) {
|
||||
boolean always_top_packagename = Settings.System.putString(context.getContentResolver(), "always_top_packagename", pkg);
|
||||
boolean always_top_classname = Settings.System.putString(context.getContentResolver(), "always_top_classname", ClassName);
|
||||
boolean always_top_packagename = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "always_top_packagename", pkg);
|
||||
boolean always_top_classname = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "always_top_classname", ClassName);
|
||||
Log.e(TAG, "setTopAppClass: always_top_packagename = " + always_top_packagename);
|
||||
Log.e(TAG, "setTopAppClass: always_top_classname = " + always_top_classname);
|
||||
ApkUtils.openPackage(context, pkg);
|
||||
|
||||
@@ -644,11 +644,11 @@ public class JgyUtils {
|
||||
|
||||
if (disallowSlide.size() != 0) {
|
||||
String slide_not = String.join(",", disallowSlide);
|
||||
boolean writeSucceed = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, slide_not);
|
||||
boolean writeSucceed = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, slide_not);
|
||||
Log.e("setNetAndlaunch", "aole_disable_slide=" + writeSucceed + ":" + slide_not);
|
||||
} else {
|
||||
String slide_ok = String.join(",", allowSlide);
|
||||
boolean writeSucceed = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
boolean writeSucceed = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
Log.e("setNetAndlaunch", "aole_disable_slide ok=" + writeSucceed + ":" + slide_ok);
|
||||
}
|
||||
|
||||
@@ -664,10 +664,10 @@ public class JgyUtils {
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + aole_app_power_on);
|
||||
if (TextUtils.isEmpty(aole_app_power_on)) {
|
||||
//当 aole_app_power_on 的值为空时,会造成系统所有应用断网
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + "Invalid");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON, aole_app_power_on);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, aole_app_power_on);
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + aole_app_power_on);
|
||||
}
|
||||
// if (BuildConfig.DEBUG) {
|
||||
@@ -704,11 +704,11 @@ public class JgyUtils {
|
||||
|
||||
if (disallowSlide.size() != 0) {
|
||||
String slide_not = String.join(",", disallowSlide);
|
||||
boolean writeSucceed = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, slide_not);
|
||||
boolean writeSucceed = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, slide_not);
|
||||
Log.e("setNetAndlaunch", "aole_disable_slide=" + writeSucceed + ":" + slide_not);
|
||||
} else {
|
||||
String slide_ok = String.join(",", allowSlide);
|
||||
boolean writeSucceed = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
boolean writeSucceed = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISABLE_SLIDE, "Invalid");
|
||||
Log.e("setNetAndlaunch", "aole_disable_slide ok=" + writeSucceed + ":" + slide_ok);
|
||||
}
|
||||
|
||||
@@ -723,10 +723,10 @@ public class JgyUtils {
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + aole_app_power_on);
|
||||
if (TextUtils.isEmpty(aole_app_power_on)) {
|
||||
//当 qch_app_power_on 的值为空时,会造成系统所有应用断网
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, "Invalid");
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + "Invalid");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON, aole_app_power_on);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_POWER_ON, aole_app_power_on);
|
||||
Log.e(TAG, "setNetAndlaunch: aole_app_power_on: " + aole_app_power_on);
|
||||
}
|
||||
// if (BuildConfig.DEBUG) {
|
||||
@@ -757,11 +757,11 @@ public class JgyUtils {
|
||||
public void setAppSourceInstallWhiteList(HashSet<String> allowInstallApp) {
|
||||
if (allowInstallApp == null || allowInstallApp.isEmpty()) {
|
||||
Log.e(TAG, "setAppSourceInstallWhiteList: allowInstallApp size = 0");
|
||||
Settings.System.putString(crv, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", DEFAULT_APP_SOURCE_WHITE_LIST));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", DEFAULT_APP_SOURCE_WHITE_LIST));
|
||||
} else {
|
||||
allowInstallApp.addAll(DEFAULT_APP_SOURCE_WHITE_LIST);
|
||||
List<String> allowList = new ArrayList<>(allowInstallApp);
|
||||
Settings.System.putString(crv, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", allowList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST, String.join(",", allowList));
|
||||
}
|
||||
Log.e(TAG, "setAppSourceInstallWhiteList: getString = " + Settings.System.getString(crv, CommonConfig.SEEWO_APP_SOURCE_INSTALL_WHITELIST));
|
||||
}
|
||||
@@ -830,9 +830,9 @@ public class JgyUtils {
|
||||
private void setDisallowNotificationPackage(Context context, HashSet<String> pkgSet) {
|
||||
Log.e(TAG, "setDisallowNotificationPackage: " + pkgSet);
|
||||
if (pkgSet.size() == 0) {
|
||||
Settings.System.putString(context.getContentResolver(), "aole_app_info", "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_info", "");
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), "aole_app_info", String.join(",", pkgSet));
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_info", String.join(",", pkgSet));
|
||||
}
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDisallowNotification(new ArrayList<>(pkgSet));
|
||||
@@ -845,9 +845,9 @@ public class JgyUtils {
|
||||
Set<String> pkgSet = privilegeApp.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toSet());
|
||||
Log.e(TAG, "setAllowPermissionsPackage: " + pkgSet);
|
||||
if (pkgSet.size() == 0) {
|
||||
Settings.System.putString(crv, "aole_app_privilege", "");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_privilege", "");
|
||||
} else {
|
||||
Settings.System.putString(crv, "aole_app_privilege", String.join(",", pkgSet));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_privilege", String.join(",", pkgSet));
|
||||
}
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDefaultPermissions(new ArrayList<>(pkgSet));
|
||||
@@ -954,10 +954,10 @@ public class JgyUtils {
|
||||
whiteAppSet.addAll(ApkUtils.aoleyunAPP);
|
||||
Set<String> filter = whiteAppSet.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toSet());
|
||||
Log.e(TAG, "setAppNetwork: filter = " + filter);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filter));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filter));
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system aole_network_allow");
|
||||
Log.e(TAG, "setAppNetwork: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -968,10 +968,10 @@ public class JgyUtils {
|
||||
|
||||
if (!MTK11Tag.equals(getAppPlatform())) {
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, null);
|
||||
} else {
|
||||
String net_not = String.join(",", blackList);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: " + net_not);
|
||||
}
|
||||
}
|
||||
@@ -999,13 +999,13 @@ public class JgyUtils {
|
||||
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
} else {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
filterList.add("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
filterList.remove("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,10 +1027,10 @@ public class JgyUtils {
|
||||
whiteAppSet.addAll(ApkUtils.aoleyunAPP);
|
||||
Set<String> filter = whiteAppSet.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toSet());
|
||||
Log.e(TAG, "setAppNetwork: filter = " + filter);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filter));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filter));
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system aole_network_allow");
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -1043,7 +1043,7 @@ public class JgyUtils {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_black_list");
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -1059,7 +1059,7 @@ public class JgyUtils {
|
||||
Log.e(TAG, "updateNetworkWhiteList: MT8768 Ebox201w");
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_white_list");
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
@@ -1084,13 +1084,13 @@ public class JgyUtils {
|
||||
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL) || "G128A".equals(Build.MODEL)) {
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
} else {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
filterList.add("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
filterList.remove("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,7 +1129,7 @@ public class JgyUtils {
|
||||
}
|
||||
if (appIDList == null || appIDList.isEmpty()) {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, null);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.APP_VIEW_CLICK_DISABLED, null);
|
||||
// TODO: 2024/9/11 修复1.4.0907版本数据为空系统报错
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled");
|
||||
Log.e(TAG, "writeDeselectIDtoSystem: " + result);
|
||||
@@ -1144,7 +1144,7 @@ public class JgyUtils {
|
||||
}
|
||||
}).collect(Collectors.joining(";"));
|
||||
Log.e(TAG, "writeDeselectIDtoSystem: " + s);
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, s);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.APP_VIEW_CLICK_DISABLED, s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1646,7 +1646,7 @@ public class JgyUtils {
|
||||
boolean b = androidSettingsPutString(mContext, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
|
||||
Log.e("writeAppPackageList: ", "aole_app_forbid: " + b + " " + Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "writeAppPackageList: Settings.System.putString failed", e);
|
||||
Log.e(TAG, "writeAppPackageList: AndroidSettingsWriter.putString failed", e);
|
||||
}
|
||||
setAppRestriction(2);
|
||||
addAppInstallWhiteList(new ArrayList<>(pkgSet));
|
||||
@@ -1675,7 +1675,7 @@ public class JgyUtils {
|
||||
try {
|
||||
androidSettingsPutString(mContext, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "writeAppPackageList: Settings.System.putString failed", e);
|
||||
Log.e(TAG, "writeAppPackageList: AndroidSettingsWriter.putString failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2277,20 +2277,20 @@ public class JgyUtils {
|
||||
if (MT8768Tag.equalsIgnoreCase(BuildConfig.platform)
|
||||
|| G128T_TAG.equalsIgnoreCase(BuildConfig.platform)
|
||||
) {
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
} else {
|
||||
//这个需要反着来
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
|
||||
}
|
||||
|
||||
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
|
||||
// if (!BuildConfig.DEBUG) {
|
||||
if (Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != state) {
|
||||
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
|
||||
}
|
||||
if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) {
|
||||
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, Settings.Global.ADB_ENABLED, state);
|
||||
}
|
||||
// }
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
@@ -3748,7 +3748,7 @@ public class JgyUtils {
|
||||
public void setTongyiAppTop() {
|
||||
if (ApkUtils.isAvailable(mContext, "com.tongyi.aistudent")) {
|
||||
ForegroundAppUtil.setTopAppClass(mContext, "com.tongyi.aistudent");
|
||||
Settings.Global.putString(crv, ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL, ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
|
||||
ForegroundAppUtil.openTopApp(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class SysSettingUtils {
|
||||
setSettingsMenuShow(context);
|
||||
setEyeProtectionModeEntrance(context, 1);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.DX11Platform) {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,17 +235,17 @@ public class SysSettingUtils {
|
||||
private static void setPhoneList(Context context, int state) {
|
||||
try {
|
||||
//设置电话功能,电话白名单
|
||||
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", state);
|
||||
boolean qch_call_forbid = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_call_forbid", state);
|
||||
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
|
||||
|
||||
boolean aole_white_list_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ON, state);
|
||||
boolean aole_white_list_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_WHITE_LIST_ON, state);
|
||||
Log.e(TAG, "aole_white_list_on:" + aole_white_list_on);
|
||||
|
||||
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "");
|
||||
boolean aole_white_list_Array = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
|
||||
boolean aole_sdcard_forbid_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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());
|
||||
@@ -257,20 +257,20 @@ public class SysSettingUtils {
|
||||
//设置电话功能,电话白名单
|
||||
//电话通话开关
|
||||
int setting_call = changeNum(jsonObject.get("setting_call").getAsInt());
|
||||
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", setting_call);
|
||||
boolean qch_call_forbid = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_call_forbid", setting_call);
|
||||
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
|
||||
//电话白名单开关
|
||||
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);
|
||||
boolean aole_white_list_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_WHITE_LIST_ON, setting_phone);
|
||||
Log.e(TAG, "aole_white_list_on:" + aole_white_list_on);
|
||||
//白名单列表
|
||||
if (setting_phone == 1) {
|
||||
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "empty");
|
||||
boolean aole_white_list_Array = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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.get("setting_phones").getAsString();
|
||||
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
|
||||
boolean aole_white_list_Array = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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);
|
||||
}
|
||||
@@ -304,10 +304,10 @@ public class SysSettingUtils {
|
||||
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
|
||||
boolean aole_usb_choose = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_usb_choose", "usb_charge");
|
||||
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
|
||||
} else {
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_mtp");
|
||||
boolean aole_usb_choose = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_usb_choose", "usb_mtp");
|
||||
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
|
||||
}
|
||||
String usbStatus;
|
||||
@@ -378,7 +378,7 @@ public class SysSettingUtils {
|
||||
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
|
||||
boolean aole_usb_choose = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_usb_choose", setting_usb);
|
||||
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
|
||||
String usbStatus;
|
||||
switch (setting_usb) {
|
||||
@@ -421,7 +421,7 @@ public class SysSettingUtils {
|
||||
Log.e(TAG, "setBluetoothTransmission: setting_bluetooth = " + state);
|
||||
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
|
||||
if (old_setting_bluetooth != state) {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetoothTransmission: setting_bluetooth no changed");
|
||||
}
|
||||
@@ -445,13 +445,13 @@ public class SysSettingUtils {
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter.disable();
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bht no changed");
|
||||
}
|
||||
|
||||
if (old_setting_bluetooth != state) {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
|
||||
}
|
||||
@@ -459,7 +459,7 @@ public class SysSettingUtils {
|
||||
if (old_setting_bhtvideo != state) {
|
||||
mmkv.encode(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, state);
|
||||
if (state == 1) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
|
||||
@@ -470,7 +470,7 @@ public class SysSettingUtils {
|
||||
AllwinnerCubeMdmManager.getInstance().setBluetoothEnable(state == 0);
|
||||
}
|
||||
// TODO: 2026/10/14 默认不管控
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_RENAME_ALLOW, 1);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_RENAME_ALLOW, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -494,19 +494,19 @@ public class SysSettingUtils {
|
||||
int setting_bluetooth_type = changeNum(getNum(jsonObject, "setting_bluetooth_type", 1));
|
||||
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, "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
|
||||
} else {
|
||||
String bluetooth_type_control = getStr(jsonObject, "bluetooth_type_control", "");
|
||||
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, "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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, "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
|
||||
} else {
|
||||
List<String> typeList = new ArrayList<>();
|
||||
if (bluetoothType.getHeadset() == 1) {
|
||||
@@ -524,7 +524,7 @@ public class SysSettingUtils {
|
||||
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));
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, String.join(",", typeList));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,13 +542,13 @@ public class SysSettingUtils {
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter.disable();
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bht no changed");
|
||||
}
|
||||
|
||||
if (old_setting_bluetooth != setting_bluetooth) {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
|
||||
}
|
||||
@@ -559,12 +559,12 @@ public class SysSettingUtils {
|
||||
String setting_context = getStr(jsonObject, "setting_context", "");
|
||||
if (!TextUtils.isEmpty(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
|
||||
Log.e(TAG, "setting_context:" + setting_context);
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
|
||||
@@ -576,7 +576,7 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
int bt_rename = getNum(jsonObject, "bluetooth_name_change", 1);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_RENAME_ALLOW, bt_rename);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_BT_RENAME_ALLOW, bt_rename);
|
||||
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ public class SysSettingUtils {
|
||||
intent.setAction("qch_hotspot_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
context.sendStickyBroadcast(intent);
|
||||
boolean aole_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, state);
|
||||
boolean aole_hotspot_forbid_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, state);
|
||||
Log.e(TAG, "aole_hotspot_forbid_on:" + aole_hotspot_forbid_on);
|
||||
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
@@ -611,7 +611,7 @@ public class SysSettingUtils {
|
||||
intent.setPackage("com.android.settings");
|
||||
context.sendStickyBroadcast(intent);
|
||||
}
|
||||
boolean aole_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HOTSPOT_FORBID_ON, setting_hotspot);
|
||||
boolean aole_hotspot_forbid_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, 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);
|
||||
|
||||
@@ -627,7 +627,7 @@ public class SysSettingUtils {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = 0;
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_NavigationBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
boolean aole_hide_NavigationBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
|
||||
|
||||
String navigationStatus = "";
|
||||
@@ -653,7 +653,7 @@ public class SysSettingUtils {
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
boolean aole_hide_statusBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
switch (setting_statusbar) {
|
||||
@@ -676,7 +676,7 @@ public class SysSettingUtils {
|
||||
int setting_navigation = changeNum(jsonObject.get("setting_navigation").getAsInt());
|
||||
Log.e(TAG, "setBar: setting_navigation = " + setting_navigation);
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_NavigationBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
boolean aole_hide_NavigationBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
|
||||
|
||||
String navigationStatus = "";
|
||||
@@ -707,7 +707,7 @@ public class SysSettingUtils {
|
||||
// int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
// if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
boolean aole_hide_statusBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
|
||||
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
switch (setting_statusbar) {
|
||||
@@ -732,7 +732,7 @@ public class SysSettingUtils {
|
||||
public static void setCamera(Context context, int state) {
|
||||
try {
|
||||
//摄像头开关
|
||||
boolean qch_app_camera = Settings.System.putInt(context.getContentResolver(), "qch_app_camera", state);
|
||||
boolean qch_app_camera = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_camera", state);
|
||||
Log.e(TAG, "qch_app_camera1:" + state);
|
||||
// ApkUtils.hideSystemSettingAPP(context, "com.mediatek.camera");
|
||||
Log.e(TAG, "setting_camera---------" + qch_app_camera);
|
||||
@@ -756,7 +756,7 @@ public class SysSettingUtils {
|
||||
try {
|
||||
//摄像头开关
|
||||
int setting_camera = changeNum(jsonObject.get("setting_camera").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_camera", setting_camera);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_camera", setting_camera);
|
||||
Log.e(TAG, "qch_app_camera2:" + setting_camera);
|
||||
// ApkUtils.hideSystemSettingAPP(context, "com.mediatek.camera");
|
||||
Log.e(TAG, "setting_camera---------" + setting_camera);
|
||||
@@ -788,13 +788,13 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
JgyUtils.getInstance().setSDOTGEnable(state == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
|
||||
boolean aole_sdcard_forbid_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
|
||||
try {
|
||||
//tfmedia开关
|
||||
// int setting_tfmedia = 1;
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
|
||||
boolean qch_tfmedia_forbid = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_forbid", state);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (state) {
|
||||
@@ -808,10 +808,10 @@ public class SysSettingUtils {
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (state == 1) {
|
||||
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
|
||||
boolean qch_tfmedia_filetypes = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_filetypes", "Empty");//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
@@ -831,7 +831,7 @@ public class SysSettingUtils {
|
||||
|
||||
Log.e(TAG, "setTF: setting_memory = " + setting_memory);
|
||||
JgyUtils.getInstance().setSDOTGEnable(setting_memory == 0);
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
boolean aole_sdcard_forbid_on = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
|
||||
|
||||
try {
|
||||
@@ -839,7 +839,7 @@ public class SysSettingUtils {
|
||||
// if (JgyUtils.isOfficialVersion() ) {
|
||||
// setting_tfmedia = changeNum(setting_tfmedia);
|
||||
// }
|
||||
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
|
||||
boolean qch_tfmedia_forbid = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_forbid", setting_tfmedia);
|
||||
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||
String tfmediaStatus = "";
|
||||
switch (setting_tfmedia) {
|
||||
@@ -863,10 +863,10 @@ public class SysSettingUtils {
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||
Log.e(TAG, "qch_tfmedia_filetypes---------" + stringBuffer.toString());
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_tfmedia_forbid", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setTF: " + e.getMessage());
|
||||
@@ -888,13 +888,13 @@ public class SysSettingUtils {
|
||||
private static void setWallpaper(Context context, int state) {
|
||||
//壁纸
|
||||
// int wallpaper = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_wallpaper", state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_wallpaper", state);
|
||||
Log.e(TAG, "qch_app_wallpaper" + state);
|
||||
}
|
||||
|
||||
public static void setCanReset(Context context, int state) {
|
||||
Log.e(TAG, "setCanReset: state = " + state);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, state);
|
||||
//默认打开
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setResetFactoryEnable(state == 0);
|
||||
@@ -911,9 +911,9 @@ public class SysSettingUtils {
|
||||
int mode = jsonObject.get("qch_restore").getAsInt();
|
||||
Log.e(TAG, "setCanReset: mode = " + mode);
|
||||
if (mode == 1) {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
|
||||
}
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setResetFactoryEnable(mode == 1);
|
||||
@@ -1034,18 +1034,18 @@ public class SysSettingUtils {
|
||||
if (jsonObject.get("is_browser_network") != null) {
|
||||
int is_browser_network = jsonObject.get("is_browser_network").getAsInt();
|
||||
Log.e(TAG, "setBrowserInput: is_browser_network = " + is_browser_network);
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_browser_network", is_browser_network);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "is_browser_network", is_browser_network);
|
||||
}
|
||||
|
||||
if (jsonObject.get("setting_browserInput") != null) {
|
||||
int qch_Browser_input = jsonObject.get("setting_browserInput").getAsInt();
|
||||
Log.e(TAG, "setBrowserInput: qch_Browser_input = " + qch_Browser_input);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", qch_Browser_input);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_Browser_input", qch_Browser_input);
|
||||
}
|
||||
|
||||
if (jsonObject.get("browser_down") != null) {
|
||||
int browser_down = jsonObject.get("browser_down").getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "aoleyun_browser_down", browser_down);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aoleyun_browser_down", browser_down);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,9 +1056,9 @@ public class SysSettingUtils {
|
||||
* @param state
|
||||
*/
|
||||
private static void setBrowserInput(Context context, int state) {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_Browser_input", state);
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_browser_network", state);
|
||||
Settings.System.putInt(context.getContentResolver(), "aoleyun_browser_down", state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_Browser_input", state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "is_browser_network", state);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aoleyun_browser_down", state);
|
||||
}
|
||||
|
||||
private static void setAdminApp(Context context, JsonObject jsonObject) {
|
||||
@@ -1066,12 +1066,12 @@ public class SysSettingUtils {
|
||||
if (appInstall != null) {
|
||||
int is_app_install = appInstall.getAsInt();
|
||||
Log.e(TAG, "setAdminApp: is_app_install = " + is_app_install);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, is_app_install);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_ALLOW_INSTALL, is_app_install);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setInstallPackageEnable(is_app_install == 1);
|
||||
}
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1079,16 +1079,16 @@ public class SysSettingUtils {
|
||||
if (adminApp != null) {
|
||||
int is_admin_app = adminApp.getAsInt();
|
||||
Log.e(TAG, "setAdminApp: is_admin_app = " + is_admin_app);
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", is_admin_app);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "is_admin_app", is_admin_app);
|
||||
} else {
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "is_admin_app", 0);
|
||||
}
|
||||
JsonElement appCategory = jsonObject.get("admin_app_category");
|
||||
if (appCategory != null && !appCategory.isJsonNull()) {
|
||||
String admin_app_category = appCategory.getAsString();
|
||||
Settings.Global.putString(context.getContentResolver(), "admin_app_category", admin_app_category);
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "admin_app_category", admin_app_category);
|
||||
} else {
|
||||
Settings.Global.putString(context.getContentResolver(), "admin_app_category", "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "admin_app_category", "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1102,58 +1102,58 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setInstallPackageEnable(state == 0);
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, changeNum(state));
|
||||
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", changeNum(state));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_APP_ALLOW_INSTALL, changeNum(state));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_GLOBAL, "is_admin_app", changeNum(state));
|
||||
}
|
||||
|
||||
private static void setSystemAppDisable(Context context, JsonObject jsonObject) {
|
||||
JsonElement pictureCategory = jsonObject.get("setting_picture");
|
||||
if (pictureCategory != null && !pictureCategory.isJsonNull()) {
|
||||
int setting_picture = pictureCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", changeNum(setting_picture));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_gallery", changeNum(setting_picture));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_gallery", 0);
|
||||
}
|
||||
|
||||
JsonElement fileCategory = jsonObject.get("setting_file");
|
||||
if (fileCategory != null && !fileCategory.isJsonNull()) {
|
||||
int setting_file = fileCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", changeNum(setting_file));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_filemanager", changeNum(setting_file));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_filemanager", 0);
|
||||
}
|
||||
|
||||
|
||||
JsonElement clockCategory = jsonObject.get("setting_clock");
|
||||
if (clockCategory != null && !clockCategory.isJsonNull()) {
|
||||
int setting_clock = clockCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", changeNum(setting_clock));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_deskclock", changeNum(setting_clock));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_deskclock", 0);
|
||||
}
|
||||
|
||||
JsonElement musicCategory = jsonObject.get("setting_music");
|
||||
if (musicCategory != null && !musicCategory.isJsonNull()) {
|
||||
int setting_music = musicCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", changeNum(setting_music));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_music", changeNum(setting_music));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_music", 0);
|
||||
}
|
||||
|
||||
JsonElement recordCategory = jsonObject.get("setting_recording");
|
||||
if (recordCategory != null && !recordCategory.isJsonNull()) {
|
||||
int setting_recording = recordCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", changeNum(setting_recording));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_soundrecorder", changeNum(setting_recording));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_soundrecorder", 0);
|
||||
}
|
||||
|
||||
JsonElement browserCategory = jsonObject.get("setting_browser");
|
||||
if (browserCategory != null && !browserCategory.isJsonNull()) {
|
||||
int setting_browser = browserCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", changeNum(setting_browser));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_browser", changeNum(setting_browser));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_browser", 0);
|
||||
}
|
||||
|
||||
Intent intent = new Intent("BrowserInternetControlKey");
|
||||
@@ -1164,17 +1164,17 @@ public class SysSettingUtils {
|
||||
JsonElement smsCategory = jsonObject.get("setting_sms");
|
||||
if (smsCategory != null && !smsCategory.isJsonNull()) {
|
||||
int setting_sms = smsCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", changeNum(setting_sms));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_sms", changeNum(setting_sms));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_sms", 0);
|
||||
}
|
||||
|
||||
JsonElement calcCategory = jsonObject.get("calculator_control");
|
||||
if (calcCategory != null && !calcCategory.isJsonNull()) {
|
||||
int calculator_control = calcCategory.getAsInt();
|
||||
Settings.System.putInt(context.getContentResolver(), "aole_app_calculator", changeNum(calculator_control));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_calculator", changeNum(calculator_control));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "aole_app_calculator", 0);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_calculator", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1183,14 +1183,14 @@ public class SysSettingUtils {
|
||||
* @param status 0打开 1关闭
|
||||
*/
|
||||
private static void setSystemAppDisable(Context context, int status) {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", status);
|
||||
Settings.System.putInt(context.getContentResolver(), "aole_app_calculator", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_gallery", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_filemanager", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_deskclock", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_music", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_soundrecorder", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_browser", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_app_sms", status);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_app_calculator", status);
|
||||
}
|
||||
|
||||
public static void setSnSetting(Context context, SnSetting snSetting) {
|
||||
@@ -1212,7 +1212,7 @@ public class SysSettingUtils {
|
||||
}
|
||||
int is_storeinstall = snSetting.getIs_storeinstall();
|
||||
// TODO: 2024/10/12 待更换为 AOLEYUN_APPSTORE_INSTALL
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLEYUN_APPSTORE_INSTALL, is_storeinstall);
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLEYUN_APPSTORE_INSTALL, is_storeinstall);
|
||||
int is_usb = snSetting.getIs_usb();
|
||||
setUsb(context, is_usb);
|
||||
int is_bluetooth_file = snSetting.getIs_bluetooth_file();
|
||||
@@ -1250,7 +1250,7 @@ public class SysSettingUtils {
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != status) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, status);
|
||||
boolean aole_hide_statusBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, status);
|
||||
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
switch (status) {
|
||||
@@ -1270,7 +1270,7 @@ public class SysSettingUtils {
|
||||
|
||||
private static void setNavigationBar(Context context, int status) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_NavigationBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, status);
|
||||
boolean aole_hide_NavigationBar = AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, status);
|
||||
Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
|
||||
|
||||
String navigationStatus = "";
|
||||
@@ -1395,7 +1395,7 @@ public class SysSettingUtils {
|
||||
if (jsonElement != null && !jsonElement.isJsonNull()) {
|
||||
int camera_ctrl = jsonElement.getAsInt();
|
||||
Log.e("setDisAllowCamera", "setDisAllowCamera: " + camera_ctrl);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DISALLOW_CAMERA, changeNum(camera_ctrl));
|
||||
AndroidSettingsWriter.putInt(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DISALLOW_CAMERA, changeNum(camera_ctrl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1505,11 +1505,11 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
Log.e(TAG, "setSettingsMenuShow: " + menus);
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, String.join(",", menus));
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_SETTINGS_DISALLOW, String.join(",", menus));
|
||||
}
|
||||
|
||||
private static void setSettingsMenuShow(Context context) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, "");
|
||||
AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_SETTINGS_DISALLOW, "");
|
||||
}
|
||||
|
||||
private static void setEyeProtectionModeEntrance(Context context, JsonObject jsonObject) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class URLUtils {
|
||||
String oldWhiteIP = mMMKV.decodeString("white_ip", "");
|
||||
if (TextUtils.isEmpty(oldwhiteList) && TextUtils.isEmpty(oldWhiteIP)) {
|
||||
Log.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is empty");
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", "Invalid");
|
||||
} else {
|
||||
String white_ip = mMMKV.decodeString("white_ip", "");
|
||||
if (!TextUtils.isEmpty(white_ip)) {
|
||||
@@ -68,7 +68,7 @@ public class URLUtils {
|
||||
URLList.removeIf(TextUtils::isEmpty);
|
||||
if (URLList.size() == 0 && whiteIPList.size() == 0) {
|
||||
Log.e(TAG, "setBrowserWhiteList: URLList set is empty , set Invalid");
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", "Invalid");
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "setBrowserWhiteList: " + URLList);
|
||||
@@ -118,7 +118,7 @@ public class URLUtils {
|
||||
}
|
||||
//临时
|
||||
if (baseURLList.size() != 0) {
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", String.join(",", baseURLList));
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", String.join(",", baseURLList));
|
||||
}
|
||||
Log.e(TAG, "subscribe: baseURLList: " + baseURLList);
|
||||
Log.e(TAG, "subscribe: DeselectBrowserArray: " + Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray"));
|
||||
@@ -210,7 +210,7 @@ public class URLUtils {
|
||||
baseURLList.removeIf(TextUtils::isEmpty);
|
||||
String DeselectBrowserArray = String.join(",", baseURLList);
|
||||
Log.e(TAG, "onComplete: " + "white list: " + DeselectBrowserArray);
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", DeselectBrowserArray);
|
||||
boolean write = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "DeselectBrowserArray", DeselectBrowserArray);
|
||||
Log.i(TAG, "onComplete: " + "write :" + write + " time = " + (System.currentTimeMillis() - time1));
|
||||
}
|
||||
});
|
||||
@@ -224,7 +224,7 @@ public class URLUtils {
|
||||
String qch_webblack_url = Settings.System.getString(mContext.getContentResolver(), "qch_webblack_url");
|
||||
Log.e(TAG, "setBrowserBlackList: qch_webblack_url = " + qch_webblack_url);
|
||||
if (TextUtils.isEmpty(qch_webblack_url)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", "Invalid");
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_webblack_url", "Invalid");
|
||||
} else {
|
||||
String black_ip = mMMKV.decodeString("black_ip", "");
|
||||
if (!TextUtils.isEmpty(black_ip)) {
|
||||
@@ -251,7 +251,7 @@ public class URLUtils {
|
||||
blackList.addAll(blackIPList);
|
||||
blackList.removeIf(TextUtils::isEmpty);
|
||||
Log.e(TAG, "setBrowserBlackList: blackList: " + blackList);
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", String.join(",", blackList));
|
||||
boolean write = AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, "qch_webblack_url", String.join(",", blackList));
|
||||
Log.e(TAG, "setBrowserBlackList: write: " + write);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,10 +1139,10 @@ public class Utils {
|
||||
}
|
||||
list = list.substring(0, list.length() - 1);
|
||||
Log.e("fht", list);
|
||||
writeSucceed = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, list);
|
||||
writeSucceed = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_FORBID, list);
|
||||
Log.e("fht", "aole_app_forbid:" + list);
|
||||
} else {
|
||||
writeSucceed = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
writeSucceed = AndroidSettingsWriter.putString(context, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_APP_FORBID, "");
|
||||
}
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user