parent
ed6f809827
commit
91b9c09c32
|
@ -1,10 +1,10 @@
|
||||||
<?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="11">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<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">
|
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
|
||||||
|
|
||||||
<activity android:name=".Orbot"
|
<activity android:name=".Orbot"
|
||||||
|
@ -33,13 +33,21 @@
|
||||||
<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=".boot.OnbootBroadcastReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action
|
||||||
|
android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?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" />
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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
|
1.0.4
|
||||||
- Added Russian, Persian, Arabic and other .po translations (see res/values-* folders)
|
- Added Russian, Persian, Arabic and other .po translations (see res/values-* folders)
|
||||||
- Fixed incorrect try to clear iptables rules for non-root devices
|
- Fixed incorrect try to clear iptables rules for non-root devices
|
||||||
|
@ -7,6 +8,9 @@ NOTE: Specific #s below correspond to Trac tickets logged and maintained at http
|
||||||
- Added new green notification icon when Tor is connected
|
- Added new green notification icon when Tor is connected
|
||||||
- Fixed app selector layout in settings
|
- Fixed app selector layout in settings
|
||||||
- Moved minSDK to 4 (Android 1.6); discontinued 1.5 support
|
- Moved minSDK to 4 (Android 1.6); discontinued 1.5 support
|
||||||
|
- Fixed log screen touch disable tor bug
|
||||||
|
- Debugged issues around network status change causing FC/crash
|
||||||
|
- Added "Start on Boot" option
|
||||||
|
|
||||||
1.0.3
|
1.0.3
|
||||||
- Fixed spanish language issues with settings screen
|
- Fixed spanish language issues with settings screen
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_x="2px"
|
android:layout_x="2px"
|
||||||
android:layout_y="2px"
|
android:layout_y="2px"
|
||||||
android:textSize="12px"
|
android:textSize="14px"
|
||||||
android:background="#A0222222"
|
android:background="#A0222222"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:width="320px"
|
android:width="300px"
|
||||||
android:height="100px"
|
android:height="75px"
|
||||||
android:textColor="#ffffff"
|
android:textColor="#ffffff"
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="pref_hs_group">Hidden Services</string>
|
|
||||||
<string name="app_name">Orbot</string>
|
<string name="app_name">Orbot</string>
|
||||||
<string name="app_version">1.0.4</string>
|
<string name="app_version">1.0.4</string>
|
||||||
|
|
||||||
|
@ -110,4 +109,12 @@
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
<string name="tor_check">This will open your default web browser to https://check.torproject.org in order to see if Orbot is probably configured and you are connected to Tor.</string>
|
<string name="tor_check">This will open your default web browser to https://check.torproject.org in order to see if Orbot is probably configured and you are connected to Tor.</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="pref_hs_group">Hidden Services</string>
|
||||||
|
|
||||||
|
<string name="pref_general_group">General</string>
|
||||||
|
<string name="pref_start_boot_title">Start Orbot on Boot</string>
|
||||||
|
<string name="pref_start_boot_summary">Automatically start Orbot and connect Tor when your Android device boots</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<PreferenceCategory android:title="@string/pref_general_group">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="pref_start_boot"
|
||||||
|
android:title="@string/pref_start_boot_title"
|
||||||
|
android:summary="@string/pref_start_boot_summary"
|
||||||
|
android:enabled="true"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_trans_proxy_group">
|
<PreferenceCategory android:title="@string/pref_trans_proxy_group">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
|
|
@ -176,10 +176,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
stopTor();
|
stopTor();
|
||||||
|
|
||||||
|
|
||||||
unbindService();
|
|
||||||
|
|
||||||
stopService(new Intent(ITorService.class.getName()));
|
|
||||||
|
|
||||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
mNotificationManager.cancelAll();
|
mNotificationManager.cancelAll();
|
||||||
|
|
||||||
|
@ -826,43 +823,45 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unbindService();
|
||||||
|
|
||||||
|
//stopService(new Intent(ITorService.class.getName()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
try
|
|
||||||
{
|
if (currentView == R.layout.layout_main)
|
||||||
|
{
|
||||||
if (mService == null)
|
try
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (mService.getStatus() == STATUS_READY)
|
|
||||||
{
|
{
|
||||||
|
if (mService == null)
|
||||||
|
{
|
||||||
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP)
|
}
|
||||||
|
else if (mService.getStatus() == STATUS_READY)
|
||||||
{
|
{
|
||||||
startTor();
|
startTor();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN)
|
|
||||||
{
|
{
|
||||||
stopTor();
|
stopTor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
Log.d(TAG,"error onclick",e);
|
||||||
{
|
}
|
||||||
Log.d(TAG,"error onclick",e);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -870,9 +869,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
*/
|
*/
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
// the start button
|
if (currentView == R.layout.layout_main)
|
||||||
// if (view.getId()==R.id.imgStatus || view.getId()==R.id.lblStatus)
|
{
|
||||||
// {
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -899,7 +897,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
|
||||||
Log.d(TAG,"error onclick",e);
|
Log.d(TAG,"error onclick",e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,18 @@ public class SettingsPreferences
|
||||||
|
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
|
||||||
|
int transProxyGroupIdx = 1;
|
||||||
|
|
||||||
if (!hasRoot)
|
if (!hasRoot)
|
||||||
{
|
{
|
||||||
getPreferenceScreen().getPreference(0).setEnabled(false);
|
getPreferenceScreen().getPreference(transProxyGroupIdx).setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefCBTransProxy = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(0)).getPreference(0));
|
prefCBTransProxy = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(transProxyGroupIdx)).getPreference(0));
|
||||||
prefcBTransProxyAll = (CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(0)).getPreference(1);
|
prefcBTransProxyAll = (CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(transProxyGroupIdx)).getPreference(1);
|
||||||
prefTransProxyApps = ((PreferenceCategory)this.getPreferenceScreen().getPreference(0)).getPreference(2);
|
prefTransProxyApps = ((PreferenceCategory)this.getPreferenceScreen().getPreference(transProxyGroupIdx)).getPreference(2);
|
||||||
|
|
||||||
prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked());
|
prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked());
|
||||||
|
|
||||||
|
@ -74,10 +77,12 @@ public class SettingsPreferences
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prefHiddenServices = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(4)).getPreference(0));
|
int hiddenGroupIdx = 5;
|
||||||
|
|
||||||
|
prefHiddenServices = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(0));
|
||||||
prefHiddenServices.setOnPreferenceClickListener(this);
|
prefHiddenServices.setOnPreferenceClickListener(this);
|
||||||
((PreferenceCategory)this.getPreferenceScreen().getPreference(4)).getPreference(1).setEnabled(prefHiddenServices.isChecked());
|
((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(1).setEnabled(prefHiddenServices.isChecked());
|
||||||
((PreferenceCategory)this.getPreferenceScreen().getPreference(4)).getPreference(2).setEnabled(prefHiddenServices.isChecked());
|
((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(2).setEnabled(prefHiddenServices.isChecked());
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -106,8 +111,8 @@ public class SettingsPreferences
|
||||||
else if (preference == prefHiddenServices)
|
else if (preference == prefHiddenServices)
|
||||||
{
|
{
|
||||||
|
|
||||||
((PreferenceCategory)this.getPreferenceScreen().getPreference(4)).getPreference(1).setEnabled(prefHiddenServices.isChecked());
|
((PreferenceCategory)this.getPreferenceScreen().getPreference(5)).getPreference(1).setEnabled(prefHiddenServices.isChecked());
|
||||||
((PreferenceCategory)this.getPreferenceScreen().getPreference(4)).getPreference(2).setEnabled(prefHiddenServices.isChecked());
|
((PreferenceCategory)this.getPreferenceScreen().getPreference(5)).getPreference(2).setEnabled(prefHiddenServices.isChecked());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
|
Log.i(TAG, "serviced created");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,16 +183,38 @@ 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);
|
||||||
|
|
||||||
|
_torInstance = this;
|
||||||
|
|
||||||
|
Log.i(TAG, "service started: " + intent.getAction());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkTorBinaries ();
|
checkTorBinaries ();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
logNotice("unable to find tor binaries: " + e.getMessage());
|
||||||
|
showToolbarNotification(e.getMessage(), R.drawable.tornotificationoff);
|
||||||
|
|
||||||
Log.e(TAG, "error checking tor binaries", e);
|
Log.e(TAG, "error checking tor binaries", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (intent.getAction()!=null && intent.getAction().equals("onboot"))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
|
boolean startOnBoot = prefs.getBoolean("pref_start_boot",true);
|
||||||
|
|
||||||
|
if (startOnBoot)
|
||||||
|
{
|
||||||
|
setTorProfile(PROFILE_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run ()
|
public void run ()
|
||||||
{
|
{
|
||||||
|
|
||||||
boolean isRunning = _torInstance.findExistingProc ();
|
boolean isRunning = _torInstance.findExistingProc ();
|
||||||
|
|
||||||
if (!isRunning)
|
if (!isRunning)
|
||||||
|
@ -227,16 +249,12 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
{
|
{
|
||||||
currentStatus = STATUS_OFF;
|
currentStatus = STATUS_OFF;
|
||||||
|
|
||||||
|
|
||||||
sendCallbackLogMessage("Web proxy shutdown");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
killTorProcess ();
|
killTorProcess ();
|
||||||
|
|
||||||
currentStatus = STATUS_READY;
|
currentStatus = STATUS_READY;
|
||||||
|
|
||||||
|
|
||||||
showToolbarNotification (getString(R.string.status_disabled),R.drawable.tornotificationoff);
|
showToolbarNotification (getString(R.string.status_disabled),R.drawable.tornotificationoff);
|
||||||
sendCallbackStatusMessage(getString(R.string.status_disabled));
|
sendCallbackStatusMessage(getString(R.string.status_disabled));
|
||||||
|
|
||||||
|
@ -276,8 +294,6 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
|
|
||||||
private void killTorProcess () throws Exception
|
private void killTorProcess () throws Exception
|
||||||
{
|
{
|
||||||
//android.os.Debug.waitForDebugger();
|
|
||||||
|
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
int procId = -1;
|
int procId = -1;
|
||||||
|
|
||||||
|
@ -287,8 +303,9 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logNotice("sending SHUTDOWN signal to Tor process");
|
logNotice("sending SHUTDOWN signal to Tor process");
|
||||||
conn.signal("SHUTDOWN");
|
|
||||||
//torConnSocket.close();
|
conn.shutdownTor("SHUTDOWN");
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(TAG,"error shutting down Tor via connection",e);
|
Log.d(TAG,"error shutting down Tor via connection",e);
|
||||||
|
@ -296,25 +313,25 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
|
|
||||||
conn = null;
|
conn = null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
try //wait a second for this
|
|
||||||
{ Thread.sleep(1000); }
|
logNotice("Checking for existing Tor process via path: " + torBinaryPath);
|
||||||
catch (Exception e) {}
|
|
||||||
|
|
||||||
logNotice("Checking for existing Tor process via path: " + torBinaryPath);
|
|
||||||
procId = TorServiceUtils.findProcessId(torBinaryPath);
|
|
||||||
|
|
||||||
while (procId != -1)
|
|
||||||
{
|
|
||||||
|
|
||||||
logNotice("Found Tor PID=" + procId + " - killing now...");
|
|
||||||
|
|
||||||
String[] cmd = { SHELL_CMD_KILL + ' ' + procId + "" };
|
|
||||||
TorServiceUtils.doShellCommand(cmd,log, false, false);
|
|
||||||
|
|
||||||
procId = TorServiceUtils.findProcessId(torBinaryPath);
|
procId = TorServiceUtils.findProcessId(torBinaryPath);
|
||||||
}
|
|
||||||
|
while (procId != -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
logNotice("Found Tor PID=" + procId + " - killing now...");
|
||||||
|
|
||||||
|
String[] cmd = { SHELL_CMD_KILL + ' ' + procId + "" };
|
||||||
|
TorServiceUtils.doShellCommand(cmd,log, false, false);
|
||||||
|
|
||||||
|
procId = TorServiceUtils.findProcessId(torBinaryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
logNotice("Checking for existing Privoxy process via path: " + privoxyPath);
|
logNotice("Checking for existing Privoxy process via path: " + privoxyPath);
|
||||||
procId = TorServiceUtils.findProcessId(privoxyPath);
|
procId = TorServiceUtils.findProcessId(privoxyPath);
|
||||||
|
@ -393,6 +410,33 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
return fileApk.getAbsolutePath();
|
return fileApk.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
apkBase = "/sd-ext/app/";
|
||||||
|
|
||||||
|
APK_EXT = ".apk";
|
||||||
|
|
||||||
|
MAX_TRIES = 10;
|
||||||
|
|
||||||
|
buildPath = apkBase + TOR_APP_USERNAME + APK_EXT;
|
||||||
|
logNotice("Checking Apps2SD APK location: " + buildPath);
|
||||||
|
|
||||||
|
fileApk = new File(buildPath);
|
||||||
|
|
||||||
|
if (fileApk.exists())
|
||||||
|
return fileApk.getAbsolutePath();
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_TRIES; i++)
|
||||||
|
{
|
||||||
|
buildPath = apkBase + TOR_APP_USERNAME + '-' + i + APK_EXT;
|
||||||
|
fileApk = new File(buildPath);
|
||||||
|
|
||||||
|
logNotice( "Checking Apps2SD location: " + buildPath);
|
||||||
|
|
||||||
|
if (fileApk.exists())
|
||||||
|
return fileApk.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -412,6 +456,9 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
|
|
||||||
String apkPath = findAPK();
|
String apkPath = findAPK();
|
||||||
|
|
||||||
|
if (apkPath == null)
|
||||||
|
throw new Exception ("Unable to locate Orbot binary APK file");
|
||||||
|
|
||||||
logNotice( "found apk at: " + apkPath);
|
logNotice( "found apk at: " + apkPath);
|
||||||
|
|
||||||
boolean apkExists = new File(apkPath).exists();
|
boolean apkExists = new File(apkPath).exists();
|
||||||
|
@ -768,13 +815,15 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTorProfile(int profile) {
|
public void setTorProfile(int profile) {
|
||||||
|
logNotice("Tor profile set to " + profile);
|
||||||
|
|
||||||
if (profile == PROFILE_ON)
|
if (profile == PROFILE_ON)
|
||||||
{
|
{
|
||||||
currentStatus = STATUS_CONNECTING;
|
currentStatus = STATUS_CONNECTING;
|
||||||
sendCallbackStatusMessage ("starting...");
|
sendCallbackStatusMessage ("starting...");
|
||||||
|
|
||||||
new Thread(_torInstance).start();
|
Thread thread = new Thread(this);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -784,6 +833,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
|
|
||||||
_torInstance.stopTor();
|
_torInstance.stopTor();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,22 +949,25 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
// a single interface, you can just return it here without checking
|
// a single interface, you can just return it here without checking
|
||||||
// the Intent.
|
// the Intent.
|
||||||
|
|
||||||
|
_torInstance = this;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
checkTorBinaries();
|
checkTorBinaries();
|
||||||
|
|
||||||
findExistingProc ();
|
|
||||||
|
|
||||||
_torInstance = this;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
logNotice("unable to find tor binaries: " + e.getMessage());
|
||||||
|
showToolbarNotification(e.getMessage(), R.drawable.tornotificationoff);
|
||||||
|
|
||||||
Log.d(TAG,"Unable to check for Tor binaries",e);
|
Log.d(TAG,"Unable to check for Tor binaries",e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findExistingProc ();
|
||||||
|
|
||||||
if (ITorService.class.getName().equals(intent.getAction())) {
|
if (ITorService.class.getName().equals(intent.getAction())) {
|
||||||
return mBinder;
|
return mBinder;
|
||||||
}
|
}
|
||||||
|
@ -1060,29 +1113,28 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
};
|
};
|
||||||
|
|
||||||
private ArrayList<String> callbackBuffer = new ArrayList<String>();
|
private ArrayList<String> callbackBuffer = new ArrayList<String>();
|
||||||
|
private boolean inCallbackStatus = false;
|
||||||
|
private boolean inCallbackLog = false;
|
||||||
|
|
||||||
private void sendCallbackStatusMessage (String newStatus)
|
private void sendCallbackStatusMessage (String newStatus)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (mCallbacks == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Broadcast to all clients the new value.
|
// Broadcast to all clients the new value.
|
||||||
final int N = mCallbacks.beginBroadcast();
|
final int N = mCallbacks.beginBroadcast();
|
||||||
|
|
||||||
|
inCallbackStatus = true;
|
||||||
callbackBuffer.add(newStatus);
|
|
||||||
|
|
||||||
if (N > 0)
|
if (N > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
Iterator<String> it = callbackBuffer.iterator();
|
for (int i=0; i<N; i++) {
|
||||||
String status = null;
|
|
||||||
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
status = it.next();
|
|
||||||
|
|
||||||
for (int i=0; i<N; i++) {
|
|
||||||
try {
|
try {
|
||||||
mCallbacks.getBroadcastItem(i).statusChanged(status);
|
mCallbacks.getBroadcastItem(i).statusChanged(newStatus);
|
||||||
|
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -1090,22 +1142,26 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
// the dead object for us.
|
// the dead object for us.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
callbackBuffer.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallbacks.finishBroadcast();
|
mCallbacks.finishBroadcast();
|
||||||
|
inCallbackStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void sendCallbackLogMessage (String logMessage)
|
private void sendCallbackLogMessage (String logMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (mCallbacks == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
callbackBuffer.add(logMessage);
|
||||||
|
|
||||||
|
|
||||||
// Broadcast to all clients the new value.
|
// Broadcast to all clients the new value.
|
||||||
final int N = mCallbacks.beginBroadcast();
|
final int N = mCallbacks.beginBroadcast();
|
||||||
|
|
||||||
|
inCallbackLog = true;
|
||||||
|
|
||||||
callbackBuffer.add(logMessage);
|
|
||||||
|
|
||||||
if (N > 0)
|
if (N > 0)
|
||||||
{
|
{
|
||||||
|
@ -1133,6 +1189,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallbacks.finishBroadcast();
|
mCallbacks.finishBroadcast();
|
||||||
|
inCallbackLog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyPreferences () throws RemoteException
|
private void applyPreferences () throws RemoteException
|
||||||
|
|
Loading…
Reference in New Issue