Skip to content

Commit 5dda9f0

Browse files
committed
Fix: Weird R8 crashes when detecting Android & Fingerprints on Android 6.0 only. Reason unknown.
Signed-off-by: imknown <imknown@qq.com>
1 parent eef1a6f commit 5dda9f0

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

app/src/main/java/net/imknown/android/forefrontinfo/ui/home/repository/HomeRepository.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@ class HomeRepository(
7777
}
7878

7979
fun detectAndroid(lld: Lld): MyModel {
80+
val lldAndroid = lld.android
81+
8082
// region [Mine]
8183
var myNameAndDessert = if (isStableAndroid()) {
82-
val dessert = lld.android.known.find {
84+
val dessert = lldAndroid.known.find {
8385
it.api.toInt() == sdkInt
8486
}?.name
8587
?: MyApplication.getMyString(android.R.string.unknownName)
8688
Build.VERSION.RELEASE + ", " + dessert
8789
} else {
88-
val android = lld.android.known.find {
90+
val android = lldAndroid.known.find {
8991
it.apiFull == sdkFull
9092
}
9193
if (android != null) {
@@ -105,8 +107,6 @@ class HomeRepository(
105107
fun oneLine(android: Lld.Androids.Android) =
106108
MyApplication.getMyString(R.string.android_info, android.version, android.apiFull)
107109

108-
val lldAndroid = lld.android
109-
110110
val latestStable = oneLine(lldAndroid.stable)
111111
val lowestSupport = oneLine(lldAndroid.support)
112112
val stablePreview = oneLine(lldAndroid.stablePreview) // Beta

app/src/main/java/net/imknown/android/forefrontinfo/ui/others/datasource/FingerprintDataSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FingerprintDataSource {
1313
fun getPreviewSdkFingerprint() = getStringProperty(PROP_PREVIEW_SDK_FINGERPRINT)
1414

1515
/** [Build.getFingerprintedPartitions] */
16-
fun getPartitions() = arrayOf(
16+
fun getPartitions() = listOf(
1717
"bootimage", "odm", "odm_dlkm", "oem", "product", "system", "system_dlkm", "system_ext", "vendor", "vendor_dlkm"
1818
)
1919

app/src/main/java/net/imknown/android/forefrontinfo/ui/others/repository/OthersRepository.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,19 @@ class OthersRepository(
133133
fun getFingerprint() = toTranslatedDetailMyModel(MyApplication.getMyString(R.string.build_stock_fingerprint), fingerprintDataSource.getFingerprint())
134134
fun getPreviewSdkFingerprint() = toTranslatedDetailMyModel(MyApplication.getMyString(R.string.build_stock_preview_fingerprint), fingerprintDataSource.getPreviewSdkFingerprint())
135135
fun getPartitionFingerprints(): List<MyModel> {
136-
val tempModels = mutableListOf<MyModel>()
137136
val partitions = fingerprintDataSource.getPartitions()
138-
partitions.forEach {
137+
return partitions.mapNotNull {
139138
val partitionFingerprintProperty = fingerprintDataSource.getPartitionFingerprint(it)
140139
val fingerprint = fingerprintDataSource.getPartitionFingerprintProperty(partitionFingerprintProperty)
141140
if (fingerprint != MyApplication.getMyString(R.string.build_not_filled)
142141
&& fingerprint != MyApplication.getMyString(R.string.result_not_supported)
143142
) {
144-
tempModels += toTranslatedDetailMyModel(MyApplication.getMyString(R.string.build_certain_fingerprint, it), fingerprint)
143+
val title = MyApplication.getMyString(R.string.build_certain_fingerprint, it)
144+
toTranslatedDetailMyModel(title, fingerprint)
145+
} else {
146+
null
145147
}
146148
}
147-
return tempModels
148149
}
149150
// endregion [Fingerprint]
150151

0 commit comments

Comments
 (0)