do not reset activity state in OnNewIntent if the activity hasn't even been initialized. closes #2869, closes #2888

This commit is contained in:
Philipp Crocoll
2025-06-17 14:04:15 +02:00
parent e1f26fb045
commit e2babde1fa

View File

@@ -131,6 +131,7 @@ namespace keepass2android
ISharedPreferences _prefs;
private bool _starting;
private bool _resumeCompleted;
private OtpInfo _otpInfo;
private IOConnectionInfo _otpAuxIoc;
private ChallengeInfo _chalInfo;
@@ -1569,6 +1570,8 @@ namespace keepass2android
}
private bool hasRequestedKeyboardActivation = false;
protected override void OnStart()
{
base.OnStart();
@@ -1688,15 +1691,20 @@ namespace keepass2android
//assume the key should be used as static password
FindViewById<EditText>(Resource.Id.password_edit).Text += otp;
}
}
else
{
// if the activity is launched twice and the first initialization hasn't even finished, we cannot
// reset the state and re-initialize the activity.
// This can happen with autofill in some cases (#2869)
if (_resumeCompleted)
{
ResetState();
GetIocFromLaunchIntent(intent);
InitializeAfterSetIoc();
OnStart();
}
}
}
@@ -1878,6 +1886,8 @@ namespace keepass2android
keyboard.HideSoftInputFromWindow(pwd.WindowToken, HideSoftInputFlags.ImplicitOnly);
}, 50);
}
_resumeCompleted = true;
}
private void TryGetOtpFromClipboard()