]> git.ipfire.org Git - thirdparty/strongswan.git/commit
android: Properly handle pressing home when VPN confirmation dialog is shown
authorTobias Brunner <tobias@strongswan.org>
Fri, 22 Jun 2018 09:22:23 +0000 (11:22 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:43 +0000 (11:31 +0200)
commit4db3bf0cb091965a3fd7a56025e6d2820a01c276
tree2c07201b133b38597e671b682c682a1c845bf694
parentb1b626a1e31b854cadc0447a4293668697356aa2
android: Properly handle pressing home when VPN confirmation dialog is shown

As documented, onActivityResult() is called right before onResume() when
the activity is reactivated.  However, if the system's VPN confirmation
dialog is shown and the home button is pressed, the activity is stopped
and not just paused, so its state is saved.  And onActivityResult() is
actually also called before onStart().  This means that no fragment
transactions may be committed (i.e. no dialog may be shown) when the
activity is later restarted (e.g. because there is another attempt to
connect the VPN) until onStart() has been called.  So if we'd try to show
the error dialog in onActivityResult() after returning to the launcher
it would result in an IllegalStateException.

However, showing the dialog for the previous confirmation dialog is not
ideal anyway, so we just ignore that result.
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileControlActivity.java