diff --git a/README-zh-CN.md b/README-zh-CN.md
index 6012f54..a2b83ec 100644
--- a/README-zh-CN.md
+++ b/README-zh-CN.md
@@ -18,7 +18,7 @@
应用发生崩溃的错误日志对开发者来说是无价的财富,若你不是开发者,你依然可以安装此模块,以便给开发者提供更多异常信息快速解决问题。
-> 最低支持 Android 8.1
+> 最低支持 Android 7.0
## 项目缘由
diff --git a/README.md b/README.md
index 18ef432..4f9eb3c 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ any installed apps, so as to quickly locate the problem.
The error log of apps crashing is an invaluable asset for developers. If you are not a developer, you can still install this module to provide
developers with more exception information to quickly solve problems.
-> Minimum support Android 8.1
+> Minimum support Android 7.0
## Project Reason
diff --git a/app/build.gradle b/app/build.gradle
index a93d0a6..63c7acf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,7 +21,7 @@ android {
defaultConfig {
applicationId "com.fankes.apperrorstracking"
- minSdk 27
+ minSdk 24
targetSdk 33
versionCode rootProject.ext.appVersionCode
versionName rootProject.ext.appVersionName
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2a1e97b..70bed9e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,7 +27,10 @@
android:value="@string/xposed_desc" />
+ android:value="89" />
+
diff --git a/app/src/main/java/com/fankes/apperrorstracking/ui/activity/base/BaseActivity.kt b/app/src/main/java/com/fankes/apperrorstracking/ui/activity/base/BaseActivity.kt
index f4fccb7..3d078e0 100644
--- a/app/src/main/java/com/fankes/apperrorstracking/ui/activity/base/BaseActivity.kt
+++ b/app/src/main/java/com/fankes/apperrorstracking/ui/activity/base/BaseActivity.kt
@@ -23,6 +23,8 @@
package com.fankes.apperrorstracking.ui.activity.base
+import android.app.ActivityManager
+import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
@@ -67,6 +69,24 @@ abstract class BaseActivity : AppCompatActivity() {
/** 回调 [onCreate] 方法 */
abstract fun onCreate()
+ /**
+ * 在旧版的 Android 系统中使用了 activity-alias 标签从启动器启动 Activity 会造成其组件名称 (完整类名) 为代理名称
+ *
+ * 为了获取真实的顶层 Activity 组件名称 (完整类名) - 如果名称不正确将自动执行一次结束并重新打开当前 Activity
+ */
+ fun checkingTopComponentName() {
+ /** 当前顶层的 Activity 组件名称 (完整类名) */
+ val topComponentName = runCatching {
+ @Suppress("DEPRECATION")
+ (getSystemService(ACTIVITY_SERVICE) as? ActivityManager?)
+ ?.getRunningTasks(9999)?.firstOrNull()?.topActivity?.className ?: ""
+ }.getOrNull() ?: ""
+ if (topComponentName.isNotBlank() && topComponentName != javaClass.name) {
+ finish()
+ startActivity(Intent(this, javaClass))
+ }
+ }
+
/**
* 弹出提示并退出
* @param name 名称
diff --git a/app/src/main/java/com/fankes/apperrorstracking/ui/activity/main/MainActivity.kt b/app/src/main/java/com/fankes/apperrorstracking/ui/activity/main/MainActivity.kt
index 7f10879..f28bc78 100644
--- a/app/src/main/java/com/fankes/apperrorstracking/ui/activity/main/MainActivity.kt
+++ b/app/src/main/java/com/fankes/apperrorstracking/ui/activity/main/MainActivity.kt
@@ -52,6 +52,7 @@ class MainActivity : BaseActivity() {
}
override fun onCreate() {
+ checkingTopComponentName()
binding.mainTextVersion.text = LocaleString.moduleVersion(BuildConfig.VERSION_NAME)
binding.mainTextSystemVersion.text = LocaleString.systemVersion(systemVersion)
binding.onlyShowErrorsInFrontSwitch.bind(ConfigData.ENABLE_ONLY_SHOW_ERRORS_IN_FRONT)
diff --git a/app/src/main/java/com/fankes/apperrorstracking/utils/factory/FunctionFactory.kt b/app/src/main/java/com/fankes/apperrorstracking/utils/factory/FunctionFactory.kt
index 31f9fa3..5cc9e29 100644
--- a/app/src/main/java/com/fankes/apperrorstracking/utils/factory/FunctionFactory.kt
+++ b/app/src/main/java/com/fankes/apperrorstracking/utils/factory/FunctionFactory.kt
@@ -19,7 +19,7 @@
*
* This file is Created by fankes on 2022/5/7.
*/
-@file:Suppress("unused")
+@file:Suppress("unused", "NotificationPermission")
package com.fankes.apperrorstracking.utils.factory
@@ -261,7 +261,8 @@ fun Context.snake(msg: String, actionText: String = "", callback: () -> Unit = {
*/
fun Context.pushNotify(channelId: String, channelName: String, title: String, content: String, icon: IconCompat, color: Int, intent: Intent) {
getSystemService()?.apply {
- createNotificationChannel(NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_HIGH))
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ createNotificationChannel(NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_HIGH))
notify((0..999).random(), NotificationCompat.Builder(this@pushNotify, channelId).apply {
this.color = color
setAutoCancel(true)
diff --git a/app/src/main/res/layout/activitiy_logger.xml b/app/src/main/res/layout/activitiy_logger.xml
index df9ad4e..e512d37 100644
--- a/app/src/main/res/layout/activitiy_logger.xml
+++ b/app/src/main/res/layout/activitiy_logger.xml
@@ -6,7 +6,7 @@
android:background="@color/colorThemeBackground"
android:orientation="vertical"
tools:context=".ui.activity.debug.LoggerActivity"
- tools:ignore="ContentDescription,UseCompoundDrawables">
+ tools:ignore="ContentDescription,UseCompoundDrawables,UnusedAttribute">
+ tools:ignore="ContentDescription,UseCompoundDrawables,SmallSp,UnusedAttribute">
+ tools:ignore="ContentDescription,UseCompoundDrawables,UnusedAttribute">
+ tools:ignore="ContentDescription,UseCompoundDrawables,UnusedAttribute">
+ tools:ignore="ContentDescription,UseCompoundDrawables,UnusedAttribute">
+ tools:ignore="UseCompoundDrawables,ContentDescription,SmallSp,UnusedAttribute">