commit 50f33c9ca2d58b741ae40fbdeec42786240117fd Author: Nathan Freitas nathan@freitas.net Date: Thu Oct 13 15:31:12 2016 -0400
make sure we set VPN mode properly before we launch the service --- app/src/main/AndroidManifest.xml | 2 +- .../main/java/org/torproject/android/OrbotMainActivity.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2570737..73a90cf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ android:versionCode="15200001" android:installLocation="auto" > - <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23"/> + <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23"/> <!-- <permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index 8b9cb5b..5e57c2c 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -299,6 +299,9 @@ public class OrbotMainActivity extends AppCompatActivity @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + Prefs.putUseVpn(isChecked); + if (isChecked) startActivity(new Intent(OrbotMainActivity.this,VPNEnableActivity.class)); else @@ -828,9 +831,15 @@ public class OrbotMainActivity extends AppCompatActivity
} } - else if (request == REQUEST_VPN && response == RESULT_OK) + else if (request == REQUEST_VPN) { - sendIntentToService(TorServiceConstants.CMD_VPN); + if (response == RESULT_OK) + sendIntentToService(TorServiceConstants.CMD_VPN); + else + { + Prefs.putUseVpn(false); + + } }
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);