From 829d37f6201b765cfa252378747197b334858298 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Thu, 10 Jan 2019 14:55:46 +0800 Subject: [PATCH 01/57] feat(android): add android wrapper project --- wrappers/android/mynteye/.gitignore | 8 + wrappers/android/mynteye/app/.gitignore | 1 + wrappers/android/mynteye/app/build.gradle | 30 +++ .../android/mynteye/app/proguard-rules.pro | 21 +++ .../mynteye/demo/ExampleInstrumentedTest.java | 26 +++ .../mynteye/app/src/main/AndroidManifest.xml | 20 ++ .../slightech/mynteye/demo/MainActivity.java | 13 ++ .../app/src/main/res/layout/activity_main.xml | 21 +++ .../app/src/main/res/values/colors.xml | 6 + .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 11 ++ .../mynteye/demo/ExampleUnitTest.java | 17 ++ wrappers/android/mynteye/build.gradle | 27 +++ wrappers/android/mynteye/gradle.properties | 15 ++ .../mynteye/gradle/dependencies.gradle | 44 +++++ .../mynteye/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + wrappers/android/mynteye/gradlew | 172 ++++++++++++++++++ wrappers/android/mynteye/gradlew.bat | 84 +++++++++ wrappers/android/mynteye/settings.gradle | 1 + 20 files changed, 525 insertions(+) create mode 100644 wrappers/android/mynteye/.gitignore create mode 100644 wrappers/android/mynteye/app/.gitignore create mode 100644 wrappers/android/mynteye/app/build.gradle create mode 100644 wrappers/android/mynteye/app/proguard-rules.pro create mode 100644 wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java create mode 100644 wrappers/android/mynteye/app/src/main/AndroidManifest.xml create mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java create mode 100644 wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml create mode 100644 wrappers/android/mynteye/app/src/main/res/values/colors.xml create mode 100644 wrappers/android/mynteye/app/src/main/res/values/strings.xml create mode 100644 wrappers/android/mynteye/app/src/main/res/values/styles.xml create mode 100644 wrappers/android/mynteye/app/src/test/java/com/slightech/mynteye/demo/ExampleUnitTest.java create mode 100644 wrappers/android/mynteye/build.gradle create mode 100644 wrappers/android/mynteye/gradle.properties create mode 100644 wrappers/android/mynteye/gradle/dependencies.gradle create mode 100644 wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.jar create mode 100644 wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties create mode 100755 wrappers/android/mynteye/gradlew create mode 100644 wrappers/android/mynteye/gradlew.bat create mode 100644 wrappers/android/mynteye/settings.gradle diff --git a/wrappers/android/mynteye/.gitignore b/wrappers/android/mynteye/.gitignore new file mode 100644 index 0000000..0df7064 --- /dev/null +++ b/wrappers/android/mynteye/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/ +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/wrappers/android/mynteye/app/.gitignore b/wrappers/android/mynteye/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/wrappers/android/mynteye/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/wrappers/android/mynteye/app/build.gradle b/wrappers/android/mynteye/app/build.gradle new file mode 100644 index 0000000..cc86012 --- /dev/null +++ b/wrappers/android/mynteye/app/build.gradle @@ -0,0 +1,30 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion xversions.compileSdk + defaultConfig { + applicationId "com.slightech.mynteye.demo" + minSdkVersion xversions.minSdk + targetSdkVersion xversions.targetSdk + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation xdeps.support.appcompat + implementation xdeps.support.constraint + + testImplementation xdeps.junit + androidTestImplementation xdeps.support.test.runner + androidTestImplementation xdeps.support.test.espresso +} diff --git a/wrappers/android/mynteye/app/proguard-rules.pro b/wrappers/android/mynteye/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/wrappers/android/mynteye/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java b/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..a7c3f03 --- /dev/null +++ b/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.slightech.mynteye.demo; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.slightech.mynteye.demo", appContext.getPackageName()); + } +} diff --git a/wrappers/android/mynteye/app/src/main/AndroidManifest.xml b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..76abdcc --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java new file mode 100644 index 0000000..e4578d3 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java @@ -0,0 +1,13 @@ +package com.slightech.mynteye.demo; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} diff --git a/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..3b779f6 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/wrappers/android/mynteye/app/src/main/res/values/colors.xml b/wrappers/android/mynteye/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..b2b4267 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #008577 + #00574B + #D81B60 + diff --git a/wrappers/android/mynteye/app/src/main/res/values/strings.xml b/wrappers/android/mynteye/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..d69f619 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + mynteye + diff --git a/wrappers/android/mynteye/app/src/main/res/values/styles.xml b/wrappers/android/mynteye/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..705be27 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/wrappers/android/mynteye/app/src/test/java/com/slightech/mynteye/demo/ExampleUnitTest.java b/wrappers/android/mynteye/app/src/test/java/com/slightech/mynteye/demo/ExampleUnitTest.java new file mode 100644 index 0000000..0e0a74c --- /dev/null +++ b/wrappers/android/mynteye/app/src/test/java/com/slightech/mynteye/demo/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.slightech.mynteye.demo; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/wrappers/android/mynteye/build.gradle b/wrappers/android/mynteye/build.gradle new file mode 100644 index 0000000..e7a3ada --- /dev/null +++ b/wrappers/android/mynteye/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + apply from: rootProject.file('gradle/dependencies.gradle') + + repositories { + google() + jcenter() + } + dependencies { + classpath xplugins.android.buildGradle + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/wrappers/android/mynteye/gradle.properties b/wrappers/android/mynteye/gradle.properties new file mode 100644 index 0000000..82618ce --- /dev/null +++ b/wrappers/android/mynteye/gradle.properties @@ -0,0 +1,15 @@ +# 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. +org.gradle.jvmargs=-Xmx1536m +# 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 + + diff --git a/wrappers/android/mynteye/gradle/dependencies.gradle b/wrappers/android/mynteye/gradle/dependencies.gradle new file mode 100644 index 0000000..da2d862 --- /dev/null +++ b/wrappers/android/mynteye/gradle/dependencies.gradle @@ -0,0 +1,44 @@ +ext { + xplugins = [ + 'android': [ + // Gradle: https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google + buildGradle: 'com.android.tools.build:gradle:3.2.1', + ], + ] + + xversions = [ + 'compileSdk': 28, + 'minSdk': 21, + 'targetSdk': 28, + + 'androidSupport': '28.0.0', + ] + + xdeps = [ + // Support Library + // https://developer.android.com/topic/libraries/support-library/ + 'support': [ + // Android AppCompat Library V7 + // https://mvnrepository.com/artifact/com.android.support/appcompat-v7?repo=google + 'appcompat': "com.android.support:appcompat-v7:${xversions.androidSupport}", + + // Android ConstraintLayout Solver + // https://mvnrepository.com/artifact/com.android.support.constraint/constraint-layout-solver + 'constraint': 'com.android.support.constraint:constraint-layout:1.1.3', + // Android Multi Dex Library + // https://mvnrepository.com/artifact/com.android.support/multidex + 'multidex': 'com.android.support:multidex:1.0.3', + + // Test apps on Android + // https://developer.android.com/training/testing/ + 'test': [ + 'espresso': 'com.android.support.test.espresso:espresso-core:3.0.2', + 'rules': 'com.android.support.test:rules:1.0.2', + 'runner': 'com.android.support.test:runner:1.0.2', + ], + ], + + // JUnit4: https://github.com/junit-team/junit4 + 'junit': 'junit:junit:4.12', + ] +} diff --git a/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.jar b/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..f6b961fd5a86aa5fbfe90f707c3138408be7c718 GIT binary patch literal 54329 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNj?q^^Y^VFp)SH8qbSJ)2BQ2giqr}t zFG7D6)c?v~^Z#E_K}1nTQbJ9gQ9<%vVRAxVj)8FwL5_iTdUB>&m3fhE=kRWl;g`&m z!W5kh{WsV%fO*%je&j+Lv4xxK~zsEYQls$Q-p&dwID|A)!7uWtJF-=Tm1{V@#x*+kUI$=%KUuf2ka zjiZ{oiL1MXE2EjciJM!jrjFNwCh`~hL>iemrqwqnX?T*MX;U>>8yRcZb{Oy+VKZos zLiFKYPw=LcaaQt8tj=eoo3-@bG_342H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kr`k~r2}yP^ND{8!v7Q1&vtk& z2Y}l@J@{|2`oA%sxvM9i0V+8IXrZ4;tey)d;LZI70Kbim<4=WoTPZy=Yd|34v#$Kh zx|#YJ8s`J>W&jt#GcMpx84w2Z3ur-rK7gf-p5cE)=w1R2*|0mj12hvapuUWM0b~dG zMg9p8FmAZI@i{q~0@QuY44&mMUNXd7z>U58shA3o`p5eVLpq>+{(<3->DWuSFVZwC zxd50Uz(w~LxC4}bgag#q#NNokK@yNc+Q|Ap!u>Ddy+df>v;j@I12CDNN9do+0^n8p zMQs7X#+FVF0C5muGfN{r0|Nkql%BQT|K(DDNdR2pzM=_ea5+GO|J67`05AV92t@4l z0Qno0078PIHdaQGHZ~Scw!dzgqjK~3B7kf>BcP__&lLyU(cu3B^uLo%{j|Mb0NR)tkeT7Hcwp4O# z)yzu>cvG(d9~0a^)eZ;;%3ksk@F&1eEBje~ zW+-_s)&RgiweQc!otF>4%vbXKaOU41{!hw?|2`Ld3I8$&#WOsq>EG)1ANb!{N4z9@ zsU!bPG-~-bqCeIDzo^Q;gnucB{tRzm{ZH^Orphm2U+REA!*<*J6YQV83@&xoDl%#wnl5qcBqCcAF-vX5{30}(oJrnSH z{RY85hylK2dMOh2%oO1J8%)0?8TOL%rS8)+CsDv}aQ>4D)Jv+DLK)9gI^n-T^$)Tc zFPUD75qJm!Y-KBqj;JP4dV4 z`X{lGmn<)1IGz330}s}Jrjtf{(lnuuNHe5(ezA(pYa=1|Ff-LhPFK8 zyJh_b{yzu0yll6ZkpRzRjezyYivjyjW7QwO;@6X`m;2Apn2EK2!~7S}-*=;5*7K$B z`x(=!^?zgj(-`&ApZJXI09aDLXaT@<;CH=?fBOY5d|b~wBA@@p^K#nxr`)?i?SqTupI_PJ(A3cx`z~9mX_*)>L F{|7XC?P&l2 literal 0 HcmV?d00001 diff --git a/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties b/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..9a4163a --- /dev/null +++ b/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/wrappers/android/mynteye/gradlew b/wrappers/android/mynteye/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/wrappers/android/mynteye/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# 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 +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +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" -a "$nonstop" = "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"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # 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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/wrappers/android/mynteye/gradlew.bat b/wrappers/android/mynteye/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/wrappers/android/mynteye/gradlew.bat @@ -0,0 +1,84 @@ +@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 + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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= + +@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 Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_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=%* + +: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/wrappers/android/mynteye/settings.gradle b/wrappers/android/mynteye/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/wrappers/android/mynteye/settings.gradle @@ -0,0 +1 @@ +include ':app' From 9aefabf76b30e1e132103b15499f010c9aa2d4b8 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Mon, 14 Jan 2019 12:03:18 +0800 Subject: [PATCH 02/57] feat(android): add libmynteye to android --- wrappers/android/mynteye/app/build.gradle | 5 ++ .../mynteye/gradle/dependencies.gradle | 3 + .../android/mynteye/libmynteye/.gitignore | 1 + .../android/mynteye/libmynteye/build.gradle | 46 +++++++++++++ .../mynteye/libmynteye/proguard-rules.pro | 21 ++++++ .../mynteye/ExampleInstrumentedTest.java | 26 +++++++ .../libmynteye/src/main/AndroidManifest.xml | 2 + .../libmynteye/src/main/cpp/CMakeLists.txt | 67 +++++++++++++++++++ .../slightech/mynteye/ExampleUnitTest.java | 17 +++++ wrappers/android/mynteye/settings.gradle | 2 +- 10 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 wrappers/android/mynteye/libmynteye/.gitignore create mode 100644 wrappers/android/mynteye/libmynteye/build.gradle create mode 100644 wrappers/android/mynteye/libmynteye/proguard-rules.pro create mode 100644 wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/AndroidManifest.xml create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt create mode 100644 wrappers/android/mynteye/libmynteye/src/test/java/com/slightech/mynteye/ExampleUnitTest.java diff --git a/wrappers/android/mynteye/app/build.gradle b/wrappers/android/mynteye/app/build.gradle index cc86012..229eac5 100644 --- a/wrappers/android/mynteye/app/build.gradle +++ b/wrappers/android/mynteye/app/build.gradle @@ -9,6 +9,9 @@ android { versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + ndk { + abiFilters xabis + } } buildTypes { release { @@ -24,6 +27,8 @@ dependencies { implementation xdeps.support.appcompat implementation xdeps.support.constraint + implementation project(':libmynteye') + testImplementation xdeps.junit androidTestImplementation xdeps.support.test.runner androidTestImplementation xdeps.support.test.espresso diff --git a/wrappers/android/mynteye/gradle/dependencies.gradle b/wrappers/android/mynteye/gradle/dependencies.gradle index da2d862..c4d7278 100644 --- a/wrappers/android/mynteye/gradle/dependencies.gradle +++ b/wrappers/android/mynteye/gradle/dependencies.gradle @@ -41,4 +41,7 @@ ext { // JUnit4: https://github.com/junit-team/junit4 'junit': 'junit:junit:4.12', ] + + xabis = ['arm64-v8a', 'armeabi-v7a'] as String[] + //xabis = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'] as String[] } diff --git a/wrappers/android/mynteye/libmynteye/.gitignore b/wrappers/android/mynteye/libmynteye/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/.gitignore @@ -0,0 +1 @@ +/build diff --git a/wrappers/android/mynteye/libmynteye/build.gradle b/wrappers/android/mynteye/libmynteye/build.gradle new file mode 100644 index 0000000..97f0e29 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion xversions.compileSdk + + defaultConfig { + minSdkVersion xversions.minSdk + targetSdkVersion xversions.targetSdk + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + externalNativeBuild { + // https://developer.android.com/ndk/guides/cmake + cmake { + cppFlags "-std=c++11 -frtti -fexceptions" + } + } + + ndk { + abiFilters xabis + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + externalNativeBuild { + cmake { + path "src/main/cpp/CMakeLists.txt" + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + testImplementation xdeps.junit + androidTestImplementation xdeps.support.test.runner + androidTestImplementation xdeps.support.test.espresso +} diff --git a/wrappers/android/mynteye/libmynteye/proguard-rules.pro b/wrappers/android/mynteye/libmynteye/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java b/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2b84b62 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.slightech.mynteye; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.slightech.mynteye.test", appContext.getPackageName()); + } +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/AndroidManifest.xml b/wrappers/android/mynteye/libmynteye/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7db87f0 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt b/wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000..104bdf3 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt @@ -0,0 +1,67 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.4.1) + +get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../../../../.." ABSOLUTE) +message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}") + +set(MYNTEYE_NAME "mynteye") + +set(MYNTEYE_NAMESPACE "${MYNTEYE_NAME}") +message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}") + +configure_file( + ${MYNTETE_ROOT}/include/mynteye/mynteye.h.in + include/mynteye/mynteye.h @ONLY +) + +## libs + +find_library(log-lib log) + +## targets + +# libmynteye + +add_definitions(-DMYNTEYE_EXPORTS) + +set(MYNTEYE_SRCS + ${MYNTETE_ROOT}/src/mynteye/uvc/linux/uvc-v4l2.cc + ${MYNTETE_ROOT}/src/mynteye/types.cc + ${MYNTETE_ROOT}/src/mynteye/util/files.cc + ${MYNTETE_ROOT}/src/mynteye/util/strings.cc + ${MYNTETE_ROOT}/src/mynteye/device/channel/bytes.cc + ${MYNTETE_ROOT}/src/mynteye/device/channel/channels.cc + ${MYNTETE_ROOT}/src/mynteye/device/channel/file_channel.cc + ${MYNTETE_ROOT}/src/mynteye/device/config.cc + ${MYNTETE_ROOT}/src/mynteye/device/context.cc + ${MYNTETE_ROOT}/src/mynteye/device/device.cc + ${MYNTETE_ROOT}/src/mynteye/device/motions.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard/channels_adapter_s.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard/device_s.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard/streams_adapter_s.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s2.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s2.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s2.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s210a.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s210a.cc + ${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s210a.cc + ${MYNTETE_ROOT}/src/mynteye/device/streams.cc + ${MYNTETE_ROOT}/src/mynteye/device/types.cc + ${MYNTETE_ROOT}/src/mynteye/device/utils.cc +) + +list(APPEND MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/miniglog.cc) + +add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS}) +target_link_libraries(${MYNTEYE_NAME} ${log-lib}) + +target_include_directories(${MYNTEYE_NAME} PUBLIC + "$" + "$" + "$" + "$" +) diff --git a/wrappers/android/mynteye/libmynteye/src/test/java/com/slightech/mynteye/ExampleUnitTest.java b/wrappers/android/mynteye/libmynteye/src/test/java/com/slightech/mynteye/ExampleUnitTest.java new file mode 100644 index 0000000..6d3ba42 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/test/java/com/slightech/mynteye/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.slightech.mynteye; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/wrappers/android/mynteye/settings.gradle b/wrappers/android/mynteye/settings.gradle index e7b4def..f04decd 100644 --- a/wrappers/android/mynteye/settings.gradle +++ b/wrappers/android/mynteye/settings.gradle @@ -1 +1 @@ -include ':app' +include ':app', ':libmynteye' From a8796478e6c924f6a8d738a649f4c67f76d2ee80 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Tue, 15 Jan 2019 15:10:59 +0800 Subject: [PATCH 03/57] feat(*): update to androidx and add mynteye jni --- wrappers/android/mynteye/app/build.gradle | 21 +++-- .../mynteye/demo/ExampleInstrumentedTest.java | 4 +- .../mynteye/app/src/main/AndroidManifest.xml | 1 + .../slightech/mynteye/demo/MainActivity.java | 9 +- .../slightech/mynteye/demo/MyApplication.java | 32 +++++++ .../app/src/main/res/layout/activity_main.xml | 4 +- wrappers/android/mynteye/build.gradle | 2 +- wrappers/android/mynteye/gradle.properties | 2 + .../mynteye/gradle/dependencies.gradle | 39 +------- .../gradle/wrapper/gradle-wrapper.properties | 3 +- .../{src/main/cpp => }/CMakeLists.txt | 74 +++++++++++---- .../android/mynteye/libmynteye/build.gradle | 17 +++- .../mynteye/ExampleInstrumentedTest.java | 4 +- .../src/main/cpp/mynteye/cpp/device.hpp | 31 ++++++ .../main/cpp/mynteye/cpp/device_usb_info.hpp | 26 +++++ .../src/main/cpp/mynteye/cpp/format.hpp | 28 ++++++ .../main/cpp/mynteye/cpp/stream_request.hpp | 32 +++++++ .../src/main/cpp/mynteye/impl/device_impl.cpp | 77 +++++++++++++++ .../src/main/cpp/mynteye/impl/device_impl.hpp | 31 ++++++ .../main/cpp/mynteye/impl/type_conversion.hpp | 37 ++++++++ .../src/main/cpp/mynteye/jni/NativeDevice.cpp | 79 ++++++++++++++++ .../src/main/cpp/mynteye/jni/NativeDevice.hpp | 32 +++++++ .../cpp/mynteye/jni/NativeDeviceUsbInfo.cpp | 32 +++++++ .../cpp/mynteye/jni/NativeDeviceUsbInfo.hpp | 34 +++++++ .../src/main/cpp/mynteye/jni/NativeFormat.hpp | 26 +++++ .../cpp/mynteye/jni/NativeStreamRequest.cpp | 37 ++++++++ .../cpp/mynteye/jni/NativeStreamRequest.hpp | 36 +++++++ .../java/com/slightech/mynteye/Device.java | 94 +++++++++++++++++++ .../com/slightech/mynteye/DeviceUsbInfo.java | 50 ++++++++++ .../java/com/slightech/mynteye/Format.java | 15 +++ .../com/slightech/mynteye/StreamRequest.java | 67 +++++++++++++ wrappers/android/mynteye/scripts/.gitignore | 1 + .../android/mynteye/scripts/mynteye.djinni | 33 +++++++ .../android/mynteye/scripts/run_djinni.sh | 83 ++++++++++++++++ 34 files changed, 1018 insertions(+), 75 deletions(-) create mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java rename wrappers/android/mynteye/libmynteye/{src/main/cpp => }/CMakeLists.txt (64%) create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device_usb_info.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/format.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/stream_request.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeFormat.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.cpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.hpp create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/DeviceUsbInfo.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Format.java create mode 100644 wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/StreamRequest.java create mode 100644 wrappers/android/mynteye/scripts/.gitignore create mode 100644 wrappers/android/mynteye/scripts/mynteye.djinni create mode 100755 wrappers/android/mynteye/scripts/run_djinni.sh diff --git a/wrappers/android/mynteye/app/build.gradle b/wrappers/android/mynteye/app/build.gradle index 229eac5..3e74552 100644 --- a/wrappers/android/mynteye/app/build.gradle +++ b/wrappers/android/mynteye/app/build.gradle @@ -8,7 +8,7 @@ android { targetSdkVersion xversions.targetSdk versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { abiFilters xabis } @@ -19,17 +19,26 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation xdeps.support.appcompat - implementation xdeps.support.constraint + implementation 'androidx.appcompat:appcompat:1.1.0-alpha01' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' + + implementation 'com.jakewharton.timber:timber:4.7.1' + + implementation 'com.jakewharton:butterknife:10.0.0' + annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' implementation project(':libmynteye') - testImplementation xdeps.junit - androidTestImplementation xdeps.support.test.runner - androidTestImplementation xdeps.support.test.espresso + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' } diff --git a/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java b/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java index a7c3f03..e30780b 100644 --- a/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java +++ b/wrappers/android/mynteye/app/src/androidTest/java/com/slightech/mynteye/demo/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.slightech.mynteye.demo; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/wrappers/android/mynteye/app/src/main/AndroidManifest.xml b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml index 76abdcc..0e03278 100644 --- a/wrappers/android/mynteye/app/src/main/AndroidManifest.xml +++ b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java index e4578d3..ef9edd7 100644 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java @@ -1,7 +1,10 @@ package com.slightech.mynteye.demo; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; +import com.slightech.mynteye.Device; +import com.slightech.mynteye.DeviceUsbInfo; +import timber.log.Timber; public class MainActivity extends AppCompatActivity { @@ -9,5 +12,9 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + for (DeviceUsbInfo info : Device.query()) { + Timber.i(info.toString()); + } } } diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java new file mode 100644 index 0000000..b72b43d --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MyApplication.java @@ -0,0 +1,32 @@ +package com.slightech.mynteye.demo; + +import android.app.Application; +import timber.log.Timber; + +public class MyApplication extends Application { + + static { + try { + System.loadLibrary("mynteye_jni"); + } catch (UnsatisfiedLinkError e) { + System.err.println("mynteye_jni library failed to load.\n" + e); + } + } + + @Override public void onCreate() { + super.onCreate(); + Timber.plant(new Timber.DebugTree()); + } + + @Override public void onLowMemory() { + super.onLowMemory(); + } + + @Override public void onTrimMemory(int level) { + super.onTrimMemory(level); + } + + @Override public void onTerminate() { + super.onTerminate(); + } +} diff --git a/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml index 3b779f6..8a0f7e4 100644 --- a/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml +++ b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/wrappers/android/mynteye/build.gradle b/wrappers/android/mynteye/build.gradle index e7a3ada..76a5905 100644 --- a/wrappers/android/mynteye/build.gradle +++ b/wrappers/android/mynteye/build.gradle @@ -8,7 +8,7 @@ buildscript { jcenter() } dependencies { - classpath xplugins.android.buildGradle + classpath 'com.android.tools.build:gradle:3.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/wrappers/android/mynteye/gradle.properties b/wrappers/android/mynteye/gradle.properties index 82618ce..d546dea 100644 --- a/wrappers/android/mynteye/gradle.properties +++ b/wrappers/android/mynteye/gradle.properties @@ -6,6 +6,8 @@ # 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. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/wrappers/android/mynteye/gradle/dependencies.gradle b/wrappers/android/mynteye/gradle/dependencies.gradle index c4d7278..9811a55 100644 --- a/wrappers/android/mynteye/gradle/dependencies.gradle +++ b/wrappers/android/mynteye/gradle/dependencies.gradle @@ -1,45 +1,8 @@ ext { - xplugins = [ - 'android': [ - // Gradle: https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google - buildGradle: 'com.android.tools.build:gradle:3.2.1', - ], - ] - xversions = [ 'compileSdk': 28, - 'minSdk': 21, + 'minSdk': 24, 'targetSdk': 28, - - 'androidSupport': '28.0.0', - ] - - xdeps = [ - // Support Library - // https://developer.android.com/topic/libraries/support-library/ - 'support': [ - // Android AppCompat Library V7 - // https://mvnrepository.com/artifact/com.android.support/appcompat-v7?repo=google - 'appcompat': "com.android.support:appcompat-v7:${xversions.androidSupport}", - - // Android ConstraintLayout Solver - // https://mvnrepository.com/artifact/com.android.support.constraint/constraint-layout-solver - 'constraint': 'com.android.support.constraint:constraint-layout:1.1.3', - // Android Multi Dex Library - // https://mvnrepository.com/artifact/com.android.support/multidex - 'multidex': 'com.android.support:multidex:1.0.3', - - // Test apps on Android - // https://developer.android.com/training/testing/ - 'test': [ - 'espresso': 'com.android.support.test.espresso:espresso-core:3.0.2', - 'rules': 'com.android.support.test:rules:1.0.2', - 'runner': 'com.android.support.test:runner:1.0.2', - ], - ], - - // JUnit4: https://github.com/junit-team/junit4 - 'junit': 'junit:junit:4.12', ] xabis = ['arm64-v8a', 'armeabi-v7a'] as String[] diff --git a/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties b/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties index 9a4163a..0c93efd 100644 --- a/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties +++ b/wrappers/android/mynteye/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Tue Jan 15 14:54:17 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt b/wrappers/android/mynteye/libmynteye/CMakeLists.txt similarity index 64% rename from wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt rename to wrappers/android/mynteye/libmynteye/CMakeLists.txt index 104bdf3..31afdd5 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/CMakeLists.txt +++ b/wrappers/android/mynteye/libmynteye/CMakeLists.txt @@ -5,29 +5,46 @@ cmake_minimum_required(VERSION 3.4.1) -get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../../../../.." ABSOLUTE) +get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE) message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}") -set(MYNTEYE_NAME "mynteye") +if(NOT DJINNI_DIR) + if(DEFINED ENV{DJINNI_DIR}) + set(DJINNI_DIR $ENV{DJINNI_DIR}) + else() + set(DJINNI_DIR "$ENV{HOME}/Workspace/Fever/Dropbox/djinni") + endif() +endif() -set(MYNTEYE_NAMESPACE "${MYNTEYE_NAME}") -message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}") +# libs + +## log + +find_library(log-lib log) + +## djinni_jni + +include_directories( + ${DJINNI_DIR}/support-lib/jni +) +add_library(djinni_jni STATIC + ${DJINNI_DIR}/support-lib/jni/djinni_support.cpp +) + +# targets + +## libmynteye + +add_definitions(-DMYNTEYE_EXPORTS) + +set(MYNTEYE_NAMESPACE "mynteye") +#message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}") configure_file( ${MYNTETE_ROOT}/include/mynteye/mynteye.h.in include/mynteye/mynteye.h @ONLY ) -## libs - -find_library(log-lib log) - -## targets - -# libmynteye - -add_definitions(-DMYNTEYE_EXPORTS) - set(MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/uvc/linux/uvc-v4l2.cc ${MYNTETE_ROOT}/src/mynteye/types.cc @@ -56,12 +73,35 @@ set(MYNTEYE_SRCS list(APPEND MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/miniglog.cc) -add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS}) -target_link_libraries(${MYNTEYE_NAME} ${log-lib}) +add_library(mynteye STATIC ${MYNTEYE_SRCS}) +target_link_libraries(mynteye ${log-lib}) -target_include_directories(${MYNTEYE_NAME} PUBLIC +target_include_directories(mynteye PUBLIC "$" "$" "$" "$" ) + +## libmynteye_jni + +set(CPP_DIR "${PROJECT_SOURCE_DIR}/src/main/cpp") + +include_directories( + ${CPP_DIR}/mynteye/cpp + ${CPP_DIR}/mynteye/impl + ${CPP_DIR}/mynteye/jni +) + +set(MYNTEYE_JNI_SRCS "") +foreach(__dir cpp impl jni) + file(GLOB __srcs "${CPP_DIR}/mynteye/${__dir}/*.cpp") + list(APPEND MYNTEYE_JNI_SRCS ${__srcs}) +endforeach() +#message(STATUS "MYNTEYE_JNI_SRCS: ${MYNTEYE_JNI_SRCS}") + +add_library(mynteye_jni SHARED + ${DJINNI_DIR}/support-lib/jni/djinni_main.cpp + ${MYNTEYE_JNI_SRCS} +) +target_link_libraries(mynteye_jni ${log-lib} djinni_jni mynteye) diff --git a/wrappers/android/mynteye/libmynteye/build.gradle b/wrappers/android/mynteye/libmynteye/build.gradle index 97f0e29..b5c3507 100644 --- a/wrappers/android/mynteye/libmynteye/build.gradle +++ b/wrappers/android/mynteye/libmynteye/build.gradle @@ -9,7 +9,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { // https://developer.android.com/ndk/guides/cmake @@ -32,15 +32,22 @@ android { externalNativeBuild { cmake { - path "src/main/cpp/CMakeLists.txt" + path "CMakeLists.txt" } } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - testImplementation xdeps.junit - androidTestImplementation xdeps.support.test.runner - androidTestImplementation xdeps.support.test.espresso + implementation 'androidx.annotation:annotation:1.0.1' + + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' } diff --git a/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java b/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java index 2b84b62..8348283 100644 --- a/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java +++ b/wrappers/android/mynteye/libmynteye/src/androidTest/java/com/slightech/mynteye/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.slightech.mynteye; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp new file mode 100644 index 0000000..6e0214f --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device.hpp @@ -0,0 +1,31 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include +#include + +namespace mynteye_jni { + +struct DeviceUsbInfo; +struct StreamRequest; + +class Device { +public: + virtual ~Device() {} + + static std::vector Query(); + + static std::shared_ptr Create(const DeviceUsbInfo & info); + + virtual std::vector GetStreamRequests() = 0; + + virtual void ConfigStreamRequest(const StreamRequest & request) = 0; + + virtual void Start() = 0; + + virtual void Stop() = 0; +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device_usb_info.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device_usb_info.hpp new file mode 100644 index 0000000..5f93d25 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/device_usb_info.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include +#include +#include + +namespace mynteye_jni { + +struct DeviceUsbInfo final { + int32_t index; + std::string name; + std::string sn; + + DeviceUsbInfo(int32_t index_, + std::string name_, + std::string sn_) + : index(std::move(index_)) + , name(std::move(name_)) + , sn(std::move(sn_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/format.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/format.hpp new file mode 100644 index 0000000..55febf5 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/format.hpp @@ -0,0 +1,28 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include + +namespace mynteye_jni { + +enum class Format : int { + GREY, + YUYV, + BGR888, + RGB888, +}; + +} // namespace mynteye_jni + +namespace std { + +template <> +struct hash<::mynteye_jni::Format> { + size_t operator()(::mynteye_jni::Format type) const { + return std::hash()(static_cast(type)); + } +}; + +} // namespace std diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/stream_request.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/stream_request.hpp new file mode 100644 index 0000000..0238c74 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/cpp/stream_request.hpp @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include "format.hpp" +#include +#include + +namespace mynteye_jni { + +struct StreamRequest final { + int32_t index; + int32_t width; + int32_t height; + Format format; + int32_t fps; + + StreamRequest(int32_t index_, + int32_t width_, + int32_t height_, + Format format_, + int32_t fps_) + : index(std::move(index_)) + , width(std::move(width_)) + , height(std::move(height_)) + , format(std::move(format_)) + , fps(std::move(fps_)) + {} +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp new file mode 100644 index 0000000..f9cb061 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp @@ -0,0 +1,77 @@ +#include "device_impl.hpp" + +#include "mynteye/device/context.h" +#include "mynteye/device/device.h" + +#include "device_usb_info.hpp" +#include "stream_request.hpp" +#include "type_conversion.hpp" + +MYNTEYE_USE_NAMESPACE + +namespace mynteye_jni { + +std::vector Device::Query() { + std::vector infos; + + Context context; + int32_t i = 0; + for (auto&& d : context.devices()) { + infos.emplace_back(i, + d->GetInfo(Info::DEVICE_NAME), + d->GetInfo(Info::SERIAL_NUMBER)); + ++i; + } + + return infos; +} + +std::shared_ptr Device::Create(const DeviceUsbInfo & info) { + Context context; + int32_t i = 0; + for (auto&& d : context.devices()) { + if (i == info.index) { + return std::make_shared(d); + } + ++i; + } + return nullptr; +} + +DeviceImpl::DeviceImpl(const device_t & device) : Device(), device_(device) { +} + +DeviceImpl::~DeviceImpl() { +} + +std::vector DeviceImpl::GetStreamRequests() { + std::vector requests; + + int32_t i = 0; + for (auto&& req : device_->GetStreamRequests()) { + requests.emplace_back(i, + req.width, req.height, to_jni(req.format), req.fps); + ++i; + } + + return requests; +} + +void DeviceImpl::ConfigStreamRequest(const StreamRequest & request) { + int32_t i = 0; + for (auto&& req : device_->GetStreamRequests()) { + if (i == request.index) { + device_->ConfigStreamRequest(req); + return; + } + ++i; + } +} + +void DeviceImpl::Start() { +} + +void DeviceImpl::Stop() { +} + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp new file mode 100644 index 0000000..9462704 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +#include "mynteye/device/device.h" + +#include "device.hpp" + +namespace mynteye_jni { + +class DeviceImpl : public Device { + public: + using device_t = std::shared_ptr; + + explicit DeviceImpl(const device_t & device); + ~DeviceImpl(); + + std::vector GetStreamRequests() override; + + void ConfigStreamRequest(const StreamRequest & request) override; + + void Start() override; + + void Stop() override; + + private: + device_t device_; +}; + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp new file mode 100644 index 0000000..b705f26 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/type_conversion.hpp @@ -0,0 +1,37 @@ +#include + +#include "mynteye/logger.h" +#include "mynteye/types.h" + +#include "format.hpp" + +namespace mynteye_jni { + +using RawFormat = MYNTEYE_NAMESPACE::Format; +using JniFormat = mynteye_jni::Format; + +inline +RawFormat from_jni(const JniFormat& format) { + switch (format) { + case JniFormat::GREY: return RawFormat::GREY; + case JniFormat::YUYV: return RawFormat::YUYV; + case JniFormat::BGR888: return RawFormat::BGR888; + case JniFormat::RGB888: return RawFormat::RGB888; + default: + LOG(FATAL) << "Format is unknown"; + } +} + +inline +JniFormat to_jni(const RawFormat& format) { + switch (format) { + case RawFormat::GREY: return JniFormat::GREY; + case RawFormat::YUYV: return JniFormat::YUYV; + case RawFormat::BGR888: return JniFormat::BGR888; + case RawFormat::RGB888: return JniFormat::RGB888; + default: + LOG(FATAL) << "Format is unknown"; + } +} + +} // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp new file mode 100644 index 0000000..a551ac0 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.cpp @@ -0,0 +1,79 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#include "NativeDevice.hpp" // my header +#include "Marshal.hpp" +#include "NativeDeviceUsbInfo.hpp" +#include "NativeStreamRequest.hpp" + +namespace djinni_generated { + +NativeDevice::NativeDevice() : ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice>("com/slightech/mynteye/Device$CppProxy") {} + +NativeDevice::~NativeDevice() = default; + + +CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + delete reinterpret_cast<::djinni::CppProxyHandle<::mynteye_jni::Device>*>(nativeRef); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_query(JNIEnv* jniEnv, jobject /*this*/) +{ + try { + DJINNI_FUNCTION_PROLOGUE0(jniEnv); + auto r = ::mynteye_jni::Device::Query(); + return ::djinni::release(::djinni::List<::djinni_generated::NativeDeviceUsbInfo>::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_create(JNIEnv* jniEnv, jobject /*this*/, jobject j_info) +{ + try { + DJINNI_FUNCTION_PROLOGUE0(jniEnv); + auto r = ::mynteye_jni::Device::Create(::djinni_generated::NativeDeviceUsbInfo::toCpp(jniEnv, j_info)); + return ::djinni::release(::djinni_generated::NativeDevice::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT jobject JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1getStreamRequests(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + auto r = ref->GetStreamRequests(); + return ::djinni::release(::djinni::List<::djinni_generated::NativeStreamRequest>::fromCpp(jniEnv, r)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */) +} + +CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1configStreamRequest(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_request) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + ref->ConfigStreamRequest(::djinni_generated::NativeStreamRequest::toCpp(jniEnv, j_request)); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1start(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + ref->Start(); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +CJNIEXPORT void JNICALL Java_com_slightech_mynteye_Device_00024CppProxy_native_1stop(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef) +{ + try { + DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef); + const auto& ref = ::djinni::objectFromHandleAddress<::mynteye_jni::Device>(nativeRef); + ref->Stop(); + } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, ) +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.hpp new file mode 100644 index 0000000..98629b8 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDevice.hpp @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include "device.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeDevice final : ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice> { +public: + using CppType = std::shared_ptr<::mynteye_jni::Device>; + using CppOptType = std::shared_ptr<::mynteye_jni::Device>; + using JniType = jobject; + + using Boxed = NativeDevice; + + ~NativeDevice(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass::get()._fromJava(jniEnv, j); } + static ::djinni::LocalRef fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass::get()._toJava(jniEnv, c)}; } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); } + +private: + NativeDevice(); + friend ::djinni::JniClass; + friend ::djinni::JniInterface<::mynteye_jni::Device, NativeDevice>; + +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.cpp new file mode 100644 index 0000000..755af55 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.cpp @@ -0,0 +1,32 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#include "NativeDeviceUsbInfo.hpp" // my header +#include "Marshal.hpp" + +namespace djinni_generated { + +NativeDeviceUsbInfo::NativeDeviceUsbInfo() = default; + +NativeDeviceUsbInfo::~NativeDeviceUsbInfo() = default; + +auto NativeDeviceUsbInfo::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.index)), + ::djinni::get(::djinni::String::fromCpp(jniEnv, c.name)), + ::djinni::get(::djinni::String::fromCpp(jniEnv, c.sn)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeDeviceUsbInfo::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 4); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mIndex)), + ::djinni::String::toCpp(jniEnv, (jstring)jniEnv->GetObjectField(j, data.field_mName)), + ::djinni::String::toCpp(jniEnv, (jstring)jniEnv->GetObjectField(j, data.field_mSn))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.hpp new file mode 100644 index 0000000..0d8b5f3 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeDeviceUsbInfo.hpp @@ -0,0 +1,34 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include "device_usb_info.hpp" +#include "djinni_support.hpp" + +namespace djinni_generated { + +class NativeDeviceUsbInfo final { +public: + using CppType = ::mynteye_jni::DeviceUsbInfo; + using JniType = jobject; + + using Boxed = NativeDeviceUsbInfo; + + ~NativeDeviceUsbInfo(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeDeviceUsbInfo(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/DeviceUsbInfo") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(ILjava/lang/String;Ljava/lang/String;)V") }; + const jfieldID field_mIndex { ::djinni::jniGetFieldID(clazz.get(), "mIndex", "I") }; + const jfieldID field_mName { ::djinni::jniGetFieldID(clazz.get(), "mName", "Ljava/lang/String;") }; + const jfieldID field_mSn { ::djinni::jniGetFieldID(clazz.get(), "mSn", "Ljava/lang/String;") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeFormat.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeFormat.hpp new file mode 100644 index 0000000..36cf938 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeFormat.hpp @@ -0,0 +1,26 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "format.hpp" + +namespace djinni_generated { + +class NativeFormat final : ::djinni::JniEnum { +public: + using CppType = ::mynteye_jni::Format; + using JniType = jobject; + + using Boxed = NativeFormat; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast(::djinni::JniClass::get().ordinal(jniEnv, j)); } + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass::get().create(jniEnv, static_cast(c)); } + +private: + NativeFormat() : JniEnum("com/slightech/mynteye/Format") {} + friend ::djinni::JniClass; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.cpp new file mode 100644 index 0000000..b20eb93 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.cpp @@ -0,0 +1,37 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#include "NativeStreamRequest.hpp" // my header +#include "Marshal.hpp" +#include "NativeFormat.hpp" + +namespace djinni_generated { + +NativeStreamRequest::NativeStreamRequest() = default; + +NativeStreamRequest::~NativeStreamRequest() = default; + +auto NativeStreamRequest::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef { + const auto& data = ::djinni::JniClass::get(); + auto r = ::djinni::LocalRef{jniEnv->NewObject(data.clazz.get(), data.jconstructor, + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.index)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.width)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.height)), + ::djinni::get(::djinni_generated::NativeFormat::fromCpp(jniEnv, c.format)), + ::djinni::get(::djinni::I32::fromCpp(jniEnv, c.fps)))}; + ::djinni::jniExceptionCheck(jniEnv); + return r; +} + +auto NativeStreamRequest::toCpp(JNIEnv* jniEnv, JniType j) -> CppType { + ::djinni::JniLocalScope jscope(jniEnv, 6); + assert(j != nullptr); + const auto& data = ::djinni::JniClass::get(); + return {::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mIndex)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mWidth)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mHeight)), + ::djinni_generated::NativeFormat::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mFormat)), + ::djinni::I32::toCpp(jniEnv, jniEnv->GetIntField(j, data.field_mFps))}; +} + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.hpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.hpp new file mode 100644 index 0000000..bdc80b1 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/jni/NativeStreamRequest.hpp @@ -0,0 +1,36 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +#pragma once + +#include "djinni_support.hpp" +#include "stream_request.hpp" + +namespace djinni_generated { + +class NativeStreamRequest final { +public: + using CppType = ::mynteye_jni::StreamRequest; + using JniType = jobject; + + using Boxed = NativeStreamRequest; + + ~NativeStreamRequest(); + + static CppType toCpp(JNIEnv* jniEnv, JniType j); + static ::djinni::LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c); + +private: + NativeStreamRequest(); + friend ::djinni::JniClass; + + const ::djinni::GlobalRef clazz { ::djinni::jniFindClass("com/slightech/mynteye/StreamRequest") }; + const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "", "(IIILcom/slightech/mynteye/Format;I)V") }; + const jfieldID field_mIndex { ::djinni::jniGetFieldID(clazz.get(), "mIndex", "I") }; + const jfieldID field_mWidth { ::djinni::jniGetFieldID(clazz.get(), "mWidth", "I") }; + const jfieldID field_mHeight { ::djinni::jniGetFieldID(clazz.get(), "mHeight", "I") }; + const jfieldID field_mFormat { ::djinni::jniGetFieldID(clazz.get(), "mFormat", "Lcom/slightech/mynteye/Format;") }; + const jfieldID field_mFps { ::djinni::jniGetFieldID(clazz.get(), "mFps", "I") }; +}; + +} // namespace djinni_generated diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java new file mode 100644 index 0000000..725cd1b --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Device.java @@ -0,0 +1,94 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicBoolean; + +public interface Device { + @NonNull + public ArrayList getStreamRequests(); + + public void configStreamRequest(@NonNull StreamRequest request); + + public void start(); + + public void stop(); + + @NonNull + public static ArrayList query() + { + return CppProxy.query(); + } + + @Nullable + public static Device create(@NonNull DeviceUsbInfo info) + { + return CppProxy.create(info); + } + + static final class CppProxy implements Device + { + private final long nativeRef; + private final AtomicBoolean destroyed = new AtomicBoolean(false); + + private CppProxy(long nativeRef) + { + if (nativeRef == 0) throw new RuntimeException("nativeRef is zero"); + this.nativeRef = nativeRef; + } + + private native void nativeDestroy(long nativeRef); + public void _djinni_private_destroy() + { + boolean destroyed = this.destroyed.getAndSet(true); + if (!destroyed) nativeDestroy(this.nativeRef); + } + protected void finalize() throws java.lang.Throwable + { + _djinni_private_destroy(); + super.finalize(); + } + + @Override + public ArrayList getStreamRequests() + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + return native_getStreamRequests(this.nativeRef); + } + private native ArrayList native_getStreamRequests(long _nativeRef); + + @Override + public void configStreamRequest(StreamRequest request) + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + native_configStreamRequest(this.nativeRef, request); + } + private native void native_configStreamRequest(long _nativeRef, StreamRequest request); + + @Override + public void start() + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + native_start(this.nativeRef); + } + private native void native_start(long _nativeRef); + + @Override + public void stop() + { + assert !this.destroyed.get() : "trying to use a destroyed object"; + native_stop(this.nativeRef); + } + private native void native_stop(long _nativeRef); + + @NonNull + public static native ArrayList query(); + + @Nullable + public static native Device create(@NonNull DeviceUsbInfo info); + } +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/DeviceUsbInfo.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/DeviceUsbInfo.java new file mode 100644 index 0000000..d190c89 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/DeviceUsbInfo.java @@ -0,0 +1,50 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public final class DeviceUsbInfo { + + + /*package*/ final int mIndex; + + /*package*/ final String mName; + + /*package*/ final String mSn; + + public DeviceUsbInfo( + int index, + @NonNull String name, + @NonNull String sn) { + this.mIndex = index; + this.mName = name; + this.mSn = sn; + } + + public int getIndex() { + return mIndex; + } + + @NonNull + public String getName() { + return mName; + } + + @NonNull + public String getSn() { + return mSn; + } + + @Override + public String toString() { + return "DeviceUsbInfo{" + + "mIndex=" + mIndex + + "," + "mName=" + mName + + "," + "mSn=" + mSn + + "}"; + } + +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Format.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Format.java new file mode 100644 index 0000000..860daf6 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/Format.java @@ -0,0 +1,15 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public enum Format { + GREY, + YUYV, + BGR888, + RGB888, + ; +} diff --git a/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/StreamRequest.java b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/StreamRequest.java new file mode 100644 index 0000000..a653e54 --- /dev/null +++ b/wrappers/android/mynteye/libmynteye/src/main/java/com/slightech/mynteye/StreamRequest.java @@ -0,0 +1,67 @@ +// AUTOGENERATED FILE - DO NOT MODIFY! +// This file generated by Djinni from mynteye.djinni + +package com.slightech.mynteye; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public final class StreamRequest { + + + /*package*/ final int mIndex; + + /*package*/ final int mWidth; + + /*package*/ final int mHeight; + + /*package*/ final Format mFormat; + + /*package*/ final int mFps; + + public StreamRequest( + int index, + int width, + int height, + @NonNull Format format, + int fps) { + this.mIndex = index; + this.mWidth = width; + this.mHeight = height; + this.mFormat = format; + this.mFps = fps; + } + + public int getIndex() { + return mIndex; + } + + public int getWidth() { + return mWidth; + } + + public int getHeight() { + return mHeight; + } + + @NonNull + public Format getFormat() { + return mFormat; + } + + public int getFps() { + return mFps; + } + + @Override + public String toString() { + return "StreamRequest{" + + "mIndex=" + mIndex + + "," + "mWidth=" + mWidth + + "," + "mHeight=" + mHeight + + "," + "mFormat=" + mFormat + + "," + "mFps=" + mFps + + "}"; + } + +} diff --git a/wrappers/android/mynteye/scripts/.gitignore b/wrappers/android/mynteye/scripts/.gitignore new file mode 100644 index 0000000..0c9146c --- /dev/null +++ b/wrappers/android/mynteye/scripts/.gitignore @@ -0,0 +1 @@ +/djinni-output-temp/ diff --git a/wrappers/android/mynteye/scripts/mynteye.djinni b/wrappers/android/mynteye/scripts/mynteye.djinni new file mode 100644 index 0000000..236cfc5 --- /dev/null +++ b/wrappers/android/mynteye/scripts/mynteye.djinni @@ -0,0 +1,33 @@ + +format = enum { + grey; + yuyv; + bgr888; + rgb888; +} + +stream_request = record { + index: i32; + width: i32; + height: i32; + format: format; + fps: i32; +} + +device_usb_info = record { + index: i32; + name: string; + sn: string; +} + +device = interface +c { + static query(): list; + + static create(info: device_usb_info): device; + + get_stream_requests(): list; + config_stream_request(request: stream_request); + + start(); + stop(); +} diff --git a/wrappers/android/mynteye/scripts/run_djinni.sh b/wrappers/android/mynteye/scripts/run_djinni.sh new file mode 100755 index 0000000..675cb15 --- /dev/null +++ b/wrappers/android/mynteye/scripts/run_djinni.sh @@ -0,0 +1,83 @@ +#! /usr/bin/env bash +set -e +shopt -s nullglob + +base_dir=$(cd "$(dirname "$0")" && pwd) + +# options + +while getopts "d:i:" opt; do + case "$opt" in + d) djinni_dir="$OPTARG" ;; + i) in_idl="$OPTARG" ;; + ?) echo "Usage: $0 <-d DJINNI_DIR> [-i IN_IDL]" + exit 2 ;; + esac +done + +if [ -z "$djinni_dir" ]; then + echo "<-d DJINNI_DIR> option is required" 1>&2 + exit 2 +fi + +[ -n "$in_idl" ] || in_idl="$base_dir/mynteye.djinni" + +# generate + +djinni_run="$djinni_dir/src/run-assume-built" +if [ ! -x "$djinni_run" ]; then + echo "djinni run file not found: $djinni_run" 1>&2 + exit 2 +fi + +temp_out="$base_dir/djinni-output-temp" + +java_package="com.slightech.mynteye" +cpp_namespace="mynteye_jni" + +[ ! -e "$temp_out" ] || rm -r "$temp_out" +"$djinni_run" \ +--java-out "$temp_out/java" \ +--java-package "$java_package" \ +--java-class-access-modifier "public" \ +--java-generate-interfaces true \ +--java-nullable-annotation "androidx.annotation.Nullable" \ +--java-nonnull-annotation "androidx.annotation.NonNull" \ +--ident-java-field mFooBar \ +\ +--cpp-out "$temp_out/cpp" \ +--cpp-namespace "$cpp_namespace" \ +--ident-cpp-enum-type FooBar \ +--ident-cpp-method FooBar \ +\ +--jni-out "$temp_out/jni" \ +--ident-jni-class NativeFooBar \ +--ident-jni-file NativeFooBar \ +\ +--idl "$in_idl" + +# copy + +mirror() { + local prefix="$1" ; shift + local src="$1" ; shift + local dest="$1" ; shift + mkdir -p "$dest" + rsync -r --delete --checksum --itemize-changes "$src"/ "$dest" | sed "s/^/[$prefix]/" +} + +dst_dir="$base_dir/../libmynteye/src/main" +cpp_out="$dst_dir/cpp/mynteye/cpp" +jni_out="$dst_dir/cpp/mynteye/jni" +java_out="$dst_dir/java/com/slightech/mynteye" + +gen_stamp="$temp_out/gen.stamp" + +echo "Copying generated code to final directories..." +mirror "cpp" "$temp_out/cpp" "$cpp_out" +mirror "jni" "$temp_out/jni" "$jni_out" +mirror "java" "$temp_out/java" "$java_out" + +date > "$gen_stamp" + +echo "djinni completed." From 5105b5ea82b1100751d8d62556a8ee56e01f2657 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Wed, 16 Jan 2019 10:38:46 +0800 Subject: [PATCH 04/57] feat(miniglog): remove log_severity_global --- include/mynteye/logger.h | 1 + include/mynteye/miniglog.h | 8 ++------ src/mynteye/miniglog.cc | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/mynteye/logger.h b/include/mynteye/logger.h index 91b83fb..823fac7 100644 --- a/include/mynteye/logger.h +++ b/include/mynteye/logger.h @@ -86,6 +86,7 @@ struct glog_init { #else #define MYNTEYE_MAX_LOG_LEVEL google::INFO +// #define MYNTEYE_MAX_LOG_LEVEL 2 #include "mynteye/miniglog.h" diff --git a/include/mynteye/miniglog.h b/include/mynteye/miniglog.h index 02d377a..83ca179 100644 --- a/include/mynteye/miniglog.h +++ b/include/mynteye/miniglog.h @@ -157,9 +157,6 @@ class MYNTEYE_API LogSink { // Global set of log sinks. The actual object is defined in logging.cc. MYNTEYE_API extern std::set log_sinks_global; -// Added by chachi - a runtime global maximum log level. Defined in logging.cc -MYNTEYE_API extern int log_severity_global; - inline void InitGoogleLogging(char */*argv*/) { // Do nothing; this is ignored. } @@ -315,9 +312,8 @@ class MYNTEYE_API LoggerVoidify { // Log only if condition is met. Otherwise evaluates to void. #define LOG_IF(severity, condition) \ - (static_cast(severity) > google::log_severity_global || !(condition)) ? \ - (void) 0 : LoggerVoidify() & \ - MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream() + !(condition) ? (void) 0 : LoggerVoidify() & \ + MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream() // Log only if condition is NOT met. Otherwise evaluates to void. #define LOG_IF_FALSE(severity, condition) LOG_IF(severity, !(condition)) diff --git a/src/mynteye/miniglog.cc b/src/mynteye/miniglog.cc index 0bda4be..8825038 100644 --- a/src/mynteye/miniglog.cc +++ b/src/mynteye/miniglog.cc @@ -36,6 +36,4 @@ namespace google { // that there is only one instance of this across the entire program. std::set log_sinks_global; -int log_severity_global(INFO); - } // namespace google From d5311120757a21db572f52c596f47620c53ff4b4 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Wed, 16 Jan 2019 10:41:12 +0800 Subject: [PATCH 05/57] feat(android): add libshell and list devices --- wrappers/android/mynteye/app/build.gradle | 1 + .../mynteye/app/src/main/AndroidManifest.xml | 6 +- .../slightech/mynteye/demo/MainActivity.java | 20 - .../mynteye/demo/ui/BaseActivity.java | 63 + .../mynteye/demo/ui/MainActivity.java | 105 ++ .../mynteye/demo/util/RootUtils.java | 76 ++ .../app/src/main/res/layout/activity_main.xml | 3 +- .../app/src/main/res/menu/menu_main.xml | 9 + .../app/src/main/res/values/strings.xml | 2 + .../src/main/cpp/mynteye/impl/device_impl.cpp | 9 + wrappers/android/mynteye/libshell/.gitignore | 1 + wrappers/android/mynteye/libshell/README.md | 2 + .../android/mynteye/libshell/build.gradle | 29 + .../mynteye/libshell/proguard-rules.pro | 21 + .../libshell/src/main/AndroidManifest.xml | 2 + .../com/stericson/RootShell/RootShell.java | 610 ++++++++++ .../RootShell/containers/RootClass.java | 348 ++++++ .../exceptions/RootDeniedException.java | 32 + .../RootShell/execution/Command.java | 350 ++++++ .../RootShell/execution/JavaCommand.java | 58 + .../stericson/RootShell/execution/Shell.java | 1038 +++++++++++++++++ wrappers/android/mynteye/settings.gradle | 2 +- 22 files changed, 2764 insertions(+), 23 deletions(-) delete mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java create mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/BaseActivity.java create mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java create mode 100644 wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/util/RootUtils.java create mode 100644 wrappers/android/mynteye/app/src/main/res/menu/menu_main.xml create mode 100644 wrappers/android/mynteye/libshell/.gitignore create mode 100644 wrappers/android/mynteye/libshell/README.md create mode 100644 wrappers/android/mynteye/libshell/build.gradle create mode 100644 wrappers/android/mynteye/libshell/proguard-rules.pro create mode 100644 wrappers/android/mynteye/libshell/src/main/AndroidManifest.xml create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/RootShell.java create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/containers/RootClass.java create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/exceptions/RootDeniedException.java create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Command.java create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/JavaCommand.java create mode 100644 wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Shell.java diff --git a/wrappers/android/mynteye/app/build.gradle b/wrappers/android/mynteye/app/build.gradle index 3e74552..5ba3d55 100644 --- a/wrappers/android/mynteye/app/build.gradle +++ b/wrappers/android/mynteye/app/build.gradle @@ -37,6 +37,7 @@ dependencies { annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' implementation project(':libmynteye') + implementation project(':libshell') testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' diff --git a/wrappers/android/mynteye/app/src/main/AndroidManifest.xml b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml index 0e03278..3633dae 100644 --- a/wrappers/android/mynteye/app/src/main/AndroidManifest.xml +++ b/wrappers/android/mynteye/app/src/main/AndroidManifest.xml @@ -3,6 +3,10 @@ xmlns:tools="http://schemas.android.com/tools" package="com.slightech.mynteye.demo"> + + + + - + diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java deleted file mode 100644 index ef9edd7..0000000 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/MainActivity.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.slightech.mynteye.demo; - -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -import com.slightech.mynteye.Device; -import com.slightech.mynteye.DeviceUsbInfo; -import timber.log.Timber; - -public class MainActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - for (DeviceUsbInfo info : Device.query()) { - Timber.i(info.toString()); - } - } -} diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/BaseActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/BaseActivity.java new file mode 100644 index 0000000..aa35d74 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/BaseActivity.java @@ -0,0 +1,63 @@ +package com.slightech.mynteye.demo.ui; + +import android.annotation.SuppressLint; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import static android.Manifest.permission.CAMERA; +import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE; + +@SuppressLint("Registered") +public class BaseActivity extends AppCompatActivity { + + private final int REQ_PERMISSIONS = 1; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestPermissions(); + } + + private void requestPermissions() { + final String[] permissions = new String[]{WRITE_EXTERNAL_STORAGE, CAMERA}; + + boolean granted = true; + for (String permission : permissions) { + if (ContextCompat.checkSelfPermission(this, permission) + != PackageManager.PERMISSION_GRANTED) { + granted = false; + } + } + if (granted) return; + + ActivityCompat.requestPermissions(this, permissions, REQ_PERMISSIONS); + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, + @NonNull int[] grantResults) { + if (requestCode == REQ_PERMISSIONS) { + boolean granted = true; + if (grantResults.length < 1) { + granted = false; + } else { + for (int result : grantResults) { + if (result != PackageManager.PERMISSION_GRANTED) { + granted = false; + } + } + } + if (!granted) { + Toast.makeText(this, "Permission denied :(", Toast.LENGTH_LONG).show(); + } + } else { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + } +} diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java new file mode 100644 index 0000000..23abf24 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java @@ -0,0 +1,105 @@ +package com.slightech.mynteye.demo.ui; + +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; +import butterknife.ButterKnife; +import com.slightech.mynteye.Device; +import com.slightech.mynteye.DeviceUsbInfo; +import com.slightech.mynteye.demo.R; +import com.slightech.mynteye.demo.util.RootUtils; +import java.util.ArrayList; +import java.util.Locale; + +public class MainActivity extends BaseActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + ButterKnife.bind(this); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem item = menu.findItem(R.id.action_open); + if (item != null) { + item.setEnabled(false); + actionOpen(() -> item.setEnabled(true)); + } + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.action_open: + item.setEnabled(false); + actionOpen(() -> item.setEnabled(true)); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void actionOpen(final Runnable completeEvent) { + if (!RootUtils.isRooted()) { + alert("Warning", "Root denied :("); + return; + } + RootUtils.requestAccessible(ok -> { + if (completeEvent != null) completeEvent.run(); + if (ok) { + toast("Root granted :)"); + showDevices(); + } else { + alert("Warning", "There are no devices accessible."); + } + }); + } + + private void showDevices() { + ArrayList infos = Device.query(); + if (infos.isEmpty()) { + alert("Warning", "There are no devices :("); + } else { + ArrayList items = new ArrayList<>(); + for (DeviceUsbInfo info : infos) { + items.add(String.format(Locale.getDefault(), "%d, %s, SN: %s", + info.getIndex(), info.getName(), info.getSn())); + } + + AlertDialog dialog = new AlertDialog.Builder(this) + .setTitle("Devices") + .create(); + ListView listView = new ListView(this); + listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items)); + listView.setOnItemClickListener((parent, view, position, id) -> { + dialog.dismiss(); + openDevice(infos.get(position)); + }); + dialog.setView(listView); + dialog.show(); + } + } + + private void openDevice(DeviceUsbInfo info) { + } + + private void toast(CharSequence text) { + Toast.makeText(this, text, Toast.LENGTH_LONG).show(); + } + + private void alert(CharSequence title, CharSequence message) { + new AlertDialog.Builder(this) + .setTitle(title) + .setMessage(message) + .setPositiveButton(android.R.string.ok, null) + .show(); + } +} diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/util/RootUtils.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/util/RootUtils.java new file mode 100644 index 0000000..36c19a4 --- /dev/null +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/util/RootUtils.java @@ -0,0 +1,76 @@ +package com.slightech.mynteye.demo.util; + +import com.stericson.RootShell.RootShell; +import com.stericson.RootShell.exceptions.RootDeniedException; +import com.stericson.RootShell.execution.Command; +import com.stericson.RootShell.execution.Shell; +import java.io.IOException; +import java.util.concurrent.TimeoutException; +import timber.log.Timber; + +public final class RootUtils { + + public interface OnRequestAccessibleListener { + void onRequestAccessible(boolean ok); + } + + public static boolean isRooted() { + if (!RootShell.isRootAvailable()) { + Timber.e("Root not found"); + return false; + } + + try { + RootShell.getShell(true); + } catch (IOException e) { + e.printStackTrace(); + return false; + } catch (TimeoutException e) { + Timber.e("TIMEOUT EXCEPTION!"); + e.printStackTrace(); + return false; + } catch (RootDeniedException e) { + Timber.e("ROOT DENIED EXCEPTION!"); + e.printStackTrace(); + return false; + } + + try { + if (!RootShell.isAccessGiven()) { + Timber.e("ERROR: No root access to this device."); + return false; + } + } catch (Exception e) { + Timber.e("ERROR: could not determine root access to this device."); + return false; + } + + return true; + } + + public static void requestAccessible(OnRequestAccessibleListener l) { + try { + Shell sh = RootShell.getShell(true); + sh.add(new Command(1, "chmod 666 /dev/video*") { + @Override + public void commandOutput(int id, String line) { + Timber.d("commandOutput: %s", line); + super.commandOutput(id, line); + } + @Override + public void commandTerminated(int id, String reason) { + Timber.d("commandTerminated: %s", reason); + } + @Override + public void commandCompleted(int id, int exitcode) { + Timber.d("commandCompleted: %s", ((exitcode == 0) ? "ok" : "fail")); + if (l != null) l.onRequestAccessible(exitcode == 0); + } + }); + sh.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml index 8a0f7e4..32dae9a 100644 --- a/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml +++ b/wrappers/android/mynteye/app/src/main/res/layout/activity_main.xml @@ -5,10 +5,11 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".MainActivity" + tools:context=".ui.MainActivity" > +

