vpn changes

This commit is contained in:
SandroB 2015-01-20 15:47:24 +01:00
parent 09bdd8fd29
commit 21b75b4c56
23 changed files with 3716 additions and 3705 deletions

View File

@ -5,6 +5,12 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments> <arguments>
@ -30,10 +36,20 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -3,17 +3,17 @@
package="org.torproject.android" package="org.torproject.android"
android:versionName="14.1.4-noPIE" android:versionName="14.1.4-noPIE"
android:versionCode="132" android:versionCode="132"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="9" android:maxSdkVersion="20" android:targetSdkVersion="19"/> <uses-sdk android:minSdkVersion="9" android:maxSdkVersion="20" android:targetSdkVersion="19"/>
<permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission> <permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/> <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission android:name="org.torproject.android.MANAGE_TOR"/> <uses-permission android:name="org.torproject.android.MANAGE_TOR"/>
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher" <application android:name=".OrbotApp" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@ -52,11 +52,11 @@
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.REQUEST_HS_PORT" /> <action android:name="org.torproject.android.REQUEST_HS_PORT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.START_TOR" /> <action android:name="org.torproject.android.START_TOR" />
</intent-filter> </intent-filter>
<!-- <!--
@ -76,47 +76,47 @@
<!-- <!--
<activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/> <activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/>
--> -->
<activity <activity
android:name=".service.DummyActivity" android:name=".service.DummyActivity"
android:theme="@android:style/Theme.NoDisplay" android:theme="@android:style/Theme.NoDisplay"
android:enabled="true" android:enabled="true"
android:allowTaskReparenting="true" android:allowTaskReparenting="true"
android:noHistory="true" android:noHistory="true"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:alwaysRetainTaskState="false" android:alwaysRetainTaskState="false"
android:stateNotNeeded="true" android:stateNotNeeded="true"
android:clearTaskOnLaunch="true" android:clearTaskOnLaunch="true"
android:finishOnTaskLaunch="true" android:finishOnTaskLaunch="true"
/> />
<activity android:name=".wizard.LotsaText" android:exported="false"/> <activity android:name=".wizard.LotsaText" android:exported="false"/>
<activity android:name=".wizard.Permissions" android:exported="false"/> <activity android:name=".wizard.Permissions" android:exported="false"/>
<activity android:name=".wizard.TipsAndTricks" android:exported="false"/> <activity android:name=".wizard.TipsAndTricks" android:exported="false"/>
<activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/> <activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/>
<activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/> <activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/>
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/> <activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".settings.AppManager" android:label="@string/app_name"/> <activity android:name=".settings.AppManager" android:label="@string/app_name"/>
<service android:enabled="true" <service android:enabled="true"
android:name=".service.TorService" android:name=".service.TorService"
android:permission="org.torproject.android.MANAGE_TOR" android:permission="org.torproject.android.MANAGE_TOR"
android:stopWithTask="false" android:stopWithTask="false"
> >
<intent-filter> <intent-filter>
<action android:name="org.torproject.android.service.ITorService" /> <action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" /> <action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter> </intent-filter>
</service> </service>
<receiver android:name=".OnBootReceiver"> <receiver android:name=".OnBootReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MEDIA_MOUNTED"/> <action android:name="android.intent.action.MEDIA_MOUNTED"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="org.torproject.android.vpn.OrbotVpnService" <service android:name="org.torproject.android.vpn.OrbotVpnService"

View File

