[skip ci]:kernel: kpm: add compatibility for kernel 4.14 and lower (#76)

manger: Fix and simplify back gesture

`thread_pid` is not defined in kernel 4.14 and lower, leading to compilation issue.
To fix this, use `pids[PIDTYPE_PID].pid` for kernel versions 4.14 and lower.
Else use `thread_pid` for kernel versions 4.19 and higher.

Reference: 107717913b/tracee/tracee.bpf.c (L354)

Co-authored-by: sidex15 <24408329+sidex15@users.noreply.github.com>
Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
ShirkNeko
2025-05-19 21:30:13 +08:00
parent 2a10b41781
commit ebc16583fb
3 changed files with 55 additions and 15 deletions

View File

@@ -192,25 +192,29 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
}
}
BackHandler(enabled = true) {
val onBack: () -> Unit = {
if (currentFlashingStatus.value != FlashingStatus.FLASHING) {
navigator.navigate(ModuleScreenDestination) {
if (flashIt is FlashIt.FlashBoot) {
navigator.popBackStack()
} else {
navigator.navigate(ModuleScreenDestination) {
}
}
}
}
BackHandler(enabled = true) {
onBack()
}
Scaffold(
topBar = {
TopBar(
currentFlashingStatus.value,
currentStatus,
navigator = navigator,
onBack = {
if (currentFlashingStatus.value != FlashingStatus.FLASHING) {
navigator.navigate(ModuleScreenDestination) {
}
}
},
flashIt = flashIt,
onBack = onBack,
onSave = {
scope.launch {
val format = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault())
@@ -421,7 +425,8 @@ private fun TopBar(
status: FlashingStatus,
moduleStatus: ModuleInstallStatus = ModuleInstallStatus(),
navigator: DestinationsNavigator,
onBack: () -> Unit = {},
flashIt: FlashIt,
onBack: () -> Unit,
onSave: () -> Unit = {},
scrollBehavior: TopAppBarScrollBehavior? = null
) {
@@ -459,12 +464,7 @@ private fun TopBar(
}
},
navigationIcon = {
IconButton(onClick = {
if (status != FlashingStatus.FLASHING) {
navigator.navigate(ModuleScreenDestination) {
}
}
}) {
IconButton(onClick = onBack) {
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null,