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
68db3666
Commit
68db3666
authored
May 07, 2022
by
vvb2060
Committed by
John Wu
May 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete outdated policies
parent
35853871
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
SuperuserViewModel.kt
...a/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
+13
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
68db3666
...
@@ -55,11 +55,16 @@ class SuperuserViewModel(
...
@@ -55,11 +55,16 @@ class SuperuserViewModel(
state
=
State
.
LOADING
state
=
State
.
LOADING
val
(
policies
,
diff
)
=
withContext
(
Dispatchers
.
IO
)
{
val
(
policies
,
diff
)
=
withContext
(
Dispatchers
.
IO
)
{
db
.
deleteOutdated
()
db
.
deleteOutdated
()
db
.
delete
(
AppContext
.
applicationInfo
.
uid
)
val
policies
=
ArrayList
<
PolicyRvItem
>()
val
policies
=
ArrayList
<
PolicyRvItem
>()
val
pm
=
AppContext
.
packageManager
val
pm
=
AppContext
.
packageManager
for
(
policy
in
db
.
fetchAll
())
{
for
(
policy
in
db
.
fetchAll
())
{
val
pkgs
=
pm
.
getPackagesForUid
(
policy
.
uid
)
?:
continue
val
pkgs
=
pm
.
getPackagesForUid
(
policy
.
uid
)
policies
.
addAll
(
pkgs
.
mapNotNull
{
pkg
->
if
(
pkgs
==
null
)
{
db
.
delete
(
policy
.
uid
)
continue
}
val
map
=
pkgs
.
mapNotNull
{
pkg
->
try
{
try
{
val
info
=
pm
.
getPackageInfo
(
pkg
,
MATCH_UNINSTALLED_PACKAGES
)
val
info
=
pm
.
getPackageInfo
(
pkg
,
MATCH_UNINSTALLED_PACKAGES
)
PolicyRvItem
(
PolicyRvItem
(
...
@@ -72,7 +77,12 @@ class SuperuserViewModel(
...
@@ -72,7 +77,12 @@ class SuperuserViewModel(
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
null
null
}
}
})
}
if
(
map
.
isEmpty
())
{
db
.
delete
(
policy
.
uid
)
continue
}
policies
.
addAll
(
map
)
}
}
policies
.
sortWith
(
compareBy
(
policies
.
sortWith
(
compareBy
(
{
it
.
appName
.
lowercase
(
currentLocale
)
},
{
it
.
appName
.
lowercase
(
currentLocale
)
},
...
...
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