android build fixes
This commit is contained in:
@ -28,7 +28,7 @@ ant debug
|
||||
../../android-sdk-linux_86/tools/emulator -avd i2p &
|
||||
|
||||
#then wait a couple minutes until the emulator is up
|
||||
#then install the I2P app
|
||||
#then install the I2P app (ONE TIME ONLY)
|
||||
ant install
|
||||
|
||||
#then run the debugger
|
||||
|
1
android/build.properties
Normal file
1
android/build.properties
Normal file
@ -0,0 +1 @@
|
||||
application-package=net.i2p.router
|
@ -76,6 +76,9 @@
|
||||
<mkdir dir="tmp" />
|
||||
<unjar src="../build/i2p.jar" dest="tmp/" />
|
||||
<delete file="tmp/net/i2p/util/LogWriter.class" />
|
||||
<delete file="tmp/net/i2p/util/SecureDirectory.class" />
|
||||
<delete file="tmp/net/i2p/util/SecureFile.class" />
|
||||
<delete file="tmp/net/i2p/util/SecureFileOutputStream.class" />
|
||||
<!-- org.bouncycastle.crypto already in android
|
||||
but we need a little trickery because our HMac is incompatible...
|
||||
and the libs aren't in the SDK to compile against??? -->
|
||||
@ -237,6 +240,7 @@
|
||||
<target name="compile" depends="buildrouter, resource-src, aidl">
|
||||
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
|
||||
destdir="${out-classes}"
|
||||
includeantruntime="false"
|
||||
bootclasspathref="android.target.classpath">
|
||||
<src path="${source-folder}" />
|
||||
<src path="${gen-folder}" />
|
||||
@ -280,6 +284,12 @@
|
||||
|
||||
<!-- Package the application and sign it with a debug key.
|
||||
This is the default target when building. It is used for debug. -->
|
||||
<!--
|
||||
I2P when this fails 365 days later because the key expired, delete ~/.android/debug.keystore
|
||||
Then do 'ant uninstall' (since the new key doesn't match the old key)
|
||||
Then do 'ant install'
|
||||
See http://developer.android.com/guide/publishing/app-signing.html for more info
|
||||
-->
|
||||
<target name="debug" depends="dex, package-resources">
|
||||
<apkbuilder
|
||||
outfolder="${out-folder}"
|
||||
@ -327,12 +337,12 @@
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Uinstall the package from the default emulator -->
|
||||
<!-- Uninstall the package from the default emulator -->
|
||||
<target name="uninstall">
|
||||
<echo>Uninstalling ${application-package} from the default emulator...</echo>
|
||||
<exec executable="${adb}" failonerror="true">
|
||||
<arg value="uninstall" />
|
||||
<arg path="${application-package}" />
|
||||
<arg value="${application-package}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class I2PAndroid extends Activity
|
||||
{
|
||||
System.err.println("onStart called");
|
||||
super.onStart();
|
||||
// net.i2p.crypto.DSAEngine.main(null);
|
||||
RouterLaunch.main(null);
|
||||
System.err.println("Router.main finished");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* bridge to android logging
|
||||
@ -56,11 +57,21 @@ class LogWriter implements Runnable {
|
||||
public void flushRecords() { flushRecords(true); }
|
||||
public void flushRecords(boolean shouldWait) {
|
||||
try {
|
||||
List records = _manager._removeAll();
|
||||
// zero copy, drain the manager queue directly
|
||||
Queue<LogRecord> records = _manager.getQueue();
|
||||
if (records == null) return;
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
LogRecord rec = (LogRecord) records.get(i);
|
||||
writeRecord(rec);
|
||||
if (!records.isEmpty()) {
|
||||
LogRecord rec;
|
||||
while ((rec = records.poll()) != null) {
|
||||
writeRecord(rec);
|
||||
}
|
||||
try {
|
||||
if (_currentOut != null)
|
||||
_currentOut.flush();
|
||||
} catch (IOException ioe) {
|
||||
//if (++_diskFullMessageCount < MAX_DISKFULL_MESSAGES)
|
||||
System.err.println("Error writing the router log - disk full? " + ioe);
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
22
android/src/net/i2p/util/SecureDirectory.java
Normal file
22
android/src/net/i2p/util/SecureDirectory.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.i2p.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* setXXX() not available until API level 9 (Platform Version 2.3)
|
||||
* @since 0.8.7
|
||||
*/
|
||||
public class SecureDirectory extends File {
|
||||
|
||||
public SecureDirectory(String pathname) {
|
||||
super(pathname);
|
||||
}
|
||||
|
||||
public SecureDirectory(String parent, String child) {
|
||||
super(parent, child);
|
||||
}
|
||||
|
||||
public SecureDirectory(File parent, String child) {
|
||||
super(parent, child);
|
||||
}
|
||||
}
|
22
android/src/net/i2p/util/SecureFile.java
Normal file
22
android/src/net/i2p/util/SecureFile.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.i2p.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* setXXX() not available until API level 9 (Platform Version 2.3)
|
||||
* @since 0.8.7
|
||||
*/
|
||||
public class SecureFile extends SecureDirectory {
|
||||
|
||||
public SecureFile(String pathname) {
|
||||
super(pathname);
|
||||
}
|
||||
|
||||
public SecureFile(String parent, String child) {
|
||||
super(parent, child);
|
||||
}
|
||||
|
||||
public SecureFile(File parent, String child) {
|
||||
super(parent, child);
|
||||
}
|
||||
}
|
53
android/src/net/i2p/util/SecureFileOutputStream.java
Normal file
53
android/src/net/i2p/util/SecureFileOutputStream.java
Normal file
@ -0,0 +1,53 @@
|
||||
package net.i2p.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
|
||||
/**
|
||||
* setXXX() not available until API level 9 (Platform Version 2.3)
|
||||
* @since 0.8.7
|
||||
*/
|
||||
public class SecureFileOutputStream extends FileOutputStream {
|
||||
|
||||
/**
|
||||
* super()
|
||||
*/
|
||||
public SecureFileOutputStream(String file) throws FileNotFoundException {
|
||||
super(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* super()
|
||||
*/
|
||||
public SecureFileOutputStream(String file, boolean append) throws FileNotFoundException {
|
||||
super(file, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* super()
|
||||
*/
|
||||
public SecureFileOutputStream(File file) throws FileNotFoundException {
|
||||
super(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* super()
|
||||
*/
|
||||
public SecureFileOutputStream(File file, boolean append) throws FileNotFoundException {
|
||||
super(file, append);
|
||||
}
|
||||
|
||||
/** @return false */
|
||||
static boolean canSetPerms() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* noop
|
||||
*/
|
||||
public static void setPerms(File f) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user