twrpinstall: prepare dynamic partitions before flashing - #23
Open
sorrow404Null wants to merge 1 commit into
Open
twrpinstall: prepare dynamic partitions before flashing#23sorrow404Null wants to merge 1 commit into
sorrow404Null wants to merge 1 commit into
Conversation
Stop recovery services that keep logical vendor and odm partitions open before removing their dm mappings, then restore services that were running before teardown. Recognize slot-suffixed dynamic partition operation lists used by full-device packages. Test: source setup-env.sh && export TARGET_HW_DISK_ENCRYPTION=false TARGET_HW_DISK_ENCRYPTION_PERF=false && m SOONG_CONFIG_TYPE_twrpGlobalVars_supports_hw_fde=bool SOONG_CONFIG_TYPE_twrpGlobalVars_supports_hw_fde_perf=bool -j12 libtwrpinstall
sorrow404Null
force-pushed
the
fix-dynamic-partition-install
branch
from
September 1, 2026 03:38
ac0c4a7 to
6203402
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates twrpinstall to better support flashing update packages on devices using dynamic partitions by detecting more OTA package layouts and preparing dynamic partition mappings/services before invoking the updater binary.
Changes:
- Extend update-package detection to recognize slot-suffixed
dynamic_partitions_op_list_{a,b}entries. - Add logic to discover running init services whose processes reference logical (dynamic) partitions via
/procinspection. - Stop affected services and unmap dynamic partitions prior to flashing.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+456
to
+469
| if (ret_val == INSTALL_SUCCESS && _isUpdatePkg && PartitionManager.Get_Super_Status()) { | ||
| const std::vector<std::string> services_to_restart = Get_Super_Device_Services(); | ||
| Set_Init_Service_State(services_to_restart, "stop", "stopped", std::chrono::seconds(2)); | ||
|
|
||
| gui_msg("unmount_dynamic_partitions=Unmounting dynamic partitions..."); | ||
| if (!PartitionManager.Unmap_Super_Devices()) { | ||
| gui_err("unmount_dynamic_partitions_err=Failed unmapping dynamic partitions"); | ||
| ret_val = INSTALL_ERROR; | ||
| } | ||
|
|
||
| Set_Init_Service_State(services_to_restart, "start", "running", std::chrono::seconds(5)); | ||
| } | ||
| if (ret_val == INSTALL_SUCCESS) | ||
| ret_val = Run_Update_Binary(path, wipe_cache, UPDATE_BINARY_ZIP_TYPE); |
Comment on lines
+247
to
+251
| for (const char* suffix : { "_a", "_b" }) { | ||
| std::string op_list = UPDATE_DYNAMIC_PART_OP_LIST_NAME; | ||
| op_list += suffix; | ||
| if (FindEntry(Zip, op_list, &find_entry) == 0) return true; | ||
| } |
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.
Summary
TWPartitionManager, then restore their previous running stateTesting
source setup-env.sh && export TARGET_HW_DISK_ENCRYPTION=false TARGET_HW_DISK_ENCRYPTION_PERF=false && m SOONG_CONFIG_TYPE_twrpGlobalVars_supports_hw_fde=bool SOONG_CONFIG_TYPE_twrpGlobalVars_supports_hw_fde_perf=bool -j12 libtwrpinstallDM_DEV_REMOVE/EBUSY; dynamic-partition teardown allowed the full-device package to complete with updater RC=0 while affected recovery services were restored after unmapping