Skip to content

Commit 3339e00

Browse files
committed
correctly handle vpnService's onRevoke method(), which fires off when another VPN app takes the stage
1 parent a92ce92 commit 3339e00

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/src/main/java/org/torproject/android/service/OrbotService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,11 @@ public void setNotificationSubtext(String message) {
632632
// system calls this method when VPN disconnects (either by the user or another VPN app)
633633
@Override
634634
public void onRevoke() {
635-
Prefs.putUseVpn(false);
636-
mVpnManager.handleIntent(new Builder(), new Intent(ACTION_STOP));
637635
// tell UI, if it's open, to update immediately (don't wait for onResume() in Activity...)
638-
sendBroadcast(new Intent(ACTION_STOP).setPackage(getPackageName()));
636+
sendLocalStatusOffBroadcast();
637+
mVpnManager.handleIntent(new Builder(), new Intent(ACTION_STOP));
638+
Prefs.putUseVpn(false);
639+
super.onRevoke(); // invokes stopSelf()
639640
}
640641

641642
private void setExitNode(String newExits) {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,6 @@
306306
<string name="unable_to_start_orbot_vpn_title">Unable to start Orbot VPN</string>
307307
<string name="unable_to_start_legacy_vpn_error_msg">There is a Custom VPN Profile configured to be an \"Always-on\" VPN. Please disable it before starting Orbot.</string>
308308
<string name="unable_to_start_other_vpn_app_error_msg">The app %1$s is configured to be an \"Always-on\" VPN. Please disable it before starting Orbot.</string>
309-
<string name="unable_to_start_unknown_reason_error_msg">The VPN permission was denied or another app has \"Always-on VPN\" enabled. You can dismiss this and reconnect if you exited the previous VPN Request dialog by mistake. Technical users can use another VPN app and use Tor as a SOCKS Proxy by enabling Orbot\'s Power User Mode.</string>
309+
<string name="unable_to_start_unknown_reason_error_msg">The VPN permission was denied or another VPN app has the \"Always-on VPN\" feature enabled. You can dismiss this and reconnect if you exited the previous VPN Request dialog by mistake. Technical users can use another VPN app and use Tor as a SOCKS Proxy by enabling Orbot\'s Power User Mode.</string>
310310
<string name="open_vpn_settings">Open Android VPN Settings</string>
311311
</resources>

0 commit comments

Comments
 (0)