checking in what should be 1.0.4

svn:r23223
This commit is contained in:
Nathan Freitas 2010-09-17 21:32:21 +00:00
parent 4be5974dfe
commit d357022ff9
11 changed files with 220 additions and 96 deletions

View File

@ -1,11 +1,11 @@
<?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" android:versionName="0.2.2.14-orbot-alpha-1.0.3" android:versionCode="9"> package="org.torproject.android" android:versionName="1.0.4" android:versionCode="10">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Orbot" <activity android:name=".Orbot"
android:theme="@android:style/Theme.NoTitleBar"> android:theme="@android:style/Theme.NoTitleBar">
@ -33,22 +33,13 @@
<activity android:name=".AppManager" android:label="@string/app_name"/> <activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/> <activity android:name=".WizardActivity" android:label="@string/app_name"/>
<!-- <service android:name=".service.TorService" android:process=":remote"> --> <service android:name=".service.TorService" android:process=":remote">
<service android:name=".service.TorService">
<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">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application> </application>

59
AndroidManifest.xml.debug Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android" android:versionName="0.2.2.14-orbot-alpha-1.0.3" android:versionCode="9">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".Orbot"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.REQUEST_HS_PORT" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.START_TOR" />
</intent-filter>
</activity>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
<!-- <service android:name=".service.TorService" android:process=":remote"> -->
<service android:name=".service.TorService">
<intent-filter>
<action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter>
</service>
<receiver android:name=".OnBootReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="3"/>
</manifest>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android" android:versionName="0.2.2.14-orbot-alpha-1.0.3" android:versionCode="9">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Orbot"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.REQUEST_HS_PORT" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="org.torproject.android.START_TOR" />
</intent-filter>
</activity>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
<service android:name=".service.TorService" android:process=":remote">
<intent-filter>
<action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter>
</service>
<receiver android:name=".OnBootReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="3"/>
</manifest>

View File

@ -1,5 +1,10 @@
NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/ NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
1.0.4
- Added Russian, Persian, Arabic and other .po translations (see res/values-* folders)
- Fixed incorrect try to clear iptables rules for non-root devices
- Fixed bug that stopped wizard helper from showing
1.0.3 1.0.3
- Fixed spanish language issues with settings screen - Fixed spanish language issues with settings screen
- Cleaned up logging, and moved most of it to debug output only - Cleaned up logging, and moved most of it to debug output only

View File

@ -322,51 +322,47 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
String action = getIntent().getAction(); String action = getIntent().getAction();
if (action != null) if (action.equals("org.torproject.android.REQUEST_HS_PORT"))
{ {
if (action.equals("org.torproject.android.REQUEST_HS_PORT"))
{
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which){
case DialogInterface.BUTTON_POSITIVE:
int hsPort = getIntent().getIntExtra("hs_port", -1);
enableHiddenServicePort (hsPort);
finish();
break;
case DialogInterface.BUTTON_NEGATIVE:
//No button clicked
finish();
break;
}
}
};
int hsPort = getIntent().getIntExtra("hs_port", -1);
String requestMsg = "An app wants to open a server port (" + hsPort + ") to the Tor network. This is safe if you trust the app.";
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener)
.setNegativeButton("Deny", dialogClickListener).show();
} DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
else if (action.equals("org.torproject.android.START_TOR")) @Override
{ public void onClick(DialogInterface dialog, int which) {
autoStartOnBind = true; switch (which){
case DialogInterface.BUTTON_POSITIVE:
if (mService == null)
bindService(); int hsPort = getIntent().getIntExtra("hs_port", -1);
} enableHiddenServicePort (hsPort);
finish();
break;
case DialogInterface.BUTTON_NEGATIVE:
//No button clicked
finish();
break;
}
}
};
int hsPort = getIntent().getIntExtra("hs_port", -1);
String requestMsg = "An app wants to open a server port (" + hsPort + ") to the Tor network. This is safe if you trust the app.";
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener)
.setNegativeButton("Deny", dialogClickListener).show();
}
else if (action.equals("org.torproject.android.START_TOR"))
{
autoStartOnBind = true;
if (mService == null)
bindService();
} }
else else
@ -390,7 +386,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
pEdit.commit(); pEdit.commit();
showHelp(); new WizardHelper(this).showWizard();
} }
} }
} }
@ -726,9 +723,9 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mOrbot); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mOrbot);
boolean showWizard = prefs.getBoolean("connect_first_time",true); boolean showFirstTime = prefs.getBoolean("connect_first_time",true);
if (showWizard) if (showFirstTime)
{ {
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();

View File

@ -3,6 +3,7 @@
package org.torproject.android; package org.torproject.android;
import org.torproject.android.service.TorServiceUtils;
import org.torproject.android.service.TorTransProxy; import org.torproject.android.service.TorTransProxy;
import android.content.Intent; import android.content.Intent;
@ -30,7 +31,7 @@ public class SettingsPreferences
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
hasRoot = TorTransProxy.hasRootAccess(); hasRoot = TorServiceUtils.checkRootAccess();
} }

View File

