Hide selection improvements
This commit is contained in:
parent
8e61080a4a
commit
79fa0d3a90
@ -99,4 +99,7 @@ data class HideProcessInfo(
|
|||||||
val name: String,
|
val name: String,
|
||||||
val packageName: String,
|
val packageName: String,
|
||||||
var isHidden: Boolean
|
var isHidden: Boolean
|
||||||
)
|
) {
|
||||||
|
val isIsolated get() = name == ISOLATED_MAGIC
|
||||||
|
val isAppZygote get() = name.endsWith("_zygote")
|
||||||
|
}
|
||||||
|
@ -40,11 +40,10 @@ class HideRvItem(
|
|||||||
if (value == true) {
|
if (value == true) {
|
||||||
processes
|
processes
|
||||||
.filterNot { it.isHidden }
|
.filterNot { it.isHidden }
|
||||||
.filter { isExpanded || it.process.name == it.process.packageName }
|
.filter { isExpanded || it.defaultSelection }
|
||||||
} else {
|
} else {
|
||||||
processes
|
processes
|
||||||
.filter { it.isHidden }
|
.filter { it.isHidden }
|
||||||
.filter { isExpanded || it.process.name == it.process.packageName }
|
|
||||||
}.forEach { it.toggle() }
|
}.forEach { it.toggle() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,12 @@ class HideRvItem(
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
processes.find { it.isHidden && it.process.name == it.process.packageName } != null
|
val defaultProcesses = processes.filter { it.defaultSelection }
|
||||||
|
when (defaultProcesses.count { it.isHidden }) {
|
||||||
|
0 -> false
|
||||||
|
defaultProcesses.size -> true
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +106,9 @@ class HideProcessRvItem(
|
|||||||
isHidden = !isHidden
|
isHidden = !isHidden
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val defaultSelection get() =
|
||||||
|
process.isIsolated || process.isAppZygote || process.name == process.packageName
|
||||||
|
|
||||||
override fun contentSameAs(other: HideProcessRvItem) = process == other.process
|
override fun contentSameAs(other: HideProcessRvItem) = process == other.process
|
||||||
override fun itemSameAs(other: HideProcessRvItem) = process.name == other.process.name
|
override fun itemSameAs(other: HideProcessRvItem) = process.name == other.process.name
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void update_uid_map() {
|
|||||||
string data_path(APP_DATA_DIR);
|
string data_path(APP_DATA_DIR);
|
||||||
size_t len = data_path.length();
|
size_t len = data_path.length();
|
||||||
auto dir = open_dir(APP_DATA_DIR);
|
auto dir = open_dir(APP_DATA_DIR);
|
||||||
bool firstIteration = true;
|
bool first_iter = true;
|
||||||
for (dirent *entry; (entry = xreaddir(dir.get()));) {
|
for (dirent *entry; (entry = xreaddir(dir.get()));) {
|
||||||
data_path.resize(len);
|
data_path.resize(len);
|
||||||
data_path += '/';
|
data_path += '/';
|
||||||
@ -96,7 +96,7 @@ void update_uid_map() {
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
for (auto &hide : hide_set) {
|
for (auto &hide : hide_set) {
|
||||||
if (hide.first == ISOLATED_MAGIC) {
|
if (hide.first == ISOLATED_MAGIC) {
|
||||||
if (!firstIteration) continue;
|
if (!first_iter) continue;
|
||||||
// Setup isolated processes
|
// Setup isolated processes
|
||||||
uid_proc_map[-1].emplace_back(hide.second);
|
uid_proc_map[-1].emplace_back(hide.second);
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ void update_uid_map() {
|
|||||||
continue;
|
continue;
|
||||||
uid_proc_map[st.st_uid].emplace_back(hide.second);
|
uid_proc_map[st.st_uid].emplace_back(hide.second);
|
||||||
}
|
}
|
||||||
firstIteration = false;
|
first_iter = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user