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
ee0ec3fb
Commit
ee0ec3fb
authored
Feb 24, 2021
by
vvb2060
Committed by
John Wu
Feb 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use UID_REMOVED action for multi-user and shared user id compatibility
parent
122a73e0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-1
Receiver.kt
app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt
+16
-13
PolicyDao.kt
...main/java/com/topjohnwu/magisk/core/magiskdb/PolicyDao.kt
+0
-6
AndroidManifest.xml
stub/src/main/AndroidManifest.xml
+4
-2
No files found.
app/src/main/AndroidManifest.xml
View file @
ee0ec3fb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<!-- Splash -->
<!-- Splash -->
<activity
<activity
android:name=
".core.SplashActivity"
android:name=
".core.SplashActivity"
android:exported=
"true"
android:theme=
"@style/SplashTheme"
>
android:theme=
"@style/SplashTheme"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
@@ -52,7 +53,7 @@
...
@@ -52,7 +53,7 @@
</intent-filter>
</intent-filter>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
<action
android:name=
"android.intent.action.
PACKAGE_FULLY
_REMOVED"
/>
<action
android:name=
"android.intent.action.
UID
_REMOVED"
/>
<data
android:scheme=
"package"
/>
<data
android:scheme=
"package"
/>
</intent-filter>
</intent-filter>
...
...
app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt
View file @
ee0ec3fb
package
com.topjohnwu.magisk.core
package
com.topjohnwu.magisk.core
import
android.annotation.SuppressLint
import
android.content.ContextWrapper
import
android.content.ContextWrapper
import
android.content.Intent
import
android.content.Intent
import
com.topjohnwu.magisk.core.base.BaseReceiver
import
com.topjohnwu.magisk.core.base.BaseReceiver
import
com.topjohnwu.magisk.core.magiskdb.PolicyDao
import
com.topjohnwu.magisk.core.magiskdb.PolicyDao
import
com.topjohnwu.magisk.core.su.SuCallbackHandler
import
com.topjohnwu.magisk.view.Shortcuts
import
com.topjohnwu.magisk.view.Shortcuts
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.GlobalScope
...
@@ -15,30 +15,33 @@ open class Receiver : BaseReceiver() {
...
@@ -15,30 +15,33 @@ open class Receiver : BaseReceiver() {
private
val
policyDB
:
PolicyDao
by
inject
()
private
val
policyDB
:
PolicyDao
by
inject
()
private
fun
getPkg
(
intent
:
Intent
):
String
{
@SuppressLint
(
"InlinedApi"
)
return
intent
.
data
?.
encodedSchemeSpecificPart
.
orEmpty
()
private
fun
getPkg
(
intent
:
Intent
):
String
?
{
val
pkg
=
intent
.
getStringExtra
(
Intent
.
EXTRA_PACKAGE_NAME
)
return
pkg
?:
intent
.
data
?.
schemeSpecificPart
}
private
fun
getUid
(
intent
:
Intent
):
Int
?
{
val
uid
=
intent
.
getIntExtra
(
Intent
.
EXTRA_UID
,
-
1
)
return
if
(
uid
==
-
1
)
null
else
uid
}
}
override
fun
onReceive
(
context
:
ContextWrapper
,
intent
:
Intent
?)
{
override
fun
onReceive
(
context
:
ContextWrapper
,
intent
:
Intent
?)
{
intent
?:
return
intent
?:
return
fun
rmPolicy
(
pkg
:
String
)
=
GlobalScope
.
launch
{
fun
rmPolicy
(
uid
:
Int
)
=
GlobalScope
.
launch
{
policyDB
.
delete
(
pkg
)
policyDB
.
delete
(
uid
)
}
}
when
(
intent
.
action
?:
return
)
{
when
(
intent
.
action
?:
return
)
{
Intent
.
ACTION_REBOOT
->
{
SuCallbackHandler
(
context
,
intent
.
getStringExtra
(
"action"
),
intent
.
extras
)
}
Intent
.
ACTION_PACKAGE_REPLACED
->
{
Intent
.
ACTION_PACKAGE_REPLACED
->
{
// This will only work pre-O
// This will only work pre-O
if
(
Config
.
suReAuth
)
if
(
Config
.
suReAuth
)
rmPolicy
(
getPkg
(
intent
))
getUid
(
intent
)
?.
let
{
rmPolicy
(
it
)
}
}
}
Intent
.
ACTION_PACKAGE_FULLY_REMOVED
->
{
Intent
.
ACTION_UID_REMOVED
->
{
val
pkg
=
getPkg
(
intent
)
getUid
(
intent
)
?.
let
{
rmPolicy
(
it
)
}
rmPolicy
(
pkg
)
getPkg
(
intent
)
?.
let
{
Shell
.
su
(
"magiskhide rm $it"
).
submit
()
}
Shell
.
su
(
"magiskhide --rm $pkg"
).
submit
()
}
}
Intent
.
ACTION_LOCALE_CHANGED
->
Shortcuts
.
setupDynamic
(
context
)
Intent
.
ACTION_LOCALE_CHANGED
->
Shortcuts
.
setupDynamic
(
context
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/core/magiskdb/PolicyDao.kt
View file @
ee0ec3fb
...
@@ -31,12 +31,6 @@ class PolicyDao(
...
@@ -31,12 +31,6 @@ class PolicyDao(
}
}
}.
commit
()
}.
commit
()
suspend
fun
delete
(
packageName
:
String
)
=
buildQuery
<
Delete
>
{
condition
{
equals
(
"package_name"
,
packageName
)
}
}.
commit
()
suspend
fun
delete
(
uid
:
Int
)
=
buildQuery
<
Delete
>
{
suspend
fun
delete
(
uid
:
Int
)
=
buildQuery
<
Delete
>
{
condition
{
condition
{
equals
(
"uid"
,
uid
)
equals
(
"uid"
,
uid
)
...
...
stub/src/main/AndroidManifest.xml
View file @
ee0ec3fb
...
@@ -14,7 +14,9 @@
...
@@ -14,7 +14,9 @@
tools:ignore=
"GoogleAppIndexingWarning,MissingApplicationIcon,UnusedAttribute"
>
tools:ignore=
"GoogleAppIndexingWarning,MissingApplicationIcon,UnusedAttribute"
>
<!-- Splash -->
<!-- Splash -->
<activity
android:name=
"f.u7"
>
<activity
android:name=
"f.u7"
android:exported=
"true"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
...
@@ -51,7 +53,7 @@
...
@@ -51,7 +53,7 @@
</intent-filter>
</intent-filter>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
<action
android:name=
"android.intent.action.
PACKAGE_FULLY
_REMOVED"
/>
<action
android:name=
"android.intent.action.
UID
_REMOVED"
/>
<data
android:scheme=
"package"
/>
<data
android:scheme=
"package"
/>
</intent-filter>
</intent-filter>
...
...
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