Skip to content

Commit

Permalink
Update CrashRecord.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Nov 5, 2023
1 parent f6cd35d commit 5243d7f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/src/main/java/com/sevtinge/hyperceiler/CrashRecord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.sevtinge.hyperceiler

import android.annotation.SuppressLint
import android.content.Context
import com.sevtinge.hyperceiler.module.base.BaseXposedInit.isSafeModeOn
import com.sevtinge.hyperceiler.utils.PrefsUtils.mPrefsName
import de.robv.android.xposed.XposedBridge

Expand Down Expand Up @@ -29,12 +30,9 @@ object CrashRecord : Thread.UncaughtExceptionHandler {
}
if (System.currentTimeMillis() - pref.getLong("last_time", 0L) < 60 * 1000L) {
XposedBridge.log("[HyperCeiler][W]: Crash happened again in one minute")
if (pref.getInt("times", 0) >= 5) {
it.createDeviceProtectedStorageContext().getSharedPreferences(mPrefsName, Context.MODE_PRIVATE).edit().apply {
clear()
apply()
}
XposedBridge.log("[HyperCeiler][W]: More than five times, clear MODULE_CONFIG")
if (pref.getInt("times", 0) >= 3) {
isSafeModeOn = true
XposedBridge.log("[HyperCeiler][W]: More than 3 times, clear MODULE_CONFIG")
pref.edit().putInt("times", 0).apply()
}
pref.edit().putInt("times", pref.getInt("times", 0) + 1).apply()
Expand Down

0 comments on commit 5243d7f

Please sign in to comment.