@ -10,10 +10,10 @@
<permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission> <permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/> <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission android:name="org.torproject.android.MANAGE_TOR"/> <uses-permission android:name="org.torproject.android.MANAGE_TOR"/>
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher" <application android:name=".OrbotApp" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@ -52,11 +52,11 @@
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.REQUEST_HS_PORT" /> <action android:name="org.torproject.android.REQUEST_HS_PORT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.START_TOR" /> <action android:name="org.torproject.android.START_TOR" />
</intent-filter> </intent-filter>
<!-- <!--
@ -76,47 +76,47 @@
<!-- <!--
<activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/> <activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/>
--> -->
<activity <activity
android:name=".service.DummyActivity" android:name=".service.DummyActivity"
android:theme="@android:style/Theme.NoDisplay" android:theme="@android:style/Theme.NoDisplay"
android:enabled="true" android:enabled="true"
android:allowTaskReparenting="true" android:allowTaskReparenting="true"
android:noHistory="true" android:noHistory="true"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:alwaysRetainTaskState="false" android:alwaysRetainTaskState="false"
android:stateNotNeeded="true" android:stateNotNeeded="true"
android:clearTaskOnLaunch="true" android:clearTaskOnLaunch="true"
android:finishOnTaskLaunch="true" android:finishOnTaskLaunch="true"
/> />
<activity android:name=".wizard.LotsaText" android:exported="false"/> <activity android:name=".wizard.LotsaText" android:exported="false"/>
<activity android:name=".wizard.Permissions" android:exported="false"/> <activity android:name=".wizard.Permissions" android:exported="false"/>
<activity android:name=".wizard.TipsAndTricks" android:exported="false"/> <activity android:name=".wizard.TipsAndTricks" android:exported="false"/>
<activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/> <activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/>
<activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/> <activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/>
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/> <activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".settings.AppManager" android:label="@string/app_name"/> <activity android:name=".settings.AppManager" android:label="@string/app_name"/>
<service android:enabled="true" <service android:enabled="true"
android:name=".service.TorService" android:name=".service.TorService"
android:permission="org.torproject.android.MANAGE_TOR" android:permission="org.torproject.android.MANAGE_TOR"
android:stopWithTask="false" android:stopWithTask="false"
> >
<intent-filter> <intent-filter>
<action android:name="org.torproject.android.service.ITorService" /> <action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" /> <action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter> </intent-filter>
</service> </service>
<receiver android:name=".OnBootReceiver"> <receiver android:name=".OnBootReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MEDIA_MOUNTED"/> <action android:name="android.intent.action.MEDIA_MOUNTED"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="org.torproject.android.vpn.OrbotVpnService" <service android:name="org.torproject.android.vpn.OrbotVpnService"

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android" package="org.sandroproxy.ony"
android:versionName="14.1.4-noPIE" android:versionName="14.1.4-noPIE"
android:versionCode="132" android:versionCode="132"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="9" android:maxSdkVersion="20" android:targetSdkVersion="19"/> <uses-sdk android:minSdkVersion="9" android:maxSdkVersion="20" android:targetSdkVersion="19"/>
<permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission> <permission android:name="org.torproject.android.MANAGE_TOR" android:label="@string/permission_manage_tor_label" android:description="@string/permission_manage_tor_description" android:protectionLevel="signature"></permission>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/> <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission android:name="org.torproject.android.MANAGE_TOR"/> <uses-permission android:name="org.torproject.android.MANAGE_TOR"/>
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher" <application android:name="org.sandroproxy.ony.OrbotApp" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:description="@string/app_description" android:description="@string/app_description"
android:configChanges="locale|orientation|screenSize" android:configChanges="locale|orientation|screenSize"
@ -27,7 +27,7 @@
android:largeHeap="false" android:largeHeap="false"
> >
<activity android:name=".Orbot" <activity android:name="org.torproject.android.Orbot"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:launchMode="singleTop" android:launchMode="singleTop"
@ -52,11 +52,11 @@
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.REQUEST_HS_PORT" /> <action android:name="org.torproject.android.REQUEST_HS_PORT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.START_TOR" /> <action android:name="org.torproject.android.START_TOR" />
</intent-filter> </intent-filter>
<!-- <!--
@ -76,47 +76,47 @@
<!-- <!--
<activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/> <activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/>
--> -->
<activity <activity
android:name=".service.DummyActivity" android:name="org.torproject.android.service.DummyActivity"
android:theme="@android:style/Theme.NoDisplay" android:theme="@android:style/Theme.NoDisplay"
android:enabled="true" android:enabled="true"
android:allowTaskReparenting="true" android:allowTaskReparenting="true"
android:noHistory="true" android:noHistory="true"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:alwaysRetainTaskState="false" android:alwaysRetainTaskState="false"
android:stateNotNeeded="true" android:stateNotNeeded="true"
android:clearTaskOnLaunch="true" android:clearTaskOnLaunch="true"
android:finishOnTaskLaunch="true" android:finishOnTaskLaunch="true"
/> />
<activity android:name=".wizard.LotsaText" android:exported="false"/> <activity android:name="org.torproject.android.wizard.LotsaText" android:exported="false"/>
<activity android:name=".wizard.Permissions" android:exported="false"/> <activity android:name="org.torproject.android.wizard.Permissions" android:exported="false"/>
<activity android:name=".wizard.TipsAndTricks" android:exported="false"/> <activity android:name="org.torproject.android.wizard.TipsAndTricks" android:exported="false"/>
<activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/> <activity android:name="org.torproject.android.wizard.ConfigureTransProxy" android:exported="false"/>
<activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/> <activity android:name="org.torproject.android.wizard.ChooseLocaleWizardActivity" android:exported="false"/>
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/> <activity android:name="org.torproject.android.settings.SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".settings.AppManager" android:label="@string/app_name"/> <activity android:name="org.torproject.android.settings.AppManager" android:label="@string/app_name"/>
<service android:enabled="true" <service android:enabled="true"
android:name=".service.TorService" android:name="org.torproject.android.service.TorService"
android:permission="org.torproject.android.MANAGE_TOR" android:permission="org.torproject.android.MANAGE_TOR"
android:stopWithTask="false" android:stopWithTask="false"
> >
<intent-filter> <intent-filter>
<action android:name="org.torproject.android.service.ITorService" /> <action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" /> <action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter> </intent-filter>
</service> </service>
<receiver android:name=".OnBootReceiver"> <receiver android:name="org.torproject.android.OnBootReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MEDIA_MOUNTED"/> <action android:name="android.intent.action.MEDIA_MOUNTED"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="org.torproject.android.vpn.OrbotVpnService" <service android:name="org.torproject.android.vpn.OrbotVpnService"

4
external/Makefile vendored
View File

@ -16,14 +16,14 @@ EXTERNAL_ROOT := $(shell pwd)
# user building this will have to manually set NDK_PROCESSOR or NDK_TOOLCHAIN. # user building this will have to manually set NDK_PROCESSOR or NDK_TOOLCHAIN.
CPU := $(shell uname -m) CPU := $(shell uname -m)
ifeq ($(CPU),x86_64) ifeq ($(CPU),x86_64)
NDK_PROCESSOR=x86_64 NDK_PROCESSOR=x86
else else
NDK_PROCESSOR=x86 NDK_PROCESSOR=x86
endif endif
# Android NDK setup # Android NDK setup
NDK_BASE ?= /opt/android-ndk NDK_BASE ?= /opt/android-ndk
NDK_PLATFORM_LEVEL ?= 9 NDK_PLATFORM_LEVEL ?= 19
NDK_ABI ?= arm NDK_ABI ?= arm
NDK_TOOLCHAIN_VERSION=4.8 NDK_TOOLCHAIN_VERSION=4.8
NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI) NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)

View File

@ -2,10 +2,10 @@
<classpath> <classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/> <classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/android-support-v7-appcompat.jar"/> <classpathentry exported="true" kind="lib" path="libs/android-support-v7-appcompat.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View File

@ -1,3 +1,3 @@
##include ../OriginalDest/Android.mk ##include ../OriginalDest/Android.mk
##include ../external/badvpn/Android.mk include ./external/badvpn/Android.mk
##include ../kalium-jni/jni/Android.mk ##include ../kalium-jni/jni/Android.mk

View File

@ -65,11 +65,9 @@
yourapp:showAsAction="never" yourapp:showAsAction="never"
/> />
<!--
<item android:id="@+id/menu_vpn" <item android:id="@+id/menu_vpn"
android:title="@string/menu_vpn" android:title="@string/menu_vpn"
yourapp:showAsAction="never"/> yourapp:showAsAction="never"/>
-->
<item android:id="@+id/menu_exit" <item android:id="@+id/menu_exit"
android:title="@string/menu_exit" android:title="@string/menu_exit"

View File

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="app_name">Orbot</string> <string name="app_name">Ony</string>
<string name="app_description">Orbot is a free proxy app that empowers other apps to use the internet more securely. Orbot uses Tor to encrypt your Internet traffic and then hides it by bouncing through a series of computers around the world. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis.</string> <string name="app_description">Orbot is a free proxy app that empowers other apps to use the internet more securely. Orbot uses Tor to encrypt your Internet traffic and then hides it by bouncing through a series of computers around the world. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis.</string>
<string name="internal_web_url">http://orbot/</string> <string name="internal_web_url">http://orbot/</string>
<string name="default_web_url">http://check.torproject.org</string> <string name="default_web_url">http://check.torproject.org</string>

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import org.sandroproxy.ony.R;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand; import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.torproject.android.service.TorResourceInstaller; import org.torproject.android.service.TorResourceInstaller;

View File

