]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Just reconnect if the tile is clicked even if there was an error
authorTobias Brunner <tobias@strongswan.org>
Tue, 12 Jun 2018 15:06:28 +0000 (17:06 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:35 +0000 (11:31 +0200)
A long press click on the tile (or a click on the notification) will open
the main activity if more information about the error are necessary.

src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java

index 9641d17971b28974962b0b74db5c79d58e217186..2527e9618e1791afee838fbaed50247aa8bceaa8 100644 (file)
@@ -131,10 +131,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
                        {
                                profile = getProfile();
                        }
-
-                       /* open the main activity in case of an error. since the state is still CONNECTING
-                        * there is a popup confirmation dialog if we connect again, disconnect would work
-                        * but doing two operations is not ideal */
+                       /* reconnect the profile in case of an error */
                        if (mService.getErrorState() == VpnStateService.ErrorState.NO_ERROR)
                        {
                                switch (mService.getState())
@@ -159,15 +156,15 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
                                                }
                                                return;
                                }
-                               if (profile != null)
-                               {
-                                       Intent intent = new Intent(this, VpnProfileControlActivity.class);
-                                       intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                                       intent.setAction(VpnProfileControlActivity.START_PROFILE);
-                                       intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
-                                       startActivity(intent);
-                                       return;
-                               }
+                       }
+                       if (profile != null)
+                       {
+                               Intent intent = new Intent(this, VpnProfileControlActivity.class);
+                               intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                               intent.setAction(VpnProfileControlActivity.START_PROFILE);
+                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+                               startActivity(intent);
+                               return;
                        }
                }
                Intent intent = new Intent(this, MainActivity.class);