Crash if screen is rotated during setup and "Create Account" is tapped twice
I got the following crash on the Nokia 3.1 (Android 10) while trying to reproduce another bug. During setup, I rotated the screen to landscape and back to portrait after tapping "Create Account", which caused the progress wheel to disappear and the "Create Account" button to reappear. I tapped the button again and Briar crashed:
2020-10-29 10:58:16.219 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Destroying StartupActivity
2020-10-29 10:58:16.224 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Stopping SplashScreenActivity
2020-10-29 10:58:16.229 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Destroying SplashScreenActivity
2020-10-29 10:58:28.199 10998-11087/org.briarproject.briar.android.debug I/SetupControllerImpl: Creating account
2020-10-29 10:58:28.380 10998-11087/org.briarproject.briar.android.debug I/IdentityManagerImpl: Creating identity took 178 ms
2020-10-29 10:58:28.381 10998-11087/org.briarproject.briar.android.debug I/IdentityManagerImpl: Identity registered
2020-10-29 10:58:29.328 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Pausing SetupActivity
2020-10-29 10:58:29.343 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Stopping SetupActivity
2020-10-29 10:58:29.412 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Destroying SetupActivity
2020-10-29 10:58:29.614 10998-11087/org.briarproject.briar.android.debug I/ScryptKdf: KDF cost parameter 8192
2020-10-29 10:58:30.015 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Creating SetupActivity
2020-10-29 10:58:30.087 10998-11087/org.briarproject.briar.android.debug I/ScryptKdf: Deriving key from password took 472 ms
2020-10-29 10:58:30.213 10998-11087/org.briarproject.briar.android.debug I/AndroidKeyStrengthener: Loaded key from keystore
2020-10-29 10:58:30.338 10998-11087/org.briarproject.briar.android.debug I/AccountManagerImpl: Storing database key in file
2020-10-29 10:58:30.341 10998-11087/org.briarproject.briar.android.debug I/AccountManagerImpl: Created database key directory
2020-10-29 10:58:30.344 10998-11087/org.briarproject.briar.android.debug I/AccountManagerImpl: Stored database key in backup file
2020-10-29 10:58:30.345 10998-11087/org.briarproject.briar.android.debug I/AccountManagerImpl: Renamed backup file to primary
2020-10-29 10:58:30.347 10998-11087/org.briarproject.briar.android.debug I/AccountManagerImpl: Stored second copy of database key in backup file
2020-10-29 10:58:30.354 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Starting SetupActivity
2020-10-29 10:58:30.366 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Resuming SetupActivity
2020-10-29 10:58:33.257 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Pausing SetupActivity
2020-10-29 10:58:33.261 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Stopping SetupActivity
2020-10-29 10:58:33.288 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Destroying SetupActivity
2020-10-29 10:58:33.623 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Creating SetupActivity
2020-10-29 10:58:33.968 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Starting SetupActivity
2020-10-29 10:58:33.980 10998-10998/org.briarproject.briar.android.debug I/BaseActivity: Resuming SetupActivity
2020-10-29 10:58:36.130 10998-11087/org.briarproject.briar.android.debug I/SetupControllerImpl: Creating account
2020-10-29 10:58:36.132 10998-11087/org.briarproject.briar.android.debug E/AndroidRuntime: FATAL EXCEPTION: pool-3-thread-1
Process: org.briarproject.briar.android.debug, PID: 10998
java.lang.AssertionError: Already have a database key
at org.briarproject.bramble.account.AccountManagerImpl.createAccount(AccountManagerImpl.java:169)
at org.briarproject.briar.android.account.SetupControllerImpl.lambda$createAccount$0$SetupControllerImpl(SetupControllerImpl.java:111)
at org.briarproject.briar.android.account.-$$Lambda$SetupControllerImpl$bM_lMydguKzowB8BXIvR9b0joQw.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)