@ -17,9 +17,9 @@ import java.util.concurrent.TimeoutException;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import org.sandroproxy.ony.R;
import org.sufficientlysecure.rootcommands.Shell; import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand; import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.torproject.android.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import android.content.Context; import android.content.Context;
@ -29,43 +29,43 @@ import android.util.Log;
public class TorResourceInstaller implements TorServiceConstants { public class TorResourceInstaller implements TorServiceConstants {
File installFolder; File installFolder;
Context context; Context context;
public TorResourceInstaller (Context context, File installFolder) public TorResourceInstaller (Context context, File installFolder)
{ {
this.installFolder = installFolder; this.installFolder = installFolder;
this.context = context; this.context = context;
} }
public void deleteDirectory(File file) { public void deleteDirectory(File file) {
if( file.exists() ) { if( file.exists() ) {
if (file.isDirectory()) { if (file.isDirectory()) {
File[] files = file.listFiles(); File[] files = file.listFiles();
for(int i=0; i<files.length; i++) { for(int i=0; i<files.length; i++) {
if(files[i].isDirectory()) { if(files[i].isDirectory()) {
deleteDirectory(files[i]); deleteDirectory(files[i]);
} }
else { else {
files[i].delete(); files[i].delete();
} }
} }
} }
file.delete(); file.delete();
} }
} }
private final static String COMMAND_RM_FORCE = "rm -f "; private final static String COMMAND_RM_FORCE = "rm -f ";
// //
/* /*
* Extract the Tor resources from the APK file using ZIP * Extract the Tor resources from the APK file using ZIP
*/ */
public boolean installResources () throws IOException, FileNotFoundException, TimeoutException public boolean installResources () throws IOException, FileNotFoundException, TimeoutException
{ {
InputStream is; InputStream is;
File outFile; File outFile;
deleteDirectory(installFolder); deleteDirectory(installFolder);
@ -74,129 +74,129 @@ public class TorResourceInstaller implements TorServiceConstants {
Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath()); Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
is = context.getResources().openRawResource(R.raw.torrc); is = context.getResources().openRawResource(R.raw.torrc);
outFile = new File(installFolder, TORRC_ASSET_KEY); outFile = new File(installFolder, TORRC_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false); streamToFile(is,outFile, false, false);
is = context.getResources().openRawResource(R.raw.torpolipo); is = context.getResources().openRawResource(R.raw.torpolipo);
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY); outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false); streamToFile(is,outFile, false, false);
is = context.getResources().openRawResource(R.raw.tor); is = context.getResources().openRawResource(R.raw.tor);
outFile = new File(installFolder, TOR_ASSET_KEY); outFile = new File(installFolder, TOR_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);
is = context.getResources().openRawResource(R.raw.polipo); is = context.getResources().openRawResource(R.raw.polipo);
outFile = new File(installFolder, POLIPO_ASSET_KEY); outFile = new File(installFolder, POLIPO_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);
is = context.getResources().openRawResource(R.raw.obfsclient); is = context.getResources().openRawResource(R.raw.obfsclient);
outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY); outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);
is = context.getResources().openRawResource(R.raw.xtables); is = context.getResources().openRawResource(R.raw.xtables);
outFile = new File(installFolder, IPTABLES_ASSET_KEY); outFile = new File(installFolder, IPTABLES_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);
return true; return true;
} }
public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
{ {
StringBufferInputStream sbis = new StringBufferInputStream(extraLines + '\n'); StringBufferInputStream sbis = new StringBufferInputStream(extraLines + '\n');
streamToFile(sbis,fileTorRcCustom,false,false); streamToFile(sbis,fileTorRcCustom,false,false);
return true; return true;
} }
public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException
{ {
InputStream is; InputStream is;
Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath()); Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
is = context.getResources().openRawResource(R.raw.torpolipo); is = context.getResources().openRawResource(R.raw.torpolipo);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + filePolipo.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + filePolipo.getAbsolutePath())).waitForFinish();
streamToFile(is,filePolipo, false, false); streamToFile(is,filePolipo, false, false);
if (extraLines != null && extraLines.length() > 0) if (extraLines != null && extraLines.length() > 0)
{ {
StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n'); StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n');
streamToFile(sbis,filePolipo,true,false); streamToFile(sbis,filePolipo,true,false);
} }
shell.close(); shell.close();
return true; return true;
} }
public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException
{ {
InputStream is; InputStream is;
File outFile; File outFile;
Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath()); Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
is = context.getResources().openRawResource(R.raw.torpolipo); is = context.getResources().openRawResource(R.raw.torpolipo);
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY); outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false); streamToFile(is,outFile, false, false);
return true; return true;
} }
/* /*
* Extract the Tor binary from the APK file using ZIP * Extract the Tor binary from the APK file using ZIP
*/ */
public boolean installGeoIP () throws IOException, FileNotFoundException public boolean installGeoIP () throws IOException, FileNotFoundException
{ {
InputStream is; InputStream is;
File outFile; File outFile;
is = context.getResources().openRawResource(R.raw.geoip); is = context.getResources().openRawResource(R.raw.geoip);
outFile = new File(installFolder, GEOIP_ASSET_KEY); outFile = new File(installFolder, GEOIP_ASSET_KEY);
streamToFile(is, outFile, false, true); streamToFile(is, outFile, false, true);
is = context.getResources().openRawResource(R.raw.geoip6); is = context.getResources().openRawResource(R.raw.geoip6);
outFile = new File(installFolder, GEOIP6_ASSET_KEY); outFile = new File(installFolder, GEOIP6_ASSET_KEY);
streamToFile(is, outFile, false, true); streamToFile(is, outFile, false, true);
return true; return true;
} }
/* /*
private static void copyAssetFile(Context ctx, String asset, File file) throws IOException, InterruptedException private static void copyAssetFile(Context ctx, String asset, File file) throws IOException, InterruptedException
{ {
DataOutputStream out = new DataOutputStream(new FileOutputStream(file)); DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
InputStream is = new GZIPInputStream(ctx.getAssets().open(asset)); InputStream is = new GZIPInputStream(ctx.getAssets().open(asset));
byte buf[] = new byte[8172]; byte buf[] = new byte[8172];
int len; int len;
while ((len = is.read(buf)) > 0) { while ((len = is.read(buf)) > 0) {
out.write(buf, 0, len); out.write(buf, 0, len);
} }
out.close(); out.close();
is.close(); is.close();
}*/ }*/
/* /*
* Write the inputstream contents to the file * Write the inputstream contents to the file
*/ */
public static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException public static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
{ {
@ -204,16 +204,16 @@ public class TorResourceInstaller implements TorServiceConstants {
int bytecount; int bytecount;
OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append); OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append);
ZipInputStream zis = null; ZipInputStream zis = null;
if (zip) if (zip)
{ {
zis = new ZipInputStream(stm); zis = new ZipInputStream(stm);
ZipEntry ze = zis.getNextEntry(); ZipEntry ze = zis.getNextEntry();
stm = zis; stm = zis;
} }
while ((bytecount = stm.read(buffer)) > 0) while ((bytecount = stm.read(buffer)) > 0)
{ {
@ -226,7 +226,7 @@ public class TorResourceInstaller implements TorServiceConstants {
stm.close(); stm.close();
if (zis != null) if (zis != null)
zis.close(); zis.close();
return true; return true;
@ -234,89 +234,89 @@ public class TorResourceInstaller implements TorServiceConstants {
} }
//copy the file from inputstream to File output - alternative impl //copy the file from inputstream to File output - alternative impl
public static void copyFile (InputStream is, File outputFile) public static void copyFile (InputStream is, File outputFile)
{ {
try { try {
outputFile.createNewFile(); outputFile.createNewFile();
DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile)); DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
DataInputStream in = new DataInputStream(is); DataInputStream in = new DataInputStream(is);
int b = -1; int b = -1;
byte[] data = new byte[1024]; byte[] data = new byte[1024];
while ((b = in.read(data)) != -1) { while ((b = in.read(data)) != -1) {
out.write(data); out.write(data);
} }
if (b == -1); //rejoice if (b == -1); //rejoice
// //
out.flush(); out.flush();
out.close(); out.close();
in.close(); in.close();
// chmod? // chmod?
} catch (IOException ex) { } catch (IOException ex) {
Log.e(TorConstants.TAG, "error copying binary", ex); Log.e(TorConstants.TAG, "error copying binary", ex);
} }
} }
/**
* Copies a raw resource file, given its ID to the given location
* @param ctx context
* @param resid resource id
* @param file destination file
* @param mode file permissions (E.g.: "755")
* @throws IOException on error
* @throws InterruptedException when interrupted
*/
public static void copyRawFile(Context ctx, int resid, File file, String mode, boolean isZipd) throws IOException, InterruptedException
{
final String abspath = file.getAbsolutePath();
// Write the iptables binary
final FileOutputStream out = new FileOutputStream(file);
InputStream is = ctx.getResources().openRawResource(resid);
if (isZipd)
{
ZipInputStream zis = new ZipInputStream(is);
ZipEntry ze = zis.getNextEntry();
is = zis;
}
byte buf[] = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
is.close();
// Change the permissions
Runtime.getRuntime().exec("chmod "+mode+" "+abspath).waitFor();
}
/** /**
* Asserts that the binary files are installed in the bin directory. * Copies a raw resource file, given its ID to the given location
* @param ctx context * @param ctx context
* @param resid resource id
* @param file destination file
* @param mode file permissions (E.g.: "755")
* @throws IOException on error
* @throws InterruptedException when interrupted
*/
public static void copyRawFile(Context ctx, int resid, File file, String mode, boolean isZipd) throws IOException, InterruptedException
{
final String abspath = file.getAbsolutePath();
// Write the iptables binary
final FileOutputStream out = new FileOutputStream(file);
InputStream is = ctx.getResources().openRawResource(resid);
if (isZipd)
{
ZipInputStream zis = new ZipInputStream(is);
ZipEntry ze = zis.getNextEntry();
is = zis;
}
byte buf[] = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
is.close();
// Change the permissions
Runtime.getRuntime().exec("chmod "+mode+" "+abspath).waitFor();
}
/**
* Asserts that the binary files are installed in the bin directory.
* @param ctx context
* @param showErrors indicates if errors should be alerted * @param showErrors indicates if errors should be alerted
* @return false if the binary files could not be installed * @return false if the binary files could not be installed
*/ */
/* /*
public static boolean assertIpTablesBinaries(Context ctx, boolean showErrors) throws Exception { public static boolean assertIpTablesBinaries(Context ctx, boolean showErrors) throws Exception {
boolean changed = false; boolean changed = false;
// Check iptables_g1 // Check iptables_g1
File file = new File(ctx.getDir("bin",0), "iptables"); File file = new File(ctx.getDir("bin",0), "iptables");
copyRawFile(ctx, R.raw.iptables, file, CHMOD_EXEC, false); copyRawFile(ctx, R.raw.iptables, file, CHMOD_EXEC, false);
return true; return true;
}*/ }*/
} }

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.sandroproxy.ony.R;
import org.torproject.android.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import org.torproject.android.service.TorService; import org.torproject.android.service.TorService;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;