+ + diff --git a/wrappers/android/mynteye/app/src/main/res/values/strings.xml b/wrappers/android/mynteye/app/src/main/res/values/strings.xml index d69f619..4cb552d 100644 --- a/wrappers/android/mynteye/app/src/main/res/values/strings.xml +++ b/wrappers/android/mynteye/app/src/main/res/values/strings.xml @@ -1,3 +1,5 @@ mynteye + + Open diff --git a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp index f9cb061..8677b10 100644 --- a/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp +++ b/wrappers/android/mynteye/libmynteye/src/main/cpp/mynteye/impl/device_impl.cpp @@ -2,6 +2,7 @@ #include "mynteye/device/context.h" #include "mynteye/device/device.h" +#include "mynteye/logger.h" #include "device_usb_info.hpp" #include "stream_request.hpp" @@ -12,6 +13,7 @@ MYNTEYE_USE_NAMESPACE namespace mynteye_jni { std::vector Device::Query() { + VLOG(2) << __func__; std::vector infos; Context context; @@ -27,6 +29,7 @@ std::vector Device::Query() { } std::shared_ptr Device::Create(const DeviceUsbInfo & info) { + VLOG(2) << __func__; Context context; int32_t i = 0; for (auto&& d : context.devices()) { @@ -39,12 +42,15 @@ std::shared_ptr Device::Create(const DeviceUsbInfo & info) { } DeviceImpl::DeviceImpl(const device_t & device) : Device(), device_(device) { + VLOG(2) << __func__; } DeviceImpl::~DeviceImpl() { + VLOG(2) << __func__; } std::vector DeviceImpl::GetStreamRequests() { + VLOG(2) << __func__; std::vector requests; int32_t i = 0; @@ -58,6 +64,7 @@ std::vector DeviceImpl::GetStreamRequests() { } void DeviceImpl::ConfigStreamRequest(const StreamRequest & request) { + VLOG(2) << __func__; int32_t i = 0; for (auto&& req : device_->GetStreamRequests()) { if (i == request.index) { @@ -69,9 +76,11 @@ void DeviceImpl::ConfigStreamRequest(const StreamRequest & request) { } void DeviceImpl::Start() { + VLOG(2) << __func__; } void DeviceImpl::Stop() { + VLOG(2) << __func__; } } // namespace mynteye_jni diff --git a/wrappers/android/mynteye/libshell/.gitignore b/wrappers/android/mynteye/libshell/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/wrappers/android/mynteye/libshell/.gitignore @@ -0,0 +1 @@ +/build diff --git a/wrappers/android/mynteye/libshell/README.md b/wrappers/android/mynteye/libshell/README.md new file mode 100644 index 0000000..d9948a7 --- /dev/null +++ b/wrappers/android/mynteye/libshell/README.md @@ -0,0 +1,2 @@ + +* [RootShell](https://github.com/Stericson/RootShell) diff --git a/wrappers/android/mynteye/libshell/build.gradle b/wrappers/android/mynteye/libshell/build.gradle new file mode 100644 index 0000000..f996e9a --- /dev/null +++ b/wrappers/android/mynteye/libshell/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion xversions.compileSdk + + defaultConfig { + minSdkVersion xversions.minSdk + targetSdkVersion xversions.targetSdk + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +} diff --git a/wrappers/android/mynteye/libshell/proguard-rules.pro b/wrappers/android/mynteye/libshell/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/wrappers/android/mynteye/libshell/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/wrappers/android/mynteye/libshell/src/main/AndroidManifest.xml b/wrappers/android/mynteye/libshell/src/main/AndroidManifest.xml new file mode 100644 index 0000000..11442a8 --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/RootShell.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/RootShell.java new file mode 100644 index 0000000..d959e88 --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/RootShell.java @@ -0,0 +1,610 @@ +/* + * This file is part of the RootShell Project: http://code.google.com/p/RootShell/ + * + * Copyright (c) 2014 Stephen Erickson, Chris Ravenscroft + * + * This code is dual-licensed under the terms of the Apache License Version 2.0 and + * the terms of the General Public License (GPL) Version 2. + * You may use this code according to either of these licenses as is most appropriate + * for your project on a case-by-case basis. + * + * The terms of each license can be found in the root directory of this project's repository as well as at: + * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * http://www.gnu.org/licenses/gpl-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under these Licenses is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See each License for the specific language governing permissions and + * limitations under that License. + */ +package com.stericson.RootShell; + + +import com.stericson.RootShell.exceptions.RootDeniedException; +import com.stericson.RootShell.execution.Command; +import com.stericson.RootShell.execution.Shell; + +import android.util.Log; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeoutException; + +public class RootShell { + + // -------------------- + // # Public Variables # + // -------------------- + + public static boolean debugMode = false; + + public static final String version = "RootShell v1.6"; + + /** + * Setting this to false will disable the handler that is used + * by default for the 3 callback methods for Command. + *

