From 0bcee7f9cc9b6e5e6b88d9d938abca5e58f07ff2 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 13 Sep 2020 17:52:14 +0530 Subject: ui: fix memory leak from statically held Handler instance Signed-off-by: Harsh Shandilya --- ui/src/main/java/com/wireguard/android/util/BiometricAuthenticator.kt | 3 +-- 1 file changed, 1 insertion(+), 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) -- cgit v1.2.3