feat: Add bytecode mode setting to expert mode#403
Open
Conversation
09f75a5 to
997adc5
Compare
PatcherProcess: fix process hang when session throws events.finished(null) was placed after the try/finally block. If Session.run() threw an exception it was caught by CoroutineExceptionHandler but events.finished() was never called, leaving patching.await() in ProcessRuntime hanging indefinitely until the process was killed. Moved events.finished(null) inside the try block on success, and added a catch block that calls events.finished(stackTrace) on failure, ensuring the main process always receives a completion signal regardless of outcome. --- CoroutineRuntime: fix MemoryMonitor polling thread leak on early failure startMemoryPolling() was called before the try block. Any exception thrown before SplitApkPreparer.prepareIfNeeded() — such as from bundles(), PatchBundle.Loader.patches(), or an invalid bundle ID — would skip stopMemoryPolling(), leaving the polling thread running indefinitely. Wrapped the entire execute() body in an outer try/finally to guarantee stopMemoryPolling() is always called. The inner try/finally for preparation.cleanup() is preserved. --- PatcherWorker: fix wakelock not released if claimInput throws wakeLock.acquire() was called before workerRepository.claimInput(). If claimInput() threw an exception the finally block was never reached, holding a partial wakelock for up to 10 minutes. Moved claimInput() inside the try/finally block using lateinit var args so the wakelock is always released and args remains accessible after the block for the temporary file cleanup check. PatcherWorker: remove duplicate MemoryMonitor calls startMemoryPolling() was called in both PatcherWorker and inside CoroutineRuntime.execute(), causing two threads writing concurrently to the same @volatile fields (memoryUsedAverage, memoryUsedMax, memoryPollSamples), producing incorrect memory statistics. stopMemoryPolling() was also redundantly called in PatcherWorker after already being called inside CoroutineRuntime.execute() and PatcherProcess. Removed both redundant calls along with the now-unused MemoryMonitor import and usedCoroutineFallback variable. Memory monitor lifecycle is now managed entirely within each runtime implementation. PatcherWorker: replace restricted API usage with public equivalent Result.Success type check required @SuppressLint("RestrictedApi") as Result.Success is an internal androidx.work class. Replaced with a patchingSucceeded boolean flag checked against the public Result.success() value, removing the suppression annotation and its import. PatcherWorker: log warning when temp APK cleanup fails patchedApk.delete() silently ignored failures. Now logs a warning if the temporary patched APK cannot be deleted and still exists. --- Session: remove unused nextPatchIndex variable
Contributor
|
Don't merge until MorpheApp/morphe-patcher#106 is merged |
# Conflicts: # app/src/main/java/app/morphe/manager/patcher/worker/PatcherWorker.kt
Contributor
Author
|
Can merge? |
Contributor
|
Can wait. There was some issue with patching X |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.