updated root perm cacheing issue and help wizard dialogs

svn:r22729
This commit is contained in:
Nathan Freitas 2010-07-30 20:19:13 +00:00
parent 9bbc210043
commit 9acd3382de
7 changed files with 112 additions and 96 deletions

View File

@ -4,8 +4,6 @@
android:versionName="0.2.2.14-orbot-alpha-0.0.9" android:versionCode="8">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">

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

@ -15,12 +15,13 @@
android:layout_height="fill_parent"
android:padding="3px">
<TextView android:text="@string/wizard_tips_msg" android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text="@string/wizard_tips_msg" android:layout_gravity="left" android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<Button android:text="@string/wizard_tips_otrchat" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOtrchat" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_otrchat" android:layout_gravity="left" android:drawableLeft="@drawable/icon_otrchat" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOtrchat" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_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_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"/>
</LinearLayout>
</ScrollView>

View File

@ -77,15 +77,15 @@ and all DNS requests. This includes the built-in Browser, Gmail, YouTube and Map
<string name="wizard_welcome_msg">Orbot brings Tor to Android. 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.\n\n*WARNING:* Simply installing Orbot will _not_ magically anonymize your mobile traffic! This wizard will help you get started.</string>
<string name="wizard_details">Some Orbot Details</string>
<string name="wizard_details_msg">Orbot is an open-source application that contains Tor, LibEvent and Privoxy. It provides a local HTTP proxy (8118) and a SOCKS proxy (9050) into the Tor network. Orbot also has the ability, on rooted device, to send all internet traffic through Tor.</string>
<string name="wizard_permissions_root">Grant Permissions</string>
<string name="wizard_permissions_stock">Permissions Warning</string>
<string name="wizard_permissions_root">Permission Granted</string>
<string name="wizard_permissions_stock">Orbot Permissions</string>
<string name="wizard_premissions_msg_root">Excellent! We\'ve detected that you have root permissions enabled for Orbot. We will use this power wisely.</string>
<string name="wizard_permissions_msg_stock">We\'ve detected that you do not have root permissions enabled. Your application data usage will NOT be transparently routed through Tor without root access. </string>
<string name="wizard_permissions_msg_stock"> While it is not required, Orbot can become a more powerful tool if your device has root access. Use the button below to grant Orbot superpowers! </string>
<string name="wizard_permissions_no_root">If you choose to continue WITHOUT root, you must use apps that know how to talk to Tor.</string>
<string name="wizard_permissions_no_root">If you don\'t have root access or have no idea what we\'re talking about, just be sure to use apps made to work with Orbot.</string>
<string name="wizard_permissions_consent">I understand and would like to continue without root</string>
<string name="wizard_permission_enable_root">Attempt to enable root access</string>
<string name="wizard_permission_enable_root">Grant Root for Orbot</string>
<string name="wizard_configure">Configure Torification</string>
<string name="wizard_configure_msg">Orbot gives you the option to route all application traffic through Tor OR to choose your applications individually.</string>
<string name="wizard_configure_all">Proxy All Apps Through Tor</string>
@ -94,9 +94,9 @@ and all DNS requests. This includes the built-in Browser, Gmail, YouTube and Map
<string name="wizard_tips_tricks">Orbot-enabled Apps</string>
<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 - From the Orbot dev team, a secure Instant Messaging client for Android.</string>
<string name="wizard_tips_orweb">OrWeb (Android 1.x Only) - From the Orbot dev team, a web browser designed to work with Tor.</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_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>
@ -105,5 +105,6 @@ and all DNS requests. This includes the built-in Browser, Gmail, YouTube and Map
<!-- 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>
</resources>

View File

@ -27,6 +27,17 @@ android:enabled="true"/>
</PreferenceCategory>
<!--
<PreferenceCategory android:title="Web Proxy">
<Preference
android:defaultValue=""
android:key="pref_web_proxy"
android:title="Open Proxy Panel"
android:summary="Set HTTP Settings (Android 2.x Experimental)"
android:enabled="true"/>
</PreferenceCategory>
-->
<PreferenceCategory android:title="Bridges">
<CheckBoxPreference android:defaultValue="false"

View File

