fixed merge conflicts

This commit is contained in:
amoghbl1 2014-06-20 02:01:17 +05:30
commit 43eac85644
28 changed files with 972 additions and 606 deletions

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/jtorctl.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="lib" path="/home/amoghbl1/git/n8fr8/jtorctl.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android"
android:versionName="14.0.0-ALPHA-4"
android:versionCode="93"
android:installLocation="auto"
android:versionName="14.0.4.1"
android:versionCode="107"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
@ -18,13 +17,12 @@
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:description="@string/app_description"
android:configChanges="locale|orientation|screenSize"
android:theme="@style/Theme.AppCompat"
android:allowBackup="false"
android:allowClearUserData="true"
android:largeHeap="true"
android:largeHeap="true"
>
<activity android:name=".Orbot" android:configChanges="orientation|screenSize"

View File

@ -1,5 +1,96 @@
NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
7ec6de7 update to 14.0.4.1
298a01e make sure transproxy is renabled when network returns
2eb79a5 fulfilles the wishes of #12413 by support --default-torrc and -f
b6715b4 fixes #12411 and #12412 enables DNS and transport by default with new Orbot settings to enable user to easily change/disable
fc608d3 update to 14.0.4
0129976 improve ability to do a full clean stop of all services
af51290 add support for updating Polipo config
156ed57 clean up unbind process and service shutdown
8a59cfb use canonical paths to ensure shell commands are correct also cleanup torrc updating
f3d21ee improve resource installer ability to update torrc
c0f7d75 use one prefs instance
2ce9ea9 make default config files have ports off by default (0)
9025fc5 update to 14.0.3.1
dee0d19 improve logic for updating torrc files (not so often)
44648f1 clean up bind/unbind and handleIntent wizard logic
917ec8d update torrc and torrcdiag when you need to
f91a35b update tor binary constants to force upgrade
65eb7ad fix torrc defaults - add back in avoiddiskwrites
c04fc95 update to 14.0.3
42e0698 don't stop tor when service onStartCommand() is called again
fc63929 ensure diag/test mode stop's Tor on activity exit
328c6af tune bind/create service logic
4716696 make transport settings dynamic (remove from torrc)
2fe57e8 pegging tor to 0.2.4.22
00b535e updated to 14.0.2.1
c2be4ac ensure polipo conf is updated; default to 9051 for ctrl port
6ab9a7b reduce memory usage of polipo
b26b9d4 update to 14.0.2
aa8ff95 ensure readers are closed; ensure socks settings are applied
b4fa943 improve process id finding using android 'toolbox'
2d6a7b3 renable large heap request
d7f3f19 more fixes for UI disconnect issue ensure service and status updates occur on new layout updates
7e76162 bumping to 14.0.1
af51a98 allow support for adding custom lines to torrc
22938c9 multiple fixes for tor start including "auto" control port also try to kill hung tor process
0224365 ensure torrc values are overwritten
81bd617 updating to 14.0.0 build 100!
98ea6d5 update changelog
5776a87 update to 14.0.0-RC3
bf6a1da update state when service connects
451cfed keep SOCKS port as default 9050 (instead of 'auto')
f94e27a updated to 14.0.0-RC-1
bedeb71 more fixes for hidden service configuration now multiple ports are properly configured and notification will display correctl
051cce4 don't allow the tor control port socket to timeout
f4baf4d updated to 2.0.21-stable
120da6b more wizard flow fixes
816a6b2 updating to 1.1.1
24773c3 update to OpenSSL 1.0.1h
8b5bb04 Makefile patch for Orbot
ccaec1e update 14.0.0-BETA-2
da3c955 fixes for tor setConf/control port fixes hidden service support manages socks port conflicts
9345186 remove unnecessary line
707bca4 amek sure wizard only is shown once on start (not twice!)
0fddd80 fix for missing libs folder
7abea23 removing binaries from repo
70d7792 updated changelog
2650fda update to 14.0.0-BETA-1
476dc1a update binaries for 0.2.4.22 Tor
b6116b5 switch to 0.2.4.22 version of Tor for release
148e7eb remove deletion of polipo folder
352c23b updated binaries for OpenSSL 1.0.1h
7622d2c update constant for 1.0.1h and latest openssl vuln http://ccsinjection.lepidum.co.jp/blog/2014-06-05/CCS-Injection-en/index.h
d392439 fix bridge append value from qrcode scan
d6f5720 remove synchronized - not needed, and causing blocking
f52c22a Merge branch 'amoghbl1-issue_3014_wizard_workflow'
f6750e1 sometimes text can be null
fd47e70 fix control port connections with socket timeouts
36a6349 status should update whether there is msg or not
63b4304 Merge branch 'issue_3014_wizard_workflow' of https://github.com/amoghbl1/orbot-1 into amoghbl1-issue_3014_wizard_workflow
25f6499 Merge branch 'master' of github.com:n8fr8/orbot
e2e0d26 Merge branch 'hans_feature_desc'
c1f9296 new work on binding and service starting
e2e00cc removed largeheap value
13ef143 add app description to manifest to support p2p distribution
c111030 Merge pull request #1 from amoghbl1/issue_2374_story_maker
4759d9f implemented button click function for the story maker button, also url added in strings, change to liking at review
53e82b1 general cleanup, removed log.d's
6488e6a cleaned Permissions workflow, implemented override for back button
935fa91 cleaned LotsaText workflow, implemented override for back button
f29a494 cleaned ConfigureTransProxy workflow, implemented override for back button
ea384f9 cleaned ChooseLocaleWizardActivity workflow, implemented override for back button and added toast warning message string
ffcfce7 cleaned TipsAndTricks workflow
255623a added the story maker button to the tips wizard page, also added tip string to the strings file.
23c689c added icon for story maker button to be added to the hints and tips page
cfc8a99 updated to 14.0.0-ALPHA-4
278997d simple notification of bridge settings via URL
17934e6 initial support for setting bridge through URL
96c0a54 add large heap and remote process settings back in
726cf0c work to stabilize Tor background service auto-restart tor binary process if killed by Android OS print out debug info related
11c31fa update the changelog
14.0.0 (ALPHA-2)
583c758 updated to 14.0.0-ALPHA-3
90848b0 reduce memory usage of app and make single process