@ -1,5 +1,6 @@
package org.torproject.android; package org.torproject.android;
import org.torproject.android.service.TorServiceUtils;
import org.torproject.android.service.TorTransProxy; import org.torproject.android.service.TorTransProxy;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -84,7 +85,7 @@ public class WizardHelper implements TorConstants {
public void onClick(View view) { public void onClick(View view) {
boolean hasRoot = TorTransProxy.hasRootAccess(); boolean hasRoot = TorServiceUtils.checkRootAccess();
if (hasRoot) if (hasRoot)
{ {

View File

@ -57,6 +57,8 @@ public class TorService extends Service implements TorServiceConstants, Runnable
private String torBinaryPath = null; private String torBinaryPath = null;
private String privoxyPath = null; private String privoxyPath = null;
private boolean hasRoot = false;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -181,6 +183,8 @@ public class TorService extends Service implements TorServiceConstants, Runnable
public void onStart(Intent intent, int startId) { public void onStart(Intent intent, int startId) {
super.onStart(intent, startId); super.onStart(intent, startId);
hasRoot = TorServiceUtils.checkRootAccess();
} }
public void run () public void run ()
@ -1090,7 +1094,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
mCallbacks.finishBroadcast(); mCallbacks.finishBroadcast();
} }
private void sendCallbackLogMessage (String logMessage) private synchronized void sendCallbackLogMessage (String logMessage)
{ {
// Broadcast to all clients the new value. // Broadcast to all clients the new value.
@ -1278,14 +1282,15 @@ public class TorService extends Service implements TorServiceConstants, Runnable
logNotice ("Transparent Proxying: " + enableTransparentProxy); logNotice ("Transparent Proxying: " + enableTransparentProxy);
boolean hasRoot = TorTransProxy.hasRootAccess();
if (enabled) if (enabled)
{ {
if (hasRoot && enableTransparentProxy) if (hasRoot)
{ {
if (enableTransparentProxy)
{
//TorTransProxy.setDNSProxying(); //TorTransProxy.setDNSProxying();
@ -1296,11 +1301,12 @@ public class TorService extends Service implements TorServiceConstants, Runnable
return true; return true;
} }
else else
{ {
TorTransProxy.purgeIptables(this,AppManager.getApps(this)); TorTransProxy.purgeIptables(this,AppManager.getApps(this));
}
} }
} }
else else

View File

@ -6,7 +6,7 @@ public interface TorServiceConstants {
public final static String TAG = "ORBOT"; public final static String TAG = "ORBOT";
public static boolean LOG_OUTPUT_TO_DEBUG = true; public static boolean LOG_OUTPUT_TO_DEBUG = false;
public final static String TOR_APP_USERNAME = "org.torproject.android"; public final static String TOR_APP_USERNAME = "org.torproject.android";

View File

@ -3,6 +3,7 @@
package org.torproject.android.service; package org.torproject.android.service;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -11,6 +12,37 @@ import android.util.Log;
public class TorServiceUtils implements TorServiceConstants { public class TorServiceUtils implements TorServiceConstants {
/**
* Check if we have root access
* @return boolean true if we have root
*/
public static boolean checkRootAccess() {
StringBuilder log = new StringBuilder();
try {
// Run an empty script just to check root access
String[] cmd = {"exit 0"};
int exitCode = TorServiceUtils.doShellCommand(cmd, log, true, true);
if (exitCode == 0) {
return true;
}
} catch (IOException e) {
//this means that there is no root to be had (normally) so we won't log anything
}
catch (Exception e) {
Log.w(TAG,"Error checking for root access: " + e.getMessage());
//this means that there is no root to be had (normally)
}
logNotice("Could not acquire root permissions");
return false;
}
private static void logNotice (String msg) private static void logNotice (String msg)
{ {

View File

@ -16,33 +16,7 @@ public class TorTransProxy implements TorServiceConstants {
if (LOG_OUTPUT_TO_DEBUG) if (LOG_OUTPUT_TO_DEBUG)
Log.d(TAG, msg); Log.d(TAG, msg);
} }
/**
* Check if we have root access
* @return boolean true if we have root
*/
public static boolean hasRootAccess() {
StringBuilder log = new StringBuilder();
try {
// Run an empty script just to check root access
String[] cmd = {"exit 0"};
int exitCode = TorServiceUtils.doShellCommand(cmd, log, true, true);
if (exitCode == 0) {
return true;
}
} catch (Exception e) {
Log.w(TAG,"Error checking for root access: " + e.getMessage() ,e);
}
logNotice("Could not acquire root access: " + log.toString());
return false;
}
/** /**
* Check if we have root access * Check if we have root access
* @return boolean true if we have root * @return boolean true if we have root
@ -190,7 +164,7 @@ public class TorTransProxy implements TorServiceConstants {
public static int setTransparentProxyingByApp(Context context, TorifiedApp[] apps, boolean forceAll) throws Exception public static int setTransparentProxyingByApp(Context context, TorifiedApp[] apps, boolean forceAll) throws Exception
{ {
android.os.Debug.waitForDebugger(); //android.os.Debug.waitForDebugger();
//redirectDNSResolvConf(); //not working yet //redirectDNSResolvConf(); //not working yet