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
6b67902d
Commit
6b67902d
authored
Jan 18, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uninstalled app su requests should still show in logs
parent
0ad0ef48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
20 deletions
+29
-20
PolicyDao.kt
...main/java/com/topjohnwu/magisk/core/magiskdb/PolicyDao.kt
+0
-1
SuLog.kt
...src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt
+0
-8
SuPolicy.kt
.../main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt
+23
-9
SuCallbackHandler.kt
...in/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
+6
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/core/magiskdb/PolicyDao.kt
View file @
6b67902d
...
@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.core.magiskdb
...
@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.core.magiskdb
import
android.content.pm.PackageManager
import
android.content.pm.PackageManager
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.model.su.SuPolicy
import
com.topjohnwu.magisk.core.model.su.SuPolicy
import
com.topjohnwu.magisk.core.model.su.toMap
import
com.topjohnwu.magisk.core.model.su.toPolicy
import
com.topjohnwu.magisk.core.model.su.toPolicy
import
com.topjohnwu.magisk.di.AppContext
import
com.topjohnwu.magisk.di.AppContext
import
com.topjohnwu.magisk.ktx.now
import
com.topjohnwu.magisk.ktx.now
...
...
app/src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt
View file @
6b67902d
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.core.model.su
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.core.model.su
import
androidx.room.Entity
import
androidx.room.Entity
import
androidx.room.Ignore
import
androidx.room.Ignore
import
androidx.room.PrimaryKey
import
androidx.room.PrimaryKey
import
com.topjohnwu.magisk.core.model.su.SuPolicy.Companion.ALLOW
import
com.topjohnwu.magisk.ktx.now
import
com.topjohnwu.magisk.ktx.timeFormatTime
import
com.topjohnwu.magisk.ktx.timeFormatTime
import
com.topjohnwu.magisk.ktx.toTime
import
com.topjohnwu.magisk.ktx.toTime
...
@@ -22,9 +20,3 @@ data class SuLog(
...
@@ -22,9 +20,3 @@ data class SuLog(
@PrimaryKey
(
autoGenerate
=
true
)
var
id
:
Int
=
0
@PrimaryKey
(
autoGenerate
=
true
)
var
id
:
Int
=
0
@Ignore
val
timeString
=
time
.
toTime
(
timeFormatTime
)
@Ignore
val
timeString
=
time
.
toTime
(
timeFormatTime
)
}
}
fun
SuPolicy
.
toLog
(
toUid
:
Int
,
fromPid
:
Int
,
command
:
String
)
=
SuLog
(
uid
,
toUid
,
fromPid
,
packageName
,
appName
,
command
,
policy
==
ALLOW
,
now
)
app/src/main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt
View file @
6b67902d
...
@@ -25,16 +25,20 @@ data class SuPolicy(
...
@@ -25,16 +25,20 @@ data class SuPolicy(
const
val
ALLOW
=
2
const
val
ALLOW
=
2
}
}
}
fun
toLog
(
toUid
:
Int
,
fromPid
:
Int
,
command
:
String
)
=
SuLog
(
uid
,
toUid
,
fromPid
,
packageName
,
appName
,
command
,
policy
==
ALLOW
,
System
.
currentTimeMillis
()
)
fun
SuPolicy
.
toMap
()
=
mapOf
(
fun
toMap
()
=
mapOf
(
"uid"
to
uid
,
"uid"
to
uid
,
"package_name"
to
packageName
,
"package_name"
to
packageName
,
"policy"
to
policy
,
"policy"
to
policy
,
"until"
to
until
,
"until"
to
until
,
"logging"
to
logging
,
"logging"
to
logging
,
"notification"
to
notification
"notification"
to
notification
)
)
}
@Throws
(
PackageManager
.
NameNotFoundException
::
class
)
@Throws
(
PackageManager
.
NameNotFoundException
::
class
)
fun
Map
<
String
,
String
>.
toPolicy
(
pm
:
PackageManager
):
SuPolicy
{
fun
Map
<
String
,
String
>.
toPolicy
(
pm
:
PackageManager
):
SuPolicy
{
...
@@ -70,3 +74,13 @@ fun Int.toPolicy(pm: PackageManager, policy: Int = INTERACTIVE): SuPolicy {
...
@@ -70,3 +74,13 @@ fun Int.toPolicy(pm: PackageManager, policy: Int = INTERACTIVE): SuPolicy {
policy
=
policy
policy
=
policy
)
)
}
}
fun
Int
.
toUidPolicy
(
pm
:
PackageManager
,
policy
:
Int
):
SuPolicy
{
return
SuPolicy
(
uid
=
this
,
packageName
=
"[UID] $this"
,
appName
=
"[UID] $this"
,
icon
=
pm
.
defaultActivityIcon
,
policy
=
policy
)
}
app/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
View file @
6b67902d
...
@@ -8,8 +8,8 @@ import com.topjohnwu.magisk.BuildConfig
...
@@ -8,8 +8,8 @@ import com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.model.su.SuPolicy
import
com.topjohnwu.magisk.core.model.su.SuPolicy
import
com.topjohnwu.magisk.core.model.su.toLog
import
com.topjohnwu.magisk.core.model.su.toPolicy
import
com.topjohnwu.magisk.core.model.su.toPolicy
import
com.topjohnwu.magisk.core.model.su.toUidPolicy
import
com.topjohnwu.magisk.di.ServiceLocator
import
com.topjohnwu.magisk.di.ServiceLocator
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.Utils
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.GlobalScope
...
@@ -58,7 +58,11 @@ object SuCallbackHandler {
...
@@ -58,7 +58,11 @@ object SuCallbackHandler {
val
notify
=
data
.
getBoolean
(
"notify"
,
true
)
val
notify
=
data
.
getBoolean
(
"notify"
,
true
)
val
allow
=
data
[
"policy"
].
toInt
()
?:
return
val
allow
=
data
[
"policy"
].
toInt
()
?:
return
val
policy
=
runCatching
{
fromUid
.
toPolicy
(
pm
,
allow
)
}.
getOrElse
{
return
}
val
policy
=
runCatching
{
fromUid
.
toPolicy
(
pm
,
allow
)
}.
getOrElse
{
fromUid
.
toUidPolicy
(
pm
,
allow
)
}
if
(
notify
)
if
(
notify
)
notify
(
context
,
policy
)
notify
(
context
,
policy
)
...
...
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