aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/dev/msfjarvis/aps/util/autofill
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/dev/msfjarvis/aps/util/autofill')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt6
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillMatcher.kt16
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt8
3 files changed, 17 insertions, 13 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
index 14cc634c..fd8faa7f 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/Api30AutofillResponseBuilder.kt
@@ -15,7 +15,6 @@ import android.service.autofill.SaveInfo
import android.view.inputmethod.InlineSuggestionsRequest
import android.widget.inline.InlinePresentationSpec
import androidx.annotation.RequiresApi
-import com.github.ajalt.timberkt.e
import com.github.androidpasswordstore.autofillparser.AutofillAction
import com.github.androidpasswordstore.autofillparser.FillableForm
import com.github.androidpasswordstore.autofillparser.fillWith
@@ -28,6 +27,9 @@ import dev.msfjarvis.aps.ui.autofill.AutofillPublisherChangedActivity
import dev.msfjarvis.aps.ui.autofill.AutofillSaveActivity
import dev.msfjarvis.aps.util.FeatureFlags
import java.io.File
+import logcat.LogPriority.ERROR
+import logcat.asLog
+import logcat.logcat
/** Implements [AutofillResponseBuilder]'s methods for API 30 and above */
@RequiresApi(Build.VERSION_CODES.R)
@@ -213,7 +215,7 @@ class Api30AutofillResponseBuilder(form: FillableForm) {
callback.onSuccess(makeFillResponse(context, inlineSuggestionsRequest, matchedFiles))
},
failure = { e ->
- e(e)
+ logcat(ERROR) { e.asLog() }
callback.onSuccess(makePublisherChangedResponse(context, inlineSuggestionsRequest, e))
}
)
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillMatcher.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillMatcher.kt
index ea10c1ac..206074fa 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillMatcher.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillMatcher.kt
@@ -8,9 +8,6 @@ import android.content.Context
import android.content.SharedPreferences
import android.widget.Toast
import androidx.core.content.edit
-import com.github.ajalt.timberkt.Timber.e
-import com.github.ajalt.timberkt.d
-import com.github.ajalt.timberkt.w
import com.github.androidpasswordstore.autofillparser.FormOrigin
import com.github.androidpasswordstore.autofillparser.computeCertificatesHash
import com.github.michaelbull.result.Err
@@ -18,6 +15,9 @@ import com.github.michaelbull.result.Ok
import com.github.michaelbull.result.Result
import dev.msfjarvis.aps.R
import java.io.File
+import logcat.LogPriority.ERROR
+import logcat.LogPriority.WARN
+import logcat.logcat
private const val PREFERENCES_AUTOFILL_APP_MATCHES = "oreo_autofill_app_matches"
private val Context.autofillAppMatches
@@ -69,7 +69,7 @@ class AutofillMatcher {
context.autofillAppMatches.getString(tokenKey(formOrigin), null) ?: return false
val hashHasChanged = certificatesHash != storedCertificatesHash
if (hashHasChanged) {
- e { "$packageName: stored=$storedCertificatesHash, new=$certificatesHash" }
+ logcat(ERROR) { "$packageName: stored=$storedCertificatesHash, new=$certificatesHash" }
true
} else {
false
@@ -134,7 +134,7 @@ class AutofillMatcher {
if (hasFormOriginHashChanged(context, formOrigin)) {
// This should never happen since we already verified the publisher in
// getMatchesFor.
- e { "App publisher changed between getMatchesFor and addMatchFor" }
+ logcat(ERROR) { "App publisher changed between getMatchesFor and addMatchFor" }
throw AutofillPublisherChangedException(formOrigin)
}
val matchPreferences = context.matchPreferences(formOrigin)
@@ -154,7 +154,7 @@ class AutofillMatcher {
putStringSet(matchesKey(formOrigin), newFiles.map { it.absolutePath }.toSet())
}
storeFormOriginHash(context, formOrigin)
- d { "Stored match for $formOrigin" }
+ logcat { "Stored match for $formOrigin" }
}
/**
@@ -176,7 +176,7 @@ class AutofillMatcher {
// created with `putStringSet`.
@Suppress("UNCHECKED_CAST") val oldMatches = value as? Set<String>
if (oldMatches == null) {
- w { "Failed to read matches for $key" }
+ logcat(WARN) { "Failed to read matches for $key" }
continue
}
// Delete all matches for file locations that are going to be overwritten, then
@@ -188,7 +188,7 @@ class AutofillMatcher {
.minus(oldNewPathMap.values)
.map { match ->
val newPath = oldNewPathMap[match] ?: return@map match
- d { "Updating match for $key: $match --> $newPath" }
+ logcat { "Updating match for $key: $match --> $newPath" }
newPath
}
.toSet()
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
index 1a825de8..723347f2 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillResponseBuilder.kt
@@ -13,7 +13,6 @@ import android.service.autofill.FillCallback
import android.service.autofill.FillResponse
import android.service.autofill.SaveInfo
import androidx.annotation.RequiresApi
-import com.github.ajalt.timberkt.e
import com.github.androidpasswordstore.autofillparser.AutofillAction
import com.github.androidpasswordstore.autofillparser.AutofillScenario
import com.github.androidpasswordstore.autofillparser.Credentials
@@ -28,6 +27,9 @@ import dev.msfjarvis.aps.ui.autofill.AutofillPublisherChangedActivity
import dev.msfjarvis.aps.ui.autofill.AutofillSaveActivity
import dev.msfjarvis.aps.util.FeatureFlags
import java.io.File
+import logcat.LogPriority.ERROR
+import logcat.asLog
+import logcat.logcat
@RequiresApi(Build.VERSION_CODES.O)
class AutofillResponseBuilder(form: FillableForm) {
@@ -180,7 +182,7 @@ class AutofillResponseBuilder(form: FillableForm) {
.fold(
success = { matchedFiles -> callback.onSuccess(makeFillResponse(context, matchedFiles)) },
failure = { e ->
- e(e)
+ logcat(ERROR) { e.asLog() }
callback.onSuccess(makePublisherChangedResponse(context, e))
}
)
@@ -209,7 +211,7 @@ class AutofillResponseBuilder(form: FillableForm) {
}
return builder.run {
if (scenario != null) fillWith(scenario, action, credentials)
- else e { "Failed to recover scenario from client state" }
+ else logcat(ERROR) { "Failed to recover scenario from client state" }
build()
}
}