make sure we set VPN mode properly before we launch the service

This commit is contained in:
Nathan Freitas 2016-10-13 15:31:12 -04:00
parent 9de4f54e6b
commit 50f33c9ca2
2 changed files with 12 additions and 3 deletions

View File

@ -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"

View File

@ -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);