summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-09-13 17:52:14 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-09-13 17:52:14 +0530
commit0bcee7f9cc9b6e5e6b88d9d938abca5e58f07ff2 (patch)
tree78b83f95c9872069c9133e031fd5c743ccc652e9
parentaf10b117b42143a64c8108bf072555fe1f40adce (diff)
ui: fix memory leak from statically held Handler instance
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-rw-r--r--ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt3
1 files changed, 1 insertions, 2 deletions
diff --git a/ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt b/ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt
index 724c8b95..e1ad91b6 100644
--- a/ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt
+++ b/ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt
@@ -23,7 +23,6 @@ import com.wireguard.android.R
object BiometricAuthenticator {
private const val TAG = "WireGuard/BiometricAuthenticator"
- private val handler = Handler(Looper.getMainLooper())
sealed class Result {
data class Success(val cryptoObject: BiometricPrompt.CryptoObject?) : Result()
@@ -78,7 +77,7 @@ object BiometricAuthenticator {
callback(Result.Success(result.cryptoObject))
}
}
- val biometricPrompt = BiometricPrompt(fragment, { handler.post(it) }, authCallback)
+ val biometricPrompt = BiometricPrompt(fragment, { Handler(Looper.getMainLooper()).post(it) }, authCallback)
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle(fragment.getString(dialogTitleRes))
.setDeviceCredentialAllowed(true)