I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 6d938a12 authored by zzz's avatar zzz
Browse files

android build fixes

parent 8a56531c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
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();
......
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);
}
}
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);
}
}
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) {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment