Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanglei
ReyunSecureSdk
Commits
14ce6561
Commit
14ce6561
authored
Apr 02, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/2
parent
0dfcd92b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
17 additions
and
92 deletions
+17
-92
build.gradle
app/build.gradle
+1
-14
CMakeLists.txt
app/src/main/cpp/CMakeLists.txt
+0
-49
native-lib.cpp
app/src/main/cpp/native-lib.cpp
+0
-11
MainActivity.java
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
+1
-3
MyApplication.java
app/src/main/java/com/reyun/sdktestdemo/MyApplication.java
+0
-1
CMakeLists.txt
wandun/src/main/cpp/CMakeLists.txt
+5
-5
core.c
wandun/src/main/cpp/core.c
+4
-3
jni_helper.h
wandun/src/main/cpp/include/jni_helper.h
+3
-3
wd_syscall.h
wandun/src/main/cpp/include/wd_syscall.h
+3
-3
jni_helper.c
wandun/src/main/cpp/jni_helper.c
+0
-0
wd_syscall.c
wandun/src/main/cpp/wd_syscall.c
+0
-0
No files found.
app/build.gradle
View file @
14ce6561
...
...
@@ -14,14 +14,6 @@ android {
versionName
"1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild
{
cmake
{
cppFlags
""
}
}
ndk
{
abiFilters
"armeabi-v7a"
,
"arm64-v8a"
}
}
buildTypes
{
...
...
@@ -30,12 +22,7 @@ android {
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
externalNativeBuild
{
cmake
{
path
"src/main/cpp/CMakeLists.txt"
version
"3.10.2"
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
...
...
app/src/main/cpp/CMakeLists.txt
deleted
100644 → 0
View file @
0dfcd92b
# 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.10.2
)
# Declares and names the project.
project
(
"sdktestdemo"
)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library
(
# Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp
)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library
(
# Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log
)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries
(
# Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${
log-lib
}
)
\ No newline at end of file
app/src/main/cpp/native-lib.cpp
deleted
100644 → 0
View file @
0dfcd92b
#include <jni.h>
#include <string>
extern
"C"
JNIEXPORT
jstring
JNICALL
Java_com_reyun_sdktestdemo_MainActivity_stringFromJNI
(
JNIEnv
*
env
,
jobject
/* this */
)
{
std
::
string
hello
=
"Hello from C++"
;
return
env
->
NewStringUTF
(
hello
.
c_str
());
}
\ No newline at end of file
app/src/main/java/com/reyun/sdktestdemo/MainActivity.java
View file @
14ce6561
...
...
@@ -19,12 +19,11 @@ public class MainActivity extends AppCompatActivity {
// Example of a call to a native method
TextView
tv
=
findViewById
(
R
.
id
.
sample_text
);
tv
.
setText
(
stringFromJNI
()
);
tv
.
setText
(
"hello world!"
);
}
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public
native
String
stringFromJNI
();
}
\ No newline at end of file
app/src/main/java/com/reyun/sdktestdemo/MyApplication.java
View file @
14ce6561
...
...
@@ -22,7 +22,6 @@ public class MyApplication extends Application {
public
void
onWdId
(
String
wdId
)
{
Log
.
d
(
TAG
,
"onWdId: "
+
wdId
);
}
/*
@Override
public void onError(String errorMsg) {
...
...
wandun/src/main/cpp/CMakeLists.txt
View file @
14ce6561
...
...
@@ -9,18 +9,18 @@ if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a")
wd_syscall64.s
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"armeabi-v7a"
)
set
(
ARCH_DEPENDED
1
_SRC
set
(
ARCH_DEPENDED_SRC
wd_syscall32.s
)
endif
()
set
(
CMAKE_CXX_FLAGS_RELEASE
"-fvisibility=hidden -O3 -fno-unwind-tables"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-fvisibility=hidden -O3 -fno-unwind-tables
-flto
"
)
add_library
(
wdun
SHARED
core.c
pp
wd_syscall.c
pp
jni_helper.c
pp
core.c
wd_syscall.c
jni_helper.c
${
ARCH_DEPENDED_SRC
}
)
...
...
wandun/src/main/cpp/core.c
pp
→
wandun/src/main/cpp/core.c
View file @
14ce6561
...
...
@@ -15,15 +15,16 @@ IMPORTWDSYSCALL
#define WDMAIN_GETWDID_METHOD_SIG "()Ljava/lang/String;"
jstring
jni_get_wdid
(
JNIEnv
*
env
,
jobject
thiz
)
{
}
JNIEXPORT
jint
JNI_OnLoad
(
JavaVM
*
vm
,
void
*
reserved
)
{
int
pid
=
WDSYSCALL
(
SYS_getpid
);
JNIEnv
*
env
=
NULL
;
if
(
vm
->
GetEnv
(
(
void
**
)
&
env
,
JNI_VERSION_1_6
)
==
JNI_TRUE
)
{
jclass
cls
=
env
->
FindClass
(
WDMAIN_CLASS_NAME
);
if
(
(
*
vm
)
->
GetEnv
(
vm
,
(
void
**
)
&
env
,
JNI_VERSION_1_6
)
==
JNI_TRUE
)
{
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
WDMAIN_CLASS_NAME
);
JNINativeMethod
methods
[]
=
{{
WDMAIN_GETWDID_METHOD_NAME
,
WDMAIN_GETWDID_METHOD_SIG
,
(
void
*
)
jni_get_wdid
}};
env
->
RegisterNatives
(
cls
,
methods
,
sizeof
(
methods
)
/
sizeof
(
JNINativeMethod
));
(
*
env
)
->
RegisterNatives
(
env
,
cls
,
methods
,
sizeof
(
methods
)
/
sizeof
(
JNINativeMethod
));
}
cJSON
*
json
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
json
,
"name"
,
"zhanglei"
);
...
...
wandun/src/main/cpp/include/jni_helper.h
View file @
14ce6561
...
...
@@ -9,14 +9,14 @@
void
wdCheckException
(
JNIEnv
*
env
);
char
wdGetMethodRetType
(
const
char
*
sig
);
inline
char
wdGetFieldType
(
const
char
*
sig
)
{
return
*
sig
;
}
char
wdGetFieldType
(
const
char
*
sig
)
{
return
*
sig
;
}
jvalue
wdGetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
jvalue
wdGetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
jobject
wdNewObject
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodSig
,
...);
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...
);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...
);
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
);
jboolean
wdCallStaticBooleanMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jbyte
wdCallStaticByteMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jchar
wdCallStaticCharMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
...
...
wandun/src/main/cpp/include/wd_syscall.h
View file @
14ce6561
...
...
@@ -18,10 +18,10 @@
#endif
#define IMPORTWDSYSCALL \
__attribute__((visibility("hidden"))) extern
"C"
int wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern
"C"
int wd_syscall64(int cmd, ...);
__attribute__((visibility("hidden"))) extern int wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern int wd_syscall64(int cmd, ...);
extern
"C"
int
wd_set_errno
(
int
n
);
int
wd_set_errno
(
int
n
);
#endif //REYUNSDK_WD_SYSCALL_H
wandun/src/main/cpp/jni_helper.c
pp
→
wandun/src/main/cpp/jni_helper.c
View file @
14ce6561
This diff is collapsed.
Click to expand it.
wandun/src/main/cpp/wd_syscall.c
pp
→
wandun/src/main/cpp/wd_syscall.c
View file @
14ce6561
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment