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
3068738a
Commit
3068738a
authored
Nov 07, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MagiskHide small tweak
parent
cfa0d8b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
13 deletions
+25
-13
magiskhide.c
jni/magiskhide.c
+19
-12
magic_mask.sh
scripts/magic_mask.sh
+3
-0
add
zip_static/common/magiskhide/add
+2
-0
rm
zip_static/common/magiskhide/rm
+1
-1
No files found.
jni/magiskhide.c
View file @
3068738a
...
...
@@ -12,6 +12,9 @@
#include <sys/inotify.h>
#include <sys/wait.h>
#define LOGFILE "/cache/magisk.log"
#define HIDELIST "/magisk/.core/magiskhide/hidelist"
FILE
*
logfile
;
int
i
,
list_size
;
char
**
hide_list
=
NULL
;
...
...
@@ -111,7 +114,7 @@ void update_list(const char *listpath) {
hide_list
=
file_to_str_arr
(
hide_fp
,
&
list_size
);
pthread_mutex_unlock
(
&
mutex
);
fclose
(
hide_fp
);
fprintf
(
logfile
,
"MagiskHide: Update process/package list:
\n
"
);
if
(
list_size
)
fprintf
(
logfile
,
"MagiskHide: Update process/package list:
\n
"
);
for
(
i
=
0
;
i
<
list_size
;
i
++
)
fprintf
(
logfile
,
"MagiskHide: %s
\n
"
,
hide_list
[
i
]);
}
...
...
@@ -129,18 +132,22 @@ void *monitor_list(void *listpath) {
// Initial load
update_list
((
char
*
)
listpath
);
int
inotifyFd
;
int
inotifyFd
=
-
1
;
char
buffer
[
512
];
inotifyFd
=
inotify_init
();
if
(
inotifyFd
==
-
1
)
exit
(
1
);
if
(
inotify_add_watch
(
inotifyFd
,
(
char
*
)
listpath
,
IN_ATTRIB
|
IN_MODIFY
)
==
-
1
)
exit
(
1
);
while
(
1
)
{
if
(
read
(
inotifyFd
,
buffer
,
512
)
==
-
1
)
exit
(
1
);
if
(
inotifyFd
==
-
1
||
read
(
inotifyFd
,
buffer
,
512
)
==
-
1
)
{
close
(
inotifyFd
);
inotifyFd
=
inotify_init
();
if
(
inotifyFd
==
-
1
)
{
fprintf
(
logfile
,
"MagiskHide: Unable to watch %s
\n
"
,
listpath
);
exit
(
1
);
}
if
(
inotify_add_watch
(
inotifyFd
,
(
char
*
)
listpath
,
IN_MODIFY
)
==
-
1
)
{
fprintf
(
logfile
,
"MagiskHide: Unable to watch %s
\n
"
,
listpath
);
exit
(
1
);
}
}
update_list
((
char
*
)
listpath
);
}
...
...
@@ -162,13 +169,13 @@ int main(int argc, char **argv, char **envp) {
close
(
STDOUT_FILENO
);
close
(
STDERR_FILENO
);
logfile
=
fopen
(
"/cache/magisk.log"
,
"a+"
);
logfile
=
fopen
(
LOGFILE
,
"a+"
);
setbuf
(
logfile
,
NULL
);
pthread_t
list_monitor
;
pthread_mutex_init
(
&
mutex
,
NULL
);
pthread_create
(
&
list_monitor
,
NULL
,
monitor_list
,
"/magisk/.core/magiskhide/hidelist"
);
pthread_create
(
&
list_monitor
,
NULL
,
monitor_list
,
HIDELIST
);
char
buffer
[
512
];
FILE
*
p
=
popen
(
"while true; do logcat -b events -v raw -s am_proc_start; sleep 1; done"
,
"r"
);
...
...
scripts/magic_mask.sh
View file @
3068738a
...
...
@@ -233,6 +233,9 @@ case $1 in
# Only for multirom!
# log_print "** Magisk post-fs mode running..."
# Cleanup previous stuffs...
rm
-rf
/cache/magisk /cache/magisk_merge /cache/magiskhide.log
unblock
;;
...
...
zip_static/common/magiskhide/add
View file @
3068738a
...
...
@@ -5,5 +5,7 @@ HIDELIST=/magisk/.core/magiskhide/hidelist
if
[
!
-z
"
$1
"
]
;
then
if
[
$(
grep
-c
"^
$1
$"
$HIDELIST
)
-eq
"0"
]
;
then
echo
"
$1
"
>>
$HIDELIST
set
`
/data/busybox/ps
-o
pid,args |
grep
"
$1
"
|
grep
-v
"grep"
`
kill
"
$1
"
fi
fi
zip_static/common/magiskhide/rm
View file @
3068738a
...
...
@@ -3,7 +3,7 @@
HIDELIST
=
/magisk/.core/magiskhide/hidelist
if
[
!
-z
"
$1
"
]
;
then
mv
$HIDELIST
$HIDELIST
.tmp
cp
-af
$HIDELIST
$HIDELIST
.tmp
cat
$HIDELIST
.tmp |
grep
-v
"^
$1
$"
>
$HIDELIST
rm
-f
$HIDELIST
.tmp
set
`
/data/busybox/ps
-o
pid,args |
grep
"
$1
"
|
grep
-v
"grep"
`
...
...
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