1.4.0429 修改一键加速界面,去掉ToastUtil,对接权限和通知

This commit is contained in:
2024-05-08 14:33:06 +08:00
parent 08f5867864
commit 004de0cc2e
32 changed files with 885 additions and 527 deletions

View File

@@ -51,7 +51,6 @@ import com.aoleyun.sn.utils.MySQLData;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ServiceAliveUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.arialyy.aria.core.Aria;
import com.baidu.location.BDAbstractLocationListener;
@@ -62,6 +61,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.io.File;
@@ -251,44 +251,46 @@ public class PushManager {
public void setPushContent(String title, String extras) {
switch (title) {
case MSG_DELETE:
ToastUtil.debugShow("收到管控:应用删除");
Toaster.debugShow("收到管控:应用删除");
deleteApp(extras);
break;
case MSG_SETTING:
ToastUtil.debugShow("收到管控:系统设置");
Toaster.debugShow("收到管控:系统设置");
if (!TextUtils.isEmpty(extras)) {
JGYUtils.getInstance().SettingSysData(extras);
JGYUtils.getInstance().removeAllTask();
}
break;
case MSG_BROWSER:
ToastUtil.debugShow("收到管控:浏览器网址管控");
Toaster.debugShow("收到管控:浏览器网址管控");
getDeselectBrowerID();
break;
case MSG_APPID:
ToastUtil.debugShow("收到管控:APP ID管控");
Toaster.debugShow("收到管控:APP ID管控");
getDeselectID();
break;
case MSG_NET_CONTROL:
ToastUtil.debugShow("收到管控:应用联网管控");
Toaster.debugShow("收到管控:应用联网管控");
settingNetControl(extras);
break;
case MSG_POWER_ON:
ToastUtil.debugShow("收到管控:应用自启管控");
Toaster.debugShow("收到管控:应用自启管控");
settingPowerOn(extras);
break;
case MSG_RESET:
ToastUtil.debugShow("收到管控:设备重置");
Toaster.debugShow("收到管控:设备重置");
JGYUtils.getInstance().cleanAoleLauncher3Cache();
Utils.doMasterClear(mContext);
Aria.download(this).removeAllTask(true);
mMMKV.clearAll();
JGYUtils.getInstance().cleanAoleAppCache();
JGYUtils.getInstance().wakeUpAoleyunAPP();
NetInterfaceManager.getInstance().setPushTags();
sendRefreshBroadcast(mContext);
break;
case MSG_INSTALL:
ToastUtil.debugShow("收到管控:应用安装");
Toaster.debugShow("收到管控:应用安装");
doDownloadAndInstall(extras);
Handler.getMain().postDelayed(new Runnable() {
@Override
@@ -301,26 +303,26 @@ public class PushManager {
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case MSG_LOCK:
ToastUtil.debugShow("收到管控:设备锁定");
Toaster.debugShow("收到管控:设备锁定");
settingLock(extras);
break;
case MSG_CAMERA:
ToastUtil.debugShow("收到管控:相机管控");
Toaster.debugShow("收到管控:相机管控");
settingCamera(extras);
break;
case MSG_ONEPACKAGES:
ToastUtil.debugShow("收到管控:");
Toaster.debugShow("收到管控:");
settingOneNet(extras);
break;
case GET_APP_USEDTIME:
ToastUtil.debugShow("收到管控:获取应用使用时间");
Toaster.debugShow("收到管控:获取应用使用时间");
JsonObject usedTimeJson = GsonUtils.getJsonObject(extras);
String random = usedTimeJson.get("random").getAsString();
String sendType = usedTimeJson.get("type").getAsString();
NetInterfaceManager.getInstance().sendAppUsedTime(random, sendType);
break;
case GET_FORCEDOWNLOADURL:
ToastUtil.debugShow("收到管控:应用强制安装");
Toaster.debugShow("收到管控:应用强制安装");
File file = new File(JGYUtils.getInstance().getDownLoadPath());
if (!file.exists()) {
file.mkdirs();
@@ -352,21 +354,21 @@ public class PushManager {
Log.e(TAG, "setHomepagtag: " + e.getMessage());
}
setHomepagtag();
ToastUtil.debugShow("收到管控:浏览器主页书签设置");
Toaster.debugShow("收到管控:浏览器主页书签设置");
}
}, 2000);
break;
case APP_WEBSITE:
ToastUtil.debugShow("收到管控:APP内部网页管控");
Toaster.debugShow("收到管控:APP内部网页管控");
setAPPinsideWebsite(extras);
break;
case DISABLE_APPUPDATE:
ToastUtil.debugShow("收到管控:应用禁止更新设置");
Toaster.debugShow("收到管控:应用禁止更新设置");
setDisableUpdateList(extras);
break;
case HIDE_DESKTOP_ICON:
ToastUtil.debugShow("收到管控:隐藏应用设置");
Toaster.debugShow("收到管控:隐藏应用设置");
Handler.getMain().postDelayed(() -> {
//后台发送时数据库未改变,有时候可能获取到的数据时上一次的
Log.e(TAG, "run: HIDE_DESKTOP_ICON ");
@@ -374,23 +376,23 @@ public class PushManager {
}, 2000);
break;
case DISABLE_APP_SLIDE:
ToastUtil.debugShow("收到管控:应用滑动设置");
Toaster.debugShow("收到管控:应用滑动设置");
setDisableSlideList(extras);
break;
case UPDATE_INFO:
ToastUtil.debugShow("收到管控:更新白名单");
Toaster.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case SN_SCREENSHOT:
ToastUtil.debugShow("收到管控:设备截图");
Toaster.debugShow("收到管控:设备截图");
screenshot(extras);
break;
case DEVICES_REBOOT:
ToastUtil.debugShow("收到管控:设备重启");
Toaster.debugShow("收到管控:设备重启");
Utils.rebootDevices(mContext);
break;
case GET_DEVICES_INFO:
ToastUtil.debugShow("收到管控:获取设备信息");
Toaster.debugShow("收到管控:获取设备信息");
getBatteryInfo(mContext);
sendRefreshBroadcast(mContext);
LocationClient locationClient = MapManager.getInstance().getLocationClient();
@@ -479,65 +481,65 @@ public class PushManager {
});
break;
case LOCK_SCREEN:
ToastUtil.debugShow("收到管控:屏幕锁定");
Toaster.debugShow("收到管控:屏幕锁定");
// JsonObject lockJSONObject = GsonUtils.getJsonObject(extras);
// String name = lockJSONObject.get("name").getAsString();
setLock_screen(1, "锁屏管控中");
break;
case UNLOCK_SCREEN:
ToastUtil.debugShow("收到管控:屏幕解锁");
Toaster.debugShow("收到管控:屏幕解锁");
setLock_screen(0, "");
break;
case KILL_SERVER:
ToastUtil.debugShow("收到管控:停止应用");
Toaster.debugShow("收到管控:停止应用");
JsonObject killJSONObject = GsonUtils.getJsonObject(extras);
String packages = killJSONObject.get("package_name").getAsString();
JGYUtils.getInstance().killBackgroundProcesses(packages);
break;
case TIME_CONTROL:
ToastUtil.debugShow("收到管控:使用时间管控");
Toaster.debugShow("收到管控:使用时间管控");
getTimeControl(extras);
break;
case TOP_APP:
ToastUtil.debugShow("收到管控:应用霸屏");
Toaster.debugShow("收到管控:应用霸屏");
getTopApp(extras);
break;
case LOGO_IMG:
ToastUtil.debugShow("收到管控:开机动画设置");
Toaster.debugShow("收到管控:开机动画设置");
setBootanimation(extras);
Log.e(TAG, "processCustomMessage: " + extras);
break;
case DEFAULTP_APP:
ToastUtil.debugShow("收到管控:设置默认APP");
Toaster.debugShow("收到管控:设置默认APP");
setDefalutApp(extras);
break;
case PLAY_SOUND:
ToastUtil.debugShow("收到管控:查找设备");
Toaster.debugShow("收到管控:查找设备");
playSound(extras);
break;
case CLEAN_APP_CACHE:
ToastUtil.debugShow("收到管控:应用缓存清除");
Toaster.debugShow("收到管控:应用缓存清除");
cleanCache(extras);
break;
case DEVELOPER_OPTIONS:
ToastUtil.debugShow("收到管控:开发人员选项管控");
Toaster.debugShow("收到管控:开发人员选项管控");
setDeveloperoptions(extras);
break;
case GLOBAL_UPDATE:
ToastUtil.debugShow("收到管控:全局更新");
Toaster.debugShow("收到管控:全局更新");
GlobalUpdate(extras);
break;
case EBAG_CODE:
ToastUtil.debugShow("收到管控:电子书包激活码");
Toaster.debugShow("收到管控:电子书包激活码");
setEbagCode(extras);
JGYUtils.getInstance().killBackgroundProcesses("com.jxw.launcher");
break;
case UPDATE_WHITELIST:
ToastUtil.debugShow("收到管控:更新白名单");
Toaster.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case UPDATE_BATCH:
ToastUtil.debugShow("收到管控:更换批次不恢复出厂设置");
Toaster.debugShow("收到管控:更换批次不恢复出厂设置");
NetInterfaceManager.getInstance().setPushTags();
Aria.download(this).removeAllTask(true);
JGYUtils.getInstance().cleanAoleAppCache();
@@ -580,7 +582,7 @@ public class PushManager {
NetInterfaceManager.getInstance().getDefaultDesktop();
break;
case TAKE_FRONT_PICTURE:
ToastUtil.debugShow("收到推送消息: 截图");
Toaster.debugShow("收到推送消息: 截图");
long createTime = System.currentTimeMillis() / 1000;
Camera2BackgroundUtil camera2BackgroundUtil = new Camera2BackgroundUtil(mContext, new Camera2BackgroundUtil.CameraCallBack() {
@Override
@@ -1203,7 +1205,7 @@ public class PushManager {
int is_developer = jsonObject.get("is_developer").getAsInt();
Log.e(TAG + ":" + "getDeveloper", "onNext: " + is_developer);
Log.e(TAG, "setDeveloperoptions: " + is_developer);
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
JGYUtils.getInstance().setDeveloperOptions(is_developer);
}
private void GlobalUpdate(String jsonString) {
@@ -1335,7 +1337,7 @@ public class PushManager {
private CustomDialog dialog;
void bindService(final String jsonString) {
ToastUtil.debugShow("收到绑定设备请求");
Toaster.debugShow("收到绑定设备请求");
JsonObject object = GsonUtils.getJsonObject(jsonString);
// String userName = object.get("member_name").getAsString();
final String id = object.get("userId").getAsString();
@@ -1378,7 +1380,7 @@ public class PushManager {
@Override
public void onNegtiveClick() {
bind(id, 2);
ToastUtil.show("设备取消绑定");
Toaster.show("设备取消绑定");
dialog.dismiss();
dialog = null;
subscribe.dispose();
@@ -1426,10 +1428,10 @@ public class PushManager {
String msg = baseResponse.msg;
// Log.e("bind", baseResponse.toString());
if (code == 200) {
ToastUtil.show("绑定成功");
Toaster.show("绑定成功");
sendRefreshIntent();
} else if (code == 301) {
ToastUtil.show(msg);
Toaster.show(msg);
}
}