diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..06b2c5d4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+# Built application files
+*.apk
+*.ap_
+
+# Files for the Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+
+# Gradle files
+.gradle/
+build/
+/*/build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+#ndk binary files
+app/src/main/obj/
+app/src/main/libs/
+# Log Files
+*.log
+
+#idea files
+/.idea/workspace.xml
+/.idea/libraries
+
+#mac file
+.DS_Store
diff --git a/Headunit.iml b/Headunit.iml
new file mode 100644
index 00000000..26baa1df
--- /dev/null
+++ b/Headunit.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index c3cf85f1..509beedc 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# headunit
+# headunit (android studio fork)
Headunit for Android Auto (tm)
A new car or a $600+ headunit is NOT required to enjoy the integration and distraction reduced environment of Android Auto.
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 00000000..e64fe496
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 00000000..a60d539d
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'com.android.application'
+
+android {
+ sourceSets.main {
+ jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jniLibs
+ jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk
+ }
+ compileSdkVersion 21
+ buildToolsVersion "22.0.1"
+
+ defaultConfig {
+ applicationId "ca.yyx.hu"
+ minSdkVersion 19
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ ndk {
+ moduleName "hu_jni"
+ ldLibs "log"
+ }
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:22.2.0'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 00000000..be85ac56
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/meridianc4m1l0/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/ca/yyx/hu/ApplicationTest.java b/app/src/androidTest/java/ca/yyx/hu/ApplicationTest.java
new file mode 100644
index 00000000..c4d3e63c
--- /dev/null
+++ b/app/src/androidTest/java/ca/yyx/hu/ApplicationTest.java
@@ -0,0 +1,13 @@
+package ca.yyx.hu;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
similarity index 100%
rename from AndroidManifest.xml
rename to app/src/main/AndroidManifest.xml
diff --git a/src/ca/yyx/hu/hu_act.java b/app/src/main/java/ca/yyx/hu/hu_act.java
similarity index 99%
rename from src/ca/yyx/hu/hu_act.java
rename to app/src/main/java/ca/yyx/hu/hu_act.java
index f3ef8252..07be6f18 100644
--- a/src/ca/yyx/hu/hu_act.java
+++ b/app/src/main/java/ca/yyx/hu/hu_act.java
@@ -48,11 +48,10 @@ public void onBackPressed() {
import android.widget.Toast;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Timer;
-import android.hardware.Camera;
+
import android.media.CamcorderProfile;
public class hu_act extends Activity implements SurfaceHolder.Callback {
@@ -247,7 +246,7 @@ public boolean onTouch (View v, MotionEvent event) {
screen_logd (intro1_str);
String intro2_str = "";
- if (this.getPackageManager ().hasSystemFeature (android.content.pm.PackageManager.FEATURE_USB_HOST))
+ if (this.getPackageManager ().hasSystemFeature (PackageManager.FEATURE_USB_HOST))
intro2_str = "This device/ROM must support USB Host Mode\n";
else
intro2_str = "This device/ROM must support USB Host Mode AND IT DOES NOT APPEAR TO BE SUPPORTED !!!!!!!!!!\n";
diff --git a/src/ca/yyx/hu/hu_tra.java b/app/src/main/java/ca/yyx/hu/hu_tra.java
similarity index 99%
rename from src/ca/yyx/hu/hu_tra.java
rename to app/src/main/java/ca/yyx/hu/hu_tra.java
index 0f031c92..5ca6df6e 100644
--- a/src/ca/yyx/hu/hu_tra.java
+++ b/app/src/main/java/ca/yyx/hu/hu_tra.java
@@ -8,8 +8,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.os.Handler;
-import android.os.Message;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
@@ -18,7 +16,6 @@
import android.hardware.usb.UsbManager;
import android.widget.Toast;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Locale;
import java.util.Map;
diff --git a/src/ca/yyx/hu/hu_tro.java b/app/src/main/java/ca/yyx/hu/hu_tro.java
similarity index 99%
rename from src/ca/yyx/hu/hu_tro.java
rename to app/src/main/java/ca/yyx/hu/hu_tro.java
index 7c3dd3e0..df8db73a 100644
--- a/src/ca/yyx/hu/hu_tro.java
+++ b/app/src/main/java/ca/yyx/hu/hu_tro.java
@@ -5,7 +5,6 @@
package ca.yyx.hu;
-import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
diff --git a/src/ca/yyx/hu/hu_uti.java b/app/src/main/java/ca/yyx/hu/hu_uti.java
similarity index 96%
rename from src/ca/yyx/hu/hu_uti.java
rename to app/src/main/java/ca/yyx/hu/hu_uti.java
index 5f0ed3e4..50daaf99 100644
--- a/src/ca/yyx/hu/hu_uti.java
+++ b/app/src/main/java/ca/yyx/hu/hu_uti.java
@@ -6,44 +6,23 @@
package ca.yyx.hu;
-import android.bluetooth.BluetoothAdapter;
-import android.net.NetworkInfo;
-import android.os.Bundle;
import android.os.StrictMode;
import android.os.Looper;
-import android.telephony.TelephonyManager;
import android.util.Log;
-import android.content.SharedPreferences;
import android.content.Context;
import android.content.pm.PackageInfo;
-import java.net.SocketTimeoutException;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Locale;
-import java.util.TimeZone;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
-import java.io.FileReader;
-import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
-import java.lang.reflect.Method;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.io.FileInputStream;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-
-public final class hu_uti {
+ public final class hu_uti {
// Stats:
private static int m_obinits = 0;
@@ -504,7 +483,7 @@ public static long file_size_get (String filename) {
public static boolean file_create (final String filename) {
main_thread_get ("file_create filename: " + filename);
- java.io.File f = null;
+ File f = null;
boolean ret = false;
try {
f = new File (filename);
diff --git a/app/src/main/jni/.hu_aad.c.swp b/app/src/main/jni/.hu_aad.c.swp
new file mode 100644
index 00000000..19c147c8
Binary files /dev/null and b/app/src/main/jni/.hu_aad.c.swp differ
diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk
new file mode 100644
index 00000000..eee96a3a
--- /dev/null
+++ b/app/src/main/jni/Android.mk
@@ -0,0 +1,36 @@
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := hu_jni
+
+LOCAL_CFLAGS := -fvisibility=hidden
+
+LOCAL_SRC_FILES := hu_jni.c hu_usb.c hu_aap.c hu_ssl.c hu_aad.c hu_uti.c
+
+LOCAL_LDLIBS := -llog -l$(LOCAL_PATH)/prebuiltlib/libssl.a -l$(LOCAL_PATH)/prebuiltlib/libcrypto.a -l$(LOCAL_PATH)/prebuiltlib/libusbnok.a
+
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := usb_reset
+LOCAL_SRC_FILES := usb_reset.c
+LOCAL_LDLIBS := -llog
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := hu
+LOCAL_SRC_FILES := hu_mai.c hu_usb.c hu_aap.c hu_ssl.c hu_aad.c hu_uti.c
+LOCAL_LDLIBS := -llog -l$(LOCAL_PATH)/prebuiltlib/libssl.so -l$(LOCAL_PATH)/prebuiltlib/libcrypto.so -l$(LOCAL_PATH)/prebuiltlib/libusbnok.so
+
+
+ # SSL wrapper:
+include $(CLEAR_VARS)
+LOCAL_MODULE:= sslwrapper_jni
+LOCAL_SRC_FILES:= sslwrapper_jni.c hu_aad.c hu_uti.c
+LOCAL_LDLIBS := -llog
+
+
+
+
+
diff --git a/jni/Application.mk b/app/src/main/jni/Application.mk
similarity index 62%
rename from jni/Application.mk
rename to app/src/main/jni/Application.mk
index 664b9789..246a2f7f 100644
--- a/jni/Application.mk
+++ b/app/src/main/jni/Application.mk
@@ -1,11 +1,8 @@
-
-APP_ABI := armeabi
-#APP_ABI := all
-
-#APP_PLATFORM := android-16
+APP_ABI :=armeabi armeabi-v7a
+APP_OPTIM := debug
+APP_PLATFORM := android-19
APP_PIE := true
-
#Always release ?
#APP_OPTIM := release # ndk-build NDK_DEBUG=0
#APP_OPTIM := debug # ndk-build NDK_DEBUG=1
diff --git a/jni/hu_aad.c b/app/src/main/jni/hu_aad.c
similarity index 91%
rename from jni/hu_aad.c
rename to app/src/main/jni/hu_aad.c
index 124a2747..027a69b0 100644
--- a/jni/hu_aad.c
+++ b/app/src/main/jni/hu_aad.c
@@ -97,18 +97,18 @@
iaad_adj (& rmv, & buf, & lft, adj);
if (log_dmp) {
- //logd ("n: %1.1d num: %1.1d vint: %20ld", n, num, vint);
- //logd ("%1.1d %1.1d %6ld", n, num, vint);
+ logd ("n: %1.1d num: %1.1d vint: %20ld", n, num, vint);
+ logd ("%1.1d %1.1d %6ld", n, num, vint);
unsigned char str_buf [256] = {0};
- //snprintf (str_buf, sizeof (str_buf), "%1.1d", num);
+ snprintf (str_buf, sizeof (str_buf), "%1.1d", num);
int ctr = 0;
for (ctr = 0; ctr < n - 1; ctr ++)
strncat (str_buf, " ", sizeof (str_buf));
- //unsigned char str_buf2 [256] = {0};
- //snprintf (str_buf2, sizeof (str_buf), "%s%1.1d", str_buf, num);
+ unsigned char str_buf2 [256] = {0};
+ snprintf (str_buf2, sizeof (str_buf), "%s%1.1d", str_buf, num);
logd ("%s%1.1d %4x %5ld", str_buf, num, vint, vint);
}
return (rmv);
@@ -118,7 +118,7 @@
unsigned int iaad_dmp_arry (int log_dmp, unsigned int n, unsigned char * buf, unsigned int len) {
if (n > 8) {
- //if (log_dmp)
+ if (log_dmp)
loge ("iaad_dmp_arry n: %d", n);
}
unsigned int rmv = 0, adj = 0;
@@ -134,7 +134,7 @@
loge ("iaad_dmp_arry iaad_vint_dec adj: %d alen: %ld", adj, alen);
return (0xffffffff);
}
- //logd ("iaad_dmp_arry iaad_vint_dec adj: %d alen: %ld", adj, alen);
+ logd ("iaad_dmp_arry iaad_vint_dec adj: %d alen: %ld", adj, alen);
iaad_adj (& rmv, & buf, & lft, adj); // Point to array
if (alen == 0)
@@ -146,7 +146,7 @@
}
if (log_dmp) {
- //logd ("iaad_dmp_arry n: %d num: %d alen: %ld", n, num, alen); // Dump raw array
+ logd ("iaad_dmp_arry n: %d num: %d alen: %ld", n, num, alen); // Dump raw array
unsigned char str_buf [256] = {0};
int ctr = 0;
for (ctr = 0; ctr < n - 1; ctr ++)
@@ -159,7 +159,7 @@
adj = iaad_dmp_n (0, n + 1, buf, alen); // Try first without error logging to see if this is a valid array
if (adj != alen || adj > 8192) { // "|| rmv + adj != len) {" only works if array is last item in packet
- //logd ("Array not embedded data adj: %d alen: %ld rmv: %d len: %d", adj, alen, rmv, len);
+ logd ("Array not embedded data adj: %d alen: %ld rmv: %d len: %d", adj, alen, rmv, len);
return (rmv + alen);
}
@@ -179,7 +179,7 @@
unsigned int lft = len;
while (lft > 0) { // While bytes left to process...
- //loge ("!!!! 1 n: %d adj: %d len: %d lft: %d rmv: %d buf: %p", n, adj, len, lft, rmv, buf);
+ loge ("!!!! 1 n: %d adj: %d len: %d lft: %d rmv: %d buf: %p", n, adj, len, lft, rmv, buf);
if ((((unsigned int) buf [0]) & 0x07) == 0) { // If varint...
adj = iaad_dmp_vint (log_dmp, n, buf, lft); // Adjust past the varint
}
@@ -195,7 +195,7 @@
}
iaad_adj (& rmv, & buf, & lft, adj); // Apply adjustment
- //loge ("!!!! 2 n: %d adj: %d len: %d lft: %d rmv: %d buf: %p", n, adj, len, lft, rmv, buf);
+ loge ("!!!! 2 n: %d adj: %d len: %d lft: %d rmv: %d buf: %p", n, adj, len, lft, rmv, buf);
}
if (lft != 0 || rmv != len || rmv < 0)
@@ -250,7 +250,7 @@
return (rmv);
}
- //hex_dump ("0 ", 16, buf, len - 2);
+ hex_dump ("0 ", 16, buf, len - 2);
adj = iaad_dmp_n (1, 1, buf, lft); // Dump the content w/ n=1
iaad_adj (& rmv, & buf, & lft, adj); // Adjust past the content (to nothing, presumably)
diff --git a/jni/hu_aad.h b/app/src/main/jni/hu_aad.h
similarity index 100%
rename from jni/hu_aad.h
rename to app/src/main/jni/hu_aad.h
diff --git a/jni/hu_aap.c b/app/src/main/jni/hu_aap.c
similarity index 100%
rename from jni/hu_aap.c
rename to app/src/main/jni/hu_aap.c
diff --git a/jni/hu_aap.h b/app/src/main/jni/hu_aap.h
similarity index 100%
rename from jni/hu_aap.h
rename to app/src/main/jni/hu_aap.h
diff --git a/jni/hu_jni.c b/app/src/main/jni/hu_jni.c
similarity index 100%
rename from jni/hu_jni.c
rename to app/src/main/jni/hu_jni.c
diff --git a/jni/hu_mai.c b/app/src/main/jni/hu_mai.c
similarity index 100%
rename from jni/hu_mai.c
rename to app/src/main/jni/hu_mai.c
diff --git a/jni/hu_oap.h b/app/src/main/jni/hu_oap.h
similarity index 87%
rename from jni/hu_oap.h
rename to app/src/main/jni/hu_oap.h
index c1b455a9..022fe191 100644
--- a/jni/hu_oap.h
+++ b/app/src/main/jni/hu_oap.h
@@ -1,15 +1,17 @@
// Accessory/ADB/Audio
-//#define AAP_VAL_MAN "Android"
-//#define AAP_VAL_MOD "Android Auto" // "Android Open Automotive Protocol"
+
//#define AAP_VAL_DES "Description"
//#define AAP_VAL_VER "VersionName"
//#define AAP_VAL_URI "https://developer.android.com/auto/index.html"
//#define AAP_VAL_SER "62skidoo"
-#define ACC_IDX_MAN 0 // Manufacturer
-#define ACC_IDX_MOD 1 // Model
+static int ACC_IDX_MAN = 0 ; // Manufacturer
+static int ACC_IDX_MOD = 1 ; // Model
+
+static char AAP_VAL_MAN[]= { "Android"};
+static char AAP_VAL_MOD[]= {"Android Auto"}; // "Android Open Automotive Protocol"
//#define ACC_IDX_DES 2 // Description
//#define ACC_IDX_VER 3 // Version
//#define ACC_IDX_URI 4 // URI
diff --git a/jni/hu_ssl.c b/app/src/main/jni/hu_ssl.c
similarity index 100%
rename from jni/hu_ssl.c
rename to app/src/main/jni/hu_ssl.c
diff --git a/jni/hu_ssl.h b/app/src/main/jni/hu_ssl.h
similarity index 100%
rename from jni/hu_ssl.h
rename to app/src/main/jni/hu_ssl.h
diff --git a/jni/hu_usb.c b/app/src/main/jni/hu_usb.c
similarity index 99%
rename from jni/hu_usb.c
rename to app/src/main/jni/hu_usb.c
index 1b1a03df..36fb97af 100644
--- a/jni/hu_usb.c
+++ b/app/src/main/jni/hu_usb.c
@@ -116,7 +116,6 @@ int LIBUSB_CALL libusb_bulk_transfer (libusb_device_handle *dev_han
byte iusb_best_pro [256] = {0};
-#ifndef NDEBUG
char * iusb_error_get (int error) {
switch (error) {
@@ -183,7 +182,6 @@ int LIBUSB_CALL libusb_bulk_transfer (libusb_device_handle *dev_han
}
}
*/
-#endif
int iusb_bulk_transfer (int ep, byte * buf, int len, int tmo) { // 0 = unlimited timeout
char * dir = "recv";
diff --git a/jni/hu_usb.h b/app/src/main/jni/hu_usb.h
similarity index 100%
rename from jni/hu_usb.h
rename to app/src/main/jni/hu_usb.h
diff --git a/jni/hu_ush.c b/app/src/main/jni/hu_ush.c
similarity index 97%
rename from jni/hu_ush.c
rename to app/src/main/jni/hu_ush.c
index 483dfd29..c04ec063 100644
--- a/jni/hu_ush.c
+++ b/app/src/main/jni/hu_ush.c
@@ -266,15 +266,15 @@
}
-#ifndef AA_NO_MAIN
- int main (int argc, char * argv []) {
- int ret = hu_usb_run ();
- while (1) {
- //aa_com_process (); // Process 1 message
- ms_sleep (30);
- }
-
- return (ret);
- }
-#endif
+//#ifndef AA_NO_MAIN
+// int main (int argc, char * argv []) {
+// int ret = hu_usb_run ();
+// while (1) {
+// //aa_com_process (); // Process 1 message
+// ms_sleep (30);
+// }
+//
+// return (ret);
+// }
+//#endif
diff --git a/jni/hu_uti.c b/app/src/main/jni/hu_uti.c
similarity index 100%
rename from jni/hu_uti.c
rename to app/src/main/jni/hu_uti.c
diff --git a/jni/hu_uti.h b/app/src/main/jni/hu_uti.h
similarity index 100%
rename from jni/hu_uti.h
rename to app/src/main/jni/hu_uti.h
diff --git a/jni/libusb.h b/app/src/main/jni/libusb.h
similarity index 100%
rename from jni/libusb.h
rename to app/src/main/jni/libusb.h
diff --git a/jni/openssl/aes.h b/app/src/main/jni/openssl/aes.h
similarity index 100%
rename from jni/openssl/aes.h
rename to app/src/main/jni/openssl/aes.h
diff --git a/jni/openssl/asn1.h b/app/src/main/jni/openssl/asn1.h
similarity index 100%
rename from jni/openssl/asn1.h
rename to app/src/main/jni/openssl/asn1.h
diff --git a/jni/openssl/asn1_mac.h b/app/src/main/jni/openssl/asn1_mac.h
similarity index 100%
rename from jni/openssl/asn1_mac.h
rename to app/src/main/jni/openssl/asn1_mac.h
diff --git a/jni/openssl/asn1t.h b/app/src/main/jni/openssl/asn1t.h
similarity index 100%
rename from jni/openssl/asn1t.h
rename to app/src/main/jni/openssl/asn1t.h
diff --git a/jni/openssl/bio.h b/app/src/main/jni/openssl/bio.h
similarity index 100%
rename from jni/openssl/bio.h
rename to app/src/main/jni/openssl/bio.h
diff --git a/jni/openssl/blowfish.h b/app/src/main/jni/openssl/blowfish.h
similarity index 100%
rename from jni/openssl/blowfish.h
rename to app/src/main/jni/openssl/blowfish.h
diff --git a/jni/openssl/bn.h b/app/src/main/jni/openssl/bn.h
similarity index 100%
rename from jni/openssl/bn.h
rename to app/src/main/jni/openssl/bn.h
diff --git a/jni/openssl/buffer.h b/app/src/main/jni/openssl/buffer.h
similarity index 100%
rename from jni/openssl/buffer.h
rename to app/src/main/jni/openssl/buffer.h
diff --git a/jni/openssl/camellia.h b/app/src/main/jni/openssl/camellia.h
similarity index 100%
rename from jni/openssl/camellia.h
rename to app/src/main/jni/openssl/camellia.h
diff --git a/jni/openssl/cast.h b/app/src/main/jni/openssl/cast.h
similarity index 100%
rename from jni/openssl/cast.h
rename to app/src/main/jni/openssl/cast.h
diff --git a/jni/openssl/cmac.h b/app/src/main/jni/openssl/cmac.h
similarity index 100%
rename from jni/openssl/cmac.h
rename to app/src/main/jni/openssl/cmac.h
diff --git a/jni/openssl/cms.h b/app/src/main/jni/openssl/cms.h
similarity index 100%
rename from jni/openssl/cms.h
rename to app/src/main/jni/openssl/cms.h
diff --git a/jni/openssl/conf.h b/app/src/main/jni/openssl/conf.h
similarity index 100%
rename from jni/openssl/conf.h
rename to app/src/main/jni/openssl/conf.h
diff --git a/jni/openssl/conf_api.h b/app/src/main/jni/openssl/conf_api.h
similarity index 100%
rename from jni/openssl/conf_api.h
rename to app/src/main/jni/openssl/conf_api.h
diff --git a/jni/openssl/crypto.h b/app/src/main/jni/openssl/crypto.h
similarity index 100%
rename from jni/openssl/crypto.h
rename to app/src/main/jni/openssl/crypto.h
diff --git a/jni/openssl/des.h b/app/src/main/jni/openssl/des.h
similarity index 100%
rename from jni/openssl/des.h
rename to app/src/main/jni/openssl/des.h
diff --git a/jni/openssl/des_old.h b/app/src/main/jni/openssl/des_old.h
similarity index 100%
rename from jni/openssl/des_old.h
rename to app/src/main/jni/openssl/des_old.h
diff --git a/jni/openssl/dh.h b/app/src/main/jni/openssl/dh.h
similarity index 100%
rename from jni/openssl/dh.h
rename to app/src/main/jni/openssl/dh.h
diff --git a/jni/openssl/dsa.h b/app/src/main/jni/openssl/dsa.h
similarity index 100%
rename from jni/openssl/dsa.h
rename to app/src/main/jni/openssl/dsa.h
diff --git a/jni/openssl/dso.h b/app/src/main/jni/openssl/dso.h
similarity index 100%
rename from jni/openssl/dso.h
rename to app/src/main/jni/openssl/dso.h
diff --git a/jni/openssl/dtls1.h b/app/src/main/jni/openssl/dtls1.h
similarity index 100%
rename from jni/openssl/dtls1.h
rename to app/src/main/jni/openssl/dtls1.h
diff --git a/jni/openssl/e_os2.h b/app/src/main/jni/openssl/e_os2.h
similarity index 100%
rename from jni/openssl/e_os2.h
rename to app/src/main/jni/openssl/e_os2.h
diff --git a/jni/openssl/ebcdic.h b/app/src/main/jni/openssl/ebcdic.h
similarity index 100%
rename from jni/openssl/ebcdic.h
rename to app/src/main/jni/openssl/ebcdic.h
diff --git a/jni/openssl/ec.h b/app/src/main/jni/openssl/ec.h
similarity index 100%
rename from jni/openssl/ec.h
rename to app/src/main/jni/openssl/ec.h
diff --git a/jni/openssl/ecdh.h b/app/src/main/jni/openssl/ecdh.h
similarity index 100%
rename from jni/openssl/ecdh.h
rename to app/src/main/jni/openssl/ecdh.h
diff --git a/jni/openssl/ecdsa.h b/app/src/main/jni/openssl/ecdsa.h
similarity index 100%
rename from jni/openssl/ecdsa.h
rename to app/src/main/jni/openssl/ecdsa.h
diff --git a/jni/openssl/err.h b/app/src/main/jni/openssl/err.h
similarity index 100%
rename from jni/openssl/err.h
rename to app/src/main/jni/openssl/err.h
diff --git a/jni/openssl/evp.h b/app/src/main/jni/openssl/evp.h
similarity index 100%
rename from jni/openssl/evp.h
rename to app/src/main/jni/openssl/evp.h
diff --git a/jni/openssl/hmac.h b/app/src/main/jni/openssl/hmac.h
similarity index 100%
rename from jni/openssl/hmac.h
rename to app/src/main/jni/openssl/hmac.h
diff --git a/jni/openssl/idea.h b/app/src/main/jni/openssl/idea.h
similarity index 100%
rename from jni/openssl/idea.h
rename to app/src/main/jni/openssl/idea.h
diff --git a/jni/openssl/krb5_asn.h b/app/src/main/jni/openssl/krb5_asn.h
similarity index 100%
rename from jni/openssl/krb5_asn.h
rename to app/src/main/jni/openssl/krb5_asn.h
diff --git a/jni/openssl/kssl.h b/app/src/main/jni/openssl/kssl.h
similarity index 100%
rename from jni/openssl/kssl.h
rename to app/src/main/jni/openssl/kssl.h
diff --git a/jni/openssl/lhash.h b/app/src/main/jni/openssl/lhash.h
similarity index 100%
rename from jni/openssl/lhash.h
rename to app/src/main/jni/openssl/lhash.h
diff --git a/jni/openssl/md4.h b/app/src/main/jni/openssl/md4.h
similarity index 100%
rename from jni/openssl/md4.h
rename to app/src/main/jni/openssl/md4.h
diff --git a/jni/openssl/md5.h b/app/src/main/jni/openssl/md5.h
similarity index 100%
rename from jni/openssl/md5.h
rename to app/src/main/jni/openssl/md5.h
diff --git a/jni/openssl/mdc2.h b/app/src/main/jni/openssl/mdc2.h
similarity index 100%
rename from jni/openssl/mdc2.h
rename to app/src/main/jni/openssl/mdc2.h
diff --git a/jni/openssl/modes.h b/app/src/main/jni/openssl/modes.h
similarity index 100%
rename from jni/openssl/modes.h
rename to app/src/main/jni/openssl/modes.h
diff --git a/jni/openssl/obj_mac.h b/app/src/main/jni/openssl/obj_mac.h
similarity index 100%
rename from jni/openssl/obj_mac.h
rename to app/src/main/jni/openssl/obj_mac.h
diff --git a/jni/openssl/objects.h b/app/src/main/jni/openssl/objects.h
similarity index 100%
rename from jni/openssl/objects.h
rename to app/src/main/jni/openssl/objects.h
diff --git a/jni/openssl/ocsp.h b/app/src/main/jni/openssl/ocsp.h
similarity index 100%
rename from jni/openssl/ocsp.h
rename to app/src/main/jni/openssl/ocsp.h
diff --git a/jni/openssl/opensslconf.h b/app/src/main/jni/openssl/opensslconf.h
similarity index 100%
rename from jni/openssl/opensslconf.h
rename to app/src/main/jni/openssl/opensslconf.h
diff --git a/jni/openssl/opensslv.h b/app/src/main/jni/openssl/opensslv.h
similarity index 100%
rename from jni/openssl/opensslv.h
rename to app/src/main/jni/openssl/opensslv.h
diff --git a/jni/openssl/ossl_typ.h b/app/src/main/jni/openssl/ossl_typ.h
similarity index 100%
rename from jni/openssl/ossl_typ.h
rename to app/src/main/jni/openssl/ossl_typ.h
diff --git a/jni/openssl/pem.h b/app/src/main/jni/openssl/pem.h
similarity index 100%
rename from jni/openssl/pem.h
rename to app/src/main/jni/openssl/pem.h
diff --git a/jni/openssl/pem2.h b/app/src/main/jni/openssl/pem2.h
similarity index 100%
rename from jni/openssl/pem2.h
rename to app/src/main/jni/openssl/pem2.h
diff --git a/jni/openssl/pkcs12.h b/app/src/main/jni/openssl/pkcs12.h
similarity index 100%
rename from jni/openssl/pkcs12.h
rename to app/src/main/jni/openssl/pkcs12.h
diff --git a/jni/openssl/pkcs7.h b/app/src/main/jni/openssl/pkcs7.h
similarity index 100%
rename from jni/openssl/pkcs7.h
rename to app/src/main/jni/openssl/pkcs7.h
diff --git a/jni/openssl/pqueue.h b/app/src/main/jni/openssl/pqueue.h
similarity index 100%
rename from jni/openssl/pqueue.h
rename to app/src/main/jni/openssl/pqueue.h
diff --git a/jni/openssl/rand.h b/app/src/main/jni/openssl/rand.h
similarity index 100%
rename from jni/openssl/rand.h
rename to app/src/main/jni/openssl/rand.h
diff --git a/jni/openssl/rc2.h b/app/src/main/jni/openssl/rc2.h
similarity index 100%
rename from jni/openssl/rc2.h
rename to app/src/main/jni/openssl/rc2.h
diff --git a/jni/openssl/rc4.h b/app/src/main/jni/openssl/rc4.h
similarity index 100%
rename from jni/openssl/rc4.h
rename to app/src/main/jni/openssl/rc4.h
diff --git a/jni/openssl/ripemd.h b/app/src/main/jni/openssl/ripemd.h
similarity index 100%
rename from jni/openssl/ripemd.h
rename to app/src/main/jni/openssl/ripemd.h
diff --git a/jni/openssl/rsa.h b/app/src/main/jni/openssl/rsa.h
similarity index 100%
rename from jni/openssl/rsa.h
rename to app/src/main/jni/openssl/rsa.h
diff --git a/jni/openssl/safestack.h b/app/src/main/jni/openssl/safestack.h
similarity index 100%
rename from jni/openssl/safestack.h
rename to app/src/main/jni/openssl/safestack.h
diff --git a/jni/openssl/seed.h b/app/src/main/jni/openssl/seed.h
similarity index 100%
rename from jni/openssl/seed.h
rename to app/src/main/jni/openssl/seed.h
diff --git a/jni/openssl/sha.h b/app/src/main/jni/openssl/sha.h
similarity index 100%
rename from jni/openssl/sha.h
rename to app/src/main/jni/openssl/sha.h
diff --git a/jni/openssl/srp.h b/app/src/main/jni/openssl/srp.h
similarity index 100%
rename from jni/openssl/srp.h
rename to app/src/main/jni/openssl/srp.h
diff --git a/jni/openssl/srtp.h b/app/src/main/jni/openssl/srtp.h
similarity index 100%
rename from jni/openssl/srtp.h
rename to app/src/main/jni/openssl/srtp.h
diff --git a/jni/openssl/ssl.h b/app/src/main/jni/openssl/ssl.h
similarity index 100%
rename from jni/openssl/ssl.h
rename to app/src/main/jni/openssl/ssl.h
diff --git a/jni/openssl/ssl2.h b/app/src/main/jni/openssl/ssl2.h
similarity index 100%
rename from jni/openssl/ssl2.h
rename to app/src/main/jni/openssl/ssl2.h
diff --git a/jni/openssl/ssl23.h b/app/src/main/jni/openssl/ssl23.h
similarity index 100%
rename from jni/openssl/ssl23.h
rename to app/src/main/jni/openssl/ssl23.h
diff --git a/jni/openssl/ssl3.h b/app/src/main/jni/openssl/ssl3.h
similarity index 100%
rename from jni/openssl/ssl3.h
rename to app/src/main/jni/openssl/ssl3.h
diff --git a/jni/openssl/stack.h b/app/src/main/jni/openssl/stack.h
similarity index 100%
rename from jni/openssl/stack.h
rename to app/src/main/jni/openssl/stack.h
diff --git a/jni/openssl/symhacks.h b/app/src/main/jni/openssl/symhacks.h
similarity index 100%
rename from jni/openssl/symhacks.h
rename to app/src/main/jni/openssl/symhacks.h
diff --git a/jni/openssl/tls1.h b/app/src/main/jni/openssl/tls1.h
similarity index 100%
rename from jni/openssl/tls1.h
rename to app/src/main/jni/openssl/tls1.h
diff --git a/jni/openssl/ts.h b/app/src/main/jni/openssl/ts.h
similarity index 100%
rename from jni/openssl/ts.h
rename to app/src/main/jni/openssl/ts.h
diff --git a/jni/openssl/txt_db.h b/app/src/main/jni/openssl/txt_db.h
similarity index 100%
rename from jni/openssl/txt_db.h
rename to app/src/main/jni/openssl/txt_db.h
diff --git a/jni/openssl/ui.h b/app/src/main/jni/openssl/ui.h
similarity index 100%
rename from jni/openssl/ui.h
rename to app/src/main/jni/openssl/ui.h
diff --git a/jni/openssl/ui_compat.h b/app/src/main/jni/openssl/ui_compat.h
similarity index 100%
rename from jni/openssl/ui_compat.h
rename to app/src/main/jni/openssl/ui_compat.h
diff --git a/jni/openssl/whrlpool.h b/app/src/main/jni/openssl/whrlpool.h
similarity index 100%
rename from jni/openssl/whrlpool.h
rename to app/src/main/jni/openssl/whrlpool.h
diff --git a/jni/openssl/x509.h b/app/src/main/jni/openssl/x509.h
similarity index 100%
rename from jni/openssl/x509.h
rename to app/src/main/jni/openssl/x509.h
diff --git a/jni/openssl/x509_vfy.h b/app/src/main/jni/openssl/x509_vfy.h
similarity index 100%
rename from jni/openssl/x509_vfy.h
rename to app/src/main/jni/openssl/x509_vfy.h
diff --git a/jni/openssl/x509v3.h b/app/src/main/jni/openssl/x509v3.h
similarity index 100%
rename from jni/openssl/x509v3.h
rename to app/src/main/jni/openssl/x509v3.h
diff --git a/jni/libs/libcrypto.a b/app/src/main/jni/prebuiltlib/libcrypto.a
similarity index 100%
rename from jni/libs/libcrypto.a
rename to app/src/main/jni/prebuiltlib/libcrypto.a
diff --git a/jni/libs/libcrypto.so b/app/src/main/jni/prebuiltlib/libcrypto.so
similarity index 100%
rename from jni/libs/libcrypto.so
rename to app/src/main/jni/prebuiltlib/libcrypto.so
diff --git a/jni/libs/libssl.a b/app/src/main/jni/prebuiltlib/libssl.a
similarity index 100%
rename from jni/libs/libssl.a
rename to app/src/main/jni/prebuiltlib/libssl.a
diff --git a/jni/libs/libssl.so b/app/src/main/jni/prebuiltlib/libssl.so
similarity index 100%
rename from jni/libs/libssl.so
rename to app/src/main/jni/prebuiltlib/libssl.so
diff --git a/jni/libs/libusbhost.so b/app/src/main/jni/prebuiltlib/libusbhost.so
similarity index 100%
rename from jni/libs/libusbhost.so
rename to app/src/main/jni/prebuiltlib/libusbhost.so
diff --git a/jni/libs/libusbnok.a b/app/src/main/jni/prebuiltlib/libusbnok.a
similarity index 100%
rename from jni/libs/libusbnok.a
rename to app/src/main/jni/prebuiltlib/libusbnok.a
diff --git a/jni/libs/libusbnok.so b/app/src/main/jni/prebuiltlib/libusbnok.so
similarity index 100%
rename from jni/libs/libusbnok.so
rename to app/src/main/jni/prebuiltlib/libusbnok.so
diff --git a/jni/libs/libusbnoks.a b/app/src/main/jni/prebuiltlib/libusbnoks.a
similarity index 100%
rename from jni/libs/libusbnoks.a
rename to app/src/main/jni/prebuiltlib/libusbnoks.a
diff --git a/jni/sslwrapper_jni.c b/app/src/main/jni/sslwrapper_jni.c
similarity index 100%
rename from jni/sslwrapper_jni.c
rename to app/src/main/jni/sslwrapper_jni.c
diff --git a/jni/usb_reset.c b/app/src/main/jni/usb_reset.c
similarity index 100%
rename from jni/usb_reset.c
rename to app/src/main/jni/usb_reset.c
diff --git a/jni/usbhost.h b/app/src/main/jni/usbhost.h
similarity index 100%
rename from jni/usbhost.h
rename to app/src/main/jni/usbhost.h
diff --git a/res/drawable-hdpi/hu_icon_256.png b/app/src/main/res/drawable-hdpi/hu_icon_256.png
similarity index 100%
rename from res/drawable-hdpi/hu_icon_256.png
rename to app/src/main/res/drawable-hdpi/hu_icon_256.png
diff --git a/res/drawable-hdpi/img_icon_128.png b/app/src/main/res/drawable-hdpi/img_icon_128.png
similarity index 100%
rename from res/drawable-hdpi/img_icon_128.png
rename to app/src/main/res/drawable-hdpi/img_icon_128.png
diff --git a/res/drawable-hdpi/img_icon_256.png b/app/src/main/res/drawable-hdpi/img_icon_256.png
similarity index 100%
rename from res/drawable-hdpi/img_icon_256.png
rename to app/src/main/res/drawable-hdpi/img_icon_256.png
diff --git a/res/drawable-hdpi/img_icon_32.png b/app/src/main/res/drawable-hdpi/img_icon_32.png
similarity index 100%
rename from res/drawable-hdpi/img_icon_32.png
rename to app/src/main/res/drawable-hdpi/img_icon_32.png
diff --git a/res/drawable-hdpi/img_icon_512.png b/app/src/main/res/drawable-hdpi/img_icon_512.png
similarity index 100%
rename from res/drawable-hdpi/img_icon_512.png
rename to app/src/main/res/drawable-hdpi/img_icon_512.png
diff --git a/res/drawable-hdpi/img_icon_64.png b/app/src/main/res/drawable-hdpi/img_icon_64.png
similarity index 100%
rename from res/drawable-hdpi/img_icon_64.png
rename to app/src/main/res/drawable-hdpi/img_icon_64.png
diff --git a/res/layout/layout.xml b/app/src/main/res/layout/layout.xml
similarity index 100%
rename from res/layout/layout.xml
rename to app/src/main/res/layout/layout.xml
diff --git a/res/raw/husam_h264 b/app/src/main/res/raw/husam_h264
similarity index 100%
rename from res/raw/husam_h264
rename to app/src/main/res/raw/husam_h264
diff --git a/res/values/strings.xml b/app/src/main/res/values/strings.xml
similarity index 100%
rename from res/values/strings.xml
rename to app/src/main/res/values/strings.xml
diff --git a/res/xml/usb_device_filter.xml b/app/src/main/res/xml/usb_device_filter.xml
similarity index 100%
rename from res/xml/usb_device_filter.xml
rename to app/src/main/res/xml/usb_device_filter.xml
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..9405f3fd
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.2.3'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/build.xml b/build.xml
deleted file mode 100644
index c74721d2..00000000
--- a/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build_headunit b/build_headunit
deleted file mode 100755
index 0f480d59..00000000
--- a/build_headunit
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-export MY_KEYSTORE_FILE="/home/mike/dev/key/headunit_key"
-export MY_KEYSTORE_PASS="password"
-export MY_KEY_NAME="mikereidis_key"
-export WS="/home/mike/dev"
-export PROJ="hu"
-cd $WS/$PROJ
-
-rm -rf obj # obj/local/armeabi/*
-rm -rf libs # libs/armeabi/
-
-mkdir libs
-
-android update project --target android-21 --path . --name $PROJ
-
-echo ndk-build start
-time ndk-build # 2>&1 |grep -i error
-
-ant -q clean release
-
-jarsigner -storepass $MY_KEYSTORE_PASS -sigalg MD5withRSA -digestalg SHA1 -keystore $MY_KEYSTORE_FILE -signedjar bin/$PROJ-release-unaligned.apk bin/$PROJ-release-unsigned.apk $MY_KEY_NAME
-zipalign -f 4 bin/$PROJ-release-unaligned.apk bin/$PROJ-release.apk
-
-#adb install -r bin/$PROJ-release.apk
-
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..1d3591c8
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..8c0fb64a
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..0c71e760
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 00000000..91a7e269
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 00000000..aec99730
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/jni/Android.mk b/jni/Android.mk
deleted file mode 100644
index 27fac3f0..00000000
--- a/jni/Android.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-
-##
-LOCAL_PATH:= $(call my-dir)
-
-#include $(call all-subdir-makefiles)
-
-# lul / libusb std linux
-# lua / libusb std android libusbnok: https://github.com/Gritzman/libusb
-# luh / libusbhost google
-
- # JNI utilities
-include $(CLEAR_VARS)
-LOCAL_MODULE := hu_jni
-
-LOCAL_CFLAGS := -fvisibility=hidden
-
-LOCAL_SRC_FILES := hu_jni.c hu_usb.c hu_aap.c hu_ssl.c hu_aad.c hu_uti.c
-
-#LOCAL_LDLIBS := -llog -l/home/m/dev/hu/jni/libs/libssl.so -l/home/m/dev/hu/jni/libs/libcrypto.so -l/home/m/dev/hu/jni/libs/libusbnok.so
-LOCAL_LDLIBS := -llog -l/home/m/dev/hu/jni/libs/libssl.a -l/home/m/dev/hu/jni/libs/libcrypto.a -l/home/m/dev/hu/jni/libs/libusbnok.a
-
-
-#LOCAL_SHARED_LIBRARIES := libs/libusbnok.a
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := usb_reset
-LOCAL_SRC_FILES := usb_reset.c
-LOCAL_LDLIBS := -llog
-##include $(BUILD_EXECUTABLE)
-
- # hu_usb AA Test for Linux with exist libusb std: lul / libusb std linux ~/b/ba
- # hu_usb AA Test for Android with built libusb nok: lua / libusb std android ndk-build
-include $(CLEAR_VARS)
-LOCAL_MODULE := hu
-LOCAL_SRC_FILES := hu_mai.c hu_usb.c hu_aap.c hu_ssl.c hu_aad.c hu_uti.c
-LOCAL_LDLIBS := -llog -l/home/m/dev/hu/jni/libs/libssl.so -l/home/m/dev/hu/jni/libs/libcrypto.so -l/home/m/dev/hu/jni/libs/libusbnok.so
-#LOCAL_SHARED_LIBRARIES := /home/m/dev/hu/jni/libs/libusbnok.a
-#LOCAL_SHARED_LIBRARIES := liblog
-#LOCAL_STATIC_LIBRARIES
-#include $(BUILD_EXECUTABLE)
-
-
- # SSL wrapper:
-include $(CLEAR_VARS)
-LOCAL_MODULE:= sslwrapper_jni
-LOCAL_SRC_FILES:= sslwrapper_jni.c hu_aad.c hu_uti.c
-LOCAL_LDLIBS := -llog
-#LOCAL_SHARED_LIBRARIES := liblog
-#include $(BUILD_SHARED_LIBRARY)
-
-
-
- # hu_ush AA Test for Android with exist libusbhost: luh / libusbhost google ndk-build
-include $(CLEAR_VARS)
-LOCAL_MODULE := hu_ush
-LOCAL_SRC_FILES := hu_ush.c hu_aad.c hu_uti.c
-LOCAL_LDLIBS := -llog -l/home/m/dev/hu/jni/libs/libcrypto.a -l/home/m/dev/hu/jni/libs/libssl.a -l/home/m/dev/hu/jni/libs/libusbhost.so
-#LOCAL_SHARED_LIBRARIES := liblog
-#include $(BUILD_EXECUTABLE)
-
-
diff --git a/project.properties b/project.properties
deleted file mode 100644
index 6e18427a..00000000
--- a/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-21
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 00000000..e7b4def4
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'