version:3.6
fix:修复强制应用无法卸载 update:增加手动推送安装白名单
This commit is contained in:
@@ -67,8 +67,8 @@ android {
|
||||
productFlavors {
|
||||
beta {
|
||||
flavorDimensions "default"
|
||||
versionCode 25
|
||||
versionName "3.4"
|
||||
versionCode 27
|
||||
versionName "3.6"
|
||||
}
|
||||
|
||||
official {
|
||||
|
||||
@@ -67,6 +67,7 @@ import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@@ -477,6 +478,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
private static final String ACTION_DEFAULT_INPUT_METHOD = "78";
|
||||
/*家长管控开关*/
|
||||
private static final String ACTION_PARENTAL_CONTROL = "79";
|
||||
/*更新白名单*/
|
||||
private static final String UPDATE_WHITE_LIST = "83";
|
||||
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
@@ -777,6 +780,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case ACTION_PARENTAL_CONTROL:
|
||||
NetInterfaceManager.getInstance().getSystemSettings();
|
||||
break;
|
||||
case UPDATE_WHITE_LIST:
|
||||
NetInterfaceManager.getInstance().getAllappPackage();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -1016,6 +1022,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
int sn_id = (int) SPUtils.get(context, "sn_id", -1);
|
||||
JsonObject object = GsonUtils.getJsonObject(jsonString);
|
||||
String packageName = object.get("app_package").getAsString();
|
||||
// 台电设备不删除无法静默卸载
|
||||
removeForceSettings(context, packageName);
|
||||
ToastUtil.debugShow("收到应用卸载消息:包名" + packageName);
|
||||
if (!"".equals(packageName) && !packageName.equals(context.getApplicationContext().getPackageName())) {
|
||||
if (!ApkUtils.isAvailable(context.getApplicationContext(), packageName)) {
|
||||
@@ -1026,6 +1034,16 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean removeForceSettings(Context context, String pkg) {
|
||||
String force_app = Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP);
|
||||
if (!TextUtils.isEmpty(force_app)) {
|
||||
Set<String> appSet = new HashSet<>(new ArrayList<>(Arrays.asList(force_app.split(","))));
|
||||
appSet.remove(pkg);
|
||||
return Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", appSet));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Disposable subscribe;
|
||||
private long cutdownTime = 30;
|
||||
private CustomDialog dialog;
|
||||
|
||||
Reference in New Issue
Block a user