View File

@ -5,8 +5,8 @@ package org.torproject.android.settings;
import java.util.Locale; import java.util.Locale;
import org.sandroproxy.ony.R;
import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.RootCommands;
import org.torproject.android.R;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;
import android.content.Context; import android.content.Context;

View File

@ -20,23 +20,36 @@ import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
import org.sandroproxy.ony.R;
import org.torproject.android.Orbot;
import org.torproject.android.service.TorService;
import org.torproject.android.service.TorServiceConstants; import org.torproject.android.service.TorServiceConstants;
import com.runjva.sourceforge.jsocks.protocol.ProxyServer;
import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.VpnService; import android.net.VpnService;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.support.v4.app.NotificationCompat;
import android.util.Log; import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast; import android.widget.Toast;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class OrbotVpnService extends VpnService implements Handler.Callback { public class OrbotVpnService extends VpnService implements Handler.Callback {
private static final String TAG = "OrbotVpnService"; private static final String TAG = "DrobotVpnService";
private PendingIntent mConfigureIntent; private PendingIntent mConfigureIntent;
@ -48,14 +61,28 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
private ParcelFileDescriptor mInterface; private ParcelFileDescriptor mInterface;
private int mSocksProxyPort = 9999; private int mSocksProxyPort = 9999;
// private ProxyServer mProxyServer; private ProxyServer mProxyServer;
private final static int VPN_MTU = 1500; private final static int VPN_MTU = 1500;
private static final int NOTIFY_ID = 10;
private static final int TRANSPROXY_NOTIFY_ID = 20;
private static final int ERROR_NOTIFY_ID = 30;
private static final int HS_NOTIFY_ID = 40;
private boolean prefPersistNotifications = true;
private NotificationManager mNotificationManager = null;
private android.support.v4.app.NotificationCompat.Builder mNotifyBuilder;
private Notification mNotification;
private boolean mShowExpandedNotifications = false;
private boolean mNotificationShowing = false;
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
// The handler is only used to show messages. // The handler is only used to show messages.
if (mHandler == null) { if (mHandler == null) {
mHandler = new Handler(this); mHandler = new Handler(this);
} }
@ -63,7 +90,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
// Stop the previous session by interrupting the thread. // Stop the previous session by interrupting the thread.
if (mThreadVPN == null || (!mThreadVPN.isAlive())) if (mThreadVPN == null || (!mThreadVPN.isAlive()))
{ {
startSocksBypass (); startSocksBypass ();
setupTun2Socks(); setupTun2Socks();
} }
@ -71,22 +98,38 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
return START_STICKY; return START_STICKY;
} }
private void startSocksBypass () private void startSocksBypass(){
{ mThreadProxy = new Thread ()
{
public void run ()
{
try {
mProxyServer = new ProxyServer(new ServerAuthenticatorNone(null, null));
ProxyServer.setVpnService(OrbotVpnService.this);
mProxyServer.start(mSocksProxyPort, 5, InetAddress.getLocalHost());
} catch (Exception e) {
Log.d(TAG,"proxy server error: " + e.getLocalizedMessage(),e);
}
}
};
mThreadProxy.start();
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
if (mProxyServer != null){
mProxyServer.stop();
}
if (mInterface != null) if (mInterface != null){
try { try {
mInterface.close(); mInterface.close();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
}
} }
@Override @Override
@ -100,152 +143,158 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
private void setupTun2Socks() { private void setupTun2Socks() {
mThreadVPN = new Thread () mThreadVPN = new Thread ()
{ {
public void run () public void run ()
{ {
if (mInterface == null) if (mInterface == null)
{ {
// Set the locale to English (or probably any other language that^M // Set the locale to English (or probably any other language that^M
// uses Hindu-Arabic (aka Latin) numerals).^M // uses Hindu-Arabic (aka Latin) numerals).^M
// We have found that VpnService.Builder does something locale-dependent^M // We have found that VpnService.Builder does something locale-dependent^M
// internally that causes errors when the locale uses its own numerals^M // internally that causes errors when the locale uses its own numerals^M
// (i.e., Farsi and Arabic).^M // (i.e., Farsi and Arabic).^M
Locale.setDefault(new Locale("en")); Locale.setDefault(new Locale("en"));
Builder builder = new Builder(); Builder builder = new Builder();
builder.setMtu(VPN_MTU); builder.setMtu(VPN_MTU);
builder.addAddress("10.0.0.1",8); builder.addAddress("10.0.0.1",28);
builder.setSession("OrbotVPN"); builder.setSession("DrobotVPN");
builder.addRoute("0.0.0.0",0); builder.addRoute("0.0.0.0",0);
builder.addRoute("10.0.0.0",8); //builder.addRoute("192.0.0.0",8);
//builder.addRoute("192.0.0.0",8); //builder.addRoute("192.168.43.0",8);
//builder.addRoute("192.168.43.0",8);
builder.addDnsServer("8.8.8.8");
// Create a new interface using the builder and save the parameters. // Create a new interface using the builder and save the parameters.
mInterface = builder.setSession(mSessionName) mInterface = builder.setSession(mSessionName)
.setConfigureIntent(mConfigureIntent) .setConfigureIntent(mConfigureIntent)
.establish(); .establish();
try try
{ {
Tun2Socks.Start(mInterface, VPN_MTU, "10.0.0.2", "255.255.255.0", "localhost:" + TorServiceConstants.PORT_SOCKS_DEFAULT, "50.116.51.157:7300", true); Tun2Socks.Start(mInterface,
} VPN_MTU,
catch (Exception e) "10.0.0.2",
{ "255.255.255.0",
Log.d(TAG,"tun2Socks has stopped",e); "127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT,
} "10.0.0.1:" + String.valueOf(TorServiceConstants.TOR_DNS_PORT_DEFAULT),
} true);
}
};
mThreadVPN.start(); }
catch (Exception e)
{
Log.d(TAG,"tun2Socks has stopped",e);
}
}
}
};
mThreadVPN.start();
showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.drawable.ic_stat_tor);
} }
@Override @Override
public void onRevoke() { public void onRevoke() {
new Thread () new Thread ()
{ {
public void run() public void run()
{ {
try try
{ {
mInterface.close(); mInterface.close();
Tun2Socks.Stop(); Tun2Socks.Stop();
} }
catch (Exception e) catch (Exception e)
{ {
Log.d(TAG,"error stopping tun2socks",e); Log.d(TAG,"error stopping tun2socks",e);
} }
} }
}.start(); }.start();
clearNotifications();
super.onRevoke();
}
super.onRevoke(); private void clearNotifications()
}
/*
private void debugPacket(ByteBuffer packet)
{ {
if (mNotificationManager != null)
mNotificationManager.cancelAll();
mNotificationShowing = false;
int buffer = packet.get(); }
int version;
int headerlength;
version = buffer >> 4;
headerlength = buffer & 0x0F;
headerlength *= 4;
Log.d(TAG, "IP Version:"+version);
Log.d(TAG, "Header Length:"+headerlength);
String status = "";
status += "Header Length:"+headerlength;
buffer = packet.get(); //DSCP + EN @SuppressLint("NewApi")
buffer = packet.getChar(); //Total Length private void showToolbarNotification (String notifyMsg, int notifyType, int icon)
{
Log.d(TAG, "Total Length:"+buffer); //Reusable code.
Intent intent = new Intent(OrbotVpnService.this, Orbot.class);
PendingIntent pendIntent = PendingIntent.getActivity(OrbotVpnService.this, 0, intent, 0);
buffer = packet.getChar(); //Identification if (mNotifyBuilder == null)
Log.d(TAG, "Identification:"+buffer); {
buffer = packet.getChar(); //Flags + Fragment Offset mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
buffer = packet.get(); //Time to Live
buffer = packet.get(); //Protocol
Log.d(TAG, "Protocol:"+buffer); if (mNotifyBuilder == null)
{
mNotifyBuilder = new NotificationCompat.Builder(this)
.setContentTitle(getString(R.string.app_name))
.setSmallIcon(R.drawable.ic_stat_tor);
mNotifyBuilder.setContentIntent(pendIntent);
}
}
status += " Protocol:"+buffer; mNotifyBuilder.setContentText(notifyMsg);
mNotifyBuilder.setSmallIcon(icon);
buffer = packet.getChar(); //Header checksum if (notifyType != NOTIFY_ID)
{
mNotifyBuilder.setTicker(notifyMsg);
// mNotifyBuilder.setLights(Color.GREEN, 1000, 1000);
}
else
{
mNotifyBuilder.setTicker(null);
}
String sourceIP = ""; mNotifyBuilder.setOngoing(prefPersistNotifications);
buffer = packet.get(); //Source IP 1st Octet
sourceIP += buffer;
sourceIP += ".";
buffer = packet.get(); //Source IP 2nd Octet mNotification = mNotifyBuilder.build();
sourceIP += buffer;
sourceIP += ".";
buffer = packet.get(); //Source IP 3rd Octet if (Build.VERSION.SDK_INT >= 16 && mShowExpandedNotifications) {
sourceIP += buffer;
sourceIP += ".";
buffer = packet.get(); //Source IP 4th Octet
sourceIP += buffer;
Log.d(TAG, "Source IP:"+sourceIP); // Create remote view that needs to be set as bigContentView for the notification.
RemoteViews expandedView = new RemoteViews(this.getPackageName(),
R.layout.layout_notification_expanded);
status += " Source IP:"+sourceIP; StringBuffer sbInfo = new StringBuffer();
String destIP = "";
buffer = packet.get(); //Destination IP 1st Octet
destIP += buffer;
destIP += ".";
buffer = packet.get(); //Destination IP 2nd Octet if (notifyType == NOTIFY_ID)
destIP += buffer; expandedView.setTextViewText(R.id.text, notifyMsg);
destIP += "."; else
{
expandedView.setTextViewText(R.id.info, notifyMsg);
buffer = packet.get(); //Destination IP 3rd Octet }
destIP += buffer; expandedView.setTextViewText(R.id.title, getString(R.string.app_name));
destIP += ".";
buffer = packet.get(); //Destination IP 4th Octet expandedView.setImageViewResource(R.id.icon, icon);
destIP += buffer; mNotification.bigContentView = expandedView;
}
Log.d(TAG, "Destination IP:"+destIP); if (prefPersistNotifications && (!mNotificationShowing))
{
status += " Destination IP:"+destIP; startForeground(NOTIFY_ID, mNotification);
}
//Log.d(TAG, "version:"+packet.getInt()); else
//Log.d(TAG, "version:"+packet.getInt()); {
//Log.d(TAG, "version:"+packet.getInt()); mNotificationManager.notify(NOTIFY_ID, mNotification);
}
}*/
mNotificationShowing = true;
}
} }

