mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 06:15:48 +00:00
AutofillPublisherChangedActivity: use runCatching to replace exception handling
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
@@ -16,6 +16,8 @@ import android.text.format.DateUtils
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.github.ajalt.timberkt.e
|
import com.github.ajalt.timberkt.e
|
||||||
|
import com.github.michaelbull.result.onFailure
|
||||||
|
import com.github.michaelbull.result.runCatching
|
||||||
import com.zeapo.pwdstore.R
|
import com.zeapo.pwdstore.R
|
||||||
import com.zeapo.pwdstore.autofill.oreo.AutofillMatcher
|
import com.zeapo.pwdstore.autofill.oreo.AutofillMatcher
|
||||||
import com.zeapo.pwdstore.autofill.oreo.AutofillPublisherChangedException
|
import com.zeapo.pwdstore.autofill.oreo.AutofillPublisherChangedException
|
||||||
@@ -76,7 +78,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showPackageInfo() {
|
private fun showPackageInfo() {
|
||||||
try {
|
runCatching {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
val packageInfo =
|
val packageInfo =
|
||||||
packageManager.getPackageInfo(appPackage, PackageManager.GET_META_DATA)
|
packageManager.getPackageInfo(appPackage, PackageManager.GET_META_DATA)
|
||||||
@@ -94,8 +96,8 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
|
|||||||
currentHash
|
currentHash
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (exception: Exception) {
|
}.onFailure { e ->
|
||||||
e(exception) { "Failed to retrieve package info for $appPackage" }
|
e(e) { "Failed to retrieve package info for $appPackage" }
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user