Repository navigation
fix: screenshot permission (#28), back handling (#30), cleanup (#35) - #50
Conversation
PR Summary by QodoFix screenshot permissions and Back handling; improve frame reuse
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
1.
|
- Screenshots on Android 6-9 request WRITE_EXTERNAL_STORAGE first and continue once it is granted; the PNG is encoded and saved on a background thread instead of the UI thread (fixes #28). - Back is no longer intercepted in onKeyDown(): the menu PopupWindow and the dialogs handle it themselves, including predictive back gestures; enableOnBackInvokedCallback opts Android 13-15 into the same behaviour (fixes #30). - Cleanup (fixes #35): - removed the ProGuard rule for the no longer existing Decoder$Frame; - FramePool keeps small and large frames in separate, bounded classes with rounded capacities, so small requests no longer take key-frame buffers and key frames reuse them; - the single-view NAL buffer and KEY_MAX_INPUT_SIZE are both 2 MiB, so 4K key frames fit; - (the 5-thread pool and the suspicious indentation went away with RtspSession, #45.) - Lint baseline refreshed: no errors left in it.
obtain() looks at each pooled frame of the size class at most once and puts undersized ones back, so a smaller buffer in front of a suitable one no longer causes an allocation and a lost buffer.
cc60036 to
fb6057d
Compare
|
Device-tested (#53): the screenshot permission is requested and screenshots are saved; Back exits correctly. FramePool keeps undersized frames (unit tests). Rebased onto the current v2, CI is green. |
Fixes #28, fixes #30, fixes #35.
WRITE_EXTERNAL_STORAGEwas never requested at runtimeKEYCODE_BACK; lint reportedGestureBackNavigationPopupWindow) and the dialogs handle it themselves, including predictive back gestures via their ownOnBackInvokedDispatcher.enableOnBackInvokedCallback="true"gives Android 13–15 the same behaviour#35 checklist
Decoder$Frame.RtspClient: already gone withRtspSession(refactor: shared RtspSession for single view and Quad (#33, #9, #18, #19, #27) #45).FramePool: separate size classes. Small frames (≤ 64 KiB) are rounded up to a power of two; large ones to 256 KiB steps, and the large class is bounded. Small requests no longer take key-frame buffers, and key frames reuse them.SuspiciousIndentation: already gone with refactor: shared RtspSession for single view and Quad (#33, #9, #18, #19, #27) #45.KEY_MAX_INPUT_SIZEand the single-view NAL buffer are both 2 MiB, so 4K key frames fit; MediaCodec treats the 1280×720 size only as a hint.Lint
The baseline is refreshed and contains no errors, only warnings:
GestureBackNavigationandSuspiciousIndentationare gone.Tests
FramePoolTestis new: capacity rounding, reuse, size-class separation, bounded large class. All JVM tests pass;assembleDebugandlintDebugpass.Device checklist