Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
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
Administrator
Magisk
Commits
19af5f9e
Commit
19af5f9e
authored
Jan 27, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove JNI; use native Java zipadjust
parent
f37f3306
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
372 deletions
+12
-372
build.gradle
build.gradle
+0
-9
FlashActivity.java
src/main/java/com/topjohnwu/magisk/FlashActivity.java
+1
-1
HideManager.java
src/main/java/com/topjohnwu/magisk/asyncs/HideManager.java
+1
-1
ProcessRepoZip.java
...main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java
+2
-8
ZipUtils.java
src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
+8
-17
CMakeLists.txt
src/main/jni/CMakeLists.txt
+0
-7
jni_glue.c
src/main/jni/jni_glue.c
+0
-19
zipadjust.c
src/main/jni/zipadjust.c
+0
-297
zipadjust.h
src/main/jni/zipadjust.h
+0
-13
No files found.
build.gradle
View file @
19af5f9e
...
...
@@ -10,10 +10,6 @@ android {
targetSdkVersion
27
versionCode
91
versionName
"5.5.5"
ndk
{
moduleName
'zipadjust'
abiFilters
'x86'
,
'x86_64'
,
'armeabi-v7a'
,
'arm64-v8a'
}
javaCompileOptions
{
annotationProcessorOptions
{
argument
(
'butterknife.debuggable'
,
'false'
)
...
...
@@ -36,11 +32,6 @@ android {
preDexLibraries
true
javaMaxHeapSize
"2g"
}
externalNativeBuild
{
cmake
{
path
'src/main/jni/CMakeLists.txt'
}
}
lintOptions
{
disable
'MissingTranslation'
}
...
...
src/main/java/com/topjohnwu/magisk/FlashActivity.java
View file @
19af5f9e
...
...
@@ -96,7 +96,7 @@ public class FlashActivity extends Activity {
reboot
.
setVisibility
(
View
.
GONE
);
logs
=
new
ArrayList
<>();
CallbackList
console
=
new
CallbackList
<
String
>(
new
ArrayList
<>())
{
CallbackList
<
String
>
console
=
new
CallbackList
<
String
>(
new
ArrayList
<>())
{
@Override
public
void
onAddElement
(
String
s
)
{
logs
.
add
(
s
);
...
...
src/main/java/com/topjohnwu/magisk/asyncs/HideManager.java
View file @
19af5f9e
...
...
@@ -123,7 +123,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
apk
.
getOutputStream
(
je
).
write
(
xml
);
// Sign the APK
ZipUtils
.
signZip
(
apk
,
repack
,
false
);
ZipUtils
.
signZip
(
apk
,
repack
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
...
...
src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java
View file @
19af5f9e
...
...
@@ -120,14 +120,8 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
// First remove top folder in Github source zip, temp1 -> temp2
removeTopFolder
(
temp1
,
temp2
);
// Then sign the zip for the first time, temp2 -> temp1
ZipUtils
.
signZip
(
temp2
,
temp1
,
false
);
// Adjust the zip to prevent unzip issues, temp1 -> temp2
ZipUtils
.
zipAdjust
(
temp1
.
getPath
(),
temp2
.
getPath
());
// Finally, sign the whole zip file again, temp2 -> target
ZipUtils
.
signZip
(
temp2
,
mFile
,
true
);
// Then sign the zip
ZipUtils
.
signZip
(
temp2
,
mFile
);
// Delete temp files
temp1
.
delete
();
...
...
src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
View file @
19af5f9e
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.content.res.AssetManager
;
import
com.topjohnwu.crypto.JarMap
;
import
com.topjohnwu.crypto.SignAPK
;
import
com.topjohnwu.magisk.MagiskManager
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
...
...
@@ -18,12 +15,6 @@ import java.util.zip.ZipInputStream;
public
class
ZipUtils
{
static
{
System
.
loadLibrary
(
"zipadjust"
);
}
public
native
static
void
zipAdjust
(
String
filenameIn
,
String
filenameOut
);
public
static
void
unzip
(
File
zip
,
File
folder
,
String
path
,
boolean
junkPath
)
throws
Exception
{
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
zip
));
unzip
(
in
,
folder
,
path
,
junkPath
);
...
...
@@ -57,25 +48,25 @@ public class ZipUtils {
}
}
public
static
void
signZip
(
InputStream
is
,
File
output
,
boolean
minSign
)
throws
Exception
{
public
static
void
signZip
(
InputStream
is
,
File
output
)
throws
Exception
{
try
(
JarMap
map
=
new
JarMap
(
is
,
false
))
{
signZip
(
map
,
output
,
minSign
);
signZip
(
map
,
output
);
}
}
public
static
void
signZip
(
File
input
,
File
output
,
boolean
minSign
)
throws
Exception
{
public
static
void
signZip
(
File
input
,
File
output
)
throws
Exception
{
try
(
JarMap
map
=
new
JarMap
(
input
,
false
))
{
signZip
(
map
,
output
,
minSign
);
signZip
(
map
,
output
);
}
}
public
static
void
signZip
(
JarMap
input
,
File
output
,
boolean
minSign
)
throws
Exception
{
public
static
void
signZip
(
JarMap
input
,
File
output
)
throws
Exception
{
try
(
BufferedOutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
)))
{
signZip
(
input
,
out
,
minSign
);
signZip
(
input
,
out
);
}
}
public
static
void
signZip
(
JarMap
input
,
OutputStream
output
,
boolean
minSign
)
throws
Exception
{
SignAPK
.
signZip
(
null
,
null
,
input
,
output
,
minSign
);
public
static
void
signZip
(
JarMap
input
,
OutputStream
output
)
throws
Exception
{
SignAPK
.
signZip
(
null
,
null
,
input
,
output
);
}
}
src/main/jni/CMakeLists.txt
deleted
100644 → 0
View file @
f37f3306
cmake_minimum_required
(
VERSION 3.6
)
add_library
(
zipadjust SHARED
jni_glue.c
zipadjust.c
)
find_library
(
libz z
)
find_library
(
liblog log
)
target_link_libraries
(
zipadjust
${
libz
}
${
liblog
}
)
src/main/jni/jni_glue.c
deleted
100644 → 0
View file @
f37f3306
//
// Java entry point
//
#include <jni.h>
#include "zipadjust.h"
JNIEXPORT
void
JNICALL
Java_com_topjohnwu_magisk_utils_ZipUtils_zipAdjust
(
JNIEnv
*
env
,
jclass
type
,
jstring
filenameIn_
,
jstring
filenameOut_
)
{
const
char
*
filenameIn
=
(
*
env
)
->
GetStringUTFChars
(
env
,
filenameIn_
,
0
);
const
char
*
filenameOut
=
(
*
env
)
->
GetStringUTFChars
(
env
,
filenameOut_
,
0
);
// TODO
zipadjust
(
filenameIn
,
filenameOut
,
0
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
filenameIn_
,
filenameIn
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
filenameOut_
,
filenameOut
);
}
\ No newline at end of file
src/main/jni/zipadjust.c
deleted
100644 → 0
View file @
f37f3306
This diff is collapsed.
Click to expand it.
src/main/jni/zipadjust.h
deleted
100644 → 0
View file @
f37f3306
#ifndef MAGISKMANAGER_ZIPADJUST_H_H
#define MAGISKMANAGER_ZIPADJUST_H_H
#include <android/log.h>
int
zipadjust
(
const
char
*
filenameIn
,
const
char
*
filenameOut
,
int
decompress
);
#define LOG_TAG "zipadjust"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#endif //MAGISKMANAGER_ZIPADJUST_H_H
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