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
c7301a51
Commit
c7301a51
authored
Feb 03, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better support for low API levels
parent
72270825
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
22 deletions
+43
-22
build.gradle
app-core/build.gradle
+1
-1
App.java
app-core/src/main/java/com/topjohnwu/magisk/App.java
+2
-2
utils.sh
app-core/src/main/res/raw/utils.sh
+5
-2
SplashActivity.java
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
+16
-13
EnvFixDialog.java
.../full/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java
+16
-0
update_binary.sh
scripts/update_binary.sh
+3
-4
No files found.
app-core/build.gradle
View file @
c7301a51
...
...
@@ -15,7 +15,7 @@ dependencies {
api
project
(
':signing'
)
api
'org.kamranzafar:jtar:2.3'
def
libsuVersion
=
'
d99f481563
'
def
libsuVersion
=
'
2.3.0
'
api
"com.github.topjohnwu.libsu:core:${libsuVersion}"
api
"com.github.topjohnwu.libsu:io:${libsuVersion}"
}
app-core/src/main/java/com/topjohnwu/magisk/App.java
View file @
c7301a51
package
com
.
topjohnwu
.
magisk
;
import
android.app.Application
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
...
...
@@ -12,12 +13,11 @@ import com.topjohnwu.magisk.database.RepoDatabaseHelper;
import
com.topjohnwu.magisk.utils.LocaleManager
;
import
com.topjohnwu.magisk.utils.RootUtils
;
import
com.topjohnwu.net.Networking
;
import
com.topjohnwu.superuser.ContainerApp
;
import
com.topjohnwu.superuser.Shell
;
import
java.util.concurrent.ThreadPoolExecutor
;
public
class
App
extends
ContainerApp
{
public
class
App
extends
Application
{
public
static
App
self
;
public
static
ThreadPoolExecutor
THREAD_POOL
;
...
...
app-core/src/main/res/raw/utils.sh
View file @
c7301a51
...
...
@@ -7,11 +7,14 @@ env_check() {
fix_env
()
{
cd
/data/adb/magisk
local
OLDPATH
=
"
$PATH
"
PATH
=
/sbin:/system/bin:/vendor/bin
sh update-binary extract
PATH
=
"
$OLDPATH
"
./busybox
rm
-f
/sbin/.magisk/busybox/
*
/sbin/.magisk/mirror/bin/busybox
--install
-s
/sbin/.magisk/busybox
rm
-f
update-binary magisk.apk
cd
/
rm
-rf
/sbin/.magisk/busybox/
*
/sbin/.magisk/mirror/bin/busybox
--install
-s
/sbin/.magisk/busybox
}
direct_install
()
{
...
...
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
View file @
c7301a51
...
...
@@ -23,6 +23,22 @@ public class SplashActivity extends BaseActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
Shell
.
getShell
(
shell
->
{
if
(
Config
.
magiskVersionCode
>
0
&&
Config
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
MIN_SUPPORT
)
{
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
unsupport_magisk_title
)
.
setMessage
(
R
.
string
.
unsupport_magisk_message
)
.
setNegativeButton
(
R
.
string
.
ok
,
null
)
.
setOnDismissListener
(
dialog
->
finish
())
.
show
();
}
else
{
initAndStart
();
}
});
}
private
void
initAndStart
()
{
String
pkg
=
Config
.
get
(
Config
.
Key
.
SU_MANAGER
);
if
(
pkg
!=
null
&&
getPackageName
().
equals
(
BuildConfig
.
APPLICATION_ID
))
{
Config
.
remove
(
Config
.
Key
.
SU_MANAGER
);
...
...
@@ -36,19 +52,6 @@ public class SplashActivity extends BaseActivity {
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{}
}
if
(
Config
.
magiskVersionCode
>
0
&&
Config
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
MIN_SUPPORT
)
{
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
unsupport_magisk_title
)
.
setMessage
(
R
.
string
.
unsupport_magisk_message
)
.
setNegativeButton
(
R
.
string
.
ok
,
null
)
.
setOnDismissListener
(
dialog
->
finish
())
.
show
();
}
else
{
initAndStart
();
}
}
private
void
initAndStart
()
{
// Dynamic detect all locales
LocaleManager
.
loadAvailableLocales
(
R
.
string
.
app_changelog
);
...
...
app/src/full/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java
View file @
c7301a51
...
...
@@ -2,14 +2,19 @@ package com.topjohnwu.magisk.dialogs;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.ClassMap
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.SplashActivity
;
import
com.topjohnwu.magisk.tasks.MagiskInstaller
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.io.SuFile
;
import
java.io.IOException
;
import
androidx.annotation.NonNull
;
public
class
EnvFixDialog
extends
CustomAlertDialog
{
...
...
@@ -35,6 +40,17 @@ public class EnvFixDialog extends CustomAlertDialog {
protected
void
onResult
(
boolean
success
)
{
pd
.
dismiss
();
Utils
.
toast
(
success
?
R
.
string
.
setup_done
:
R
.
string
.
setup_fail
,
Toast
.
LENGTH_LONG
);
if
(
success
)
{
// Relaunch the app
try
{
Shell
.
getShell
().
close
();
}
catch
(
IOException
ignored
)
{}
Intent
intent
=
new
Intent
(
activity
,
ClassMap
.
get
(
SplashActivity
.
class
));
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_TASK_ON_HOME
|
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
activity
.
startActivity
(
intent
);
activity
.
finish
();
}
}
}.
exec
();
});
...
...
scripts/update_binary.sh
View file @
c7301a51
#!/sbin/sh
X86_CNT
=
__X86_CNT__
extract_bb
()
{
case
`
uname
-m
`
in
x
*
)
dd
if
=
"
$0
"
of
=
"
$BBBIN
"
bs
=
1024
skip
=
1
count
=
$X86_CNT
;;
*
)
dd
if
=
"
$0
"
of
=
"
$BBBIN
"
bs
=
1024
skip
=
$((
$X86_CNT
+
1
))
;;
esac
touch
"
$BBBIN
"
chmod
755
"
$BBBIN
"
dd
if
=
"
$0
"
of
=
"
$BBBIN
"
bs
=
1024
skip
=
$((
$X86_CNT
+
1
))
"./
$BBBIN
"
>
/dev/null
||
dd
if
=
"
$0
"
of
=
"
$BBBIN
"
bs
=
1024
skip
=
1
count
=
$X86_CNT
}
setup_bb
()
{
BBDIR
=
$TMPDIR
/bin
...
...
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