mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-09 16:41:04 +00:00
code cleanup
This commit is contained in:
parent
0bd4db4cc7
commit
4c6988e3bc
@ -46,6 +46,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
options.deprecation = true
|
||||
}
|
||||
|
||||
task zipCerts(type:Zip) {
|
||||
from (files('../contrib/'))
|
||||
include 'certificates/**/*.crt'
|
||||
|
@ -1 +1 @@
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx2048M -XX:MaxPermSize=256M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
@ -38,7 +38,7 @@ public class DaemonSingleton {
|
||||
|
||||
public State getState() { return state; }
|
||||
|
||||
public synchronized void start() {
|
||||
public synchronized void start(final String confDir, final String dataDir) {
|
||||
if(state != State.uninitialized)return;
|
||||
state = State.starting;
|
||||
fireStateUpdate();
|
||||
@ -62,14 +62,13 @@ public class DaemonSingleton {
|
||||
}
|
||||
try {
|
||||
synchronized (DaemonSingleton.this) {
|
||||
String args[] = {
|
||||
"i2pd",
|
||||
"--conf=/sdcard/i2pd/i2pd.conf",
|
||||
"--tunconf=/sdcard/i2pd/tunnels.conf",
|
||||
"--datadir=/data/data/org.purplei2p.i2pd/app_data/",
|
||||
"--service",
|
||||
"--daemon"
|
||||
};
|
||||
|
||||
String args[] = new String[] {
|
||||
"i2pd", "--service", "--daemon",
|
||||
"--datadir=" + dataDir,
|
||||
"--conf=" + confDir + "/i2pd.conf",
|
||||
"--tunconf=" + confDir + "/tunnels.conf"
|
||||
};
|
||||
|
||||
daemonStartResult = I2PD_JNI.startDaemon(args);
|
||||
if("ok".equals(daemonStartResult)){
|
||||
|
@ -5,6 +5,8 @@ import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
@ -28,13 +30,20 @@ public class ForegroundService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private String dataDir;
|
||||
private String confDir;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
|
||||
dataDir = this.getDir("data", Context.MODE_PRIVATE).toString();
|
||||
confDir = Environment.getExternalStoragePublicDirectory("i2pd").toString();
|
||||
|
||||
// Display a notification about us starting. We put an icon in the status bar.
|
||||
showNotification();
|
||||
daemon.start();
|
||||
|
||||
Log.i("ForegroundService", "About to start daemon with dataDir: " + dataDir + ", confDir: " + confDir);
|
||||
daemon.start(confDir, dataDir);
|
||||
// Tell the user we started.
|
||||
Toast.makeText(this, R.string.i2pd_service_started, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -42,7 +51,7 @@ public class ForegroundService extends Service {
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.i("ForegroundService", "Received start id " + startId + ": " + intent);
|
||||
daemon.start();
|
||||
daemon.start(confDir, dataDir);
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class I2PD extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//install certs every time
|
||||
Decompress.unzipFromAssets(this, "certificates.zip", "/data/data/org.purplei2p.i2pd/app_data/");
|
||||
Decompress.unzipFromAssets(this, "certificates.zip", this.getDir("data", Context.MODE_PRIVATE).toString() + "/" );
|
||||
|
||||
textView = new TextView(this);
|
||||
setContentView(textView);
|
||||
|
Loading…
x
Reference in New Issue
Block a user