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
7ba40f92
Commit
7ba40f92
authored
Aug 01, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove busybox in APK, download from internet
parent
345cd179
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
16 deletions
+71
-16
build.gradle
app/build.gradle
+1
-1
MagiskManager.java
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
+5
-14
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+9
-1
DownloadBusybox.java
...ain/java/com/topjohnwu/magisk/asyncs/DownloadBusybox.java
+56
-0
No files found.
app/build.gradle
View file @
7ba40f92
...
@@ -12,7 +12,7 @@ android {
...
@@ -12,7 +12,7 @@ android {
versionName
"5.1.1"
versionName
"5.1.1"
ndk
{
ndk
{
moduleName
'zipadjust'
moduleName
'zipadjust'
abiFilters
'x86'
,
'
armeabi-v7
a'
abiFilters
'x86'
,
'
x86_64'
,
'armeabi-v7a'
,
'arm64-v8
a'
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
View file @
7ba40f92
...
@@ -10,7 +10,6 @@ import android.content.res.Resources;
...
@@ -10,7 +10,6 @@ import android.content.res.Resources;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.text.TextUtils
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
...
@@ -37,10 +36,12 @@ public class MagiskManager extends Application {
...
@@ -37,10 +36,12 @@ public class MagiskManager extends Application {
public
static
final
String
INTENT_SECTION
=
"section"
;
public
static
final
String
INTENT_SECTION
=
"section"
;
public
static
final
String
INTENT_VERSION
=
"version"
;
public
static
final
String
INTENT_VERSION
=
"version"
;
public
static
final
String
INTENT_LINK
=
"link"
;
public
static
final
String
INTENT_LINK
=
"link"
;
public
static
final
String
BUSYBOX_VERSION
=
"1.27.1"
;
public
static
final
String
MAGISKHIDE_PROP
=
"persist.magisk.hide"
;
public
static
final
String
MAGISKHIDE_PROP
=
"persist.magisk.hide"
;
public
static
final
String
DISABLE_INDICATION_PROP
=
"ro.magisk.disable"
;
public
static
final
String
DISABLE_INDICATION_PROP
=
"ro.magisk.disable"
;
public
static
final
String
NOTIFICATION_CHANNEL
=
"magisk_update_notice"
;
public
static
final
String
NOTIFICATION_CHANNEL
=
"magisk_update_notice"
;
public
static
final
String
BUSYBOX_VERSION
=
"1.27.1"
;
public
static
final
String
BUSYBOX_ARM
=
"https://github.com/topjohnwu/ndk-busybox/releases/download/1.27.1/busybox-arm"
;
public
static
final
String
BUSYBOX_X86
=
"https://github.com/topjohnwu/ndk-busybox/releases/download/1.27.1/busybox-x86"
;
// Events
// Events
public
final
CallbackEvent
magiskHideDone
=
new
CallbackEvent
();
public
final
CallbackEvent
magiskHideDone
=
new
CallbackEvent
();
...
@@ -162,17 +163,6 @@ public class MagiskManager extends Application {
...
@@ -162,17 +163,6 @@ public class MagiskManager extends Application {
initSU
();
initSU
();
updateMagiskInfo
();
updateMagiskInfo
();
updateBlockInfo
();
updateBlockInfo
();
// Initialize busybox
File
busybox
=
new
File
(
getApplicationInfo
().
dataDir
+
"/busybox/busybox"
);
if
(!
busybox
.
exists
()
||
!
TextUtils
.
equals
(
prefs
.
getString
(
"busybox_version"
,
""
),
BUSYBOX_VERSION
))
{
shell
.
su
(
"rm -rf "
+
busybox
.
getParentFile
());
busybox
.
getParentFile
().
mkdirs
();
shell
.
su_raw
(
"cp -f "
+
new
File
(
getApplicationInfo
().
nativeLibraryDir
,
"libbusybox.so"
)
+
" "
+
busybox
,
"chmod -R 755 "
+
busybox
.
getParent
(),
busybox
+
" --install -s "
+
busybox
.
getParent
()
);
}
// Initialize prefs
// Initialize prefs
prefs
.
edit
()
prefs
.
edit
()
.
putBoolean
(
"dark_theme"
,
isDarkTheme
)
.
putBoolean
(
"dark_theme"
,
isDarkTheme
)
...
@@ -189,8 +179,9 @@ public class MagiskManager extends Application {
...
@@ -189,8 +179,9 @@ public class MagiskManager extends Application {
.
putString
(
"mnt_ns"
,
String
.
valueOf
(
suNamespaceMode
))
.
putString
(
"mnt_ns"
,
String
.
valueOf
(
suNamespaceMode
))
.
putString
(
"busybox_version"
,
BUSYBOX_VERSION
)
.
putString
(
"busybox_version"
,
BUSYBOX_VERSION
)
.
apply
();
.
apply
();
// Add busybox to PATH
// Add busybox to PATH
shell
.
su_raw
(
"PATH="
+
busybox
.
getParent
()
+
"
:$PATH"
);
shell
.
su_raw
(
"PATH="
+
getApplicationInfo
().
dataDir
+
"/busybox
:$PATH"
);
// Create notification channel on Android O
// Create notification channel on Android O
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
7ba40f92
...
@@ -8,12 +8,15 @@ import android.content.Intent;
...
@@ -8,12 +8,15 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
com.topjohnwu.magisk.asyncs.DownloadBusybox
;
import
com.topjohnwu.magisk.asyncs.LoadModules
;
import
com.topjohnwu.magisk.asyncs.LoadModules
;
import
com.topjohnwu.magisk.asyncs.UpdateRepos
;
import
com.topjohnwu.magisk.asyncs.UpdateRepos
;
import
com.topjohnwu.magisk.components.Activity
;
import
com.topjohnwu.magisk.components.Activity
;
import
com.topjohnwu.magisk.services.UpdateCheckService
;
import
com.topjohnwu.magisk.services.UpdateCheckService
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
public
class
SplashActivity
extends
Activity
{
public
class
SplashActivity
extends
Activity
{
private
static
final
int
UPDATE_SERVICE_ID
=
1
;
private
static
final
int
UPDATE_SERVICE_ID
=
1
;
...
@@ -46,9 +49,14 @@ public class SplashActivity extends Activity{
...
@@ -46,9 +49,14 @@ public class SplashActivity extends Activity{
((
JobScheduler
)
getSystemService
(
Context
.
JOB_SCHEDULER_SERVICE
)).
schedule
(
jobInfo
);
((
JobScheduler
)
getSystemService
(
Context
.
JOB_SCHEDULER_SERVICE
)).
schedule
(
jobInfo
);
}
}
loadModuleTask
.
setCallBack
(()
->
new
UpdateRepos
(
getApplication
()).
exec
());
loadModuleTask
.
setCallBack
(()
->
new
UpdateRepos
(
getApplication
()).
exec
());
File
busybox
=
new
File
(
magiskManager
.
getApplicationInfo
().
dataDir
+
"/busybox/busybox"
);
if
(!
busybox
.
exists
()
||
!
TextUtils
.
equals
(
magiskManager
.
prefs
.
getString
(
"busybox_version"
,
""
),
MagiskManager
.
BUSYBOX_VERSION
))
{
new
DownloadBusybox
(
this
,
busybox
).
exec
();
}
}
}
// Now fire all async tasks
loadModuleTask
.
exec
();
loadModuleTask
.
exec
();
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
...
...
app/src/main/java/com/topjohnwu/magisk/asyncs/DownloadBusybox.java
0 → 100644
View file @
7ba40f92
package
com
.
topjohnwu
.
magisk
.
asyncs
;
import
android.content.Context
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebService
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
public
class
DownloadBusybox
extends
ParallelTask
<
Void
,
Void
,
Void
>
{
private
File
busybox
;
private
Shell
shell
;
public
DownloadBusybox
(
Context
context
,
File
bb
)
{
busybox
=
bb
;
shell
=
Utils
.
getMagiskManager
(
context
).
shell
;
}
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
shell
.
su
(
"rm -rf "
+
busybox
.
getParentFile
());
busybox
.
getParentFile
().
mkdirs
();
try
{
FileOutputStream
out
=
new
FileOutputStream
(
busybox
);
InputStream
in
=
WebService
.
request
(
WebService
.
GET
,
Build
.
SUPPORTED_32_BIT_ABIS
[
0
].
contains
(
"x86"
)
?
MagiskManager
.
BUSYBOX_X86
:
MagiskManager
.
BUSYBOX_ARM
,
null
);
if
(
in
==
null
)
throw
new
IOException
();
byte
[]
buffer
=
new
byte
[
4096
];
int
read
;
while
((
read
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
read
);
}
out
.
close
();
in
.
close
();
shell
.
su_raw
(
"chmod -R 755 "
+
busybox
.
getParent
(),
busybox
+
" --install -s "
+
busybox
.
getParent
()
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
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