Wake-up-free collaborative refresh method and device
By intercepting data packets, utilizing synchronization sequence identifiers, and performing logical operations in an isolated environment, the problem of inconsistency between the visual state of interface components and the application database was solved, achieving low-power and highly secure interface component refresh and ensuring data consistency and stability.
Patent Information
- Application Number
- CN202611307208.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-10
AI Technical Summary
In distributed multi-device collaborative scenarios, after the visual state of the interface components is updated, the receiving application process is not woken up, resulting in the private database not being synchronized, leading to data inconsistency and causing confusion in user perception. Furthermore, the out-of-order, duplicate, or lost data packets in distributed network transmission exacerbate this problem.
By intercepting data packets, the application process is prevented from starting. The validity of incremental state data is determined by using synchronization sequence identifiers and local version status information. Logical operations are performed in an isolated environment to update the UI component template data. Data packets are stored in the local cache and written to the database in batches when the application process is started.
Without waking up the application process, it achieves eventual consistency between the visual state of the interface components and the persistent data of the application, reduces terminal power consumption, improves the stability of distributed transmission, and eliminates security risks.
Smart Images

Figure CN123067982A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of distributed computing and multi-device collaboration technology, and in particular to a wake-up-free collaborative refresh method and apparatus. Background Technology
[0002] In distributed, multi-device collaborative scenarios, UI components (such as universal cards) serve as the core carriers for information display and lightweight interaction, and are widely used in various terminals such as smartphones, wearable devices, and in-vehicle systems. Users expect the content of UI components to remain synchronized in real time across different devices to provide a consistent and seamless interactive experience.
[0003] In existing cross-device interface component synchronization solutions, to avoid excessive power consumption caused by frequently waking up the receiving application process, there are technical means to have the system service refresh the visual effects of the interface components. However, such solutions generally face the following problems: although the visual state of the interface components has been updated through the system service, the receiving application process, because it has not been woken up, has not been able to synchronously write the corresponding changed data into its private database. This results in inconsistencies between the data presented in the application and the updated visual state of the interface components when the user subsequently opens the application, causing data conflicts and user confusion. At the same time, the out-of-order, duplicate, or lost data packets in distributed network transmission further exacerbate the risk of the above-mentioned inconsistencies, which may cause abnormal display of interface components or rollback.
[0004] Therefore, there is an urgent need to provide a collaborative refresh solution that can ensure eventual consistency between the visual state of cross-device interface components and persistent application data without waking up the receiving application process. Summary of the Invention
[0005] This application provides a wake-up-free collaborative refresh method and apparatus, which aims to solve the problem of data inconsistency caused by the updated visual effects of interface components but the unsynchronized application database under the wake-up-free refresh mechanism.
[0006] To achieve the above objectives, this application provides the following technical solution:
[0007] A wake-up-free collaborative refresh method includes:
[0008] After intercepting a data packet from the first device, the launch operation of the application process corresponding to the target interface component is prohibited; the data packet contains incremental status data and the corresponding synchronization sequence identifier;
[0009] Based on the synchronization sequence identifier and the locally stored version status information, the status of the incremental status data is determined.
[0010] If the incremental state data is valid, logical operations are performed on the incremental state data using an isolated environment to obtain the operation result.
[0011] The variables in the local interface component template data are updated according to the calculation result, and the updated interface component template data is sent to the rendering service to refresh the display of the target interface component.
[0012] The data packet is stored in the local cache. When the application process is launched, the data packet is read from the local cache, and the incremental status data in the data packet is written in batches and updated to the local database.
[0013] A wake-up-free collaborative refresh device includes:
[0014] The data packet interception unit is used to prevent the launch operation of the application process corresponding to the target interface component after intercepting a data packet from the first device; the data packet contains incremental status data and a corresponding synchronization sequence identifier;
[0015] The status determination unit is used to determine the status of the incremental status data based on the synchronization sequence identifier and the version status information stored locally.
[0016] A logic operation unit is used to perform logical operations on the incremental state data in an isolated environment if the incremental state data is valid data, so as to obtain the operation result;
[0017] The interface component rendering unit is used to update the variables in the local interface component template data according to the calculation result, and send the updated interface component template data to the rendering service to refresh the display of the target interface component;
[0018] The data alignment unit is used to store the data packet in a local cache. When the application process is started, it reads the data packet from the local cache and writes the incremental status data in the data packet in batches to update the local database.
[0019] A storage medium comprising a stored program, wherein the program is executed by a processor to perform the wake-up-free cooperative refresh method described above.
[0020] An electronic device includes: a processor, a memory, and a bus; the processor and the memory are connected via the bus.
[0021] The memory is used to store the program, and the processor is used to run the program, wherein the program is executed by the processor to perform the wake-up-free collaborative refresh method described above.
[0022] The technical solution provided in this application is as follows: After intercepting data packets from the first device, the startup operation of the application process corresponding to the target interface component is prohibited; based on the synchronization sequence identifier and combined with the locally stored version status information, the status of the incremental status data is determined; if the incremental status data is valid, logical operations are performed on the incremental status data in an isolated environment to obtain the operation result; the variables in the local interface component template data are updated according to the operation result, and the updated interface component template data is sent to the rendering service to refresh the display of the target interface component; the data packets are stored in the local cache, and when the application process is started, the data packets are read from the local cache, and the incremental status data in the data packets is written in batches and updated to the local database. This application reduces terminal power consumption by prohibiting the startup operation of the application process and having the system side handle the refresh of the interface component; it eliminates the security risk of untrusted code running at the system privilege level by performing logical operations in an isolated environment; it ensures the eventual consistency between the visual effect of the interface component and the persistent data by storing the data packets in the local cache and writing and updating them in batches when the application process is started; and it improves the stability of distributed transmission by identifying out-of-order data through the synchronization sequence identifier. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a first flowchart illustrating a wake-up-free collaborative refresh method provided in an embodiment of this application;
[0025] Figure 2 This is a second flowchart illustrating a wake-up-free collaborative refresh method provided in an embodiment of this application.
[0026] Figure 3 A third flowchart illustrating a wake-up-free collaborative refresh method provided in an embodiment of this application;
[0027] Figure 4 A schematic diagram of the fourth process of a wake-up-free collaborative refresh method provided in an embodiment of this application;
[0028] Figure 5 A fifth flowchart illustrating a wake-up-free collaborative refresh method provided in this application embodiment;
[0029] Figure 6 A sixth flowchart illustrating a wake-up-free collaborative refresh method provided in this application embodiment;
[0030] Figure 7 A seventh flowchart illustrating a wake-up-free collaborative refresh method provided in this application embodiment;
[0031] Figure 8 This is a schematic diagram of the architecture of a wake-up-free collaborative refresh device provided in an embodiment of this application. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0034] like Figure 1 The diagram shown is a first flowchart of a wake-up-free collaborative refresh method provided in this application embodiment. The method is applied to the system resident service of the receiving device (i.e., the second device) and includes the following steps.
[0035] S101: After intercepting a data packet from the first device, prohibit the launch operation of the application process corresponding to the target interface component.
[0036] The first device is a sending device equipped with a detection module that detects user interaction with its universal desktop interface components. The first and second devices are connected via a distributed communication link, forming the sending and receiving nodes in a multi-device collaborative scenario. The first device responds to user interaction with its universal desktop interface components by generating data packets and sending them to the second device via the communication link.
[0037] The target interface component serves as an information display and interaction carrier running on the desktops of various terminal devices in a distributed multi-device collaborative scenario. The same target interface component can be added to multiple interconnected terminal devices simultaneously. The target interface component is the interface component instance on the second device corresponding to the data packet; that is, the specific presentation form of the target interface component on the second device. The target interface component shares the same interface component identifier with the interacted interface components on the first device, enabling cross-device association through this identifier.
[0038] In addition, the data packet contains incremental state data and a corresponding synchronization sequence identifier. The incremental state data consists of state variables extracted from data changes generated by interactions with UI components on the first device, and does not include static style data. The synchronization sequence identifier is used to uniquely identify the timing relationship of the data packet.
[0039] It should be noted that the incremental state data is obtained by the first device after detecting user interaction with interface components, by capturing the original data changes generated by the interaction, and then performing incremental refinement processing on the original data changes. This incremental refinement process includes: filtering static style data unrelated to the visual presentation of the interface components from the original data changes, retaining only key state variables directly related to changes in the display state of the interface components, to form the incremental state data. A synchronization sequence identifier is appended to the incremental state data when the data packet is generated, used to uniquely identify the version relationship and timing of the data packet.
[0040] In some examples, when the second device receives a data packet from the first device via a communication link, the system resident service intercepts the packet. The system resident service is a system-level service process that runs residently in the operating system of the second device. After intercepting the data packet, the system resident service sends a process lock control signal to the process management service. This signal instructs the process management service to disable the launch link (i.e., the process launch interface) of the application process corresponding to the target interface component, thereby preventing calls to the process launch interface.
[0041] In a possible implementation, the data packet is a lightweight binary data packet sent by the first device via a distributed communication link. This data packet is generated through binary encoding compression and contains incremental state data and a synchronization sequence identifier. The synchronization sequence identifier is a generational vector clock, which contains the serial number of the sending device and the synchronization generation number, used to uniquely identify the version relationship and timing of the data packet. The process management service is a system-level service in the second device's operating system responsible for managing the lifecycle of application processes; its process launch interface is the entry point for waking up application processes. By sending a process lock control signal to the process management service, this interface is made unavailable at the system level, thereby preventing the application process from launching at its source.
[0042] In this embodiment of the application, by disabling the application process to start up, the power consumption overhead caused by frequently waking up the main application process due to the synchronization of interface components is avoided.
[0043] S102: Based on the synchronization sequence identifier and combined with the locally stored version status information, determine the status of the incremental status data.
[0044] The version status information is an identifier stored locally on the second device, used to indicate the latest data version applied to the current interface component. One possible implementation of the version status information is a maximum watermark, which is the largest synchronization sequence identifier among all data packets successfully processed and applied to the display of the interface component by the second device.
[0045] In some examples, the system's resident service extracts the synchronization sequence identifier from the intercepted data packets, reads the locally stored version status information, and compares the two. If the synchronization sequence identifier is greater than the version status information, the incremental status data is determined to be valid; if the synchronization sequence identifier is less than or equal to the version status information, the incremental status data is determined to be invalid, and the data packet is discarded. This comparison and determination process is used to filter duplicate data packets caused by network transmission.
[0046] In a possible implementation, the version status information is the highest watermark of the current application status of the interface component stored at the local system layer of the second device. This watermark records the largest synchronization sequence identifier among all data packets successfully processed and applied to the display of the interface component by the second device. The comparison between the synchronization sequence identifier and the version status information is a numerical comparison. If the synchronization sequence identifier is greater than the version status information, it indicates that the data packet is new and has not yet been applied by the second device, and is therefore determined to be valid data; if the synchronization sequence identifier is equal to or less than the version status information, it indicates that the data packet has been processed by the second device, and is therefore determined to be invalid data. The above comparison and determination process is used to filter out duplicate data packets that may occur during distributed network transmission, avoiding interface component display status rollback or database write conflicts due to duplicate application.
[0047] Optionally, the process of determining the state of incremental state data based on the synchronization sequence identifier and locally stored version state information can be found in [reference needed]. Figure 2 The steps are shown.
[0048] Optional, Figure 2 The illustrated process addresses how to determine the validity of incremental status data after it has been received. To fulfill the prerequisite of ensuring that all incremental status data has been received before determining validity, this application embodiment also provides... Figure 3 The steps shown are as follows: Figure 2 and Figure 3 The processes described above together constitute a complete data status determination mechanism.
[0049] S103: If the incremental state data is valid, perform logical operations on the incremental state data using the isolation environment to obtain the operation result.
[0050] The isolated environment is a lightweight, secure execution environment built into the system's resident services. It is used to execute the logical expressions built into the UI components within a system-level privileged isolation sandbox. The isolated environment is a non-Turing-complete instruction execution environment, supporting only predefined declarative logical operations and not loop or recursive instruction structures.
[0051] In some examples, if the incremental state data is deemed valid, the system's resident service inputs the incremental state data into the isolation environment. The isolation environment then performs logical operations based on the state variables in the incremental state data and the update logic bound to the UI component template data, and outputs the results.
[0052] In a possible implementation, the isolated environment is a lightweight expression computation engine built into the system's resident services, running in an independent, lightweight, secure sandbox isolation zone. This isolated environment is a non-Turing-complete micro-execution environment, supporting only the execution of predefined declarative logical expressions, and does not support loops, recursion, or jump instructions, nor does it allow calls to any external system APIs. The isolated environment has a built-in instruction step counter, which increments by one for each instruction executed. For example, for a habit check-in interface component, the incremental status data includes the habit identifier ID, the current progress count, and whether the check-in is complete. The isolated environment performs a subtraction operation based on the remaining progress calculation logic bound to the template (target value minus the current progress value) to obtain the remaining progress result. Throughout the entire logical operation process, the initialization of the JavaScript runtime engine is not involved, ensuring extremely low power consumption and high system-level security during the calculation process.
[0053] Optionally, the process of performing logical operations on incremental state data in an isolated environment to obtain the operation results can be found in [link to documentation]. Figure 4 The steps are shown.
[0054] In this embodiment, logical operations are performed in an isolated environment, eliminating the need to start the JavaScript engine of the application process and preventing the security risks of untrusted third-party code running at the system privilege level.
[0055] S104: Update the variables in the local interface component template data according to the calculation result, and send the updated interface component template data to the rendering service to refresh the display of the target interface component.
[0056] The interface component template data is a virtual DOM (Document Object Model) template tree pre-cached locally on the second device, corresponding to the target interface component. The interface component template data contains template nodes, which are configured with update logic corresponding to incremental state data, specifically manifested as declarative abstract syntax tree nodes.
[0057] In some examples, the system's resident service, based on the calculation result, substitutes the result into the corresponding variable placeholders in the UI component template data to generate updated UI component template data, and then sends the updated UI component template data to the UI (User Interface) rendering service process of the second device. The rendering service process then performs local pixel redrawing on the target UI component based on the updated UI component template data.
[0058] In a possible implementation, the interface component template data is a virtual DOM template tree corresponding to the target interface component, pre-cached locally on the second device. The virtual DOM template tree describes the complete visual layout of the interface component in a tree structure, where nodes associated with dynamic data have pre-defined variable placeholders. These variable placeholders are specific markers reserved in the template nodes (e.g., "{{progress}}", "{{status}}", etc.), used to be replaced by actual data during template rendering. The system's resident service substitutes the calculation results into the corresponding variable placeholders to generate a complete, lightweight virtual DOM tree that can be directly used for rendering. This virtual DOM tree is sent directly to the UI rendering service process via a fast path. The UI rendering service process compares this virtual DOM tree with the currently displayed virtual DOM tree, performing pixel redrawing only on the changed local areas, without redrawing the entire interface component.
[0059] Optionally, the process of updating variables in the local UI component template data based on the calculation results can be found in [link to documentation]. Figure 5 The steps are shown.
[0060] S105: Store the data packet in the local cache. When the application process is started, read the data packet from the local cache, write the incremental status data in the data packet in batches, and update the local database.
[0061] The local cache is a multi-version distributed shared memory at the second device system layer. One possible implementation of the local cache is a circular buffer.
[0062] In some examples, the system's resident service sends the updated UI component template data to the rendering service while simultaneously storing the data packets in a local cache. When the application process is launched, a delayed data alignment module is configured within the application process. This module reads the data packets from the local cache, extracts the incremental state data and corresponding synchronization sequence identifiers from the data packets, and writes and updates them to the local database in batches within a single database transaction.
[0063] In a possible implementation, the local cache is a multi-version distributed shared memory at the second device system layer. The local cache stores multiple data packets and their corresponding incremental state data and synchronization sequence identifiers in the form of a circular buffer. The circular buffer is a fixed-size circular storage structure; when the buffer is full, new data overwrites the oldest data, ensuring that the cache always stores the latest incremental update records. Since the local cache is system-level shared memory, even when the application process is in sleep mode, the system's resident services can still write data normally, unaffected by the application process's state. When the application process is restarted, the delayed data alignment module reads all data packets accumulated during the application process's sleep period from the local cache during the application initialization phase, sorts them by synchronization sequence identifier, and writes them in batches to the local relational database in a single database transaction, ensuring the atomicity and consistency of the data write.
[0064] Optionally, the implementation process for batch writing and updating incremental status data from data packets to the local database can be found in [reference needed]. Figure 6 The steps are shown.
[0065] Optionally, if the target UI component does not support wake-up-free synchronization, you can refer to... Figure 7 The steps are shown.
[0066] The processes shown in S101-S105 above, by disabling the application process's startup operation, using an isolated environment to perform logical operations, storing data packets in a local cache and writing them to the database in batches when the application process is started, can complete the refresh of interface components without waking up the application process, while taking into account low power consumption, high security and data consistency.
[0067] like Figure 2 The diagram shown is a second flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application. This flowchart is a... Figure 1 The further refinement of "determining the status of incremental status data based on the synchronization sequence identifier and the locally stored version status information" in S102 includes the following steps.
[0068] S201: Retrieve locally saved version status information.
[0069] The version status information is an identifier stored at the local system layer of the second device, indicating the latest data version applied to the current interface component. It is stored in a multi-version distributed shared memory. The version status information is updated after each successful application of incremental status data to ensure that it always reflects the latest data version applied to the current interface component.
[0070] In some examples, the system resident service reads version status information of the current UI component's applied state from the local cache of the second device.
[0071] In a possible implementation, version status information is stored in a multi-version distributed shared memory at the second device system layer, in the same storage area as the local cache. The system's resident services retrieve version status information by reading predetermined data fields from this storage area.
[0072] S202: Compare the synchronization sequence identifier with the version status information to obtain the comparison result.
[0073] The comparison result is the numerical relationship between the synchronization sequence identifier and the version status information. The comparison result includes two possibilities: "greater than" and "not greater than", which directly reflects the newness of the incremental status data carried by the data packet relative to the data already applied by the current interface component.
[0074] In some examples, the system resident service compares the synchronization sequence identifier extracted from the data packet with the locally stored version status information to obtain the comparison result.
[0075] In a possible implementation, the comparison result is a numerical ranking, including both "greater than" and "not greater than". This comparison operation essentially determines whether the data version represented by the synchronization sequence identifier is higher than the currently applied data version. Since the synchronization sequence identifier is a strictly incremental sequence number, the numerical ranking directly reflects the order of the data versions.
[0076] It should be noted that the prerequisite for executing step S201 is usually that the sequence continuity has been confirmed. The process for confirming sequence continuity can be found in [link to relevant documentation]. Figure 3 The steps are shown.
[0077] S203: Based on the comparison results, determine whether the incremental status data is valid.
[0078] Valid data refers to incremental state data that has not yet been applied by the second device, meaning its corresponding synchronization sequence identifier is greater than the current version state information. Invalid data refers to incremental state data that has already been applied by the second device, meaning its corresponding synchronization sequence identifier is not greater than the current version state information.
[0079] In some examples, if the comparison result shows that the synchronization sequence identifier is greater than the version status information, the system's resident service determines that the incremental status data is valid; if the comparison result shows that the synchronization sequence identifier is not greater than the version status information, the system's resident service determines that the incremental status data is invalid.
[0080] In a possible implementation, the determination logic is as follows: if the synchronization sequence identifier is greater than the version status information, it indicates that the data packet contains new data that has not yet been applied by the second device, and therefore it is valid data; conversely, if the synchronization sequence identifier is not greater than the version status information, the data in the data packet has been applied by the second device, and therefore it is invalid data.
[0081] S204: If the incremental status data is invalid, discard the data packet.
[0082] Discarding data packets means that the system's resident services will no longer perform subsequent visual refresh and data alignment operations on invalid data packets, and will directly release the memory resources occupied by the data packets.
[0083] In some examples, if incremental status data is determined to be invalid, the system's resident service discards the packet.
[0084] In a possible implementation, the discarding operation includes: the system's resident services no longer performing subsequent visual refresh and data alignment operations on the data packet, directly releasing the memory resources occupied by the data packet. The discarding operation itself does not generate any system logs or user notifications to avoid unnecessary system overhead.
[0085] The processes shown in S201-S204 above achieve the filtering of expired or duplicate data packets by comparing the synchronization sequence identifier with the version status information and determining the validity of the incremental status data accordingly.
[0086] like Figure 3 The diagram shown is a third flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application. This flowchart is a... Figure 1 Further supplements to "determine the status of incremental status data based on the synchronization sequence identifier and the locally stored version status information" in S102 include the following steps.
[0087] S301: Detect whether the synchronization sequence identifier and version status information are continuous.
[0088] In this context, "continuous" means there is no gap in sequence numbers between the synchronization sequence identifier and the version status information. If the synchronization sequence identifier equals the version status information plus one, it is considered continuous; if the synchronization sequence identifier is greater than the version status information plus one, it is considered discontinuous. Discontinuity indicates that data packets have been lost.
[0089] In some examples, the system's resident service checks whether the synchronization sequence identifier and version status information are consecutive before comparing them. If the synchronization sequence identifier is equal to the version status information plus one, it is considered consecutive; if the synchronization sequence identifier is greater than the version status information plus one, it is considered discontinuous.
[0090] In a possible implementation, the purpose of continuity detection is to determine if any data packets have been lost. In distributed transmission, data packets may be lost due to wireless channel switching or network congestion. The synchronization sequence identifier is a strictly increasing sequence; if all data packets have arrived, the synchronization sequence identifier of the current data packet should be the version status information plus one. If the synchronization sequence identifier is greater than the version status information plus one, it indicates that there are missing data packets between the next sequence number of the version status information and the synchronization sequence identifier of the current data packet.
[0091] S302: If the detection result is discontinuous, request the first device to retransmit the missing incremental status data.
[0092] The packet retransmission request is a control instruction sent by the system resident service to the first device to request the retransmission of lost data packets. It contains a list of missing synchronization sequence identifiers.
[0093] In some examples, if a discontinuity is detected, the system resident service determines the missing synchronization sequence identifier, generates a replacement request based on the missing synchronization sequence identifier, and sends the replacement request to the first device.
[0094] In a possible implementation, the missing synchronization sequence identifiers are all sequence numbers ranging from the version status information plus one to the current synchronization sequence identifier minus one. The packet replacement request contains a list of missing synchronization sequence identifiers, indicating to the first device which data packets need to be retransmitted. After receiving the packet replacement request, the first device searches for the corresponding data packets in its local cache or records according to the list of missing synchronization sequence identifiers and retransmits them to the second device.
[0095] S303: After confirming that the synchronization sequence identifiers are continuous, compare the synchronization sequence identifiers with the version status information.
[0096] Among them, confirming the continuity of synchronization sequence identifiers means that the system's resident service verifies that all supplementary data packets corresponding to the missing synchronization sequence identifiers have been successfully received.
[0097] In some examples, after receiving the supplementary data packet returned by the first device, the resident system service confirms that the synchronization sequence identifiers are continuous, and then performs a comparison step between the synchronization sequence identifiers and the version status information.
[0098] In a possible implementation, confirming the continuity of synchronization sequence identifiers means that the system's resident service verifies that all supplementary data packets corresponding to the missing synchronization sequence identifiers have been successfully received. The verification method is as follows: check if there are data packet records in the local buffer that match all missing synchronization sequence identifiers. If all exist, the sequence is confirmed to be continuous; if there are still missing ones, the packet replacement request operation in S302 is repeated until the sequence is complete and continuous.
[0099] The processes described in S301-S303 above ensure that the data is complete and continuous before validity determination by detecting the continuity of the sequence before comparison and requesting retransmission of missing data when discontinuity is detected.
[0100] like Figure 4 The diagram shown is a fourth flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application. This flowchart is a... Figure 1 The further refinement of "using the isolation environment to perform logical operations on the incremental state data to obtain the operation results" in S103 is as follows:
[0101] S401: Input incremental state data into the isolation environment and perform logical operations on the incremental state data in the isolation environment.
[0102] The logical operation is a declarative expression calculation performed based on the state variables in the incremental state data and the update logic bound in the interface component template data.
[0103] In some examples, the system's resident services input incremental state data into the isolated environment. The isolated environment then performs logical operations based on the state variables in the incremental state data and the update logic bound to the UI component template data.
[0104] In a possible implementation, the isolated environment identifies the update logic corresponding to the incremental state data fields when parsing the declarative abstract syntax tree nodes in the UI component template data. The abstract syntax tree nodes are pre-bound with logical expressions that define the operation to be performed when a specific incremental state data field is reached. For example, for the remaining progress calculation node, the bound logical expression is "target value minus current progress value," where the target value is a constant and the current progress value is read from the incremental state data.
[0105] S402: Monitor the resource consumption of logical operations during execution.
[0106] Resource consumption includes the number of instruction steps executed. The isolated environment has a built-in instruction step counter to count the number of instructions executed in real time for logical operations.
[0107] In some examples, a resident system service monitors the resource consumption of logical operations during their execution. Resource consumption includes the number of instruction steps executed.
[0108] In one possible implementation, the isolated environment has a built-in instruction step counter, which increments by one for each instruction executed. A resident system service periodically reads the current value of this counter and compares it with a preset threshold. The monitoring process is continuous, starting from the beginning of the logical operation and continuing until the logical operation ends or the preset threshold is reached.
[0109] S403: If resource consumption reaches a preset threshold, the logical operation is terminated.
[0110] The preset threshold is a pre-defined security threshold used to prevent malicious or abnormal code from consuming the computing resources of the system's resident services without restraint.
[0111] In some examples, when the number of executed instruction steps reaches a preset safety threshold, the system resident service terminates the current logical operation and returns a default placeholder value.
[0112] In a possible implementation, the preset threshold can be 1000 instruction steps. This preset threshold ensures that logical operations can be completed in a very short time, preventing malicious or abnormal code from blocking the system's resident processes. When the preset threshold is reached, the system's resident service automatically triggers a circuit breaker, terminating the execution of the current logical operation and returning a default placeholder value (such as 0 or an empty string) as the operation result, ensuring that the interface components can be displayed normally without crashing due to abnormal logic.
[0113] The processes shown in S401-S403 above utilize a non-Turing-complete isolated environment to perform logical operations and terminate the operation when resource consumption reaches a preset threshold. This avoids the heavy power consumption of launching the application's JavaScript engine and eliminates the security risks of third-party code running in privileged system services.
[0114] like Figure 5 The diagram shown is a fifth flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application. This flowchart is a... Figure 1 The further refinement of "updating the variables in the local interface component template data according to the calculation result" in S104 includes the following steps.
[0115] S501: Read the locally stored interface component template data. The interface component template data contains template nodes, and the template nodes are configured with update logic corresponding to the incremental state data.
[0116] The interface component cache area is a dedicated storage area in the local storage medium of the second device for storing interface component template data, and it is a different storage area from the local cache area. The interface component template data is pre-set at the factory of the second device or written by the application during application installation, and corresponds one-to-one with a specific interface component instance.
[0117] In some examples, the system resident service reads locally stored interface component template data from the interface component cache on the second device.
[0118] In a possible implementation, the interface component cache is a dedicated area in the local storage medium of the second device for storing interface component template data, and it is a different storage area from the local cache. The interface component template data is pre-configured at the factory or written by the application during application installation, and corresponds one-to-one with a specific interface component instance. The system's resident service retrieves the corresponding interface component template data from the interface component cache based on the identifier information of the target interface component.
[0119] S502: Update the variables in the template node based on the calculation results.
[0120] The system's resident service replaces the corresponding placeholders with the calculation results based on the binding relationship between the field names in the incremental status data and the placeholders in the template nodes.
[0121] In some examples, the system's resident service substitutes the calculation results output by the isolated environment into the corresponding variable placeholders in the template node, updates the variables in the template node, and generates updated UI component template data.
[0122] In a possible implementation, variable placeholders are reserved markers in the template node, intended to be replaced by actual data during template rendering, such as "{{progress}}" or "{{status}}". The system's persistent service replaces the corresponding placeholders with the calculation results based on the binding relationship between the field names in the incremental status data and the placeholders in the template node. After the substitution is complete, the variable values in the template node are updated with the new calculation results, generating a complete set of UI component template data that can be directly used for rendering.
[0123] The processes shown in S501-S502 above implement a technical path for displaying content after synthesizing and updating the local template based on incremental state data and local templates by reading the locally pre-stored interface component template data and updating the variables in the template node according to the calculation results.
[0124] like Figure 6 The diagram shown is a sixth flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application. This flowchart is a... Figure 1The further refinement of "batch writing and updating the incremental status data in the data packet to the local database" in S105 shown includes the following steps.
[0125] S601: Reads multiple data packets from the local cache.
[0126] Among these, multiple data packets are all the data packets accumulated in the local buffer during the application process's sleep period. Each data packet is stored in a circular buffer in the order of its synchronization sequence identifier.
[0127] In some examples, when the application process is started, the delayed data alignment module reads multiple data packets accumulated during the application process's sleep from the local cache.
[0128] In a possible implementation, the application process can be launched by a user actively clicking on a target interface component to trigger a cold start, or by the system detecting that the second device is in an idle charging state to trigger idle alignment. The delayed data alignment module is a dedicated module in the application process responsible for data synchronization. In the first stage of application process initialization, it reads the accumulated data packets from the local cache to ensure that the application's internal data has been synchronized and aligned before the application interface is presented to the user.
[0129] S602: Extract the incremental status data and the corresponding synchronization sequence identifier from each data packet.
[0130] Extraction refers to parsing incremental state data and its corresponding synchronization sequence identifier from each data packet, and temporarily storing the parsing results in the application process's memory.
[0131] In some examples, the delayed data alignment module extracts the incremental state data and the corresponding synchronization sequence identifier from each data packet.
[0132] In a possible implementation, each data packet contains a set of incremental state data and its corresponding synchronization sequence identifier. The delayed data alignment module iterates through all the read data packets, extracts the incremental state data and synchronization sequence identifier from each data packet, and temporarily stores them in the application process's memory for subsequent sorting and writing operations.
[0133] S603: Determine the writing order of each incremental state data based on each synchronization sequence identifier.
[0134] The write order refers to the sequence in which incremental status data is written to the local database. The write order is arranged in ascending order of synchronization sequence identifiers to ensure that the order in which data packets are applied is consistent with the order in which they were sent by the first device.
[0135] In some examples, the delayed data alignment module sorts multiple incremental state data according to the sequence order based on the synchronization sequence identifier to determine the writing order.
[0136] In a possible implementation, the synchronization sequence identifier is a strictly incremental sequence number. Therefore, the incremental state data is sorted in ascending order according to the synchronization sequence identifier, which ensures that the order in which the data packets are applied is consistent with the order in which the first device sends them, thereby avoiding data inconsistency caused by out-of-order writing.
[0137] S604: In a single write operation, incremental status data are written to the local database sequentially in the write order.
[0138] A single write operation is a database write operation completed in one go, committing all incremental state data to be written within the same database transaction. If an exception occurs during the write process, the entire transaction is rolled back, and all data is not written, thus ensuring the atomicity and consistency of data writes.
[0139] In some examples, the delayed data alignment module commits multiple incremental state data entries to the local relational database within the same database transaction during a single write operation.
[0140] In a possible implementation, a single write operation is a database write operation completed in one go, committing all incremental state data to be written sequentially within the same database transaction. Since all data is committed within the same transaction, if an exception occurs during the write process, the entire transaction is rolled back, and all data is not written. This avoids the partial success state where some data is written successfully while others fail, ensuring the atomicity and consistency of data writing.
[0141] The processes shown in S601-S604 above achieve dual-channel decoupling of visual effect refresh and data persistence by reading multiple data packets from the local cache when the application process is launched, sorting them according to the synchronization sequence identifier, and then writing them to the database in batches. This ensures the final consistency between the visual effects of the interface components and the persisted data.
[0142] like Figure 7 The diagram shown is a seventh flowchart of a wake-up-free collaborative refresh method provided in an embodiment of this application, which includes the following steps.
[0143] S701: Obtain the synchronization configuration information of the target interface component.
[0144] The synchronization configuration information consists of synchronization attribute declarations stored in the local configuration file of the second device, which are associated with the identification information of the target interface component. This synchronization configuration information indicates whether the target interface component supports wake-up-free synchronization and is written by the application when the target interface component is installed or used for the first time.
[0145] In some examples, after intercepting data packets from the first device, the system's resident service obtains the synchronization configuration information of the target UI component in the local configuration of the second device. This synchronization configuration information indicates whether the target UI component supports wake-up-free synchronization.
[0146] In a possible implementation, the synchronization configuration information is stored in a local configuration file on the second device and associated with the identification information of the target interface component. This configuration information is written by the application when the target interface component is installed or used for the first time, and is used to declare whether the interface component supports a wake-up-free synchronization mechanism.
[0147] S702: Based on the synchronization configuration information, determine whether the target interface component supports wake-up-free synchronization.
[0148] Determining whether the target UI component supports wake-free synchronization involves reading the values of predetermined fields in the synchronization configuration information. If the field value is true (e.g., true or 1), the target UI component supports wake-free synchronization; if the field value is false (e.g., false or 0), the target UI component does not support wake-free synchronization.
[0149] In some examples, the system's resident service determines whether the target UI component supports wake-up-free synchronization based on synchronization configuration information. If so, it executes... Figure 1 The step in S101 to disable the application process launch operation is shown; if not, then S703 is executed.
[0150] In a possible implementation, the determination is made by reading the value of a predetermined field in the synchronization configuration information. If the field value is true (e.g., true or 1), it is determined that the target interface component supports wake-free synchronization; if the field value is false (e.g., false or 0), it is determined that the target interface component does not support wake-free synchronization.
[0151] S703: If the target interface component does not support wake-up-free synchronization, then wake up the application process and forward the data packet to the application process.
[0152] In this context, "wake up the application process" means that the system's resident services do not issue process lock control signals or prohibit the calling process's start-up interface, allowing the application process to be woken up according to the normal process management process. After the data packet is forwarded to the application process, the application process itself is responsible for parsing the data packet, updating the display of interface components, and synchronizing the local database.
[0153] In some examples, if the target UI component does not support wake-up-free synchronization, the system resident service allows the application process to be woken up normally and forwards data packets to the application process.
[0154] In a possible implementation, allowing application processes to be woken up normally means that the system's resident services do not issue process locking control signals or prohibit the calling process start-up interface, allowing the application process to be woken up according to the normal process management process. After the data packet is forwarded to the application process, the application process itself is responsible for parsing the data packet, updating the display of interface components, and synchronizing the local database.
[0155] The processes described in S701-S703 above, by checking the synchronization configuration information of the target interface components, achieve differentiated processing for interface components that support wake-up-free synchronization and those that do not. For interface components that support wake-up-free synchronization, the system side performs the interface component refresh on their behalf, avoiding the power consumption overhead introduced by restarting the application process; for interface components that do not support wake-up-free synchronization, the traditional refresh method is compatible, ensuring the normal operation of the interface component synchronization function. This differentiated processing mechanism enables this solution to be compatible with different types of interface components, improving the applicability and compatibility of the solution.
[0156] like Figure 8 The diagram shown is an architectural schematic of a wake-up-free collaborative refresh device provided in an embodiment of this application, including the following units.
[0157] The data packet interception unit 100 is used to prevent the launch operation of the application process corresponding to the target interface component after intercepting the data packet from the first device; the data packet contains incremental status data and the corresponding synchronization sequence identifier.
[0158] The status determination unit 200 is used to determine the status of incremental status data based on the synchronization sequence identifier and the version status information stored locally.
[0159] Optionally, the status determination unit 200 is specifically used for: obtaining locally stored version status information; comparing the synchronization sequence identifier with the version status information to obtain the comparison result; determining whether the incremental status data is valid based on the comparison result; and discarding the data packet if the incremental status data is invalid.
[0160] Optionally, the status determination unit 200 is further configured to: detect whether the synchronization sequence identifier and the version status information are continuous; if the detection result is not continuous, request the first device to retransmit the missing incremental status data; and after confirming that the synchronization sequence identifier is continuous, compare the synchronization sequence identifier with the version status information.
[0161] The logic operation unit 300 is used to perform logical operations on the incremental state data in an isolated environment if the incremental state data is valid, so as to obtain the operation result.
[0162] Optionally, the logic operation unit 300 is specifically used to: input incremental state data into the isolation environment and perform logic operations on the incremental state data in the isolation environment; monitor the resource consumption of the logic operation during the execution of the logic operation; and terminate the logic operation if the resource consumption reaches a preset threshold.
[0163] Optionally, the logic operation unit 300 is specifically used to: input incremental state data into the isolation environment and perform logic operations on the incremental state data in the isolation environment; monitor the resource consumption of the logic operation during the execution of the logic operation; and terminate the logic operation if the resource consumption reaches a preset threshold.
[0164] The component rendering unit 400 is used to update the variables in the local interface component template data according to the calculation results, and send the updated interface component template data to the rendering service to refresh the display of the target interface component.
[0165] Optionally, the component rendering unit 400 is specifically used for: reading locally pre-stored interface component template data, the interface component template data containing template nodes, the template nodes being configured with update logic corresponding to incremental state data; and updating the variables in the template nodes according to the calculation results.
[0166] The data alignment unit 500 is used to store data packets in the local cache. When the application process is started, it reads data packets from the local cache, writes the incremental state data in the data packets in batches, and updates the local database.
[0167] Optionally, the data alignment unit 500 is specifically used for: reading multiple data packets from the local buffer; extracting incremental state data and corresponding synchronization sequence identifiers from each data packet; determining the writing order of each incremental state data according to each synchronization sequence identifier; and writing each incremental state data to the local database in the writing order during a single write operation.
[0168] The process wake-up unit 600 is used to: obtain the synchronization configuration information of the target interface component; determine whether the target interface component supports wake-up-free synchronization based on the synchronization configuration information; if the target interface component does not support wake-up-free synchronization, wake up the application process and forward the data packet to the application process.
[0169] In summary, the device described in this application reduces terminal power consumption by disabling the application process's startup operation and having the system side handle the refresh of interface components. It eliminates the security risk of untrusted code running at the system privilege level by performing logical operations in an isolated environment. It ensures the eventual consistency between the visual effects of interface components and persistent data by storing data packets in a local cache and writing and updating them in batches to the local database when the application process is started. It also improves the stability of distributed transmission by identifying out-of-order data through synchronization sequence identifiers.
[0170] This application also provides a computer-readable storage medium including a stored program, wherein the program executes the wake-up-free collaborative refresh method provided in this application.
[0171] This application also provides an electronic device, including a processor, a memory, and a bus. The processor and the memory are connected via the bus. The memory is used to store a program, and the processor is used to run the program. During program execution, the wake-up-free collaborative refresh method provided in this application is implemented.
[0172] While several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of this application. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0173] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A wake-up-free collaborative refresh method, characterized in that, include: After intercepting data packets from the first device, the launch operation of the application process corresponding to the target interface component is prohibited; The data packet contains incremental status data and the corresponding synchronization sequence identifier; Based on the synchronization sequence identifier and the locally stored version status information, the status of the incremental status data is determined. If the incremental state data is valid, logical operations are performed on the incremental state data using an isolated environment to obtain the operation result. The variables in the local interface component template data are updated according to the calculation result, and the updated interface component template data is sent to the rendering service to refresh the display of the target interface component. The data packet is stored in the local cache. When the application process is launched, the data packet is read from the local cache, and the incremental status data in the data packet is written in batches and updated to the local database.
2. The method according to claim 1, characterized in that, Based on the synchronization sequence identifier and the locally stored version status information, the status of the incremental status data is determined, including: Retrieve locally saved version status information; The synchronization sequence identifier is compared with the version status information to obtain the comparison result; Based on the comparison results, it is determined whether the incremental state data is valid; If the incremental status data is invalid, the data packet is discarded.
3. The method according to claim 1, characterized in that, Based on the synchronization sequence identifier and the locally stored version status information, determining the status of the incremental status data further includes: Detect whether the synchronization sequence identifier and the version status information are consecutive; If the detection result is discontinuous, request the first device to retransmit the missing incremental status data; After confirming that the synchronization sequence identifiers are consecutive, the synchronization sequence identifiers are compared with the version status information.
4. The method according to claim 1, characterized in that, Logical operations are performed on the incremental state data using an isolated environment to obtain the operation results, including: The incremental state data is input into the isolation environment, and logical operations are performed on the incremental state data in the isolation environment. During the execution of the logical operation, the resource consumption of the logical operation is monitored; If the resource consumption reaches a preset threshold, the logical operation is terminated.
5. The method according to claim 1, characterized in that, Update the variables in the local interface component template data according to the calculation result, including: Read locally stored interface component template data, wherein the interface component template data includes template nodes, and the template nodes are configured with update logic corresponding to the incremental state data; Based on the calculation result, update the variables in the template node.
6. The method according to claim 1, characterized in that, The incremental status data in the data packet is written in batches and updated to the local database, including: Read multiple data packets from the local cache; Extract the incremental state data and the corresponding synchronization sequence identifier from each of the data packets; The writing order of each incremental state data is determined based on each of the synchronization sequence identifiers; In a single write operation, each incremental state data is written to the local database in the order described in the write operation.
7. The method according to claim 1, characterized in that, The method further includes: Obtain the synchronization configuration information of the target interface component; Based on the synchronization configuration information, determine whether the target interface component supports wake-up-free synchronization; If the target interface component does not support wake-up-free synchronization, then the application process is woken up, and the data packet is forwarded to the application process.
8. A wake-up-free collaborative refresh device, characterized in that, include: The data packet interception unit is used to prevent the launch operation of the application process corresponding to the target interface component after intercepting the data packet from the first device. The data packet contains incremental status data and the corresponding synchronization sequence identifier; The status determination unit is used to determine the status of the incremental status data based on the synchronization sequence identifier and the version status information stored locally. A logic operation unit is used to perform logical operations on the incremental state data in an isolated environment if the incremental state data is valid data, so as to obtain the operation result; The interface component rendering unit is used to update the variables in the local interface component template data according to the calculation result, and send the updated interface component template data to the rendering service to refresh the display of the target interface component; The data alignment unit is used to store the data packet in a local cache. When the application process is started, it reads the data packet from the local cache and writes the incremental status data in the data packet in batches to update the local database.
9. A storage medium, characterized in that, The storage medium includes a stored program, wherein the program is executed by a processor to perform the wake-up-free collaborative refresh method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, include: Processor, memory, and bus; The processor and the memory are connected via the bus; The memory is used to store a program, and the processor is used to run the program, wherein the program is executed by the processor to perform the wake-up-free collaborative refresh method according to any one of claims 1 to 7.
