Skip to content

Commit f3c9e38

Browse files
committed
优化崩溃捕捉界面显示的信息
1 parent 5c4fe98 commit f3c9e38

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

app/src/main/java/com/hjq/demo/ui/activity/common/CrashActivity.kt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import com.hjq.demo.R
3030
import com.hjq.demo.aop.SingleClick
3131
import com.hjq.demo.app.AppActivity
3232
import com.hjq.demo.other.AppConfig
33+
import com.hjq.device.compat.DeviceBrand
34+
import com.hjq.device.compat.DeviceMarketName
35+
import com.hjq.device.compat.DeviceOs
3336
import com.tencent.bugly.library.Bugly
3437
import kotlinx.coroutines.Dispatchers
3538
import kotlinx.coroutines.launch
@@ -165,8 +168,14 @@ class CrashActivity : AppActivity() {
165168
}
166169
}
167170
val builder: StringBuilder = StringBuilder()
168-
builder.append("设备品牌:\t").append(Build.BRAND)
169-
.append("\n设备型号:\t").append(Build.MODEL)
171+
builder.append("设备品牌:\t").append(DeviceBrand.getBrandName())
172+
173+
val marketName = DeviceMarketName.getMarketName(this)
174+
if (!TextUtils.isEmpty(marketName)) {
175+
builder.append("\n设备名称:\t").append(marketName)
176+
}
177+
178+
builder.append("\n设备型号:\t").append(Build.MODEL)
170179
.append("\n设备类型:\t").append(if (isTabletDevice()) "平板" else "手机")
171180

172181
builder.append("\n屏幕宽高:\t").append(screenWidth).append(" x ").append(screenHeight)
@@ -179,6 +188,15 @@ class CrashActivity : AppActivity() {
179188
.append("\nAPI 版本:\t").append(getSdkVersion())
180189
.append("\nCPU 架构:\t").append(Build.SUPPORTED_ABIS[0])
181190

191+
val osName = DeviceOs.getOsName()
192+
if (!TextUtils.isEmpty(osName)) {
193+
builder.append("\n厂商系统:\t").append(osName)
194+
val osVersionName = DeviceOs.getOsVersionName()
195+
if (!TextUtils.isEmpty(osVersionName)) {
196+
builder.append("\n厂商版本:\t").append(osVersionName)
197+
}
198+
}
199+
182200
builder.append("\n应用版本:\t").append(AppConfig.getVersionName())
183201
.append("\n版本代码:\t").append(AppConfig.getVersionCode())
184202

0 commit comments

Comments
 (0)