+ * By disabling this all callbacks will be called from a thread other than + * the main UI thread. + */ + public static boolean handlerEnabled = true; + + + /** + * Setting this will change the default command timeout. + *

+ * The default is 20000ms + */ + public static int defaultCommandTimeout = 20000; + + public static enum LogLevel { + VERBOSE, + ERROR, + DEBUG, + WARN + } + // -------------------- + // # Public Methods # + // -------------------- + + /** + * This will close all open shells. + */ + public static void closeAllShells() throws IOException { + Shell.closeAll(); + } + + /** + * This will close the custom shell that you opened. + */ + public static void closeCustomShell() throws IOException { + Shell.closeCustomShell(); + } + + /** + * This will close either the root shell or the standard shell depending on what you specify. + * + * @param root a boolean to specify whether to close the root shell or the standard shell. + */ + public static void closeShell(boolean root) throws IOException { + if (root) { + Shell.closeRootShell(); + } else { + Shell.closeShell(); + } + } + + /** + * Use this to check whether or not a file exists on the filesystem. + * + * @param file String that represent the file, including the full path to the + * file and its name. + * @return a boolean that will indicate whether or not the file exists. + */ + public static boolean exists(final String file) { + return exists(file, false); + } + + /** + * Use this to check whether or not a file OR directory exists on the filesystem. + * + * @param file String that represent the file OR the directory, including the full path to the + * file and its name. + * @param isDir boolean that represent whether or not we are looking for a directory + * @return a boolean that will indicate whether or not the file exists. + */ + public static boolean exists(final String file, boolean isDir) { + final List result = new ArrayList(); + + String cmdToExecute = "ls " + (isDir ? "-d " : " "); + + Command command = new Command(0, false, cmdToExecute + file) { + @Override + public void commandOutput(int id, String line) { + RootShell.log(line); + result.add(line); + + super.commandOutput(id, line); + } + }; + + try { + //Try without root... + RootShell.getShell(false).add(command); + commandWait(RootShell.getShell(false), command); + + } catch (Exception e) { + RootShell.log("Exception: " + e); + return false; + } + + for (String line : result) { + if (line.trim().equals(file)) { + return true; + } + } + + result.clear(); + + command = new Command(0, false, cmdToExecute + file) { + @Override + public void commandOutput(int id, String line) { + RootShell.log(line); + result.add(line); + + super.commandOutput(id, line); + } + }; + + try { + RootShell.getShell(true).add(command); + commandWait(RootShell.getShell(true), command); + + } catch (Exception e) { + RootShell.log("Exception: " + e); + return false; + } + + //Avoid concurrent modification... + List final_result = new ArrayList(); + final_result.addAll(result); + + for (String line : final_result) { + if (line.trim().equals(file)) { + return true; + } + } + + return false; + + } + + /** + * @param binaryName String that represent the binary to find. + * @param singlePath boolean that represents whether to return a single path or multiple. + * + * @return List containing the locations the binary was found at. + */ + public static List findBinary(String binaryName, boolean singlePath) { + return findBinary(binaryName, null, singlePath); + } + + /** + * @param binaryName String that represent the binary to find. + * @param searchPaths List which contains the paths to search for this binary in. + * @param singlePath boolean that represents whether to return a single path or multiple. + * + * @return List containing the locations the binary was found at. + */ + public static List findBinary(final String binaryName, List searchPaths, boolean singlePath) { + + final List foundPaths = new ArrayList(); + + boolean found = false; + + if(searchPaths == null) + { + searchPaths = RootShell.getPath(); + } + + RootShell.log("Checking for " + binaryName); + + //Try to use stat first + try { + for (String path : searchPaths) { + + if(!path.endsWith("/")) + { + path += "/"; + } + + final String currentPath = path; + + Command cc = new Command(0, false, "stat " + path + binaryName) { + @Override + public void commandOutput(int id, String line) { + if (line.contains("File: ") && line.contains(binaryName)) { + foundPaths.add(currentPath); + + RootShell.log(binaryName + " was found here: " + currentPath); + } + + RootShell.log(line); + + super.commandOutput(id, line); + } + }; + + cc = RootShell.getShell(false).add(cc); + commandWait(RootShell.getShell(false), cc); + + if(foundPaths.size() > 0 && singlePath) { + break; + } + } + + found = !foundPaths.isEmpty(); + + } catch (Exception e) { + RootShell.log(binaryName + " was not found, more information MAY be available with Debugging on."); + } + + if (!found) { + RootShell.log("Trying second method"); + + for (String path : searchPaths) { + + if(!path.endsWith("/")) + { + path += "/"; + } + + if (RootShell.exists(path + binaryName)) { + RootShell.log(binaryName + " was found here: " + path); + foundPaths.add(path); + + if(foundPaths.size() > 0 && singlePath) { + break; + } + + } else { + RootShell.log(binaryName + " was NOT found here: " + path); + } + } + } + + Collections.reverse(foundPaths); + + return foundPaths; + } + + /** + * This will open or return, if one is already open, a custom shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param shellPath a String to Indicate the path to the shell that you want to open. + * @param timeout an int to Indicate the length of time before giving up on opening a shell. + * @throws TimeoutException + * @throws com.stericson.RootShell.exceptions.RootDeniedException + * @throws IOException + */ + public static Shell getCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException + { + return Shell.startCustomShell(shellPath, timeout); + } + + /** + * This will return the environment variable PATH + * + * @return List A List of Strings representing the environment variable $PATH + */ + public static List getPath() { + return Arrays.asList(System.getenv("PATH").split(":")); + } + + /** + * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param root a boolean to Indicate whether or not you want to open a root shell or a standard shell + * @param timeout an int to Indicate the length of time to wait before giving up on opening a shell. + * @param shellContext the context to execute the shell with + * @param retry a int to indicate how many times the ROOT shell should try to open with root priviliges... + */ + public static Shell getShell(boolean root, int timeout, Shell.ShellContext shellContext, int retry) throws IOException, TimeoutException, RootDeniedException { + if (root) { + return Shell.startRootShell(timeout, shellContext, retry); + } else { + return Shell.startShell(timeout); + } + } + + /** + * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param root a boolean to Indicate whether or not you want to open a root shell or a standard shell + * @param timeout an int to Indicate the length of time to wait before giving up on opening a shell. + * @param shellContext the context to execute the shell with + */ + public static Shell getShell(boolean root, int timeout, Shell.ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException { + return getShell(root, timeout, shellContext, 3); + } + + /** + * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param root a boolean to Indicate whether or not you want to open a root shell or a standard shell + * @param shellContext the context to execute the shell with + */ + public static Shell getShell(boolean root, Shell.ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException { + return getShell(root, 0, shellContext, 3); + } + + /** + * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param root a boolean to Indicate whether or not you want to open a root shell or a standard shell + * @param timeout an int to Indicate the length of time to wait before giving up on opening a shell. + */ + public static Shell getShell(boolean root, int timeout) throws IOException, TimeoutException, RootDeniedException { + return getShell(root, timeout, Shell.defaultContext, 3); + } + + /** + * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output + * and for closing the shell when you are done using it. + * + * @param root a boolean to Indicate whether or not you want to open a root shell or a standard shell + */ + public static Shell getShell(boolean root) throws IOException, TimeoutException, RootDeniedException { + return RootShell.getShell(root, 0); + } + + /** + * @return true if your app has been given root access. + * @throws TimeoutException if this operation times out. (cannot determine if access is given) + */ + public static boolean isAccessGiven() { + return isAccessGiven(0, 3); + } + + /** + * Control how many time of retries should request + * + * @param timeout The timeout + * @param retries The number of retries + * + * @return true if your app has been given root access. + * @throws TimeoutException if this operation times out. (cannot determine if access is given) + */ + public static boolean isAccessGiven(int timeout, int retries) { + final Set ID = new HashSet(); + final int IAG = 158; + + try { + RootShell.log("Checking for Root access"); + + Command command = new Command(IAG, false, "id") { + @Override + public void commandOutput(int id, String line) { + if (id == IAG) { + ID.addAll(Arrays.asList(line.split(" "))); + } + + super.commandOutput(id, line); + } + }; + + Shell shell = Shell.startRootShell(timeout, retries); + shell.add(command); + commandWait(shell, command); + + //parse the userid + for (String userid : ID) { + RootShell.log(userid); + + if (userid.toLowerCase().contains("uid=0")) { + RootShell.log("Access Given"); + return true; + } + } + + return false; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * @return true if BusyBox was found. + */ + public static boolean isBusyboxAvailable() + { + return isBusyboxAvailable(false); + } + + /** + * @return true if BusyBox or Toybox was found. + */ + public static boolean isBusyboxAvailable(boolean includeToybox) + { + if(includeToybox) { + return (findBinary("busybox", true)).size() > 0 || (findBinary("toybox", true)).size() > 0; + } else { + return (findBinary("busybox", true)).size() > 0; + } + } + + /** + * @return true if su was found. + */ + public static boolean isRootAvailable() { + return (findBinary("su", true)).size() > 0; + } + + /** + * This method allows you to output debug messages only when debugging is on. This will allow + * you to add a debug option to your app, which by default can be left off for performance. + * However, when you need debugging information, a simple switch can enable it and provide you + * with detailed logging. + *

