Skip to content

Commit fcf2d7e

Browse files
ameerhosseinmarkpash
authored andcommitted
Fix stuck connection when another VPN app connects
1 parent 3087e0d commit fcf2d7e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/src/main/java/org/bepass/oblivion/OblivionVpnService.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ public void onChange(ConnectionState state) {
284284

285285
@Override
286286
public IBinder onBind(Intent intent) {
287+
String action = intent != null ? intent.getAction() : null;
288+
/*
289+
If we override onBind, we never receive onRevoke.
290+
return superclass onBind when action is SERVICE_INTERFACE to receive onRevoke lifecycle call.
291+
*/
292+
if (action != null && action.equals(VpnService.SERVICE_INTERFACE)) {
293+
return super.onBind(intent);
294+
}
287295
return serviceMessenger.getBinder();
288296
}
289297

@@ -339,7 +347,7 @@ public void onDestroy() {
339347

340348
@Override
341349
public void onRevoke() {
342-
super.onRevoke();
350+
stopVpn();
343351
}
344352

345353
private void runVpn() {

0 commit comments

Comments
 (0)