View File

@ -25,6 +25,7 @@ import java.net.Socket;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.os.Build; import android.os.Build;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.util.Log;
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public class Tun2Socks public class Tun2Socks
@ -35,6 +36,8 @@ public class Tun2Socks
boolean doVpnProtect(DatagramSocket socket); boolean doVpnProtect(DatagramSocket socket);
}; };
private static final String TAG = Tun2Socks.class.getSimpleName();
private static final boolean LOGD = true;
private static Thread mThread; private static Thread mThread;
private static ParcelFileDescriptor mVpnInterfaceFileDescriptor; private static ParcelFileDescriptor mVpnInterfaceFileDescriptor;
@ -61,11 +64,11 @@ public class Tun2Socks
boolean udpgwTransparentDNS) boolean udpgwTransparentDNS)
{ {
if (!mLibLoaded) if (!mLibLoaded)
{ {
System.loadLibrary("tun2socks"); System.loadLibrary("tun2socks");
mLibLoaded = true; mLibLoaded = true;
} }
mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor; mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor;
mVpnInterfaceMTU = vpnInterfaceMTU; mVpnInterfaceMTU = vpnInterfaceMTU;
@ -76,16 +79,14 @@ public class Tun2Socks
mUdpgwTransparentDNS = udpgwTransparentDNS; mUdpgwTransparentDNS = udpgwTransparentDNS;
if (mVpnInterfaceFileDescriptor != null) if (mVpnInterfaceFileDescriptor != null)
runTun2Socks( runTun2Socks(
mVpnInterfaceFileDescriptor.detachFd(), mVpnInterfaceFileDescriptor.detachFd(),
mVpnInterfaceMTU, mVpnInterfaceMTU,
mVpnIpAddress, mVpnIpAddress,
mVpnNetMask, mVpnNetMask,
mSocksServerAddress, mSocksServerAddress,
mUdpgwServerAddress, mUdpgwServerAddress,
mUdpgwTransparentDNS ? 1 : 0); mUdpgwTransparentDNS ? 1 : 0);
} }
public static void Stop() public static void Stop()
@ -95,6 +96,22 @@ public class Tun2Socks
} }
public static void logTun2Socks(
String level,
String channel,
String msg)
{
String logMsg = level + "(" + channel + "): " + msg;
if (0 == level.compareTo("ERROR"))
{
Log.e(TAG, logMsg);
}
else
{
if (LOGD) Log.d(TAG, logMsg);
}
}
private native static int runTun2Socks( private native static int runTun2Socks(
int vpnInterfaceFileDescriptor, int vpnInterfaceFileDescriptor,
int vpnInterfaceMTU, int vpnInterfaceMTU,

View File

@ -2,7 +2,7 @@ package org.torproject.android.wizard;
import java.util.Locale; import java.util.Locale;
import org.torproject.android.R; import org.sandroproxy.ony.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;
@ -24,66 +24,66 @@ import android.widget.Toast;
public class ChooseLocaleWizardActivity extends Activity implements TorConstants { public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
private int flag = 0; private int flag = 0;
private ListView listLocales; private ListView listLocales;
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
setContentView(R.layout.layout_wizard_locale); setContentView(R.layout.layout_wizard_locale);
listLocales = (ListView)findViewById(R.id.wizard_locale_list); listLocales = (ListView)findViewById(R.id.wizard_locale_list);
Button next = ((Button)findViewById(R.id.btnWizard2)); Button next = ((Button)findViewById(R.id.btnWizard2));
// next.setEnabled(false); // next.setEnabled(false);
String[] strLangs = getResources().getStringArray(R.array.languages); String[] strLangs = getResources().getStringArray(R.array.languages);
strLangs[0] = Locale.getDefault().getDisplayName(); strLangs[0] = Locale.getDefault().getDisplayName();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs);
listLocales.setAdapter(adapter); listLocales.setAdapter(adapter);
listLocales.setSelection(0); listLocales.setSelection(0);
listLocales.setOnItemClickListener(new OnItemClickListener() { listLocales.setOnItemClickListener(new OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> arg0, View arg1, public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) { int arg2, long arg3) {
setLocalePref(arg2); setLocalePref(arg2);
finish(); finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class)); startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
} }
}); });
next.setOnClickListener(new View.OnClickListener() { next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
setLocalePref(0); setLocalePref(0);
finish(); finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class)); startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
} }
}); });
} }
private void setLocalePref(int selId) private void setLocalePref(int selId)
{ {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Configuration config = getResources().getConfiguration(); Configuration config = getResources().getConfiguration();
@ -91,18 +91,18 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
String lang = localeVals[selId]; String lang = localeVals[selId];
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();
pEdit.putString(PREF_DEFAULT_LOCALE, lang); pEdit.putString(PREF_DEFAULT_LOCALE, lang);
pEdit.commit(); pEdit.commit();
Locale locale = null; Locale locale = null;
if (lang.equals("xx")) if (lang.equals("xx"))
{ {
locale = Locale.getDefault(); locale = Locale.getDefault();
} }
else else
locale = new Locale(lang); locale = new Locale(lang);
Locale.setDefault(locale); Locale.setDefault(locale);
config.locale = locale; config.locale = locale;
@ -111,26 +111,26 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
} }
@Override @Override
protected void onRestoreInstanceState(Bundle savedInstanceState) { protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState); super.onRestoreInstanceState(savedInstanceState);
} }
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
//Code to override the back button! //Code to override the back button!
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
Toast.makeText(getApplicationContext(), R.string.wizard_exit_at_first_screen_toast, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.wizard_exit_at_first_screen_toast, Toast.LENGTH_SHORT).show();
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -1,12 +1,8 @@
package org.torproject.android.wizard; package org.torproject.android.wizard;
import org.sandroproxy.ony.R;
import org.torproject.android.Orbot; import org.torproject.android.Orbot;
import org.torproject.android.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import org.torproject.android.R.drawable;
import org.torproject.android.R.id;
import org.torproject.android.R.layout;
import org.torproject.android.R.string;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;
import org.torproject.android.settings.AppManager; import org.torproject.android.settings.AppManager;

