From ebc16583fbeadd49d85cb291186ff1bc05d6c9f8 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Mon, 19 May 2025 21:30:13 +0800 Subject: [PATCH] =?UTF-8?q?[skip=20ci]=EF=BC=9Akernel:=20kpm:=20add=20comp?= =?UTF-8?q?atibility=20for=20kernel=204.14=20and=20lower=20(#76)=20manger:?= =?UTF-8?q?=20Fix=20and=20simplify=20back=20gesture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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: https://github.com/yanivagman/BPFroid/blob/107717913bce95d6d5c232bf8dc4b11932b59d50/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> --- .github/workflows/crowdin.yml | 36 +++++++++++++++++++ kernel/kpm/super_access.c | 4 +++ .../java/com/sukisu/ultra/ui/screen/Flash.kt | 30 ++++++++-------- 3 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/crowdin.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 00000000..a5b03ce5 --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,36 @@ +name: Crowdin Action + +on: + push: + branches: [ main ] + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: crowdin action + uses: crowdin/github-action@master + with: + upload_sources: true + upload_translations: true + download_translations: true + localization_branch_name: "Crowdin" + crowdin_branch_name: "main" + create_pull_request: true + pull_request_title: 'New Crowdin Translations' + pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' + pull_request_base_branch_name: 'main' + skip_untranslated_files: true + env: + # A classic GitHub Personal Access Token with the 'repo' scope selected (the user should have write access to the repository). + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + # A numeric ID, found at https://crowdin.com/project//tools/api + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + + # Visit https://crowdin.com/settings#api-key to create this token + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/kernel/kpm/super_access.c b/kernel/kpm/super_access.c index 0829bfda..7a61e22f 100644 --- a/kernel/kpm/super_access.c +++ b/kernel/kpm/super_access.c @@ -167,7 +167,11 @@ DYNAMIC_STRUCT_BEGIN(task_struct) DEFINE_MEMBER(task_struct, group_leader) DEFINE_MEMBER(task_struct, mm) DEFINE_MEMBER(task_struct, active_mm) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) + DEFINE_MEMBER(task_struct, pids[PIDTYPE_PID].pid) +#else DEFINE_MEMBER(task_struct, thread_pid) +#endif DEFINE_MEMBER(task_struct, files) DEFINE_MEMBER(task_struct, seccomp) #ifdef CONFIG_THREAD_INFO_IN_TASK diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt index 46d504ca..a3426671 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt @@ -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,