1.4.0705 优化后台,增加全局黑名单
This commit is contained in:
@@ -82,6 +82,7 @@ public class ApkUtils {
|
||||
this.add("com.qunyu.dividedroad");
|
||||
this.add("com.ygyb.yischool");
|
||||
this.add("com.yxxmk.uiui");
|
||||
this.add("com.yxxmk.uiuios");
|
||||
this.add("com.uiui.floatwindow");
|
||||
this.add("com.uiuipad.find");
|
||||
this.add("com.uiuipad.appstore");
|
||||
@@ -94,6 +95,9 @@ public class ApkUtils {
|
||||
this.add("com.ttstd.ttutils");
|
||||
this.add("com.ttstd.qin");
|
||||
this.add("com.uiuios.ailog");
|
||||
|
||||
this.add("com.android.documentsui");
|
||||
this.add("com.android.settings");
|
||||
}};
|
||||
|
||||
/**
|
||||
@@ -143,7 +147,7 @@ public class ApkUtils {
|
||||
this.add("com.verizon.remoteSimlock");
|
||||
this.add("com.android.protips");
|
||||
this.add("com.android.theme.icon_pack.rounded.systemui");
|
||||
this.add("com.android.documentsui");
|
||||
// this.add("com.android.documentsui");
|
||||
this.add("com.android.externalstorage");
|
||||
this.add("com.mediatek.ygps");
|
||||
this.add("com.mediatek.simprocessor");
|
||||
@@ -246,7 +250,7 @@ public class ApkUtils {
|
||||
this.add("com.android.theme.icon.squircle");
|
||||
this.add("com.android.storagemanager");
|
||||
this.add("com.android.bookmarkprovider");
|
||||
this.add("com.android.settings");
|
||||
// this.add("com.android.settings");
|
||||
this.add("com.google.android.inputmethod.pinyin");
|
||||
this.add("com.android.theme.icon_pack.filled.launcher");
|
||||
this.add("com.android.networkstack.permissionconfig");
|
||||
@@ -422,6 +426,16 @@ public class ApkUtils {
|
||||
|
||||
}};
|
||||
|
||||
public static final Set<String> yixuepaiApp = new HashSet<String>() {{
|
||||
this.add("com.qi.airoom");
|
||||
this.add("com.qi.AiStudyRoom");
|
||||
this.add("com.eusoft.eudic");
|
||||
this.add("com.fenbi.android.solar");
|
||||
this.add("com.eduyun.app.factory.ykt");
|
||||
this.add("com.yaerxing.fkst");
|
||||
this.add("com.jxw.usagedate");
|
||||
}};
|
||||
|
||||
|
||||
/**
|
||||
* 学习桌面和九学王app
|
||||
@@ -481,7 +495,14 @@ public class ApkUtils {
|
||||
|
||||
this.add("com.jxw.souti");
|
||||
this.add("com.jxw.xdfzq");
|
||||
this.add("com.uiui.zysn");
|
||||
}};
|
||||
|
||||
public static final Set<String> G11Pkgs = new HashSet<String>() {{
|
||||
/*G11 平台*/
|
||||
this.add("com.lhcx.drawing");
|
||||
this.add("com.dingwei.htbtool");
|
||||
this.add("com.tencent.wemeet.app");
|
||||
this.add("net.xmind.doughnut");
|
||||
}};
|
||||
|
||||
/**
|
||||
@@ -1406,6 +1427,7 @@ public class ApkUtils {
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.speed");
|
||||
this.add("com.books.wisdom");
|
||||
|
||||
}};
|
||||
|
||||
|
||||
@@ -1429,10 +1451,14 @@ public class ApkUtils {
|
||||
//排除所有系统应用,不显示
|
||||
if (isSystemApp(context, packageName)) {
|
||||
if (!AoleyunOSApp.contains(packageName)
|
||||
&& !aoleyunAPP.contains(packageName)
|
||||
&& !aihuaApp.contains(packageName)
|
||||
&& !dongwa.contains(packageName)
|
||||
&& !yixuepaiApp.contains(packageName)
|
||||
&& !mJxwApp.contains(packageName)
|
||||
&& !allPkgSet.contains(packageName)
|
||||
) {
|
||||
Log.e(TAG, "getRunningAppInfo: continue = " + packageName);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,6 @@ 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;
|
||||
@@ -77,7 +76,6 @@ import com.tencent.mmkv.MMKV;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -87,9 +85,6 @@ import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
@@ -534,8 +529,7 @@ public class JGYUtils {
|
||||
*
|
||||
* @param netAndLaunchBean
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean, List<AppListInfo> appListInfos) {
|
||||
public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean, List<AppListInfo> appListInfos) {
|
||||
Log.e(TAG, "setNetAndlaunch: " + "应用联网管控: " + netAndLaunchBean.getData().toString());
|
||||
Log.e(TAG, "setNetAndlaunch: ");
|
||||
HashSet<String> autoLaunchApp = new HashSet<>();//开机自启app
|
||||
@@ -663,8 +657,7 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean) {
|
||||
public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean) {
|
||||
Log.e(TAG, "setNetAndlaunch: " + "应用联网管控: " + netAndLaunchBean.getData().toString());
|
||||
Log.e(TAG, "setNetAndlaunch: ");
|
||||
HashSet<String> autoLaunchApp = new HashSet<>();//开机自启app
|
||||
@@ -772,31 +765,33 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList, HashSet<String> whiteList) {
|
||||
public void setAppNetwork(Context context, HashSet<String> blackList, HashSet<String> whiteList) {
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控 blackList =" + blackList);
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控 whiteList =" + whiteList);
|
||||
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
// 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);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
mMMKV.encode(CommonConfig.AOLE_ACTION_NETWORK_ALLOW, whiteList);
|
||||
if (whiteList == null || whiteList.size() == 0) {
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
// TODO: 2024/6/28 暂时所有的都为白名单
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
|
||||
String net_not = String.join(",", whiteList);
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: net_not = " + net_not);
|
||||
List<String> filterList = whiteList.stream().filter(s -> !ApkUtils.isAvailable(context, s)).collect(Collectors.toList());
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(context, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
@@ -815,13 +810,13 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void updateNetworkWhiteList() {
|
||||
String whiteString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
if (TextUtils.isEmpty(whiteString)) {
|
||||
Set<String> pkgs = mMMKV.decodeStringSet(CommonConfig.AOLE_ACTION_NETWORK_ALLOW, new HashSet<>());
|
||||
if (pkgs.isEmpty()) {
|
||||
Log.e(TAG, "updateNetworkWhiteList: allow content is empty");
|
||||
return;
|
||||
}
|
||||
List<String> whiteList = new ArrayList<>(Arrays.asList(whiteString.split(",")));
|
||||
List<String> filterList = whiteList.stream().filter(s -> !ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
List<String> whiteList = new ArrayList<>(pkgs);
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
// Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
@@ -830,8 +825,7 @@ public class JGYUtils {
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + filterList);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void onBootSendNetwork() {
|
||||
public void onBootSendNetwork() {
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
@@ -897,7 +891,7 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized public void setAppinsideWeb(BaseResponse<List<Appground>> response) {
|
||||
public void setAppinsideWeb(BaseResponse<List<Appground>> response) {
|
||||
if (response.code == 200) {
|
||||
List<Appground> appgrounds = response.data;
|
||||
if (appgrounds != null && appgrounds.size() > 0) {
|
||||
@@ -951,7 +945,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* @param response 黑白名单都可以管控
|
||||
*/
|
||||
synchronized public void setNewAppinsideWeb(BaseResponse response) {
|
||||
public void setNewAppinsideWeb(BaseResponse response) {
|
||||
Log.e(TAG, "setNewAppinsideWeb: " + "应用内部联网管控: " + response);
|
||||
if (response.code == 200) {
|
||||
String jsonString = GsonUtils.toJSONString(response.data);
|
||||
@@ -989,7 +983,7 @@ public class JGYUtils {
|
||||
// public static final String JGY_APPINSIDE_FIRST_WRITE = "JGY_APPINSIDE_FIRST_WRITE";
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized private void setWhiteApp(List<TTAppground> appgrounds) {
|
||||
private void setWhiteApp(List<TTAppground> appgrounds) {
|
||||
//去重
|
||||
List<TTAppground> ttAppgrounds = appgrounds.stream().distinct().collect(Collectors.toList());
|
||||
List<TTAppground> old = getOldWhitelist();
|
||||
@@ -997,7 +991,7 @@ public class JGYUtils {
|
||||
setWhiteList(ttAppgrounds);
|
||||
}
|
||||
|
||||
synchronized private void comparedAppground(List<TTAppground> oldAppgrounds, List<TTAppground> newAppgrounds) {
|
||||
private void comparedAppground(List<TTAppground> oldAppgrounds, List<TTAppground> newAppgrounds) {
|
||||
List<TTAppground> addAppgrounds = new ArrayList<>();
|
||||
List<TTAppground> deleteAppgrounds = new ArrayList<>();
|
||||
List<TTAppground> changedAppgrounds = new ArrayList<>();
|
||||
@@ -1131,7 +1125,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* @param pkg 开启app白名单
|
||||
*/
|
||||
synchronized private void addPackage(String pkg) {
|
||||
private void addPackage(String pkg) {
|
||||
Log.e(TAG, "addPackage: " + pkg);
|
||||
Intent intent26 = new Intent();
|
||||
intent26.setAction("qch_app_inside_website");
|
||||
@@ -1144,7 +1138,7 @@ public class JGYUtils {
|
||||
* @param pkg
|
||||
* @param urls 添加app白名单
|
||||
*/
|
||||
synchronized private void addToWhitelist(String pkg, String urls) {
|
||||
private void addToWhitelist(String pkg, String urls) {
|
||||
if (TextUtils.isEmpty(urls)) {
|
||||
Log.e(TAG, "addToWhitelist: " + "urls is NULL");
|
||||
return;
|
||||
@@ -1169,7 +1163,7 @@ public class JGYUtils {
|
||||
* @param pkg
|
||||
* @param urls 删除某个app 内某个白名单
|
||||
*/
|
||||
synchronized private void deleteWhitelistUrl(String pkg, String urls) {
|
||||
private void deleteWhitelistUrl(String pkg, String urls) {
|
||||
if (TextUtils.isEmpty(urls)) {
|
||||
Log.e(TAG, "addToWhitelist: " + "urls is NULL");
|
||||
return;
|
||||
@@ -1192,7 +1186,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* @param pkg 开启和关闭白名单管控都需要发送
|
||||
*/
|
||||
synchronized private void deleteOtherAppWhitelist(String pkg) {
|
||||
private void deleteOtherAppWhitelist(String pkg) {
|
||||
Log.e(TAG, "disableAppWhitelist: " + pkg);
|
||||
Intent intent24 = new Intent();
|
||||
intent24.setAction("qch_app_setDelAppWhitUid");
|
||||
@@ -1204,7 +1198,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* @param appgrounds 设置黑名单管控
|
||||
*/
|
||||
synchronized private void setBlackApp(List<TTAppground> appgrounds) {
|
||||
private void setBlackApp(List<TTAppground> appgrounds) {
|
||||
Log.e(TAG, "setBlackApp: " + appgrounds);
|
||||
StringBuilder blackList = new StringBuilder();
|
||||
StringBuilder packageList = new StringBuilder();//单条管控名单
|
||||
@@ -1244,7 +1238,7 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized private static void sendAllweb(Context context) {
|
||||
private static void sendAllweb(Context context) {
|
||||
Log.e(TAG, "sendAllweb: ");
|
||||
Intent intent = new Intent("qch_app_website")
|
||||
.setPackage("com.android.settings");
|
||||
@@ -1252,7 +1246,7 @@ public class JGYUtils {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
synchronized private static void sendwebUrl(Context context) {
|
||||
private static void sendwebUrl(Context context) {
|
||||
Log.e(TAG, "sendwebUrl: ");
|
||||
Intent intent = new Intent("qch_app_inside_website")
|
||||
.setPackage("com.android.settings");
|
||||
@@ -1260,7 +1254,7 @@ public class JGYUtils {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
synchronized public void SettingSysData(String data) {
|
||||
public void SettingSysData(String data) {
|
||||
SPUtils.put(mContext, "SystemSettingData", data);
|
||||
if (TextUtils.isEmpty(data)) {
|
||||
Log.e(TAG, "SettingSysData: " + "data is empty");
|
||||
@@ -1292,11 +1286,16 @@ public class JGYUtils {
|
||||
this.add("com.notepad.uiui");
|
||||
this.add("com.calendar.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.videoplayer");
|
||||
// this.add("com.uiui.videoplayer");
|
||||
this.add("com.ygyb.yischool");
|
||||
this.add("com.books.wisdom");
|
||||
this.add("com.qi.airoom");
|
||||
this.add("com.qi.AiStudyRoom");
|
||||
this.add("com.eusoft.eudic");
|
||||
this.add("com.fenbi.android.solar");
|
||||
this.add("com.eduyun.app.factory.ykt");
|
||||
this.add("com.yaerxing.fkst");
|
||||
this.add("com.jxw.usagedate");
|
||||
}};
|
||||
|
||||
private Set<String> getWhitePkgList() {
|
||||
@@ -1315,6 +1314,9 @@ public class JGYUtils {
|
||||
if ("G23".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.zhengwu);
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform) {
|
||||
pkgSet.addAll(ApkUtils.G11Pkgs);
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform) {
|
||||
pkgSet.add("com.tencent.wemeet.app");
|
||||
}
|
||||
@@ -1362,19 +1364,20 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void checkForceDownload() {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
NetInterfaceManager.getInstance().getForceDownload();
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<ForceDownloadData>>() {
|
||||
}.getType();
|
||||
List<ForceDownloadData> forceDownloadData = gson.fromJson(jsonString, listType);
|
||||
if (forceDownloadData != null) {
|
||||
JGYUtils.getInstance().forceDownload(forceDownloadData);
|
||||
}
|
||||
}
|
||||
// String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
|
||||
// //为 "" 是已经请求成功的
|
||||
// if (jsonString == null) {
|
||||
// NetInterfaceManager.getInstance().getForceDownload();
|
||||
// } else {
|
||||
// Gson gson = new Gson();
|
||||
// Type listType = new TypeToken<List<ForceDownloadData>>() {
|
||||
// }.getType();
|
||||
// List<ForceDownloadData> forceDownloadData = gson.fromJson(jsonString, listType);
|
||||
// if (forceDownloadData != null) {
|
||||
// JGYUtils.getInstance().forceDownload(forceDownloadData);
|
||||
// }
|
||||
// }
|
||||
NetInterfaceManager.getInstance().getForceDownload();
|
||||
}
|
||||
|
||||
|
||||
@@ -2009,6 +2012,7 @@ public class JGYUtils {
|
||||
|
||||
|
||||
public void killPackage(String pkg) {
|
||||
Log.e(TAG, "killPackage: " + pkg);
|
||||
ActivityManager manager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
manager.killBackgroundProcesses(pkg);
|
||||
CmdUtil.execute("am force-stop " + pkg);
|
||||
@@ -2329,12 +2333,13 @@ public class JGYUtils {
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
context.startService(new Intent(context, StepService.class));
|
||||
context.startService(new Intent(context, GuardService.class));
|
||||
context.startService(new Intent(context, LogcatService.class));
|
||||
// context.startService(new Intent(context, LogcatService.class));
|
||||
}
|
||||
}
|
||||
|
||||
private String Launcher3 = "com.android.launcher3";
|
||||
private String Launcher3Class = "com.android.launcher3.Launcher";
|
||||
private String Launcher3QuickstepClass = "com.android.launcher3.uioverrides.QuickstepLauncher";
|
||||
|
||||
private String AoleyunOs = "com.aoleyun.os";
|
||||
private String AoleyunOsClass = "com.aoleyun.os.Launcher";
|
||||
@@ -2407,6 +2412,12 @@ public class JGYUtils {
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform) {
|
||||
JGYUtils.getInstance().setDop7DefaultDesktop();
|
||||
} else if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform) {
|
||||
JGYUtils.getInstance().setJXWDefaultDesktop();
|
||||
// } else if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
|
||||
// JGYUtils.getInstance().setJXWDefaultDesktop();
|
||||
} else if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AUDG104Platform) {
|
||||
JGYUtils.getInstance().setAiuduDefaultDesktop();
|
||||
}
|
||||
} else {
|
||||
if (pkg.equalsIgnoreCase(desktopPkg)) {
|
||||
@@ -2438,29 +2449,45 @@ public class JGYUtils {
|
||||
* 设置奥乐云桌面为默认
|
||||
*/
|
||||
public void setDefaultDesktop() {
|
||||
Log.e(TAG, "setDefaultDesktop: ");
|
||||
setDefaultDesktop(PackageNames.DESKTOP);
|
||||
}
|
||||
|
||||
public void setYxpDefaultDesktop() {
|
||||
Log.e(TAG, "setYxpDefaultDesktop: ");
|
||||
setDefaultDesktop(PackageNames.YIXUEPAI_DESKTOP);
|
||||
}
|
||||
|
||||
public void setDop7DefaultDesktop() {
|
||||
Log.e(TAG, "setDop7DefaultDesktop: ");
|
||||
setDefaultDesktop("com.aoleyunos.dop7");
|
||||
}
|
||||
|
||||
public void setJXWDefaultDesktop() {
|
||||
Log.e(TAG, "setJXWDefaultDesktop: ");
|
||||
setDefaultDesktop("com.jxw.launcher");
|
||||
}
|
||||
|
||||
public void setAiuduDefaultDesktop() {
|
||||
Log.e(TAG, "setAiuduDefaultDesktop: ");
|
||||
// setDefaultDesktop("com.aoleyun.audos");
|
||||
// setLauncher3();
|
||||
setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认桌面
|
||||
*
|
||||
* @param pkg
|
||||
*/
|
||||
public void setDefaultDesktop(String pkg) {
|
||||
Log.e(TAG, "setDefaultDesktop: " + pkg);
|
||||
Log.e(TAG, "setDefaultDesktop: pkg = " + pkg);
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
setLauncher3();
|
||||
} else {
|
||||
String className = getStartClassName(pkg);
|
||||
Log.e(TAG, "setDefaultDesktop: " + className);
|
||||
Log.e(TAG, "setDefaultDesktop: className = " + className);
|
||||
if (TextUtils.isEmpty(className)) {
|
||||
setLauncher3();
|
||||
} else {
|
||||
@@ -2479,14 +2506,18 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private void setLauncher3() {
|
||||
public void setLauncher3() {
|
||||
if (ApkUtils.isAvailable(mContext, AoleyunOs)
|
||||
|| "C2".equals(Build.MODEL)) {
|
||||
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
|
||||
} else if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
|
||||
} else {
|
||||
setDefaultDesktop(Launcher3, Launcher3Class);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||
setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
|
||||
} else {
|
||||
setDefaultDesktop(Launcher3, Launcher3Class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2544,7 +2575,7 @@ public class JGYUtils {
|
||||
} else {
|
||||
//爱华设置,暂时屏蔽
|
||||
// setDefaultLauncher(mContext, pkg, className);
|
||||
Log.e(TAG, "setDefaultDesktop: setDefaultLauncher: " + pkg);
|
||||
Log.e(TAG, "setDefaultDesktop: setDefaultLauncher: pkg = " + pkg);
|
||||
}
|
||||
// String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||
// if (Objects.equals(oldDesktop, pkg)) {
|
||||
@@ -2569,10 +2600,42 @@ public class JGYUtils {
|
||||
Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className);
|
||||
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname"));
|
||||
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.classname = " + SystemProperties.get("persist.sys.launcher.classname"));
|
||||
|
||||
Log.e(TAG, "setDefaultDesktop: getDefaultLaunchers = " + getDefaultLaunchers());
|
||||
setDefaultLauncher(new ComponentName(pkg, className));
|
||||
}
|
||||
|
||||
public Set<String> getDefaultLaunchers() {
|
||||
Set<String> defaultLaunchers = new HashSet<String>();
|
||||
PackageManager packageManager = mContext.getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
// 查询所有已安装的桌面应用
|
||||
List<ResolveInfo> launcherList = packageManager.queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
// 获取默认的桌面应用,没有指定默认桌面时返回"android"
|
||||
ResolveInfo defaultLauncher = packageManager.resolveActivity(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (launcherList != null && defaultLauncher != null) {
|
||||
String pkgName = defaultLauncher.activityInfo.packageName;
|
||||
Log.e("getDefaultLaunchers", "default launcher is : " + pkgName);
|
||||
// 没有指定默认桌面时返回的是"android",故这里过滤下防止"android"被添加到默认桌面列表中
|
||||
for (ResolveInfo info : launcherList) {
|
||||
Log.e("getDefaultLaunchers", "launcher : " + info.activityInfo.packageName);
|
||||
if (info.activityInfo.packageName.equals(pkgName)) {
|
||||
defaultLaunchers.add(pkgName);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 有多个桌面应用,且目前没有指定默认桌面时,返回所有的桌面应用
|
||||
if (defaultLaunchers.isEmpty() && launcherList != null) {
|
||||
for (ResolveInfo resolveInfo : launcherList) {
|
||||
defaultLaunchers.add(resolveInfo.activityInfo.packageName);
|
||||
}
|
||||
}
|
||||
Log.e("getDefaultLaunchers", "defaultLaunchers : " + defaultLaunchers);
|
||||
return defaultLaunchers;
|
||||
}
|
||||
|
||||
public String getMacJson(Context context) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial(context));
|
||||
@@ -2800,9 +2863,10 @@ public class JGYUtils {
|
||||
mContext.sendBroadcast(bootIntent);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void wakeUpAoleyunAPP() {
|
||||
wakeUpAppstore();
|
||||
wakeUpNotify();
|
||||
// wakeUpAppstore();
|
||||
// wakeUpNotify();
|
||||
}
|
||||
|
||||
public static String getModel() {
|
||||
|
||||
@@ -6,27 +6,29 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.cube.SuperPower;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.bean.BluetoothType;
|
||||
import com.aoleyun.sn.bean.SnSetting;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class SysSettingUtils {
|
||||
@@ -348,6 +350,46 @@ public class SysSettingUtils {
|
||||
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo = " + setting_bhtvideo);
|
||||
|
||||
//蓝牙设备连接类型开关
|
||||
int setting_bluetooth_type = changeNum(jsonObject.get("setting_bluetooth_type").getAsInt());
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth_type = " + setting_bluetooth_type);
|
||||
if (setting_bluetooth_type == 1) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
|
||||
} else {
|
||||
String bluetooth_type_control = jsonObject.get("bluetooth_type_control").getAsString();
|
||||
Log.e(TAG, "setBluetooth: bluetooth_type_control = " + bluetooth_type_control);
|
||||
if (TextUtils.isEmpty(bluetooth_type_control)) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<BluetoothType>() {
|
||||
}.getType();
|
||||
BluetoothType bluetoothType = gson.fromJson(bluetooth_type_control, listType);
|
||||
if (bluetoothType == null) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, "");
|
||||
} else {
|
||||
List<String> typeList = new ArrayList<>();
|
||||
if (bluetoothType.getHeadset() == 1) {
|
||||
typeList.add(CommonConfig.AOLE_BT_HEADSET_KEY);
|
||||
}
|
||||
if (bluetoothType.getSound() == 1) {
|
||||
typeList.add(CommonConfig.AOLE_BT_BOX_KEY);
|
||||
}
|
||||
if (bluetoothType.getMobile() == 1) {
|
||||
typeList.add(CommonConfig.AOLE_BT_PHONE_KEY);
|
||||
}
|
||||
if (bluetoothType.getComputer() == 1) {
|
||||
typeList.add(CommonConfig.AOLE_BT_COMPUTER_KEY);
|
||||
}
|
||||
if (bluetoothType.getKeyboard() == 1) {
|
||||
typeList.add(CommonConfig.AOLE_BT_KEYBOARD_KEY);
|
||||
}
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_DEVICE_TYPE, String.join(",", typeList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int old_setting_bht = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, 1);
|
||||
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
|
||||
int old_setting_bhtvideo = mmkv.decodeInt(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, 1);
|
||||
@@ -895,6 +937,11 @@ public class SysSettingUtils {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", 0);
|
||||
}
|
||||
|
||||
Intent intent = new Intent("BrowserInternetControlKey");
|
||||
intent.setPackage("com.aoleyun.browser");
|
||||
context.sendBroadcast(intent);
|
||||
|
||||
|
||||
JsonElement smsCategory = jsonObject.get("setting_sms");
|
||||
if (smsCategory != null && !smsCategory.isJsonNull()) {
|
||||
int setting_sms = smsCategory.getAsInt();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class WiFiUtils {
|
||||
}
|
||||
|
||||
|
||||
synchronized public static void saveWiFiPasswd(List<WiFiAlias> passwd) {
|
||||
public static void saveWiFiPasswd(List<WiFiAlias> passwd) {
|
||||
String jsonString = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).decodeString("WiFiPassword", "");
|
||||
Log.e(TAG, "saveWiFiPasswd: " + jsonString);
|
||||
Gson gson = new Gson();
|
||||
@@ -254,7 +254,7 @@ public class WiFiUtils {
|
||||
}
|
||||
|
||||
|
||||
synchronized private static boolean wifiSaved(String ssid) {
|
||||
private static boolean wifiSaved(String ssid) {
|
||||
// 获取已保存wifi配置链表
|
||||
List<WifiConfiguration> configs = mWifiManager.getConfiguredNetworks();
|
||||
boolean saved = false;
|
||||
|
||||
Reference in New Issue
Block a user