fix: comprehensive stability, memory, and installer improvements#3187
Open
Anajrim01 wants to merge 14 commits intoReVanced:devfrom
Open
fix: comprehensive stability, memory, and installer improvements#3187Anajrim01 wants to merge 14 commits intoReVanced:devfrom
Anajrim01 wants to merge 14 commits intoReVanced:devfrom
Conversation
Instead of throwing on invalid values, it silently fails and filters the invalid Long out as a null
- fix Koin crash by always passing SelectedApplicationInfo.ViewModelParams when resolving SelectedAppInfoViewModel in nested destinations - serialize patcher ProgressEvent handling through a single channel consumer to prevent out-of-order/concurrent step state updates - improve PatcherWorker resilience: - rethrow UserInteractionException instead of silently swallowing it - timeout downloader loading (30s) to avoid indefinite waits - fail fast if patched APK is missing/empty before signing - delete failed output artifacts after unsuccessful runs - stop silently swallowing setForeground failures on Android 14+ - remove GlobalScope usage in uiSafe and patcher cleanup paths - make patch selection/options writes more atomic and race-safe: - DAO-level get-or-create helpers with conflict-safe inserts - transactional selection import replacement - replace several versionName!! call sites with safe fallbacks to prevent NPEs on malformed APK metadata - replace magic download cache TTL literal with a named constant This reduces startup crashes, improves patching reliability, and hardens data integrity under concurrent updates. # Conflicts: # app/src/main/java/app/revanced/manager/ui/viewmodel/AppSelectorViewModel.kt
Author
|
I've tried to verify that all functionality remains the same without breaking anything and have come across no negative behavior except patcher slowing down a bit when GC is overwhelmed (but this is intentional to prevent it from crashing from too much memory allocation). |
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.
This PR introduces a widespread set of stability and performance improvements across the application. It addresses critical crashes (including the Koin initialization failure), fixes memory exhaustion (OOM) and UI lag during heavy patching, properly supports multi-user root installations, and eliminates several data-race conditions.
Bug Fixes & Crash Resolutions
InvocationTargetExceptionoccurring on startup by properly resolving theparentBackStackEntryand passing its data.ChangelogSource.Managerfactory inUpdateViewModel..toLong()with.toLongOrNull()inBasePreferencesManagerto prevent crashes from malformed data.!!non-null assertions acrossversionNamechecks, gracefully falling back to"unknown".KeystoreManagerthat multiplied the validity duration by 24, resulting in incorrect expiry dates.Performance & Memory Improvements
Channelwith a10,000capacity and aBufferOverflow.DROP_OLDESTstrategy.Core, Concurrency, and Database
RandomtoUUID.randomUUID()inAppDatabaseto guarantee unique IDs.OptionDaoandSelectionDao'get-or-create' operations in@Transactionblocks withOnConflictStrategy.IGNOREto resolve duplicate entry exceptions.workerInputsinWorkerRepositoryto aConcurrentHashMap.GlobalScope.launchusage inPatcherViewModelandUtil.kt(uiSafe), replacing them with proper lifecycle-bound scopes and safeLooper.getMainLooper()handlers.REPLACEtoKEEPto prevent the accidental cancellation of actively running patcher/downloader jobs.Root & Installer Enhancements
--user 0. The application now correctly calculates theuserIddynamically viaProcess.myUid() / 100000.greppath matching for mounts by explicitly passing the-Fflag, ensuring file paths are evaluated as literal strings rather than regex.patchedApkis deleted if the patching process fails.Notes for Reviewers
Changelog Fix: HardcodingChangelogSource.Manageracts as a highly effective workaround for the prerelease parsing crash, bypassing the failing source argument entirely.Closes / Fixes
InvocationTargetException, upon invocation. #3153