Asynchronous View Tree Generation for Android Page Display
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing page display methods under the Android operating system face issues with slow display speed and poor fluency due to the single-threaded processing of layout files, which results in increased time consumption when dealing with large content and numerous view objects.
Innovation Solution
A page display method that acquires a layout file, obtains view data, and asynchronously generates a target view tree using multiple processing threads, allowing for efficient processing and display of the page.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If single-threaded processing is used to convert layout file to ViewTree, then system simplicity is maintained, but display speed and fluency deteriorate
Solution Approach 1:
The patent divides the ViewTree generation process into multiple independent segments that can be processed in parallel. Specifically, it separates the conversion process into: (1) parsing the layout file to extract view data, (2) generating view objects from the extracted data, and (3) assembling view objects into the final ViewTree. These segments are processed concurrently using multiple threads, thereby improving display speed while managing complexity through structured division of labor.
Solution Approach 2:
The patent performs preliminary extraction of view data from the layout file before the actual ViewTree generation. This preliminary action separates data extraction from object creation, allowing the extraction phase to complete independently and prepare data for parallel processing. This prepares the system for multi-threaded execution by pre-processing the layout file into a format suitable for concurrent view object generation.
2Productivity
If single-threaded processing is used, then resource consumption is low, but time consumption increases when dealing with large content
Solution Approach 1:
The patent segments the ViewTree generation into parallelizable tasks: layout file parsing, view data extraction, view object creation, and tree assembly. Each segment can be processed independently or concurrently, significantly improving productivity when handling large content with numerous view objects.
Solution Approach 2:
The patent implements dynamic thread management where the number and allocation of processing threads adapt to the complexity of the layout file. When dealing with large content, the system dynamically increases parallel processing capacity to reduce time consumption, while maintaining flexibility to adjust resource allocation based on real-time processing needs.
3Speed
If asynchronous multi-threaded generation is implemented, then view tree generation speed improves, but system complexity increases
Solution Approach 1:
The patent structures the asynchronous multi-threaded process into clearly defined segments with specific responsibilities: a parsing thread for extracting view data, generation threads for creating view objects, and an assembly thread for building the final ViewTree. This segmentation reduces thread management complexity by assigning dedicated functions to each thread group while maintaining high generation speed through parallel execution.
Solution Approach 2:
The patent introduces an intermediary data structure (view data) that serves as a buffer between the layout file parsing phase and the ViewTree generation phase. This intermediary allows asynchronous processing by decoupling the input parsing from the output generation, enabling multiple threads to work independently on different aspects of the conversion process without direct interference, thus managing complexity while improving speed.
Data Source
AI summary
Embodiments of the present disclosure provide a page display method, apparatus, electronic device, and storage medium, comprising acquiring a layout file of a target page, which is used to characterize a page layout of the target page; according to the layout file, obtaining view data of the target page, which is used to characterize view attributes of view objects within the target page; based on the view data, asynchronously generating a target view tree corresponding to the target page via at least two processing threads; and displaying the target page based on the target view tree.


