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
0eef4eac
Commit
0eef4eac
authored
Feb 01, 2019
by
vvb2060
Committed by
John Wu
Feb 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use REBOOT foreground broadcast
parent
5764f0c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
GeneralReceiver.java
...java/com/topjohnwu/magisk/components/GeneralReceiver.java
+17
-0
connect.cpp
native/jni/su/connect.cpp
+9
-14
No files found.
app/src/full/java/com/topjohnwu/magisk/components/GeneralReceiver.java
View file @
0eef4eac
...
@@ -40,6 +40,23 @@ public class GeneralReceiver extends BroadcastReceiver {
...
@@ -40,6 +40,23 @@ public class GeneralReceiver extends BroadcastReceiver {
if
(
action
==
null
)
if
(
action
==
null
)
return
;
return
;
switch
(
action
)
{
switch
(
action
)
{
case
Intent
.
ACTION_REBOOT
:
String
rebootAction
=
intent
.
getStringExtra
(
"action"
);
switch
(
rebootAction
)
{
case
"request"
:
Intent
i
=
new
Intent
(
app
,
ClassMap
.
get
(
SuRequestActivity
.
class
))
.
putExtra
(
"socket"
,
intent
.
getStringExtra
(
"socket"
))
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
app
.
startActivity
(
i
);
break
;
case
"log"
:
SU_LOGGER
.
handleLogs
(
intent
);
break
;
case
"notify"
:
SU_LOGGER
.
handleNotify
(
intent
);
break
;
}
break
;
case
Intent
.
ACTION_BOOT_COMPLETED
:
case
Intent
.
ACTION_BOOT_COMPLETED
:
String
bootAction
=
intent
.
getStringExtra
(
"action"
);
String
bootAction
=
intent
.
getStringExtra
(
"action"
);
if
(
bootAction
==
null
)
if
(
bootAction
==
null
)
...
...
native/jni/su/connect.cpp
View file @
0eef4eac
...
@@ -18,10 +18,10 @@
...
@@ -18,10 +18,10 @@
#include "su.h"
#include "su.h"
#define BROADCAST_BOOT_COMPLETED \
#define BROADCAST_
RE
BOOT_COMPLETED \
"/system/bin/app_process", "/system/bin", "com.android.commands.am.Am", \
"/system/bin/app_process", "/system/bin", "com.android.commands.am.Am", \
"broadcast", nullptr, nullptr, "-a", "android.intent.action.
BOOT_COMPLETED
", \
"broadcast", nullptr, nullptr, "-a", "android.intent.action.
REBOOT
", \
"-f", "0x
0
0000020"
"-f", "0x
1
0000020"
static
inline
const
char
*
get_command
(
const
struct
su_request
*
to
)
{
static
inline
const
char
*
get_command
(
const
struct
su_request
*
to
)
{
if
(
to
->
command
[
0
])
if
(
to
->
command
[
0
])
...
@@ -33,14 +33,9 @@ static inline const char *get_command(const struct su_request *to) {
...
@@ -33,14 +33,9 @@ static inline const char *get_command(const struct su_request *to) {
static
void
silent_run
(
const
char
**
args
,
struct
su_info
*
info
)
{
static
void
silent_run
(
const
char
**
args
,
struct
su_info
*
info
)
{
char
component
[
128
];
char
component
[
128
];
if
(
SDK_INT
>=
22
)
{
sprintf
(
component
,
"%s/a.h"
,
info
->
str
[
SU_MANAGER
]);
args
[
4
]
=
"-p"
;
args
[
4
]
=
"-n"
;
args
[
5
]
=
info
->
str
[
SU_MANAGER
];
args
[
5
]
=
component
;
}
else
{
sprintf
(
component
,
"%s/a.h"
,
info
->
str
[
SU_MANAGER
]);
args
[
4
]
=
"-n"
;
args
[
5
]
=
component
;
}
exec_t
exec
{
exec_t
exec
{
.
pre_exec
=
[]()
->
void
{
.
pre_exec
=
[]()
->
void
{
int
null
=
xopen
(
"/dev/null"
,
O_WRONLY
|
O_CLOEXEC
);
int
null
=
xopen
(
"/dev/null"
,
O_WRONLY
|
O_CLOEXEC
);
...
@@ -85,7 +80,7 @@ void app_log(struct su_context *ctx) {
...
@@ -85,7 +80,7 @@ void app_log(struct su_context *ctx) {
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
BROADCAST_BOOT_COMPLETED
,
BROADCAST_
RE
BOOT_COMPLETED
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"log"
,
"--es"
,
"action"
,
"log"
,
"--ei"
,
"from.uid"
,
fromUid
,
"--ei"
,
"from.uid"
,
fromUid
,
...
@@ -112,7 +107,7 @@ void app_notify(struct su_context *ctx) {
...
@@ -112,7 +107,7 @@ void app_notify(struct su_context *ctx) {
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
BROADCAST_BOOT_COMPLETED
,
BROADCAST_
RE
BOOT_COMPLETED
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"notify"
,
"--es"
,
"action"
,
"notify"
,
"--ei"
,
"from.uid"
,
fromUid
,
"--ei"
,
"from.uid"
,
fromUid
,
...
@@ -127,7 +122,7 @@ void app_connect(const char *socket, struct su_info *info) {
...
@@ -127,7 +122,7 @@ void app_connect(const char *socket, struct su_info *info) {
setup_user
(
user
,
info
);
setup_user
(
user
,
info
);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
BROADCAST_BOOT_COMPLETED
,
BROADCAST_
RE
BOOT_COMPLETED
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"request"
,
"--es"
,
"action"
,
"request"
,
"--es"
,
"socket"
,
socket
,
"--es"
,
"socket"
,
socket
,
...
...
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