mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
netDB and certificates in internal storage
This commit is contained in:
parent
d41fabbc9f
commit
81d7a832c0
6
android/.gitignore
vendored
6
android/.gitignore
vendored
@ -5,4 +5,8 @@ ant.properties
|
||||
local.properties
|
||||
build.sh
|
||||
bin
|
||||
log*
|
||||
log*
|
||||
.gradle*
|
||||
build
|
||||
assets
|
||||
gradle-app.setting
|
||||
|
@ -8,26 +8,32 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete,overwrite: true) {
|
||||
delete 'build'
|
||||
delete 'assets'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.2"
|
||||
defaultConfig {
|
||||
applicationId "org.purplei2p.i2pd"
|
||||
targetSdkVersion 25
|
||||
minSdkVersion 14
|
||||
versionCode 1
|
||||
versionName "2.17.1"
|
||||
}
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.0"
|
||||
defaultConfig {
|
||||
applicationId "org.purplei2p.i2pd"
|
||||
targetSdkVersion 25
|
||||
minSdkVersion 14
|
||||
versionCode 1
|
||||
versionName "2.17.2b"
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
res.srcDirs = ['res']
|
||||
jniLibs.srcDirs = ['libs']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
orignal {
|
||||
storeFile file("i2pdapk.jks")
|
||||
@ -37,11 +43,18 @@ android {
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.orignal
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.orignal
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task zipCerts(type: Zip) {
|
||||
archiveName 'certificates.zip'
|
||||
destinationDir file('assets')
|
||||
from (files('../contrib/certificates'))
|
||||
}
|
||||
|
||||
preBuild.dependsOn zipCerts
|
||||
|
@ -126,12 +126,11 @@ namespace android
|
||||
}
|
||||
*/
|
||||
static DaemonAndroidImpl daemon;
|
||||
static char* argv[1]={strdup("tmp")};
|
||||
/**
|
||||
* returns error details if failed
|
||||
* returns "ok" if daemon initialized and started okay
|
||||
*/
|
||||
std::string start(/*int argc, char* argv[]*/)
|
||||
std::string start(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -139,7 +138,7 @@ namespace android
|
||||
|
||||
{
|
||||
//Log.d(TAG"Initialising the daemon...");
|
||||
bool daemonInitSuccess = daemon.init(1,argv);
|
||||
bool daemonInitSuccess = daemon.init(argc,argv);
|
||||
if(!daemonInitSuccess)
|
||||
{
|
||||
//QMessageBox::critical(0, "Error", "Daemon init failed");
|
||||
|
@ -37,7 +37,7 @@ namespace android
|
||||
* returns "ok" if daemon init failed
|
||||
* returns errinfo if daemon initialized and started okay
|
||||
*/
|
||||
std::string start();
|
||||
std::string start(int argc, char* argv[]);
|
||||
|
||||
// stops the daemon
|
||||
void stop();
|
||||
|
@ -45,7 +45,16 @@ JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_startDaemon
|
||||
(JNIEnv * env, jclass clazz) {
|
||||
return env->NewStringUTF(i2p::android::start().c_str());
|
||||
|
||||
int argc=5;
|
||||
static char* argv[]={
|
||||
"i2pd", "--service", "--daemon",
|
||||
"--conf=/sdcard/i2pd/i2pd.conf",
|
||||
"--tunconf=/sdcard/i2pd/tunnels.conf",
|
||||
"--datadir=/data/data/org.purplei2p.i2pd/app_data/"
|
||||
};
|
||||
|
||||
return env->NewStringUTF(i2p::android::start(argc,argv).c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopDaemon
|
||||
|
@ -2,6 +2,13 @@ package org.purplei2p.i2pd;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@ -26,7 +33,7 @@ public class I2PD extends Activity {
|
||||
private TextView textView;
|
||||
|
||||
private final DaemonSingleton daemon = DaemonSingleton.getInstance();
|
||||
|
||||
|
||||
private DaemonSingleton.StateUpdateListener daemonStateUpdatedListener =
|
||||
new DaemonSingleton.StateUpdateListener() {
|
||||
|
||||
@ -58,6 +65,9 @@ public class I2PD extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//install certs every time
|
||||
Decompress.unzipFromAssets(this, "certificates.zip", "/data/data/org.purplei2p.i2pd/app_data/");
|
||||
|
||||
textView = new TextView(this);
|
||||
setContentView(textView);
|
||||
DaemonSingleton.getInstance().addStateChangeListener(daemonStateUpdatedListener);
|
||||
|
Loading…
Reference in New Issue
Block a user