added check for trans proxy preference

svn:r21749
This commit is contained in:
Nathan Freitas 2010-02-24 05:09:24 +00:00
parent d9664a03ae
commit eafeb64b9c
3 changed files with 40 additions and 5 deletions

View File

@ -63,8 +63,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(android.R.style.Theme_Black);
setTitle(getString(R.string.app_name) + ' ' + getString(R.string.app_version));
setTheme(android.R.style.Theme_Black_NoTitleBar);
//setTitle(getString(R.string.app_name) + ' ' + getString(R.string.app_version));
showMain();
}
@ -328,7 +328,9 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
boolean useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
if (useBridges)
@ -496,7 +498,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
processSettings();
mService.setProfile(PROFILE_ON);
if (hasRoot)
if (hasRoot && enableTransparentProxy)
{
TorRoot.enableDNSProxying();
TorRoot.enabledWebProxying();
@ -507,7 +509,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
mService.setProfile(PROFILE_ONDEMAND);
if (hasRoot)
if (hasRoot && enableTransparentProxy)
{
TorRoot.purgeNatIptables();
}
@ -606,6 +608,7 @@ public class Orbot extends Activity implements OnClickListener, TorConstants
boolean mIsBound = false;
boolean hasRoot = false;
boolean enableTransparentProxy = false;
private void bindService ()
{

View File

@ -34,4 +34,7 @@ public interface TorConstants {
public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled";
public final static String PREF_BRIDGES_LIST = "pref_bridges_list";
public final static String PREF_TRANSPARENT = "pref_transparent";
}

View File

@ -5,6 +5,12 @@ package org.torproject.android.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Iterator;
import java.util.List;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.util.Log;
/**
@ -227,4 +233,27 @@ public final class TorRoot {
exec = null;
}
}
public void getApps (Context context)
{
PackageManager pMgr = context.getPackageManager();
List<ApplicationInfo> lAppInfo = pMgr.getInstalledApplications(0);
Iterator<ApplicationInfo> itAppInfo = lAppInfo.iterator();
ApplicationInfo aInfo = null;
while (itAppInfo.hasNext())
{
aInfo = itAppInfo.next();
boolean appEnabled = aInfo.enabled;
int uid = aInfo.uid; //-m owner --uid-owner
String username = pMgr.getNameForUid(uid);
String procName = aInfo.processName;
String name = aInfo.name;
}
}
}