17
external/Makefile vendored
View File

@ -23,15 +23,11 @@ endif
# Android NDK setup
NDK_BASE ?= /opt/android-ndk
NDK_PLATFORM_LEVEL ?= 9
NDK_ABI=arm
NDK_PLATFORM_LEVEL ?= 9
NDK_ABI ?= arm
NDK_TOOLCHAIN_VERSION=4.8
NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
APP_ABI=armeabi
# NDK platform level, aka APP_PLATFORM, is equivalent to minSdkVersion
APP_PLATFORM := android-$(shell sed -n 's,.*android:minSdkVersion="\([0-9][0-9]*\)".*,\1,p' \
$(EXTERNAL_ROOT)/../AndroidManifest.xml)
NDK_SYSROOT=$(NDK_BASE)/platforms/$(APP_PLATFORM)/arch-$(NDK_ABI)
APP_ABI ?= armeabi
NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
ifeq ($(NDK_ABI),x86)
HOST = i686-linux-android
@ -85,14 +81,14 @@ all: assets
lib/libcrypto.a:
cd openssl && \
./Configure android -DL_ENDIAN && \
make CC="$(CC)" ANDROID_DEV=$(NDK_BASE)/platforms/android-8/arch-arm /usr build_libs
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
lib/libssl.a:
cp config.sub openssl
cp config.guess openssl
cd openssl && \
./Configure android -DL_ENDIAN && \
make CC="$(CC)" ANDROID_DEV=$(NDK_BASE)/platforms/android-8/arch-arm /usr build_libs
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
openssl-build-stamp: lib/libcrypto.a lib/libssl.a
touch openssl-build-stamp
@ -294,7 +290,6 @@ polipo: polipo-build-stamp
polipo-clean:
-rm -f bin/polipo
-rm -f polipo-build-stamp
-rm -rf polipo
#------------------------------------------------------------------------------#
# JTorControl library
@ -352,8 +347,8 @@ clean: openssl-clean libevent-clean tor-clean polipo-clean jtorctl-clean liballi
showsetup:
@echo "NDK_TOOLCHAIN_VERSION: $(NDK_TOOLCHAIN_VERSION)"
@echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)"
@echo "NDK_PLATFORM_LEVEL: $(NDK_PLATFORM_LEVEL)"
@echo "NDK_SYSROOT: $(NDK_SYSROOT)"
@echo "APP_PLATFORM: $(APP_PLATFORM)"
@echo "APP_ABI: $(APP_ABI)"
@echo "HOST: $(HOST)"
@echo "CC: $(CC)"

3
libs/README.md Normal file
View File

@ -0,0 +1,3 @@
Please build the necessary dependency jars from the external folder:
make -c external

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -44,15 +44,15 @@ socksProxyType = socks5
# Uncomment this if you want Polipo to use a ridiculously small amount
# of memory (a hundred C-64 worth or so):
# chunkHighMark = 819200
# objectHighMark = 128
chunkHighMark = 819200
objectHighMark = 128
# Uncomment this if you've got plenty of memory:
# chunkHighMark = 50331648
# objectHighMark = 16384
chunkHighMark = 67108864
#chunkHighMark = 67108864
### On-disk data
### ************

View File

@ -1,11 +1,7 @@
Log notice stdout
ControlListenAddress 127.0.0.1
ControlPort 9051
ControlPort auto
SOCKSPort 0
DNSPort 0
TransPort 0
CookieAuthentication 1
TransPort 9040
TransListenAddress 127.0.0.1
DNSPort 5400
DNSListenAddress 127.0.0.1
AvoidDiskWrites 1
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsOnResolve 1
AvoidDiskWrites 1

View File