+ * This method handles whether or not to log the information you pass it depending whether or + * not RootShell.debugMode is on. So you can use this and not have to worry about handling it + * yourself. + * + * @param msg The message to output. + */ + public static void log(String msg) { + log(null, msg, LogLevel.DEBUG, null); + } + + /** + * This method allows you to output debug messages only when debugging is on. This will allow + * you to add a debug option to your app, which by default can be left off for performance. + * However, when you need debugging information, a simple switch can enable it and provide you + * with detailed logging. + *

+ * This method handles whether or not to log the information you pass it depending whether or + * not RootShell.debugMode is on. So you can use this and not have to worry about handling it + * yourself. + * + * @param TAG Optional parameter to define the tag that the Log will use. + * @param msg The message to output. + */ + public static void log(String TAG, String msg) { + log(TAG, msg, LogLevel.DEBUG, null); + } + + /** + * This method allows you to output debug messages only when debugging is on. This will allow + * you to add a debug option to your app, which by default can be left off for performance. + * However, when you need debugging information, a simple switch can enable it and provide you + * with detailed logging. + *

+ * This method handles whether or not to log the information you pass it depending whether or + * not RootShell.debugMode is on. So you can use this and not have to worry about handling it + * yourself. + * + * @param msg The message to output. + * @param type The type of log, 1 for verbose, 2 for error, 3 for debug, 4 for warn + * @param e The exception that was thrown (Needed for errors) + */ + public static void log(String msg, LogLevel type, Exception e) { + log(null, msg, type, e); + } + + /** + * This method allows you to check whether logging is enabled. + * Yes, it has a goofy name, but that's to keep it as short as possible. + * After all writing logging calls should be painless. + * This method exists to save Android going through the various Java layers + * that are traversed any time a string is created (i.e. what you are logging) + *

+ * Example usage: + * if(islog) { + * StrinbBuilder sb = new StringBuilder(); + * // ... + * // build string + * // ... + * log(sb.toString()); + * } + * + * @return true if logging is enabled + */ + public static boolean islog() { + return debugMode; + } + + /** + * This method allows you to output debug messages only when debugging is on. This will allow + * you to add a debug option to your app, which by default can be left off for performance. + * However, when you need debugging information, a simple switch can enable it and provide you + * with detailed logging. + *

+ * This method handles whether or not to log the information you pass it depending whether or + * not RootShell.debugMode is on. So you can use this and not have to worry about handling it + * yourself. + * + * @param TAG Optional parameter to define the tag that the Log will use. + * @param msg The message to output. + * @param type The type of log, 1 for verbose, 2 for error, 3 for debug + * @param e The exception that was thrown (Needed for errors) + */ + public static void log(String TAG, String msg, LogLevel type, Exception e) { + if (msg != null && !msg.equals("")) { + if (debugMode) { + if (TAG == null) { + TAG = version; + } + + switch (type) { + case VERBOSE: + Log.v(TAG, msg); + break; + case ERROR: + Log.e(TAG, msg, e); + break; + case DEBUG: + Log.d(TAG, msg); + break; + case WARN: + Log.w(TAG, msg); + break; + } + } + } + } + + // -------------------- + // # Public Methods # + // -------------------- + + private static void commandWait(Shell shell, Command cmd) throws Exception { + while (!cmd.isFinished()) { + + RootShell.log(version, shell.getCommandQueuePositionString(cmd)); + RootShell.log(version, "Processed " + cmd.totalOutputProcessed + " of " + cmd.totalOutput + " output from command."); + + synchronized (cmd) { + try { + if (!cmd.isFinished()) { + cmd.wait(2000); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + if (!cmd.isExecuting() && !cmd.isFinished()) { + if (!shell.isExecuting && !shell.isReading) { + RootShell.log(version, "Waiting for a command to be executed in a shell that is not executing and not reading! \n\n Command: " + cmd.getCommand()); + Exception e = new Exception(); + e.setStackTrace(Thread.currentThread().getStackTrace()); + e.printStackTrace(); + } else if (shell.isExecuting && !shell.isReading) { + RootShell.log(version, "Waiting for a command to be executed in a shell that is executing but not reading! \n\n Command: " + cmd.getCommand()); + Exception e = new Exception(); + e.setStackTrace(Thread.currentThread().getStackTrace()); + e.printStackTrace(); + } else { + RootShell.log(version, "Waiting for a command to be executed in a shell that is not reading! \n\n Command: " + cmd.getCommand()); + Exception e = new Exception(); + e.setStackTrace(Thread.currentThread().getStackTrace()); + e.printStackTrace(); + } + } + + } + } +} diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/containers/RootClass.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/containers/RootClass.java new file mode 100644 index 0000000..9cf7659 --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/containers/RootClass.java @@ -0,0 +1,348 @@ +package com.stericson.RootShell.containers; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileFilter; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/* #ANNOTATIONS @SupportedAnnotationTypes("com.stericson.RootShell.containers.RootClass.Candidate") */ +/* #ANNOTATIONS @SupportedSourceVersion(SourceVersion.RELEASE_6) */ +public class RootClass /* #ANNOTATIONS extends AbstractProcessor */ { + + /* #ANNOTATIONS + @Override + public boolean process(Set typeElements, RoundEnvironment roundEnvironment) { + processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "I was invoked!!!"); + + return false; + } + */ + + static String PATH_TO_DX = "/Users/Chris/Projects/android-sdk-macosx/build-tools/18.0.1/dx"; + + enum READ_STATE { + STARTING, FOUND_ANNOTATION; + } + + public RootClass(String[] args) throws ClassNotFoundException, NoSuchMethodException, + IllegalAccessException, InvocationTargetException, InstantiationException { + + // Note: rather than calling System.load("/system/lib/libandroid_runtime.so"); + // which would leave a bunch of unresolved JNI references, + // we are using the 'withFramework' class as a preloader. + // So, yeah, russian dolls: withFramework > RootClass > actual method + + String className = args[0]; + RootArgs actualArgs = new RootArgs(); + actualArgs.args = new String[args.length - 1]; + System.arraycopy(args, 1, actualArgs.args, 0, args.length - 1); + Class classHandler = Class.forName(className); + Constructor classConstructor = classHandler.getConstructor(RootArgs.class); + classConstructor.newInstance(actualArgs); + } + + public @interface Candidate { + + } + + ; + + public class RootArgs { + + public String args[]; + } + + static void displayError(Exception e) { + // Not using system.err to make it easier to capture from + // calling library. + System.out.println("##ERR##" + e.getMessage() + "##"); + e.printStackTrace(); + } + + // I reckon it would be better to investigate classes using getAttribute() + // however this method allows the developer to simply select "Run" on RootClass + // and immediately re-generate the necessary jar file. + static public class AnnotationsFinder { + + private final String AVOIDDIRPATH = "stericson" + File.separator + "RootShell" + File.separator; + + private List classFiles; + + public AnnotationsFinder() throws IOException { + System.out.println("Discovering root class annotations..."); + classFiles = new ArrayList(); + lookup(new File("src"), classFiles); + System.out.println("Done discovering annotations. Building jar file."); + File builtPath = getBuiltPath(); + if (null != builtPath) { + // Android! Y U no have com.google.common.base.Joiner class? + String rc1 = "com" + File.separator + + "stericson" + File.separator + + "RootShell" + File.separator + + "containers" + File.separator + + "RootClass.class"; + String rc2 = "com" + File.separator + + "stericson" + File.separator + + "RootShell" + File.separator + + "containers" + File.separator + + "RootClass$RootArgs.class"; + String rc3 = "com" + File.separator + + "stericson" + File.separator + + "RootShell" + File.separator + + "containers" + File.separator + + "RootClass$AnnotationsFinder.class"; + String rc4 = "com" + File.separator + + "stericson" + File.separator + + "RootShell" + File.separator + + "containers" + File.separator + + "RootClass$AnnotationsFinder$1.class"; + String rc5 = "com" + File.separator + + "stericson" + File.separator + + "RootShell" + File.separator + + "containers" + File.separator + + "RootClass$AnnotationsFinder$2.class"; + String[] cmd; + boolean onWindows = (-1 != System.getProperty("os.name").toLowerCase().indexOf("win")); + if (onWindows) { + StringBuilder sb = new StringBuilder( + " " + rc1 + " " + rc2 + " " + rc3 + " " + rc4 + " " + rc5 + ); + for (File file : classFiles) { + sb.append(" " + file.getPath()); + } + cmd = new String[]{ + "cmd", "/C", + "jar cvf" + + " anbuild.jar" + + sb.toString() + }; + } else { + ArrayList al = new ArrayList(); + al.add("jar"); + al.add("cf"); + al.add("anbuild.jar"); + al.add(rc1); + al.add(rc2); + al.add(rc3); + al.add(rc4); + al.add(rc5); + for (File file : classFiles) { + al.add(file.getPath()); + } + cmd = al.toArray(new String[al.size()]); + } + ProcessBuilder jarBuilder = new ProcessBuilder(cmd); + jarBuilder.directory(builtPath); + try { + jarBuilder.start().waitFor(); + } catch (IOException e) { + } catch (InterruptedException e) { + } + + String strRawFolder = "res" + File.separator + "raw"; + if (builtPath.toString().startsWith("build")); //Check if running in AndroidStudio + strRawFolder = "src" + File.separator + "main" + File.separator + "res" + File.separator + "raw"; + + File rawFolder = new File(strRawFolder); + if (!rawFolder.exists()) { + rawFolder.mkdirs(); + } + + System.out.println("Done building jar file. Creating dex file."); + if (onWindows) { + cmd = new String[]{ + "cmd", "/C", + "dx --dex --output=" + strRawFolder + File.separator + "anbuild.dex " + + builtPath + File.separator + "anbuild.jar" + }; + } else { + cmd = new String[]{ + getPathToDx(), + "--dex", + "--output=" + strRawFolder + File.separator + "anbuild.dex", + builtPath + File.separator + "anbuild.jar" + }; + } + ProcessBuilder dexBuilder = new ProcessBuilder(cmd); + try { + dexBuilder.start().waitFor(); + } catch (IOException e) { + } catch (InterruptedException e) { + } + } + System.out.println("All done. ::: anbuild.dex should now be in your project's src" + File.separator + "main" + File.separator + "res" + File.separator + "raw" + File.separator + " folder :::"); + } + + protected void lookup(File path, List fileList) { + String desourcedPath = path.toString().replace("src" + File.separator, "").replace("main" + File.separator + "java" + File.separator, ""); + + File[] files = path.listFiles(new FileFilter() { + @Override + public boolean accept(File file) { + return true; + } + }); + for (File file : files) { + if (file.isDirectory()) { + if (-1 == file.getAbsolutePath().indexOf(AVOIDDIRPATH)) { + lookup(file, fileList); + } + } else { + if (file.getName().endsWith(".java")) { + if (hasClassAnnotation(file)) { + final String fileNamePrefix = file.getName().replace(".java", ""); + final File compiledPath = new File(getBuiltPath().toString() + File.separator + desourcedPath); + File[] classAndInnerClassFiles = compiledPath.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String filename) { + return filename.startsWith(fileNamePrefix); + } + }); + for (final File matchingFile : classAndInnerClassFiles) { + fileList.add(new File(desourcedPath + File.separator + matchingFile.getName())); + } + + } + } + } + } + } + + protected boolean hasClassAnnotation(File file) { + READ_STATE readState = READ_STATE.STARTING; + Pattern p = Pattern.compile(" class ([A-Za-z0-9_]+)"); + try { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line; + while (null != (line = reader.readLine())) { + switch (readState) { + case STARTING: + if (-1 < line.indexOf("@RootClass.Candidate")) { + readState = READ_STATE.FOUND_ANNOTATION; + } + break; + case FOUND_ANNOTATION: + Matcher m = p.matcher(line); + if (m.find()) { + System.out.println(" Found annotated class: " + m.group(0)); + return true; + } else { + System.err.println("Error: unmatched annotation in " + + file.getAbsolutePath()); + readState = READ_STATE.STARTING; + } + break; + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + protected String getPathToDx() throws IOException { + String androidHome = System.getenv("ANDROID_HOME"); + if (null == androidHome) { + throw new IOException("Error: you need to set $ANDROID_HOME globally"); + } + String dxPath = null; + File[] files = new File(androidHome + File.separator + "build-tools").listFiles(); + int recentSdkVersion = 0; + for (File file : files) { + + String fileName = null; + if (file.getName().contains("-")) { + String[] splitFileName = file.getName().split("-"); + if (splitFileName[1].contains("W")) { + char[] fileNameChars = splitFileName[1].toCharArray(); + fileName = String.valueOf(fileNameChars[0]); + } else if (splitFileName[1].contains("rc")) { + continue; //Do not use release candidates + } else { + fileName = splitFileName[1]; + } + } else { + fileName = file.getName(); + } + + int sdkVersion; + + String[] sdkVersionBits = fileName.split("[.]"); + sdkVersion = Integer.parseInt(sdkVersionBits[0]) * 10000; + if (sdkVersionBits.length > 1) { + sdkVersion += Integer.parseInt(sdkVersionBits[1]) * 100; + if (sdkVersionBits.length > 2) { + sdkVersion += Integer.parseInt(sdkVersionBits[2]); + } + } + if (sdkVersion > recentSdkVersion) { + String tentativePath = file.getAbsolutePath() + File.separator + "dx"; + if (new File(tentativePath).exists()) { + recentSdkVersion = sdkVersion; + dxPath = tentativePath; + } + } + } + if (dxPath == null) { + throw new IOException("Error: unable to find dx binary in $ANDROID_HOME"); + } + return dxPath; + } + + protected File getBuiltPath() { + File foundPath = null; + + File ideaPath = new File("out" + File.separator + "production"); // IntelliJ + if (ideaPath.isDirectory()) { + File[] children = ideaPath.listFiles(new FileFilter() { + @Override + public boolean accept(File pathname) { + return pathname.isDirectory(); + } + }); + if (children.length > 0) { + foundPath = new File(ideaPath.getAbsolutePath() + File.separator + children[0].getName()); + } + } + if (null == foundPath) { + File eclipsePath = new File("bin" + File.separator + "classes"); // Eclipse IDE + if (eclipsePath.isDirectory()) { + foundPath = eclipsePath; + } + } + if (null == foundPath) { + File androidStudioPath = new File("build" + File.separator + "intermediates" + File.separator + "classes" + File.separator + "debug"); // Android Studio + if (androidStudioPath.isDirectory()) { + foundPath = androidStudioPath; + } + } + + return foundPath; + } + + + } + + public static void main(String[] args) { + try { + if (args.length == 0) { + new AnnotationsFinder(); + } else { + new RootClass(args); + } + } catch (Exception e) { + displayError(e); + } + } +} \ No newline at end of file diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/exceptions/RootDeniedException.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/exceptions/RootDeniedException.java new file mode 100644 index 0000000..758ba8c --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/exceptions/RootDeniedException.java @@ -0,0 +1,32 @@ +/* + * This file is part of the RootShell Project: https://github.com/Stericson/RootShell + * + * Copyright (c) 2014 Stephen Erickson, Chris Ravenscroft + * + * This code is dual-licensed under the terms of the Apache License Version 2.0 and + * the terms of the General Public License (GPL) Version 2. + * You may use this code according to either of these licenses as is most appropriate + * for your project on a case-by-case basis. + * + * The terms of each license can be found in the root directory of this project's repository as well as at: + * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * http://www.gnu.org/licenses/gpl-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under these Licenses is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See each License for the specific language governing permissions and + * limitations under that License. + */ + +package com.stericson.RootShell.exceptions; + +public class RootDeniedException extends Exception { + + private static final long serialVersionUID = -8713947214162841310L; + + public RootDeniedException(String error) { + super(error); + } +} diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Command.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Command.java new file mode 100644 index 0000000..edb7bad --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Command.java @@ -0,0 +1,350 @@ +/* + * This file is part of the RootShell Project: http://code.google.com/p/RootShell/ + * + * Copyright (c) 2014 Stephen Erickson, Chris Ravenscroft + * + * This code is dual-licensed under the terms of the Apache License Version 2.0 and + * the terms of the General Public License (GPL) Version 2. + * You may use this code according to either of these licenses as is most appropriate + * for your project on a case-by-case basis. + * + * The terms of each license can be found in the root directory of this project's repository as well as at: + * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * http://www.gnu.org/licenses/gpl-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under these Licenses is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See each License for the specific language governing permissions and + * limitations under that License. + */ + +package com.stericson.RootShell.execution; + +import com.stericson.RootShell.RootShell; + +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; + +import java.io.IOException; + +public class Command { + + //directly modified by JavaCommand + protected boolean javaCommand = false; + protected Context context = null; + + public int totalOutput = 0; + + public int totalOutputProcessed = 0; + + ExecutionMonitor executionMonitor = null; + + Handler mHandler = null; + + //Has this command already been used? + protected boolean used = false; + + boolean executing = false; + + String[] command = {}; + + boolean finished = false; + + boolean terminated = false; + + boolean handlerEnabled = true; + + int exitCode = -1; + + int id = 0; + + int timeout = RootShell.defaultCommandTimeout; + + /** + * Constructor for executing a normal shell command + * + * @param id the id of the command being executed + * @param command the command, or commands, to be executed. + */ + public Command(int id, String... command) { + this.command = command; + this.id = id; + + createHandler(RootShell.handlerEnabled); + } + + /** + * Constructor for executing a normal shell command + * + * @param id the id of the command being executed + * @param handlerEnabled when true the handler will be used to call the + * callback methods if possible. + * @param command the command, or commands, to be executed. + */ + public Command(int id, boolean handlerEnabled, String... command) { + this.command = command; + this.id = id; + + createHandler(handlerEnabled); + } + + /** + * Constructor for executing a normal shell command + * + * @param id the id of the command being executed + * @param timeout the time allowed before the shell will give up executing the command + * and throw a TimeoutException. + * @param command the command, or commands, to be executed. + */ + public Command(int id, int timeout, String... command) { + this.command = command; + this.id = id; + this.timeout = timeout; + + createHandler(RootShell.handlerEnabled); + } + + //If you override this you MUST make a final call + //to the super method. The super call should be the last line of this method. + public void commandOutput(int id, String line) { + RootShell.log("Command", "ID: " + id + ", " + line); + totalOutputProcessed++; + } + + public void commandTerminated(int id, String reason) { + //pass + } + + public void commandCompleted(int id, int exitcode) { + //pass + } + + protected final void commandFinished() { + if (!terminated) { + synchronized (this) { + if (mHandler != null && handlerEnabled) { + Message msg = mHandler.obtainMessage(); + Bundle bundle = new Bundle(); + bundle.putInt(CommandHandler.ACTION, CommandHandler.COMMAND_COMPLETED); + msg.setData(bundle); + mHandler.sendMessage(msg); + } else { + commandCompleted(id, exitCode); + } + + RootShell.log("Command " + id + " finished."); + finishCommand(); + } + } + } + + private void createHandler(boolean handlerEnabled) { + + this.handlerEnabled = handlerEnabled; + + if (Looper.myLooper() != null && handlerEnabled) { + RootShell.log("CommandHandler created"); + mHandler = new CommandHandler(); + } else { + RootShell.log("CommandHandler not created"); + } + } + + public final void finish() + { + RootShell.log("Command finished at users request!"); + commandFinished(); + } + + protected final void finishCommand() { + this.executing = false; + this.finished = true; + this.notifyAll(); + } + + + public final String getCommand() { + StringBuilder sb = new StringBuilder(); + + if(javaCommand) { + String filePath = context.getFilesDir().getPath(); + + for (int i = 0; i < command.length; i++) { + /* + * TODO Make withFramework optional for applications + * that do not require access to the fw. -CFR + */ + //export CLASSPATH=/data/user/0/ch.masshardt.emailnotification/files/anbuild.dex ; app_process /system/bin + if (Build.VERSION.SDK_INT > 22) { + //dalvikvm command is not working in Android Marshmallow + sb.append( + "export CLASSPATH=" + filePath + "/anbuild.dex;" + + " app_process /system/bin " + + command[i]); + } else { + sb.append( + "dalvikvm -cp " + filePath + "/anbuild.dex" + + " com.android.internal.util.WithFramework" + + " com.stericson.RootTools.containers.RootClass " + + command[i]); + } + + sb.append('\n'); + } + } + else { + for (int i = 0; i < command.length; i++) { + sb.append(command[i]); + sb.append('\n'); + } + } + + return sb.toString(); + } + + public final boolean isExecuting() { + return executing; + } + + public final boolean isHandlerEnabled() { + return handlerEnabled; + } + + public final boolean isFinished() { + return finished; + } + + public final int getExitCode() { + return this.exitCode; + } + + protected final void setExitCode(int code) { + synchronized (this) { + exitCode = code; + } + } + + protected final void startExecution() { + this.used = true; + executionMonitor = new ExecutionMonitor(this); + executionMonitor.setPriority(Thread.MIN_PRIORITY); + executionMonitor.start(); + executing = true; + } + + public final void terminate() + { + RootShell.log("Terminating command at users request!"); + terminated("Terminated at users request!"); + } + + protected final void terminate(String reason) { + try { + Shell.closeAll(); + RootShell.log("Terminating all shells."); + terminated(reason); + } catch (IOException e) { + } + } + + protected final void terminated(String reason) { + synchronized (Command.this) { + + if (mHandler != null && handlerEnabled) { + Message msg = mHandler.obtainMessage(); + Bundle bundle = new Bundle(); + bundle.putInt(CommandHandler.ACTION, CommandHandler.COMMAND_TERMINATED); + bundle.putString(CommandHandler.TEXT, reason); + msg.setData(bundle); + mHandler.sendMessage(msg); + } else { + commandTerminated(id, reason); + } + + RootShell.log("Command " + id + " did not finish because it was terminated. Termination reason: " + reason); + setExitCode(-1); + terminated = true; + finishCommand(); + } + } + + protected final void output(int id, String line) { + totalOutput++; + + if (mHandler != null && handlerEnabled) { + Message msg = mHandler.obtainMessage(); + Bundle bundle = new Bundle(); + bundle.putInt(CommandHandler.ACTION, CommandHandler.COMMAND_OUTPUT); + bundle.putString(CommandHandler.TEXT, line); + msg.setData(bundle); + mHandler.sendMessage(msg); + } else { + commandOutput(id, line); + } + } + + private class ExecutionMonitor extends Thread { + + private final Command command; + + public ExecutionMonitor(Command command) { + this.command = command; + } + + public void run() { + + if(command.timeout > 0) + { + synchronized (command) { + try { + RootShell.log("Command " + command.id + " is waiting for: " + command.timeout); + command.wait(command.timeout); + } catch (InterruptedException e) { + RootShell.log("Exception: " + e); + } + + if (!command.isFinished()) { + RootShell.log("Timeout Exception has occurred for command: " + command.id + "."); + terminate("Timeout Exception"); + } + } + } + } + } + + private class CommandHandler extends Handler { + + static final public String ACTION = "action"; + + static final public String TEXT = "text"; + + static final public int COMMAND_OUTPUT = 0x01; + + static final public int COMMAND_COMPLETED = 0x02; + + static final public int COMMAND_TERMINATED = 0x03; + + public final void handleMessage(Message msg) { + int action = msg.getData().getInt(ACTION); + String text = msg.getData().getString(TEXT); + + switch (action) { + case COMMAND_OUTPUT: + commandOutput(id, text); + break; + case COMMAND_COMPLETED: + commandCompleted(id, exitCode); + break; + case COMMAND_TERMINATED: + commandTerminated(id, text); + break; + } + } + } +} diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/JavaCommand.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/JavaCommand.java new file mode 100644 index 0000000..032569e --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/JavaCommand.java @@ -0,0 +1,58 @@ +package com.stericson.RootShell.execution; + +import android.content.Context; + +public class JavaCommand extends Command +{ + /** + * Constructor for executing Java commands rather than binaries + * + * @param context needed to execute java command. + */ + public JavaCommand(int id, Context context, String... command) { + super(id, command); + this.context = context; + this.javaCommand = true; + } + + /** + * Constructor for executing Java commands rather than binaries + * + * @param context needed to execute java command. + */ + public JavaCommand(int id, boolean handlerEnabled, Context context, String... command) { + super(id, handlerEnabled, command); + this.context = context; + this.javaCommand = true; + } + + /** + * Constructor for executing Java commands rather than binaries + * + * @param context needed to execute java command. + */ + public JavaCommand(int id, int timeout, Context context, String... command) { + super(id, timeout, command); + this.context = context; + this.javaCommand = true; + } + + + @Override + public void commandOutput(int id, String line) + { + super.commandOutput(id, line); + } + + @Override + public void commandTerminated(int id, String reason) + { + // pass + } + + @Override + public void commandCompleted(int id, int exitCode) + { + // pass + } +} diff --git a/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Shell.java b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Shell.java new file mode 100644 index 0000000..b64923e --- /dev/null +++ b/wrappers/android/mynteye/libshell/src/main/java/com/stericson/RootShell/execution/Shell.java @@ -0,0 +1,1038 @@ +/* + * This file is part of the RootShell Project: http://code.google.com/p/RootShell/ + * + * Copyright (c) 2014 Stephen Erickson, Chris Ravenscroft + * + * This code is dual-licensed under the terms of the Apache License Version 2.0 and + * the terms of the General Public License (GPL) Version 2. + * You may use this code according to either of these licenses as is most appropriate + * for your project on a case-by-case basis. + * + * The terms of each license can be found in the root directory of this project's repository as well as at: + * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * http://www.gnu.org/licenses/gpl-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under these Licenses is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See each License for the specific language governing permissions and + * limitations under that License. + */ +package com.stericson.RootShell.execution; + +import com.stericson.RootShell.RootShell; +import com.stericson.RootShell.exceptions.RootDeniedException; + +import android.content.Context; +import android.util.Log; + +import java.io.BufferedReader; +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeoutException; + +public class Shell { + + public static enum ShellType { + NORMAL, + ROOT, + CUSTOM + } + + //this is only used with root shells + public static enum ShellContext { + NORMAL("normal"), //The normal context... + SHELL("u:r:shell:s0"), //unprivileged shell (such as an adb shell) + SYSTEM_SERVER("u:r:system_server:s0"), // system_server, u:r:system:s0 on some firmwares + SYSTEM_APP("u:r:system_app:s0"), // System apps + PLATFORM_APP("u:r:platform_app:s0"), // System apps + UNTRUSTED_APP("u:r:untrusted_app:s0"), // Third-party apps + RECOVERY("u:r:recovery:s0"), //Recovery + SUPERSU("u:r:supersu:s0"); //SUPER SU default + + private String value; + + private ShellContext(String value) { + this.value = value; + } + + public String getValue() { + return this.value; + } + + } + + //Statics -- visible to all + private static final String token = "F*D^W@#FGF"; + + private static Shell rootShell = null; + + private static Shell shell = null; + + private static Shell customShell = null; + + private static String[] suVersion = new String[]{ + null, null + }; + + //the default context for root shells... + public static ShellContext defaultContext = ShellContext.NORMAL; + + //per shell + private int shellTimeout = 25000; + + private ShellType shellType = null; + + private ShellContext shellContext = Shell.ShellContext.NORMAL; + + private String error = ""; + + private final Process proc; + + private final BufferedReader inputStream; + + private final BufferedReader errorStream; + + private final OutputStreamWriter outputStream; + + private final List commands = new ArrayList(); + + //indicates whether or not to close the shell + private boolean close = false; + + private Boolean isSELinuxEnforcing = null; + + public boolean isExecuting = false; + + public boolean isReading = false; + + public boolean isClosed = false; + + private int maxCommands = 5000; + + private int read = 0; + + private int write = 0; + + private int totalExecuted = 0; + + private int totalRead = 0; + + private boolean isCleaning = false; + + private Shell(String cmd, ShellType shellType, ShellContext shellContext, int shellTimeout) throws IOException, TimeoutException, RootDeniedException { + + RootShell.log("Starting shell: " + cmd); + RootShell.log("Context: " + shellContext.getValue()); + RootShell.log("Timeout: " + shellTimeout); + + this.shellType = shellType; + this.shellTimeout = shellTimeout > 0 ? shellTimeout : this.shellTimeout; + this.shellContext = shellContext; + + if (this.shellContext == ShellContext.NORMAL) { + this.proc = Runtime.getRuntime().exec(cmd); + } else { + String display = getSuVersion(false); + String internal = getSuVersion(true); + + //only done for root shell... + //Right now only SUPERSU supports the --context switch + if (isSELinuxEnforcing() && + (display != null) && + (internal != null) && + (display.endsWith("SUPERSU")) && + (Integer.valueOf(internal) >= 190)) { + cmd += " --context " + this.shellContext.getValue(); + } else { + RootShell.log("Su binary --context switch not supported!"); + RootShell.log("Su binary display version: " + display); + RootShell.log("Su binary internal version: " + internal); + RootShell.log("SELinuxEnforcing: " + isSELinuxEnforcing()); + } + + this.proc = Runtime.getRuntime().exec(cmd); + + } + + this.inputStream = new BufferedReader(new InputStreamReader(this.proc.getInputStream(), "UTF-8")); + this.errorStream = new BufferedReader(new InputStreamReader(this.proc.getErrorStream(), "UTF-8")); + this.outputStream = new OutputStreamWriter(this.proc.getOutputStream(), "UTF-8"); + + /** + * Thread responsible for carrying out the requested operations + */ + Worker worker = new Worker(this); + worker.start(); + + try { + /** + * The flow of execution will wait for the thread to die or wait until the + * given timeout has expired. + * + * The result of the worker, which is determined by the exit code of the worker, + * will tell us if the operation was completed successfully or it the operation + * failed. + */ + worker.join(this.shellTimeout); + + /** + * The operation could not be completed before the timeout occurred. + */ + if (worker.exit == -911) { + + try { + this.proc.destroy(); + } catch (Exception e) { + } + + closeQuietly(this.inputStream); + closeQuietly(this.errorStream); + closeQuietly(this.outputStream); + + throw new TimeoutException(this.error); + } + /** + * Root access denied? + */ + else if (worker.exit == -42) { + + try { + this.proc.destroy(); + } catch (Exception e) { + } + + closeQuietly(this.inputStream); + closeQuietly(this.errorStream); + closeQuietly(this.outputStream); + + throw new RootDeniedException("Root Access Denied"); + } + /** + * Normal exit + */ + else { + /** + * The shell is open. + * + * Start two threads, one to handle the input and one to handle the output. + * + * input, and output are runnables that the threads execute. + */ + Thread si = new Thread(this.input, "Shell Input"); + si.setPriority(Thread.NORM_PRIORITY); + si.start(); + + Thread so = new Thread(this.output, "Shell Output"); + so.setPriority(Thread.NORM_PRIORITY); + so.start(); + } + } catch (InterruptedException ex) { + worker.interrupt(); + Thread.currentThread().interrupt(); + throw new TimeoutException(); + } + } + + + public Command add(Command command) throws IOException { + if (this.close) { + throw new IllegalStateException( + "Unable to add commands to a closed shell"); + } + + if(command.used) { + //The command has been used, don't re-use... + throw new IllegalStateException( + "This command has already been executed. (Don't re-use command instances.)"); + } + + while (this.isCleaning) { + //Don't add commands while cleaning + ; + } + + this.commands.add(command); + + this.notifyThreads(); + + return command; + } + + public final void useCWD(Context context) throws IOException, TimeoutException, RootDeniedException { + add( + new Command( + -1, + false, + "cd " + context.getApplicationInfo().dataDir) + ); + } + + private void cleanCommands() { + this.isCleaning = true; + int toClean = Math.abs(this.maxCommands - (this.maxCommands / 4)); + RootShell.log("Cleaning up: " + toClean); + + for (int i = 0; i < toClean; i++) { + this.commands.remove(0); + } + + this.read = this.commands.size() - 1; + this.write = this.commands.size() - 1; + this.isCleaning = false; + } + + private void closeQuietly(final Reader input) { + try { + if (input != null) { + input.close(); + } + } catch (Exception ignore) { + } + } + + private void closeQuietly(final Writer output) { + try { + if (output != null) { + output.close(); + } + } catch (Exception ignore) { + } + } + + public void close() throws IOException { + RootShell.log("Request to close shell!"); + + int count = 0; + while (isExecuting) { + RootShell.log("Waiting on shell to finish executing before closing..."); + count++; + + //fail safe + if (count > 10000) { + break; + } + + } + + synchronized (this.commands) { + /** + * instruct the two threads monitoring input and output + * of the shell to close. + */ + this.close = true; + this.notifyThreads(); + } + + RootShell.log("Shell Closed!"); + + if (this == Shell.rootShell) { + Shell.rootShell = null; + } else if (this == Shell.shell) { + Shell.shell = null; + } else if (this == Shell.customShell) { + Shell.customShell = null; + } + } + + public static void closeCustomShell() throws IOException { + RootShell.log("Request to close custom shell!"); + + if (Shell.customShell == null) { + return; + } + + Shell.customShell.close(); + } + + public static void closeRootShell() throws IOException { + RootShell.log("Request to close root shell!"); + + if (Shell.rootShell == null) { + return; + } + Shell.rootShell.close(); + } + + public static void closeShell() throws IOException { + RootShell.log("Request to close normal shell!"); + + if (Shell.shell == null) { + return; + } + Shell.shell.close(); + } + + public static void closeAll() throws IOException { + RootShell.log("Request to close all shells!"); + + Shell.closeShell(); + Shell.closeRootShell(); + Shell.closeCustomShell(); + } + + public int getCommandQueuePosition(Command cmd) { + return this.commands.indexOf(cmd); + } + + public String getCommandQueuePositionString(Command cmd) { + return "Command is in position " + getCommandQueuePosition(cmd) + " currently executing command at position " + this.write + " and the number of commands is " + commands.size(); + } + + public static Shell getOpenShell() { + if (Shell.customShell != null) { + return Shell.customShell; + } else if (Shell.rootShell != null) { + return Shell.rootShell; + } else { + return Shell.shell; + } + } + + /** + * From libsuperuser. + * + *

