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
468796c2
Commit
468796c2
authored
Oct 16, 2020
by
vvb2060
Committed by
topjohnwu
Oct 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to show OS apps
parent
5833aade
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
10 deletions
+33
-10
HideViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt
+16
-8
include_hide_filter.xml
app/src/main/res/layout/include_hide_filter.xml
+16
-2
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt
View file @
468796c2
package
com.topjohnwu.magisk.ui.hide
import
android.annotation.SuppressLint
import
android.content.pm.ApplicationInfo
import
android.content.pm.PackageManager
import
androidx.databinding.Bindable
...
...
@@ -27,14 +28,20 @@ class HideViewModel : BaseViewModel(), Queryable {
@get
:
Bindable
var
isShowSystem
=
Config
.
showSystemApp
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
showSystem
){
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
showSystem
)
{
Config
.
showSystemApp
=
it
submitQuery
()
}
@get
:
Bindable
var
isShowOS
=
false
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
showOS
)
{
submitQuery
()
}
@get
:
Bindable
var
query
=
""
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
query
){
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
query
)
{
submitQuery
()
}
...
...
@@ -46,6 +53,7 @@ class HideViewModel : BaseViewModel(), Queryable {
it
.
bindExtra
(
BR
.
viewModel
,
this
)
}
@SuppressLint
(
"InlinedApi"
)
override
fun
refresh
()
=
viewModelScope
.
launch
{
if
(!
Utils
.
showSuperUser
())
{
state
=
State
.
LOADING_FAILED
...
...
@@ -55,9 +63,9 @@ class HideViewModel : BaseViewModel(), Queryable {
val
(
apps
,
diff
)
=
withContext
(
Dispatchers
.
Default
)
{
val
pm
=
get
<
PackageManager
>()
val
hides
=
Shell
.
su
(
"magiskhide --ls"
).
exec
().
out
.
map
{
HideTarget
(
it
)
}
val
apps
=
pm
.
getInstalledApplications
(
0
)
val
apps
=
pm
.
getInstalledApplications
(
PackageManager
.
MATCH_UNINSTALLED_PACKAGES
)
.
asSequence
()
.
filter
{
it
.
enabled
&&
it
.
uid
>=
10000
&&
!
blacklist
.
contains
(
it
.
packageName
)
}
.
filter
{
it
.
enabled
&&
!
blacklist
.
contains
(
it
.
packageName
)
}
.
map
{
HideAppInfo
(
it
,
pm
)
}
.
map
{
createTarget
(
it
,
hides
)
}
.
filter
{
it
.
processes
.
isNotEmpty
()
}
...
...
@@ -88,8 +96,9 @@ class HideViewModel : BaseViewModel(), Queryable {
items
.
filter
{
fun
showHidden
()
=
it
.
itemsChecked
!=
0
fun
filterSystem
()
=
isShowSystem
||
it
.
info
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
==
0
fun
filterSystem
()
=
isShowSystem
||
it
.
info
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
==
0
fun
filterOS
()
=
(
isShowSystem
&&
isShowOS
)
||
it
.
info
.
uid
>=
10000
fun
filterQuery
():
Boolean
{
fun
inName
()
=
it
.
info
.
label
.
contains
(
query
,
true
)
...
...
@@ -98,7 +107,7 @@ class HideViewModel : BaseViewModel(), Queryable {
return
inName
()
||
inPackage
()
||
inProcesses
()
}
showHidden
()
||
(
filterSystem
()
&&
filterQuery
())
showHidden
()
||
(
filterSystem
()
&&
filter
OS
()
&&
filter
Query
())
}
state
=
State
.
LOADED
}
...
...
@@ -121,4 +130,3 @@ class HideViewModel : BaseViewModel(), Queryable {
)
}
}
}
app/src/main/res/layout/include_hide_filter.xml
View file @
468796c2
...
...
@@ -47,7 +47,7 @@
app:layout_constraintTop_toBottomOf=
"@+id/hide_filter_title_filter"
>
<com.google.android.material.chip.Chip
android:id=
"@+id/hide_filter_chip"
android:id=
"@+id/hide_filter_
system_
chip"
style=
"@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -60,6 +60,20 @@
app:chipBackgroundColor=
"?colorSurfaceVariant"
tools:checked=
"true"
/>
<com.google.android.material.chip.Chip
android:id=
"@+id/hide_filter_os_chip"
style=
"@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:checked=
"@={viewModel.showOS}"
android:nextFocusRight=
"@id/hide_filter_chip_data"
android:nextFocusDown=
"@id/hide_filter_search_field"
android:text=
"@string/show_os_app"
android:textAppearance=
"@style/AppearanceFoundation.Caption"
app:checkedIcon=
"@drawable/ic_check_md2"
app:chipBackgroundColor=
"?colorSurfaceVariant"
tools:checked=
"true"
/>
<com.google.android.material.chip.Chip
android:id=
"@+id/hide_filter_chip_data"
style=
"@style/Widget.MaterialComponents.Chip.Entry"
...
...
@@ -136,7 +150,7 @@
android:id=
"@+id/hide_filter_done"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:nextFocusLeft=
"@id/hide_filter_chip"
android:nextFocusLeft=
"@id/hide_filter_
system_
chip"
app:backgroundTint=
"?colorPrimary"
app:elevation=
"0dp"
app:fabSize=
"mini"
...
...
app/src/main/res/values/strings.xml
View file @
468796c2
...
...
@@ -102,6 +102,7 @@
<!-- MagiskHide -->
<string
name=
"show_system_app"
>
Show system apps
</string>
<string
name=
"show_os_app"
>
Show OS apps
</string>
<string
name=
"hide_filter_hint"
>
Filter by name
</string>
<string
name=
"hide_scroll_up"
>
Scroll up
</string>
<string
name=
"hide_filters"
>
Filters
</string>
...
...
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