1.4.0429 修改一键加速界面,去掉ToastUtil,对接权限和通知
This commit is contained in:
@@ -32,6 +32,7 @@ import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -81,6 +82,9 @@ public class ApkUtils {
|
||||
|
||||
this.add("com.yixuepai.os");
|
||||
this.add("com.tongyi.aistudent");
|
||||
this.add("com.uisaas.service");
|
||||
this.add("com.ttstd.ttutils");
|
||||
this.add("com.ttstd.qin");
|
||||
}};
|
||||
|
||||
/**
|
||||
@@ -411,7 +415,7 @@ public class ApkUtils {
|
||||
/**
|
||||
* 学习桌面和九学王app
|
||||
*/
|
||||
public static final Set<String> jxwApp = new HashSet<String>() {{
|
||||
public static final Set<String> mJxwApp = new HashSet<String>() {{
|
||||
this.add("com.google.android.inputmethod.pinyin");
|
||||
this.add("air.com.zhihuiyoujiao.flashplayer");
|
||||
this.add("com.example.arithmeticformula");
|
||||
@@ -463,6 +467,10 @@ public class ApkUtils {
|
||||
this.add("com.teclast.zybrowser");
|
||||
this.add("com.teclast.zyappstore");
|
||||
this.add("com.teclast.zy");
|
||||
|
||||
this.add("com.jxw.souti");
|
||||
this.add("com.jxw.xdfzq");
|
||||
this.add("com.uiui.zysn ");
|
||||
}};
|
||||
|
||||
/**
|
||||
@@ -552,7 +560,7 @@ public class ApkUtils {
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "openPackage: " + e.getMessage());
|
||||
ToastUtil.show("打开失败");
|
||||
Toaster.show("打开失败");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -783,12 +791,12 @@ public class ApkUtils {
|
||||
public void onNext(Integer value) {
|
||||
if (value == 2) {
|
||||
//安装成功
|
||||
ToastUtil.show("安装成功");
|
||||
Toaster.show("安装成功");
|
||||
Log.e("installRx", "-----------安装成功-----------");
|
||||
} else {
|
||||
//安装错误
|
||||
Log.e("installRx", "------------安装错误-----------");
|
||||
ToastUtil.show("安装失败");
|
||||
Toaster.show("安装失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,7 +827,7 @@ public class ApkUtils {
|
||||
|
||||
public static boolean installApps(String apkPath) {
|
||||
Log.e(TAG, "installApps: 正在安装应用 " + apkPath);
|
||||
ToastUtil.show("正在安装应用");
|
||||
Toaster.show("正在安装应用");
|
||||
Process process = null;
|
||||
BufferedReader successResult = null;
|
||||
BufferedReader errorResult = null;
|
||||
@@ -874,7 +882,7 @@ public class ApkUtils {
|
||||
if (sessionId != -1) {
|
||||
boolean copySuccess = copyApkFile(packageInstaller, sessionId, apkFilePath);
|
||||
if (copySuccess) {
|
||||
ToastUtil.show("正在安装应用");
|
||||
Toaster.show("正在安装应用");
|
||||
install(packageInstaller, sessionId, context);
|
||||
}
|
||||
}
|
||||
@@ -943,7 +951,7 @@ public class ApkUtils {
|
||||
|
||||
public static void installApkInSilence(String installPath, String packageName) {
|
||||
Log.e(TAG, "installApps: 正在安装应用 " + installPath);
|
||||
ToastUtil.show("正在安装应用");
|
||||
Toaster.show("正在安装应用");
|
||||
|
||||
Class<?> pmService;
|
||||
Class<?> activityTherad;
|
||||
@@ -1138,39 +1146,24 @@ public class ApkUtils {
|
||||
return applicationInfos;
|
||||
}
|
||||
|
||||
public static void showAllAPP(Context context) {
|
||||
public static void showAllApp(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<PackageInfo> packages = pm.getInstalledPackages(PackageManager.COMPONENT_ENABLED_STATE_ENABLED | PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
|
||||
for (PackageInfo packageInfo : packages) {
|
||||
Log.i(TAG, "showAllAPP: " + packageInfo.packageName);
|
||||
//如果是自带可以卸载的,除开不需要管控的
|
||||
if (canremove_systemapp.contains(packageInfo.packageName)
|
||||
&& !show_canremove_systemapp.contains(packageInfo.packageName)) {
|
||||
String pkg = packageInfo.packageName;
|
||||
Log.i(TAG, "showAllApp: " + pkg);
|
||||
Log.e(TAG, "showAllApp: disable = " + (pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED));
|
||||
if (canremove_systemapp.contains(pkg)
|
||||
&& !show_canremove_systemapp.contains(pkg)) {
|
||||
Log.e(TAG, "showAllApp: continue: " + pkg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1 && !systemapp.contains(packageInfo.packageName)) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
//10.0上日历和电子邮件是可卸载的
|
||||
//7.0是系统应用
|
||||
if (show_canremove_systemapp.contains(packageInfo.packageName)) {
|
||||
Logger.e("showAllAPP2", "packageName:" + packageInfo.packageName);
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "showAllAPP: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger.e("showAllAPP", "packageName:" + packageInfo.packageName);
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "showAllAPP: " + e.getMessage());
|
||||
}
|
||||
hideSystemSettingAPP(context, packageInfo.packageName);
|
||||
try {
|
||||
Log.i(TAG, "showAllApp: show: " + pkg);
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "showAllApp: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1472,4 +1465,28 @@ public class ApkUtils {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取第三方应用
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static List<String> queryFilterAppList(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);// GET_UNINSTALLED_PACKAGES代表已删除,但还有安装目录的
|
||||
List<String> applicationInfos = new ArrayList<>();
|
||||
for (ApplicationInfo app : appInfos) {
|
||||
// Log.e("queryFilterAppInfo", String.valueOf(app.flags));
|
||||
// Log.e("queryFilterAppInfo", String.valueOf((app.flags & mask)));
|
||||
if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
//通过flag排除系统应用,会将电话、短信也排除掉
|
||||
} else {
|
||||
applicationInfos.add(app.packageName);
|
||||
Log.e("queryFilterAppInfo", app.packageName);
|
||||
}
|
||||
}
|
||||
return applicationInfos;
|
||||
}
|
||||
|
||||
}
|
||||
91
app/src/main/java/com/aoleyun/sn/utils/AppUtil.java
Normal file
91
app/src/main/java/com/aoleyun/sn/utils/AppUtil.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2012 www.amsoft.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.aoleyun.sn.utils;
|
||||
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
||||
public class AppUtil {
|
||||
private static String TAG = AppUtil.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* 描述:获取可用内存.
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static long getAvailMemory(Context context) {
|
||||
// 获取android当前可用内存大小
|
||||
ActivityManager activityManager = (ActivityManager) context
|
||||
.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
// 当前系统可用内存 ,将获得的内存大小规格化
|
||||
|
||||
return memoryInfo.availMem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return 可用的内存大小
|
||||
*/
|
||||
public static long getFreeMemory(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
long freeMem = memoryInfo.totalMem - memoryInfo.availMem;
|
||||
// Log.e("getHardware", "getFreeMemory: " + freeMem);
|
||||
return freeMem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:总内存.
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static long getTotalMemory(Context context) {
|
||||
// 系统内存信息文件
|
||||
String file = "/proc/meminfo";
|
||||
String memInfo;
|
||||
String[] strs;
|
||||
long memory = 0;
|
||||
|
||||
try {
|
||||
FileReader fileReader = new FileReader(file);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader, 8192);
|
||||
// 读取meminfo第一行,系统内存大小
|
||||
memInfo = bufferedReader.readLine();
|
||||
strs = memInfo.split("\\s+");
|
||||
for (String str : strs) {
|
||||
Log.e(TAG, "getTotalMemory: " + str + "\t");
|
||||
}
|
||||
// 获得系统总内存,单位KB
|
||||
memory = Integer.valueOf(strs[1]).intValue();
|
||||
bufferedReader.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Byte转位KB或MB
|
||||
return memory * 1024;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
|
||||
public class InstallResultReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "InstallResultReceiver";
|
||||
|
||||
@@ -51,7 +53,7 @@ public class InstallResultReceiver extends BroadcastReceiver {
|
||||
// Log.e("fht", LEGACY_STATUS);
|
||||
// Log.e("fht", STATUS_MESSAGE);
|
||||
if (STATUS_MESSAGE != null && STATUS_MESSAGE.equals("INSTALL_SUCCEEDED")) {
|
||||
ToastUtil.show(PACKAGE_NAME + "安装成功");
|
||||
Toaster.show(PACKAGE_NAME + "安装成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ 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.hjq.toast.Toaster;
|
||||
import com.kte.interfacesettings.aidl.ITools;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
@@ -146,6 +147,7 @@ public class JGYUtils {
|
||||
public static final int C2Platform = 13;
|
||||
public static final int YXPD1Platform = 15;
|
||||
public static final int G11Platform = 16;
|
||||
public static final int MT8768Platform = 17;
|
||||
|
||||
|
||||
public static final String Other = "其他";
|
||||
@@ -161,6 +163,7 @@ public class JGYUtils {
|
||||
public static final String C2Tag = "MTK8183";
|
||||
public static final String YXPD1TAG = "YXPD1";
|
||||
public static final String G11TAG = "MTKG11";
|
||||
public static final String MT8768Tag = "MT8768";
|
||||
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
@@ -283,6 +286,9 @@ public class JGYUtils {
|
||||
} else if (G11TAG.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MTKG11");
|
||||
return G11Platform;
|
||||
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MT8768");
|
||||
return MT8768Platform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -329,6 +335,8 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(YXPD1Platform);
|
||||
} else if (G11TAG.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G11Platform);
|
||||
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(MT8768Platform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -585,7 +593,7 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void onBootOpenApp() {
|
||||
String qch_app_power_on = Settings.System.getString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_APP_POWER_ON);
|
||||
String qch_app_power_on = Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON);
|
||||
if (TextUtils.isEmpty(qch_app_power_on)) {
|
||||
return;
|
||||
}
|
||||
@@ -651,6 +659,9 @@ public class JGYUtils {
|
||||
HashSet<String> disallowUpgrade = new HashSet<>();//禁止升级
|
||||
HashSet<String> allowSlide = new HashSet<>();//允许滑动
|
||||
HashSet<String> disallowSlide = new HashSet<>();//禁止滑动
|
||||
HashSet<String> disallowNotification = new HashSet<>();//禁止通知栏显示通知
|
||||
HashSet<String> allowPermissions = new HashSet<>();//默认给所有权限
|
||||
|
||||
|
||||
List<NetAndLaunchData> data = netAndLaunchBean.getData();
|
||||
for (NetAndLaunchData netAndLaunchData : data) {
|
||||
@@ -659,6 +670,8 @@ public class JGYUtils {
|
||||
int is_network = netAndLaunchData.getIs_network();
|
||||
int is_upgrade = netAndLaunchData.getIs_upgrade();
|
||||
int is_slide = netAndLaunchData.getIs_slide();
|
||||
int is_notification = netAndLaunchData.getIs_notification();
|
||||
int is_dynamic_perm = netAndLaunchData.getIs_dynamic_perm();
|
||||
|
||||
if (is_auto == 1) {
|
||||
autoLaunchApp.add(app_package);
|
||||
@@ -678,6 +691,13 @@ public class JGYUtils {
|
||||
} else {
|
||||
disallowSlide.add(app_package);
|
||||
}
|
||||
|
||||
if (is_notification == 0) {
|
||||
disallowNotification.add(app_package);
|
||||
}
|
||||
if (is_dynamic_perm == 1) {
|
||||
allowPermissions.add(app_package);
|
||||
}
|
||||
}
|
||||
|
||||
if (disallowSlide.size() != 0) {
|
||||
@@ -711,6 +731,29 @@ public class JGYUtils {
|
||||
// Log.e(TAG, "setNetAndlaunch: 测试写入: " + w);
|
||||
// }
|
||||
setAppNetwork(mContext, disallowNetApp, allowNetApp);
|
||||
setDisallowNotificationPackage(mContext, disallowNotification);
|
||||
mMMKV.encode("aole_app_privilege", allowPermissions);
|
||||
setAllowPermissionsPackage(mContext);
|
||||
}
|
||||
|
||||
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", "");
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), "aole_app_info", String.join(",", pkgSet));
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllowPermissionsPackage(Context context) {
|
||||
Set<String> privilegeApp = mMMKV.decodeStringSet("aole_app_privilege", new HashSet<>());
|
||||
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(context.getContentResolver(), "aole_app_privilege", "");
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), "aole_app_privilege", String.join(",", pkgSet));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@@ -884,7 +927,7 @@ public class JGYUtils {
|
||||
//列表为空的情况
|
||||
sendAllweb(mContext);
|
||||
sendwebUrl(mContext);
|
||||
//ToastUtil.show(msg);
|
||||
//Toaster.show(msg);
|
||||
Log.e("setAppinsideWeb", "setAppinsideWeb: " + response.msg);
|
||||
}
|
||||
}
|
||||
@@ -921,7 +964,7 @@ public class JGYUtils {
|
||||
setWhiteApp(whiteApp);
|
||||
sendAllweb(mContext);
|
||||
sendwebUrl(mContext);
|
||||
//ToastUtil.show(msg);
|
||||
//Toaster.show(msg);
|
||||
Log.e("setAppinsideWeb", "setAppinsideWeb: " + response.msg);
|
||||
}
|
||||
}
|
||||
@@ -1236,19 +1279,13 @@ public class JGYUtils {
|
||||
this.add("com.ygyb.yischool");
|
||||
}};
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void writeAppPackageList(String packageList) {
|
||||
if (isUnlocked(mContext)) {
|
||||
addAppInstallWhiteList(new ArrayList<>());
|
||||
setAppRestriction(0);
|
||||
return;
|
||||
}
|
||||
ApkUtils.addShortcut(mContext);
|
||||
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
|
||||
pkgSet.addAll(defaultPackages);
|
||||
private Set<String> getWhitePkgList() {
|
||||
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
|
||||
pkgSet.addAll(showAppList);
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.jxwApp);
|
||||
pkgSet.addAll(ApkUtils.mJxwApp);
|
||||
|
||||
if ("AS001".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
}
|
||||
@@ -1264,10 +1301,23 @@ public class JGYUtils {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform) {
|
||||
pkgSet.add("com.gaomuxuexi34");
|
||||
}
|
||||
pkgSet.removeIf(TextUtils::isEmpty);
|
||||
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
|
||||
pkgSet.remove("com.tencent.mm");
|
||||
}
|
||||
return pkgSet;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void writeAppPackageList(String packageList) {
|
||||
if (isUnlocked(mContext)) {
|
||||
addAppInstallWhiteList(new ArrayList<>());
|
||||
setAppRestriction(0);
|
||||
return;
|
||||
}
|
||||
ApkUtils.addShortcut(mContext);
|
||||
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
|
||||
pkgSet.addAll(getWhitePkgList());
|
||||
pkgSet.removeIf(TextUtils::isEmpty);
|
||||
String aole_app_forbid = String.join(",", pkgSet);
|
||||
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
|
||||
boolean b = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
|
||||
@@ -1283,27 +1333,9 @@ public class JGYUtils {
|
||||
return;
|
||||
}
|
||||
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.jxwApp);
|
||||
if ("AS001".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
}
|
||||
if ("D1".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.dongwa);
|
||||
}
|
||||
if ("G23".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.zhengwu);
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform) {
|
||||
pkgSet.add("com.tencent.wemeet.app");
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform) {
|
||||
pkgSet.add("com.gaomuxuexi34");
|
||||
}
|
||||
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
|
||||
pkgSet.remove("com.tencent.mm");
|
||||
}
|
||||
pkgSet.addAll(getWhitePkgList());
|
||||
pkgSet.removeIf(TextUtils::isEmpty);
|
||||
|
||||
String aole_app_forbid = String.join(",", pkgSet);
|
||||
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
|
||||
@@ -1523,7 +1555,7 @@ public class JGYUtils {
|
||||
if (isUnlocked(mContext)) {
|
||||
return;
|
||||
}
|
||||
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
||||
int aihuaUnlock = Settings.System.getInt(crv, CommonConfig.AIHUA_UNLOCK, 0);
|
||||
if (aihuaUnlock == 1) {
|
||||
return;
|
||||
}
|
||||
@@ -1568,7 +1600,7 @@ public class JGYUtils {
|
||||
if (ApkUtils.aihuaApp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.jxwApp.contains(packageName)) {
|
||||
if (ApkUtils.mJxwApp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (PackageNames.DEVICE_INFO.equals(packageName) || PackageNames.APPSTORE.equals(packageName)
|
||||
@@ -1652,17 +1684,13 @@ public class JGYUtils {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (!showAppList.contains(pkg)
|
||||
&& !ApkUtils.aoleyunAPP.contains(pkg)
|
||||
&& !ApkUtils.desktopAPP.contains(pkg)
|
||||
&& !ApkUtils.aihuaApp.contains(pkg)
|
||||
) {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
Log.e(TAG, "hideSystemAPP: " + "disable: " + pkg);
|
||||
} else {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
Log.e(TAG, "hideSystemAPP: " + "enable: " + pkg);
|
||||
}
|
||||
// if (!getWhitePkgList().contains(pkg)) {
|
||||
// pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
// Log.e(TAG, "hideSystemAPP: " + "disable: " + pkg);
|
||||
// } else {
|
||||
// pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
// Log.e(TAG, "hideSystemAPP: " + "enable: " + pkg);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1713,7 +1741,11 @@ public class JGYUtils {
|
||||
String oldMd5 = FileUtils.getFileMD5ToString(bootFile);
|
||||
if (!TextUtils.isEmpty(oldMd5) && oldMd5.equalsIgnoreCase(MD5)) {
|
||||
Log.e(TAG, "checkBootFile: Bootanimation file exists");
|
||||
setBootanimation(bootFile.getAbsolutePath());
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
JGYUtils.getInstance().setBootanimationG10J(bootFile.getAbsolutePath());
|
||||
} else {
|
||||
JGYUtils.getInstance().setBootanimation(bootFile.getAbsolutePath());
|
||||
}
|
||||
} else {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("MD5", MD5);
|
||||
@@ -1779,8 +1811,44 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String BOOTANIMATION_PATH_G10J = "/storage/emulated/0/Download/bootanimation.zip";
|
||||
|
||||
public void setBootanimationG10J(String filePath) {
|
||||
File newFile = new File(filePath);
|
||||
if (!newFile.exists()) {
|
||||
Log.e(TAG, "setBootanimationG10J: file not exists");
|
||||
return;
|
||||
}
|
||||
File file = new File(BOOTANIMATION_PATH_G10J);
|
||||
String oldMD5 = FileUtils.getFileMD5ToString(file);
|
||||
String newMD5 = FileUtils.getFileMD5ToString(newFile);
|
||||
if (oldMD5.equals(newMD5)) {
|
||||
Log.e(TAG, "setBootanimationG10J: file md5 is the same");
|
||||
} else {
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
if (file.delete()) {
|
||||
Log.e(TAG, "setBootanimationG10J: delete old Bootanimation file successful");
|
||||
} else {
|
||||
Toaster.show("删除动画文件失败");
|
||||
}
|
||||
}
|
||||
if (FileUtils.copy(newFile, file)) {
|
||||
Log.e(TAG, "setBootanimationG10J: set Bootanimation successful");
|
||||
} else {
|
||||
Log.e(TAG, "setBootanimationG10J: set Bootanimation failed");
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent("com.hra.setBootanimation");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public void removeBootanimation() {
|
||||
File systemFile = new File(BOOTANIMATION_PATH);
|
||||
File systemFile;
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
systemFile = new File(BOOTANIMATION_PATH_G10J);
|
||||
} else {
|
||||
systemFile = new File(BOOTANIMATION_PATH);
|
||||
}
|
||||
if (systemFile.exists()) {
|
||||
if (systemFile.delete()) {
|
||||
Log.e(TAG, "removeBootanimation: delete: " + "ture");
|
||||
@@ -1788,6 +1856,10 @@ public class JGYUtils {
|
||||
Log.e(TAG, "removeBootanimation: delete: " + "false");
|
||||
}
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
Intent intent = new Intent("com.hra.setBootanimation");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void copy(String oldPath, String newPath) {
|
||||
@@ -1813,10 +1885,25 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static int changeNum(int status) {
|
||||
return status == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state 1打开 0关闭
|
||||
*/
|
||||
public void setDeveloperOptions(int state) {
|
||||
Log.e(TAG, "getDeveloper: " + state);
|
||||
int newStatu = changeNum(state);
|
||||
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
if (oldStatu == newStatu) {
|
||||
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "getDeveloper: state = " + state);
|
||||
Log.e(TAG, "setDeveloperOptions: " + JGYUtils.getInstance().checkAppPlatform());
|
||||
if (!BuildConfig.DEBUG) {
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
//这个需要反着来
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.CubePlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|
||||
@@ -1826,11 +1913,14 @@ public class JGYUtils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
|
||||
) {
|
||||
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state == 1 ? 0 : 1);
|
||||
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state == 1 ? 0 : 1);
|
||||
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
|
||||
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
|
||||
}
|
||||
if (state == 1) {
|
||||
|
||||
/*已废弃 为1关闭,为0打开*/
|
||||
if (newStatu == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
@@ -1838,8 +1928,8 @@ public class JGYUtils {
|
||||
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
|
||||
} else {
|
||||
Log.e(TAG, "getDeveloper: " + "打开开发者模式");
|
||||
// ToastUtil.show("打开开发者模式");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2557,64 +2647,64 @@ public class JGYUtils {
|
||||
case "com.mediatek.camera":
|
||||
case "com.android.camera2":
|
||||
if (Settings.System.getInt(crv, "qch_app_camera", 0) == 1) {
|
||||
ToastUtil.show("摄像头已禁止使用");
|
||||
return false;
|
||||
Toaster.show("摄像头已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.dialer":
|
||||
if (Settings.System.getInt(crv, "qch_call_forbid", 0) == 1) {
|
||||
ToastUtil.show("电话已禁止使用");
|
||||
return false;
|
||||
Toaster.show("电话已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.gallery3d":
|
||||
if (Settings.System.getInt(crv, "qch_app_gallery", 1) == 1) {
|
||||
ToastUtil.show("图库已禁止使用");
|
||||
return false;
|
||||
Toaster.show("图库已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.documentsui":
|
||||
if (Settings.System.getInt(crv, "qch_app_filemanager", 1) == 1) {
|
||||
ToastUtil.show("文件已禁止使用");
|
||||
return false;
|
||||
Toaster.show("文件已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.deskclock":
|
||||
if (Settings.System.getInt(crv, "qch_app_deskclock", 0) == 1) {
|
||||
ToastUtil.show("时钟已禁止使用");
|
||||
return false;
|
||||
Toaster.show("时钟已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.music":
|
||||
if (Settings.System.getInt(crv, "qch_app_music", 1) == 1) {
|
||||
ToastUtil.show("音乐已禁止使用");
|
||||
return false;
|
||||
Toaster.show("音乐已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.soundrecorder":
|
||||
if (Settings.System.getInt(crv, "qch_app_soundrecorder", 1) == 1) {
|
||||
ToastUtil.show("录音机已禁止使用");
|
||||
return false;
|
||||
Toaster.show("录音机已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.aoleyun.browser":
|
||||
case "com.android.browser":
|
||||
if (Settings.System.getInt(crv, "qch_app_browser", 1) == 1) {
|
||||
ToastUtil.show("浏览器已禁止使用");
|
||||
return false;
|
||||
Toaster.show("浏览器已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "com.android.messaging":
|
||||
case "com.android.mms":
|
||||
if (Settings.System.getInt(crv, "qch_app_sms", 1) == 1) {
|
||||
ToastUtil.show("短信已禁止使用");
|
||||
return false;
|
||||
Toaster.show("短信已禁止使用");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2818,7 +2908,7 @@ public class JGYUtils {
|
||||
String apkPath = aolePath + File.separator + fileName;
|
||||
Log.e(TAG, "subscribe: " + apkPath);
|
||||
String pkg = ApkUtils.getPackageName(mContext, apkPath);
|
||||
if (mJxwApps.contains(pkg)) {
|
||||
if (ApkUtils.mJxwApp.contains(pkg)) {
|
||||
packageListMap.put(pkg, apkPath);
|
||||
} else {
|
||||
Log.e(TAG, "checkLocalAppInstall: skip: " + pkg + " fileName: " + fileName);
|
||||
@@ -2863,62 +2953,6 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Set<String> mJxwApps = new HashSet<String>() {{
|
||||
this.add("air.com.zhihuiyoujiao.flashplayer");
|
||||
this.add("com.example.arithmeticformula");
|
||||
this.add("com.example.elementcycleapp");
|
||||
this.add("com.example.pianpangbushou");
|
||||
this.add("com.iflytek.cyber.iot.show.core");
|
||||
this.add("com.iflytek.speechcloud");
|
||||
this.add("com.jxw.bihuamingcheng");
|
||||
this.add("com.jxw.bishunguize");
|
||||
this.add("com.jxw.characterlearning");
|
||||
this.add("com.jxw.dmxcy");
|
||||
this.add("com.jxw.englishsoundmark");
|
||||
this.add("com.jxw.examsystem");
|
||||
this.add("com.jxw.game");
|
||||
this.add("com.jxw.gb.zwpg");
|
||||
this.add("com.jxw.handwrite");
|
||||
this.add("com.jxw.jinfangyici");
|
||||
this.add("com.jxw.jxwbook");
|
||||
this.add("com.jxw.jxwcalculator");
|
||||
this.add("com.jxw.laboratory");
|
||||
this.add("com.jxw.learnchinesepinyin");
|
||||
this.add("com.jxw.letterstudynew");
|
||||
this.add("com.jxw.liancichengju");
|
||||
this.add("com.jxw.mskt.video");
|
||||
this.add("com.jxw.newyouer.video");
|
||||
this.add("com.jxw.online_study");
|
||||
this.add("com.jxw.question");
|
||||
this.add("com.jxw.schultegrid");
|
||||
this.add("com.jxw.singsound");
|
||||
this.add("com.jxw.studydigital");
|
||||
this.add("com.jxw.teacher.video");
|
||||
this.add("com.jxw.wuweijidanci");
|
||||
this.add("com.jxw.youer.video");
|
||||
this.add("com.jxw.yuwenxiezuo");
|
||||
this.add("com.jxw.yyhb");
|
||||
this.add("com.jxw.zncd");
|
||||
this.add("com.jxw.souti");
|
||||
this.add("com.jxw.xdfzq");
|
||||
this.add("com.oirsdfg89.flg");
|
||||
this.add("com.study.flashplayer");
|
||||
this.add("com.tech.translate");
|
||||
this.add("com.uiui.zybrowser");
|
||||
this.add("com.uiui.zysn ");
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.uiui.zyappstore");
|
||||
this.add("com.uiui.zy");
|
||||
this.add("com.uiui.zyos");
|
||||
this.add("com.teclast.zyos");
|
||||
this.add("com.teclast.zybrowser");
|
||||
this.add("com.teclast.zyappstore");
|
||||
this.add("com.teclast.zy");
|
||||
}};
|
||||
|
||||
|
||||
public static boolean isUnlocked(Context context) {
|
||||
int locked = Settings.System.getInt(context.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
@@ -3106,7 +3140,7 @@ public class JGYUtils {
|
||||
public void setTongyiAppTop() {
|
||||
if (ApkUtils.isAvailable(mContext, "com.tongyi.aistudent")) {
|
||||
ForegroundAppUtil.setTopAppClass(mContext, "com.tongyi.aistudent");
|
||||
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
|
||||
Settings.Global.putString(crv, ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
|
||||
ForegroundAppUtil.openTopApp(mContext);
|
||||
}
|
||||
}
|
||||
@@ -3133,11 +3167,14 @@ public class JGYUtils {
|
||||
* @return true为能打开
|
||||
*/
|
||||
public boolean isCloudLessonMod(String pkg) {
|
||||
if (JGYUtils.getInstance().isForbid(pkg)) {
|
||||
return false;
|
||||
}
|
||||
if (ApkUtils.isSystemApp(mContext, pkg)) {
|
||||
Log.e(TAG, "isCloudLessonMod: is system app");
|
||||
return true;
|
||||
}
|
||||
if (mJxwApps.contains(pkg)) {
|
||||
if (ApkUtils.mJxwApp.contains(pkg)) {
|
||||
return true;
|
||||
}
|
||||
if (mLessonJson == null)
|
||||
@@ -3150,6 +3187,7 @@ public class JGYUtils {
|
||||
if (mContralTime.inControlTime()) {
|
||||
return pkgs.contains(pkg);
|
||||
} else {
|
||||
Toaster.show("专注模式只允许使用指定应用");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3157,4 +3195,19 @@ public class JGYUtils {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAppName(String pkg) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo info = null;
|
||||
try {
|
||||
info = pm.getPackageInfo(pkg, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (info == null) {
|
||||
return "未知";
|
||||
} else {
|
||||
return info.applicationInfo.loadLabel(pm).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,12 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class SysSettingUtils {
|
||||
@@ -62,13 +65,15 @@ public class SysSettingUtils {
|
||||
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
|
||||
setUSBstate(context, jsonObject);
|
||||
setAdminApp(context, jsonObject);
|
||||
setSystemAppDisable(context, jsonObject);
|
||||
setNotification(context, jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context 关闭所有功能
|
||||
*/
|
||||
public static void setDisableSetting(Context context) {
|
||||
ToastUtil.debugShow("关闭所有功能");
|
||||
Toaster.debugShow("关闭所有功能");
|
||||
Log.e("setDisableSetting", "Close all settings: ");
|
||||
setPhoneList(context, 1);
|
||||
setUSBstate(context, 1);
|
||||
@@ -87,17 +92,19 @@ public class SysSettingUtils {
|
||||
setAutoTime(context, 1);
|
||||
setBrowserInput(context, 1);
|
||||
if (!BuildConfig.DEBUG) {
|
||||
JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
// JGYUtils.getInstance().setDeveloperOptions(0);
|
||||
}
|
||||
setStatusBar(context, 1);
|
||||
setAdminApp(context, 1);
|
||||
setSystemAppDisable(context, 0);
|
||||
setNotification(context, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context 开启所有功能
|
||||
*/
|
||||
public static void setEnableSetting(Context context) {
|
||||
ToastUtil.debugShow("打开所有功能");
|
||||
Toaster.debugShow("打开所有功能");
|
||||
setPhoneList(context, 0);
|
||||
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
|
||||
openMtp(context);
|
||||
@@ -113,9 +120,11 @@ public class SysSettingUtils {
|
||||
setCanReset(context, 0);
|
||||
setAutoTime(context, 0);
|
||||
setBrowserInput(context, 0);
|
||||
JGYUtils.getInstance().setDeveloperOptions(0);
|
||||
// JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
setStatusBar(context, 0);
|
||||
setAdminApp(context, 0);
|
||||
setSystemAppDisable(context, 0);
|
||||
setNotification(context, 1);
|
||||
}
|
||||
|
||||
private static void openMtp(Context context) {
|
||||
@@ -183,6 +192,11 @@ public class SysSettingUtils {
|
||||
//Midi模式:usb_midi
|
||||
if (!BuildConfig.DEBUG) {
|
||||
try {
|
||||
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
|
||||
if ("usb_charge".equals(oldUsb)) {
|
||||
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
|
||||
Log.e(TAG, "aole_usb_choose:" + aole_usb_choose);
|
||||
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
|
||||
@@ -211,6 +225,11 @@ public class SysSettingUtils {
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
String setting_usb = jsonObject.get("setting_usb").getAsString();
|
||||
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
|
||||
if (setting_usb.equals(oldUsb)) {
|
||||
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
|
||||
return;
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (JGYUtils.isCubeDevice()) {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
@@ -253,71 +272,117 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBluetooth(Context context, int state) {
|
||||
try {
|
||||
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
|
||||
//写入系统数据库
|
||||
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (aole_bht_forbid_on) {
|
||||
//成功
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
//获取默认蓝牙适配器
|
||||
}
|
||||
//蓝牙总开关开启
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
|
||||
mBluetoothAdapter.disable();
|
||||
//设置关闭时关闭蓝牙
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setBluetooth: " + e.getMessage());
|
||||
/**
|
||||
* @param context
|
||||
* @param state 1关闭 0打开
|
||||
*/
|
||||
private static void setBluetoothTransmission(Context context, int state) {
|
||||
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);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetoothTransmission: setting_bluetooth no changed");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBluetooth(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//蓝牙开关
|
||||
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
|
||||
//总开关
|
||||
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
|
||||
//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
|
||||
//蓝牙传输开关
|
||||
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
/**
|
||||
* @param context
|
||||
* @param state 1关闭 0打开
|
||||
*/
|
||||
private static void setBluetooth(Context context, int state) {
|
||||
Log.e(TAG, "setBluetooth: state = " + state);
|
||||
|
||||
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (aole_bht_forbid_on) {
|
||||
//成功
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
//获取默认蓝牙适配器
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
//蓝牙总开关开启
|
||||
String setting_context = jsonObject.get("setting_context").getAsString();
|
||||
if (setting_bhtvideo == 0) {
|
||||
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
|
||||
Log.e(TAG, "setting_context:" + setting_context);
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
|
||||
} else {
|
||||
mBluetoothAdapter.disable();
|
||||
//设置关闭时关闭蓝牙
|
||||
}
|
||||
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
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);
|
||||
|
||||
if (old_setting_bht != state) {
|
||||
if (state == 1) {//总开关关闭
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter.disable();
|
||||
}
|
||||
JGYUtils.getInstance().setBluetoothEnable(setting_bht == 1);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setBluetooth: " + e.getMessage());
|
||||
Settings.System.putInt(context.getContentResolver(), 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);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
|
||||
}
|
||||
|
||||
JGYUtils.getInstance().setBluetoothEnable(state == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param jsonObject 1关闭 0打开
|
||||
*/
|
||||
private static void setBluetooth(Context context, JsonObject jsonObject) {
|
||||
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
//需要转换
|
||||
//总开关
|
||||
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
|
||||
Log.e(TAG, "setBluetooth: setting_bht = " + setting_bht);
|
||||
//蓝牙数据功能管控
|
||||
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth = " + setting_bluetooth);
|
||||
//蓝牙音频功能管控
|
||||
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo = " + setting_bhtvideo);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
if (old_setting_bht != setting_bht) {
|
||||
if (setting_bht == 1) {//总开关关闭
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter.disable();
|
||||
}
|
||||
Settings.System.putInt(context.getContentResolver(), 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);
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
|
||||
}
|
||||
|
||||
if (old_setting_bhtvideo != setting_bhtvideo) {
|
||||
mmkv.encode(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_bhtvideo);
|
||||
String setting_context = jsonObject.get("setting_context").getAsString();
|
||||
if (setting_bhtvideo == 0) {
|
||||
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
|
||||
Log.e(TAG, "setting_context:" + setting_context);
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else if (setting_bhtvideo == 1) {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
|
||||
}
|
||||
|
||||
JGYUtils.getInstance().setBluetoothEnable(setting_bht == 1);
|
||||
}
|
||||
|
||||
private static void setHotspot(Context context, int state) {
|
||||
@@ -562,92 +627,11 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
private static void setIcon(Context context, int state) {
|
||||
try {
|
||||
//设置5个app的开关
|
||||
//时钟
|
||||
// int deskclock = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", state);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
|
||||
Log.e(TAG, "qch_app_deskclock" + state);
|
||||
//录音机
|
||||
// int soundrecorder = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", state);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
|
||||
Log.e(TAG, "qch_app_soundrecorder" + state);
|
||||
//音乐
|
||||
// int music = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", state);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
|
||||
Log.e(TAG, "qch_app_music" + state);
|
||||
//图库
|
||||
// int gallery = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", state);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
|
||||
Log.e(TAG, "qch_app_gallery" + state);
|
||||
//文件管理器
|
||||
// int filemanager = 1;
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", state);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
|
||||
} else {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.documentsui");
|
||||
}
|
||||
Log.e(TAG, "qch_app_filemanager" + state);
|
||||
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", state);
|
||||
Log.e(TAG, "qch_app_browser" + state);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setIcon: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIcon(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//added:2019.12.6
|
||||
//设置5个app的开关
|
||||
//时钟
|
||||
int deskclock = changeNum(jsonObject.get("setting_clock").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
|
||||
Log.e(TAG, "qch_app_deskclock" + deskclock);
|
||||
//录音机
|
||||
int soundrecorder = changeNum(jsonObject.get("setting_recording").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
|
||||
Log.e(TAG, "qch_app_soundrecorder" + soundrecorder);
|
||||
//音乐
|
||||
int music = changeNum(jsonObject.get("setting_music").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", music);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
|
||||
Log.e(TAG, "qch_app_music" + music);
|
||||
//图库
|
||||
int gallery = changeNum(jsonObject.get("setting_picture").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", gallery);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
|
||||
Log.e(TAG, "qch_app_gallery" + gallery);
|
||||
//壁纸
|
||||
int wallpaper = changeNum(jsonObject.get("setting_wallpaper").getAsInt());
|
||||
setWallpaper(context, wallpaper);
|
||||
//文件管理器
|
||||
int filemanager = changeNum(jsonObject.get("setting_file").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
|
||||
} else {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.documentsui");
|
||||
}
|
||||
Log.e(TAG, "qch_app_filemanager" + filemanager);
|
||||
//浏览器
|
||||
int browser = changeNum(jsonObject.get("setting_browser").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", browser);
|
||||
Log.e(TAG, "qch_app_browser" + browser);
|
||||
//短信
|
||||
int setting_sms = changeNum(jsonObject.get("setting_sms").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", setting_sms);
|
||||
Log.e(TAG, "qch_app_sms" + setting_sms);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setIcon: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void setWallpaper(Context context, int state) {
|
||||
@@ -847,6 +831,7 @@ public class SysSettingUtils {
|
||||
} else {
|
||||
Settings.Global.putString(context.getContentResolver(), "admin_app_category", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void setAdminApp(Context context, int state) {
|
||||
@@ -855,6 +840,78 @@ public class SysSettingUtils {
|
||||
Settings.Global.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", 0);
|
||||
}
|
||||
|
||||
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));
|
||||
} else {
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @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);
|
||||
}
|
||||
|
||||
public static void setSnSetting(Context context, SnSetting snSetting) {
|
||||
if (snSetting != null) {
|
||||
@@ -878,9 +935,9 @@ public class SysSettingUtils {
|
||||
int is_usb = snSetting.getIs_usb();
|
||||
setUsb(context, is_usb);
|
||||
int is_bluetooth_file = snSetting.getIs_bluetooth_file();
|
||||
setBluetooth(context, changeNum(is_bluetooth_file));
|
||||
setBluetoothTransmission(context, changeNum(is_bluetooth_file));
|
||||
int is_developer = snSetting.getIs_developer();
|
||||
JGYUtils.getInstance().setDeveloperOptions(changeNum(is_developer));
|
||||
JGYUtils.getInstance().setDeveloperOptions(is_developer);
|
||||
int is_restore = snSetting.getIs_restore();
|
||||
setCanReset(context, changeNum(is_restore));
|
||||
int is_topbar = snSetting.getIs_topbar();
|
||||
@@ -898,11 +955,8 @@ public class SysSettingUtils {
|
||||
}
|
||||
Settings.Global.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 1);
|
||||
setUsb(context, 0);
|
||||
setBluetooth(context, 0);
|
||||
int status = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
if (status != 0) {
|
||||
JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
}
|
||||
setBluetoothTransmission(context, 0);
|
||||
JGYUtils.getInstance().setDeveloperOptions(0);
|
||||
setCanReset(context, 0);
|
||||
setActionBar(context, 0);
|
||||
setNavigationBar(context, 0);
|
||||
@@ -954,6 +1008,15 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
private static void setUsb(Context context, int status) {
|
||||
Log.e(TAG, "setUsb: " + status);
|
||||
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
int oldStatus = mmkv.decodeInt(CommonConfig.AOLE_ACTION_USB_CODE, 0);
|
||||
if (oldStatus == status) {
|
||||
Log.e(TAG, "setUsb: oldStatus = " + oldStatus + " no changed");
|
||||
return;
|
||||
}
|
||||
mmkv.encode(CommonConfig.AOLE_ACTION_USB_CODE, status);
|
||||
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
@@ -996,5 +1059,31 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setNotification(Context context, JsonObject jsonObject) {
|
||||
if (jsonObject.get("is_notification") != null) {
|
||||
int status = jsonObject.get("is_notification").getAsInt();
|
||||
Log.e(TAG, "setNotification: status = " + status);
|
||||
setNotification(context, status);
|
||||
} else {
|
||||
Log.e(TAG, "setNotification: JsonElement not found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param status 字段is notification 1开启 0 关闭
|
||||
*/
|
||||
public static void setNotification(Context context, int status) {
|
||||
Intent intent = new Intent();
|
||||
switch (status) {
|
||||
default:
|
||||
case 1:
|
||||
intent.setAction("aole_show_appinfo");
|
||||
break;
|
||||
case 0:
|
||||
intent.setAction("aole_hide_appinfo");
|
||||
break;
|
||||
}
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.aoleyun.sn.utils;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.blankj.utilcode.util.ColorUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
|
||||
public class ToastUtil {
|
||||
private static final String TAG = ToastUtil.class.getSimpleName();
|
||||
|
||||
public static void show(final String msg) {
|
||||
ToastUtils.make()
|
||||
.setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.WHITE)
|
||||
.setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.show(msg);
|
||||
}
|
||||
|
||||
public static void debugShow(final String msg) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
ToastUtils.make()
|
||||
.setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.RED)
|
||||
.setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.setDurationIsLong(true)
|
||||
.show(msg);
|
||||
} else {
|
||||
Log.e(TAG, "debugShow: " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showCenter(final String msg) {
|
||||
ToastUtils.make()
|
||||
.setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.WHITE)
|
||||
.setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.show(msg);
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ 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.hjq.toast.Toaster;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -1072,7 +1073,7 @@ public class Utils {
|
||||
*/
|
||||
synchronized public static void doMasterClear(Context context) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
ToastUtil.show("收到重置设备推送消息");
|
||||
Toaster.show("收到重置设备推送消息");
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
||||
@@ -1774,6 +1775,7 @@ public class Utils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
|
||||
) {
|
||||
return Utils.getProperty("ro.build.display.id", "获取失败");
|
||||
} else {
|
||||
|
||||
@@ -19,6 +19,7 @@ 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 org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
@@ -97,7 +98,7 @@ public class XAPKUtils {
|
||||
String jsonString = JsonUtils.readJsonFile(unpackDir.getAbsolutePath() + File.separator + "manifest.json");
|
||||
emitter.onNext(jsonString);
|
||||
} else {
|
||||
ToastUtil.show("读取XAPK配置文件失败");
|
||||
Toaster.show("读取XAPK配置文件失败");
|
||||
emitter.onComplete();
|
||||
}
|
||||
}
|
||||
@@ -335,7 +336,7 @@ public class XAPKUtils {
|
||||
}
|
||||
// boolean copySuccess = ;
|
||||
// if (copySuccess) {
|
||||
ToastUtil.show("正在安装应用");
|
||||
Toaster.show("正在安装应用");
|
||||
install(packageInstaller, sessionId, context);
|
||||
// }
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user