Skip to content

Commit

Permalink
去除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
heyanLE committed Jun 1, 2024
1 parent d0fb39e commit 3a0b85a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ dependencies {
implementation(project(":easy-i18n"))
implementation(project(":injekt"))
implementation(project(":lib_upnp"))
implementation(project(":lib_signal"))
//implementation(project(":lib_signal"))

implementation(libs.zip4j)

Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/com/heyanle/easybangumi4/Scheduler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import com.heyanle.easybangumi4.exo.MediaModule
import com.heyanle.easybangumi4.extension.ExtensionController
import com.heyanle.easybangumi4.extension.ExtensionModule
import com.heyanle.easybangumi4.case.CaseModule
import com.heyanle.easybangumi4.crash.NativeHandler
import com.heyanle.easybangumi4.crash.SourceCrashController
import com.heyanle.easybangumi4.dlna.DlnaModule
import com.heyanle.easybangumi4.setting.SettingModule
Expand Down Expand Up @@ -106,10 +105,10 @@ object Scheduler {
*/
private fun initCrasher(application: Application) {
Thread.setDefaultUncaughtExceptionHandler(CrashHandler(application))
SignalController.initSignal(intArrayOf(
SignalConst.SIGQUIT,
SignalConst.SIGABRT,
SignalConst.SIGSEGV),application, NativeHandler())
// SignalController.initSignal(intArrayOf(
// SignalConst.SIGQUIT,
// SignalConst.SIGABRT,
// SignalConst.SIGSEGV),application, NativeHandler())
}

/**
Expand Down
46 changes: 23 additions & 23 deletions app/src/main/java/com/heyanle/easybangumi4/crash/NativeHandler.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package com.heyanle.easybangumi4.crash

import android.content.Context
import com.pika.lib_signal.CallOnCatchSignal

/**
* Created by heyanle on 2024/5/31.
* https://github.com/heyanLE
*/
class NativeHandler: CallOnCatchSignal {

override fun checkIsAnr(): Boolean {
return false
}

override fun handleAnr(context: Context, logcat: String) {

}

override fun handleCrash(context: Context, signal: Int, logcat: String) {
SourceCrashController.onNativeCrash(signal, logcat)
}
}
//package com.heyanle.easybangumi4.crash
//
//import android.content.Context
//import com.pika.lib_signal.CallOnCatchSignal
//
///**
// * Created by heyanle on 2024/5/31.
// * https://github.com/heyanLE
// */
//class NativeHandler: CallOnCatchSignal {
//
// override fun checkIsAnr(): Boolean {
// return false
// }
//
// override fun handleAnr(context: Context, logcat: String) {
//
// }
//
// override fun handleCrash(context: Context, signal: Int, logcat: String) {
// SourceCrashController.onNativeCrash(signal, logcat)
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,42 @@ object SourceCrashController {


fun appendComponentAction(key: String, action: String){
scope.launch {
try {
if (!actionListFile.exists()){
folder.mkdirs()
actionListFile.createNewFile()
}

val actionString = "open;${key};${action};"
actionList.add("${key};${action}")
actionListFile.appendText(actionString + "\n")
}catch (e: Throwable){
e.printStackTrace()
}

}
// scope.launch {
// try {
// if (!actionListFile.exists()){
// folder.mkdirs()
// actionListFile.createNewFile()
// }
//
// val actionString = "open;${key};${action};"
// actionList.add("${key};${action}")
// actionListFile.appendText(actionString + "\n")
// }catch (e: Throwable){
// e.printStackTrace()
// }
//
// }
}

fun appendComponentAction(component: Component, method: Method){
appendComponentAction(component.source.key, "${component.javaClass.name}#${method.name}")
}

fun closeComponentAction(key: String, action: String){
scope.launch {
try {
if (!actionListFile.exists()) {
folder.mkdirs()
actionListFile.createNewFile()
}
val actionString =
"close;${key};${action};"
actionList.remove("${key};${action};")
actionListFile.appendText(actionString + "\n")
}catch (e: Throwable){
e.printStackTrace()
}
}
// scope.launch {
// try {
// if (!actionListFile.exists()) {
// folder.mkdirs()
// actionListFile.createNewFile()
// }
// val actionString =
// "close;${key};${action};"
// actionList.remove("${key};${action};")
// actionListFile.appendText(actionString + "\n")
// }catch (e: Throwable){
// e.printStackTrace()
// }
// }
}

fun closeComponentAction(component: Component, method: Method){
Expand All @@ -116,7 +116,7 @@ object SourceCrashController {
}
sb.append(it).append("\n")
}
jumpToCrashPage("源操作记录(已关闭相关源):\n${sb.toString()}\n${stringWriter.toString()}")
jumpToCrashPage("${stringWriter.toString()}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class SourceController(

// // 加载 So 咯
if (source is NativeSupportedSource){
return SourceInfo.Error(source, extension, "暂时不支持动态链接 so 库")
val soList = source.dependSoName()
// if (soList.any { !it.startsWith("lib_" + extension.pkgName) }){
// return SourceInfo.Error(source, extension, "加载错误, so 文件必须以lib_[包名] 开头", )
Expand Down

0 comments on commit 3a0b85a

Please sign in to comment.