[or-cvs] r23223: {projects} checking in what should be 1.0.4 (in projects/android/trunk/Orbot: . src/org/torproject/android src/org/torproject/android/service)

Nathan Freitas nathan at freitas.net
Fri Sep 17 21:32:21 UTC 2010


Author: n8fr8
Date: 2010-09-17 21:32:21 +0000 (Fri, 17 Sep 2010)
New Revision: 23223

Added:
   projects/android/trunk/Orbot/AndroidManifest.xml.debug
   projects/android/trunk/Orbot/AndroidManifest.xml.production
Modified:
   projects/android/trunk/Orbot/AndroidManifest.xml
   projects/android/trunk/Orbot/CHANGELOG
   projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
   projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java
   projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
   projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java
   projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java
   projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceUtils.java
   projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java
Log:
checking in what should be 1.0.4

Modified: projects/android/trunk/Orbot/AndroidManifest.xml
===================================================================
--- projects/android/trunk/Orbot/AndroidManifest.xml	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/AndroidManifest.xml	2010-09-17 21:32:21 UTC (rev 23223)
@@ -1,11 +1,11 @@
 <?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">
+      package="org.torproject.android" android:versionName="1.0.4" android:versionCode="10">
        
        <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"
                   android:theme="@android:style/Theme.NoTitleBar">
@@ -33,23 +33,14 @@
         <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">
+    	<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"/>

Added: projects/android/trunk/Orbot/AndroidManifest.xml.debug
===================================================================
--- projects/android/trunk/Orbot/AndroidManifest.xml.debug	                        (rev 0)
+++ projects/android/trunk/Orbot/AndroidManifest.xml.debug	2010-09-17 21:32:21 UTC (rev 23223)
@@ -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> 

Added: projects/android/trunk/Orbot/AndroidManifest.xml.production
===================================================================
--- projects/android/trunk/Orbot/AndroidManifest.xml.production	                        (rev 0)
+++ projects/android/trunk/Orbot/AndroidManifest.xml.production	2010-09-17 21:32:21 UTC (rev 23223)
@@ -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> 

Modified: projects/android/trunk/Orbot/CHANGELOG
===================================================================
--- projects/android/trunk/Orbot/CHANGELOG	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/CHANGELOG	2010-09-17 21:32:21 UTC (rev 23223)
@@ -1,5 +1,10 @@
 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
 - Fixed spanish language issues with settings screen
 - Cleaned up logging, and moved most of it to debug output only

Modified: projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -322,52 +322,48 @@
 
 		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;
+			
+			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;
-				        }
-				    }
-				};
+			        case DialogInterface.BUTTON_NEGATIVE:
+			            //No button clicked
+			        	finish();
+			            break;
+			        }
+			    }
+			};
 
-	        	int hsPort = getIntent().getIntExtra("hs_port", -1);
+        	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();
-				
+			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 if (action.equals("org.torproject.android.START_TOR"))
+		{
+			autoStartOnBind = true;
 			
+			if (mService == null)
+				bindService();
+			
 		}
 		else
 		{
@@ -390,7 +386,8 @@
 				
 				pEdit.commit();
 				
-				showHelp();
+			    new WizardHelper(this).showWizard();
+
 			}
 		}
 	}
@@ -726,9 +723,9 @@
 		    		
 		    		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();

Modified: projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -3,6 +3,7 @@
 
 package org.torproject.android;
 
+import org.torproject.android.service.TorServiceUtils;
 import org.torproject.android.service.TorTransProxy;
 
 import android.content.Intent;
@@ -30,7 +31,7 @@
 		super.onCreate(savedInstanceState);
 		addPreferencesFromResource(R.xml.preferences);
 		
-		hasRoot = TorTransProxy.hasRootAccess();
+		hasRoot = TorServiceUtils.checkRootAccess();
 		
 	}
 	

Modified: projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -1,5 +1,6 @@
 package org.torproject.android;
 
+import org.torproject.android.service.TorServiceUtils;
 import org.torproject.android.service.TorTransProxy;
 
 import android.app.AlertDialog;
@@ -84,7 +85,7 @@
 			public void onClick(View view) {
 				
 				
-				boolean hasRoot = TorTransProxy.hasRootAccess();
+				boolean hasRoot = TorServiceUtils.checkRootAccess();
 				
 				if (hasRoot)
 				{

Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -57,6 +57,8 @@
     private String torBinaryPath = null;
     private String privoxyPath = null;
     
+    private boolean hasRoot = false;
+    
     /** Called when the activity is first created. */
     public void onCreate() {
     	super.onCreate();
@@ -181,6 +183,8 @@
 	public void onStart(Intent intent, int startId) {
 		super.onStart(intent, startId);
 		
+    	hasRoot = TorServiceUtils.checkRootAccess();
+
 	}
 	 
 	public void run ()
@@ -1090,7 +1094,7 @@
         mCallbacks.finishBroadcast();
     }
     
-    private void sendCallbackLogMessage (String logMessage)
+    private synchronized void sendCallbackLogMessage (String logMessage)
     {
     	 
         // Broadcast to all clients the new value.
@@ -1278,14 +1282,15 @@
 	
     	logNotice ("Transparent Proxying: " + enableTransparentProxy);
     	
-    	boolean hasRoot = TorTransProxy.hasRootAccess();
 
 		if (enabled)
 		{
 		
 
-			if (hasRoot && enableTransparentProxy)
+			if (hasRoot)
 			{
+				if (enableTransparentProxy)
+				{
 				
 				
 					//TorTransProxy.setDNSProxying();
@@ -1296,12 +1301,13 @@
 					return true;
 				
 				
+				}
+				else
+				{
+					TorTransProxy.purgeIptables(this,AppManager.getApps(this));
+	
+				}
 			}
-			else
-			{
-				TorTransProxy.purgeIptables(this,AppManager.getApps(this));
-
-			}
 		}
 		else
 		{

Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -6,7 +6,7 @@
 
 	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";
 	

Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceUtils.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceUtils.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceUtils.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -3,6 +3,7 @@
 package org.torproject.android.service;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.util.StringTokenizer;
@@ -11,7 +12,38 @@
 
 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)
 	{
 		if (LOG_OUTPUT_TO_DEBUG)

Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java	2010-09-17 21:05:08 UTC (rev 23222)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java	2010-09-17 21:32:21 UTC (rev 23223)
@@ -16,33 +16,7 @@
 		if (LOG_OUTPUT_TO_DEBUG)
 			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
 	 * @return boolean true if we have root
@@ -190,7 +164,7 @@
 	public static int setTransparentProxyingByApp(Context context, TorifiedApp[] apps, boolean forceAll) throws Exception
 	{
 
-		android.os.Debug.waitForDebugger();
+		//android.os.Debug.waitForDebugger();
 		
 		//redirectDNSResolvConf(); //not working yet
 		



More information about the tor-commits mailing list