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
4f525875
Commit
4f525875
authored
Mar 26, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support ADB shell if app shares its UID
parent
d7ee4ef5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
SuRequestHandler.kt
...ain/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
+1
-1
XAndroid.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt
+8
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
View file @
4f525875
...
@@ -36,7 +36,7 @@ class SuRequestHandler(
...
@@ -36,7 +36,7 @@ class SuRequestHandler(
// Never allow com.topjohnwu.magisk (could be malware)
// Never allow com.topjohnwu.magisk (could be malware)
if
(
pkgInfo
.
packageName
==
BuildConfig
.
APPLICATION_ID
)
{
if
(
pkgInfo
.
packageName
==
BuildConfig
.
APPLICATION_ID
)
{
Shell
.
cmd
(
"(pm uninstall ${BuildConfig.APPLICATION_ID}
)& >/dev/null 2>&1
"
).
exec
()
Shell
.
cmd
(
"(pm uninstall ${BuildConfig.APPLICATION_ID}
>/dev/null 2>&1)&
"
).
exec
()
return
false
return
false
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt
View file @
4f525875
...
@@ -19,6 +19,7 @@ import android.graphics.drawable.BitmapDrawable
...
@@ -19,6 +19,7 @@ import android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.LayerDrawable
import
android.graphics.drawable.LayerDrawable
import
android.net.Uri
import
android.net.Uri
import
android.os.Build.VERSION.SDK_INT
import
android.os.Build.VERSION.SDK_INT
import
android.os.Process
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.view.ViewTreeObserver
...
@@ -272,7 +273,13 @@ fun PackageManager.getPackageInfo(uid: Int, pid: Int): PackageInfo? {
...
@@ -272,7 +273,13 @@ fun PackageManager.getPackageInfo(uid: Int, pid: Int): PackageInfo? {
if
(
pid
<=
0
)
if
(
pid
<=
0
)
return
null
return
null
// Try to find package name from PID
// Try to find package name from PID
val
proc
=
RootUtils
.
obj
?.
getAppProcess
(
pid
)
?:
return
null
val
proc
=
RootUtils
.
obj
?.
getAppProcess
(
pid
)
?:
return
if
(
uid
==
Process
.
SHELL_UID
)
{
// It is possible that some apps installed are sharing UID with shell.
// We will not be able to find a package from the active process list,
// because the client is forked from ADB shell, not any app process.
getPackageInfo
(
"com.android.shell"
,
flag
)
}
else
null
val
pkg
=
proc
.
pkgList
[
0
]
val
pkg
=
proc
.
pkgList
[
0
]
getPackageInfo
(
pkg
,
flag
)
getPackageInfo
(
pkg
,
flag
)
}
else
{
}
else
{
...
...
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