@ -1,16 +1,7 @@
SocksPort 9050
SOCKSListenAddress 127.0.0.1
SafeSocks 0
TestSocks 1
WarnUnsafeSocks 1
Log info stdout
ControlListenAddress 127.0.0.1
ControlPort 9051
Log debug stdout
ControlPort auto
SOCKSPort 0
DNSPort 0
TransPort 0
CookieAuthentication 1
TransPort 9040
TransListenAddress 127.0.0.1
DNSPort 5400
DNSListenAddress 127.0.0.1
AvoidDiskWrites 1
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsOnResolve 1
AvoidDiskWrites 1

Binary file not shown.

View File

@ -1,6 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="app_name">Orbot</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="default_web_url">http://check.torproject.org</string>
<string name="secure_default_web_url">https://check.torproject.org</string>
@ -86,6 +87,7 @@
<string name="wizard_proxy_help_msg">If the Android app you are using can support the use of an HTTP or SOCKS proxy, then you can configure it to connect to Orbot and use Tor.\n\n\n The host settings is 127.0.0.1 or \"localhost\". For HTTP, the port setting is 8118. For SOCKS, the proxy is 9050. You should use SOCKS4A or SOCKS5 if possible.\n \n\n\n You can learn more about proxying on Android via the FAQ at: http://tinyurl.com/proxyandroid\n </string>
<string name="wizard_final">Orbot is ready!</string>
<string name="wizard_final_msg">Hundreds of thousands of people around the world use Tor for a wide variety of reasons.\n\nJournalists and bloggers, human rights defenders, law enforcement officers, soldiers, corporations, citizens of repressive regimes, and just ordinary citizens&#8230; and now you are ready to, as well!</string>
<string name="wizard_exit_at_first_screen_toast">Please configure Orbot before you can start using it!</string>
<!--END Welcome Wizard strings (DJH)-->
<string name="connect_first_time">You\'ve successfully connected to the Tor network - but this does NOT mean your device is secure. You can use the \'Check\' option from the menu to test your browser. \n\nVisit us at https://guardianproject.info/apps/orbot or send an email to help@guardianproject.info to learn more.</string>
<string name="tor_check">This will open your web browser to https://check.torproject.org in order to see if Orbot is probably configured and you are connected to Tor.</string>
@ -255,4 +257,23 @@
<string name="network_connectivity_is_good_waking_tor_up_">Network connectivity is good. Waking Tor up...</string>
<string name="updating_settings_in_tor_service">updating settings in Tor service</string>
<string name="pref_socks_title">Tor SOCKS</string>
<string name="pref_socks_summary">Port that Tor offers its SOCKS proxy on (default: 9050 or 0 to disable)</string>
<string name="pref_socks_dialog">SOCKS Port Config</string>
<string name="pref_transport_title">Tor TransProxy Port</string>
<string name="pref_transport_summary">Port that Tor offers its Transparent Proxy on (default: 9040 or 0 to disable)</string>
<string name="pref_transport_dialog">TransProxy Port Config</string>
<string name="pref_dnsport_title">Tor DNS Port</string>
<string name="pref_dnsport_summary">Port that Tor offers its DNS on (default: 5400 or 0 to disable)</string>
<string name="pref_dnsport_dialog">DNS Port Config</string>
<string name="pref_torrc_title">Torrc Custom Config</string>
<string name="pref_torrc_summary">EXPERTS ONLY: enter direct torrc config lines</string>
<string name="pref_torrc_dialog">Custom Torrc</string>
</resources>

View File

@ -196,6 +196,36 @@ android:dialogTitle="@string/pref_proxy_password_dialog"
</PreferenceCategory>
<PreferenceCategory android:title="Debug">
<EditTextPreference android:key="pref_socks"
android:title="@string/pref_socks_title"
android:summary="@string/pref_socks_summary"
android:dialogTitle="@string/pref_socks_dialog"
android:defaultValue="9050"
/>
<EditTextPreference android:key="pref_transport"
android:title="@string/pref_transport_title"
android:summary="@string/pref_transport_summary"
android:dialogTitle="@string/pref_transport_dialog"
android:defaultValue="9040"
/>
<EditTextPreference android:key="pref_dnsport"
android:title="@string/pref_dnsport_title"
android:summary="@string/pref_dnsport_summary"
android:dialogTitle="@string/pref_dnsport_dialog"
android:defaultValue="5400"
/>
<EditTextPreference android:key="pref_custom_torrc"
android:title="@string/pref_torrc_title"
android:summary="@string/pref_torrc_summary"
android:dialogTitle="@string/pref_torrc_dialog"
android:defaultValue=""
/>
<CheckBoxPreference
android:key="pref_enable_logging"
android:defaultValue="false"

View File

