Fix isolated process display

This commit is contained in:
vvb2060 2021-03-19 03:24:14 +08:00 committed by John Wu
parent 8b5cb4c7b0
commit d11358671e
3 changed files with 11 additions and 6 deletions

View File

@ -60,7 +60,7 @@ class HideAppInfo(info: ApplicationInfo, pm: PackageManager, hideList: List<Cmdl
val hidden = hideList.filter { it.packageName == packageName || it.packageName == ISOLATED_MAGIC }
fun createProcess(name: String, pkg: String = packageName): HideProcessInfo {
return HideProcessInfo(name, pkg, hidden.any { it.process == name })
return HideProcessInfo(name, pkg, hidden.any { it.process == name && it.packageName == pkg })
}
var haveAppZygote = false
@ -86,7 +86,7 @@ class HideAppInfo(info: ApplicationInfo, pm: PackageManager, hideList: List<Cmdl
receivers?.processes().orEmpty() +
providers?.processes().orEmpty() +
listOf(if (haveAppZygote) createProcess("${processName}_zygote") else null)
}.filterNotNull().distinctBy { it.name }.sortedBy { it.name }
}.filterNotNull().distinct().sortedBy { it.name }
}
companion object {
@ -102,6 +102,6 @@ data class HideProcessInfo(
val packageName: String,
var isHidden: Boolean
) {
val isIsolated get() = name == ISOLATED_MAGIC
val isIsolated get() = packageName == ISOLATED_MAGIC
val isAppZygote get() = name.endsWith("_zygote")
}

View File

@ -93,6 +93,8 @@ class HideProcessRvItem(
override val layoutRes get() = R.layout.item_hide_process_md2
val displayName = if (process.isIsolated) "(isolated) ${process.name}" else process.name
@get:Bindable
var isHidden
get() = process.isHidden
@ -109,7 +111,10 @@ class HideProcessRvItem(
val defaultSelection get() =
process.isIsolated || process.isAppZygote || process.name == process.packageName
override fun contentSameAs(other: HideProcessRvItem) = process == other.process
override fun itemSameAs(other: HideProcessRvItem) = process.name == other.process.name
override fun contentSameAs(other: HideProcessRvItem) =
process.isHidden == other.process.isHidden
override fun itemSameAs(other: HideProcessRvItem) =
process.name == other.process.name && process.packageName == other.process.packageName
}

View File

@ -30,7 +30,7 @@
android:layout_marginBottom="@dimen/l_75"
android:singleLine="true"
android:ellipsize="middle"
android:text="@{item.process.name}"
android:text="@{item.displayName}"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hide_process_checkbox"