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
cf9957ce
Commit
cf9957ce
authored
Nov 01, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly detect SysUI appId
Fix #6322
parent
44643ad7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
misc.cpp
native/src/base/misc.cpp
+5
-1
bootstages.cpp
native/src/core/bootstages.cpp
+1
-1
utils.cpp
native/src/zygisk/deny/utils.cpp
+3
-4
No files found.
native/src/base/misc.cpp
View file @
cf9957ce
...
@@ -214,7 +214,11 @@ vector<string_view> split_ro(string_view s, string_view delims) {
...
@@ -214,7 +214,11 @@ vector<string_view> split_ro(string_view s, string_view delims) {
#undef vsnprintf
#undef vsnprintf
int
vssprintf
(
char
*
dest
,
size_t
size
,
const
char
*
fmt
,
va_list
ap
)
{
int
vssprintf
(
char
*
dest
,
size_t
size
,
const
char
*
fmt
,
va_list
ap
)
{
return
std
::
min
(
vsnprintf
(
dest
,
size
,
fmt
,
ap
),
(
int
)
size
-
1
);
if
(
size
>
0
)
{
*
dest
=
0
;
return
std
::
min
(
vsnprintf
(
dest
,
size
,
fmt
,
ap
),
(
int
)
size
-
1
);
}
return
-
1
;
}
}
int
ssprintf
(
char
*
dest
,
size_t
size
,
const
char
*
fmt
,
...)
{
int
ssprintf
(
char
*
dest
,
size_t
size
,
const
char
*
fmt
,
...)
{
...
...
native/src/core/bootstages.cpp
View file @
cf9957ce
...
@@ -126,7 +126,7 @@ static bool magisk_env() {
...
@@ -126,7 +126,7 @@ static bool magisk_env() {
string
pkg
;
string
pkg
;
get_manager
(
0
,
&
pkg
);
get_manager
(
0
,
&
pkg
);
s
printf
(
buf
,
"%s/0/%s/install"
,
APP_DATA_DIR
,
s
sprintf
(
buf
,
sizeof
(
buf
)
,
"%s/0/%s/install"
,
APP_DATA_DIR
,
pkg
.
empty
()
?
"xxx"
/* Ensure non-exist path */
:
pkg
.
data
());
pkg
.
empty
()
?
"xxx"
/* Ensure non-exist path */
:
pkg
.
data
());
// Alternative binaries paths
// Alternative binaries paths
...
...
native/src/zygisk/deny/utils.cpp
View file @
cf9957ce
...
@@ -41,10 +41,6 @@ static void rescan_apps() {
...
@@ -41,10 +41,6 @@ static void rescan_apps() {
app_id_to_pkgs
.
clear
();
app_id_to_pkgs
.
clear
();
struct
stat
st
{};
if
(
xstat
(
"/data/data/com.android.systemui"
,
&
st
)
==
0
)
sys_ui_app_id
=
to_app_id
(
st
.
st_uid
);
auto
data_dir
=
xopen_dir
(
APP_DATA_DIR
);
auto
data_dir
=
xopen_dir
(
APP_DATA_DIR
);
if
(
!
data_dir
)
if
(
!
data_dir
)
return
;
return
;
...
@@ -54,6 +50,7 @@ static void rescan_apps() {
...
@@ -54,6 +50,7 @@ static void rescan_apps() {
int
dfd
=
xopenat
(
dirfd
(
data_dir
.
get
()),
entry
->
d_name
,
O_RDONLY
);
int
dfd
=
xopenat
(
dirfd
(
data_dir
.
get
()),
entry
->
d_name
,
O_RDONLY
);
if
(
auto
dir
=
xopen_dir
(
dfd
))
{
if
(
auto
dir
=
xopen_dir
(
dfd
))
{
while
((
entry
=
xreaddir
(
dir
.
get
())))
{
while
((
entry
=
xreaddir
(
dir
.
get
())))
{
struct
stat
st
{};
// For each package
// For each package
if
(
xfstatat
(
dfd
,
entry
->
d_name
,
&
st
,
0
))
if
(
xfstatat
(
dfd
,
entry
->
d_name
,
&
st
,
0
))
continue
;
continue
;
...
@@ -61,6 +58,8 @@ static void rescan_apps() {
...
@@ -61,6 +58,8 @@ static void rescan_apps() {
if
(
auto
it
=
pkg_to_procs
.
find
(
entry
->
d_name
);
it
!=
pkg_to_procs
.
end
())
{
if
(
auto
it
=
pkg_to_procs
.
find
(
entry
->
d_name
);
it
!=
pkg_to_procs
.
end
())
{
app_id_to_pkgs
[
app_id
].
insert
(
it
->
first
);
app_id_to_pkgs
[
app_id
].
insert
(
it
->
first
);
}
}
if
(
entry
->
d_name
==
"com.android.systemui"
sv
)
sys_ui_app_id
=
app_id
;
}
}
}
else
{
}
else
{
close
(
dfd
);
close
(
dfd
);
...
...
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