@ -33,6 +33,8 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -81,28 +83,39 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
/* The primary interface we will be calling on the service. */
ITorService mService = null;
//should move this up with all the other class variables
private boolean mIsBound = false;
private Intent mTorService = null;
private SharedPreferences mPrefs = null;
private boolean autoStartFromIntent = false;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TorServiceUtils.getSharedPrefs(getApplicationContext()).registerOnSharedPreferenceChangeListener(this);
mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
mPrefs.registerOnSharedPreferenceChangeListener(this);
setLocale();
doLayout();
mTorService = new Intent(this, TorService.class);
getApplication().getApplicationContext().startService(mTorService);
appConflictChecker ();
startService ();
}
Intent torService;
private void startService ()
{
torService = new Intent(this, TorService.class);
startService(torService);
bindService(torService,
mConnection, Context.BIND_AUTO_CREATE);
}
private void doLayout ()
@ -159,11 +172,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
downloadText.setText(formatCount(0) + " / " + formatTotal(0));
uploadText.setText(formatCount(0) + " / " + formatTotal(0));
updateStatus("");
// Gesture detection
mGestureDetector = new GestureDetector(this, new MyGestureDetector());
}
@ -178,7 +189,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
private void appendLogTextAndScroll(String text)
{
if(mTxtOrbotLog != null){
if(mTxtOrbotLog != null && text != null && text.length() > 0){
if (mTxtOrbotLog.getText().length() > MAX_LOG_LENGTH)
mTxtOrbotLog.setText("");
@ -373,7 +384,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
else if (item.getItemId() == R.id.menu_wizard)
{
startWizard();
startActivity(new Intent(this, ChooseLocaleWizardActivity.class));
}
else if (item.getItemId() == R.id.menu_verify)
{
@ -416,6 +428,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
//terminology but also making sure there are clear distinctions in control
stopTor();
if (mConnection != null)
unbindService(mConnection);
//perhaps this should be referenced as INTENT_TOR_SERVICE as in startService
stopService(new Intent(this,TorService.class));
@ -442,6 +457,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
if (aDialog != null)
aDialog.dismiss();
}
private void doTorCheck ()
@ -475,7 +491,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
private void enableHiddenServicePort (int hsPort)
{
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = mPrefs.edit();
@ -515,34 +530,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
setResult(RESULT_OK, nResult);
}
/* (non-Javadoc)
* @see android.app.Activity#onResume()
*/
protected void onResume() {
super.onResume();
bindService();
updateStatus("");
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
try {
Log.d("lala", ""+mService.getStatus());
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
updateStatus("");
handleIntents();
}
private void handleIntents ()
private synchronized void handleIntents ()
{
if (getIntent() == null)
return;
@ -594,12 +584,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
{
autoStartFromIntent = true;
if (mService == null)
{
bindService();
}
else
{
if (mService != null)
{
try {
startTor();
} catch (RemoteException e) {
@ -624,10 +610,23 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
newBridgeValue = URLDecoder.decode(newBridgeValue); //decode the value here
showAlert("Bridges Updated","Restart Orbot to use this bridge: " + newBridgeValue,false);
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
Editor pEdit = mPrefs.edit();
pEdit.putString(TorConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
if (bridges != null && bridges.trim().length() > 0)
{
if (bridges.indexOf('\n')!=-1)
bridges += '\n' + newBridgeValue;
else
bridges += ',' + newBridgeValue;
}
else
bridges = newBridgeValue;
pEdit.putString(TorConstants.PREF_BRIDGES_LIST,bridges); //set the string to a preference
pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED,true);
pEdit.commit();
}
@ -636,21 +635,16 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
else
{
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean showWizard = mPrefs.getBoolean("show_wizard",true);
showWizard = mPrefs.getBoolean("show_wizard",showWizard);
if (showWizard)
{
Editor pEdit = mPrefs.edit();
pEdit.putBoolean("show_wizard",false);
pEdit.commit();
startWizard();
//startActivityForResult(new Intent(getApplicationContext(), LotsaText.class), 1);
pEdit.commit();
showWizard = false;
startActivity(new Intent(this, ChooseLocaleWizardActivity.class));
}
@ -661,7 +655,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
private boolean showWizard = true;
@Override
@ -669,6 +663,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
super.onConfigurationChanged(newConfig);
doLayout();
updateStatus("");
}
/* (non-Javadoc)
@ -686,7 +681,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
*/
private void openBrowser(final String browserLaunchUrl)
{
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean isOrwebInstalled = appInstalledOrNot("info.guardianproject.browser");
boolean isTransProxy = mPrefs.getBoolean("pref_transparent", false);
@ -767,20 +761,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
}
/*
* Show the help view - a popup dialog
*/
private void startWizard ()
{
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = mPrefs.edit();
pEdit.putBoolean("wizardscreen1",true);
pEdit.commit();
startActivityForResult(new Intent(getApplicationContext(), ChooseLocaleWizardActivity.class), 1);
}
/*
* Load the basic settings application to display torrc
*/
@ -791,26 +771,32 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && mService != null)
protected void onResume() {
super.onResume();
if (mService != null)
{
try {
mService.processSettings();
if (torStatus != TorServiceConstants.STATUS_ON)
mService.processSettings();
setLocale();
handleIntents();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
AlertDialog aDialog = null;
updateStatus("");
}
AlertDialog aDialog = null;
//general alert dialog for mostly Tor warning messages
//sometimes this can go haywire or crazy with too many error
@ -852,25 +838,53 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
*/
public void updateStatus (String torServiceMsg)
{
new updateStatusAsync().execute(torServiceMsg);
}
private class updateStatusAsync extends AsyncTask<String, Void, Integer> {
String mTorServiceMsg = null;
@Override
protected Integer doInBackground(String... params) {
mTorServiceMsg = params[0];
int newTorStatus = -1;
try
{
if (torServiceMsg == null || torServiceMsg.length()==0)
torStatus = -1; //reset Tor status
int newTorStatus = -1;
//if the serivce is bound, query it for the curren status value (int)
if (mService != null)
newTorStatus = mService.getStatus();
if (mService != null)
return new Integer(mService.getStatus());
}
catch (Exception e)
{
//error
Log.d(TAG,"error in update status",e);
}
return newTorStatus;
}
@Override
protected void onPostExecute(Integer result) {
updateUI(result.intValue());
super.onPostExecute(result);
}
private void updateUI (int newTorStatus)
{
//now update the layout_main UI based on the status
if (imgStatus != null)
{
if (newTorStatus == TorServiceConstants.STATUS_ON)
{
if (torStatus != newTorStatus)
{
//if (torStatus != newTorStatus)
//{
imgStatus.setImageResource(R.drawable.toron);
// mViewMain.setBackgroundResource(R.drawable.onionrootonly);
@ -880,13 +894,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
if (mItemOnOff != null)
mItemOnOff.setTitle(R.string.menu_stop);
}
//}
if (torServiceMsg != null && torServiceMsg.length() > 0)
if (mTorServiceMsg != null && mTorServiceMsg.length() > 0)
{
appendLogTextAndScroll(torServiceMsg);
appendLogTextAndScroll(mTorServiceMsg);
}
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
if (showFirstTime)
@ -921,11 +935,11 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
mItemOnOff.setTitle(R.string.menu_stop);
}
if (lblStatus != null && torServiceMsg != null)
if (torServiceMsg.indexOf('%')!=-1)
lblStatus.setText(torServiceMsg);
if (lblStatus != null && mTorServiceMsg != null)
if (mTorServiceMsg.indexOf('%')!=-1)
lblStatus.setText(mTorServiceMsg);
appendLogTextAndScroll(torServiceMsg);
appendLogTextAndScroll(mTorServiceMsg);
}
@ -942,14 +956,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
torStatus = newTorStatus;
}
catch (RemoteException e)
{
Log.e(TAG,"remote exception updating status",e);
}
}
}
// guess what? this start's Tor! actually no it just requests via the local ITorService to the remote TorService instance
@ -985,7 +995,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
mService.setProfile(TorServiceConstants.PROFILE_OFF);
Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG);
mHandler.sendMessage(msg);
//trafficRow.setVisibility(RelativeLayout.GONE);
}
@ -1004,10 +1013,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
try
{
if (mService != null && mService.getStatus() == TorServiceConstants.STATUS_OFF)
if (torStatus == TorServiceConstants.STATUS_OFF)
{
// createProgressDialog(getString(R.string.status_starting_up));
startTor();
}
@ -1158,8 +1165,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
public void onServiceConnected(ComponentName className,
IBinder service) {
mIsBound = true;
// This is called when the connection with the service has been
// established, giving us the service object we can use to
// interact with the service. We are communicating with our
@ -1167,6 +1172,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
// representation of that from the raw service object.
mService = ITorService.Stub.asInterface(service);
torStatus = -1;
// We want to monitor the service for as long as we are
// connected to it.
try {
@ -1179,9 +1186,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
}
handleIntents();
updateStatus("");
} catch (RemoteException e) {
// In this case the service has crashed before we could even
@ -1202,51 +1210,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
// This is called when the connection with the service has been
// unexpectedly disconnected -- that is, its process crashed.
mService = null;
Log.d(TAG,"service was disconnected");
}
};
//this is where we bind!
private void bindService ()
{
//since its auto create, we prob don't ever need to call startService
//also we should again be consistent with using either iTorService.class.getName()
//or the variable constant
bindService(mTorService,
mConnection, Context.BIND_AUTO_CREATE);
}
//unbind removes the callback, and unbinds the service
private void unbindService ()
{
if (mIsBound) {
// If we have received the service, and hence registered with
// it, then now is the time to unregister.
if (mService != null) {
try {
mService.unregisterCallback(mCallback);
} catch (RemoteException e) {
// There is nothing special we need to do if the service
// has crashed.
}
}
// Detach our existing connection.
unbindService(mConnection);
mIsBound = false;
//maybe needs this?
mService = null;
}
}
/*
private void createProgressDialog (String msg)
@ -1280,7 +1247,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
Configuration config = getResources().getConfiguration();
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
String lang = mPrefs.getString(PREF_DEFAULT_LOCALE, "");
if (! "".equals(lang) && ! config.locale.getLanguage().equals(lang))
@ -1296,7 +1262,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
protected void onDestroy() {
super.onDestroy();
unbindService();
//unbindService();
}
public class DataCount {

View File

@ -57,8 +57,9 @@ public class OrbotDiagnosticsActivity extends Activity {
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
stopTor();
}
@Override

View File

@ -56,4 +56,6 @@ public interface TorConstants {
public final static int MAX_LOG_LENGTH = 10000;
public final static String PREF_SOCKS = "pref_socks";
}

View File

@ -11,6 +11,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringBufferInputStream;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
import java.util.zip.ZipEntry;
@ -115,6 +116,54 @@ public class TorResourceInstaller implements TorServiceConstants {
return true;
}
public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
{
StringBufferInputStream sbis = new StringBufferInputStream(extraLines + '\n');
streamToFile(sbis,fileTorRcCustom,false,false);
return true;
}
public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException
{
InputStream is;
Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
is = context.getResources().openRawResource(R.raw.torpolipo);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + filePolipo.getAbsolutePath())).waitForFinish();
streamToFile(is,filePolipo, false, false);
if (extraLines != null && extraLines.length() > 0)
{
StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n');
streamToFile(sbis,filePolipo,true,false);
}
shell.close();
return true;
}
public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException
{
InputStream is;
File outFile;
Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
is = context.getResources().openRawResource(R.raw.torpolipo);
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false);
return true;
}
/*
* Extract the Tor binary from the APK file using ZIP
*/

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ public interface TorServiceConstants {
public final static String SHELL_CMD_CHMOD = "chmod";
public final static String SHELL_CMD_KILL = "kill -9";
public final static String SHELL_CMD_RM = "rm";
public final static String SHELL_CMD_PS = "ps";
public final static String SHELL_CMD_PS = "toolbox ps";
//public final static String SHELL_CMD_PIDOF = "pidof";
public final static String SHELL_CMD_LINK = "ln -s";
public final static String SHELL_CMD_CP = "cp";
@ -49,15 +49,14 @@ public interface TorServiceConstants {
public final static int PORT_HTTP = 8118; //just like Privoxy!
//Socks port client connects to, server is the Tor binary
public final static int PORT_SOCKS = 9050;
public final static String PORT_SOCKS_DEFAULT = "9050";
//what is says!
public final static String IP_LOCALHOST = "127.0.0.1";
public final static int TOR_CONTROL_PORT = 9051;
public final static int UPDATE_TIMEOUT = 1000;
public final static int TOR_TRANSPROXY_PORT = 9040;
public final static int TOR_TRANSPROXY_PORT_DEFAULT = 9040;
public final static int STANDARD_DNS_PORT = 53;
public final static int TOR_DNS_PORT = 5400;
public final static int TOR_DNS_PORT_DEFAULT = 5400;
//path to check Tor against
public final static String URL_TOR_CHECK = "https://check.torproject.org";
@ -77,7 +76,7 @@ public interface TorServiceConstants {
public static final int DISABLE_TOR_MSG = 3;
public static final int LOG_MSG = 4;
public static final String BINARY_TOR_VERSION = "0.2.5.4-alpha-openssl1.0.1g";
public static final String BINARY_TOR_VERSION = "0.2.4.22-openssl1.0.1h.u2";
public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED";
//obfsproxy
@ -89,5 +88,7 @@ public interface TorServiceConstants {
//name of the iptables binary
public final static String IPTABLES_ASSET_KEY = "xtables";
public final static int DEFAULT_CONTROL_PORT = 9051;
}

View File

@ -78,16 +78,19 @@ public class TorServiceUtils implements TorServiceConstants {
Process procPs = null;
//String processKey = new File(command).getName();
String processKey = new File(command).getName();
procPs = r.exec(SHELL_CMD_PS); // this is the android ps <name> command
procPs = r.exec(SHELL_CMD_PS + ' ' + processKey); // this is the android ps <name> command
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
String line = reader.readLine(); //read first line "headers" USER PID PPID etc
String line = null;
while ((line = reader.readLine())!=null)
{
if (line.contains(command))
if (line.contains("PID"))
continue;
if (line.contains(processKey))
{
String[] lineParts = line.split("\\s+");
@ -109,7 +112,6 @@ public class TorServiceUtils implements TorServiceConstants {
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static SharedPreferences getSharedPrefs (Context context)
{
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB)

View File

@ -23,10 +23,24 @@ public class TorTransProxy implements TorServiceConstants {
private final static String ALLOW_LOCAL = " ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 ";
private int mTransProxyPort = TorServiceConstants.TOR_TRANSPROXY_PORT_DEFAULT;
private int mDNSPort = TorServiceConstants.TOR_DNS_PORT_DEFAULT;
public TorTransProxy (TorService torService, File fileXTables)
{
mTorService = torService;
mFileXtables = fileXTables;
}
public void setTransProxyPort (int transProxyPort)
{
mTransProxyPort = transProxyPort;
}
public void setDNSPort (int dnsPort)
{
mDNSPort = dnsPort;
}
public String getIpTablesPath (Context context)
@ -383,7 +397,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(tApp.getUid());
script.append(" -m tcp --syn");
script.append(" -j REDIRECT --to-ports ");
script.append(TOR_TRANSPROXY_PORT);
script.append(mTransProxyPort);
executeCommand (shell, script.toString());
script = new StringBuilder();
@ -398,7 +412,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -m udp --dport ");
script.append(STANDARD_DNS_PORT);
script.append(" -j REDIRECT --to-ports ");
script.append(TOR_DNS_PORT);
script.append(mDNSPort);
executeCommand (shell, script.toString());
script = new StringBuilder();
@ -454,7 +468,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -t nat -A PREROUTING -i ");
script.append(hwinterfaces[i]);
script.append(" -p udp --dport 53 -j REDIRECT --to-ports ");
script.append(TOR_DNS_PORT);
script.append(mDNSPort);
executeCommand (shell, script.toString());
script = new StringBuilder();
@ -465,7 +479,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -t nat -A PREROUTING -i ");
script.append(hwinterfaces[i]);
script.append(" -p tcp -j REDIRECT --to-ports ");
script.append(TOR_TRANSPROXY_PORT);
script.append(mTransProxyPort);
lastExit = executeCommand (shell, script.toString());
script = new StringBuilder();
@ -642,7 +656,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(torUid);
script.append(" -m tcp --syn");
script.append(" -j REDIRECT --to-ports ");
script.append(TOR_TRANSPROXY_PORT);
script.append(mTransProxyPort);
executeCommand (shell, script.toString());
script = new StringBuilder();
@ -658,7 +672,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -m udp --dport ");
script.append(STANDARD_DNS_PORT);
script.append(" -j REDIRECT --to-ports ");
script.append(TOR_DNS_PORT);
script.append(mDNSPort);
executeCommand (shell, script.toString());
script = new StringBuilder();
@ -699,7 +713,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -A ").append(srcChainName);
script.append(" -p tcp");
script.append(" -m tcp");
script.append(" --dport ").append(TOR_TRANSPROXY_PORT);
script.append(" --dport ").append(mTransProxyPort);
script.append(" -j ACCEPT");
executeCommand (shell, script.toString());
@ -711,7 +725,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -A ").append(srcChainName);
script.append(" -p tcp");
script.append(" -m tcp");
script.append(" --dport ").append(PORT_SOCKS);
script.append(" --dport ").append(PORT_SOCKS_DEFAULT);
script.append(" -j ACCEPT");
executeCommand (shell, script.toString());
@ -735,7 +749,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -A ").append(srcChainName);
script.append(" -p udp");
script.append(" -m udp");
script.append(" --dport ").append(TOR_DNS_PORT);
script.append(" --dport ").append(mDNSPort);
script.append(" -j ACCEPT");
executeCommand (shell, script.toString());
@ -747,7 +761,7 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -A ").append(srcChainName);
script.append(" -p udp");
script.append(" -m udp");
script.append(" --dport ").append(TOR_DNS_PORT);
script.append(" --dport ").append(mDNSPort);
script.append(" -j ACCEPT");
executeCommand (shell, script.toString());

View File

@ -7,19 +7,20 @@ import org.torproject.android.TorConstants;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
@ -38,55 +39,42 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
super.onStart();
setContentView(R.layout.layout_wizard_locale);
stepSix();
}
@Override
protected void onResume() {
super.onResume();
}
listLocales = (ListView)findViewById(R.id.wizard_locale_list);
Button next = ((Button)findViewById(R.id.btnWizard2));
// next.setEnabled(false);
String[] strLangs = getResources().getStringArray(R.array.languages);
strLangs[0] = Locale.getDefault().getDisplayName();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs);
listLocales.setAdapter(adapter);
listLocales.setSelection(0);
listLocales.setOnItemClickListener(new OnItemClickListener() {
private void stepSix(){
listLocales = (ListView)findViewById(R.id.wizard_locale_list);
Button next = ((Button)findViewById(R.id.btnWizard2));
// next.setEnabled(false);
String[] strLangs = getResources().getStringArray(R.array.languages);
strLangs[0] = Locale.getDefault().getDisplayName();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs);
listLocales.setAdapter(adapter);
listLocales.setSelection(0);
listLocales.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
setLocalePref(arg2);
startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
}
});
next.setOnClickListener(new View.OnClickListener() {
setLocalePref(arg2);
finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
public void onClick(View v) {
startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
}
});
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setLocalePref(0);
finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
}
});
}
});
@ -135,4 +123,14 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
super.onSaveInstanceState(outState);
}
//Code to override the back button!
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
Toast.makeText(getApplicationContext(), R.string.wizard_exit_at_first_screen_toast, Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
}

View File

@ -20,6 +20,8 @@ import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@ -62,18 +64,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode)
{
case RESULT_CLOSE_ALL:
setResult(RESULT_CLOSE_ALL);
finish();
}
super.onActivityResult(requestCode, resultCode, data);
}
private void setupUI ()
{
@ -119,16 +109,16 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(ConfigureTransProxy.this, Permissions.class), 1);
finish();
startActivity(new Intent(ConfigureTransProxy.this, Permissions.class));
}
});
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(ConfigureTransProxy.this, TipsAndTricks.class), 1);
finish();
startActivity(new Intent(ConfigureTransProxy.this, TipsAndTricks.class));
}
});
@ -143,10 +133,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onClick(View v) {
context.startActivity(new Intent(context, AppManager.class));
startActivity(new Intent(ConfigureTransProxy.this, AppManager.class));
}
});
@ -239,4 +226,16 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
super.onSaveInstanceState(outState);
}
//Code to override the back button!
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
finish();
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
return true;
}
return false;
}
}

