Compare commits
5 Commits
android-0.
...
android-0.
Author | SHA1 | Date | |
---|---|---|---|
abe20c95d0 | |||
52a60b37e2 | |||
adb5c56f26 | |||
177ac2e3a1 | |||
1219725e6a |
@ -1,8 +1,8 @@
|
|||||||
<?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="net.i2p.android.router"
|
package="net.i2p.android.router"
|
||||||
android.versionCode="4208704"
|
android.versionCode="4720640"
|
||||||
android.versionName="0.8.7-4_b1-API8"
|
android.versionName="0.9.1-0_b1-API8"
|
||||||
android:installLocation="preferExternal"
|
android:installLocation="preferExternal"
|
||||||
>
|
>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
@ -67,6 +67,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activity.PeersActivity"
|
<activity android:name=".activity.PeersActivity"
|
||||||
android:label="I2P Peers and Transport Status"
|
android:label="I2P Peers and Transport Status"
|
||||||
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android.theme="@android:style/Theme.NoTitleBar"
|
android.theme="@android:style/Theme.NoTitleBar"
|
||||||
android:launchMode="singleTop" >
|
android:launchMode="singleTop" >
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -165,6 +165,8 @@
|
|||||||
<copy file="LICENSE.txt" tofile="res/raw/license_app_txt" />
|
<copy file="LICENSE.txt" tofile="res/raw/license_app_txt" />
|
||||||
<copy file="licenses/LICENSE-Apache2.0.txt" tofile="res/raw/license_apache20_txt" />
|
<copy file="licenses/LICENSE-Apache2.0.txt" tofile="res/raw/license_apache20_txt" />
|
||||||
<copy file="${i2pbase}/installer/resources/themes/console/images/i2plogo.png" todir="res/drawable/" />
|
<copy file="${i2pbase}/installer/resources/themes/console/images/i2plogo.png" todir="res/drawable/" />
|
||||||
|
<copy file="${i2pbase}/installer/resources/themes/console/images/outbound.png" todir="res/drawable/" />
|
||||||
|
<copy file="${i2pbase}/installer/resources/themes/console/images/inbound.png" todir="res/drawable/" />
|
||||||
<copy file="${i2pbase}/installer/resources/themes/console/light/images/header.png" todir="res/drawable/" />
|
<copy file="${i2pbase}/installer/resources/themes/console/light/images/header.png" todir="res/drawable/" />
|
||||||
<copy file="${i2pbase}/installer/resources/themes/console/light/console.css" tofile="res/raw/console_css" />
|
<copy file="${i2pbase}/installer/resources/themes/console/light/console.css" tofile="res/raw/console_css" />
|
||||||
<copy file="${i2pbase}/installer/resources/blocklist.txt" tofile="res/raw/blocklist_txt" />
|
<copy file="${i2pbase}/installer/resources/blocklist.txt" tofile="res/raw/blocklist_txt" />
|
||||||
@ -210,6 +212,8 @@
|
|||||||
<target name="distclean" depends="clean">
|
<target name="distclean" depends="clean">
|
||||||
<delete dir="${jar.libs.dir}" verbose="${verbose}" />
|
<delete dir="${jar.libs.dir}" verbose="${verbose}" />
|
||||||
<delete file="res/drawable/i2plogo.png" verbose="${verbose}"/>
|
<delete file="res/drawable/i2plogo.png" verbose="${verbose}"/>
|
||||||
|
<delete file="res/drawable/outbound.png" verbose="${verbose}"/>
|
||||||
|
<delete file="res/drawable/inbound.png" verbose="${verbose}"/>
|
||||||
<delete file="res/drawable/header.png" verbose="${verbose}"/>
|
<delete file="res/drawable/header.png" verbose="${verbose}"/>
|
||||||
<delete file="res/raw/console_css" verbose="${verbose}"/>
|
<delete file="res/raw/console_css" verbose="${verbose}"/>
|
||||||
<delete file="res/raw/blocklist_txt" verbose="${verbose}" />
|
<delete file="res/raw/blocklist_txt" verbose="${verbose}" />
|
||||||
|
BIN
res/drawable/ic_launcher_itoopie_120.png
Normal file
BIN
res/drawable/ic_launcher_itoopie_120.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
res/drawable/ic_launcher_itoopie_150.png
Normal file
BIN
res/drawable/ic_launcher_itoopie_150.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
res/drawable/ic_launcher_itoopie_180.png
Normal file
BIN
res/drawable/ic_launcher_itoopie_180.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
res/drawable/ic_launcher_itoopie_300.png
Normal file
BIN
res/drawable/ic_launcher_itoopie_300.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
res/drawable/ic_launcher_itoopie_330.png
Normal file
BIN
res/drawable/ic_launcher_itoopie_330.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -1,23 +1,23 @@
|
|||||||
logger.consoleBufferSize=250
|
logger.consoleBufferSize=250
|
||||||
logger.dateFormat=MM/dd HH:mm:ss.SSS
|
logger.dateFormat=MM/dd HH:mm:ss.SSS
|
||||||
logger.defaultLevel=INFO
|
logger.defaultLevel=WARN
|
||||||
logger.displayOnScreen=true
|
logger.displayOnScreen=true
|
||||||
logger.logFileSize=64k
|
logger.logFileSize=64k
|
||||||
logger.logRotationLimit=2
|
logger.logRotationLimit=2
|
||||||
logger.minimumOnScreenLevel=WARN
|
logger.minimumOnScreenLevel=WARN
|
||||||
logger.record.net.i2p.crypto=WARN
|
logger.record.net.i2p.crypto=WARN
|
||||||
logger.record.net.i2p.router.InNetMessagePool=WARN
|
logger.record.net.i2p.router.InNetMessagePool=WARN
|
||||||
logger.record.net.i2p.router.Router=INFO
|
logger.record.net.i2p.router.Router=WARN
|
||||||
logger.record.net.i2p.router.Shitlist=WARN
|
logger.record.net.i2p.router.Shitlist=WARN
|
||||||
logger.record.net.i2p.router.networkdb=WARN
|
logger.record.net.i2p.router.networkdb=WARN
|
||||||
logger.record.net.i2p.router.peermanager=WARN
|
logger.record.net.i2p.router.peermanager=WARN
|
||||||
logger.record.net.i2p.router.peermanager.ProfileOrganizer=WARN
|
logger.record.net.i2p.router.peermanager.ProfileOrganizer=WARN
|
||||||
logger.record.net.i2p.router.transport=WARN
|
logger.record.net.i2p.router.transport=ERROR
|
||||||
logger.record.net.i2p.router.transport.FIFOBandwidthRefiller=ERROR
|
logger.record.net.i2p.router.transport.FIFOBandwidthRefiller=ERROR
|
||||||
logger.record.net.i2p.router.tunnel=WARN
|
logger.record.net.i2p.router.tunnel=WARN
|
||||||
logger.record.net.i2p.stat.Rate=ERROR
|
logger.record.net.i2p.stat.Rate=ERROR
|
||||||
logger.record.net.i2p.util.I2PThread=ERROR
|
logger.record.net.i2p.util.I2PThread=ERROR
|
||||||
logger.record.net.i2p.util.LogManager=WARN
|
logger.record.net.i2p.util.LogManager=WARN
|
||||||
logger.record.net.i2p.util.LogWriter=WARN
|
logger.record.net.i2p.util.LogWriter=WARN
|
||||||
logger.record.net.i2p.util.NativeBigInteger=DEBUG
|
logger.record.net.i2p.util.NativeBigInteger=ERROR
|
||||||
logger.record.net.org.cybergarage.util.Debug=DEBUG
|
logger.record.net.org.cybergarage.util.Debug=DEBUG
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
******* Please read all of the following *******
|
******* Please read all of the following *******
|
||||||
|
|
||||||
This is the first alpha release of the I2P Android app.
|
This is an alpha release of the I2P Android app.
|
||||||
|
|
||||||
WARNING - This is ALPHA SOFTWARE. It may crash your phone. Do not rely upon it for strong anonymity. Tunnels may be as short as one hop. There may be serious security holes in the app.
|
WARNING - This is ALPHA SOFTWARE. It may crash your phone. Do not rely upon it for strong anonymity. Tunnels may be as short as one hop. There may be serious security holes in the app.
|
||||||
|
|
||||||
Minimum Android OS is 2.2 (API 8). The app is only tested on the Motorola Droid. It uses a lot of RAM. You need at least 256 MB of RAM. 512 should be much better.
|
Minimum Android OS is 2.2 (API 8). It uses a lot of RAM. You need at least 256 MB of RAM. 512 should be much better.
|
||||||
|
|
||||||
The app may use a lot of RAM even after the router has stopped and there is no icon in the notification bar. Go to Settings -> Applications -> Running Services and stop the I2P service if necessary. Or Settings -> Applications -> Manage Applications -> Running -> I2P and force stop.
|
The app may use a lot of RAM even after the router has stopped and there is no icon in the notification bar. Go to Settings -> Applications -> Running Services and stop the I2P service if necessary. Or Settings -> Applications -> Manage Applications -> Running -> I2P and force stop.
|
||||||
|
|
||||||
The app may be moved to the SD card if you have Froyo (2.2) or higher. The app does not store any files on the SD card.
|
The app may be moved to the SD card. The app does not store any files on the SD card.
|
||||||
|
|
||||||
The app runs on either WIFI or mobile networks. For now, the app is very low bandwidth, as it does not allow participating tunnels. It does not route traffic for other routers.
|
The app runs on either WIFI or mobile networks. For now, the app is very low bandwidth, as it does not allow participating tunnels. It does not route traffic for other routers.
|
||||||
|
|
||||||
The app uses TCP only for router-router connections, with a maximum of 24 simultaneous. UDP is disabled.
|
The app uses TCP only for router-router connections, with a maximum of 24 simultaneous. UDP is disabled.
|
||||||
|
|
||||||
UPnP is enabled but it doesn't appear to be working.
|
UPnP is disabled. With UDP disabled also, you do not publish an IP address and should not be getting incoming connections.
|
||||||
|
|
||||||
NTP is disabled. If you have cell service, your phone or tablet should have the correct time. If you do not have cell service, ensure your device has accurate time.
|
NTP is disabled. If you have cell service, your phone or tablet should have the correct time. If you do not have cell service, ensure your device has accurate time.
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ i2cp.disableInterface=true
|
|||||||
# Todo: implement a NamingService using the android native SQLite
|
# Todo: implement a NamingService using the android native SQLite
|
||||||
#
|
#
|
||||||
i2p.naming.impl=net.i2p.client.naming.HostsTxtNamingService
|
i2p.naming.impl=net.i2p.client.naming.HostsTxtNamingService
|
||||||
|
i2p.hostsfilelist=hosts.txt
|
||||||
#
|
#
|
||||||
##### Tunnels
|
##### Tunnels
|
||||||
#
|
#
|
||||||
@ -49,9 +50,10 @@ i2np.ntcp.maxConnections=24
|
|||||||
i2np.udp.enable=false
|
i2np.udp.enable=false
|
||||||
i2np.udp.maxConnections=12
|
i2np.udp.maxConnections=12
|
||||||
#
|
#
|
||||||
# no COMM at all!!!
|
|
||||||
#i2p.vmCommSystem=true
|
|
||||||
#
|
#
|
||||||
# not on android
|
# not on android
|
||||||
i2np.upnp.enable=true
|
i2np.upnp.enable=false
|
||||||
routerconsole.geoip.enable=false
|
routerconsole.geoip.enable=false
|
||||||
|
#
|
||||||
|
# temp until certs are included
|
||||||
|
router.reseedSSLDisable=true
|
||||||
|
@ -14,6 +14,7 @@ CORE=`grep 'public final static String VERSION' $I2PBASE/core/java/src/net/i2p/C
|
|||||||
MAJOR=`echo $CORE | cut -d '.' -f 1`
|
MAJOR=`echo $CORE | cut -d '.' -f 1`
|
||||||
MINOR=`echo $CORE | cut -d '.' -f 2`
|
MINOR=`echo $CORE | cut -d '.' -f 2`
|
||||||
RELEASE=`echo $CORE | cut -d '.' -f 3`
|
RELEASE=`echo $CORE | cut -d '.' -f 3`
|
||||||
|
RELEASE=${RELEASE:-0}
|
||||||
|
|
||||||
ROUTERBUILD=$((`grep 'public final static long BUILD' $I2PBASE/router/java/src/net/i2p/router/RouterVersion.java | \
|
ROUTERBUILD=$((`grep 'public final static long BUILD' $I2PBASE/router/java/src/net/i2p/router/RouterVersion.java | \
|
||||||
cut -d '=' -f 2 | \
|
cut -d '=' -f 2 | \
|
||||||
@ -26,7 +27,7 @@ SDK=`grep 'android:minSdkVersion' $MANIFEST | \
|
|||||||
cut -d '"' -f 2`
|
cut -d '"' -f 2`
|
||||||
|
|
||||||
# don't let build number get too long
|
# don't let build number get too long
|
||||||
VERSIONSTRING="${CORE}-${ROUTERBUILD}_b$(($ANDROIDBUILD % 512))-API$SDK"
|
VERSIONSTRING="${MAJOR}.${MINOR}.${RELEASE}-${ROUTERBUILD}_b$(($ANDROIDBUILD % 512))-API$SDK"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Android version code is an integer.
|
# Android version code is an integer.
|
||||||
|
@ -39,14 +39,21 @@ public class AddressbookActivity extends ListActivity {
|
|||||||
|
|
||||||
// get the names
|
// get the names
|
||||||
NamingService ns = ctx.namingService();
|
NamingService ns = ctx.namingService();
|
||||||
|
// After router shutdown we get nothing... why?
|
||||||
Set<String> names = ns.getNames();
|
Set<String> names = ns.getNames();
|
||||||
|
|
||||||
// set the header
|
// set the header
|
||||||
TextView tv = (TextView) getLayoutInflater().inflate(R.layout.addressbook_header, null);
|
TextView tv = (TextView) getLayoutInflater().inflate(R.layout.addressbook_header, null);
|
||||||
tv.setText(names.size() + " hosts in address book. Start typing to filter.");
|
int sz = names.size();
|
||||||
|
if (sz > 1)
|
||||||
|
tv.setText(sz + " hosts in address book. Start typing to filter.");
|
||||||
|
else if (sz > 0)
|
||||||
|
tv.setText("1 host in address book.");
|
||||||
|
else
|
||||||
|
tv.setText("No hosts in address book, or your router is not up.");
|
||||||
ListView lv = getListView();
|
ListView lv = getListView();
|
||||||
lv.addHeaderView(tv, "", false);
|
lv.addHeaderView(tv, "", false);
|
||||||
lv.setTextFilterEnabled(true);
|
lv.setTextFilterEnabled(sz > 1);
|
||||||
|
|
||||||
// set the list
|
// set the list
|
||||||
List<String> nameList = new ArrayList(names);
|
List<String> nameList = new ArrayList(names);
|
||||||
|
@ -41,7 +41,7 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
System.err.println(this + " onCreate called");
|
Util.i(this + " onCreate called");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
_myDir = getFilesDir().getAbsolutePath();
|
_myDir = getFilesDir().getAbsolutePath();
|
||||||
}
|
}
|
||||||
@ -49,14 +49,14 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onRestart()
|
public void onRestart()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onRestart called");
|
Util.i(this + " onRestart called");
|
||||||
super.onRestart();
|
super.onRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onStart called");
|
Util.i(this + " onStart called");
|
||||||
super.onStart();
|
super.onStart();
|
||||||
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
|
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
|
||||||
if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START))
|
if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START))
|
||||||
@ -87,28 +87,28 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onResume called");
|
Util.i(this + " onResume called");
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause()
|
public void onPause()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onPause called");
|
Util.i(this + " onPause called");
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState)
|
public void onSaveInstanceState(Bundle outState)
|
||||||
{
|
{
|
||||||
System.err.println(this + " onSaveInstanceState called");
|
Util.i(this + " onSaveInstanceState called");
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onStop called");
|
Util.i(this + " onStop called");
|
||||||
unbindRouter();
|
unbindRouter();
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
System.err.println(this + " onDestroy called");
|
Util.i(this + " onDestroy called");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,9 +151,11 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
MenuItem addressbook = menu.findItem(R.id.menu_addressbook);
|
MenuItem addressbook = menu.findItem(R.id.menu_addressbook);
|
||||||
addressbook.setVisible(showAddressbook);
|
addressbook.setVisible(showAddressbook);
|
||||||
addressbook.setEnabled(showAddressbook);
|
addressbook.setEnabled(showAddressbook);
|
||||||
|
|
||||||
|
boolean showReload = showAddressbook || (this instanceof PeersActivity);
|
||||||
MenuItem reload = menu.findItem(R.id.menu_reload);
|
MenuItem reload = menu.findItem(R.id.menu_reload);
|
||||||
reload.setVisible(showAddressbook);
|
reload.setVisible(showReload);
|
||||||
reload.setEnabled(showAddressbook);
|
reload.setEnabled(showReload);
|
||||||
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
@ -208,14 +210,14 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
protected boolean startRouter() {
|
protected boolean startRouter() {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
|
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
|
||||||
System.err.println(this + " calling startService");
|
Util.i(this + " calling startService");
|
||||||
ComponentName name = startService(intent);
|
ComponentName name = startService(intent);
|
||||||
if (name == null)
|
if (name == null)
|
||||||
System.err.println(this + " XXXXXXXXXXXXXXXXXXXX got from startService: " + name);
|
Util.i(this + " XXXXXXXXXXXXXXXXXXXX got from startService: " + name);
|
||||||
System.err.println(this + " got from startService: " + name);
|
Util.i(this + " got from startService: " + name);
|
||||||
boolean success = bindRouter(true);
|
boolean success = bindRouter(true);
|
||||||
if (!success)
|
if (!success)
|
||||||
System.err.println(this + " Bind router failed");
|
Util.i(this + " Bind router failed");
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,10 +227,10 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
protected boolean bindRouter(boolean autoCreate) {
|
protected boolean bindRouter(boolean autoCreate) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
|
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
|
||||||
System.err.println(this + " calling bindService");
|
Util.i(this + " calling bindService");
|
||||||
_connection = new RouterConnection();
|
_connection = new RouterConnection();
|
||||||
boolean success = bindService(intent, _connection, autoCreate ? BIND_AUTO_CREATE : 0);
|
boolean success = bindService(intent, _connection, autoCreate ? BIND_AUTO_CREATE : 0);
|
||||||
System.err.println(this + " bindService: auto create? " + autoCreate + " success? " + success);
|
Util.i(this + " bindService: auto create? " + autoCreate + " success? " + success);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +245,7 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
protected class RouterConnection implements ServiceConnection {
|
protected class RouterConnection implements ServiceConnection {
|
||||||
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
System.err.println(this + " connected to router service");
|
Util.i(this + " connected to router service");
|
||||||
RouterBinder binder = (RouterBinder) service;
|
RouterBinder binder = (RouterBinder) service;
|
||||||
RouterService svc = binder.getService();
|
RouterService svc = binder.getService();
|
||||||
_routerService = svc;
|
_routerService = svc;
|
||||||
@ -252,7 +254,7 @@ public abstract class I2PActivityBase extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
System.err.println(this + " disconnected from router service!!!!!!!");
|
Util.i(this + " disconnected from router service!!!!!!!");
|
||||||
// save memory
|
// save memory
|
||||||
_routerService = null;
|
_routerService = null;
|
||||||
_isBound = false;
|
_isBound = false;
|
||||||
|
@ -9,6 +9,7 @@ import android.net.Uri;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.webkit.HttpAuthHandler;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -173,6 +174,12 @@ class I2PWebViewClient extends WebViewClient {
|
|||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
|
||||||
|
Util.e("ORHAR URL: " + host);
|
||||||
|
super.onReceivedHttpAuthRequest(view, handler, host, realm);
|
||||||
|
}
|
||||||
|
|
||||||
/******
|
/******
|
||||||
API 11 :(
|
API 11 :(
|
||||||
|
|
||||||
|
@ -256,11 +256,11 @@ public class MainActivity extends I2PActivityBase {
|
|||||||
private void updateStatus() {
|
private void updateStatus() {
|
||||||
RouterContext ctx = getRouterContext();
|
RouterContext ctx = getRouterContext();
|
||||||
TextView tv = (TextView) findViewById(R.id.main_status_text);
|
TextView tv = (TextView) findViewById(R.id.main_status_text);
|
||||||
/***
|
|
||||||
if (!Util.isConnected(this)) {
|
if (!Util.isConnected(this)) {
|
||||||
tv.setText("No Internet connection is available");
|
tv.setText("No Internet connection is available");
|
||||||
tv.setVisibility(View.VISIBLE);
|
tv.setVisibility(View.VISIBLE);
|
||||||
} else ****/ if (ctx != null) {
|
} else if (ctx != null) {
|
||||||
int active = ctx.commSystem().countActivePeers();
|
int active = ctx.commSystem().countActivePeers();
|
||||||
int known = Math.max(ctx.netDb().getKnownRouters() - 1, 0);
|
int known = Math.max(ctx.netDb().getKnownRouters() - 1, 0);
|
||||||
int inEx = ctx.tunnelManager().getFreeTunnelCount();
|
int inEx = ctx.tunnelManager().getFreeTunnelCount();
|
||||||
@ -303,7 +303,9 @@ public class MainActivity extends I2PActivityBase {
|
|||||||
tv.setText(_savedStatus);
|
tv.setText(_savedStatus);
|
||||||
tv.setVisibility(View.VISIBLE);
|
tv.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
//tv.setVisibility(View.INVISIBLE);
|
// network but no router context
|
||||||
|
tv.setVisibility(View.INVISIBLE);
|
||||||
|
/****
|
||||||
RouterService svc = _routerService;
|
RouterService svc = _routerService;
|
||||||
String status =
|
String status =
|
||||||
"connected? " + Util.isConnected(this) +
|
"connected? " + Util.isConnected(this) +
|
||||||
@ -317,6 +319,7 @@ public class MainActivity extends I2PActivityBase {
|
|||||||
"\ncan stop? " + (svc == null ? "null" : svc.canManualStop());
|
"\ncan stop? " + (svc == null ? "null" : svc.canManualStop());
|
||||||
tv.setText(status);
|
tv.setText(status);
|
||||||
tv.setVisibility(View.VISIBLE);
|
tv.setVisibility(View.VISIBLE);
|
||||||
|
****/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package net.i2p.android.router.activity;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -70,6 +71,9 @@ public class PeersActivity extends I2PActivityBase {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
wv.loadData(data, "text/html", "UTF-8");
|
wv.loadData(data, "text/html", "UTF-8");
|
||||||
|
// figure out a way to get /themes/console/images/outbound.png to load
|
||||||
|
//String url = "file://" + _myDir + "/docs/";
|
||||||
|
//wv.loadDataWithBaseURL(url, data, "text/html", "UTF-8", url);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,4 +91,17 @@ public class PeersActivity extends I2PActivityBase {
|
|||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
WebView wv = (WebView) findViewById(R.id.peers_webview);
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.menu_reload:
|
||||||
|
update();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
System.err.println("Got broadcast: " + action);
|
//Util.w("Got broadcast: " + action);
|
||||||
|
|
||||||
if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
||||||
boolean failover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);
|
boolean failover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);
|
||||||
@ -47,7 +47,7 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
NetworkInfo other = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO);
|
NetworkInfo other = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO);
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
System.err.println("No conn? " + noConn + " failover? " + failover +
|
Util.w("No conn? " + noConn + " failover? " + failover +
|
||||||
" info: " + info + " other: " + other);
|
" info: " + info + " other: " + other);
|
||||||
printInfo(info);
|
printInfo(info);
|
||||||
printInfo(other);
|
printInfo(other);
|
||||||
@ -63,10 +63,10 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
if (++_unconnectedCount >= 3) {
|
if (++_unconnectedCount >= 3) {
|
||||||
RouterService svc = _routerService;
|
RouterService svc = _routerService;
|
||||||
if (_isBound && svc != null) {
|
if (_isBound && svc != null) {
|
||||||
System.err.println("********* Network down, already bound");
|
Util.w("********* Network down, already bound");
|
||||||
svc.networkStop();
|
svc.networkStop();
|
||||||
} else {
|
} else {
|
||||||
System.err.println("********* Network down, binding to router");
|
Util.w("********* Network down, binding to router");
|
||||||
// connection will call networkStop()
|
// connection will call networkStop()
|
||||||
bindRouter();
|
bindRouter();
|
||||||
}
|
}
|
||||||
@ -81,10 +81,10 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
/****
|
/****
|
||||||
private static void printInfo(NetworkInfo ni) {
|
private static void printInfo(NetworkInfo ni) {
|
||||||
if (ni == null) {
|
if (ni == null) {
|
||||||
System.err.println("Network info is null");
|
Util.w("Network info is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.err.println(
|
Util.w(
|
||||||
"state: " + ni.getState() +
|
"state: " + ni.getState() +
|
||||||
" detail: " + ni.getDetailedState() +
|
" detail: " + ni.getDetailedState() +
|
||||||
" extrainfo: " + ni.getExtraInfo() +
|
" extrainfo: " + ni.getExtraInfo() +
|
||||||
@ -101,10 +101,10 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
private boolean bindRouter() {
|
private boolean bindRouter() {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClassName(_context, "net.i2p.android.router.service.RouterService");
|
intent.setClassName(_context, "net.i2p.android.router.service.RouterService");
|
||||||
System.err.println(this + " calling bindService");
|
Util.w(this + " calling bindService");
|
||||||
_connection = new RouterConnection();
|
_connection = new RouterConnection();
|
||||||
boolean success = _context.bindService(intent, _connection, 0);
|
boolean success = _context.bindService(intent, _connection, 0);
|
||||||
System.err.println(this + " got from bindService: " + success);
|
Util.w(this + " got from bindService: " + success);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
_isBound = true;
|
_isBound = true;
|
||||||
_unconnectedCount = 0;
|
_unconnectedCount = 0;
|
||||||
_wasConnected = false;
|
_wasConnected = false;
|
||||||
System.err.println("********* Network down, stopping router");
|
Util.w("********* Network down, stopping router");
|
||||||
_routerService.networkStop();
|
_routerService.networkStop();
|
||||||
// this doesn't work here... TODO where to unbind
|
// this doesn't work here... TODO where to unbind
|
||||||
//_context.unbindService(this);
|
//_context.unbindService(this);
|
||||||
@ -132,7 +132,7 @@ public class I2PReceiver extends BroadcastReceiver {
|
|||||||
public void onServiceDisconnected(ComponentName name) {
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
_isBound = false;
|
_isBound = false;
|
||||||
_routerService = null;
|
_routerService = null;
|
||||||
System.err.println("********* Receiver unbinding from router");
|
Util.w("********* Receiver unbinding from router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,23 +41,23 @@ class Init {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void debugStuff() {
|
void debugStuff() {
|
||||||
System.err.println("java.io.tmpdir" + ": " + System.getProperty("java.io.tmpdir"));
|
Util.i("java.io.tmpdir" + ": " + System.getProperty("java.io.tmpdir"));
|
||||||
System.err.println("java.vendor" + ": " + System.getProperty("java.vendor"));
|
Util.i("java.vendor" + ": " + System.getProperty("java.vendor"));
|
||||||
System.err.println("java.version" + ": " + System.getProperty("java.version"));
|
Util.i("java.version" + ": " + System.getProperty("java.version"));
|
||||||
System.err.println("os.arch" + ": " + System.getProperty("os.arch"));
|
Util.i("os.arch" + ": " + System.getProperty("os.arch"));
|
||||||
System.err.println("os.name" + ": " + System.getProperty("os.name"));
|
Util.i("os.name" + ": " + System.getProperty("os.name"));
|
||||||
System.err.println("os.version" + ": " + System.getProperty("os.version"));
|
Util.i("os.version" + ": " + System.getProperty("os.version"));
|
||||||
System.err.println("user.dir" + ": " + System.getProperty("user.dir"));
|
Util.i("user.dir" + ": " + System.getProperty("user.dir"));
|
||||||
System.err.println("user.home" + ": " + System.getProperty("user.home"));
|
Util.i("user.home" + ": " + System.getProperty("user.home"));
|
||||||
System.err.println("user.name" + ": " + System.getProperty("user.name"));
|
Util.i("user.name" + ": " + System.getProperty("user.name"));
|
||||||
System.err.println("getFilesDir()" + ": " + myDir);
|
Util.i("getFilesDir()" + ": " + myDir);
|
||||||
System.err.println("max mem" + ": " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()));
|
Util.i("max mem" + ": " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()));
|
||||||
System.err.println("Package" + ": " + ctx.getPackageName());
|
Util.i("Package" + ": " + ctx.getPackageName());
|
||||||
System.err.println("Version" + ": " + _ourVersion);
|
Util.i("Version" + ": " + _ourVersion);
|
||||||
System.err.println("MODEL" + ": " + Build.MODEL);
|
Util.i("MODEL" + ": " + Build.MODEL);
|
||||||
System.err.println("DISPLAY" + ": " + Build.DISPLAY);
|
Util.i("DISPLAY" + ": " + Build.DISPLAY);
|
||||||
System.err.println("VERSION" + ": " + Build.VERSION.RELEASE);
|
Util.i("VERSION" + ": " + Build.VERSION.RELEASE);
|
||||||
System.err.println("SDK" + ": " + Build.VERSION.SDK);
|
Util.i("SDK" + ": " + Build.VERSION.SDK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize() {
|
void initialize() {
|
||||||
@ -65,6 +65,12 @@ class Init {
|
|||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.setProperty("i2p.dir.temp", myDir + "/tmp");
|
props.setProperty("i2p.dir.temp", myDir + "/tmp");
|
||||||
props.setProperty("i2p.dir.pid", myDir + "/tmp");
|
props.setProperty("i2p.dir.pid", myDir + "/tmp");
|
||||||
|
// Time disabled in default router.config
|
||||||
|
// But lots of time problems on Android, not all carriers support NITZ
|
||||||
|
// and there was no NTP before 3.0. Tablets should be fine?
|
||||||
|
// Phones in airplane mode with wifi enabled still a problem.
|
||||||
|
if (Build.VERSION.SDK_INT < 11) // Honeycomb 3.0
|
||||||
|
props.setProperty("time.disabled", "false");
|
||||||
mergeResourceToFile(R.raw.router_config, "router.config", props);
|
mergeResourceToFile(R.raw.router_config, "router.config", props);
|
||||||
mergeResourceToFile(R.raw.logger_config, "logger.config", null);
|
mergeResourceToFile(R.raw.logger_config, "logger.config", null);
|
||||||
mergeResourceToFile(R.raw.i2ptunnel_config, "i2ptunnel.config", null);
|
mergeResourceToFile(R.raw.i2ptunnel_config, "i2ptunnel.config", null);
|
||||||
@ -101,6 +107,8 @@ class Init {
|
|||||||
imgDir.mkdir();
|
imgDir.mkdir();
|
||||||
copyResourceToFile(R.drawable.i2plogo, "docs/themes/console/images/i2plogo.png");
|
copyResourceToFile(R.drawable.i2plogo, "docs/themes/console/images/i2plogo.png");
|
||||||
copyResourceToFile(R.drawable.itoopie_sm, "docs/themes/console/images/itoopie_sm.png");
|
copyResourceToFile(R.drawable.itoopie_sm, "docs/themes/console/images/itoopie_sm.png");
|
||||||
|
copyResourceToFile(R.drawable.outbound, "docs/themes/console/images/outbound.png");
|
||||||
|
copyResourceToFile(R.drawable.inbound, "docs/themes/console/images/inbound.png");
|
||||||
|
|
||||||
File img2Dir = new File(cssDir, "images");
|
File img2Dir = new File(cssDir, "images");
|
||||||
img2Dir.mkdir();
|
img2Dir.mkdir();
|
||||||
@ -122,7 +130,7 @@ class Init {
|
|||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
FileOutputStream out = null;
|
FileOutputStream out = null;
|
||||||
|
|
||||||
System.err.println("Creating file " + f + " from resource");
|
Util.i("Creating file " + f + " from resource");
|
||||||
byte buf[] = new byte[4096];
|
byte buf[] = new byte[4096];
|
||||||
try {
|
try {
|
||||||
// Context methods
|
// Context methods
|
||||||
@ -165,9 +173,9 @@ class Init {
|
|||||||
try {
|
try {
|
||||||
fin = new FileInputStream(new File(myDir, f));
|
fin = new FileInputStream(new File(myDir, f));
|
||||||
DataHelper.loadProps(props, fin);
|
DataHelper.loadProps(props, fin);
|
||||||
System.err.println("Merging resource into file " + f);
|
Util.i("Merging resource into file " + f);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.err.println("Creating file " + f + " from resource");
|
Util.i("Creating file " + f + " from resource");
|
||||||
}
|
}
|
||||||
|
|
||||||
// override user settings
|
// override user settings
|
||||||
@ -177,7 +185,7 @@ class Init {
|
|||||||
props.putAll(overrides);
|
props.putAll(overrides);
|
||||||
File path = new File(myDir, f);
|
File path = new File(myDir, f);
|
||||||
DataHelper.storeProps(props, path);
|
DataHelper.storeProps(props, path);
|
||||||
System.err.println("Saved " + props.size() +" properties in " + f);
|
Util.i("Saved " + props.size() +" properties in " + f);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
} catch (Resources.NotFoundException nfe) {
|
} catch (Resources.NotFoundException nfe) {
|
||||||
} finally {
|
} finally {
|
||||||
@ -199,7 +207,7 @@ class Init {
|
|||||||
fin = ctx.openFileInput(CONFIG_FILE);
|
fin = ctx.openFileInput(CONFIG_FILE);
|
||||||
DataHelper.loadProps(props, fin);
|
DataHelper.loadProps(props, fin);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.err.println("Looks like a new install");
|
Util.i("Looks like a new install");
|
||||||
} finally {
|
} finally {
|
||||||
if (fin != null) try { fin.close(); } catch (IOException ioe) {}
|
if (fin != null) try { fin.close(); } catch (IOException ioe) {}
|
||||||
}
|
}
|
||||||
@ -209,12 +217,12 @@ class Init {
|
|||||||
boolean newVersion = !_ourVersion.equals(oldVersion);
|
boolean newVersion = !_ourVersion.equals(oldVersion);
|
||||||
|
|
||||||
if (newVersion) {
|
if (newVersion) {
|
||||||
System.err.println("New version " + _ourVersion);
|
Util.i("New version " + _ourVersion);
|
||||||
props.setProperty(PROP_INSTALLED_VERSION, _ourVersion);
|
props.setProperty(PROP_INSTALLED_VERSION, _ourVersion);
|
||||||
try {
|
try {
|
||||||
DataHelper.storeProps(props, ctx.getFileStreamPath(CONFIG_FILE));
|
DataHelper.storeProps(props, ctx.getFileStreamPath(CONFIG_FILE));
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.err.println("Failed to write " + CONFIG_FILE);
|
Util.i("Failed to write " + CONFIG_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newVersion;
|
return newVersion;
|
||||||
@ -227,7 +235,7 @@ class Init {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
File f = files[i];
|
File f = files[i];
|
||||||
System.err.println("Deleting old file/dir " + f);
|
Util.i("Deleting old file/dir " + f);
|
||||||
FileUtil.rmdir(f, false);
|
FileUtil.rmdir(f, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package net.i2p.android.router.service;
|
|||||||
|
|
||||||
import net.i2p.addressbook.DaemonThread;
|
import net.i2p.addressbook.DaemonThread;
|
||||||
import net.i2p.android.apps.NewsFetcher;
|
import net.i2p.android.apps.NewsFetcher;
|
||||||
|
import net.i2p.android.router.util.Util;
|
||||||
import net.i2p.i2ptunnel.TunnelControllerGroup;
|
import net.i2p.i2ptunnel.TunnelControllerGroup;
|
||||||
import net.i2p.router.Job;
|
import net.i2p.router.Job;
|
||||||
import net.i2p.router.JobImpl;
|
import net.i2p.router.JobImpl;
|
||||||
@ -71,17 +72,17 @@ class LoadClientsJob extends JobImpl {
|
|||||||
public String getName() { return "Start I2P Tunnel"; };
|
public String getName() { return "Start I2P Tunnel"; };
|
||||||
|
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
System.err.println("Starting i2ptunnel");
|
Util.i("Starting i2ptunnel");
|
||||||
TunnelControllerGroup tcg = TunnelControllerGroup.getInstance();
|
TunnelControllerGroup tcg = TunnelControllerGroup.getInstance();
|
||||||
int sz = tcg.getControllers().size();
|
int sz = tcg.getControllers().size();
|
||||||
System.err.println("i2ptunnel started " + sz + " clients");
|
Util.i("i2ptunnel started " + sz + " clients");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ClientShutdownHook implements Runnable {
|
private class ClientShutdownHook implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println("client shutdown hook");
|
Util.i("client shutdown hook");
|
||||||
// i2ptunnel registers its own hook
|
// i2ptunnel registers its own hook
|
||||||
if (_fetcherThread != null)
|
if (_fetcherThread != null)
|
||||||
_fetcherThread.interrupt();
|
_fetcherThread.interrupt();
|
||||||
|
@ -60,7 +60,7 @@ public class RouterService extends Service {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
State lastState = getSavedState();
|
State lastState = getSavedState();
|
||||||
setState(State.INIT);
|
setState(State.INIT);
|
||||||
System.err.println(this + " onCreate called" +
|
Util.i(this + " onCreate called" +
|
||||||
" Saved state is: " + lastState +
|
" Saved state is: " + lastState +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
|
|
||||||
@ -86,14 +86,14 @@ public class RouterService extends Service {
|
|||||||
/** NOT called by system if it restarts us after a crash */
|
/** NOT called by system if it restarts us after a crash */
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
System.err.println(this + " onStart called" +
|
Util.i(this + " onStart called" +
|
||||||
" Intent is: " + intent +
|
" Intent is: " + intent +
|
||||||
" Flags is: " + flags +
|
" Flags is: " + flags +
|
||||||
" ID is: " + startId +
|
" ID is: " + startId +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
boolean restart = intent != null && intent.getBooleanExtra(EXTRA_RESTART, false);
|
boolean restart = intent != null && intent.getBooleanExtra(EXTRA_RESTART, false);
|
||||||
if (restart)
|
if (restart)
|
||||||
System.err.println(this + " RESTARTING");
|
Util.i(this + " RESTARTING");
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (_state != State.INIT)
|
if (_state != State.INIT)
|
||||||
//return START_STICKY;
|
//return START_STICKY;
|
||||||
@ -101,14 +101,14 @@ public class RouterService extends Service {
|
|||||||
_receiver = new I2PReceiver(this);
|
_receiver = new I2PReceiver(this);
|
||||||
if (Util.isConnected(this)) {
|
if (Util.isConnected(this)) {
|
||||||
if (restart)
|
if (restart)
|
||||||
_statusBar.replace("I2P is restarting");
|
_statusBar.replace(StatusBar.ICON1, "I2P is restarting");
|
||||||
else
|
else
|
||||||
_statusBar.replace("I2P is starting up");
|
_statusBar.replace(StatusBar.ICON1, "I2P is starting up");
|
||||||
setState(State.STARTING);
|
setState(State.STARTING);
|
||||||
_starterThread = new Thread(new Starter());
|
_starterThread = new Thread(new Starter());
|
||||||
_starterThread.start();
|
_starterThread.start();
|
||||||
} else {
|
} else {
|
||||||
_statusBar.replace("I2P is waiting for a network connection");
|
_statusBar.replace(StatusBar.ICON6, "I2P is waiting for a network connection");
|
||||||
setState(State.WAITING);
|
setState(State.WAITING);
|
||||||
_handler.postDelayed(new Waiter(), 10*1000);
|
_handler.postDelayed(new Waiter(), 10*1000);
|
||||||
}
|
}
|
||||||
@ -123,14 +123,14 @@ public class RouterService extends Service {
|
|||||||
/** maybe this goes away when the receiver can bind to us */
|
/** maybe this goes away when the receiver can bind to us */
|
||||||
private class Waiter implements Runnable {
|
private class Waiter implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println(MARKER + this + " waiter handler" +
|
Util.i(MARKER + this + " waiter handler" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
if (_state == State.WAITING) {
|
if (_state == State.WAITING) {
|
||||||
if (Util.isConnected(RouterService.this)) {
|
if (Util.isConnected(RouterService.this)) {
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (_state != State.WAITING)
|
if (_state != State.WAITING)
|
||||||
return;
|
return;
|
||||||
_statusBar.replace("Network connected, I2P is starting up");
|
_statusBar.replace(StatusBar.ICON1, "Network connected, I2P is starting up");
|
||||||
setState(State.STARTING);
|
setState(State.STARTING);
|
||||||
_starterThread = new Thread(new Starter());
|
_starterThread = new Thread(new Starter());
|
||||||
_starterThread.start();
|
_starterThread.start();
|
||||||
@ -144,11 +144,11 @@ public class RouterService extends Service {
|
|||||||
|
|
||||||
private class Starter implements Runnable {
|
private class Starter implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println(MARKER + this + " starter thread" +
|
Util.i(MARKER + this + " starter thread" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
//System.err.println(MARKER + this + " JBigI speed test started");
|
//Util.i(MARKER + this + " JBigI speed test started");
|
||||||
//NativeBigInteger.main(null);
|
//NativeBigInteger.main(null);
|
||||||
//System.err.println(MARKER + this + " JBigI speed test finished, launching router");
|
//Util.i(MARKER + this + " JBigI speed test finished, launching router");
|
||||||
RouterLaunch.main(null);
|
RouterLaunch.main(null);
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (_state != State.STARTING)
|
if (_state != State.STARTING)
|
||||||
@ -157,7 +157,7 @@ public class RouterService extends Service {
|
|||||||
List contexts = RouterContext.listContexts();
|
List contexts = RouterContext.listContexts();
|
||||||
if ( (contexts == null) || (contexts.isEmpty()) )
|
if ( (contexts == null) || (contexts.isEmpty()) )
|
||||||
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
|
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
|
||||||
_statusBar.update("I2P is running");
|
_statusBar.replace(StatusBar.ICON2, "I2P is running");
|
||||||
_context = (RouterContext)contexts.get(0);
|
_context = (RouterContext)contexts.get(0);
|
||||||
_context.router().setKillVMOnEnd(false);
|
_context.router().setKillVMOnEnd(false);
|
||||||
Job loadJob = new LoadClientsJob(_context);
|
Job loadJob = new LoadClientsJob(_context);
|
||||||
@ -166,7 +166,7 @@ public class RouterService extends Service {
|
|||||||
_context.addFinalShutdownTask(new FinalShutdownHook());
|
_context.addFinalShutdownTask(new FinalShutdownHook());
|
||||||
_starterThread = null;
|
_starterThread = null;
|
||||||
}
|
}
|
||||||
System.err.println("Router.main finished");
|
Util.i("Router.main finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,9 +215,9 @@ public class RouterService extends Service {
|
|||||||
boolean haveTunnels = inCl > 0 && outCl > 0;
|
boolean haveTunnels = inCl > 0 && outCl > 0;
|
||||||
if (haveTunnels != _hadTunnels) {
|
if (haveTunnels != _hadTunnels) {
|
||||||
if (haveTunnels)
|
if (haveTunnels)
|
||||||
_statusBar.replace("Client tunnels are ready");
|
_statusBar.replace(StatusBar.ICON3, "Client tunnels are ready");
|
||||||
else
|
else
|
||||||
_statusBar.replace("Client tunnels are down");
|
_statusBar.replace(StatusBar.ICON2, "Client tunnels are down");
|
||||||
_hadTunnels = haveTunnels;
|
_hadTunnels = haveTunnels;
|
||||||
}
|
}
|
||||||
_statusBar.update(status, details);
|
_statusBar.update(status, details);
|
||||||
@ -226,7 +226,7 @@ public class RouterService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent)
|
public IBinder onBind(Intent intent)
|
||||||
{
|
{
|
||||||
System.err.println(this + "onBind called" +
|
Util.i(this + "onBind called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
return _binder;
|
return _binder;
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ public class RouterService extends Service {
|
|||||||
* Stop and don't restart the router, but keep the service
|
* Stop and don't restart the router, but keep the service
|
||||||
*/
|
*/
|
||||||
public void manualStop() {
|
public void manualStop() {
|
||||||
System.err.println("manualStop called" +
|
Util.i("manualStop called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (!canManualStop())
|
if (!canManualStop())
|
||||||
@ -272,7 +272,7 @@ public class RouterService extends Service {
|
|||||||
if (_state == State.STARTING)
|
if (_state == State.STARTING)
|
||||||
_starterThread.interrupt();
|
_starterThread.interrupt();
|
||||||
if (_state == State.STARTING || _state == State.RUNNING) {
|
if (_state == State.STARTING || _state == State.RUNNING) {
|
||||||
_statusBar.replace("Stopping I2P");
|
_statusBar.replace(StatusBar.ICON4, "Stopping I2P");
|
||||||
Thread stopperThread = new Thread(new Stopper(State.MANUAL_STOPPING, State.MANUAL_STOPPED));
|
Thread stopperThread = new Thread(new Stopper(State.MANUAL_STOPPING, State.MANUAL_STOPPED));
|
||||||
stopperThread.start();
|
stopperThread.start();
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ public class RouterService extends Service {
|
|||||||
* Stop the router and kill the service
|
* Stop the router and kill the service
|
||||||
*/
|
*/
|
||||||
public void manualQuit() {
|
public void manualQuit() {
|
||||||
System.err.println("manualQuit called" +
|
Util.i("manualQuit called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (!canManualStop())
|
if (!canManualStop())
|
||||||
@ -291,7 +291,7 @@ public class RouterService extends Service {
|
|||||||
if (_state == State.STARTING)
|
if (_state == State.STARTING)
|
||||||
_starterThread.interrupt();
|
_starterThread.interrupt();
|
||||||
if (_state == State.STARTING || _state == State.RUNNING) {
|
if (_state == State.STARTING || _state == State.RUNNING) {
|
||||||
_statusBar.replace("Stopping I2P");
|
_statusBar.replace(StatusBar.ICON4, "Stopping I2P");
|
||||||
Thread stopperThread = new Thread(new Stopper(State.MANUAL_QUITTING, State.MANUAL_QUITTED));
|
Thread stopperThread = new Thread(new Stopper(State.MANUAL_QUITTING, State.MANUAL_QUITTED));
|
||||||
stopperThread.start();
|
stopperThread.start();
|
||||||
} else if (_state == State.WAITING) {
|
} else if (_state == State.WAITING) {
|
||||||
@ -305,13 +305,13 @@ public class RouterService extends Service {
|
|||||||
* Stop and then spin waiting for a network connection, then restart
|
* Stop and then spin waiting for a network connection, then restart
|
||||||
*/
|
*/
|
||||||
public void networkStop() {
|
public void networkStop() {
|
||||||
System.err.println("networkStop called" +
|
Util.i("networkStop called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (_state == State.STARTING)
|
if (_state == State.STARTING)
|
||||||
_starterThread.interrupt();
|
_starterThread.interrupt();
|
||||||
if (_state == State.STARTING || _state == State.RUNNING) {
|
if (_state == State.STARTING || _state == State.RUNNING) {
|
||||||
_statusBar.replace("Network disconnected, stopping I2P");
|
_statusBar.replace(StatusBar.ICON4, "Network disconnected, stopping I2P");
|
||||||
// don't change state, let the shutdown hook do it
|
// don't change state, let the shutdown hook do it
|
||||||
Thread stopperThread = new Thread(new Stopper(State.NETWORK_STOPPING, State.NETWORK_STOPPING));
|
Thread stopperThread = new Thread(new Stopper(State.NETWORK_STOPPING, State.NETWORK_STOPPING));
|
||||||
stopperThread.start();
|
stopperThread.start();
|
||||||
@ -325,12 +325,12 @@ public class RouterService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void manualStart() {
|
public void manualStart() {
|
||||||
System.err.println("restart called" +
|
Util.i("restart called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (!canManualStart())
|
if (!canManualStart())
|
||||||
return;
|
return;
|
||||||
_statusBar.replace("I2P is starting up");
|
_statusBar.replace(StatusBar.ICON1, "I2P is starting up");
|
||||||
setState(State.STARTING);
|
setState(State.STARTING);
|
||||||
_starterThread = new Thread(new Starter());
|
_starterThread = new Thread(new Starter());
|
||||||
_starterThread.start();
|
_starterThread.start();
|
||||||
@ -346,7 +346,7 @@ public class RouterService extends Service {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
System.err.println("onDestroy called" +
|
Util.i("onDestroy called" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
|
|
||||||
_handler.removeCallbacks(_updater);
|
_handler.removeCallbacks(_updater);
|
||||||
@ -368,7 +368,7 @@ public class RouterService extends Service {
|
|||||||
_starterThread.interrupt();
|
_starterThread.interrupt();
|
||||||
if (_state == State.STARTING || _state == State.RUNNING) {
|
if (_state == State.STARTING || _state == State.RUNNING) {
|
||||||
// should this be in a thread?
|
// should this be in a thread?
|
||||||
_statusBar.replace("I2P is shutting down");
|
_statusBar.replace(StatusBar.ICON5, "I2P is shutting down");
|
||||||
Thread stopperThread = new Thread(new Stopper(State.STOPPING, State.STOPPED));
|
Thread stopperThread = new Thread(new Stopper(State.STOPPING, State.STOPPED));
|
||||||
stopperThread.start();
|
stopperThread.start();
|
||||||
}
|
}
|
||||||
@ -393,13 +393,13 @@ public class RouterService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println(MARKER + this + " stopper thread" +
|
Util.i(MARKER + this + " stopper thread" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
RouterContext ctx = _context;
|
RouterContext ctx = _context;
|
||||||
if (ctx != null)
|
if (ctx != null)
|
||||||
ctx.router().shutdown(Router.EXIT_HARD);
|
ctx.router().shutdown(Router.EXIT_HARD);
|
||||||
_statusBar.off();
|
_statusBar.off();
|
||||||
System.err.println("********** Router shutdown complete");
|
Util.i("********** Router shutdown complete");
|
||||||
synchronized (_stateLock) {
|
synchronized (_stateLock) {
|
||||||
if (_state == nextState)
|
if (_state == nextState)
|
||||||
setState(stopState);
|
setState(stopState);
|
||||||
@ -414,9 +414,9 @@ public class RouterService extends Service {
|
|||||||
*/
|
*/
|
||||||
private class ShutdownHook implements Runnable {
|
private class ShutdownHook implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println(this + " shutdown hook" +
|
Util.i(this + " shutdown hook" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
_statusBar.replace("I2P is shutting down");
|
_statusBar.replace(StatusBar.ICON5, "I2P is shutting down");
|
||||||
I2PReceiver rcvr = _receiver;
|
I2PReceiver rcvr = _receiver;
|
||||||
if (rcvr != null) {
|
if (rcvr != null) {
|
||||||
synchronized(rcvr) {
|
synchronized(rcvr) {
|
||||||
@ -450,7 +450,7 @@ public class RouterService extends Service {
|
|||||||
*/
|
*/
|
||||||
private class FinalShutdownHook implements Runnable {
|
private class FinalShutdownHook implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.err.println(this + " final shutdown hook" +
|
Util.i(this + " final shutdown hook" +
|
||||||
" Current state is: " + _state);
|
" Current state is: " + _state);
|
||||||
_statusBar.off();
|
_statusBar.off();
|
||||||
//I2PReceiver rcvr = _receiver;
|
//I2PReceiver rcvr = _receiver;
|
||||||
@ -469,7 +469,7 @@ public class RouterService extends Service {
|
|||||||
_handler.postDelayed(new Waiter(), 10*1000);
|
_handler.postDelayed(new Waiter(), 10*1000);
|
||||||
} else if (_state == State.STARTING || _state == State.RUNNING ||
|
} else if (_state == State.STARTING || _state == State.RUNNING ||
|
||||||
_state == State.STOPPING) {
|
_state == State.STOPPING) {
|
||||||
System.err.println(this + " died of unknown causes");
|
Util.i(this + " died of unknown causes");
|
||||||
setState(State.STOPPED);
|
setState(State.STOPPED);
|
||||||
stopSelf();
|
stopSelf();
|
||||||
} else if (_state == State.MANUAL_QUITTING) {
|
} else if (_state == State.MANUAL_QUITTING) {
|
||||||
|
@ -11,7 +11,7 @@ import java.lang.Thread.UncaughtExceptionHandler;
|
|||||||
import net.i2p.android.router.R;
|
import net.i2p.android.router.R;
|
||||||
import net.i2p.android.router.activity.MainActivity;
|
import net.i2p.android.router.activity.MainActivity;
|
||||||
|
|
||||||
public class StatusBar {
|
class StatusBar {
|
||||||
|
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
private final Intent intent;
|
private final Intent intent;
|
||||||
@ -20,13 +20,20 @@ public class StatusBar {
|
|||||||
|
|
||||||
private static final int ID = 1;
|
private static final int ID = 1;
|
||||||
|
|
||||||
|
public static final int ICON1 = R.drawable.ic_launcher_itoopie_300;
|
||||||
|
public static final int ICON2 = R.drawable.ic_launcher_itoopie_330;
|
||||||
|
public static final int ICON3 = R.drawable.ic_launcher_itoopie;
|
||||||
|
public static final int ICON4 = R.drawable.ic_launcher_itoopie_120;
|
||||||
|
public static final int ICON5 = R.drawable.ic_launcher_itoopie_150;
|
||||||
|
public static final int ICON6 = R.drawable.ic_launcher_itoopie_180;
|
||||||
|
|
||||||
StatusBar(Context cx) {
|
StatusBar(Context cx) {
|
||||||
ctx = cx;
|
ctx = cx;
|
||||||
String ns = Context.NOTIFICATION_SERVICE;
|
String ns = Context.NOTIFICATION_SERVICE;
|
||||||
mgr = (NotificationManager)ctx.getSystemService(ns);
|
mgr = (NotificationManager)ctx.getSystemService(ns);
|
||||||
Thread.currentThread().setUncaughtExceptionHandler(new CrashHandler(mgr));
|
Thread.currentThread().setUncaughtExceptionHandler(new CrashHandler(mgr));
|
||||||
|
|
||||||
int icon = R.drawable.ic_launcher_itoopie;
|
int icon = ICON1;
|
||||||
// won't be shown if replace() is called
|
// won't be shown if replace() is called
|
||||||
String text = "Starting I2P";
|
String text = "Starting I2P";
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
@ -37,9 +44,10 @@ public class StatusBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** remove and re-add */
|
/** remove and re-add */
|
||||||
public void replace(String tickerText) {
|
public void replace(int icon, String tickerText) {
|
||||||
off();
|
off();
|
||||||
notif.tickerText = tickerText;
|
notif.icon = icon;
|
||||||
|
notif.tickerText= tickerText;
|
||||||
update(tickerText);
|
update(tickerText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user