|
|
|
|
@@ -39,6 +39,14 @@ import androidx.core.content.ContextCompat;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.aoleyun.sn.BuildConfig;
|
|
|
|
|
import com.aoleyun.sn.bean.AppListInfo;
|
|
|
|
|
import com.aoleyun.sn.bean.Appground;
|
|
|
|
|
import com.aoleyun.sn.bean.BaseResponse;
|
|
|
|
|
import com.aoleyun.sn.bean.ForceDownloadData;
|
|
|
|
|
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
|
|
|
|
import com.aoleyun.sn.bean.NetAndLaunchData;
|
|
|
|
|
import com.aoleyun.sn.bean.TTAppground;
|
|
|
|
|
import com.aoleyun.sn.comm.CommonConfig;
|
|
|
|
|
import com.aoleyun.sn.comm.JGYActions;
|
|
|
|
|
import com.aoleyun.sn.comm.PackageNames;
|
|
|
|
|
@@ -46,6 +54,10 @@ import com.aoleyun.sn.disklrucache.CacheHelper;
|
|
|
|
|
import com.aoleyun.sn.network.NetInterfaceManager;
|
|
|
|
|
import com.aoleyun.sn.network.UrlAddress;
|
|
|
|
|
import com.aoleyun.sn.receiver.BootReceiver;
|
|
|
|
|
import com.aoleyun.sn.service.GuardService;
|
|
|
|
|
import com.aoleyun.sn.service.LogcatService;
|
|
|
|
|
import com.aoleyun.sn.service.StepService;
|
|
|
|
|
import com.aoleyun.sn.service.main.MainService;
|
|
|
|
|
import com.blankj.utilcode.util.FileUtils;
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
|
@@ -56,18 +68,6 @@ import com.google.zxing.WriterException;
|
|
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
|
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
|
|
|
|
import com.aoleyun.sn.BuildConfig;
|
|
|
|
|
import com.aoleyun.sn.bean.AppListInfo;
|
|
|
|
|
import com.aoleyun.sn.bean.Appground;
|
|
|
|
|
import com.aoleyun.sn.bean.BaseResponse;
|
|
|
|
|
import com.aoleyun.sn.bean.ForceDownloadData;
|
|
|
|
|
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
|
|
|
|
import com.aoleyun.sn.bean.NetAndLaunchData;
|
|
|
|
|
import com.aoleyun.sn.bean.TTAppground;
|
|
|
|
|
import com.aoleyun.sn.service.GuardService;
|
|
|
|
|
import com.aoleyun.sn.service.LogcatService;
|
|
|
|
|
import com.aoleyun.sn.service.main.MainService;
|
|
|
|
|
import com.aoleyun.sn.service.StepService;
|
|
|
|
|
import com.tencent.mmkv.MMKV;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
@@ -94,14 +94,11 @@ import java.util.HashSet;
|
|
|
|
|
import java.util.LinkedHashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -385,20 +382,20 @@ public class JGYUtils {
|
|
|
|
|
int is_network = netAndLaunchData.getIs_network();
|
|
|
|
|
int is_upgrade = netAndLaunchData.getIs_upgrade();
|
|
|
|
|
int is_slide = netAndLaunchData.getIs_slide();
|
|
|
|
|
if (is_auto == 0) {
|
|
|
|
|
if (is_auto == 1) {
|
|
|
|
|
autoLaunchApp.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_network == 0) {
|
|
|
|
|
if (is_network == 1) {
|
|
|
|
|
allowNetApp.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowNetApp.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_upgrade == 0) {
|
|
|
|
|
if (is_upgrade == 1) {
|
|
|
|
|
allowUpgrade.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowUpgrade.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_slide == 0) {
|
|
|
|
|
if (is_slide == 1) {
|
|
|
|
|
allowSlide.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowSlide.add(app_package);
|
|
|
|
|
@@ -436,7 +433,7 @@ public class JGYUtils {
|
|
|
|
|
// boolean w = Settings.System.putString(crv, "aole_app_power_on", "");
|
|
|
|
|
// Log.e(TAG, "setNetAndlaunch: 测试写入: " + w);
|
|
|
|
|
// }
|
|
|
|
|
setAppNetwork(mContext, disallowNetApp);
|
|
|
|
|
setAppNetwork(mContext, disallowNetApp, allowNetApp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onBootOpenApp() {
|
|
|
|
|
@@ -515,20 +512,20 @@ public class JGYUtils {
|
|
|
|
|
int is_upgrade = netAndLaunchData.getIs_upgrade();
|
|
|
|
|
int is_slide = netAndLaunchData.getIs_slide();
|
|
|
|
|
|
|
|
|
|
if (is_auto == 0) {
|
|
|
|
|
if (is_auto == 1) {
|
|
|
|
|
autoLaunchApp.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_network == 0) {
|
|
|
|
|
if (is_network == 1) {
|
|
|
|
|
allowNetApp.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowNetApp.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_upgrade == 0) {
|
|
|
|
|
if (is_upgrade == 1) {
|
|
|
|
|
allowUpgrade.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowUpgrade.add(app_package);
|
|
|
|
|
}
|
|
|
|
|
if (is_slide == 0) {
|
|
|
|
|
if (is_slide == 1) {
|
|
|
|
|
allowSlide.add(app_package);
|
|
|
|
|
} else {
|
|
|
|
|
disallowSlide.add(app_package);
|
|
|
|
|
@@ -565,11 +562,11 @@ public class JGYUtils {
|
|
|
|
|
// boolean w = Settings.System.putString(crv, "aole_app_power_on", "");
|
|
|
|
|
// Log.e(TAG, "setNetAndlaunch: 测试写入: " + w);
|
|
|
|
|
// }
|
|
|
|
|
setAppNetwork(mContext, disallowNetApp);
|
|
|
|
|
setAppNetwork(mContext, disallowNetApp, allowNetApp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
|
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList) {
|
|
|
|
|
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList, HashSet<String> whiteList) {
|
|
|
|
|
ContentResolver contentResolver = context.getContentResolver();
|
|
|
|
|
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
|
|
|
|
|
// String dis = Settings.System.getString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
|
|
|
|
@@ -646,11 +643,25 @@ public class JGYUtils {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
String net_not = String.join(",", blackList);
|
|
|
|
|
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
|
|
|
|
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
|
|
|
|
Log.e(TAG, "setAppNetwork: " + net_not);
|
|
|
|
|
if (blackList == null || blackList.size() == 0) {
|
|
|
|
|
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
|
|
|
|
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
|
|
|
|
} else {
|
|
|
|
|
String net_not = String.join(",", blackList);
|
|
|
|
|
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
|
|
|
|
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
|
|
|
|
Log.e(TAG, "setAppNetwork: " + net_not);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (whiteList == null || whiteList.size() == 0) {
|
|
|
|
|
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
|
|
|
|
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
|
|
|
|
} else {
|
|
|
|
|
String net_not = String.join(",", whiteList);
|
|
|
|
|
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, net_not);
|
|
|
|
|
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, net_not);
|
|
|
|
|
Log.e(TAG, "setAppNetwork: " + net_not);
|
|
|
|
|
}
|
|
|
|
|
//Intent netControlIntent = new Intent(CommonDatas.ACTION_HrReceiver_JGY_DIS);
|
|
|
|
|
//netControlIntent.putExtra("package_name", net_not);
|
|
|
|
|
//sendBroadcast(netControlIntent);
|
|
|
|
|
@@ -2126,15 +2137,15 @@ public class JGYUtils {
|
|
|
|
|
Intent intent = new Intent("setDefaultLauncher");
|
|
|
|
|
intent.putExtra("package", pkg);
|
|
|
|
|
intent.putExtra("className", className);
|
|
|
|
|
if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) {
|
|
|
|
|
Log.e(TAG, "setDefaultDesktop: MTK");
|
|
|
|
|
//爱华定制
|
|
|
|
|
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver"));
|
|
|
|
|
// TODO: 2022/7/6 MTK有问题
|
|
|
|
|
setDefaultLauncher(mContext, "com.android.transfer", "com.android.transfer.MainActivity");
|
|
|
|
|
SystemProperties.set("persist.sys.launcher.pkgname", pkg);
|
|
|
|
|
SystemProperties.set("persist.sys.launcher.classname", className);
|
|
|
|
|
}
|
|
|
|
|
// if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) {
|
|
|
|
|
// Log.e(TAG, "setDefaultDesktop: MTK");
|
|
|
|
|
// //爱华定制
|
|
|
|
|
// intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver"));
|
|
|
|
|
// // TODO: 2022/7/6 MTK有问题
|
|
|
|
|
// setDefaultLauncher(mContext, "com.android.transfer", "com.android.transfer.MainActivity");
|
|
|
|
|
// SystemProperties.set("persist.sys.launcher.pkgname", pkg);
|
|
|
|
|
// SystemProperties.set("persist.sys.launcher.classname", className);
|
|
|
|
|
// }
|
|
|
|
|
intent.setPackage("com.android.settings");
|
|
|
|
|
mContext.sendBroadcast(intent);
|
|
|
|
|
// ApkUtils.openPackage(mContext, pkg);
|
|
|
|
|
|