android: Just reconnect if the tile is clicked even if there was an error

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.
This commit is contained in:
Tobias Brunner
2018-07-03 11:31:35 +02:00
parent be89310784
commit d56f1bf832
@@ -131,10 +131,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
{ {
profile = getProfile(); profile = getProfile();
} }
/* reconnect the profile in case of an error */
/* 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 */
if (mService.getErrorState() == VpnStateService.ErrorState.NO_ERROR) if (mService.getErrorState() == VpnStateService.ErrorState.NO_ERROR)
{ {
switch (mService.getState()) switch (mService.getState())
@@ -159,6 +156,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
} }
return; return;
} }
}
if (profile != null) if (profile != null)
{ {
Intent intent = new Intent(this, VpnProfileControlActivity.class); Intent intent = new Intent(this, VpnProfileControlActivity.class);
@@ -169,7 +167,6 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
return; return;
} }
} }
}
Intent intent = new Intent(this, MainActivity.class); Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityAndCollapse(intent); startActivityAndCollapse(intent);