added proxy settings help screen and fixed processSettings() NPE

svn:r22852
This commit is contained in:
Nathan Freitas 2010-08-10 16:43:32 +00:00
parent 2bc9aa6c57
commit 039091770e
7 changed files with 172 additions and 91 deletions

View File

@ -47,6 +47,4 @@
</manifest>

View File

@ -1,8 +1,12 @@
NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
1.0.0 - 2010-08-10
- Added "Proxy Settings" help screen
- Handle potential null pointers on process settings where service not yet active
0.0.9x - 2010-08-03
- Revised Orbot install wizard
- Integrated Tor 0.2.2.14 binary
- Integrated Tor 0.2.2.14 and iptables 4.x binary
- Fixed "got root" detection method
- Fixed Per App Torification handling so it updates on exit from Settings screen

View File

@ -10,5 +10,5 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=Google Inc.:Google APIs:3
target=android-3
apk-configurations=

View File

@ -21,7 +21,7 @@
<Button android:text="@string/wizard_tips_orweb" android:drawableLeft="@drawable/icon_orweb" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOrweb" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_proxy" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOrweb" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_proxy" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonProxyHelp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>

View File

@ -96,7 +96,15 @@ and all DNS requests. This includes the built-in Browser, Gmail, YouTube and Map
<string name="wizard_tips_msg">We encourage you to download &amp; use apps that know how to connect directly to Orbot. Click on the buttons below to install.</string>
<string name="wizard_tips_otrchat">OTRCHAT - Secure instant messaging client for Android</string>
<string name="wizard_tips_orweb">ORWEB (Android 1.x Only) - Browser designed for privacy &amp; for Orbot</string>
<string name="wizard_tips_proxy">Proxy Help - Learn how to configure apps to work with Orbot</string>
<string name="wizard_tips_proxy">Proxy Settings - Learn how to configure apps to work with Orbot</string>
<string name="wizard_proxy_help_info">Proxy Settings</string>
<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
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
You can learn more about proxying on Android via the FAQ at: http://tinyurl.com/proxyandroid
</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: journalists and bloggers, human rights workers, law enforcement officers, soldiers, corporations, citizens of repressive regimes, and just ordinary citizens... and now you are ready to, as well!</string>

View File

@ -32,6 +32,7 @@ import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
@ -398,100 +399,114 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
private void processSettings () throws RemoteException
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
boolean becomeRelay = prefs.getBoolean(PREF_OR, false);
boolean ReachableAddresses = prefs.getBoolean(PREF_REACHABLE_ADDRESSES,false);
boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
mService.updateTransProxy();
String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
if (useBridges)
try
{
if (bridgeList == null || bridgeList.length() == 0)
if (mService == null)
return; //nothing to do if the service isn't connected yet
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
//boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
boolean becomeRelay = prefs.getBoolean(PREF_OR, false);
boolean ReachableAddresses = prefs.getBoolean(PREF_REACHABLE_ADDRESSES,false);
boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
mService.updateTransProxy();
String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
if (useBridges)
{
if (bridgeList == null || bridgeList.length() == 0)
{
showAlert("Bridge Error","In order to use the bridge feature, you must enter at least one bridge IP address." +
"Send an email to bridges@torproject.org with the line \"get bridges\" by itself in the body of the mail from a gmail account.");
showAlert("Bridge Error","In order to use the bridge feature, you must enter at least one bridge IP address." +
"Send an email to bridges@torproject.org with the line \"get bridges\" by itself in the body of the mail from a gmail account.");
return;
return;
}
mService.updateConfiguration("UseBridges", "1", false);
String bridgeDelim = "\n";
if (bridgeList.indexOf(",") != -1)
{
bridgeDelim = ",";
}
StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
while (st.hasMoreTokens())
{
mService.updateConfiguration("bridge", st.nextToken(), false);
}
mService.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
}
mService.updateConfiguration("UseBridges", "1", false);
String bridgeDelim = "\n";
if (bridgeList.indexOf(",") != -1)
else
{
bridgeDelim = ",";
}
StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
while (st.hasMoreTokens())
{
mService.updateConfiguration("bridge", st.nextToken(), false);
mService.updateConfiguration("UseBridges", "0", false);
}
mService.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
try
{
if (ReachableAddresses)
{
String ReachableAddressesPorts =
prefs.getString(PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
}
else
{
mService.updateConfiguration("UseBridges", "0", false);
mService.updateConfiguration("ReachableAddresses", ReachableAddressesPorts, false);
}
}
}
catch (Exception e)
{
showAlert("Config Error","Your ReachableAddresses settings caused an exception!");
}
try
{
if (ReachableAddresses)
{
String ReachableAddressesPorts =
prefs.getString(PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
try
{
if (becomeRelay && (!useBridges) && (!ReachableAddresses))
{
int ORPort = Integer.parseInt(prefs.getString(PREF_OR_PORT, "9001"));
String nickname = prefs.getString(PREF_OR_NICKNAME, "Orbot");
mService.updateConfiguration("ReachableAddresses", ReachableAddressesPorts, false);
mService.updateConfiguration("ORPort", ORPort + "", false);
mService.updateConfiguration("Nickname", nickname, false);
mService.updateConfiguration("ExitPolicy", "reject *:*", false);
}
}
}
}
catch (Exception e)
{
showAlert("Uh-oh!","Your relay settings caused an exception!");
return;
}
if (mService != null)
mService.saveConfiguration();
}
catch (Exception e)
{
showAlert("Config Error","Your ReachableAddresses settings caused an exception!");
}
showAlert("Uh-oh!","There was an error updating your settings");
try
{
if (becomeRelay && (!useBridges) && (!ReachableAddresses))
{
int ORPort = Integer.parseInt(prefs.getString(PREF_OR_PORT, "9001"));
String nickname = prefs.getString(PREF_OR_NICKNAME, "Orbot");
mService.updateConfiguration("ORPort", ORPort + "", false);
mService.updateConfiguration("Nickname", nickname, false);
mService.updateConfiguration("ExitPolicy", "reject *:*", false);
}
}
catch (Exception e)
{
showAlert("Uh-oh!","Your relay settings caused an exception!");
Log.w(TAG, "processSettings()", e);
return;
}
mService.saveConfiguration();
}
@ -623,15 +638,47 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
}
/*
@Override
public boolean onTouchEvent(MotionEvent event) {
try
{
if (mService == null)
{
}
else if (mService.getStatus() == STATUS_READY)
{
startTor();
}
else
{
stopTor();
}
}
catch (Exception e)
{
Log.i(TAG,"error onclick",e);
}
return super.onTouchEvent(event);
}
/*
* (non-Javadoc)
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
public void onClick(View view) {
// the start button
if (view.getId()==R.id.imgStatus || view.getId()==R.id.lblStatus)
{
// if (view.getId()==R.id.imgStatus || view.getId()==R.id.lblStatus)
// {
try
{
@ -658,7 +705,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
Log.i(TAG,"error onclick",e);
}
}
// }
}

View File

@ -207,6 +207,18 @@ public class WizardHelper implements TorConstants {
}
});
Button btn3 = (Button)view.findViewById(R.id.WizardRootButtonProxyHelp);
btn3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
showProxyHelp();
}
});
showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
@ -380,5 +392,17 @@ public class WizardHelper implements TorConstants {
.show();
}
private void showProxyHelp ()
{
LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_proxy_help, null);
new AlertDialog.Builder(context)
.setTitle(context.getString(R.string.wizard_proxy_help_info))
.setView(view)
.show();
}
}