View File

@ -1,6 +1,6 @@
package org.torproject.android.wizard; package org.torproject.android.wizard;
import org.torproject.android.R; import org.sandroproxy.ony.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;

View File

@ -1,7 +1,7 @@
package org.torproject.android.wizard; package org.torproject.android.wizard;
import org.sandroproxy.ony.R;
import org.sufficientlysecure.rootcommands.RootCommands; import org.sufficientlysecure.rootcommands.RootCommands;
import org.torproject.android.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import org.torproject.android.service.TorServiceUtils; import org.torproject.android.service.TorServiceUtils;
@ -22,48 +22,48 @@ import android.widget.TextView;
public class Permissions extends Activity implements TorConstants { public class Permissions extends Activity implements TorConstants {
private Context context; private Context context;
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
context = this; context = this;
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
setContentView(R.layout.layout_wizard_permissions); setContentView(R.layout.layout_wizard_permissions);
stepFourRoot(); stepFourRoot();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
} }
private void stepFourRoot(){ private void stepFourRoot(){
String msg1 = context.getString(R.string.wizard_permissions_root_msg1); String msg1 = context.getString(R.string.wizard_permissions_root_msg1);
String msg2 = context.getString(R.string.wizard_permissions_root_msg2); String msg2 = context.getString(R.string.wizard_permissions_root_msg2);
TextView txtBody1 = ((TextView)findViewById(R.id.WizardTextBody1)); TextView txtBody1 = ((TextView)findViewById(R.id.WizardTextBody1));
txtBody1.setText(msg1); txtBody1.setText(msg1);
TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2)); TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2));
txtBody2.setText(msg2); txtBody2.setText(msg2);
txtBody2.setVisibility(TextView.VISIBLE); txtBody2.setVisibility(TextView.VISIBLE);
Button grantPermissions = ((Button)findViewById(R.id.grantPermissions)); Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
grantPermissions.setVisibility(Button.VISIBLE); grantPermissions.setVisibility(Button.VISIBLE);
Button back = ((Button)findViewById(R.id.btnWizard1)); Button back = ((Button)findViewById(R.id.btnWizard1));
Button next = ((Button)findViewById(R.id.btnWizard2)); Button next = ((Button)findViewById(R.id.btnWizard2));
@ -74,133 +74,133 @@ public class Permissions extends Activity implements TorConstants {
consent.setOnCheckedChangeListener(new OnCheckedChangeListener (){ consent.setOnCheckedChangeListener(new OnCheckedChangeListener (){
public void onCheckedChanged(CompoundButton buttonView, public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) { boolean isChecked) {
//this is saying do not use root //this is saying do not use root
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();
pEdit.putBoolean(PREF_TRANSPARENT, false); pEdit.putBoolean(PREF_TRANSPARENT, false);
pEdit.putBoolean(PREF_TRANSPARENT_ALL, false); pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit.putBoolean(PREF_HAS_ROOT, false); pEdit.putBoolean(PREF_HAS_ROOT, false);
pEdit.commit(); pEdit.commit();
/* /*
Button next = ((Button)findViewById(R.id.btnWizard2)); Button next = ((Button)findViewById(R.id.btnWizard2));
if(isChecked) if(isChecked)
next.setEnabled(true); next.setEnabled(true);
else else
next.setEnabled(false); next.setEnabled(false);
*/ */
stepFour(); stepFour();
} }
}); });
grantPermissions.setOnClickListener(new View.OnClickListener() { grantPermissions.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
//Check and Install iptables - TorTransProxy.testOwnerModule(this) //Check and Install iptables - TorTransProxy.testOwnerModule(this)
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean hasRoot = RootCommands.rootAccessGiven(); boolean hasRoot = RootCommands.rootAccessGiven();
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();
pEdit.putBoolean(PREF_HAS_ROOT,hasRoot); pEdit.putBoolean(PREF_HAS_ROOT,hasRoot);
pEdit.commit(); pEdit.commit();
if (!hasRoot) if (!hasRoot)
{ {
stepFour(); stepFour();
} }
else else
{ {
finish(); finish();
startActivity(new Intent(Permissions.this, ConfigureTransProxy.class)); startActivity(new Intent(Permissions.this, ConfigureTransProxy.class));
} }
} }
}); });
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivity(new Intent(Permissions.this, LotsaText.class)); startActivity(new Intent(Permissions.this, LotsaText.class));
} }
}); });
next.setOnClickListener(new View.OnClickListener() { next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivity(new Intent(Permissions.this, TipsAndTricks.class)); startActivity(new Intent(Permissions.this, TipsAndTricks.class));
} }
}); });
} }
private void stepFour(){ private void stepFour(){
String title = context.getString(R.string.wizard_permissions_title); String title = context.getString(R.string.wizard_permissions_title);
String msg = context.getString(R.string.wizard_permissions_no_root_msg); String msg = context.getString(R.string.wizard_permissions_no_root_msg);
setTitle(title); setTitle(title);
TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody1)); TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody1));
txtBody.setText(msg); txtBody.setText(msg);
Button btn1 = ((Button)findViewById(R.id.btnWizard1)); Button btn1 = ((Button)findViewById(R.id.btnWizard1));
Button btn2 = ((Button)findViewById(R.id.btnWizard2)); Button btn2 = ((Button)findViewById(R.id.btnWizard2));
btn2.setEnabled(true); btn2.setEnabled(true);
TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2)); TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2));
txtBody2.setVisibility(TextView.GONE); txtBody2.setVisibility(TextView.GONE);
Button grantPermissions = ((Button)findViewById(R.id.grantPermissions)); Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
grantPermissions.setVisibility(Button.GONE); grantPermissions.setVisibility(Button.GONE);
CheckBox consent = (CheckBox)findViewById(R.id.checkBox); CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
consent.setVisibility(CheckBox.GONE); consent.setVisibility(CheckBox.GONE);
btn1.setOnClickListener(new View.OnClickListener() { btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivity(new Intent(Permissions.this, LotsaText.class)); startActivity(new Intent(Permissions.this, LotsaText.class));
} }
}); });
btn2.setOnClickListener(new View.OnClickListener() { btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivity(new Intent(Permissions.this, TipsAndTricks.class)); startActivity(new Intent(Permissions.this, TipsAndTricks.class));
} }
}); });
} }
//Code to override the back button! //Code to override the back button!
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
finish(); finish();
startActivity(new Intent(getBaseContext(), LotsaText.class)); startActivity(new Intent(getBaseContext(), LotsaText.class));
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -1,7 +1,7 @@
package org.torproject.android.wizard; package org.torproject.android.wizard;
import org.sandroproxy.ony.R;
import org.torproject.android.Orbot; import org.torproject.android.Orbot;
import org.torproject.android.R;
import org.torproject.android.TorConstants; import org.torproject.android.TorConstants;
import android.app.Activity; import android.app.Activity;
@ -17,137 +17,137 @@ import android.widget.TextView;
public class TipsAndTricks extends Activity implements TorConstants { public class TipsAndTricks extends Activity implements TorConstants {
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
setContentView(R.layout.layout_wizard_tips); setContentView(R.layout.layout_wizard_tips);
stepFive(); stepFive();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
} }
void stepFive(){ void stepFive(){
String title = getString(R.string.wizard_tips_title); String title = getString(R.string.wizard_tips_title);
setTitle(title); setTitle(title);
Button btnLink = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot); Button btnLink = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.gibberbot_apk_url); String url = getString(R.string.gibberbot_apk_url);
finish(); finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallOrweb); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallOrweb);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.orweb_apk_url); String url = getString(R.string.orweb_apk_url);
finish(); finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallDuckgo); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallDuckgo);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.duckgo_apk_url); String url = getString(R.string.duckgo_apk_url);
finish(); finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallFirefox); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallFirefox);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.proxymob_setup_url); String url = getString(R.string.proxymob_setup_url);
finish(); finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallTwitter); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallTwitter);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.twitter_setup_url); String url = getString(R.string.twitter_setup_url);
finish(); finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallStoryMaker); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallStoryMaker);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.story_maker_url); String url = getString(R.string.story_maker_url);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonInstallMartus); btnLink = (Button)findViewById(R.id.WizardRootButtonInstallMartus);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.martus_url); String url = getString(R.string.martus_url);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
btnLink = (Button)findViewById(R.id.WizardRootButtonGooglePlay); btnLink = (Button)findViewById(R.id.WizardRootButtonGooglePlay);
btnLink.setOnClickListener(new OnClickListener() { btnLink.setOnClickListener(new OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
String url = getString(R.string.wizard_tips_play_url); String url = getString(R.string.wizard_tips_play_url);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} }
}); });
Button back = ((Button)findViewById(R.id.btnWizard1)); Button back = ((Button)findViewById(R.id.btnWizard1));
@ -155,95 +155,91 @@ public class TipsAndTricks extends Activity implements TorConstants {
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1); startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
} }
}); });
next.setOnClickListener(new View.OnClickListener() { next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
showWizardFinal(); showWizardFinal();
} }
}); });
} }
private void showWizardFinal () private void showWizardFinal ()
{ {
setContentView(R.layout.scrollingtext_buttons_view); setContentView(R.layout.scrollingtext_buttons_view);
String title = getString(R.string.wizard_final); String title = getString(R.string.wizard_final);
String msg = getString(R.string.wizard_final_msg); String msg = getString(R.string.wizard_final_msg);
setTitle(title); setTitle(title);
TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody)); TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
txtBody.setText(msg); txtBody.setText(msg);
Button btn1 = ((Button)findViewById(R.id.btnWizard1)); Button btn1 = ((Button)findViewById(R.id.btnWizard1));
Button btn2 = ((Button)findViewById(R.id.btnWizard2)); Button btn2 = ((Button)findViewById(R.id.btnWizard2));
btn2.setText(getString(R.string.btn_finish)); btn2.setText(getString(R.string.btn_finish));
btn1.setVisibility(Button.VISIBLE); btn1.setVisibility(Button.VISIBLE);
btn1.setOnClickListener(new View.OnClickListener() { btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
startActivity(new Intent(TipsAndTricks.this, Permissions.class)); startActivity(new Intent(TipsAndTricks.this, Permissions.class));
} }
}); });
btn2.setOnClickListener(new View.OnClickListener() { btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
} }
}); });
} }
//Code to override the back button! //Code to override the back button!
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
finish(); finish();
startActivity(new Intent(getBaseContext(), Permissions.class)); startActivity(new Intent(getBaseContext(), Permissions.class));
return true; return true;
} }
return false; return false;
} }
/* /*
private void showWizardFinal () private void showWizardFinal ()
{ {
String title = null; String title = null;
String msg = null; String msg = null;
title = context.getString(R.string.wizard_final); title = context.getString(R.string.wizard_final);
msg = context.getString(R.string.wizard_final_msg); msg = context.getString(R.string.wizard_final_msg);
DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
context.startActivity(new Intent(context, Orbot.class)); context.startActivity(new Intent(context, Orbot.class));
} }
}; };
new AlertDialog.Builder(context) new AlertDialog.Builder(context)
.setIcon(R.drawable.icon) .setIcon(R.drawable.icon)
.setTitle(title) .setTitle(title)
.setPositiveButton(R.string.button_close, ocListener) .setPositiveButton(R.string.button_close, ocListener)
.setMessage(msg) .setMessage(msg)
.show(); .show();
}*/
}*/
} }