version:
bugfixes:对接分组标签和强制下载分组应用,增加地理围栏接口,地理围栏功能未实现
This commit is contained in:
@@ -25,6 +25,7 @@ import android.view.WindowManager;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.bean.ApkInfoPush;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.BatteryInfo;
|
||||
import com.aoleyun.sn.bean.DownloadInfo;
|
||||
@@ -266,12 +267,19 @@ public class PushManager {
|
||||
private static final String GROUP_APP_INSTALL = "80";
|
||||
/*分组应用卸载*/
|
||||
private static final String GROUP_APP_UNINSTALL = "81";
|
||||
/*电子围栏*/
|
||||
private static final String ELECTRONIC_FENCE = "82";
|
||||
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
case MSG_DELETE:
|
||||
Toaster.debugShow("收到管控:应用删除");
|
||||
deleteApp(extras);
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
String pkg = jsonObject.get("package_name").getAsString();
|
||||
deleteApp(pkg);
|
||||
}
|
||||
break;
|
||||
case MSG_SETTING:
|
||||
Toaster.debugShow("收到管控:系统设置");
|
||||
@@ -308,6 +316,7 @@ public class PushManager {
|
||||
|
||||
sendRefreshBroadcast(mContext);
|
||||
break;
|
||||
|
||||
case MSG_INSTALL:
|
||||
Toaster.debugShow("收到管控:应用安装");
|
||||
doDownloadAndInstall(extras);
|
||||
@@ -341,26 +350,9 @@ public class PushManager {
|
||||
NetInterfaceManager.getInstance().sendAppUsedTime(random, sendType);
|
||||
break;
|
||||
case GET_FORCEDOWNLOADURL:
|
||||
case GROUP_APP_INSTALL:
|
||||
Toaster.debugShow("收到管控:应用强制安装");
|
||||
File file = new File(JgyUtils.getInstance().getDownLoadPath());
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(extras)) {
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
JsonObject extra = GsonUtils.getJsonObject(extras);
|
||||
String app_name = extra.get("app_name").getAsString();
|
||||
String app_package = extra.get("package").getAsString();
|
||||
String url = extra.get("url").getAsString();
|
||||
int versionCode = extra.get("version_code").getAsInt();
|
||||
String app_id = extra.get("app_id").getAsString();
|
||||
JsonObject packageObj = new JsonObject();
|
||||
packageObj.addProperty("app_name", app_name);
|
||||
packageObj.addProperty("app_package", app_package);
|
||||
packageObj.addProperty("app_id", app_id);
|
||||
Utils.ariaDownload(mContext, url, packageObj);
|
||||
downloadForceInstallApk(extras);
|
||||
break;
|
||||
case SET_HOMEPAG_TAG:
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@@ -558,6 +550,7 @@ public class PushManager {
|
||||
NetInterfaceManager.getInstance().getAppLimit();
|
||||
break;
|
||||
case UPDATE_BATCH:
|
||||
case UPDATE_CHILD_BATCH:
|
||||
Toaster.debugShow("收到管控:更换批次不恢复出厂设置");
|
||||
NetInterfaceManager.getInstance().setPushTags();
|
||||
Aria.download(this).removeAllTask(true);
|
||||
@@ -681,16 +674,34 @@ public class PushManager {
|
||||
case SET_WALLPAPER:
|
||||
setWallpaper(extras);
|
||||
break;
|
||||
case UPDATE_CHILD_BATCH:
|
||||
break;
|
||||
case GROUP_APP_INSTALL:
|
||||
break;
|
||||
case GROUP_APP_UNINSTALL:
|
||||
Toaster.debugShow("收到管控:应用删除");
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
String pkg = jsonObject.get("app_package").getAsString();
|
||||
deleteApp(pkg);
|
||||
}
|
||||
case ELECTRONIC_FENCE:
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void downloadForceInstallApk(String extras) {
|
||||
File file = new File(JgyUtils.getInstance().getDownLoadPath());
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(extras)) {
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
ApkInfoPush apkInfoPush = GsonUtils.toJavaObject(extras, ApkInfoPush.class);
|
||||
JsonObject packageObj = GsonUtils.getJsonObject(GsonUtils.toJSONString(apkInfoPush));
|
||||
Utils.ariaDownload(mContext, apkInfoPush.getApp_url(), packageObj);
|
||||
}
|
||||
|
||||
private void setWallpaper(String extras) {
|
||||
NetInterfaceManager.getInstance().getWallpaper();
|
||||
}
|
||||
@@ -705,23 +716,20 @@ public class PushManager {
|
||||
NetInterfaceManager.getInstance().getCloudLessonSettings();
|
||||
}
|
||||
|
||||
private void deleteApp(String extras) {
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
String pkg = jsonObject.get("package_name").getAsString();
|
||||
if (TextUtils.isEmpty(pkg)) return;
|
||||
String forceApp = Settings.System.getString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP);
|
||||
if (!TextUtils.isEmpty(forceApp)) {
|
||||
List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(",")));
|
||||
forceAppList.remove(pkg);
|
||||
if (forceAppList.size() != 0) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
}
|
||||
private void deleteApp(String pkg) {
|
||||
Log.e(TAG, "deleteApp: " + pkg);
|
||||
if (TextUtils.isEmpty(pkg)) return;
|
||||
String forceApp = Settings.System.getString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP);
|
||||
if (!TextUtils.isEmpty(forceApp)) {
|
||||
List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(",")));
|
||||
forceAppList.remove(pkg);
|
||||
if (forceAppList.size() != 0) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
}
|
||||
ApkUtils.UninstallAPP(mContext, pkg);
|
||||
}
|
||||
ApkUtils.UninstallAPP(mContext, pkg);
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user