+ * Detects the version of the su binary installed (if any), if supported + * by the binary. Most binaries support two different version numbers, + * the public version that is displayed to users, and an internal + * version number that is used for version number comparisons. Returns + * null if su not available or retrieving the version isn't supported. + *

+ *

+ * Note that su binary version and GUI (APK) version can be completely + * different. + *

+ *

+ * This function caches its result to improve performance on multiple + * calls + *

+ * + * @param internal Request human-readable version or application + * internal version + * @return String containing the su version or null + */ + private synchronized String getSuVersion(boolean internal) { + int idx = internal ? 0 : 1; + if (suVersion[idx] == null) { + String version = null; + + // Replace libsuperuser:Shell.run with manual process execution + Process process; + try { + process = Runtime.getRuntime().exec(internal ? "su -V" : "su -v", null); + process.waitFor(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } catch (InterruptedException e) { + e.printStackTrace(); + return null; + } + + // From libsuperuser:StreamGobbler + List stdout = new ArrayList(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + try { + String line = null; + while ((line = reader.readLine()) != null) { + stdout.add(line); + } + } catch (IOException e) { + } + // make sure our stream is closed and resources will be freed + try { + reader.close(); + } catch (IOException e) { + } + + process.destroy(); + + List ret = stdout; + + if (ret != null) { + for (String line : ret) { + if (!internal) { + if (line.contains(".")) { + version = line; + break; + } + } else { + try { + if (Integer.parseInt(line) > 0) { + version = line; + break; + } + } catch (NumberFormatException e) { + } + } + } + } + + suVersion[idx] = version; + } + return suVersion[idx]; + } + + public static boolean isShellOpen() { + return Shell.shell == null; + } + + public static boolean isCustomShellOpen() { + return Shell.customShell == null; + } + + public static boolean isRootShellOpen() { + return Shell.rootShell == null; + } + + public static boolean isAnyShellOpen() { + return Shell.shell != null || Shell.rootShell != null || Shell.customShell != null; + } + + /** + * From libsuperuser. + * + * Detect if SELinux is set to enforcing, caches result + * + * @return true if SELinux set to enforcing, or false in the case of + * permissive or not present + */ + public synchronized boolean isSELinuxEnforcing() { + if (isSELinuxEnforcing == null) { + Boolean enforcing = null; + + // First known firmware with SELinux built-in was a 4.2 (17) + // leak + if (android.os.Build.VERSION.SDK_INT >= 17) { + + // Detect enforcing through sysfs, not always present + File f = new File("/sys/fs/selinux/enforce"); + if (f.exists()) { + try { + InputStream is = new FileInputStream("/sys/fs/selinux/enforce"); + try { + enforcing = (is.read() == '1'); + } finally { + is.close(); + } + } catch (Exception e) { + } + } + + // 4.4+ builds are enforcing by default, take the gamble + if (enforcing == null) { + enforcing = (android.os.Build.VERSION.SDK_INT >= 19); + } + } + + if (enforcing == null) { + enforcing = false; + } + + isSELinuxEnforcing = enforcing; + } + return isSELinuxEnforcing; + } + + /** + * Runnable to write commands to the open shell. + *

+ * When writing commands we stay in a loop and wait for new + * commands to added to "commands" + *

+ * The notification of a new command is handled by the method add in this class + */ + private Runnable input = new Runnable() { + public void run() { + + try { + while (true) { + + synchronized (commands) { + /** + * While loop is used in the case that notifyAll is called + * and there are still no commands to be written, a rare + * case but one that could happen. + */ + while (!close && write >= commands.size()) { + isExecuting = false; + commands.wait(); + } + } + + if (write >= maxCommands) { + + /** + * wait for the read to catch up. + */ + while (read != write) { + RootShell.log("Waiting for read and write to catch up before cleanup."); + } + /** + * Clean up the commands, stay neat. + */ + cleanCommands(); + } + + /** + * Write the new command + * + * We write the command followed by the token to indicate + * the end of the command execution + */ + if (write < commands.size()) { + isExecuting = true; + Command cmd = commands.get(write); + + if(null != cmd) + { + cmd.startExecution(); + RootShell.log("Executing: " + cmd.getCommand() + " with context: " + shellContext); + + //write the command + outputStream.write(cmd.getCommand()); + outputStream.flush(); + + //write the token... + String line = "\necho " + token + " " + totalExecuted + " $?\n"; + outputStream.write(line); + outputStream.flush(); + + write++; + totalExecuted++; + } + } else if (close) { + /** + * close the thread, the shell is closing. + */ + isExecuting = false; + outputStream.write("\nexit 0\n"); + outputStream.flush(); + RootShell.log("Closing shell"); + return; + } + } + } catch (IOException | InterruptedException e) { + RootShell.log(e.getMessage(), RootShell.LogLevel.ERROR, e); + } + finally { + write = 0; + closeQuietly(outputStream); + } + } + }; + + protected void notifyThreads() { + Thread t = new Thread() { + public void run() { + synchronized (commands) { + commands.notifyAll(); + } + } + }; + + t.start(); + } + + /** + * Runnable to monitor the responses from the open shell. + * + * This include the output and error stream + */ + private Runnable output = new Runnable() { + public void run() { + try { + Command command = null; + + //as long as there is something to read, we will keep reading. + while (!close || inputStream.ready() || read < commands.size()) { + isReading = false; + String outputLine = inputStream.readLine(); + isReading = true; + + /** + * If we receive EOF then the shell closed? + */ + if (outputLine == null) { + break; + } + + if (command == null) { + if (read >= commands.size()) { + if (close) { + break; + } + + continue; + } + + command = commands.get(read); + } + + /** + * trying to determine if all commands have been completed. + * + * if the token is present then the command has finished execution. + */ + int pos = -1; + + pos = outputLine.indexOf(token); + + if (pos == -1) { + /** + * send the output for the implementer to process + */ + command.output(command.id, outputLine); + } else if (pos > 0) { + /** + * token is suffix of output, send output part to implementer + */ + RootShell.log("Found token, line: " + outputLine); + command.output(command.id, outputLine.substring(0, pos)); + } + + if (pos >= 0) { + outputLine = outputLine.substring(pos); + String fields[] = outputLine.split(" "); + + if (fields.length >= 2 && fields[1] != null) { + int id = 0; + + try { + id = Integer.parseInt(fields[1]); + } catch (NumberFormatException e) { + } + + int exitCode = -1; + + try { + exitCode = Integer.parseInt(fields[2]); + } catch (NumberFormatException e) { + } + + if (id == totalRead) { + processErrors(command); + + + /** + * wait for output to be processed... + * + */ + int iterations = 0; + while (command.totalOutput > command.totalOutputProcessed) { + + if(iterations == 0) + { + iterations++; + RootShell.log("Waiting for output to be processed. " + command.totalOutputProcessed + " Of " + command.totalOutput); + } + + try { + + synchronized (this) + { + this.wait(2000); + } + } catch (Exception e) { + RootShell.log(e.getMessage()); + } + } + + RootShell.log("Read all output"); + + command.setExitCode(exitCode); + command.commandFinished(); + + command = null; + + read++; + totalRead++; + continue; + } + } + } + } + + try { + proc.waitFor(); + proc.destroy(); + } catch (Exception e) { + } + + while (read < commands.size()) { + if (command == null) { + command = commands.get(read); + } + + if(command.totalOutput < command.totalOutputProcessed) + { + command.terminated("All output not processed!"); + command.terminated("Did you forget the super.commandOutput call or are you waiting on the command object?"); + } + else + { + command.terminated("Unexpected Termination."); + } + + command = null; + read++; + } + + read = 0; + + } catch (IOException e) { + RootShell.log(e.getMessage(), RootShell.LogLevel.ERROR, e); + } finally { + closeQuietly(outputStream); + closeQuietly(errorStream); + closeQuietly(inputStream); + + RootShell.log("Shell destroyed"); + isClosed = true; + isReading = false; + } + } + }; + + public void processErrors(Command command) { + try { + while (errorStream.ready() && command != null) { + String line = errorStream.readLine(); + + /** + * If we recieve EOF then the shell closed? + */ + if (line == null) { + break; + } + + /** + * send the output for the implementer to process + */ + command.output(command.id, line); + } + } catch (Exception e) { + RootShell.log(e.getMessage(), RootShell.LogLevel.ERROR, e); + } + } + + public static Command runRootCommand(Command command) throws IOException, TimeoutException, RootDeniedException { + return Shell.startRootShell().add(command); + } + + public static Command runCommand(Command command) throws IOException, TimeoutException { + return Shell.startShell().add(command); + } + + public static Shell startRootShell() throws IOException, TimeoutException, RootDeniedException { + return Shell.startRootShell(0, 3); + } + + public static Shell startRootShell(int timeout) throws IOException, TimeoutException, RootDeniedException { + return Shell.startRootShell(timeout, 3); + } + + public static Shell startRootShell(int timeout, int retry) throws IOException, TimeoutException, RootDeniedException { + return Shell.startRootShell(timeout, Shell.defaultContext, retry); + } + + public static Shell startRootShell(int timeout, ShellContext shellContext, int retry) throws IOException, TimeoutException, RootDeniedException { + // keep prompting the user until they accept for x amount of times... + int retries = 0; + + if (Shell.rootShell == null) { + + RootShell.log("Starting Root Shell!"); + String cmd = "su"; + while (Shell.rootShell == null) { + try { + RootShell.log("Trying to open Root Shell, attempt #" + retries); + Shell.rootShell = new Shell(cmd, ShellType.ROOT, shellContext, timeout); + } catch (IOException e) { + if (retries++ >= retry) { + RootShell.log("IOException, could not start shell"); + throw e; + } + } catch (RootDeniedException e) { + if (retries++ >= retry) { + RootShell.log("RootDeniedException, could not start shell"); + throw e; + } + } catch (TimeoutException e) { + if (retries++ >= retry) { + RootShell.log("TimeoutException, could not start shell"); + throw e; + } + } + } + } else if (Shell.rootShell.shellContext != shellContext) { + try { + RootShell.log("Context is different than open shell, switching context... " + Shell.rootShell.shellContext + " VS " + shellContext); + Shell.rootShell.switchRootShellContext(shellContext); + } catch (IOException e) { + if (retries++ >= retry) { + RootShell.log("IOException, could not switch context!"); + throw e; + } + } catch (RootDeniedException e) { + if (retries++ >= retry) { + RootShell.log("RootDeniedException, could not switch context!"); + throw e; + } + } catch (TimeoutException e) { + if (retries++ >= retry) { + RootShell.log("TimeoutException, could not switch context!"); + throw e; + } + } + } else { + RootShell.log("Using Existing Root Shell!"); + } + + return Shell.rootShell; + } + + public static Shell startCustomShell(String shellPath) throws IOException, TimeoutException, RootDeniedException { + return Shell.startCustomShell(shellPath, 0); + } + + public static Shell startCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException { + + if (Shell.customShell == null) { + RootShell.log("Starting Custom Shell!"); + Shell.customShell = new Shell(shellPath, ShellType.CUSTOM, ShellContext.NORMAL, timeout); + } else { + RootShell.log("Using Existing Custom Shell!"); + } + + return Shell.customShell; + } + + public static Shell startShell() throws IOException, TimeoutException { + return Shell.startShell(0); + } + + public static Shell startShell(int timeout) throws IOException, TimeoutException { + + try { + if (Shell.shell == null) { + RootShell.log("Starting Shell!"); + Shell.shell = new Shell("/system/bin/sh", ShellType.NORMAL, ShellContext.NORMAL, timeout); + } else { + RootShell.log("Using Existing Shell!"); + } + return Shell.shell; + } catch (RootDeniedException e) { + //Root Denied should never be thrown. + throw new IOException(); + } + } + + public Shell switchRootShellContext(ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException { + if (this.shellType == ShellType.ROOT) { + try { + Shell.closeRootShell(); + } catch (Exception e) { + RootShell.log("Problem closing shell while trying to switch context..."); + } + + //create new root shell with new context... + + return Shell.startRootShell(this.shellTimeout, shellContext, 3); + } else { + //can only switch context on a root shell... + RootShell.log("Can only switch context on a root shell!"); + return this; + } + } + + protected static class Worker extends Thread { + + public int exit = -911; + + public Shell shell; + + private Worker(Shell shell) { + this.shell = shell; + } + + public void run() { + + /** + * Trying to open the shell. + * + * We echo "Started" and we look for it in the output. + * + * If we find the output then the shell is open and we return. + * + * If we do not find it then we determine the error and report + * it by setting the value of the variable exit + */ + try { + shell.outputStream.write("echo Started\n"); + shell.outputStream.flush(); + + while (true) { + String line = shell.inputStream.readLine(); + + if (line == null) { + throw new EOFException(); + } else if ("".equals(line)) { + continue; + } else if ("Started".equals(line)) { + this.exit = 1; + setShellOom(); + break; + } + + shell.error = "unknown error occurred."; + } + } catch (IOException e) { + exit = -42; + if (e.getMessage() != null) { + shell.error = e.getMessage(); + } else { + shell.error = "RootAccess denied?."; + } + } + + } + + /* + * setOom for shell processes (sh and su if root shell) and discard outputs + * Negative values make the process LESS likely to be killed in an OOM situation + * Positive values make the process MORE likely to be killed in an OOM situation + */ + private void setShellOom() { + try { + Class processClass = shell.proc.getClass(); + Field field; + try { + field = processClass.getDeclaredField("pid"); + } catch (NoSuchFieldException e) { + field = processClass.getDeclaredField("id"); + } + field.setAccessible(true); + int pid = (Integer) field.get(shell.proc); + shell.outputStream.write("(echo -17 > /proc/" + pid + "/oom_adj) &> /dev/null\n"); + shell.outputStream.write("(echo -17 > /proc/$$/oom_adj) &> /dev/null\n"); + shell.outputStream.flush(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/wrappers/android/mynteye/settings.gradle b/wrappers/android/mynteye/settings.gradle index f04decd..7804b01 100644 --- a/wrappers/android/mynteye/settings.gradle +++ b/wrappers/android/mynteye/settings.gradle @@ -1 +1 @@ -include ':app', ':libmynteye' +include ':app', ':libmynteye', ':libshell' From d673a151c961cee72d0f38a561bdd04bd5bd23bf Mon Sep 17 00:00:00 2001 From: John Zhao Date: Wed, 16 Jan 2019 19:42:00 +0800 Subject: [PATCH 06/57] fix(android): fix call complete event --- .../main/java/com/slightech/mynteye/demo/ui/MainActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java index 23abf24..2eec261 100644 --- a/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java +++ b/wrappers/android/mynteye/app/src/main/java/com/slightech/mynteye/demo/ui/MainActivity.java @@ -49,6 +49,7 @@ public class MainActivity extends BaseActivity { private void actionOpen(final Runnable completeEvent) { if (!RootUtils.isRooted()) { + if (completeEvent != null) completeEvent.run(); alert("Warning", "Root denied :("); return; } From 5eb3174edb5a13216a8da9ea457ae2c81608ee4b Mon Sep 17 00:00:00 2001 From: John Zhao Date: Thu, 17 Jan 2019 11:58:55 +0800 Subject: [PATCH 07/57] refactor(android): move djinni jni files to thrid_party --- .../android/mynteye/libmynteye/CMakeLists.txt | 8 +- .../djinni/support-lib/djinni_common.hpp | 33 + .../djinni/support-lib/jni/Marshal.hpp | 536 ++++++++++++++ .../djinni/support-lib/jni/djinni_main.cpp | 31 + .../djinni/support-lib/jni/djinni_support.cpp | 686 ++++++++++++++++++ .../djinni/support-lib/jni/djinni_support.hpp | 658 +++++++++++++++++ .../djinni/support-lib/proxy_cache_impl.hpp | 176 +++++ .../support-lib/proxy_cache_interface.hpp | 185 +++++ 8 files changed, 2312 insertions(+), 1 deletion(-) create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/djinni_common.hpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/jni/Marshal.hpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/jni/djinni_main.cpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/jni/djinni_support.cpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/jni/djinni_support.hpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/proxy_cache_impl.hpp create mode 100644 wrappers/android/mynteye/third_party/djinni/support-lib/proxy_cache_interface.hpp diff --git a/wrappers/android/mynteye/libmynteye/CMakeLists.txt b/wrappers/android/mynteye/libmynteye/CMakeLists.txt index 31afdd5..4f84689 100644 --- a/wrappers/android/mynteye/libmynteye/CMakeLists.txt +++ b/wrappers/android/mynteye/libmynteye/CMakeLists.txt @@ -8,11 +8,17 @@ cmake_minimum_required(VERSION 3.4.1) get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE) message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}") +get_filename_component(PRO_ROOT "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) +message(STATUS "PRO_ROOT: ${PRO_ROOT}") + +set(LIB_ROOT "${PROJECT_SOURCE_DIR}") +message(STATUS "LIB_ROOT: ${LIB_ROOT}") + if(NOT DJINNI_DIR) if(DEFINED ENV{DJINNI_DIR}) set(DJINNI_DIR $ENV{DJINNI_DIR}) else() - set(DJINNI_DIR "$ENV{HOME}/Workspace/Fever/Dropbox/djinni") + set(DJINNI_DIR "${PRO_ROOT}/third_party/djinni") endif() endif() diff --git a/wrappers/android/mynteye/third_party/djinni/support-lib/djinni_common.hpp b/wrappers/android/mynteye/third_party/djinni/support-lib/djinni_common.hpp new file mode 100644 index 0000000..0892a32 --- /dev/null +++ b/wrappers/android/mynteye/third_party/djinni/support-lib/djinni_common.hpp @@ -0,0 +1,33 @@ +// +// Copyright 2015 Dropbox, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#pragma once + +#ifdef _MSC_VER + #define DJINNI_WEAK_DEFINITION // weak attribute not supported by MSVC + #define DJINNI_NORETURN_DEFINITION __declspec(noreturn) + #if _MSC_VER < 1900 // snprintf not implemented prior to VS2015 + #define DJINNI_SNPRINTF snprintf + #define noexcept _NOEXCEPT // work-around for missing noexcept VS2015 + #define constexpr // work-around for missing constexpr VS2015 + #else + #define DJINNI_SNPRINTF _snprintf + #endif +#else + #define DJINNI_WEAK_DEFINITION __attribute__((weak)) + #define DJINNI_NORETURN_DEFINITION __attribute__((noreturn)) + #define DJINNI_SNPRINTF snprintf +#endif diff --git a/wrappers/android/mynteye/third_party/djinni/support-lib/jni/Marshal.hpp b/wrappers/android/mynteye/third_party/djinni/support-lib/jni/Marshal.hpp new file mode 100644 index 0000000..fcced9b --- /dev/null +++ b/wrappers/android/mynteye/third_party/djinni/support-lib/jni/Marshal.hpp @@ -0,0 +1,536 @@ +// +// Copyright 2014 Dropbox, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#pragma once + +#include "djinni_support.hpp" +#include +#include +#include +#include +#include +#include +#include + +namespace djinni +{ + template + class Primitive + { + public: + using CppType = CppT; + using JniType = JniT; + + static CppType toCpp(JNIEnv* /*jniEnv*/, JniType j) noexcept { return static_cast(j); } + static JniType fromCpp(JNIEnv* /*jniEnv*/, CppType c) noexcept { return static_cast(c); } + + struct Boxed + { + using JniType = jobject; + static CppType toCpp(JNIEnv* jniEnv, JniType j) + { + assert(j != nullptr); + const auto& data = JniClass::get(); + assert(jniEnv->IsInstanceOf(j, data.clazz.get())); + auto ret = Primitive::toCpp(jniEnv, Self::unbox(jniEnv, data.method_unbox, j)); + jniExceptionCheck(jniEnv); + return ret; + } + static LocalRef fromCpp(JNIEnv* jniEnv, CppType c) + { + const auto& data = JniClass::get(); + auto ret = jniEnv->CallStaticObjectMethod(data.clazz.get(), data.method_box, Primitive::fromCpp(jniEnv, c)); + jniExceptionCheck(jniEnv); + return {jniEnv, ret}; + } + }; + + protected: + Primitive(const char* javaClassSpec, + const char* staticBoxMethod, + const char* staticBoxMethodSignature, + const char* unboxMethod, + const char* unboxMethodSignature) + : clazz(jniFindClass(javaClassSpec)) + , method_box(jniGetStaticMethodID(clazz.get(), staticBoxMethod, staticBoxMethodSignature)) + , method_unbox(jniGetMethodID(clazz.get(), unboxMethod, unboxMethodSignature)) + {} + + private: + const GlobalRef clazz; + const jmethodID method_box; + const jmethodID method_unbox; + }; + + class Bool : public Primitive + { + Bool() : Primitive("java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", "booleanValue", "()Z") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallBooleanMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class I8 : public Primitive + { + I8() : Primitive("java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", "byteValue", "()B") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallByteMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class I16 : public Primitive + { + I16() : Primitive("java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", "shortValue", "()S") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallShortMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class I32 : public Primitive + { + I32() : Primitive("java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", "intValue", "()I") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallIntMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class I64 : public Primitive + { + I64() : Primitive("java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", "longValue", "()J") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallLongMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class F32 : public Primitive + { + F32() : Primitive("java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", "floatValue", "()F") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallFloatMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + class F64 : public Primitive + { + F64() : Primitive("java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", "doubleValue", "()D") {} + friend JniClass; + friend Primitive; + static JniType unbox(JNIEnv* jniEnv, jmethodID method, jobject j) { + auto result = jniEnv->CallDoubleMethod(j, method); + jniExceptionCheck(jniEnv); + return result; + } + }; + + struct String + { + using CppType = std::string; + using JniType = jstring; + + using Boxed = String; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) + { + assert(j != nullptr); + return jniUTF8FromString(jniEnv, j); + } + + static LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) + { + return {jniEnv, jniStringFromUTF8(jniEnv, c)}; + } + }; + + struct WString + { + using CppType = std::wstring; + using JniType = jstring; + + using Boxed = WString; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) + { + assert(j != nullptr); + return jniWStringFromString(jniEnv, j); + } + + static LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) + { + return {jniEnv, jniStringFromWString(jniEnv, c)}; + } + }; + + struct Binary + { + using CppType = std::vector; + using JniType = jbyteArray; + + using Boxed = Binary; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) + { + assert(j != nullptr); + + std::vector ret; + jsize length = jniEnv->GetArrayLength(j); + jniExceptionCheck(jniEnv); + + if (!length) { + return ret; + } + + { + auto deleter = [jniEnv, j] (void* c) { + if (c) { + jniEnv->ReleasePrimitiveArrayCritical(j, c, JNI_ABORT); + } + }; + + std::unique_ptr ptr( + reinterpret_cast(jniEnv->GetPrimitiveArrayCritical(j, nullptr)), + deleter + ); + + if (ptr) { + // Construct and then move-assign. This copies the elements only once, + // and avoids having to initialize before filling (as with resize()) + ret = std::vector{ptr.get(), ptr.get() + length}; + } else { + // Something failed... + jniExceptionCheck(jniEnv); + } + } + + return ret; + } + + static LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) + { + assert(c.size() <= std::numeric_limits::max()); + auto j = LocalRef(jniEnv, jniEnv->NewByteArray(static_cast(c.size()))); + jniExceptionCheck(jniEnv); + // Using .data() on an empty vector is UB + if(!c.empty()) + { + jniEnv->SetByteArrayRegion(j.get(), 0, jsize(c.size()), reinterpret_cast(c.data())); + } + return j; + } + }; + + struct Date + { + using CppType = std::chrono::system_clock::time_point; + using JniType = jobject; + + using Boxed = Date; + + static CppType toCpp(JNIEnv* jniEnv, JniType j) + { + static const auto POSIX_EPOCH = std::chrono::system_clock::from_time_t(0); + assert(j != nullptr); + const auto & data = JniClass::get(); + assert(jniEnv->IsInstanceOf(j, data.clazz.get())); + auto time_millis = jniEnv->CallLongMethod(j, data.method_get_time); + jniExceptionCheck(jniEnv); + return POSIX_EPOCH + std::chrono::milliseconds{time_millis}; + } + + static LocalRef fromCpp(JNIEnv* jniEnv, const CppType& c) + { + static const auto POSIX_EPOCH = std::chrono::system_clock::from_time_t(0); + const auto & data = JniClass::get(); + const auto cpp_millis = std::chrono::duration_cast(c - POSIX_EPOCH); + const jlong millis = static_cast(cpp_millis.count()); + auto j = LocalRef(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor, millis)); + jniExceptionCheck(jniEnv); + return j; + } + + private: + Date() = default; + friend ::djinni::JniClass; + + const GlobalRef clazz { jniFindClass("java/util/Date") }; + const jmethodID constructor { jniGetMethodID(clazz.get(), "", "(J)V") }; + const jmethodID method_get_time { jniGetMethodID(clazz.get(), "getTime", "()J") }; + }; + + template