View File

@ -2,10 +2,6 @@ package org.torproject.android.wizard;
import org.torproject.android.R;
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 android.app.Activity;
@ -14,11 +10,9 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class LotsaText extends Activity implements TorConstants{
@ -57,19 +51,6 @@ public class LotsaText extends Activity implements TorConstants{
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode)
{
case RESULT_CLOSE_ALL:
setResult(RESULT_CLOSE_ALL);
finish();
}
super.onActivityResult(requestCode, resultCode, data);
}
private void stepOne() {
@ -135,11 +116,22 @@ public class LotsaText extends Activity implements TorConstants{
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(LotsaText.this, Permissions.class), 1);
finish();
startActivity(new Intent(LotsaText.this, Permissions.class));
}
});
}
//Code to override the back button!
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
finish();
startActivity(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class));
return true;
}
return true;
}
}

View File

@ -3,7 +3,6 @@ package org.torproject.android.wizard;
import org.sufficientlysecure.rootcommands.RootCommands;
import org.torproject.android.R;
import org.torproject.android.TorConstants;
import org.torproject.android.service.TorService;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
@ -12,14 +11,13 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.TextView;
public class Permissions extends Activity implements TorConstants {
@ -50,17 +48,6 @@ public class Permissions extends Activity implements TorConstants {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode)
{
case RESULT_CLOSE_ALL:
setResult(RESULT_CLOSE_ALL);
finish();
}
super.onActivityResult(requestCode, resultCode, data);
}
private void stepFourRoot(){
@ -138,9 +125,8 @@ public class Permissions extends Activity implements TorConstants {
}
else
{
startActivityForResult(new Intent(Permissions.this, ConfigureTransProxy.class), 1);
finish();
startActivity(new Intent(Permissions.this, ConfigureTransProxy.class));
}
@ -150,8 +136,8 @@ public class Permissions extends Activity implements TorConstants {
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
finish();
startActivity(new Intent(Permissions.this, LotsaText.class));
}
});
@ -160,7 +146,8 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
finish();
startActivity(new Intent(Permissions.this, TipsAndTricks.class));
}
});
@ -186,25 +173,34 @@ public class Permissions extends Activity implements TorConstants {
Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
grantPermissions.setVisibility(Button.GONE);
CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
consent.setVisibility(CheckBox.GONE);
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
finish();
startActivity(new Intent(Permissions.this, LotsaText.class));
}
});
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
finish();
startActivity(new Intent(Permissions.this, TipsAndTricks.class));
}
});
}
//Code to override the back button!
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
finish();
startActivity(new Intent(getBaseContext(), LotsaText.class));
return true;
}
return false;
}
}

