mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 20:07:59 -06:00
Update Autofill logging (#5697)
This commit is contained in:
parent
6d25c12271
commit
f4102bcd30
@ -13,6 +13,7 @@ import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockData
|
|||||||
import com.x8bit.bitwarden.data.vault.repository.util.statusFor
|
import com.x8bit.bitwarden.data.vault.repository.util.statusFor
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +41,10 @@ class AutofillTotpCopyViewModel @Inject constructor(
|
|||||||
private fun handleIntentReceived(action: AutofillTotpCopyAction.IntentReceived) {
|
private fun handleIntentReceived(action: AutofillTotpCopyAction.IntentReceived) {
|
||||||
viewModelScope
|
viewModelScope
|
||||||
.launchWithTimeout(
|
.launchWithTimeout(
|
||||||
timeoutBlock = { finishActivity() },
|
timeoutBlock = {
|
||||||
|
Timber.w("Autofill -- Timeout")
|
||||||
|
finishActivity()
|
||||||
|
},
|
||||||
timeoutDuration = CIPHER_WAIT_TIMEOUT_MILLIS,
|
timeoutDuration = CIPHER_WAIT_TIMEOUT_MILLIS,
|
||||||
) {
|
) {
|
||||||
// Extract TOTP copy data from the intent.
|
// Extract TOTP copy data from the intent.
|
||||||
@ -49,16 +53,31 @@ class AutofillTotpCopyViewModel @Inject constructor(
|
|||||||
.getTotpCopyIntentOrNull()
|
.getTotpCopyIntentOrNull()
|
||||||
?.cipherId
|
?.cipherId
|
||||||
|
|
||||||
if (cipherId == null || isVaultLocked()) {
|
if (cipherId == null) {
|
||||||
|
Timber.w("Autofill -- Cipher was not provided")
|
||||||
|
finishActivity()
|
||||||
|
return@launchWithTimeout
|
||||||
|
}
|
||||||
|
if (isVaultLocked()) {
|
||||||
|
Timber.w("Autofill -- Vault is locked")
|
||||||
finishActivity()
|
finishActivity()
|
||||||
return@launchWithTimeout
|
return@launchWithTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and find the matching cipher.
|
// Try and find the matching cipher.
|
||||||
when (val result = vaultRepository.getCipher(cipherId = cipherId)) {
|
when (val result = vaultRepository.getCipher(cipherId = cipherId)) {
|
||||||
GetCipherResult.CipherNotFound -> finishActivity()
|
GetCipherResult.CipherNotFound -> {
|
||||||
is GetCipherResult.Failure -> finishActivity()
|
Timber.w("Autofill -- Cipher not found")
|
||||||
|
finishActivity()
|
||||||
|
}
|
||||||
|
|
||||||
|
is GetCipherResult.Failure -> {
|
||||||
|
Timber.w(result.error, "Autofill -- Get cipher failure")
|
||||||
|
finishActivity()
|
||||||
|
}
|
||||||
|
|
||||||
is GetCipherResult.Success -> {
|
is GetCipherResult.Success -> {
|
||||||
|
Timber.d("Autofill -- Cipher found")
|
||||||
sendEvent(AutofillTotpCopyEvent.CompleteAutofill(result.cipherView))
|
sendEvent(AutofillTotpCopyEvent.CompleteAutofill(result.cipherView))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class FillResponseBuilderImpl : FillResponseBuilder {
|
|||||||
saveInfo: SaveInfo?,
|
saveInfo: SaveInfo?,
|
||||||
): FillResponse? =
|
): FillResponse? =
|
||||||
if (filledData.fillableAutofillIds.isNotEmpty()) {
|
if (filledData.fillableAutofillIds.isNotEmpty()) {
|
||||||
Timber.w("Autofill request constructing FillResponse")
|
Timber.d("Autofill request constructing FillResponse")
|
||||||
val fillResponseBuilder = FillResponse.Builder()
|
val fillResponseBuilder = FillResponse.Builder()
|
||||||
saveInfo?.let { nonNullSaveInfo -> fillResponseBuilder.setSaveInfo(nonNullSaveInfo) }
|
saveInfo?.let { nonNullSaveInfo -> fillResponseBuilder.setSaveInfo(nonNullSaveInfo) }
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.x8bit.bitwarden.data.platform.manager.event.OrganizationEventManager
|
|||||||
import com.x8bit.bitwarden.data.platform.manager.model.OrganizationEvent
|
import com.x8bit.bitwarden.data.platform.manager.model.OrganizationEvent
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary implementation of [AutofillCompletionManager].
|
* Primary implementation of [AutofillCompletionManager].
|
||||||
@ -41,6 +42,7 @@ class AutofillCompletionManagerImpl(
|
|||||||
.intent
|
.intent
|
||||||
?.getAutofillAssistStructureOrNull()
|
?.getAutofillAssistStructureOrNull()
|
||||||
?: run {
|
?: run {
|
||||||
|
Timber.w("Assist structure not found")
|
||||||
activity.cancelAndFinish()
|
activity.cancelAndFinish()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -51,6 +53,7 @@ class AutofillCompletionManagerImpl(
|
|||||||
assistStructure = assistStructure,
|
assistStructure = assistStructure,
|
||||||
)
|
)
|
||||||
if (autofillRequest !is AutofillRequest.Fillable) {
|
if (autofillRequest !is AutofillRequest.Fillable) {
|
||||||
|
Timber.w("Request is not fillable")
|
||||||
activity.cancelAndFinish()
|
activity.cancelAndFinish()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -68,11 +71,13 @@ class AutofillCompletionManagerImpl(
|
|||||||
authIntentSender = null,
|
authIntentSender = null,
|
||||||
)
|
)
|
||||||
?: run {
|
?: run {
|
||||||
|
Timber.w("Dataset not found")
|
||||||
activity.cancelAndFinish()
|
activity.cancelAndFinish()
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
totpManager.tryCopyTotpToClipboard(cipherView = cipherView)
|
totpManager.tryCopyTotpToClipboard(cipherView = cipherView)
|
||||||
val resultIntent = createAutofillSelectionResultIntent(dataset)
|
val resultIntent = createAutofillSelectionResultIntent(dataset)
|
||||||
|
Timber.d("Autofill success")
|
||||||
activity.setResultAndFinish(resultIntent = resultIntent)
|
activity.setResultAndFinish(resultIntent = resultIntent)
|
||||||
cipherView.id?.let {
|
cipherView.id?.let {
|
||||||
organizationEventManager.trackEvent(
|
organizationEventManager.trackEvent(
|
||||||
|
|||||||
@ -135,7 +135,7 @@ class AutofillParserImpl(
|
|||||||
|
|
||||||
// Get inline information if available
|
// Get inline information if available
|
||||||
val isInlineAutofillEnabled = settingsRepository.isInlineAutofillEnabled
|
val isInlineAutofillEnabled = settingsRepository.isInlineAutofillEnabled
|
||||||
Timber.e("Autofill request isInlineEnabled=$isInlineAutofillEnabled -- ${fillRequest?.id}")
|
Timber.d("Autofill request isInlineEnabled=$isInlineAutofillEnabled -- ${fillRequest?.id}")
|
||||||
val maxInlineSuggestionsCount = fillRequest.getMaxInlineSuggestionsCount(
|
val maxInlineSuggestionsCount = fillRequest.getMaxInlineSuggestionsCount(
|
||||||
autofillAppInfo = autofillAppInfo,
|
autofillAppInfo = autofillAppInfo,
|
||||||
isInlineAutofillEnabled = isInlineAutofillEnabled,
|
isInlineAutofillEnabled = isInlineAutofillEnabled,
|
||||||
|
|||||||
@ -190,7 +190,7 @@ internal class FlightRecorderManagerImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class FlightRecorderTree : Timber.Tree() {
|
private inner class FlightRecorderTree : Timber.DebugTree() {
|
||||||
var flightRecorderData: FlightRecorderDataSet.FlightRecorderData? = null
|
var flightRecorderData: FlightRecorderDataSet.FlightRecorderData? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
value?.let {
|
value?.let {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user