@ -186,6 +186,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
unbindService();
stopService(new Intent(ITorService.class.getName()));
} catch (RemoteException e) {
Log.w(TAG, e);
@ -330,7 +332,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
lblStatus = (TextView)findViewById(R.id.lblStatus);
imgStatus = (ImageView)findViewById(R.id.imgStatus);
updateStatus("");
//updateStatus("");
}
/*
@ -343,36 +345,6 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
}
private static class ListEntry {
private CheckBox box;
private TextView text;
}
/*
* Show the about view - a popup dialog
*/
private void showAbout ()
{
LayoutInflater li = LayoutInflater.from(this);
View view = li.inflate(R.layout.layout_about, null);
TextView versionName = (TextView)view.findViewById(R.id.versionName);
versionName.setText(R.string.app_version);
new AlertDialog.Builder(this)
.setTitle(getString(R.string.button_about))
.setView(view)
.setNeutralButton(getString(R.string.button_help), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
showHelp();
}
})
.setNegativeButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Log.d(TAG, "Close pressed");
}
})
.show();
}
/*
* Show the help view - a popup dialog
@ -649,6 +621,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
{
new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle(title)
.setMessage(msg)
.setPositiveButton(android.R.string.ok, null)
@ -683,7 +656,22 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
lblStatus.setText(getString(R.string.status_activated));
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mOrbot);
boolean showWizard = prefs.getBoolean("connect_first_time",true);
if (showWizard)
{
Editor pEdit = prefs.edit();
pEdit.putBoolean("connect_first_time",false);
pEdit.commit();
showAlert(getString(R.string.status_activated),getString(R.string.connect_first_time));
}
/*
if (progressDialog != null)
@ -792,7 +780,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
Message msg = mHandler.obtainMessage(ENABLE_TOR_MSG);
mHandler.sendMessage(msg);
updateStatus("");
// updateStatus("");
}
private void stopTor () throws RemoteException
@ -802,7 +790,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
Message msg = mHandler.obtainMessage(DISABLE_TOR_MSG);
mHandler.sendMessage(msg);
updateStatus("");
//updateStatus("");
}
@ -979,6 +967,9 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
if (mService != null) {
try {
mService.unregisterCallback(mCallback);
} catch (RemoteException e) {
// There is nothing special we need to do if the service
// has crashed.
@ -988,6 +979,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
// Detach our existing connection.
unbindService(mConnection);
mIsBound = false;
}
}

View File

@ -24,7 +24,7 @@ import android.widget.Toast;
public class WizardHelper implements TorConstants {
private Context context;
private Dialog currentDialog;
private AlertDialog currentDialog;
public WizardHelper (Context context)
{
@ -70,59 +70,72 @@ public class WizardHelper implements TorConstants {
public void showWizardStep2()
{
String title = null;
String msg = null;
title = context.getString(R.string.wizard_permissions_root);
msg = context.getString(R.string.wizard_premissions_msg_root);
String title = context.getString(R.string.wizard_permissions_stock);
LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_stock, null);
Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonEnable);
btn1.setOnClickListener(new OnClickListener() {
title = context.getString(R.string.wizard_permissions_stock);
LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_stock, null);
Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonEnable);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
@Override
public void onClick(View view) {
boolean hasRoot = TorTransProxy.hasRootAccess();
if (hasRoot)
{
currentDialog.dismiss();
showWizardStep2Root();
}
else
{
Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
}
}
});
showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (which == DialogInterface.BUTTON_NEUTRAL)
{
showWizardTipsAndTricks();
}
else if (which == DialogInterface.BUTTON_POSITIVE)
{
showWizardStep1();
}
boolean hasRoot = TorTransProxy.hasRootAccess();
if (hasRoot)
{
currentDialog.dismiss();
showWizardStep2Root();
}
});
else
{
Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
view.setEnabled(false);
}
}
});
CheckBox cb1 = (CheckBox)view.findViewById(R.id.CheckBoxConsent);
cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
currentDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(isChecked);
}
});
showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (which == DialogInterface.BUTTON_NEUTRAL)
{
showWizardTipsAndTricks();
}
else if (which == DialogInterface.BUTTON_POSITIVE)
{
showWizardStep1();
}
}
});
currentDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(false);
}
@ -315,7 +328,7 @@ public class WizardHelper implements TorConstants {
}
private void showDialog (String title, String msg, String button1, String button2, DialogInterface.OnClickListener ocListener)
public void showDialog (String title, String msg, String button1, String button2, DialogInterface.OnClickListener ocListener)
{
// dialog.setContentView(R.layout.custom_dialog);