From 576419bbf2b1ebba30a2a95b3f61ab25f999de5a Mon Sep 17 00:00:00 2001 From: Fanhuitong <981964879@qq.com> Date: Mon, 20 Nov 2023 15:02:29 +0800 Subject: [PATCH] =?UTF-8?q?version:3.1.0=20fix:=E9=BB=98=E8=AE=A4=E6=89=93?= =?UTF-8?q?=E5=BC=80=E9=87=8D=E7=BD=AE=E9=80=89=E9=A1=B9=20update:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 ++ .../com/fuying/sn/base/BaseApplication.java | 6 +++- .../fuying/sn/desktop/RunningAppManager.java | 35 ++++++------------- .../com/fuying/sn/manager/ControlManager.java | 10 +++--- .../com/fuying/sn/manager/DeviceManager.java | 13 +++---- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 561d8bb..ef4cf8f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -481,6 +481,8 @@ dependencies { implementation "org.java-websocket:Java-WebSocket:1.5.3" //MMKV implementation 'com.tencent:mmkv-static:1.2.13' + //bugly + implementation 'com.tencent.bugly:crashreport:4.1.9.2' //腾讯移动推送 TPNS implementation 'com.tencent.tpns:tpns:1.3.2.0-release' //百度地图 diff --git a/app/src/main/java/com/fuying/sn/base/BaseApplication.java b/app/src/main/java/com/fuying/sn/base/BaseApplication.java index e4448d0..045c3dd 100644 --- a/app/src/main/java/com/fuying/sn/base/BaseApplication.java +++ b/app/src/main/java/com/fuying/sn/base/BaseApplication.java @@ -19,6 +19,7 @@ import com.fuying.sn.service.main.MainService; import com.tencent.android.tpush.XGIOperateCallback; import com.tencent.android.tpush.XGPushConfig; import com.tencent.android.tpush.XGPushManager; +import com.tencent.bugly.crashreport.CrashReport; import com.tencent.mmkv.MMKV; import com.fuying.sn.BuildConfig; import com.fuying.sn.desktop.RunningAppManager; @@ -72,11 +73,14 @@ public class BaseApplication extends Application { String rootDir = MMKV.initialize(this); Log.i(TAG, "mmkv root: " + rootDir); + JGYUtils.init(this); + CrashReport.initCrashReport(getApplicationContext(), "e5f026c8d5", false); + CrashReport.setDeviceId(this, Utils.getSerial()); + LogDBManager.init(this); ConnectManager.init(this); Aria.init(this); Aria.download(this).resumeAllTask(); - JGYUtils.init(this); RunningAppManager.init(this); TimeControlManager.init(this); ControlManager.init(this); diff --git a/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java b/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java index b49d4b6..8255fd5 100644 --- a/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java +++ b/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java @@ -583,6 +583,17 @@ public class RunningAppManager { boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg); MachineControl machineControl = TimeControlManager.getInstance().getGlobalMachineControl(); + Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime); + if (globalRemainingTime <= 0) { + if (machineControl != null) { + if (machineControl.getIs_part() == 0 && machineControl.getIs_quota() == 0) { + return; + } + } else { + ToastUtil.show("今日可使用时间已用完"); + return; + } + } if (havaConfigure) { AppTimeControl appTimeControl = TimeControlManager.getInstance().getAppTimeControl(pkg); //全局配置的 @@ -604,19 +615,6 @@ public class RunningAppManager { } else { mGlobalUsageTime.remove(pkg); } - - Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime); - if (globalRemainingTime <= 0) { - if (machineControl != null) { - if (machineControl.getIs_part() == 0 && machineControl.getIs_quota() == 0) { - return; - } - } else { - ToastUtil.show("今日可使用时间已用完"); - return; - } - } - //单个app的 AppUsageTime singleAppUsageTime; if (mAllAppUsageTime.get(pkg) == null) { @@ -648,17 +646,6 @@ public class RunningAppManager { if (machineControl == null) { return; } - Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime); - if (globalRemainingTime <= 0) { - if (machineControl != null) { - if (machineControl.getIs_part() == 0 && machineControl.getIs_quota() == 0) { - return; - } - } else { - ToastUtil.show("今日可使用时间已用完"); - return; - } - } Log.i(TAG, "reduceAppRemainingTime: " + machineControl.getToday_time()); long remainingTime = machineControl.getToday_time() - time; if (remainingTime < 0) { diff --git a/app/src/main/java/com/fuying/sn/manager/ControlManager.java b/app/src/main/java/com/fuying/sn/manager/ControlManager.java index 0e4feb9..d13a474 100644 --- a/app/src/main/java/com/fuying/sn/manager/ControlManager.java +++ b/app/src/main/java/com/fuying/sn/manager/ControlManager.java @@ -631,12 +631,12 @@ public class ControlManager { private void setCanReset(SystemSettings settings) { int mode = settings.getQch_restore(); - if (mode == 1) { +// if (mode == 1) { +// Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0); +// } else { Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0); - } else { - Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1); - } - closeSettingsApp(); +// } +// closeSettingsApp(); Log.e(TAG, "aole_restore_forbid_on:" + mode); } diff --git a/app/src/main/java/com/fuying/sn/manager/DeviceManager.java b/app/src/main/java/com/fuying/sn/manager/DeviceManager.java index 2dffd5d..af34345 100644 --- a/app/src/main/java/com/fuying/sn/manager/DeviceManager.java +++ b/app/src/main/java/com/fuying/sn/manager/DeviceManager.java @@ -58,12 +58,12 @@ public class DeviceManager { * 重置,恢复出厂设置 */ synchronized public static void doMasterClear() { - if (isDebugMode()) { - ToastUtil.show("收到重置设备推送消息"); - return; - } +// if (isDebugMode()) { +// ToastUtil.show("收到重置设备推送消息"); +// return; +// } if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) { - Intent intent = new Intent("android.intent.action.FACTORY_RESET"); + Intent intent = new Intent(Intent.ACTION_FACTORY_RESET); intent.setPackage("android"); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.putExtra("android.intent.extra.REASON", "MasterClearConfirm"); @@ -71,8 +71,9 @@ public class DeviceManager { intent.putExtra("com.android.internal.intent.extra.WIPE_ESIMS", false); mContext.sendBroadcast(intent); } else { - Intent intent = new Intent("android.intent.action.MASTER_CLEAR"); + Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR); // intent.setPackage("com.android.settings"); +// intent.setPackage("android"); mContext.sendBroadcast(intent); } }