fix: parse foldable display size from 4607 dump - #4
Open
tonycoder-hub wants to merge 1 commit into
Open
Conversation
The first activeMode: match on RenderService output is wrong on foldables: the inner panel stays in the dump after fold. Prefer DisplayManagerService (hidumper -s 4607) Bounds/FoldStatus, and fall back to the POWER_STATUS_ON RenderService panel. Fixes codematrixer#17 Co-authored-by: Tony Jin <407243179@qq.com>
tonycoder-hub
marked this pull request as ready for review
August 18, 2026 19:46
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.
Fixes codematrixer#17.
HdcWrapper.display_sizeused the firstactiveMode: WxHonhidumper -s RenderService -a screen. On foldables that dump lists every panel, and the inneractiveModestays in the text after fold (or when locked). The first match is then(0,0)-adjacent wrong: the stale inner panel, not the live cover.Conclusion after reading the issue + dumps
screen[0]isPOWER_STATUS_OFF2496x2224andscreen[1]isPOWER_STATUS_ON1080x2504. The old regex always takes2496x2224.hdc shell hidumper -s 4607 -a "-a"(DisplayManagerService). That dump’sFoldStatus+Bounds<L,T,W,H>(boxed in the screenshot) already track the current fold configuration.PhyBoundsis ignored so we do not double-count.POWER_STATUS_ON, thenSUSPEND(locked single panel). If every physical panel isOFF(locked foldable), do not guess the stale inner mode — return(0,0)and let 4607 win.No device required.
tests/test_display_size.pyuses the issue dump text (lock/unlock/fold) plus the 4607 sample. Those tests assert the oldactiveMode:regex still returns the stale inner size /(0,0), and the new parser returns the live panel.