Disable autofill for PIN entry fields.

This commit is contained in:
jeffrey-signal
2025-09-16 09:31:19 -04:00
committed by Greyson Parrelli
parent 6d90330e86
commit 5807cbc9e9
11 changed files with 31 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
/*
* Copyright 2025 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.components
import android.content.Context
import android.util.AttributeSet
import com.google.android.material.textfield.TextInputEditText
/**
* An EditText that completely disables Android's auto-fill functionality.
*/
class NoAutofillEditText : TextInputEditText {
constructor(context: Context) : super(context, null)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
override fun getAutofillType(): Int = AUTOFILL_TYPE_NONE
}

View File

@@ -205,7 +205,7 @@ class ChangeNumberRegistrationLockFragment : LoggingFragment(R.layout.fragment_c
private fun onIncorrectKbsRegistrationLockPin(svrTriesRemaining: Int) {
binding.kbsLockPinConfirm.cancelSpinning()
binding.kbsLockPinInput.getText().clear()
binding.kbsLockPinInput.getText()?.clear()
enableAndFocusPinEntry()
if (svrTriesRemaining == 0) {

View File

@@ -29,7 +29,7 @@ enum class PinKeyboardType(val code: String) {
private val inputType: Int by lazy {
when (this) {
NUMERIC -> InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
ALPHA_NUMERIC -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS or InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
ALPHA_NUMERIC -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
}
}

View File

@@ -185,7 +185,7 @@ class RegistrationLockFragment : LoggingFragment(R.layout.fragment_registration_
private fun onIncorrectKbsRegistrationLockPin(svrTriesRemaining: Int) {
binding.kbsLockPinConfirm.cancelSpinning()
binding.kbsLockPinInput.getText().clear()
binding.kbsLockPinInput.getText()?.clear()
enableAndFocusPinEntry()
if (svrTriesRemaining == 0) {

View File

@@ -185,7 +185,7 @@ class RegistrationLockFragment : LoggingFragment(R.layout.fragment_registration_
private fun onIncorrectKbsRegistrationLockPin(svrTriesRemaining: Int) {
binding.kbsLockPinConfirm.cancelSpinning()
binding.kbsLockPinInput.getText().clear()
binding.kbsLockPinInput.getText()?.clear()
enableAndFocusPinEntry()
if (svrTriesRemaining == 0) {