capntrips / KernelFlasher

Kernel Flasher is an Android app to flash, backup, and restore kernels.
https://forum.xda-developers.com/t/dev-kernel-flasher.4439887/
Other
864 stars 50 forks source link

Error when flashing vendor_dlkm image causes app crash #17

Open Tomoms opened 10 months ago

Tomoms commented 10 months ago

Hi, pardon my ignorance about the inner working of dynamic partitions, I'm definitely not an expert. I build my own ROM, and I have added a dynamic vendor_dlkm partition to my setup for convenience, since I also do kernel development. Sometimes, flashing a vendor_dlkm image fails with the following error:

11-02 11:27:52.161 24679 24679 I httools_static: [libfs_mgr] dt_fstab: Skip disabled entry for partition vendor
11-02 11:27:52.165 24681 24681 I httools_static: [libfs_mgr] dt_fstab: Skip disabled entry for partition vendor
11-02 11:27:52.189 24684 24684 I lptools_static: [liblp] Updated logical partition table at slot 0 on device /dev/block/by-name/super
11-02 11:27:52.192 24684 24684 I lptools_static: [liblp] Updated logical partition table at slot 1 on device /dev/block/by-name/super
11-02 11:27:52.193  1056  1056 V RefreshRateConfigs: getBestRefreshRateLocked: 2 layers
11-02 11:27:52.193  1056  1056 V RefreshRateConfigs: TouchBoost - choose 90.00 Hz
11-02 11:27:52.193  1056  1056 V RefreshRateConfigs: getFrameRateOverrides: 2 layers
11-02 11:27:52.197  3762  3762 E FullInputEventModel: onStartInput event aborted: ol.y: could not obtain extracted text (class ol.y)
11-02 11:27:52.197 24686 24686 E lptools_static: [liblp] Not enough free space to expand partition: vendor_dlkm_kf
11-02 11:27:52.200 24688 24688 I httools_static: [libfs_mgr] dt_fstab: Skip disabled entry for partition vendor
11-02 11:27:52.217 24690 24690 E lptools_static: DM_DEV_REMOVE failed for [vendor_dlkm_a]: Device or resource busy
--------- beginning of crash
11-02 11:27:52.221 24403 24549 E AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2
11-02 11:27:52.221 24403 24549 E AndroidRuntime: Process: com.github.capntrips.kernelflasher, PID: 24403
11-02 11:27:52.221 24403 24549 E AndroidRuntime: java.lang.Error: Unmapping vendor_dlkm_a failed
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at com.github.capntrips.kernelflasher.common.PartitionUtil.flashLogicalPartition(PartitionUtil.kt:164)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at com.github.capntrips.kernelflasher.ui.screens.slot.SlotViewModel$flashImage$1.invokeSuspend(SlotViewModel.kt:554)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at com.github.capntrips.kernelflasher.ui.screens.slot.SlotViewModel$flashImage$1.invoke(Unknown Source:8)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at com.github.capntrips.kernelflasher.ui.screens.slot.SlotViewModel$flashImage$1.invoke(Unknown Source:2)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at com.github.capntrips.kernelflasher.ui.screens.slot.SlotViewModel$launch$1.invokeSuspend(SlotViewModel.kt:137)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
11-02 11:27:52.221 24403 24549 E AndroidRuntime:    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@48a7c9, Dispatchers.IO]

When this happens, the app suddenly force closes. Perhaps you can handle this exception more gracefully in your code? Thanks!