mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-01 16:55:18 +08:00
Added show app process when crashed and remove background process judge
This commit is contained in:
12
README.md
12
README.md
@@ -46,15 +46,23 @@ Added more features to app's crash dialog, fixed custom rom deleted dialog, the
|
||||
|
||||
- 异常历史记录功能,可通过通知栏磁贴“异常历史记录”进入和模块主界面进入(正在开发)
|
||||
|
||||
- 多进程 APP 的异常将会显示异常的进程名
|
||||
|
||||
- 支持 Android 10 及以上系统的深色模式
|
||||
|
||||
## Future
|
||||
|
||||
此项目依然在开发中,现在未解决的问题和包含的问题如下
|
||||
|
||||
- 排除列表以及更多功能正在开发
|
||||
- 排除列表功能
|
||||
|
||||
- 后台进程可能依然会弹出崩溃对话框且开发者选项里的设置无效,还在排查
|
||||
- 模块主界面进入“异常历史记录”功能
|
||||
|
||||
- 隐藏 APP 多进程和后台进程崩溃对话框功能
|
||||
|
||||
- 已忽略异常的 APP 查看功能
|
||||
|
||||
- 更多功能
|
||||
|
||||
## License
|
||||
|
||||
|
@@ -26,15 +26,19 @@ import java.io.Serializable
|
||||
/**
|
||||
* 应用异常信息显示 bean
|
||||
* @param packageName APP 包名
|
||||
* @param processName APP 进程名
|
||||
* @param appName APP 名称
|
||||
* @param title 标题
|
||||
* @param isApp 是否为 APP
|
||||
* @param isShowAppInfoButton 是否显示应用信息按钮
|
||||
* @param isShowCloseAppButton 是否显示关闭应用按钮
|
||||
* @param isShowReopenButton 是否显示重新打开按钮
|
||||
*/
|
||||
data class AppErrorsDisplayBean(
|
||||
var packageName: String,
|
||||
var processName: String,
|
||||
var appName: String,
|
||||
var title: String,
|
||||
var isApp: Boolean,
|
||||
var isShowAppInfoButton: Boolean,
|
||||
var isShowCloseAppButton: Boolean,
|
||||
var isShowReopenButton: Boolean
|
||||
) : Serializable
|
@@ -49,8 +49,6 @@ object FrameworkHooker : YukiBaseHooker() {
|
||||
|
||||
private const val AppErrorsClass = "com.android.server.am.AppErrors"
|
||||
|
||||
private const val AppErrorResultClass = "com.android.server.am.AppErrorResult"
|
||||
|
||||
private const val AppErrorDialog_DataClass = "com.android.server.am.AppErrorDialog\$Data"
|
||||
|
||||
private const val ProcessRecordClass = "com.android.server.am.ProcessRecord"
|
||||
@@ -126,12 +124,6 @@ object FrameworkHooker : YukiBaseHooker() {
|
||||
/** 错误数据 */
|
||||
val errData = args().first().cast<Message>()?.obj
|
||||
|
||||
/** 错误结果 */
|
||||
val errResult = AppErrorResultClass.clazz.method {
|
||||
name = "get"
|
||||
emptyParam()
|
||||
}.get(AppErrorDialog_DataClass.clazz.field { name = "result" }.get(errData).any()).int()
|
||||
|
||||
/** 当前进程信息 */
|
||||
val proc = AppErrorDialog_DataClass.clazz.field { name = "proc" }.get(errData).any()
|
||||
|
||||
@@ -173,19 +165,19 @@ object FrameworkHooker : YukiBaseHooker() {
|
||||
context.toast(msg = "AppErrorsTracking has crashed, please see the log in console")
|
||||
return@afterHook
|
||||
}
|
||||
/** 判断是否被忽略 - 在后台就不显示对话框 */
|
||||
if (ignoredErrorsIfUnlockApps.contains(packageName) || ignoredErrorsIfRestartApps.contains(packageName) || errResult == -2)
|
||||
return@afterHook
|
||||
/** 启动错误对话框显示窗口 */
|
||||
AppErrorsDisplayActivity.start(
|
||||
context, AppErrorsDisplayBean(
|
||||
packageName = packageName,
|
||||
appName = appName,
|
||||
title = if (isRepeating) LocaleString.aerrRepeatedTitle(appName) else LocaleString.aerrTitle(appName),
|
||||
isApp = isApp,
|
||||
isShowReopenButton = isRepeating.not() && context.isAppCanOpened(packageName)
|
||||
if (ignoredErrorsIfUnlockApps.contains(packageName).not() && ignoredErrorsIfRestartApps.contains(packageName).not())
|
||||
AppErrorsDisplayActivity.start(
|
||||
context, AppErrorsDisplayBean(
|
||||
packageName = packageName,
|
||||
processName = processName,
|
||||
appName = appName,
|
||||
title = if (isRepeating) LocaleString.aerrRepeatedTitle(appName) else LocaleString.aerrTitle(appName),
|
||||
isShowAppInfoButton = isApp,
|
||||
isShowReopenButton = isApp && isRepeating.not() && context.isAppCanOpened(packageName) && packageName == processName,
|
||||
isShowCloseAppButton = isApp
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
injectMember {
|
||||
|
@@ -328,4 +328,10 @@ object LocaleString {
|
||||
|
||||
/** @string Automatic generated */
|
||||
fun yearAgo(vararg objArrs: Any) = R.string.year_ago.bind(*objArrs)
|
||||
|
||||
/** @string Automatic generated */
|
||||
val crashProcess get() = crashProcess()
|
||||
|
||||
/** @string Automatic generated */
|
||||
fun crashProcess(vararg objArrs: Any) = R.string.crash_process.bind(*objArrs)
|
||||
}
|
@@ -62,9 +62,11 @@ class AppErrorsDisplayActivity : BaseActivity<ActivityAppErrorsDisplayBinding>()
|
||||
showDialog {
|
||||
title = appErrorsDisplay.title
|
||||
bind<DiaAppErrorsDisplayBinding>().apply {
|
||||
appInfoItem.isVisible = appErrorsDisplay.isApp
|
||||
processNameText.isVisible = appErrorsDisplay.packageName != appErrorsDisplay.processName
|
||||
appInfoItem.isVisible = appErrorsDisplay.isShowAppInfoButton
|
||||
closeAppItem.isVisible = appErrorsDisplay.isShowReopenButton.not() && appErrorsDisplay.isShowCloseAppButton
|
||||
reopenAppItem.isVisible = appErrorsDisplay.isShowReopenButton
|
||||
closeAppItem.isVisible = appErrorsDisplay.isShowReopenButton.not()
|
||||
processNameText.text = LocaleString.crashProcess(appErrorsDisplay.processName)
|
||||
appInfoItem.setOnClickListener {
|
||||
cancel()
|
||||
openSelfSetting(appErrorsDisplay.packageName)
|
||||
|
@@ -6,6 +6,19 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/process_name_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:ellipsize="end"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingRight="14dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
|
||||
android:id="@+id/app_info_item"
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">日前</string>
|
||||
<string name="month_ago">月前</string>
|
||||
<string name="year_ago">年前</string>
|
||||
<string name="crash_process">エラープロセス「%1$s」</string>
|
||||
</resources>
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">天前</string>
|
||||
<string name="month_ago">月前</string>
|
||||
<string name="year_ago">年前</string>
|
||||
<string name="crash_process">异常进程 \"%1$s\"</string>
|
||||
</resources>
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">天前</string>
|
||||
<string name="month_ago">月前</string>
|
||||
<string name="year_ago">年前</string>
|
||||
<string name="crash_process">異常進程 \"%1$s\"</string>
|
||||
</resources>
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">天前</string>
|
||||
<string name="month_ago">月前</string>
|
||||
<string name="year_ago">年前</string>
|
||||
<string name="crash_process">異常進程 \"%1$s\"</string>
|
||||
</resources>
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">天前</string>
|
||||
<string name="month_ago">月前</string>
|
||||
<string name="year_ago">年前</string>
|
||||
<string name="crash_process">異常進程 \"%1$s\"</string>
|
||||
</resources>
|
@@ -70,4 +70,5 @@
|
||||
<string name="day_ago">days ago</string>
|
||||
<string name="month_ago">month ago</string>
|
||||
<string name="year_ago">year ago</string>
|
||||
<string name="crash_process">Crash Process \"%1$s\"</string>
|
||||
</resources>
|
Reference in New Issue
Block a user