parent
848a6c3a4f
commit
a5b3bbdf77
|
@ -14,5 +14,6 @@ public class OnBootReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.torproject.android.service.TorServiceConstants;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -44,10 +45,10 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Useful UI bits */
|
/* Useful UI bits */
|
||||||
private TextView txtMessageLog = null; //the full screen log view of Tor control messages
|
//private TextView txtMessageLog = null; //the full screen log view of Tor control messages
|
||||||
private TextView lblStatus = null; //the main text display widget
|
private TextView lblStatus = null; //the main text display widget
|
||||||
private ImageView imgStatus = null; //the main touchable image for activating Orbot
|
private ImageView imgStatus = null; //the main touchable image for activating Orbot
|
||||||
// private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
private MenuItem mItemOnOff = null;
|
private MenuItem mItemOnOff = null;
|
||||||
|
|
||||||
/* Some tracking bits */
|
/* Some tracking bits */
|
||||||
|
@ -60,6 +61,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
ITorService mService = null;
|
ITorService mService = null;
|
||||||
private boolean autoStartOnBind = false;
|
private boolean autoStartOnBind = false;
|
||||||
|
|
||||||
|
SharedPreferences prefs;
|
||||||
|
|
||||||
Orbot mOrbot = null;
|
Orbot mOrbot = null;
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
|
@ -69,8 +72,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
mOrbot = this;
|
mOrbot = this;
|
||||||
|
|
||||||
setTheme(android.R.style.Theme_Black_NoTitleBar);
|
setTheme(android.R.style.Theme_Black_NoTitleBar);
|
||||||
//setTitle(getString(R.string.app_name) + ' ' + getString(R.string.app_version));
|
|
||||||
showMain();
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +96,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
mItem = menu.add(0, 7, Menu.NONE, getString(R.string.menu_verify));
|
mItem = menu.add(0, 7, Menu.NONE, getString(R.string.menu_verify));
|
||||||
mItem.setIcon(R.drawable.ic_menu_check);
|
mItem.setIcon(R.drawable.ic_menu_check);
|
||||||
|
|
||||||
mItem = menu.add(0,6, Menu.NONE, getString(R.string.menu_log));
|
// mItem = menu.add(0,6, Menu.NONE, getString(R.string.menu_log));
|
||||||
mItem.setIcon(R.drawable.ic_menu_reports);
|
// mItem.setIcon(R.drawable.ic_menu_reports);
|
||||||
|
|
||||||
mItem = menu.add(0, 3, Menu.NONE, getString(R.string.menu_info));
|
mItem = menu.add(0, 3, Menu.NONE, getString(R.string.menu_info));
|
||||||
mItem.setIcon(R.drawable.ic_menu_about);
|
mItem.setIcon(R.drawable.ic_menu_about);
|
||||||
|
@ -146,10 +149,6 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
{
|
{
|
||||||
showSettings();
|
showSettings();
|
||||||
}
|
}
|
||||||
else if (item.getItemId() == 6)
|
|
||||||
{
|
|
||||||
showMessageLog();
|
|
||||||
}
|
|
||||||
else if (item.getItemId() == 3)
|
else if (item.getItemId() == 3)
|
||||||
{
|
{
|
||||||
showHelp();
|
showHelp();
|
||||||
|
@ -193,6 +192,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
|
* @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||||
|
|
||||||
if(keyCode==KeyEvent.KEYCODE_BACK){
|
if(keyCode==KeyEvent.KEYCODE_BACK){
|
||||||
|
@ -209,7 +209,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
|
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see android.app.Activity#onPause()
|
* @see android.app.Activity#onPause()
|
||||||
|
@ -306,6 +306,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
showMain();
|
||||||
|
|
||||||
if (getIntent() == null)
|
if (getIntent() == null)
|
||||||
return;
|
return;
|
||||||
|
@ -361,6 +362,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//setTitle(getString(R.string.app_name) + ' ' + getString(R.string.app_version));
|
||||||
|
|
||||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
mNotificationManager.cancelAll();
|
mNotificationManager.cancelAll();
|
||||||
|
@ -382,6 +384,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
new WizardHelper(this).showWizard();
|
new WizardHelper(this).showWizard();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,9 +403,6 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see android.app.Activity#onStop()
|
* @see android.app.Activity#onStop()
|
||||||
*/
|
*/
|
||||||
|
@ -419,7 +419,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
*/
|
*/
|
||||||
private void showMain ()
|
private void showMain ()
|
||||||
{
|
{
|
||||||
bindService(); //connect the UI activity to the remote service
|
// bindService(); //connect the UI activity to the remote service
|
||||||
|
|
||||||
currentView = R.layout.layout_main;
|
currentView = R.layout.layout_main;
|
||||||
setContentView(currentView);
|
setContentView(currentView);
|
||||||
|
@ -458,6 +458,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
/*
|
/*
|
||||||
* Show the message log UI
|
* Show the message log UI
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
private void showMessageLog ()
|
private void showMessageLog ()
|
||||||
{
|
{
|
||||||
currentView = R.layout.layout_log;
|
currentView = R.layout.layout_log;
|
||||||
|
@ -469,7 +470,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
txtMessageLog.setText(logBuffer.toString());
|
txtMessageLog.setText(logBuffer.toString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -495,19 +496,17 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSettings () throws RemoteException
|
private void processSettings () throws RemoteException
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (mService == null)
|
if (mService == null)
|
||||||
return; //nothing to do if the service isn't connected yet
|
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 useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
|
||||||
|
|
||||||
//boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
|
//boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
|
||||||
|
@ -518,12 +517,10 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
|
|
||||||
boolean enableHiddenServices = prefs.getBoolean("pref_hs_enable", false);
|
boolean enableHiddenServices = prefs.getBoolean("pref_hs_enable", false);
|
||||||
|
|
||||||
|
|
||||||
boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
|
boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
|
||||||
|
|
||||||
|
|
||||||
mService.updateTransProxy();
|
mService.updateTransProxy();
|
||||||
|
|
||||||
|
|
||||||
String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
|
String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
|
||||||
|
|
||||||
if (useBridges)
|
if (useBridges)
|
||||||
|
@ -649,10 +646,10 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mService.updateConfiguration("HiddenServiceDir","", false);
|
mService.updateConfiguration("HiddenServiceDir","", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mService.saveConfiguration();
|
mService.saveConfiguration();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -665,6 +662,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getHiddenServiceHostname ()
|
private String getHiddenServiceHostname ()
|
||||||
{
|
{
|
||||||
String appHome = "/data/data/" + TorServiceConstants.TOR_APP_USERNAME + "/";
|
String appHome = "/data/data/" + TorServiceConstants.TOR_APP_USERNAME + "/";
|
||||||
|
@ -709,6 +707,12 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
{
|
{
|
||||||
imgStatus.setImageResource(R.drawable.toron);
|
imgStatus.setImageResource(R.drawable.toron);
|
||||||
// imgStatus.clearAnimation();
|
// imgStatus.clearAnimation();
|
||||||
|
if (progressDialog != null)
|
||||||
|
{
|
||||||
|
progressDialog.dismiss();
|
||||||
|
progressDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String lblMsg = getString(R.string.status_activated) + "\n" + torServiceMsg;
|
String lblMsg = getString(R.string.status_activated) + "\n" + torServiceMsg;
|
||||||
|
|
||||||
|
@ -753,10 +757,15 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
imgStatus.setImageResource(R.drawable.torstarting);
|
imgStatus.setImageResource(R.drawable.torstarting);
|
||||||
|
if (progressDialog == null)
|
||||||
|
{
|
||||||
|
progressDialog =ProgressDialog.show(this, "", getString(R.string.status_starting_up));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
progressDialog.setMessage(torServiceMsg);
|
||||||
|
//lblStatus.setText(torServiceMsg);
|
||||||
|
|
||||||
|
|
||||||
lblStatus.setText(torServiceMsg);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int idx = torServiceMsg.indexOf("%");
|
int idx = torServiceMsg.indexOf("%");
|
||||||
|
|
||||||
|
@ -774,12 +783,23 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
imgStatus.setImageResource(R.drawable.torstopping);
|
imgStatus.setImageResource(R.drawable.torstopping);
|
||||||
// imgStatus.clearAnimation();
|
// imgStatus.clearAnimation();
|
||||||
|
|
||||||
|
if (progressDialog != null)
|
||||||
|
{
|
||||||
|
progressDialog.dismiss();
|
||||||
|
progressDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
lblStatus.setText(getString(R.string.status_shutting_down));
|
lblStatus.setText(getString(R.string.status_shutting_down));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (progressDialog != null)
|
||||||
|
{
|
||||||
|
progressDialog.dismiss();
|
||||||
|
progressDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
// imgStatus.clearAnimation();
|
// imgStatus.clearAnimation();
|
||||||
|
|
||||||
|
@ -953,16 +973,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case LOG_MSG:
|
case LOG_MSG:
|
||||||
|
//do nothing
|
||||||
|
|
||||||
String torLogMsg = (String)msg.getData().getString(HANDLER_TOR_MSG);
|
|
||||||
|
|
||||||
logBuffer.append(torLogMsg);
|
|
||||||
logBuffer.append('\n');
|
|
||||||
|
|
||||||
if (txtMessageLog != null)
|
|
||||||
{
|
|
||||||
txtMessageLog.append(torLogMsg + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ENABLE_TOR_MSG:
|
case ENABLE_TOR_MSG:
|
||||||
|
|
Loading…
Reference in New Issue