mirror of
https://github.com/home-assistant/android
synced 2024-09-20 16:42:04 +00:00
Fix button widget authentication dismissed due to non-foreground window (#4066)
- Fixes the button widget authentication dialog automatically being dismissed when triggered on Android 14 QPR1+, because the window was not in the foreground. It looks like the framework check for this was bugged before QPR1, and the Home Assistant app was showing the authentication dialog before the window (which is transparent) was in the foreground.
This commit is contained in:
parent
1fa6ec463e
commit
7cc545bfac
|
@ -15,12 +15,20 @@ class WidgetAuthenticationActivity : AppCompatActivity() {
|
|||
private const val TAG = "WidgetAuthenticationA"
|
||||
}
|
||||
|
||||
private var authenticating = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "onCreate in WidgetAuthenticationActivity called")
|
||||
}
|
||||
|
||||
val authenticator = Authenticator(this, this, ::authenticationResult)
|
||||
authenticator.authenticate(getString(R.string.biometric_set_title))
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (hasFocus && !isFinishing && !authenticating) {
|
||||
val authenticator = Authenticator(this, this, ::authenticationResult)
|
||||
authenticator.authenticate(getString(R.string.biometric_set_title))
|
||||
authenticating = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun authenticationResult(result: Int) {
|
||||
|
|
Loading…
Reference in a new issue