Skip to content

Commit

Permalink
update pltd and cjdroute, make wallet debug selectable,
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoukoul committed May 22, 2021
1 parent 2e6d36a commit 0b1765b
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 57 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .idea/.gitignore
100644 → 100755
Empty file.
Empty file modified .idea/.name
100644 → 100755
Empty file.
21 changes: 5 additions & 16 deletions .idea/codeStyles/Project.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/gradle.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified .idea/render.experimental.xml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .idea/runConfigurations.xml
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions app/src/main/java/co/anode/anodium/AnodeClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ object AnodeClient {
ignoreErr{ jsonObject.accumulate("localTimestamp", DateTimeFormatter.ISO_INSTANT.format(Instant.now())) }
ignoreErr{ jsonObject.accumulate("ip4Address", CjdnsSocket.ipv4Address) }
ignoreErr{ jsonObject.accumulate("ip6Address", CjdnsSocket.ipv6Route) }
ignoreErr{ jsonObject.accumulate("cpuUtilizationPercent", anodeUtil.readCPUUsage().toString()) }
ignoreErr{ jsonObject.accumulate("cpuUtilizationPercent", "0") }
ignoreErr{ jsonObject.accumulate("availableMemoryBytes", anodeUtil.readMemUsage()) }
val prefs = mycontext.getSharedPreferences("co.anode.anodium", Context.MODE_PRIVATE)
val username = prefs!!.getString("username","")
Expand Down Expand Up @@ -281,7 +281,7 @@ object AnodeClient {
jsonObject.accumulate("localTimestamp", DateTimeFormatter.ISO_INSTANT.format(Instant.now()))
ignoreErr { jsonObject.accumulate("ip4Address", CjdnsSocket.ipv4Address) }
ignoreErr { jsonObject.accumulate("ip6Address", CjdnsSocket.ipv6Route) }
ignoreErr { jsonObject.accumulate("cpuUtilizationPercent", anodeUtil.readCPUUsage().toString()) }
ignoreErr { jsonObject.accumulate("cpuUtilizationPercent", "0") }
ignoreErr { jsonObject.accumulate("availableMemoryBytes", anodeUtil.readMemUsage()) }
val prefs = mycontext.getSharedPreferences("co.anode.anodium", Context.MODE_PRIVATE)
val username = prefs!!.getString("username","")
Expand Down
43 changes: 13 additions & 30 deletions app/src/main/java/co/anode/anodium/AnodeUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class AnodeUtil(c: Context?) {
val CJDROUTE_LOG = "cjdroute.log"
val PLTD_LOG = "pltd.log"
val PLTD_BINFILE = "pltd"
lateinit var pltd_pb: Process
lateinit var cjdns_pb: Process
private val CJDROUTE_TEMPCONFFILE = "tempcjdroute.conf"

init {
Expand Down Expand Up @@ -47,6 +49,12 @@ class AnodeUtil(c: Context?) {
newPath = "$filesdir/pltd"
Os.symlink(oldPath,newPath)


//Create lnd directory
val lnddir = File("$CJDNS_PATH/lnd")
if (!lnddir.exists()) {
lnddir.mkdir()
}
//Copy tls files
var `in`: InputStream
var out: OutputStream?
Expand Down Expand Up @@ -84,8 +92,8 @@ class AnodeUtil(c: Context?) {
val confFile = File("$CJDNS_PATH/$CJDROUTE_CONFFILE")
if (!confFile.exists()) {
initializeCjdrouteConfFile()
launchCJDNS()
}
launchCJDNS()
launchpltd()
}

Expand Down Expand Up @@ -130,9 +138,9 @@ class AnodeUtil(c: Context?) {
.redirectOutput(File(CJDNS_PATH, CJDROUTE_LOG))
.redirectErrorStream(true)
pb.environment()["TMPDIR"] = CJDNS_PATH
val p = processBuilder.start()
p.waitFor()
Log.e(LOGTAG, "cjdns exited with " + p.exitValue())
cjdns_pb = processBuilder.start()
cjdns_pb.waitFor()
Log.e(LOGTAG, "cjdns exited with " + cjdns_pb.exitValue())
} catch (e: Exception) {
throw AnodeUtilException("Failed to execute cjdroute " + e.message)
}
Expand All @@ -148,9 +156,7 @@ class AnodeUtil(c: Context?) {
.redirectOutput(File(CJDNS_PATH, PLTD_LOG))
.redirectErrorStream(true)
pb.environment()["TMPDIR"] = CJDNS_PATH
val p = processBuilder.start()
//p.waitFor()
//Log.e(LOGTAG, "pltd exited with " + p.exitValue())
pltd_pb = processBuilder.start()
} catch (e: Exception) {
throw AnodeUtilException("Failed to execute pltd " + e.message)
}
Expand Down Expand Up @@ -211,29 +217,6 @@ class AnodeUtil(c: Context?) {
}
}

fun readCPUUsage(): Float {
/*try {
val reader = RandomAccessFile("/proc/stat", "r")
var load = reader.readLine()
var toks = load.split(" +").toTypedArray() // Split on one or more spaces
val idle1 = toks[4].toLong()
val cpu1 = toks[2].toLong() + toks[3].toLong() + toks[5].toLong() + toks[6].toLong() + toks[7].toLong() + toks[8].toLong()
try {
Thread.sleep(360)
} catch (e: java.lang.Exception) {}
reader.seek(0)
load = reader.readLine()
reader.close()
toks = load.split(" +").toTypedArray()
val idle2 = toks[4].toLong()
val cpu2 = toks[2].toLong() + toks[3].toLong() + toks[5].toLong() + toks[6].toLong() + toks[7].toLong() + toks[8].toLong()
return (cpu2 - cpu1).toFloat() / (cpu2 + idle2 - (cpu1 + idle1))
} catch (ex: IOException) {
ex.printStackTrace()
}*/
return 0f
}

fun readMemUsage(): String {
val runtime = Runtime.getRuntime();
val usedMemInMB=(runtime.totalMemory() - runtime.freeMemory()) / 1048576L;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/co/anode/anodium/LndRPCController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ object LndRPCController {
Log.e(LOGTAG, e.toString())
return e.toString()
}
return "fdsgfd"//"OK"
return "OK"
}

fun getPubKey() {
Expand Down
Binary file added app/src/main/jniLibs/arm64-v8a/libcjdroute.so
Binary file not shown.
Binary file added app/src/main/jniLibs/arm64-v8a/libpltd.so
Binary file not shown.
Binary file added app/src/main/jniLibs/x86/libcjdroute.so
Binary file not shown.
Binary file added app/src/main/jniLibs/x86/libpltd.so
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_debug_wallet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textIsSelectable="true"
android:layout_marginEnd="20dp"/>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
7 changes: 4 additions & 3 deletions build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.31'

repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.13'
}
}

allprojects {
repositories {
google()
jcenter()

maven { url "https://jitpack.io" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

android.bundle.enableUncompressedNativeLibs=false
Empty file modified gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Empty file modified gradlew.bat
100644 → 100755
Empty file.
Empty file modified logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified settings.gradle
100644 → 100755
Empty file.
Empty file modified tools/android_key
100644 → 100755
Empty file.
Empty file modified tools/release_notify.sh
100644 → 100755
Empty file.

0 comments on commit 0b1765b

Please sign in to comment.