diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..173454b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
diff --git a/License.pdf b/License.pdf
new file mode 100644
index 0000000..0e9b671
Binary files /dev/null and b/License.pdf differ
diff --git a/License_binaries.pdf b/License_binaries.pdf
new file mode 100644
index 0000000..3c5f519
Binary files /dev/null and b/License_binaries.pdf differ
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..87cf43b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,58 @@
+# TUmine java part - developer accessible classes #
+
+## What is this? ##
+
+These are all the classes that the developer integrating the miner might need.
+
+## Where are the rest of the classes? ##
+
+You can purchase the whole source code (java + c++) on my [website](https://android-miner.tuev-co.eu/#pricing).
+
+## How can I use these files? ##
+
+Only use them for educational purposes
+
+## Can I contribute? ##
+
+**YES**, they biggest contributors will get the low fee version of the miner for FREE.
+
+## How to include the miner in my app? ##
+
+There different versions + I have made a self-hosted repository
+
+Here are all the versions (add the attached snippet to the app/build.gradle):
+* This version of the TUmine Monero .aar library doesn't contain native miner. The needed file will be downloaded once.
+ ```gradle
+ implementation 'tuev.co:tumine:10.0-nonative'
+ ```
+
+* This version of the TUmine Monero .aar library contains native miner with SSL support. -> THE MINER HAS BIGGER SIZE (contains openssl)
+ ```gradle
+ implementation 'tuev.co:tumine:10.0-ssl'
+ ```
+* This version of the TUmine Monero .aar library contains native miner WITHOUT SSL support.
+ ```gradle
+ implementation 'tuev.co:tumine:10.0-basic'
+ ```
+
+Also add my maven repository to the root build.gradle of your project.
+```gradle
+allprojects {
+ repositories {
+ ...
+ maven {
+ url 'https://maven.tuev-co.eu/repository/internal'
+ }
+ }
+}
+```
+
+The files from my maven repository have the same sources + documentation + '.aar'.
+
+## License ##
+
+This is the license for downloading and using the binaries and this source code: [Binaries LICENSE](License_binaries.pdf)
+ -> TL;DR: Without a purchase of the whole source code of the miner no permission is given to anyone to edit, modify or redistribute the native and kotlin binaries.
+
+ The files in this repo can only be used for contribution to this project and for educational purposes.
+This is the license for buying the WHOLE source code: [Source Code LICENSE](License.pdf)
diff --git a/app/src/basic/assets/tumine64arm b/app/src/basic/assets/tumine64arm
new file mode 100644
index 0000000..2ab6eb9
Binary files /dev/null and b/app/src/basic/assets/tumine64arm differ
diff --git a/app/src/basic/assets/tumine86 b/app/src/basic/assets/tumine86
new file mode 100644
index 0000000..060fb4a
Binary files /dev/null and b/app/src/basic/assets/tumine86 differ
diff --git a/app/src/basic/assets/tumine86arm b/app/src/basic/assets/tumine86arm
new file mode 100644
index 0000000..f43e63c
Binary files /dev/null and b/app/src/basic/assets/tumine86arm differ
diff --git a/app/src/basic/updated.txt b/app/src/basic/updated.txt
new file mode 100644
index 0000000..d7f9c1e
--- /dev/null
+++ b/app/src/basic/updated.txt
@@ -0,0 +1,12 @@
+Version: 10-basic
+Updated: 02-03-2019 18:22:44.417
+Format: dd-MM-yyyy HH:mm:ss.SSS
+
+Copied from -> to:
+
+ tumineProjectRoot/android/libs/armeabi-v7a/tumine -> tumineProjectRoot/android-out/basic/assets/tumine86arm
+
+ tumineProjectRoot/android/libs/x86/tumine -> tumineProjectRoot/android-out/basic/assets/tumine86
+
+ tumineProjectRoot/android/libs/arm64-v8a/tumine -> tumineProjectRoot/android-out/basic/assets/tumine64arm
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..db4fb90
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/tuev/co/tumine/InfoPassing.java b/app/src/main/java/tuev/co/tumine/InfoPassing.java
new file mode 100644
index 0000000..534611c
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/InfoPassing.java
@@ -0,0 +1,889 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+
+import android.annotation.TargetApi;
+import android.app.Notification;
+import android.app.job.JobInfo;
+import android.app.job.JobScheduler;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+
+import static android.content.Context.JOB_SCHEDULER_SERVICE;
+
+/**
+ * **IMPORTANT**: Make sure the user has internet
+ * to initialize some files if you use the
+ * *nonative* version in your app.
+ */
+@SuppressWarnings("unused")
+public class InfoPassing implements Parcelable, Serializable {
+
+
+ transient Context context;
+
+ public InfoPassing(Context context) {
+ this.context = context;
+ }
+
+
+
+ public static class QuestionableUsefulness implements Parcelable, Serializable {
+ /**
+ * Cpu affinity set which cores will be used
+ *
+ * *Default*: "0x-1" - Auto
+ */
+ String cpuAffinity = "0x-1";
+
+ /**
+ * Between 0 and 5
+ *
+ * *Default*: -1 - Auto
+ */
+ int cpuPriority = -1;
+
+ public QuestionableUsefulness() {}
+
+ QuestionableUsefulness(Parcel parcel) {
+ cpuAffinity = parcel.readString();
+ cpuPriority = parcel.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeString(cpuAffinity);
+ parcel.writeInt(cpuPriority);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public QuestionableUsefulness createFromParcel(Parcel in) {
+ return new QuestionableUsefulness(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public QuestionableUsefulness[] newArray(int size) {
+ return new QuestionableUsefulness[size];
+ }
+ };
+
+ //Getters/Setters - not needed by the library itself, all documentation is provided above the fields
+
+ public String getCpuAffinity() {
+ return cpuAffinity;
+ }
+
+ public QuestionableUsefulness setCpuAffinity(String cpuAffinity) {
+ this.cpuAffinity = cpuAffinity;
+ return this;
+ }
+
+ public int getCpuPriority() {
+ return cpuPriority;
+ }
+
+ public QuestionableUsefulness setCpuPriority(int cpuPriority) {
+ this.cpuPriority = cpuPriority;
+ return this;
+ }
+ }
+
+ //what output do you want to receive
+ public static class MinerOutput implements Parcelable, Serializable {
+
+ //get updates about what is happening with the service using the ReceiveInfo connector
+ /** These are the keys which will be used in the ReceiveInfo connector:
+ - info, without error can be: lowMemory, stopped, started
+ - info, with error: contains the error message
+ - Logcat messages about some checks before function execution
+ */
+ boolean isBasicLogging = true;
+
+ //review start params as received by the miner
+ boolean debugParams = false;
+
+ //report ONLY simple hashrate, accepted and errors
+ boolean reportOnlyBasics = false;
+
+ //if true the miner won't create a file used for communication between it and the kotlin library
+ //might improve performance
+ boolean silent = false;
+
+ /**
+ * if returned number {@link Double} or {@link Integer}
+ * is invalid, return -11 instead of null
+ */
+ boolean useMinus11InsteadOfNull = false;
+
+ public MinerOutput() {}
+
+ MinerOutput(Parcel parcel) {
+ isBasicLogging = parcel.readInt() != 0;
+ debugParams = parcel.readInt() != 0;
+ reportOnlyBasics = parcel.readInt() != 0;
+ silent = parcel.readInt() != 0;
+ useMinus11InsteadOfNull = parcel.readInt() != 0;
+ }
+
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt( (isBasicLogging) ? 1 : 0);
+ parcel.writeInt( (debugParams) ? 1 : 0);
+ parcel.writeInt( (reportOnlyBasics) ? 1 : 0);
+ parcel.writeInt( (silent) ? 1 : 0);
+ parcel.writeInt( (useMinus11InsteadOfNull) ? 1 : 0);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public MinerOutput createFromParcel(Parcel in) {
+ return new MinerOutput(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public MinerOutput[] newArray(int size) {
+ return new MinerOutput[size];
+ }
+ };
+
+ //Getters/Setters - not needed by the library itself, all documentation is provided above the fields
+
+
+ public boolean isBasicLogging() {
+ return isBasicLogging;
+ }
+
+ public MinerOutput setBasicLogging(boolean basicLogging) {
+ isBasicLogging = basicLogging;
+ return this;
+ }
+
+ public boolean isDebugParams() {
+ return debugParams;
+ }
+
+ public MinerOutput setDebugParams(boolean debugParams) {
+ this.debugParams = debugParams;
+ return this;
+ }
+
+ public boolean isReportOnlyBasics() {
+ return reportOnlyBasics;
+ }
+
+ public MinerOutput setReportOnlyBasics(boolean reportOnlyBasics) {
+ this.reportOnlyBasics = reportOnlyBasics;
+ return this;
+ }
+
+ public boolean isSilent() {
+ return silent;
+ }
+
+ public MinerOutput setSilent(boolean silent) {
+ this.silent = silent;
+ return this;
+ }
+
+ public MinerOutput setUseMinus11InsteadOfNull(boolean useMinus11InsteadOfNull) {
+ this.useMinus11InsteadOfNull = useMinus11InsteadOfNull;
+ return this;
+ }
+
+ public boolean isUseMinus11InsteadOfNull() {
+ return useMinus11InsteadOfNull;
+ }
+ }
+
+ //the essential fields for the miner
+ public static class MinerConfig implements Parcelable, Serializable {
+
+ /**
+ * If enabled update the mining part over the internet.
+ *
+ * *INFO*: Checks for update on every start.
+ */
+ boolean updateOverInternet = false;
+
+ /**
+ * ANDROID_VERSION >= OREO
+ *
+ * Newer android versions don't let background apps
+ * use high performance cores.
+ * This makes the phone laggy when mining is started
+ * from JobScheduler.
+ *
+ * It's recommended to use **1/4** of all cores here.
+ * @see InfoPassing#availableCores
+ */
+ int coresWhenInAJob = 0;
+
+ /**
+ * *NOTE*: check my website for benchmarks
+ *
+ * **Important**: use the [availableCores] to know the hardware that you're dealing with
+ */
+ int coresToUse = 0;
+
+ /**
+ * Download larger binary with SSL support (openssl included) if updateOverInternet is activated
+ *
+ * Because they are bigger I recommend to use ONLY the .jar file and let the miner download the binary when needed
+ *
+ * **Important**: If any of the pools uses ssl this will be enabled automatically
+ */
+ boolean useSSL = true;
+
+ /**
+ * Which mining algorithm to use.
+ *
+ * This affects which coins you can mine.
+ *
+ * *Default*: [MiningAlgorithm.CRYPTONIGHT]
+ */
+ MiningAlgorithm algorithm = MiningAlgorithm.CRYPTONIGHT;
+
+ /**
+ * Mining pools to use.
+ *
+ * If one of them fails the miner will
+ * switch to the next one.
+ */
+ ArrayList pools = new ArrayList();
+
+ MinerConfig(Parcel parcel){
+ updateOverInternet = parcel.readInt() != 0;
+ coresWhenInAJob = parcel.readInt();
+ coresToUse = parcel.readInt();
+ useSSL = parcel.readInt() != 0;
+ algorithm = MiningAlgorithm.fromString(parcel.readString());
+ pools = (ArrayList) parcel.readArrayList(Pool.class.getClassLoader());
+ }
+
+ public MinerConfig(){}
+
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt( (updateOverInternet) ? 1 : 0);
+ parcel.writeInt(coresWhenInAJob);
+ parcel.writeInt(coresToUse);
+ parcel.writeInt( (useSSL) ? 1 : 0);
+ parcel.writeString(algorithm.toString());
+ parcel.writeList(pools);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public MinerConfig createFromParcel(Parcel in) {
+ return new MinerConfig(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public MinerConfig[] newArray(int size) {
+ return new MinerConfig[size];
+ }
+ };
+
+ /*
+ * Getters/Setters - not needed by the library itself (if you choose to remove them, make the fields above public).
+ * Added because it's the java way of accessing fields.
+ * All documentation is provided above the fields themselves.
+ */
+
+
+ public boolean isUpdateOverInternet() {
+ return updateOverInternet;
+ }
+
+ public MinerConfig setUpdateOverInternet(boolean updateOverInternet) {
+ this.updateOverInternet = updateOverInternet;
+ return this;
+ }
+
+ public int getCoresWhenInAJob() {
+ return coresWhenInAJob;
+ }
+
+ public MinerConfig setCoresWhenInAJob(int coresWhenInAJob) {
+ this.coresWhenInAJob = coresWhenInAJob;
+ return this;
+ }
+
+ public int getCoresToUse() {
+ return coresToUse;
+ }
+
+ public MinerConfig setCoresToUse(int coresToUse) {
+ this.coresToUse = coresToUse;
+ return this;
+ }
+
+ public boolean isUseSSL() {
+ return useSSL;
+ }
+
+ public MinerConfig setUseSSL(boolean useSSL) {
+ this.useSSL = useSSL;
+ return this;
+ }
+
+ public MiningAlgorithm getAlgorithm() {
+ return algorithm;
+ }
+
+ public MinerConfig setAlgorithm(MiningAlgorithm algorithm) {
+ this.algorithm = algorithm;
+ return this;
+ }
+
+ public ArrayList getPools() {
+ return pools;
+ }
+
+ public MinerConfig setPools(ArrayList pools) {
+ this.pools = pools;
+ return this;
+ }
+ }
+
+ //all Android specific stuff needed for the mining to work
+ public static class MiningInAndroid implements Parcelable, Serializable {
+ /**
+ * The id which will be used in startForeground(int, Notification)
+ */
+ int foregroundNotificationId = 6345;
+
+ /**
+ * Keep CPU from sleeping
+ *
+ * **Important**: add '' to your manifest
+ */
+ boolean keepCPUawake = false;
+
+ /**
+ * Provide a class in your Project which extends {@link NotificationGetter}
+ * **Important**: if the service will be a foreground one
+ */
+
+ Class extends NotificationGetter> notificationGetterClass = null;
+
+ /**
+ * Although not recommended, you can provide a Notification
+ * for the mining foreground service here
+ * **Important**: if the service will be a foreground one
+ */
+
+ /**
+ * use {@link InfoPassing.MiningInAndroid#notificationGetterClass} instead
+ */
+ @Deprecated
+ Notification notification = null;
+
+ /**
+ * Check cpu usage for 20 secs on start of the miner:
+ * 75% or more - don't start mining, the OS is hard enough on the device
+ * 50% to 75% - mine with only 1 thread
+ */
+ boolean smartStart = false;
+
+
+ public MiningInAndroid(){}
+
+ MiningInAndroid(Parcel parcel) {
+ foregroundNotificationId = parcel.readInt();
+ keepCPUawake = parcel.readInt() != 0;
+ String className = parcel.readString();
+ if (className != null) {
+ try {
+ notificationGetterClass = Class.forName(className).asSubclass(NotificationGetter.class);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ smartStart = parcel.readInt() != 0;
+ notification = parcel.readParcelable(Notification.class.getClassLoader());
+ }
+
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt(foregroundNotificationId);
+ parcel.writeInt( (keepCPUawake) ? 1 : 0);
+ parcel.writeString(notificationGetterClass == null ? null : notificationGetterClass.getName());
+ parcel.writeInt( (smartStart) ? 1 : 0);
+ parcel.writeParcelable(notification, 0);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public MiningInAndroid createFromParcel(Parcel in) {
+ return new MiningInAndroid(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public MiningInAndroid[] newArray(int size) {
+ return new MiningInAndroid[size];
+ }
+ };
+
+ /*
+ * Getters/Setters - not needed by the library itself (if you choose to remove them, make the fields above public).
+ * Added because it's the java way of accessing fields.
+ * All documentation is provided above the fields themselves.
+ */
+
+ public int getForegroundNotificationId() {
+ return foregroundNotificationId;
+ }
+
+ public MiningInAndroid setForegroundNotificationId(int foregroundNotificationId) {
+ this.foregroundNotificationId = foregroundNotificationId;
+ return this;
+ }
+
+ public boolean isKeepCPUawake() {
+ return keepCPUawake;
+ }
+
+ public MiningInAndroid setKeepCPUawake(boolean keepCPUawake) {
+ this.keepCPUawake = keepCPUawake;
+ return this;
+ }
+
+ public Class extends NotificationGetter> getNotificationGetterClass() {
+ return notificationGetterClass;
+ }
+
+ public MiningInAndroid setNotificationGetterClass(Class extends NotificationGetter> notificationGetterClass) {
+ this.notificationGetterClass = notificationGetterClass;
+ return this;
+ }
+
+ public boolean isSmartStart() {
+ return smartStart;
+ }
+
+ public MiningInAndroid setSmartStart(boolean smartStart) {
+ this.smartStart = smartStart;
+ return this;
+ }
+
+ @Deprecated
+ public Notification getNotification() {
+ return notification;
+ }
+
+ @Deprecated
+ public MiningInAndroid setNotification(Notification notification) {
+ this.notification = notification;
+ return this;
+ }
+ }
+
+ MiningInAndroid miningInAndroid = new MiningInAndroid();
+ MinerConfig minerConfig = new MinerConfig();
+ MinerOutput minerOutput = new MinerOutput();
+ QuestionableUsefulness questionableUsefulness = new QuestionableUsefulness();
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeParcelable(miningInAndroid, 0);
+ dest.writeParcelable(minerConfig, 0);
+ dest.writeParcelable(minerOutput, 0);
+ dest.writeParcelable(questionableUsefulness, 0);
+
+ }
+
+ private InfoPassing(Parcel orig) {
+ ClassLoader classLoader = InfoPassing.class.getClassLoader();
+
+ miningInAndroid = orig.readParcelable(classLoader);
+ minerConfig = orig.readParcelable(classLoader);
+ minerOutput = orig.readParcelable(classLoader);
+ questionableUsefulness = orig.readParcelable(classLoader);
+
+ if (miningInAndroid == null) {
+ miningInAndroid = new MiningInAndroid();
+ }
+ if (minerConfig == null) {
+ minerConfig = new MinerConfig();
+ }
+ if (minerOutput == null) {
+ minerOutput = new MinerOutput();
+ }
+ if (questionableUsefulness == null) {
+ questionableUsefulness = new QuestionableUsefulness();
+ }
+
+ }
+
+ /**save this InfoPassing's state (fields) to storage
+ * @see InfoPassing#readState(Context) for retrieval of the saved InfoPassing's state
+ */
+ public void saveState() {
+ if (context == null) {
+ return;
+ }
+ File file = new File(getDefaultTuminePrivateDir(context), "TUmine.info");
+ if (file.exists()) {
+ file.delete();
+ }
+ FileOutputStream fos;
+ ObjectOutputStream out;
+ try {
+ if (!file.createNewFile()) {
+ return;
+ }
+ fos = new FileOutputStream(file);
+ out = new ObjectOutputStream(fos);
+ out.writeObject(this);
+ out.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ //Each time the service starts, it checks for this file and if it is not present, it recreates it from the newest source available
+ public void updateLibrary() {
+ if (context == null) {
+ return;
+ }
+ new File(getDefaultTuminePrivateDir(context).getAbsolutePath()+"/tumine").delete();
+ }
+
+ public void startMiningService(boolean dontSaveState) {
+ if (context == null) {
+ return;
+ }
+ if (!dontSaveState) {
+ saveState();
+ }
+ Intent startMine = new Intent(context, MiningService.class);
+ startMine.putExtra("data", (Parcelable) this);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (miningInAndroid.notificationGetterClass != null) {
+ context.startForegroundService(startMine);
+ } else {
+ scheduleJob(context);
+ }
+ } else {
+ context.startService(startMine);
+ }
+ }
+
+ public void startMiningService() {
+ startMiningService(false);
+ }
+
+ private transient MiningService miningService = null;
+
+ /**
+ * This starts in another thread, it doesn't block the one you start it in.
+ */
+ public void startMiningNoService(boolean dontSaveState) {
+ if (context == null) {
+ return;
+ }
+ if (!dontSaveState) {
+ saveState();
+ }
+ miningService = new MiningService();
+ miningService.context = context;
+ miningService.infoPassing = this;
+ miningService.runningWithoutService = true;
+ miningService.prepareMine();
+ }
+
+ public void startMiningNoService() {
+ startMiningNoService(false);
+ }
+
+ public void stopMiningNoService() {
+ miningService.stopMining(true);
+ miningService = null;
+ }
+
+ public static void stopMiningService(Context context) {
+ Intent startMine = new Intent(context, MiningService.class);
+ startMine.putExtra("action", "stop");
+ context.startService(startMine);
+ }
+
+ public void stopMiningService() {
+ InfoPassing.stopMiningService(context);
+ }
+
+
+ public void changeMiningServiceSpeed(int threads) {
+ Intent startMine = new Intent(context, MiningService.class);
+ startMine.putExtra("action", "threads");
+ startMine.putExtra("threads", threads);
+ context.startService(startMine);
+ }
+
+ public static int availableCores = Runtime.getRuntime().availableProcessors();
+
+ public static int getAvailableCores() {
+ return availableCores;
+ }
+
+ public static int getVersion() {
+ return version;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public InfoPassing createFromParcel(Parcel in) {
+ return new InfoPassing(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public InfoPassing[] newArray(int size) {
+ return new InfoPassing[size];
+ }
+ };
+
+ /*
+ * Getters - not needed by the library itself (if you choose to remove them, make the fields above public).
+ * Added because it's the java way of accessing fields.
+ */
+
+ public MiningInAndroid getMiningInAndroid() {
+ return miningInAndroid;
+ }
+
+ public MinerConfig getMinerConfig() {
+ return minerConfig;
+ }
+
+ public MinerOutput getMinerOutput() {
+ return minerOutput;
+ }
+
+ public QuestionableUsefulness getQuestionableUsefulness() {
+ return questionableUsefulness;
+ }
+
+ //local miner version
+ public static int version = 10;
+
+ //all static methods are below
+
+ /**
+ * May be null.
+ * @param context passed as context for the restored 'InfoPassing'
+ */
+ public static InfoPassing readState(Context context) {
+ FileInputStream fis;
+ ObjectInputStream in;
+ InfoPassing outInfo = null;
+ File file = new File(getDefaultTuminePrivateDir(context), "TUmine.info");
+ if (!file.exists()) {
+ return null;
+ }
+ try {
+ fis = new FileInputStream(file);
+ in = new ObjectInputStream(fis);
+ outInfo = (InfoPassing) in.readObject();
+ in.close();
+ outInfo.context = context;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return outInfo;
+ }
+
+ /**
+ * start the mine service without passing a 'Info Passing' instance
+ * @see InfoPassing#readState(Context) is used to start the miner
+ */
+ public static void startMiningServiceRestoreState(Context context) {
+ InfoPassing state = readState(context);
+ if (state != null) {
+ Intent startMine = new Intent(context, MiningService.class);
+ startMine.putExtra("action", "restore");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (state.miningInAndroid.notificationGetterClass != null) {
+ context.startForegroundService(startMine);
+ } else {
+ scheduleJob(context);
+ }
+ } else {
+ context.startService(startMine);
+ }
+ }
+ }
+
+ public static Notification getNotificationFromClass(Class extends NotificationGetter> notificationGetterClass, Context context) {
+ try {
+ return notificationGetterClass.newInstance().returnNotification(context);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**Our best case scenario for newer devices.
+ * The new android versions forbid background service but
+ * using JobScheduler we get around 7 mins (tested on Pie)
+ * every 15 to 20 minutes of mining.
+ *
+ * The native miner first mines for you for 4 minutes
+ * and then for me - your risk nothing:
+ * The initialisation, connection, update and
+ * all other task eat up from the mining time for me.
+ *
+ * This is NOT very reliable but it's the best we have for the
+ * newer androids with their power management.
+ * It's possible that Android will execute it only once and
+ * stop until the app is reopen.
+ */
+ @TargetApi(Build.VERSION_CODES.O)
+ public static void scheduleJob(Context context) {
+ JobScheduler jobScheduler = (JobScheduler) context.getApplicationContext().getSystemService(JOB_SCHEDULER_SERVICE);
+ if (jobScheduler.getPendingJob(2521) != null) {
+ return;
+ }
+
+ ComponentName componentName = new ComponentName(context, MineJobService.class);
+ JobInfo jobInfo = new JobInfo.Builder(2521, componentName)
+ .setRequiresCharging(false)
+ .setPeriodic(15 * 60 * 1000)
+ .build();
+
+ int resultCode = jobScheduler.schedule(jobInfo);
+ if (resultCode == JobScheduler.RESULT_SUCCESS) {
+ Log.d("TUmine", "Job scheduled!");
+ } else {
+ Log.d("TUmine", "Job not scheduled");
+ }
+ }
+
+ /**
+ * @return the location where all of the miner's files are saved
+ */
+ public static File getDefaultTuminePrivateDir(Context context) {
+ File dir = new File(context.getFilesDir().getAbsolutePath(), "tumineFiles");
+ if (dir.exists()){
+ return dir;
+ }
+ dir.mkdir();
+ return dir;
+ }
+
+ /**
+ * To keep a single instance of
+ * itself the miner responds to
+ * port '4672', if this port is
+ * open then the miner is running.
+ */
+ public static void checkIfMinerIsRunning(final OnRunningResult onRunningResult) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress("127.0.0.1", 4672), 1000);
+ socket.close();
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
+ @Override
+ public void run() {
+ onRunningResult.result(true);
+ }
+ });
+ } catch (Exception ex) {
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
+ @Override
+ public void run() {
+ onRunningResult.result(false);
+ }
+ });
+ }
+ }
+ }).start();
+ }
+
+
+
+}
diff --git a/app/src/main/java/tuev/co/tumine/MineConnector.java b/app/src/main/java/tuev/co/tumine/MineConnector.java
new file mode 100644
index 0000000..a013aef
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/MineConnector.java
@@ -0,0 +1,134 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Handler;
+
+@SuppressWarnings("unused")
+public class MineConnector {
+ OnMessageReceived messageReciever;
+ Context context;
+
+ /**
+ * Automatically:
+ * * connects to the miner if the service is running.
+ * * stops itself and removes all hooks
+ *
+ * @param isBasicLogging parse data from the miner ONLY about:
+ * - lastMiningJobResult
+ * - hashrate and hashratePerThread
+ * - lastError
+ * - initInfo
+ */
+ public MineConnector(OnMessageReceived messageReciever,
+ Context context,
+ boolean isBasicLogging, boolean useMinus11InsteadOfNull) {
+ this.messageReciever = messageReciever;
+ this.context = context;
+ attach();
+ sockListener = new SockClient(messageReciever, context, isBasicLogging, useMinus11InsteadOfNull);
+ }
+
+ public MineConnector(OnMessageReceived messageReciever, InfoPassing infoPassing) {
+ this.messageReciever = messageReciever;
+ this.context = infoPassing.context;
+ attach();
+ sockListener = new SockClient(messageReciever, context, infoPassing.minerOutput.isBasicLogging, infoPassing.minerOutput.useMinus11InsteadOfNull);
+ }
+ private boolean attached = false;
+
+ private SockClient sockListener;
+
+ private BroadcastReceiver receiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent == null || intent.getExtras() == null) {
+ return;
+ }
+ if(intent.getExtras().getBoolean("started")) {
+ if (attached) {
+ if (!sockListener.isRunning()) {
+ attached = false;
+ }
+ }
+ if (!attached) {
+ attached = true;
+ sockListener.runTask();
+ messageReciever.connected();
+ }
+ } else if (intent.getExtras().getBoolean("stopped")) {
+ attached = false;
+ sockListener.stopClient();
+ messageReciever.stopped();
+ }
+ }
+ };
+ public void pause() {
+ sockListener.sendMessage("pause");
+ }
+ public void resume() {
+ sockListener.sendMessage("resume");
+ }
+ public void requestHashratePerThread() {
+ sockListener.sendMessage("advhash");
+ }
+
+ /**
+ * **IMPORTANT**: Call when no longer needed.
+ */
+ public void detach() {
+ try {
+ context.unregisterReceiver(receiver);
+ sockListener.stopClient();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ attached = false;
+ }
+
+ /**
+ * Use ONLY when already called detach
+ *
+ * Don't worry I have made a check.
+ */
+ public void reattach() {
+ if (!attached) {
+ attach();
+ }
+ }
+
+ private void attach() {
+ IntentFilter filter = new IntentFilter("tuev.co.tumine.MineServiceUpdate");
+ context.registerReceiver(receiver, filter);
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Intent isRunning = new Intent("tuev.co.tumine.MineServiceStatus");
+ isRunning.putExtra("action", "report");
+ context.sendBroadcast(isRunning);
+ }
+ }, 2500);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/tuev/co/tumine/MineJobService.java b/app/src/main/java/tuev/co/tumine/MineJobService.java
new file mode 100644
index 0000000..7783c64
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/MineJobService.java
@@ -0,0 +1,52 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+import android.annotation.TargetApi;
+import android.app.job.JobParameters;
+import android.app.job.JobService;
+import android.os.Build;
+
+@TargetApi(Build.VERSION_CODES.O)
+public class MineJobService extends JobService {
+ MiningService miningService;
+
+ @Override
+ public boolean onStartJob(JobParameters params) {
+ InfoPassing infoPassing = InfoPassing.readState(this);
+ if (infoPassing == null) {
+ return true;
+ }
+
+ miningService = new MiningService();
+ miningService.context = this;
+ miningService.infoPassing = infoPassing;
+ miningService.runningInsideJob = true;
+ miningService.prepareMine();
+ return true;
+ }
+
+ @Override
+ public boolean onStopJob(JobParameters params) {
+ miningService.stopMining(true);
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/tuev/co/tumine/MiningAlgorithm.java b/app/src/main/java/tuev/co/tumine/MiningAlgorithm.java
new file mode 100644
index 0000000..fa371b7
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/MiningAlgorithm.java
@@ -0,0 +1,74 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+public enum MiningAlgorithm {
+
+ CRYPTONIGHT ("cryptonight"),
+ CRYPTONIGHT_0 ("cryptonight/0"),
+ CRYPTONIGHT_1 ("cryptonight/1"),
+ CRYPTONIGHT_XTL ("cryptonight/xtl"),
+ CRYPTONIGHT_MSR ("cryptonight/msr"),
+ CRYPTONIGHT_XAO ("cryptonight/xao"),
+ CRYPTONIGHT_RTO ("cryptonight/rto"),
+ CRYPTONIGHT_2 ("cryptonight/2"),
+ CRYPTONIGHT_HALF ("cryptonight/half"),
+ CRYPTONIGHT_XTLV9 ("cryptonight/xtlv9"),
+ CRYPTONIGHT_WOW ("cryptonight/wow"),
+ CRYPTONIGHT_R ("cryptonight/r"),
+
+ CRYPTONIGHT_LITE ("cryptonight-lite"),
+ CRYPTONIGHT_LIGHT ("cryptonight-light"),
+ CRYPTONIGHT_LITE_0 ("cryptonight-lite/0"),
+ CRYPTONIGHT_LITE_1 ("cryptonight-lite/1"),
+
+ CRYPTONIGHT_HEAVY ("cryptonight-heavy"),
+ CRYPTONIGHT_HEAVY_0 ("cryptonight-heavy/0"),
+ CRYPTONIGHT_HEAVY_XHV ("cryptonight-heavy/xhv"),
+ CRYPTONIGHT_HEAVY_TUBE ("cryptonight-heavy/tube"),
+
+ CRYPTONIGHT_PICO ("cryptonight-pico"),
+ CRYPTONIGHT_PICO_TRTL ("cryptonight-pico/trtl"),
+ CRYPTONIGHT_TURTLE ("cryptonight-turtle"),
+ CRYPTONIGHT_ULTRALITE ("cryptonight-ultralite");
+
+ private String algo;
+
+ MiningAlgorithm(String algo) {
+ this.algo = algo;
+ }
+
+
+ public static MiningAlgorithm fromString(String in) {
+ for (MiningAlgorithm dow : MiningAlgorithm.values()) {
+ // Use equalsIgnoreCase to make the getValue method a little more robust
+ if (dow.toString().equalsIgnoreCase(in)) {
+ return dow;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return algo;
+ }
+}
diff --git a/app/src/main/java/tuev/co/tumine/NotificationGetter.java b/app/src/main/java/tuev/co/tumine/NotificationGetter.java
new file mode 100644
index 0000000..8f380b2
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/NotificationGetter.java
@@ -0,0 +1,33 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+import android.app.Notification;
+import android.content.Context;
+
+public abstract class NotificationGetter {
+
+ /**
+ * @param context application context
+ * @return Notification for {@link android.app.Service#startForeground(int, Notification)}
+ */
+ public abstract Notification returnNotification(Context context);
+}
diff --git a/app/src/main/java/tuev/co/tumine/OnMessageReceived.java b/app/src/main/java/tuev/co/tumine/OnMessageReceived.java
new file mode 100644
index 0000000..97dd9a8
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/OnMessageReceived.java
@@ -0,0 +1,27 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+public interface OnMessageReceived {
+ void messageReceived(OutputInfo message);
+ void connected();
+ void stopped();
+}
\ No newline at end of file
diff --git a/app/src/main/java/tuev/co/tumine/OnRunningResult.java b/app/src/main/java/tuev/co/tumine/OnRunningResult.java
new file mode 100644
index 0000000..5fdaa44
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/OnRunningResult.java
@@ -0,0 +1,25 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+public interface OnRunningResult {
+ void result(boolean running);
+}
\ No newline at end of file
diff --git a/app/src/main/java/tuev/co/tumine/OutputHelperClasses.java b/app/src/main/java/tuev/co/tumine/OutputHelperClasses.java
new file mode 100644
index 0000000..650028c
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/OutputHelperClasses.java
@@ -0,0 +1,579 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+
+@SuppressWarnings("unused")
+public class OutputHelperClasses {
+ public enum ChangedValue {
+ initInfo,
+
+ message,
+
+ debugInfo,
+
+ sslVersion,
+
+ startMiningInfo,
+ usingPool,
+ lastMiningJobResult,
+ lastMiningJob,
+ hashrate,
+ lastError,
+
+
+ hashratePerThread
+ }
+
+ public enum CpuArchitecture {
+ x86(0),
+ x64(1);
+ private Integer value;
+
+ CpuArchitecture(Integer value) {
+ this.value = value;
+ }
+
+
+ public static CpuArchitecture fromInt(Integer in) {
+ for (CpuArchitecture dow : CpuArchitecture.values()) {
+ // Use equalsIgnoreCase to make the getValue method a little more robust
+ if (dow.value == in) {
+ return dow;
+ }
+ }
+ return null;
+ }
+
+ public Integer toInt() {
+ return value;
+ }
+ }
+
+ public static class VersionInfo {
+
+ private String minerVersion;
+
+ private String libuvVersion;
+
+ private String compilerVersion;
+
+
+ public final String getMinerVersion() {
+ return this.minerVersion;
+ }
+
+ public final void setMinerVersion(String minerVersion) {
+ this.minerVersion = minerVersion;
+ }
+
+
+ public final String getLibuvVersion() {
+ return this.libuvVersion;
+ }
+
+ public final void setLibuvVersion(String libuvVersion) {
+ this.libuvVersion = libuvVersion;
+ }
+
+
+ public final String getCompilerVersion() {
+ return this.compilerVersion;
+ }
+
+ public final void setCompilerVersion(String compilerVersion) {
+ this.compilerVersion = compilerVersion;
+ }
+
+ public VersionInfo(String minerVersion, String libuvVersion, String compilerVersion) {
+ this.minerVersion = minerVersion;
+ this.libuvVersion = libuvVersion;
+ this.compilerVersion = compilerVersion;
+ }
+ }
+ public static class BasicStartInfo {
+ private Integer threads;
+
+ private MiningAlgorithm algorithm;
+ private Integer miningVariant;
+
+ public final Integer getThreads() {
+ return this.threads;
+ }
+
+ public final void setThreads(Integer threads) {
+ this.threads = threads;
+ }
+
+
+ public final MiningAlgorithm getAlgorithm() {
+ return this.algorithm;
+ }
+
+ public final void setAlgorithm( MiningAlgorithm algorithm) {
+ this.algorithm = algorithm;
+ }
+
+ public final Integer getMiningVariant() {
+ return this.miningVariant;
+ }
+
+ public final void setMiningVariant(Integer miningVariant) {
+ this.miningVariant = miningVariant;
+ }
+
+ public BasicStartInfo(Integer threads, MiningAlgorithm algorithm, Integer miningVariant) {
+ this.threads = threads;
+ this.algorithm = algorithm;
+ this.miningVariant = miningVariant;
+ }
+ }
+
+ public static class CpuInfo {
+
+ private String name;
+
+ private CpuArchitecture cpuArchitecture;
+ private boolean hardwareAES;
+ private final Double l2Cache;
+ private final Double l3Cache;
+
+
+ public final String getName() {
+ return this.name;
+ }
+
+ public final void setName( String name) {
+ this.name = name;
+ }
+
+
+ public final CpuArchitecture getCpuArchitecture() {
+ return this.cpuArchitecture;
+ }
+
+ public final void setCpuArchitecture( CpuArchitecture cpuArchitecture) {
+ this.cpuArchitecture = cpuArchitecture;
+ }
+
+ public final boolean getHardwareAES() {
+ return this.hardwareAES;
+ }
+
+ public final void setHardwareAES(boolean hardwareAES) {
+ this.hardwareAES = hardwareAES;
+ }
+
+ public final Double getL2Cache() {
+ return this.l2Cache;
+ }
+
+ public final Double getL3Cache() {
+ return this.l3Cache;
+ }
+
+ public CpuInfo( String name, CpuArchitecture cpuArchitecture, boolean hardwareAES, Double l2Cache, Double l3Cache) {
+ this.name = name;
+ this.cpuArchitecture = cpuArchitecture;
+ this.hardwareAES = hardwareAES;
+ this.l2Cache = l2Cache;
+ this.l3Cache = l3Cache;
+ }
+ }
+
+ public static class MiningJobResult {
+
+ private String error;
+ private Integer accepted;
+ private Integer rejected;
+ private Integer difficulty;
+ private Integer elapsedInMs;
+
+
+ public final String getError() {
+ return this.error;
+ }
+
+ public final void setError( String error) {
+ this.error = error;
+ }
+
+ public final Integer getAccepted() {
+ return this.accepted;
+ }
+
+ public final void setAccepted(Integer accepted) {
+ this.accepted = accepted;
+ }
+
+ public final Integer getRejected() {
+ return this.rejected;
+ }
+
+ public final void setRejected(Integer rejected) {
+ this.rejected = rejected;
+ }
+
+ public final Integer getDifficulty() {
+ return this.difficulty;
+ }
+
+ public final void setDifficulty(Integer difficulty) {
+ this.difficulty = difficulty;
+ }
+
+ public final Integer getElapsedInMs() {
+ return this.elapsedInMs;
+ }
+
+ public final void setElapsedInMs(Integer elapsedInMs) {
+ this.elapsedInMs = elapsedInMs;
+ }
+
+ public MiningJobResult( String error, Integer accepted, Integer rejected, Integer difficulty, Integer elapsedInMs) {
+ this.error = error;
+ this.accepted = accepted;
+ this.rejected = rejected;
+ this.difficulty = difficulty;
+ this.elapsedInMs = elapsedInMs;
+ }
+ }
+
+ public static class MiningJob {
+
+ private String url;
+ private Integer difficulty;
+
+ private MiningAlgorithm algorithm;
+
+
+ public final String getUrl() {
+ return this.url;
+ }
+
+ public final void setUrl( String url) {
+ this.url = url;
+ }
+
+ public final Integer getDifficulty() {
+ return this.difficulty;
+ }
+
+ public final void setDifficulty(Integer difficulty) {
+ this.difficulty = difficulty;
+ }
+
+
+ public final MiningAlgorithm getAlgorithm() {
+ return this.algorithm;
+ }
+
+ public final void setAlgorithm( MiningAlgorithm algorithm) {
+ this.algorithm = algorithm;
+ }
+
+ public MiningJob(String url, Integer difficulty, MiningAlgorithm algorithm) {
+ this.url = url;
+ this.difficulty = difficulty;
+ this.algorithm = algorithm;
+ }
+ }
+
+ public static class Hashrate {
+
+ private Double shortInterval;
+
+ private Double mediumInterval;
+
+ private Double largeInterval;
+
+ private Double highest;
+
+
+ public final Double getShortInterval() {
+ return this.shortInterval;
+ }
+
+ public final void setShortInterval( Double shortInterval) {
+ this.shortInterval = shortInterval;
+ }
+
+
+ public final Double getMediumInterval() {
+ return this.mediumInterval;
+ }
+
+ public final void setMediumInterval( Double mediumInterval) {
+ this.mediumInterval = mediumInterval;
+ }
+
+
+ public final Double getLargeInterval() {
+ return this.largeInterval;
+ }
+
+ public final void setLargeInterval( Double largeInterval) {
+ this.largeInterval = largeInterval;
+ }
+
+
+ public final Double getHighest() {
+ return this.highest;
+ }
+
+ public final void setHighest( Double highest) {
+ this.highest = highest;
+ }
+
+ public Hashrate( Double shortInterval, Double mediumInterval, Double largeInterval, Double highest) {
+ this.shortInterval = shortInterval;
+ this.mediumInterval = mediumInterval;
+ this.largeInterval = largeInterval;
+ this.highest = highest;
+ }
+ }
+
+ public static class HashratePerThread {
+ private Integer index;
+
+ private final String affinity;
+
+ private Double shortInterval;
+
+ private Double mediumInterval;
+
+ private Double largeInterval;
+
+ public final Integer getIndex() {
+ return this.index;
+ }
+
+ public final void setIndex(Integer index) {
+ this.index = index;
+ }
+
+
+ public final String getAffinity() {
+ return this.affinity;
+ }
+
+
+ public final Double getShortInterval() {
+ return this.shortInterval;
+ }
+
+ public final void setShortInterval( Double shortInterval) {
+ this.shortInterval = shortInterval;
+ }
+
+
+ public final Double getMediumInterval() {
+ return this.mediumInterval;
+ }
+
+ public final void setMediumInterval( Double mediumInterval) {
+ this.mediumInterval = mediumInterval;
+ }
+
+
+ public final Double getLargeInterval() {
+ return this.largeInterval;
+ }
+
+ public final void setLargeInterval( Double largeInterval) {
+ this.largeInterval = largeInterval;
+ }
+
+ public HashratePerThread(Integer index, String affinity, Double shortInterval, Double mediumInterval, Double largeInterval) {
+ this.index = index;
+ this.affinity = affinity;
+ this.shortInterval = shortInterval;
+ this.mediumInterval = mediumInterval;
+ this.largeInterval = largeInterval;
+ }
+ }
+
+ public static class StartMiningInfo {
+
+ private Integer threads;
+
+ private Integer ways;
+
+ private Double memoryInMB;
+
+
+ public final Integer getThreads() {
+ return this.threads;
+ }
+
+ public final void setThreads( Integer threads) {
+ this.threads = threads;
+ }
+
+
+ public final Integer getWays() {
+ return this.ways;
+ }
+
+ public final void setWays( Integer ways) {
+ this.ways = ways;
+ }
+
+
+ public final Double getMemoryInMB() {
+ return this.memoryInMB;
+ }
+
+ public final void setMemoryInMB( Double memoryInMB) {
+ this.memoryInMB = memoryInMB;
+ }
+
+ public StartMiningInfo( Integer threads, Integer ways, Double memoryInMB) {
+ this.threads = threads;
+ this.ways = ways;
+ this.memoryInMB = memoryInMB;
+ }
+ }
+
+ public static class InitInfo {
+
+ private String pkg;
+ private boolean paid;
+
+ private Integer percentageToMe;
+
+
+ public final String getPkg() {
+ return this.pkg;
+ }
+
+ public final void setPkg( String pkg) {
+ this.pkg = pkg;
+ }
+
+ public final boolean getPaid() {
+ return this.paid;
+ }
+
+ public final void setPaid(boolean paid) {
+ this.paid = paid;
+ }
+
+
+ public final Integer getPercentageToMe() {
+ return this.percentageToMe;
+ }
+
+ public final void setPercentageToMe( Integer percentageToMe) {
+ this.percentageToMe = percentageToMe;
+ }
+
+ public InitInfo( String pkg, boolean paid, Integer percentageToMe) {
+ this.pkg = pkg;
+ this.paid = paid;
+ this.percentageToMe = percentageToMe;
+ }
+ }
+
+ public static class Debuginfo {
+
+ private BasicStartInfo basicStartInfo;
+
+ private VersionInfo versionInfo;
+
+ private CpuInfo cpuInfo;
+
+ private String[] pools;
+
+
+ public final BasicStartInfo getBasicStartInfo() {
+ return this.basicStartInfo;
+ }
+
+ public final void setBasicStartInfo( BasicStartInfo basicStartInfo) {
+ this.basicStartInfo = basicStartInfo;
+ }
+
+
+ public final VersionInfo getVersionInfo() {
+ return this.versionInfo;
+ }
+
+ public final void setVersionInfo( VersionInfo versionInfo) {
+ this.versionInfo = versionInfo;
+ }
+
+
+ public final CpuInfo getCpuInfo() {
+ return this.cpuInfo;
+ }
+
+ public final void setCpuInfo( CpuInfo cpuInfo) {
+ this.cpuInfo = cpuInfo;
+ }
+
+
+ public final String[] getPools() {
+ return this.pools;
+ }
+
+ public final void setPools( String[] pools) {
+ this.pools = pools;
+ }
+
+ public Debuginfo( BasicStartInfo basicStartInfo, VersionInfo versionInfo, CpuInfo cpuInfo, String[] pools) {
+ this.basicStartInfo = basicStartInfo;
+ this.versionInfo = versionInfo;
+ this.cpuInfo = cpuInfo;
+ this.pools = pools;
+ }
+ }
+
+ public static class SslInfo {
+
+ private String tlsVersion;
+
+ private String tlsFingerprInteger;
+
+
+ public final String getTlsVersion() {
+ return this.tlsVersion;
+ }
+
+ public final void setTlsVersion( String tlsVersion) {
+ this.tlsVersion = tlsVersion;
+ }
+
+
+ public final String getTlsFingerprInteger() {
+ return this.tlsFingerprInteger;
+ }
+
+ public final void setTlsFingerprInteger( String tlsFingerprInteger) {
+ this.tlsFingerprInteger = tlsFingerprInteger;
+ }
+
+ public SslInfo( String tlsVersion, String tlsFingerprInteger) {
+ this.tlsVersion = tlsVersion;
+ this.tlsFingerprInteger = tlsFingerprInteger;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/tuev/co/tumine/OutputInfo.java b/app/src/main/java/tuev/co/tumine/OutputInfo.java
new file mode 100644
index 0000000..92ab0cd
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/OutputInfo.java
@@ -0,0 +1,168 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+import java.util.ArrayList;
+
+import tuev.co.tumine.OutputHelperClasses.ChangedValue;
+import tuev.co.tumine.OutputHelperClasses.Debuginfo;
+import tuev.co.tumine.OutputHelperClasses.Hashrate;
+import tuev.co.tumine.OutputHelperClasses.InitInfo;
+import tuev.co.tumine.OutputHelperClasses.MiningJob;
+import tuev.co.tumine.OutputHelperClasses.MiningJobResult;
+import tuev.co.tumine.OutputHelperClasses.SslInfo;
+import tuev.co.tumine.OutputHelperClasses.StartMiningInfo;
+
+@SuppressWarnings("unused")
+public class OutputInfo {
+
+ ChangedValue lastChangedValue;
+
+ InitInfo initInfo;
+
+ String message;
+
+ SslInfo sslVersion;
+
+ Debuginfo debugInfo;
+
+ StartMiningInfo startMiningInfo;
+
+ Pool usingPool;
+
+ MiningJobResult lastMiningJobResult;
+
+ MiningJob lastMiningJob;
+
+ Hashrate hashrate;
+
+ String lastError;
+
+ ArrayList hashratePerThread;
+
+
+ public ChangedValue getLastChangedValue() {
+ return this.lastChangedValue;
+ }
+
+ public void setLastChangedValue( ChangedValue lastChangedValue) {
+ this.lastChangedValue = lastChangedValue;
+ }
+
+
+ public InitInfo getInitInfo() {
+ return this.initInfo;
+ }
+
+ public void setInitInfo( InitInfo initInfo) {
+ this.initInfo = initInfo;
+ }
+
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage( String message) {
+ this.message = message;
+ }
+
+
+ public SslInfo getSslVersion() {
+ return this.sslVersion;
+ }
+
+ public void setSslVersion( SslInfo sslVersion) {
+ this.sslVersion = sslVersion;
+ }
+
+
+ public Debuginfo getDebugInfo() {
+ return this.debugInfo;
+ }
+
+ public void setDebugInfo( Debuginfo debugInfo) {
+ this.debugInfo = debugInfo;
+ }
+
+
+ public StartMiningInfo getStartMiningInfo() {
+ return this.startMiningInfo;
+ }
+
+ public void setStartMiningInfo( StartMiningInfo startMiningInfo) {
+ this.startMiningInfo = startMiningInfo;
+ }
+
+
+ public Pool getUsingPool() {
+ return this.usingPool;
+ }
+
+ public void setUsingPool( Pool usingPool) {
+ this.usingPool = usingPool;
+ }
+
+
+ public MiningJobResult getLastMiningJobResult() {
+ return this.lastMiningJobResult;
+ }
+
+ public void setLastMiningJobResult( MiningJobResult lastMiningJobResult) {
+ this.lastMiningJobResult = lastMiningJobResult;
+ }
+
+
+ public MiningJob getLastMiningJob() {
+ return this.lastMiningJob;
+ }
+
+ public void setLastMiningJob( MiningJob lastMiningJob) {
+ this.lastMiningJob = lastMiningJob;
+ }
+
+
+ public Hashrate getHashrate() {
+ return this.hashrate;
+ }
+
+ public void setHashrate( Hashrate hashrate) {
+ this.hashrate = hashrate;
+ }
+
+
+ public String getLastError() {
+ return this.lastError;
+ }
+
+ public void setLastError( String lastError) {
+ this.lastError = lastError;
+ }
+
+
+ public ArrayList getHashratePerThread() {
+ return this.hashratePerThread;
+ }
+
+ public void setHashratePerThread( ArrayList hashratePerThread) {
+ this.hashratePerThread = hashratePerThread;
+ }
+}
diff --git a/app/src/main/java/tuev/co/tumine/Pool.java b/app/src/main/java/tuev/co/tumine/Pool.java
new file mode 100644
index 0000000..a79fd72
--- /dev/null
+++ b/app/src/main/java/tuev/co/tumine/Pool.java
@@ -0,0 +1,219 @@
+/* Tuev, Co
+ * Copyright 2018-2019 Tuev, Co ,
+ *
+ * This file contains Original Code as defined in and that are subject to
+ * the License provided in the 'License.pdf' in the file tree or
+ * available in 'https://tuev-co.eu'. You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to distribute, or enable the distribution of,
+ * unlawful or unlicensed copies of the 'Tumine Monero Software'
+ * or any binaries or libraries built using the source code provided.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND.
+ *
+ *
+ * Please see the License for the specific governing rights and
+ * limitations under the License.
+ *
+ */
+
+package tuev.co.tumine;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.io.Serializable;
+
+
+@SuppressWarnings("unused")
+public class Pool implements Parcelable, Serializable {
+
+ /**
+ * **IMPORTANT**: requires larger binaries with SSL support (openssl included)
+ *
+ * Because they are bigger I recommend to use the 'nonative' version and let the miner download the binary when needed
+ *
+ * If the value is wrong the miner will try to reconnect without/with ssl
+ */
+ boolean useSSL;
+ String url;//-the pool where you want to mine monero (XMR) or other cryptonight coins - look at this: http://moneropools.com/
+ //specify appropriate username based on the mining pool you are using
+ String user;
+ //specify appropriate password based on the mining pool you are using
+ String password;// - this is important for earnings tacking
+ String rigID = "null";
+ //send keepAlive message to the server every 'keepAlive' seconds
+ //1 = default, 0 = off, custom = seconds
+ int keepAlive = 1;
+ boolean nicehash = false;
+ /**
+ * **IMPORTANT**: requires larger binaries with SSL support (openssl included)
+ *
+ * Because they are bigger I recommend to use the 'nonative' version and let the miner download the binary when needed
+ *
+ * If the value is wrong the miner will try to reconnect without/with ssl
+ */
+ String ip = null;
+ String urlDebug = null;
+
+ public String getUrlDebug() {
+ return urlDebug;
+ }
+
+ public Pool setUrlDebug(String urlDebug) {
+ this.urlDebug = urlDebug;
+ return this;
+ }
+
+ public Pool setUrl(String url) {
+ this.url = url;
+ return this;
+ }
+
+ public Pool setUser(String user) {
+ this.user = user;
+ return this;
+ }
+
+ public Pool setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public Pool setRigID(String rigID) {
+ this.rigID = rigID;
+ return this;
+ }
+
+ public Pool setKeepAlive(int keepAlive) {
+ this.keepAlive = keepAlive;
+ return this;
+ }
+
+
+ public Pool setNicehash(boolean nicehash) {
+ this.nicehash = nicehash;
+ return this;
+ }
+ public Pool setIp(String ip) {
+ this.ip = ip;
+ return this;
+ }
+
+ public Pool setUseSSL(boolean useSSL) {
+ this.useSSL = useSSL;
+ return this;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getRigID() {
+ return rigID;
+ }
+
+ public int getKeepAlive() {
+ return keepAlive;
+ }
+
+ public boolean isNicehash() {
+ return nicehash;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public boolean isUseSSL() {
+ return useSSL;
+ }
+
+ public Pool(String url,//-the pool where you want to mine monero (XMR) or other cryptonight coins - look at this: http://moneropools.com/
+ //specify appropriate username based on the mining pool you are using
+ String user,
+ //specify appropriate password based on the mining pool you are using
+ String password,// - this is important for earnings tacking
+ String rigID,
+ //send keepAlive message to the server every 'keepAlive' seconds
+ //1 = default, 0 = off, custom = seconds
+ int keepAlive,
+ boolean nicehash,
+ String ip,
+ boolean useSSL) {
+ this.url = url;
+ this.user = user;
+ this.rigID = rigID;
+ this.keepAlive = keepAlive;
+ this.nicehash = nicehash;
+ this.ip = ip;
+ this.password = password;
+ this.useSSL = useSSL;
+ }
+
+ public Pool(String url,//-the pool where you want to mine monero (XMR) or other cryptonight coins - look at this: http://moneropools.com/
+ //specify appropriate username based on the mining pool you are using
+ String user,
+ //specify appropriate password based on the mining pool you are using
+ String password// - this is important for earnings tacking
+ ) {
+ this.url = url;
+ this.user = user;
+ this.password = password;
+ }
+
+ private Pool(Parcel parcel) {
+ this(
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readInt(),
+ parcel.readInt() != 0,
+ parcel.readString(),
+ parcel.readInt() != 0
+ );
+ }
+
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeString(url);
+ parcel.writeString(user);
+ parcel.writeString(password);
+ parcel.writeString(rigID);
+ parcel.writeInt(keepAlive);
+ parcel.writeInt( (nicehash) ? 1 : 0);
+ parcel.writeString(ip);
+ parcel.writeInt( (useSSL) ? 1 : 0);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Creator CREATOR
+ = new Creator() {
+
+ // This simply calls our new constructor (typically private) and
+ // passes along the unmarshalled `Parcel`, and then returns the new object!
+ @Override
+ public Pool createFromParcel(Parcel in) {
+ return new Pool(in);
+ }
+
+ // We just need to copy this and change the type to match our class.
+ @Override
+ public Pool[] newArray(int size) {
+ return new Pool[size];
+ }
+ };
+}
\ No newline at end of file
diff --git a/app/src/ssl/assets/tumine64arm b/app/src/ssl/assets/tumine64arm
new file mode 100644
index 0000000..fc0dc29
Binary files /dev/null and b/app/src/ssl/assets/tumine64arm differ
diff --git a/app/src/ssl/assets/tumine86 b/app/src/ssl/assets/tumine86
new file mode 100644
index 0000000..80cc9d8
Binary files /dev/null and b/app/src/ssl/assets/tumine86 differ
diff --git a/app/src/ssl/assets/tumine86arm b/app/src/ssl/assets/tumine86arm
new file mode 100644
index 0000000..3e47d0d
Binary files /dev/null and b/app/src/ssl/assets/tumine86arm differ
diff --git a/app/src/ssl/updated.txt b/app/src/ssl/updated.txt
new file mode 100644
index 0000000..2d3b9f9
--- /dev/null
+++ b/app/src/ssl/updated.txt
@@ -0,0 +1,12 @@
+Version: 10-ssl
+Updated: 02-03-2019 18:22:44.392
+Format: dd-MM-yyyy HH:mm:ss.SSS
+
+Copied from -> to:
+
+ tumineProjectRoot/android/libs/armeabi-v7a/tumine_ssl -> tumineProjectRoot/android-out/ssl/assets/tumine86arm
+
+ tumineProjectRoot/android/libs/x86/tumine_ssl -> tumineProjectRoot/android-out/ssl/assets/tumine86
+
+ tumineProjectRoot/android/libs/arm64-v8a/tumine_ssl -> tumineProjectRoot/android-out/ssl/assets/tumine64arm
+