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

Skip to content
Snippets Groups Projects
Commit 35495e4d authored by zzz's avatar zzz
Browse files

Android:

  - Add a version update script
  - Disable NTP
  - Disable external I2CP
parent 59741608
No related branches found
No related tags found
No related merge requests found
...@@ -129,6 +129,14 @@ ...@@ -129,6 +129,14 @@
<copy file="jni/libjbigi.so" todir="${native.libs.dir}/armeabi" /> <copy file="jni/libjbigi.so" todir="${native.libs.dir}/armeabi" />
</target> </target>
<target name="incrementBuild">
<buildnumber file="scripts/build.number" />
<exec executable="sh" osfamily="unix" failonerror="true">
<arg value="-c" />
<arg value="scripts/setversion.sh" />
</exec>
</target>
<!-- install now does both --> <!-- install now does both -->
<target name="reinstall" depends="install" /> <target name="reinstall" depends="install" />
...@@ -138,6 +146,7 @@ ...@@ -138,6 +146,7 @@
<delete file="res/raw/blocklist_txt" verbose="${verbose}" /> <delete file="res/raw/blocklist_txt" verbose="${verbose}" />
<delete dir="jni/build/" verbose="${verbose}" /> <delete dir="jni/build/" verbose="${verbose}" />
<delete file="jni/libjbigi.so" verbose="${verbose}" /> <delete file="jni/libjbigi.so" verbose="${verbose}" />
<delete file="scripts/build.number" verbose="${verbose}" />
</target> </target>
<!-- <!--
...@@ -443,7 +452,7 @@ ...@@ -443,7 +452,7 @@
<!-- empty default pre-build target. Create a similar target in <!-- empty default pre-build target. Create a similar target in
your build.xml and it'll be called instead of this one. --> your build.xml and it'll be called instead of this one. -->
<!-- I2P add depends --> <!-- I2P add depends -->
<target name="-pre-build" depends="copy-i2p-resources" /> <target name="-pre-build" depends="copy-i2p-resources, incrementBuild" />
<!-- Generates the R.java file for this project's resources. --> <!-- Generates the R.java file for this project's resources. -->
<target name="-resource-src" depends="-dirs"> <target name="-resource-src" depends="-dirs">
......
...@@ -7,9 +7,14 @@ prng.buffers=2 ...@@ -7,9 +7,14 @@ prng.buffers=2
router.decayingBloomFilterM=20 router.decayingBloomFilterM=20
stat.full=false stat.full=false
# #
# Don't run NTP client, the phone should have a valid time
#
time.disabled=true
#
# no I2CP # no I2CP
# #
i2p.dummyClientFacade=true i2p.dummyClientFacade=true
i2cp.disableInterface=true
# #
##### Transport ##### Transport
# #
......
#
# Get the version number and fix up AndroidManifest.xml
# Public domain
#
THISDIR=$(realpath $(dirname $(which $0)))
cd $THISDIR
MANIFEST=../AndroidManifest.xml
TMP=AndroidManifest.xml.tmp
CORE=`grep 'public final static String VERSION' ../../core/java/src/net/i2p/CoreVersion.java | \
cut -d '"' -f 2`
MAJOR=`echo $CORE | cut -d '.' -f 1`
MINOR=`echo $CORE | cut -d '.' -f 2`
RELEASE=`echo $CORE | cut -d '.' -f 3`
ROUTERBUILD=$((`grep 'public final static long BUILD' ../../router/java/src/net/i2p/router/RouterVersion.java | \
cut -d '=' -f 2 | \
cut -d ';' -f 1`))
ANDROIDBUILD=`grep 'build.number' build.number | \
cut -d '=' -f 2`
SDK=`grep 'android:minSdkVersion' $MANIFEST | \
cut -d '"' -f 2`
# don't let build number get too long
VERSIONSTRING="${CORE}-${ROUTERBUILD}_b$(($ANDROIDBUILD % 256))-SDK$SDK"
#
# Android version code is an integer.
# So we have 31 bits.
# MAJOR 4 bits 0-15
# MINOR 8 bits 0-255
# RELEASE 8 bits 0-255
# ROUTERBUILD 8 bits 0-255
# ANDROIDBUILD 3 bits 0-7
#
# Note that ANDROIDBUILD is modded % 8, it will wrap,
# beware of that if you release multiple builds using the
# same ROUTERBUILD, or clear it if you update ROUTERBUILD
#
VERSIONINT=$(( \
(($MAJOR % 16) << 27) + \
(($MINOR % 256) << 19) + \
(($RELEASE % 256) << 11) + \
(($ROUTERBUILD % 256) << 3) + \
($ANDROIDBUILD % 8) \
))
echo "Android version: '$VERSIONSTRING' (${VERSIONINT})"
SUBST='s/android.versionCode="[0-9]"/android.versionCode="'${VERSIONINT}'"/'
sed "$SUBST" < $MANIFEST > $TMP
SUBST='s/android.versionName="[^"]*"/android.versionName="'${VERSIONSTRING}'"/'
sed "$SUBST" < $TMP > $MANIFEST
rm -f $TMP
...@@ -2,6 +2,8 @@ package net.i2p.router; ...@@ -2,6 +2,8 @@ package net.i2p.router;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.Resources.NotFoundException; import android.content.res.Resources.NotFoundException;
import android.os.Bundle; import android.os.Bundle;
...@@ -103,6 +105,20 @@ public class I2PAndroid extends Activity ...@@ -103,6 +105,20 @@ public class I2PAndroid extends Activity
System.err.println("user.home" + ": " + System.getProperty("user.home")); System.err.println("user.home" + ": " + System.getProperty("user.home"));
System.err.println("user.name" + ": " + System.getProperty("user.name")); System.err.println("user.name" + ": " + System.getProperty("user.name"));
System.err.println("getFilesDir()" + ": " + DIR); System.err.println("getFilesDir()" + ": " + DIR);
System.err.println("Package" + ": " + getPackageName());
System.err.println("Version" + ": " + getOurVersion());
}
private String getOurVersion() {
PackageManager pm = getPackageManager();
String us = getPackageName();
try {
PackageInfo pi = pm.getPackageInfo(us, 0);
System.err.println("VersionCode" + ": " + pi.versionCode);
if (pi.versionName != null)
return pi.versionName;
} catch (Exception e) {}
return "??";
} }
private void initialize() { private void initialize() {
......
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