* NBigI: Recognize Android

This commit is contained in:
zzz
2011-06-04 12:03:35 +00:00
parent 173343e049
commit 885d549e84
3 changed files with 17 additions and 5 deletions

View File

@ -49,4 +49,5 @@ ant reinstall
# Now click on the I2P icon on your phone!
#other helpful commands
../../android-sdk-linux_86/tools/adb shell
../../android-sdk-linux_86/platform-tools/adb shell
../../android-sdk-linux_86/platform-tools/adb pull /some/file/on/emulator some-local-dir/

View File

@ -127,10 +127,6 @@
<arg value="jni/build.sh" />
</exec>
<copy file="jni/libjbigi.so" todir="${native.libs.dir}/armeabi" />
<exec executable="chmod" osfamily="unix" failonerror="true">
<arg value="+x" />
<arg value="${native.libs.dir}/armeabi/libjbigi.so" />
</exec>
</target>
<!-- install now does both -->

View File

@ -16,6 +16,7 @@ import java.math.BigInteger;
import java.net.URL;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@ -138,6 +139,7 @@ public class NativeBigInteger extends BigInteger {
private static final boolean _isLinux = System.getProperty("os.name").toLowerCase().contains("linux");
private static final boolean _isFreebsd = System.getProperty("os.name").toLowerCase().contains("freebsd");
private static final boolean _isSunos = System.getProperty("os.name").toLowerCase().contains("sunos");
private static final boolean _isAndroid = System.getProperty("java.vendor").contains("Android");
/*
* This isn't always correct.
@ -498,6 +500,17 @@ public class NativeBigInteger extends BigInteger {
System.loadLibrary(name);
return true;
} catch (UnsatisfiedLinkError ule) {
if (_isAndroid) {
// temp debug
warn("jbigi loadLibrary() fail", ule);
try {
System.load("/data/data/net.i2p.router/lib/libjbigi.so");
return true;
} catch (Throwable t) {
warn("jbigi load() fail", t);
}
warn("Is the file there? " + (new File("/data/data/net.i2p.router/lib/libjbigi.so")).exists());
}
return false;
}
}
@ -581,6 +594,8 @@ public class NativeBigInteger extends BigInteger {
* @since 0.8.7
*/
private static List<String> getResourceList() {
if (_isAndroid)
return Collections.EMPTY_LIST;
List<String> rv = new ArrayList(8);
String primary = getMiddleName2(true);
if (primary != null) {