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
001f8657
Commit
001f8657
authored
Aug 11, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global Magisk native busybox for Magisk Manager
parent
ea884e7f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
38 deletions
+48
-38
MagiskManager.java
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
+3
-3
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+0
-9
DownloadBusybox.java
...ain/java/com/topjohnwu/magisk/asyncs/DownloadBusybox.java
+45
-26
No files found.
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
View file @
001f8657
...
...
@@ -12,6 +12,7 @@ import android.os.Handler;
import
android.preference.PreferenceManager
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.asyncs.DownloadBusybox
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
import
com.topjohnwu.magisk.database.RepoDatabaseHelper
;
import
com.topjohnwu.magisk.database.SuDatabaseHelper
;
...
...
@@ -40,8 +41,6 @@ public class MagiskManager extends Application {
public
static
final
String
DISABLE_INDICATION_PROP
=
"ro.magisk.disable"
;
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"
;
// Topics
public
final
Topic
magiskHideDone
=
new
Topic
();
...
...
@@ -144,7 +143,6 @@ public class MagiskManager extends Application {
// Locale
defaultLocale
=
Locale
.
getDefault
();
setLocale
();
new
LoadLocale
(
this
).
exec
();
isDarkTheme
=
prefs
.
getBoolean
(
"dark_theme"
,
false
);
if
(
BuildConfig
.
DEBUG
)
{
...
...
@@ -176,6 +174,8 @@ public class MagiskManager extends Application {
}
public
void
init
()
{
new
LoadLocale
(
this
).
exec
();
new
DownloadBusybox
(
this
).
exec
();
getMagiskInfo
();
updateBlockInfo
();
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
001f8657
...
...
@@ -8,15 +8,12 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
com.topjohnwu.magisk.asyncs.DownloadBusybox
;
import
com.topjohnwu.magisk.asyncs.LoadModules
;
import
com.topjohnwu.magisk.asyncs.UpdateRepos
;
import
com.topjohnwu.magisk.components.Activity
;
import
com.topjohnwu.magisk.services.UpdateCheckService
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
public
class
SplashActivity
extends
Activity
{
private
static
final
int
UPDATE_SERVICE_ID
=
1
;
...
...
@@ -49,12 +46,6 @@ public class SplashActivity extends Activity{
((
JobScheduler
)
getSystemService
(
Context
.
JOB_SCHEDULER_SERVICE
)).
schedule
(
jobInfo
);
}
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
();
}
}
loadModuleTask
.
exec
();
...
...
app/src/main/java/com/topjohnwu/magisk/asyncs/DownloadBusybox.java
View file @
001f8657
...
...
@@ -3,7 +3,7 @@ package com.topjohnwu.magisk.asyncs;
import
android.content.Context
;
import
android.os.Build
;
import
com.topjohnwu.magisk.
MagiskManager
;
import
com.topjohnwu.magisk.
utils.Utils
;
import
com.topjohnwu.magisk.utils.WebService
;
import
java.io.File
;
...
...
@@ -13,23 +13,34 @@ import java.io.InputStream;
public
class
DownloadBusybox
extends
ParallelTask
<
Void
,
Void
,
Void
>
{
private
static
final
String
BUSYBOX_ARM
=
"https://github.com/topjohnwu/ndk-busybox/releases/download/1.27.1/busybox-arm"
;
private
static
final
String
BUSYBOX_X86
=
"https://github.com/topjohnwu/ndk-busybox/releases/download/1.27.1/busybox-x86"
;
private
static
final
String
BUSYBOXPATH
=
"/dev/magisk/bin"
;
private
File
busybox
;
public
DownloadBusybox
(
Context
context
,
File
bb
)
{
public
DownloadBusybox
(
Context
context
)
{
super
(
context
);
busybox
=
bb
;
busybox
=
new
File
(
context
.
getCacheDir
(),
"busybox"
);
}
@Override
protected
void
onPreExecute
()
{
getShell
().
su_raw
(
"export PATH="
+
BUSYBOXPATH
+
":$PATH"
);
}
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
getShell
().
su
(
"rm -rf "
+
busybox
.
getParentFile
());
busybox
.
getParentFile
().
mkdirs
();
Context
context
=
getMagiskManager
();
if
(!
Utils
.
itemExist
(
getShell
(),
BUSYBOXPATH
+
"/busybox"
))
{
if
(!
busybox
.
exists
()
&&
Utils
.
checkNetworkStatus
(
context
))
{
Utils
.
removeItem
(
getShell
(),
context
.
getApplicationInfo
().
dataDir
+
"/busybox"
);
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
,
BUSYBOX_X86
:
BUSYBOX_ARM
,
null
);
if
(
in
==
null
)
throw
new
IOException
();
...
...
@@ -40,13 +51,21 @@ public class DownloadBusybox extends ParallelTask<Void, Void, Void> {
}
out
.
close
();
in
.
close
();
getShell
().
su_raw
(
"chmod -R 755 "
+
busybox
.
getParent
(),
busybox
+
" --install -s "
+
busybox
.
getParent
()
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
busybox
.
exists
())
{
getShell
().
su_raw
(
"rm -rf "
+
BUSYBOXPATH
,
"mkdir -p "
+
BUSYBOXPATH
,
"cp "
+
busybox
+
" "
+
BUSYBOXPATH
,
"chmod -R 755 "
+
BUSYBOXPATH
,
BUSYBOXPATH
+
"/busybox --install -s "
+
BUSYBOXPATH
);
}
}
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