1.5.0513
bugfixes:增加应用禁用和卸载监听
This commit is contained in:
@@ -1364,6 +1364,10 @@ public class JgyUtils {
|
||||
SysSettingUtils.setDisableSetting(mContext);
|
||||
SPUtils.put(mContext, JGYActions.ACTION_STATUSBAR_STATUS, "");
|
||||
} else {
|
||||
if (JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.ZR6016Tag)) {
|
||||
Log.e(TAG, "SettingSysData: ZR6016Tag");
|
||||
SysSettingUtils.setBluetooth(mContext, 0);
|
||||
}
|
||||
SysSettingUtils.setSystemSetting(mContext, data);
|
||||
}
|
||||
}
|
||||
@@ -1441,14 +1445,15 @@ public class JgyUtils {
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void writeAppPackageList(String packageList) {
|
||||
public void writeAppPackageList(List<String> pkgs) {
|
||||
if (isUnlocked(mContext)) {
|
||||
addAppInstallWhiteList(new ArrayList<>());
|
||||
setAppRestriction(0);
|
||||
return;
|
||||
}
|
||||
ApkUtils.addShortcut(mContext);
|
||||
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
|
||||
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
|
||||
pkgSet.addAll(pkgs);
|
||||
pkgSet.addAll(getWhitePkgList());
|
||||
pkgSet.removeIf(TextUtils::isEmpty);
|
||||
String aole_app_forbid = String.join(",", pkgSet);
|
||||
@@ -1701,29 +1706,23 @@ public class JgyUtils {
|
||||
}
|
||||
|
||||
Log.e(TAG, "deleteOtherApp: " + "start");
|
||||
String[] result_white = new String[]{};
|
||||
String[] result_forbid = new String[]{};
|
||||
//获取后台应用白名单
|
||||
String only_jgy_shortcut_list = Settings.System.getString(crv, JGYActions.ACTION_JGY_SHORTCUTLIST);
|
||||
if (!TextUtils.isEmpty(only_jgy_shortcut_list)) {
|
||||
result_white = only_jgy_shortcut_list.split(",");
|
||||
}
|
||||
Set<String> allAppWhiteSet = mMMKV.decodeStringSet(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY, new HashSet<>());
|
||||
Log.e("deleteOtherApp", "allAppWhiteSet:" + allAppWhiteSet);
|
||||
|
||||
List<String> resulWhitetList = new ArrayList<>(defaultPackages);
|
||||
resulWhitetList.addAll(allAppWhiteSet);
|
||||
//获取可以被安装的包名
|
||||
String aole_app_forbid = Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID);
|
||||
if (!TextUtils.isEmpty(aole_app_forbid)) {
|
||||
result_forbid = aole_app_forbid.split(",");
|
||||
}
|
||||
Log.e("deleteOtherApp", "only_jgy_shortcut_list:" + only_jgy_shortcut_list);
|
||||
Log.e("deleteOtherApp", "aole_app_forbid:" + aole_app_forbid);
|
||||
if (!TextUtils.isEmpty(aole_app_forbid)) {
|
||||
List<String> result_forbid = new ArrayList<>(Arrays.asList(aole_app_forbid.split(",")));
|
||||
resulWhitetList.addAll(result_forbid);
|
||||
}
|
||||
|
||||
List<String> resulWhitetList = new ArrayList<>(Arrays.asList(result_white));
|
||||
List<String> resulForbidtList = new ArrayList<>(Arrays.asList(result_forbid));
|
||||
resulWhitetList.addAll(resulForbidtList);
|
||||
HashSet<String> allWhitePkg = new HashSet<>(resulWhitetList);
|
||||
List<String> installedPackageList = ApkUtils.queryFilterAppInfo(mContext);
|
||||
|
||||
Log.e("deleteOtherApp", "installedPackageList:" + installedPackageList.toString());
|
||||
if (allWhitePkg.size() > 0) {
|
||||
if (resulWhitetList.size() > 0) {
|
||||
for (final String packageName : installedPackageList) {
|
||||
if (ApkUtils.isSystemApp(mContext, packageName)) {
|
||||
Log.e("deleteOtherApp", "is systemApp:" + packageName);
|
||||
@@ -1748,7 +1747,7 @@ public class JgyUtils {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (!allWhitePkg.contains(packageName)) {
|
||||
if (!resulWhitetList.contains(packageName)) {
|
||||
ApkUtils.UninstallAPP(mContext, packageName);
|
||||
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
|
||||
}
|
||||
@@ -2039,22 +2038,17 @@ public class JgyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static int changeNum(int status) {
|
||||
return status == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state 1打开 0关闭
|
||||
*/
|
||||
public void setDeveloperOptions(int state) {
|
||||
int newStatu = changeNum(state);
|
||||
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
if (oldStatu == newStatu) {
|
||||
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0);
|
||||
if (oldStatu == state) {
|
||||
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
|
||||
}
|
||||
Log.e(TAG, "getDeveloper: state = " + state);
|
||||
//这个需要反着来
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
|
||||
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
|
||||
|
||||
@@ -2203,6 +2197,7 @@ public class JgyUtils {
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void cleanLauncherCache() {
|
||||
Log.e(TAG, "cleanLauncherCache: Start");
|
||||
int cleaned = (int) SPUtils.get(mContext, "fristcleanLauncherCache", 0);
|
||||
@@ -3524,4 +3519,48 @@ public class JgyUtils {
|
||||
|| "G11J".equals(Build.MODEL);
|
||||
}
|
||||
|
||||
public void checkAoleyunApp() {
|
||||
boolean availableSn = ApkUtils.isAvailable(mContext, "com.aoleyun.sn");
|
||||
boolean disableSn = ApkUtils.isDisable(mContext, "com.aoleyun.sn");
|
||||
Log.e(TAG, "checkAoleyunApp: sn isAvailable = " + availableSn);
|
||||
if (!availableSn || disableSn) {
|
||||
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.sn");
|
||||
Log.e(TAG, "checkAoleyunApp: sn install = " + installResult);
|
||||
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.sn");
|
||||
Log.e(TAG, "checkAoleyunApp: sn enable = " + enableResult);
|
||||
}
|
||||
|
||||
boolean availableAudos = ApkUtils.isAvailable(mContext, "com.aoleyun.audos");
|
||||
boolean disableAudos = ApkUtils.isDisable(mContext, "com.aoleyun.audos");
|
||||
Log.e(TAG, "checkAoleyunApp: audos isAvailable = " + availableAudos);
|
||||
if (!availableAudos || disableAudos) {
|
||||
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.audos");
|
||||
Log.e(TAG, "checkAoleyunApp: audos install = " + installResult);
|
||||
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.audos");
|
||||
Log.e(TAG, "checkAoleyunApp: audos enable = " + enableResult);
|
||||
}
|
||||
|
||||
boolean availableOs = ApkUtils.isAvailable(mContext, "com.aoleyun.os");
|
||||
boolean disableOs = ApkUtils.isDisable(mContext, "com.aoleyun.os");
|
||||
Log.e(TAG, "checkAoleyunApp: os isAvailable = " + availableOs);
|
||||
if (!availableOs || disableOs) {
|
||||
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.os");
|
||||
Log.e(TAG, "checkAoleyunApp: os install = " + installResult);
|
||||
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.os");
|
||||
Log.e(TAG, "checkAoleyunApp: os enable = " + enableResult);
|
||||
}
|
||||
|
||||
|
||||
// boolean availableAppstore = ApkUtils.isAvailable(mContext, "com.aoleyun.appstore");
|
||||
// boolean disableAppstore = ApkUtils.isDisable(mContext, "com.aoleyun.audos");
|
||||
// Log.e(TAG, "checkAoleyunApp: appstore isAvailable = " + availableAppstore);
|
||||
// if (!availableAppstore || disableAppstore) {
|
||||
// CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.appstore");
|
||||
// Log.e(TAG, "checkAoleyunApp: appstore install = " + installResult);
|
||||
// CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.appstore");
|
||||
// Log.e(TAG, "checkAoleyunApp: appstore enable = " + enableResult);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user