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
45765e29
Commit
45765e29
authored
Feb 06, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final fixes
parent
6e28a260
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
59 deletions
+62
-59
magisk_uninstaller.sh
app/src/main/assets/magisk_uninstaller.sh
+1
-0
InstallFragment.java
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
+43
-38
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+2
-6
SuReceiver.java
.../main/java/com/topjohnwu/magisk/superuser/SuReceiver.java
+16
-15
No files found.
app/src/main/assets/magisk_uninstaller.sh
View file @
45765e29
#!/system/bin/sh
#!/system/bin/sh
[
-z
$BOOTMODE
]
&&
BOOTMODE
=
false
TMPDIR
=
/tmp
TMPDIR
=
/tmp
(
$BOOTMODE
)
&&
TMPDIR
=
/dev/tmp
(
$BOOTMODE
)
&&
TMPDIR
=
/dev/tmp
...
...
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
View file @
45765e29
...
@@ -82,44 +82,49 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
...
@@ -82,44 +82,49 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
.
show
();
});
});
uninstallButton
.
setOnClickListener
(
vi
->
{
if
(
Global
.
Info
.
magiskVersion
<
10.3
)
{
Utils
.
getAlertDialogBuilder
(
getActivity
())
uninstallButton
.
setVisibility
(
View
.
GONE
);
.
setTitle
(
"Uninstall Magisk"
)
}
else
{
.
setMessage
(
"This will remove all modules, MagiskSU, and potentially re-encrypt your device\nAre you sure to process?"
)
uninstallButton
.
setOnClickListener
(
vi
->
{
.
setPositiveButton
(
R
.
string
.
yes
,
(
dialogInterface
,
i
)
->
{
Utils
.
getAlertDialogBuilder
(
getActivity
())
try
{
.
setTitle
(
"Uninstall Magisk"
)
InputStream
in
=
getActivity
().
getAssets
().
open
(
UNINSTALLER
);
.
setMessage
(
"This will remove all modules, MagiskSU, and potentially re-encrypt your device\nAre you sure to process?"
)
File
uninstaller
=
new
File
(
getActivity
().
getCacheDir
().
getAbsolutePath
()
+
"/"
+
UNINSTALLER
);
.
setPositiveButton
(
R
.
string
.
yes
,
(
dialogInterface
,
i
)
->
{
FileOutputStream
out
=
new
FileOutputStream
(
uninstaller
);
try
{
byte
[]
bytes
=
new
byte
[
1024
];
InputStream
in
=
getActivity
().
getAssets
().
open
(
UNINSTALLER
);
int
read
;
File
uninstaller
=
new
File
(
getActivity
().
getCacheDir
().
getAbsolutePath
()
+
"/"
+
UNINSTALLER
);
while
((
read
=
in
.
read
(
bytes
))
!=
-
1
)
FileOutputStream
out
=
new
FileOutputStream
(
uninstaller
);
out
.
write
(
bytes
,
0
,
read
);
byte
[]
bytes
=
new
byte
[
1024
];
in
.
close
();
int
read
;
out
.
close
();
while
((
read
=
in
.
read
(
bytes
))
!=
-
1
)
ProgressDialog
progress
=
new
ProgressDialog
(
getActivity
());
out
.
write
(
bytes
,
0
,
read
);
progress
.
setTitle
(
R
.
string
.
reboot
);
in
.
close
();
progress
.
show
();
out
.
close
();
new
CountDownTimer
(
5000
,
1000
)
{
ProgressDialog
progress
=
new
ProgressDialog
(
getActivity
());
@Override
progress
.
setTitle
(
R
.
string
.
reboot
);
public
void
onTick
(
long
millisUntilFinished
)
{
progress
.
show
();
progress
.
setMessage
(
getString
(
R
.
string
.
reboot_countdown
,
millisUntilFinished
/
1000
));
new
CountDownTimer
(
5000
,
1000
)
{
}
@Override
public
void
onTick
(
long
millisUntilFinished
)
{
@Override
progress
.
setMessage
(
getString
(
R
.
string
.
reboot_countdown
,
millisUntilFinished
/
1000
));
public
void
onFinish
()
{
}
progress
.
setMessage
(
getString
(
R
.
string
.
reboot_countdown
,
0
));
Shell
.
su
(
true
,
"cp -af "
+
uninstaller
+
" /cache/"
+
UNINSTALLER
,
@Override
"reboot"
);
public
void
onFinish
()
{
}
progress
.
setMessage
(
getString
(
R
.
string
.
reboot_countdown
,
0
));
}.
start
();
Shell
.
su
(
true
,
"cp -af "
+
uninstaller
+
" /cache/"
+
UNINSTALLER
,
}
catch
(
IOException
e
)
{
"reboot"
);
e
.
printStackTrace
();
}
}
}.
start
();
})
}
catch
(
IOException
e
)
{
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
e
.
printStackTrace
();
.
show
();
}
});
})
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
show
();
});
}
if
(
Global
.
Events
.
blockDetectionDone
.
isTriggered
)
{
if
(
Global
.
Events
.
blockDetectionDone
.
isTriggered
)
{
updateUI
();
updateUI
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
45765e29
...
@@ -16,14 +16,9 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -16,14 +16,9 @@ public class SplashActivity extends AppCompatActivity {
// Init the info and configs and root shell
// Init the info and configs and root shell
Global
.
init
(
getApplicationContext
());
Global
.
init
(
getApplicationContext
());
// Start MagiskHide if not started at boot
if
(
Global
.
Configs
.
magiskHide
&&
!
Global
.
Info
.
disabled
&&
Global
.
Info
.
magiskVersion
>
10.3
)
new
Async
.
MagiskHide
().
enable
();
// Now fire all async tasks
// Now fire all async tasks
new
Async
.
LoadApps
(
getPackageManager
()).
exec
();
new
Async
.
GetBootBlocks
().
exec
();
new
Async
.
CheckUpdates
().
exec
();
new
Async
.
CheckUpdates
().
exec
();
new
Async
.
GetBootBlocks
().
exec
();
new
Async
.
LoadModules
()
{
new
Async
.
LoadModules
()
{
@Override
@Override
protected
void
onPostExecute
(
Void
v
)
{
protected
void
onPostExecute
(
Void
v
)
{
...
@@ -31,6 +26,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -31,6 +26,7 @@ public class SplashActivity extends AppCompatActivity {
new
Async
.
LoadRepos
(
getApplicationContext
()).
exec
();
new
Async
.
LoadRepos
(
getApplicationContext
()).
exec
();
}
}
}.
exec
();
}.
exec
();
new
Async
.
LoadApps
(
getPackageManager
()).
exec
();
// Preparation done, now start main activity
// Preparation done, now start main activity
Intent
intent
=
new
Intent
(
getApplicationContext
(),
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
getApplicationContext
(),
MainActivity
.
class
);
...
...
app/src/main/java/com/topjohnwu/magisk/superuser/SuReceiver.java
View file @
45765e29
...
@@ -44,22 +44,23 @@ public class SuReceiver extends BroadcastReceiver {
...
@@ -44,22 +44,23 @@ public class SuReceiver extends BroadcastReceiver {
SuLogEntry
log
=
new
SuLogEntry
(
policy
);
SuLogEntry
log
=
new
SuLogEntry
(
policy
);
if
(
policy
.
notification
&&
Global
.
Configs
.
suNotificationType
==
TOAST
)
{
String
message
;
String
message
;
switch
(
action
)
{
switch
(
action
)
{
case
"allow"
:
case
"allow"
:
message
=
context
.
getString
(
R
.
string
.
su_allow_toast
,
policy
.
appName
);
message
=
context
.
getString
(
R
.
string
.
su_allow_toast
,
policy
.
appName
);
log
.
action
=
true
;
log
.
action
=
true
;
break
;
break
;
case
"deny"
:
case
"deny"
:
message
=
context
.
getString
(
R
.
string
.
su_deny_toast
,
policy
.
appName
);
message
=
context
.
getString
(
R
.
string
.
su_deny_toast
,
policy
.
appName
);
log
.
action
=
false
;
log
.
action
=
false
;
break
;
break
;
default
:
default
:
return
;
return
;
}
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
if
(
policy
.
notification
&&
Global
.
Configs
.
suNotificationType
==
TOAST
)
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
policy
.
logging
)
{
if
(
policy
.
logging
)
{
toUid
=
intent
.
getIntExtra
(
"to.uid"
,
-
1
);
toUid
=
intent
.
getIntExtra
(
"to.uid"
,
-
1
);
if
(
toUid
<
0
)
return
;
if
(
toUid
<
0
)
return
;
...
...
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