View File

@ -3,25 +3,16 @@ package org.torproject.android.wizard;
import org.torproject.android.Orbot;
import org.torproject.android.R;
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 android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class TipsAndTricks extends Activity implements TorConstants {
@ -48,17 +39,6 @@ public class TipsAndTricks extends Activity implements TorConstants {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode)
{
case RESULT_CLOSE_ALL:
setResult(RESULT_CLOSE_ALL);
finish();
}
super.onActivityResult(requestCode, resultCode, data);
}
void stepFive(){
@ -74,6 +54,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View view) {
String url = getString(R.string.gibberbot_apk_url);
finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@ -86,6 +67,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View view) {
String url = getString(R.string.orweb_apk_url);
finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@ -98,6 +80,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View view) {
String url = getString(R.string.duckgo_apk_url);
finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@ -110,6 +93,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View view) {
String url = getString(R.string.proxymob_setup_url);
finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@ -122,6 +106,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View view) {
String url = getString(R.string.twitter_setup_url);
finish();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@ -160,7 +145,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
}
});
@ -195,19 +180,30 @@ public class TipsAndTricks extends Activity implements TorConstants {
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
finish();
startActivity(new Intent(TipsAndTricks.this, Permissions.class));
}
});
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(TipsAndTricks.this, Orbot.class), 1);
finish();
}
});
}
//Code to override the back button!
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
finish();
startActivity(new Intent(getBaseContext(), Permissions.class));
return true;
}
return false;
}
/*
private void showWizardFinal ()
{