Data synchronization method, electronic device, and system
By predicting the offline time of peer devices and delaying the data synchronization timing, a fine-grained push latency strategy was adopted to solve the power consumption and transmission pressure problems caused by frequent wake-ups, thus achieving consistent data synchronization across multiple devices and meeting user needs.
Patent Information
- Application Number
- CN202310559647.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-17
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2043-05-17
AI Technical Summary
In distributed communication systems, frequent data pushes lead to unnecessary wake-ups of peer devices, increasing power consumption and transmission pressure. Furthermore, existing consistency grading strategies cannot meet the dynamic changes in user habits and the data consistency requirements of multiple devices.
By acquiring offline statistics of peer devices, predicting their offline time, delaying data synchronization timing, reducing the number of times peer devices are woken up, and adopting a fine-grained push latency strategy, the synchronization timing is adjusted according to user habits and device status to ensure data consistency across multiple devices.
It effectively reduces device power consumption and transmission pressure, meets users' data usage needs, achieves finer-grained data consistency synchronization, and avoids application malfunctions.
Smart Images

Figure CN119011601B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of terminal, and in particular, to a data synchronization method, an electronic device and a system. BACKGROUND
[0002] With the development of terminal technology, electronic devices can establish connections with various types of other electronic devices to form a distributed communication system. In the distributed communication system, electronic devices can achieve data synchronization with other devices through data pushing to ensure the consistency of multi-terminal electronic device data.
[0003] In the process of data pushing synchronization, the electronic device needs to wake up the opposite device without distinction to send the synchronization data to the opposite device. However, after receiving the synchronization data, the opposite device may not need to use the synchronization data, so frequent data pushing leads to waste of power consumption and increases transmission pressure. SUMMARY
[0004] To solve the above technical problems, the present application provides a data synchronization method, an electronic device and a system. The technical scheme provided by the present application delays the data synchronization time with the second electronic device by determining the predicted offline time of the second electronic device. While ensuring the consistency of multi-terminal data, the second electronic device in sleep state is avoided from being frequently woken up, and the power consumption and transmission pressure are reduced.
[0005] To achieve the above technical purposes, the present application provides the following technical scheme:
[0006] In a first aspect, a data synchronization method is provided, applied to a first electronic device. The method comprises: obtaining offline statistical information of a second electronic device. Generating data of a first application. According to the offline statistical information, determining the predicted offline time of the second electronic device, wherein the second electronic device is currently in a sleep state. According to the predicted offline time, delaying the synchronization of the data of the first application with the second electronic device.
[0007] In some examples, the offline statistical information is used to indicate the offline time of the second electronic device corresponding to different device usage information. Optionally, the device usage information of the second electronic device includes at least one of device online duration, usage time, and device power.
[0008] In this way, the first electronic device can determine the predicted offline time of the second electronic device according to the offline statistical information when the second electronic device is in a sleep state, and delay data synchronization based on the predicted offline time, thereby effectively reducing the number of wake-ups of the second electronic device and reducing power consumption and transmission pressure.
[0009] According to the first aspect, the offline statistical information is used to indicate a corresponding offline time of the second electronic device under different device usage information, and the expected offline time of the second electronic device is determined according to the offline statistical information, including: obtaining current device usage information of the second electronic device. The expected offline time is determined according to the offline statistical information and the current device usage information of the second electronic device.
[0010] In some embodiments, after determining to generate the first application data to be synchronized, the first electronic device determines that the electronic device to be synchronized with the first application data includes the second electronic device. The first electronic device determines that the second electronic device is currently in a sleep state, and to avoid frequently waking up the second electronic device and increasing power consumption of the second electronic device, the first electronic device can first not synchronize the first application data to be synchronized with the second electronic device, but first determine the expected offline time of the second electronic device, and then synchronize the first application data to be synchronized with the second electronic device based on the expected offline time.
[0011] For example, the first electronic device determines the expected offline time of the second electronic device according to the offline statistical information and the current device usage information of the second electronic device by any one of a plurality of ways such as normal distribution, Poisson distribution, mean value, mode, and median.
[0012] According to the first aspect, or any one of the implementation manners of the first aspect, delaying synchronization of the first application data with the second electronic device according to the expected offline time includes: sending a wake-up indication to the second electronic device at a first time window corresponding to the expected offline time. After waking up the second electronic device, the first synchronization data corresponding to the first application is sent to the second electronic device, and the first synchronization data is all data of the first application that has not been synchronized with the second electronic device and accumulated before the first time window.
[0013] Optionally, when the first electronic device determines that data synchronization with the second electronic device is needed, the first electronic device can send a wake-up indication to the second electronic device to wake up the second electronic device.
[0014] For example, after application 1 in electronic device A generates data, the electronic device C in a sleep state is not immediately woken up, but is delayed to wake up the electronic device C, such as sending a wake-up indication to the electronic device C at a first time window corresponding to the expected offline time t of the electronic device C to wake up the electronic device C for data synchronization.
[0015] For example, the electronic device A wakes up the electronic device C and synchronizes data with the electronic device C at N hours (or minutes or other time units) before the determined offline time of the electronic device C. For another example, the electronic device A determines the time of waking up the electronic device C by counting forward or counting down from the current time after determining the offline time of the electronic device C, and the time is before the offline time of the electronic device C. Then the electronic device C wakes up the electronic device C at the determined time and synchronizes data with the electronic device C.
[0016] In this way, the first electronic device can determine the offline time of the second electronic device according to the offline statistical information when the second electronic device is in the sleep state, and synchronize data based on the offline time, thereby effectively reducing the number of wake-ups of the second electronic device and reducing power consumption and transmission pressure.
[0017] According to the first aspect or any one of the implementations of the first aspect, delaying the data of the first application from being synchronized with the second electronic device according to the offline time comprises: determining that the second electronic device switches from the sleep state to the active state before a first time window corresponding to the offline time, and sending second synchronization data corresponding to the first application to the second electronic device, the second synchronization data being all data of the first application that has not been synchronized with the second electronic device before the second electronic device switches from the sleep state to the active state.
[0018] In this way, data is synchronized in a timely manner based on the state switching of the second electronic device, ensuring consistency of multi-terminal data and avoiding application running abnormally.
[0019] According to the first aspect or any one of the implementations of the first aspect, before generating the data of the first application, the method further comprises: obtaining data usage information of the second electronic device, the data usage information being used to indicate the frequency of using different applications after the second electronic device is offline. Delaying the data of the first application from being synchronized with the second electronic device according to the offline time comprises: determining a push delay corresponding to the first application in the second electronic device according to the offline time and the data usage information. Sending a wake-up indication to the second electronic device at a second time window corresponding to the push delay. After waking up the second electronic device, sending third synchronization data corresponding to the first application to the second electronic device, the second time window being before a first time window corresponding to the offline time, and the third synchronization data being all data of the first application that has not been synchronized with the second electronic device before the second time window.
[0020] In some embodiments, after the electronic device is offline, the user has a high demand for using part of the data and a low demand for using part of the data. Then, the electronic device can also count the frequency of use of the user for different applications after the device is offline, so as to determine the use habit of the user, and subsequently, for the data that still has access demand after the device is offline, part of the data has a higher consistency requirement on part of the device, and can be synchronized within a short time after the data is generated to meet the requirement of offline accessible data. For another part of the data that has a low consistency requirement, synchronization can be delayed under the consideration of communication overhead and wake-up.
[0021] For example, the application 1 in the electronic device A does not immediately wake up the electronic device C in the sleep state after generating the data, but delays the wake-up of the electronic device C in the sleep state. The electronic device A determines the predicted offline time of the electronic device C. Then, the electronic device A determines the push delay t1 corresponding to the first application in the electronic device C according to the predicted offline time of the electronic device C and the data use information. Then, the electronic device A can send a wake-up indication to the electronic device C at a second time window corresponding to the push delay t1 to wake up the electronic device C for data synchronization.
[0022] For example, the electronic device A wakes up the electronic device C and synchronizes data with the electronic device C N hours (or minutes or other time units) before the end of the determined push delay t1 of the electronic device C. For another example, the electronic device A starts timing from the current time after determining the push delay t1 of the electronic device C, and determines the time of waking up the electronic device C by forward timing or countdown, which is before the end of the push delay t1 of the electronic device C.
[0023] In this way, compared with the current coarse-grained consistency classification strategy based on strong, arbitrary and final consistency, the data synchronization method provided in the embodiments of the present application can determine the push delay based on the use habit of the user, and realize more fine-grained continuous consistency synchronization.
[0024] In addition, the first electronic device synchronizes the data consistency of different devices according to the use habit of the user on different devices, which reduces the data transmission power consumption and communication overhead while meeting the data use demand after the first electronic device is offline and ensuring the data use success rate.
[0025] According to the first aspect, or any one of the implementation forms of the above first aspect, the method further includes: before the second time window corresponding to the push delay, determining that the second electronic device is switched from the sleep state to the active state, and sending fourth synchronization data corresponding to the first application to the second electronic device, the fourth synchronization data being all data of the first application that has not been synchronized with the second electronic device before the second electronic device is switched from the sleep state to the active state.
[0026] For example, after the electronic device A generates the data of the application 1, the electronic device A determines the predicted offline time and the push delay t1 of the electronic device C according to the offline statistical information and the data usage information of the electronic device C, and sets the corresponding timer. Then, during the process of waiting for the data of the application 1 of the electronic device C according to the push delay t1, the electronic device C is switched from the sleep state to the active state before the time window corresponding to the push delay t1. Then, the electronic device A can no longer continue to wait, but directly synchronizes the data of the application 1 with the electronic device C.
[0027] In this way, the data synchronization is performed in time based on the state switching of the second electronic device, the consistency of the multi-terminal data is ensured, and the application running exception is avoided.
[0028] According to the first aspect, or any one of the implementation forms of the first aspect, the device usage information of the second electronic device includes at least one of a device online duration, a usage time, and a device power.
[0029] According to the first aspect, or any one of the implementation forms of the first aspect, the method further includes: during the process of waiting for the data of the first application of the second electronic device according to the predicted offline time or the push delay, the first electronic device determines that a condition of switching to the sleep state or the low power state is met, or determines that the first electronic device is about to be offline. Then, the first electronic device wakes up the second electronic device which has not performed the data synchronization before switching to the sleep state or the low power state, or before being offline, and performs the data synchronization.
[0030] In this way, the problem of inconsistency of multi-terminal data caused by the switching of the first electronic device to the sleep state or the low power state is avoided.
[0031] The second aspect provides an electronic device. The electronic device includes a processor and a memory, the memory is coupled to the processor, and the memory is used to store computer program code including computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes: obtaining offline statistical information of a second electronic device. Generating data of a first application. According to the offline statistical information, determining a predicted offline time of the second electronic device, wherein the second electronic device is currently in a sleep state. Delaying synchronization of the data of the first application with the second electronic device according to the predicted offline time.
[0032] According to the second aspect, the offline statistical information is used to indicate offline times of the second electronic device corresponding to different device usage information. According to the offline statistical information, the predicted offline time of the second electronic device is determined, including: obtaining current device usage information of the second electronic device. According to the offline statistical information and the current device usage information of the second electronic device, the predicted offline time is determined.
[0033] According to a second aspect, or any possible implementation mode of the second aspect, delaying the data of the first application from being synchronized with the second electronic device according to the predicted offline time comprises: sending a wake-up indication to the second electronic device at a first time window corresponding to the predicted offline time. After waking up the second electronic device, sending first synchronization data corresponding to the first application to the second electronic device, the first synchronization data being all the data of the first application that has not been synchronized with the second electronic device and accumulated before the first time window.
[0034] According to a second aspect, or any possible implementation mode of the second aspect, delaying the data of the first application from being synchronized with the second electronic device according to the predicted offline time comprises: determining that the second electronic device switches from the sleep state to the active state before the first time window corresponding to the predicted offline time, and sending second synchronization data corresponding to the first application to the second electronic device, the second synchronization data being all the data of the first application that has not been synchronized with the second electronic device and accumulated before the second electronic device switches from the sleep state to the active state.
[0035] According to a second aspect, or any possible implementation mode of the second aspect, when the processor reads the computer instructions from the memory, the electronic device further performs: obtaining data usage information of the second electronic device, the data usage information being used to indicate the frequency of using different applications after the second electronic device goes offline. Delaying the data of the first application from being synchronized with the second electronic device according to the predicted offline time comprises: determining a push delay corresponding to the first application in the second electronic device according to the predicted offline time and the data usage information. Sending a wake-up indication to the second electronic device at a second time window corresponding to the push delay. After waking up the second electronic device, sending third synchronization data corresponding to the first application to the second electronic device, the second time window being before a first time window corresponding to the predicted offline time, and the third synchronization data being all the data of the first application that has not been synchronized with the second electronic device and accumulated before the second time window.
[0036] According to a second aspect, or any possible implementation mode of the second aspect, when the processor reads the computer instructions from the memory, the electronic device further performs: determining that the second electronic device switches from the sleep state to the active state before a second time window corresponding to the push delay, and sending fourth synchronization data corresponding to the first application to the second electronic device, the fourth synchronization data being all the data of the first application that has not been synchronized with the second electronic device and accumulated before the second electronic device switches from the sleep state to the active state.
[0037] According to a second aspect, or any possible implementation mode of the second aspect, the device usage information of the second electronic device comprises at least one of a device online duration, a usage time, and a device power.
[0038] According to a second aspect, or any possible implementation mode of the second aspect, when the processor reads the computer instructions from the memory, the electronic device further performs: in the process of waiting for the data of the first application to be synchronized with the second electronic device according to the predicted offline time or the push delay, the first electronic device determines that a condition for switching to the sleep state or the low-power state is met, or determines that the first electronic device is about to be offline. Then, the first electronic device wakes up the second electronic device which has not performed the data synchronization before switching to the sleep state or the low-power state, or before being offline, and performs the data synchronization.
[0039] The technical effects of the second aspect and any possible implementation mode of the second aspect can refer to the technical effects of the first aspect and any possible implementation mode of the first aspect, which will not be repeated here.
[0040] According to a third aspect, a data synchronization system is provided, which includes a first electronic device and a second electronic device. The first electronic device is configured to: obtain offline statistical information of the second electronic device, generate data of a first application, and determine a predicted offline time of the second electronic device according to the offline statistical information, wherein the second electronic device is currently in a sleep state. The first electronic device is further configured to delay sending a wake-up instruction to the second electronic device according to the predicted offline time. The second electronic device is configured to switch from the sleep state to an active state in response to the received wake-up instruction. The first electronic device is further configured to synchronize the data of the first application with the second electronic device.
[0041] According to the third aspect, the offline statistical information is used to indicate offline times of the second electronic device corresponding to different device usage information. The first electronic device is configured to obtain current device usage information of the second electronic device, and determine the predicted offline time according to the offline statistical information and the current device usage information of the second electronic device.
[0042] According to the third aspect, or any possible implementation mode of the third aspect, the first electronic device is configured to send the wake-up instruction to the second electronic device at a first time window corresponding to the predicted offline time. After waking up the second electronic device, the first electronic device is configured to send first synchronization data corresponding to the first application to the second electronic device, the first synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the first time window.
[0043] According to the third aspect, or any possible implementation mode of the third aspect, the first electronic device is configured to determine that the second electronic device switches from the sleep state to the active state before the first time window corresponding to the predicted offline time, and send second synchronization data corresponding to the first application to the second electronic device, the second synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the second electronic device switches from the sleep state to the active state.
[0044] According to a third aspect, or any possible implementation mode of the third aspect, the first electronic device is further configured to: obtain data usage information of the second electronic device, the data usage information being used to indicate frequencies of using different applications after the second electronic device is offline; determine the push delay corresponding to the first application in the second electronic device according to the predicted offline time and the data usage information; send the wake-up indication to the second electronic device in a second time window corresponding to the push delay; and send the third synchronization data corresponding to the first application to the second electronic device after waking up the second electronic device, the second time window being before a first time window corresponding to the predicted offline time, and the third synchronization data being all data of the first application that is accumulated before the second time window and has not been synchronized with the second electronic device.
[0045] According to the third aspect, or any possible implementation mode of the third aspect, the first electronic device is configured to: determine that the second electronic device switches from the sleep state to the active state before a second time window corresponding to the push delay, and send the fourth synchronization data corresponding to the first application to the second electronic device, the fourth synchronization data being all data of the first application that is accumulated before the second electronic device switches from the sleep state to the active state and has not been synchronized with the second electronic device.
[0046] According to the third aspect, or any possible implementation mode of the third aspect, the device usage information of the second electronic device includes at least one of a device online duration, a usage time, and a device power level.
[0047] The technical effects of the third aspect and any possible implementation mode of the third aspect can refer to the technical effects of the first aspect and any possible implementation mode of the first aspect, which will not be described herein.
[0048] A fourth aspect provides an electronic device having a function of implementing the data state synchronization method in the first aspect and any possible implementation mode thereof. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0049] The technical effects of the fourth aspect and any possible implementation mode of the fourth aspect can refer to the technical effects of the first aspect and any possible implementation mode of the first aspect, which will not be described herein.
[0050] A fifth aspect provides a computer-readable storage medium. The computer-readable storage medium stores a computer program (also referred to as instructions or code), which, when executed by an electronic device, causes the electronic device to perform the method of the first aspect or any possible implementation mode of the first aspect.
[0051] The technical effects of the fifth aspect and any of the implementations of the fifth aspect are the same as those of the first aspect and any of the implementations of the first aspect, which will not be repeated here.
[0052] In a sixth aspect, a computer program product is provided, which, when running on an electronic device, causes the electronic device to perform the method of the first aspect or any of the implementations of the first aspect.
[0053] The technical effects of the sixth aspect and any of the implementations of the sixth aspect are the same as those of the first aspect and any of the implementations of the first aspect, which will not be repeated here.
[0054] In a seventh aspect, a circuit system is provided, which includes a processing circuit configured to perform the method of the first aspect or any of the implementations of the first aspect.
[0055] The technical effects of the seventh aspect and any of the implementations of the seventh aspect are the same as those of the first aspect and any of the implementations of the first aspect, which will not be repeated here.
[0056] In an eighth aspect, a chip system is provided, which includes at least one processor and at least one interface circuit, the at least one interface circuit is configured to perform a transceiving function and send an instruction to the at least one processor, and when the at least one processor executes the instruction, the at least one processor executes the method of the first aspect or any of the implementations of the first aspect.
[0057] The technical effects of the eighth aspect and any of the implementations of the eighth aspect are the same as those of the first aspect and any of the implementations of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 A schematic diagram of a communication system to which a data synchronization method provided by an embodiment of the present application is applied;
[0059] Figure 2-1 A schematic diagram of a hardware structure of a first electronic device provided by an embodiment of the present application;
[0060] Figure 2-2 A schematic diagram of a software structure block diagram of the first electronic device 100 provided by an embodiment of the present application;
[0061] Figure 3 A data synchronization scenario provided by an embodiment of the present application Figure 1
[0062] Figure 4 A push delay determination scenario diagram provided by an embodiment of the present application;
[0063] Figure 5 A data synchronization timeline diagram provided by an embodiment of the present application Figure 1 ;
[0064] Figure 6-1 A data synchronization scenario diagram two provided by an embodiment of the present application
[0065] Figure 6-2 A data synchronization timeline diagram two provided by an embodiment of the present application
[0066] Figure 7 A data synchronization timeline diagram provided by an embodiment of the present application Figure 3 ;
[0067] Figure 8 A flow diagram of a data synchronization method provided by an embodiment of the present application
[0068] Figure 9 A structure diagram of a first electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting on the present application. As used in the specification and the appended claims of the present application, the singular forms “a,” “an,” and “the” are intended to include the plural forms, such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that “at least one” and “one or more” refer to one or two or more (including two) in the following embodiments of the present application.
[0070] Reference in the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, although it can. The terms "including," "comprising," "having" and variations thereof are meant to encompass the items listed thereafter and equivalents thereof as well as additional items. The terms "connected," "coupled," and variations thereof are meant to encompass the items listed thereafter, as well as implementations in which the items are directly connected, and implementations in which the items are indirectly connected and / or coupled via one or more additional items. The term "first," "second," and variations thereof merely mean "one," "two," and do not require either "one" or "two" to be present.
[0071] In the present application embodiments, the words "exemplary" and / or "example" are used to mean serving as an example, instance, or illustration. Any implementation described herein as "exemplary" and / or "example" is not necessarily to be construed as preferred or advantageous over other implementations. The illustrative implementations of the present application are not meant to be limiting. Other implementations of the present application can be used and / or implemented, whereas the terms "exemplary" and / or "example" are intended to be broad-based for personalifying the concepts.
[0072] In some scenarios, the super terminal can realize the cooperative management of multiple devices and resource sharing. For example, after the mobile phone cooperates with the nearby tablet, computer, smart screen and other devices, a super terminal can be formed. Then, the user can continue the current task of other devices on the devices that have been cooperated in the super terminal. For example, continue to watch the video being played on the mobile phone on the smart screen, continue to edit the file being edited on the mobile phone on the computer, and the like. In order to realize the above super terminal function, different electronic devices need to keep the consistency of multi-terminal data through data synchronization.
[0073] In some examples, the electronic device generates data and pushes the synchronization data to other electronic devices in the communication system, so as to realize the consistency of data between different electronic devices.
[0074] Optionally, the generated data can be application data or system data. The system data includes, for example, bundle manager service (BMS) data, device profile (DP) data, distributed hardware manager service (DHMS) data, and the like.
[0075] In some embodiments, the electronic device can complete the push synchronization of data in various ways.
[0076] For example, the electronic device performs push of the synchronization data according to a consistency level policy in a process of performing data synchronization in a push manner. The consistency level includes three coarse-grained levels of strong, arbitrary, and eventual consistency. For example, the strong synchronization includes that the electronic device pushes the synchronization data to the peer device immediately after generating the data. The arbitrary synchronization includes that the electronic device preferentially pushes part of the synchronization data with higher consistency to the peer device after generating the data. The eventual consistency synchronization includes that the peer device can successfully acquire the updated data of the electronic device within a certain period.
[0077] However, in the above scheme, although the electronic device manages the data synchronization process according to a certain consistency level policy, the consistency level policy has a coarse-grained level and cannot meet the actual use requirements. For example, the peer device can not use the synchronization data for a short time after receiving the synchronization data. In addition, in the case that the peer device is in a sleep state or a low power state, the electronic device still wakes up the peer device to push the synchronization data, so that the data synchronization is not only invalid for a short time but also increases the power consumption burden of the peer device. As a result, frequent data pushing leads to waste of power consumption and increases transmission pressure.
[0078] For another example, the electronic device performs data synchronization with the peer device when it is determined that the peer device meets a preset condition. The preset condition includes that the peer device is charging, the power is more than 90%, has Wi-Fi connection, and the peer device is in a lock screen state. In this way, the data synchronization performance is improved and energy is saved by limiting the preset condition.
[0079] However, in the above scheme, it is difficult to guarantee the data consistency of multiple devices due to the limitation of the preset condition. In addition, the fixed preset condition is simple and static, and cannot meet the dynamic changes of user use habits.
[0080] For another example, based on edge and cloud-oriented application, the electronic device sends the synchronization data to the peer device from high to low according to the priority order of the application data, so as to meet the data synchronization requirement. The electronic device supports sending synchronization data of folder granularity.
[0081] However, the above scheme is not suitable for distributed scenarios and cannot meet the data consistency requirement of multiple devices, and the synchronization data granularity is large.
[0082] In addition, in the various schemes of the above examples, the electronic device does not consider the device state of the peer device during the process of pushing the synchronization data. For example, the peer device is in a sleep state or a low power state, and the electronic device still wakes up the peer device to send the synchronization data, and the peer device does not need to use the synchronization data for a short time after receiving the synchronization data. Then, this data synchronization is unnecessary data synchronization, which causes resource waste.
[0083] Based on this, the embodiment of the present application provides a data synchronization method, and the electronic device completes data synchronization with the peer device before the peer device is offline by predicting the offline time of the peer device. Thus, while ensuring the consistency of multi-end data, the peer device in a sleep state is avoided from being frequently woken up, and the power consumption and transmission pressure are reduced.
[0084] Figure 1 A schematic diagram of a communication system to which the data synchronization method provided by the embodiment of the present application is applied is shown in FIG. 1. As shown in FIG. 1, the communication system includes a first electronic device 100 and a second electronic device 200. Figure 1
[0085] Optionally, the first electronic device 100 or the second electronic device 200 can be, for example, a terminal device such as a mobile phone, a tablet computer, a notebook computer, a smart screen, a wearable device, a vehicle-mounted terminal, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence (AI) device, etc. The operating system installed in the first electronic device 100 or the second electronic device 200 includes, but is not limited to, Windows, Android, iOS, Linux, Mac OS, etc., or other operating systems. The specific type of the first electronic device 100 or the second electronic device 200 and the operating system installed therein are not limited in the present application.
[0086] In some embodiments, a wireless communication connection is established between the first electronic device 100 and the second electronic device 200. The wireless communication technology used to establish this connection includes, but is not limited to, at least one of the following: Bluetooth (BT) (e.g., classic Bluetooth or Bluetooth Low Energy (BLE) Bluetooth), wireless local area networks (WLAN) (such as Wireless Fidelity (Wi-Fi) networks), near field communication (NFC), Zigbee, frequency modulation (FM), infrared (IR), etc.
[0087] Optionally, the first electronic device 100 and the second electronic device 200 can also establish a communication connection through a third-party device in the local area network, such as a router, gateway, smart device controller, server, etc.
[0088] Optionally, the first electronic device 100 and the second electronic device 200 in this application embodiment can be implemented by different devices. Different devices can have the same, similar, or somewhat different hardware structures, for example... Figure 2-1 The hardware structure shown.
[0089] For example, the first electronic device 100 has such Figure 2-1 Taking the hardware structure shown as an example, for Figure 2-1 The hardware structure shown will be explained.
[0090] like Figure 2-1 As shown, the first electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0091] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0092] The processor 110 can include one or more processing units. For example, the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors.
[0093] The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0094] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.
[0095] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0096] The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 can include multiple sets of I2C buses. The processor 110 can be coupled to a touch sensor, a charger, a flash, a camera 193, etc. through different I2C bus interfaces, respectively. For example, the processor 110 can be coupled to a touch sensor through an I2C interface, so that the processor 110 and the touch sensor communicate through the I2C bus interface to realize the touch function of the first electronic device 100.
[0097] The MIPI interface can be used to connect the processor 110 and peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to realize the shooting function of the first electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the first electronic device 100.
[0098] The USB interface 130 is an interface conforming to the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the first electronic device 100, and can also be used to transmit data between the first electronic device 100 and a peripheral device. It can also be used to connect a headset to play audio through the headset. The interface can also be used to connect other first electronic devices, such as AR devices, etc.
[0099] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the first electronic device 100. In other embodiments of the present application, the first electronic device 100 can also use different interface connection methods or combinations of multiple interface connection methods in the above embodiments.
[0100] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input through the wireless charging coil of the first electronic device 100. The charging management module 140 can charge the battery 142 while also supplying power to the first electronic device through the power management module 141.
[0101] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to supply power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160, etc. The power management module 141 can also be used to monitor battery capacity, battery cycle count, battery health status (leakage, impedance), etc. In other embodiments, the power management module 141 can also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be provided in the same device.
[0102] The wireless communication function of the first electronic device 100 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.
[0103] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the first electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in combination with a tuning switch.
[0104] The mobile communication module 150 can provide a solution including 2G / 3G / 4G / 5G wireless communication applied to the first electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit the processed signals to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert the signals into electromagnetic waves radiated by the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 150 can be disposed in the same device as at least part of the modules of the processor 110.
[0105] The modem processor can include a modulator and a demodulator. The modulator is used to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor is transmitted to the application processor. The application processor outputs a sound signal through an audio device, or displays an image or a video through the display screen 194. In some embodiments, the modem processor can be an independent device. In some other embodiments, the modem processor can be independent of the processor 110, and disposed in the same device as the mobile communication module 150 or other functional modules.
[0106] The wireless communication module 160 can provide a solution for wireless communication including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. applied to the first electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 can also receive signals to be transmitted from the processor 110, frequency-modulate them, amplify them, and radiate them as electromagnetic waves via the antenna 2.
[0107] In some embodiments, the antenna 1 and the mobile communication module 150 of the first electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the first electronic device 100 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite based augmentation systems (SBAS).
[0108] The first electronic device 100 implements a display function through a GPU, a display 194, and an application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.
[0109] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be manufactured by using a liquid crystal display (LCD), for example, an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Mini-led, a Micro-led, a Micro-oled, a quantum dot light emitting diode (QLED), etc. In some embodiments, the first electronic device 100 can include 1 or N display screens 194, where N is a positive integer greater than 1.
[0110] The camera 193 is used to capture still images or videos. An object generates an optical image through a lens and projects the optical image to a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to an ISP to convert it into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into an image signal in a standard format, such as RGB, YUV, etc. In some embodiments, the first electronic device 100 can include 1 or N cameras 193, where N is a positive integer greater than 1.
[0111] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the first electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement data storage functions. For example, music, video, etc. files are saved in the external memory card.
[0112] The internal memory 121 can be used to store computer executable program codes, the executable program codes including instructions. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. The data storage area can store data (such as audio data, a phone book, etc.) created during use of the first electronic device 100, and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 executes various function applications and data processing of the first electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory disposed in the processor.
[0113] The audio module 170 is used to convert digital audio information into an analog audio signal output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or part of the function modules of the audio module 170 can be disposed in the processor 110. The first electronic device 100 can play music, record sound, etc. through the audio module 170. The audio module 170 can include a speaker, a receiver, a microphone, an earphone interface, and an application processor, etc. to realize audio functions.
[0114] The sensor module 180 can include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0115] The key 190 includes a power-on key, a volume key, etc. The key 190 can be a mechanical key. It can also be a touch key. The first electronic device 100 can receive a key input, and generate a key signal input related to user settings and function control of the first electronic device 100.
[0116] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompt, and can also be used for touch vibration feedback.
[0117] The indicator 192 can be an indicator light, which can be used to indicate a charging state, a power change, and can also be used to indicate a message, a missed call, a notification, etc.
[0118] The SIM card interface 195 is used to connect a SIM card. The first electronic device 100 can support one or N SIM card interfaces, N being a positive integer greater than 1.
[0119] The software system of the first electronic device 100 or the second electronic device 200 can employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. Embodiments of the present application take an Android system with a layered architecture as an example to exemplarily illustrate the software structure of the first electronic device 100 or the second electronic device 200.
[0120] Figure 2-2 is a software structure block diagram of the first electronic device 100 according to an embodiment of the present application. The second electronic device 200 can have the same, similar, or certain different software structure.
[0121] The layered architecture divides software into several layers, each of which has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0122] The application layer can include a series of application packages.
[0123] As shown in Figure 2-2 , the application package can include calendar, contacts, memo, motion health, clipboard, gallery, map, camera, video, and other applications.
[0124] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications of the application layer. The application framework layer includes some pre-defined functions.
[0125] As shown in Figure 2-2 , the application framework layer can include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0126] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, and take screenshots, etc.
[0127] The content provider is used to store and obtain data, and make the data accessible to applications. The data can include videos, images, audio, dialed and received calls, browsing history and bookmarks, phone books, and the like.
[0128] The view system includes visual controls, such as controls that display text, controls that display pictures, and the like. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon can include a view that displays text and a view that displays a picture.
[0129] The telephony manager is used to provide communication functions of the first electronic device 100. For example, management of a call state (including call connection, call hang-up, and the like).
[0130] The resource manager provides various resources for an application, such as localized strings, icons, pictures, layout files, video files, and the like.
[0131] The notification manager enables an application to display notification information in a status bar. The notification manager can be used to convey a message of an informing type that can automatically disappear after a short stay without user interaction. The notification manager can also be a notification that appears in a form of a graph or a scroll bar text in a top status bar of a system.
[0132] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0133] The core library includes two parts: one part is a function function that is called by the java language, and the other part is the core library of the Android.
[0134] The application layer and the application framework layer are run in the virtual machine. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions of management of an object life cycle, stack management, thread management, security and exception management, and garbage collection.
[0135] The system library can include a plurality of function modules. For example: a surface manager, media libraries, a three-dimensional graphics processing library (for example: OpenGL ES), a two-dimensional graphics engine (for example: SGL), and the like.
[0136] The surface manager is used to manage a display subsystem and provides fusion of 2D and 3D layers for a plurality of applications.
[0137] The media library supports playback and recording of a plurality of commonly used audio, video formats, and static image files. The media library can support a plurality of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, and the like.
[0138] The three-dimensional graphics processing library is used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing, and the like.
[0139] A two-dimensional (2D) graphics engine is a drawing engine for 2D drawing.
[0140] The kernel layer is a layer between hardware and software. The kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
[0141] The working flow of the software and hardware of the first electronic device 100 and the second electronic device 200 is described below in the context of synchronization of calendar data.
[0142] In the first electronic device 100, when the touch sensor receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, a timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation and the control corresponding to the click operation as the control of the calendar application icon as an example, the calendar application calls the interface of the application framework layer to start the calendar application. Then, the first electronic device 100 detects, through the touch sensor, a touch operation of the user in the calendar application during the display of the calendar application and determines that the calendar application generates new data and needs to be synchronized. Then, the first electronic device 100 can determine the device state of the second electronic device 200. If the second electronic device 200 is in an active state, the first electronic device 100 sends the newly generated calendar data to the second electronic device 200. If the second electronic device 200 is in a sleep state, the first electronic device 100 can not send the newly generated calendar data to the second electronic device 200, but synchronize the calendar data with the second electronic device 200 before the second electronic device 200 is offline according to the predicted offline time of the second electronic device 200. The predicted offline time is the time when the second electronic device 200 is predicted to be offline. The method for determining the predicted offline time is described below and will not be described here.
[0143] In some scenarios, different electronic devices in a communication system can install the same distributed application, and the data of the distributed application meets the consistency requirement, so as to realize the collaborative management of the distributed application on different electronic devices. For example, a file being edited on a tablet is continued to edit on a mobile phone.
[0144] In some examples, the electronic device needs to run the distributed application after the electronic device goes offline, possibly in response to a user operation. Therefore, before the electronic device goes offline, consistency of data among the distributed applications needs to be ensured. The offline state of the electronic device is determined according to whether the electronic device is connected to a communication network. For example, when the electronic device is connected to the communication network, the electronic device can determine that it is online. For another example, when the location of the electronic device is beyond the coverage of the communication network or in response to a user operation of disconnecting the network, the electronic device determines that it is offline. Alternatively, when the electronic device determines that it is offline, the electronic device can notify other devices in the communication network that it is about to go offline. Alternatively, other devices in the communication network can determine that the electronic device is about to go offline through interaction with the electronic device.
[0145] For example, a mobile phone and a tablet are connected to the same home network. After a user edits a memo on the tablet, the user carries the mobile phone out of the home, and the mobile phone goes offline and no longer connects to the home network after moving out of the coverage of the home network. Therefore, the mobile phone can no longer synchronize data with other devices in the home network. As can be seen, when the mobile phone is online, the tablet needs to synchronize memo data with the mobile phone. Otherwise, after the mobile phone goes offline, the user cannot continue to edit the memo on the mobile phone because the memo application on the mobile phone and the tablet cannot synchronize memo data, which affects the user experience.
[0146] In some embodiments, the first electronic device 100 and the second electronic device 200 in the distributed communication system can determine the network state of the peer device in various ways, such as whether the peer device is online.
[0147] For example, the first electronic device 100 determines the communication status with the second electronic device 200 through heartbeat broadcasting. If the first electronic device 100 does not receive the heartbeat broadcast or the heartbeat broadcast response sent by the second electronic device 200 within a preset time, the first electronic device 100 can determine that the second electronic device 200 is offline.
[0148] It should be understood that the electronic devices in the distributed communication system can also determine the network state of the peer device in other ways, which are not limited in the embodiments of the present application.
[0149] In some embodiments, when the first electronic device 100 connects to the communication system for the first time, the first electronic device 100 can interact with the second electronic device 200 in the communication system to obtain offline statistical information. Subsequently, the first electronic device 100 or the second electronic device 200 can determine the predicted offline time of the peer device according to the obtained offline statistical information.
[0150] Optionally, the electronic device in the communication system can update the offline communication information according to a preset period, and interact with other devices, thereby avoiding the influence of the accuracy of the predicted offline time due to the use of the device.
[0151] Optionally, after determining that the peer device is offline, the electronic device can temporarily not delete the offline statistical information corresponding to the peer device, thereby avoiding the need to interact with the offline statistical information after the peer device accesses the communication system, and saving transmission resources. Optionally, the electronic device can also delete the saved offline statistical information corresponding to the peer device after the peer device is offline for more than a preset time threshold, thereby saving storage space. Alternatively, the electronic device can also determine whether to delete the offline statistical information corresponding to the peer device according to whether the peer device is a same-account device and other factors.
[0152] Optionally, the communication system can include a central device, and the electronic device in the communication system can send its offline statistical information to the central device, and the central device can manage the offline statistical information of each electronic device. Subsequently, the electronic device can request the central device to obtain the predicted offline time of a device that has not performed data synchronization (such as a device in a sleep state), thereby saving the computing resources of each electronic device. Optionally, the central device can be a long-power device, a long-connection device, or other devices in the communication system, such as a smart home control panel.
[0153] Optionally, the offline statistical information includes offline time corresponding to different device usage states of the electronic device. For example, the electronic device can count its device usage information, record the offline time of the device corresponding to different device usage information, and generate offline statistical information. Optionally, the device usage information includes one or more of the online duration, the usage time, and the device power of the device.
[0154] For example, as shown in Table 1 below, the electronic device records the device usage information including the online duration T0, the usage time T p , and the device power P, and records the time O p when the device becomes offline under different device usage information S=(T0, T s , P) as shown in Table 2 below after K observations, to obtain offline statistical information. For example, as shown in Table 1 below, the electronic device counts the offline time 1 corresponding to the device usage information 1 (such as an online duration of 1 hour, a usage time of 10 am, and a device power of 90%) multiple times, and the offline time 1 counted multiple times is 10 hours, 9 hours, and the like. Among them, the counted offline time is the time when the electronic device becomes offline based on the corresponding device usage information, such as 10 hours based on the device usage information 1.
[0155] In this way, the electronic device counts offline time of the peer device corresponding to different device usage information, and each device usage information can correspond to one or more offline times, and generates offline statistical information.
[0156] Table 1
[0157] Online duration Usage time Device power Device usage information 1 1 hour 10 am 90% Device usage information 2 5 hours 2 pm 30% … … … …
[0158] Table 2
[0159]
[0160] In some embodiments, after generating the data, the first electronic device 100 can determine the device state of the second electronic device 200, such as that the second electronic device 200 is in a sleep state, and can temporarily not perform data synchronization with the second electronic device 200. In addition, the first electronic device 100 can determine offline statistical information of the second electronic device 200, and then the first electronic device 100 determines the predicted offline time of the second electronic device 200 according to at least one of the current online duration, the use time, and the device power of the second electronic device 200 and the offline statistical information of the second electronic device 200 according to a preset method. Then, the first electronic device 100 wakes up the second electronic device 200 according to the predicted offline time to perform data synchronization.
[0161] For example, the electronic device determines that the current device usage information of the peer device D is S', and then determines a set of historical offline durations of the peer device D under the device usage information S' according to the offline statistical information of the peer device D Then, the electronic device fits this set of data as a normal distribution N(u, σ). After standardizing the normal distribution, the electronic device can obtain an interval [a, b] under a 1-α confidence level, where is the sample size, and z is the variable after standardization. Then, the electronic device can determine that the peer device D has a probability of 1-α to be offline after [a, b] minutes. At this time, the electronic device can determine that the delay T=(a+b) / 2 is the predicted offline time of the peer device D, and then the electronic device wakes up the peer device D and sends the data to be synchronized to the peer device D after waiting for the delay T.
[0162] For another example, the electronic device determines that the current device usage information of the peer device D is S"1, and then determines a set of historical offline durations of the peer device D under the device usage information S"1 according to the offline statistical information of the peer device D Then, the electronic device fits this set of data as a Poisson distribution with parameter λ, and according to the calculation formula of the Poisson distribution obtain the probability of each offline duration. Then, the electronic device determines a confidence level a, and can obtain a confidence interval under the confidence level Take a value from the confidence interval as the predicted offline time T. Then, the electronic device wakes up the peer device D and sends the data to be synchronized to the peer device D after waiting for the delay T.
[0163] Alternatively, the first electronic device 100 can also determine the average, mode, or median of the corresponding offline time as the predicted offline time of the second electronic device 200 according to the offline statistical information.
[0164] For example, the first electronic device 100 obtains the offline statistical information of the second electronic device 200 as shown in Table 1 and Table 2. After generating data, the first electronic device 100 determines that the second electronic device 200 is in a sleep state, and determines that the current online duration of the second electronic device 200 is 5 hours, the usage time is 2 pm, and the device power is 30%. Then, the first electronic device 100 matches to the predicted offline time of the corresponding second electronic device 200, which is 2 hours.
[0165] Alternatively, after determining the predicted offline time of the second electronic device 200, the first electronic device 100 wakes up the second electronic device 200 and sends the unsynchronized data to the second electronic device 200 in the time window corresponding to the predicted offline time. Alternatively, the time window corresponding to the predicted offline time is, for example, a preset time period before the predicted offline time. For example, the first electronic device 100 wakes up the second electronic device 200 for data synchronization N hours (or minutes, or other time units) before the determined predicted offline time of the second electronic device 200. For another example, after determining the predicted offline time of the second electronic device 200, the first electronic device 100 starts timing from the current time, and determines the time to wake up the second electronic device 200 for data synchronization by forward timing or countdown, which is before the predicted offline time of the second electronic device 200.
[0166] In some embodiments, the first electronic device 100 can generate data multiple times before the predicted offline time of the second electronic device 200. Since it is not the predicted offline time of the second electronic device 200, the first electronic device 100 does not send these synchronization data to the second electronic device 200. Then, the first electronic device 100 can record these unsynchronized data, and then send the recorded unsynchronized data to the second electronic device 200 after waking up the second electronic device 200 in the time window corresponding to the predicted offline time.
[0167] In this way, the unified synchronization of data is realized, and the data transmission pressure is reduced.
[0168] Exemplarily, as Figure 3As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain device usage information of the peer device in a preset manner, such as obtaining the online duration, usage time, device power and the like of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated by the electronic device A that has not been synchronized with the electronic device C. Figure 3 As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain device usage information of the peer device in a preset manner, such as obtaining the online duration, usage time, device power and the like of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated by the electronic device A that has not been synchronized with the electronic device C. Figure 3 As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain device usage information of the peer device in a preset manner, such as obtaining the online duration, usage time, device power and the like of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated by the electronic device A that has not been synchronized with the electronic device C.
[0169] Thus, the electronic device can determine the predicted offline time of the peer device according to the offline statistical information in the case that the peer device is in a sleep state, and perform data synchronization based on the predicted offline time, thereby effectively reducing the number of wake-ups of the peer device, and reducing power consumption and transmission pressure.
[0170] In some embodiments, before the predicted offline time of the second electronic device 200, the first electronic device 100 determines that the second electronic device 200 switches from the sleep state to the active state, or from the low power state to the non-low power state. Then, the first electronic device 100 can directly send the unsynchronized data to the second electronic device 200, without having to wait until the time window corresponding to the predicted offline time to perform data synchronization.
[0171] Thus, based on the state switching of the second electronic device 200, the data synchronization is performed in time, ensuring the consistency of multi-end data and avoiding application running abnormally.
[0172] In some embodiments, the first electronic device 100 and the second electronic device 200 in the distributed communication system can determine the device state of the peer device in various ways. Optionally, the device state includes active state, sleep state, low power state, non-low power state, and the like.
[0173] For example, the first electronic device 100 determines the communication status between the first electronic device 100 and the second electronic device 200 through the heartbeat broadcast. If the first electronic device 100 does not receive the heartbeat broadcast or the heartbeat broadcast response sent by the second electronic device 200 within a preset time, it is determined that the second electronic device 200 switches from the active state to the sleep state. Alternatively, after the second electronic device 200 switches from the sleep state to the active state, the second electronic device 200 can send a broadcast signal to the first electronic device 100, so that the first electronic device 100 can determine that the second electronic device 200 has switched to the active state according to the broadcast signal.
[0174] For another example, when the second electronic device 200 determines that the power of the second electronic device 200 is lower than the power threshold, the second electronic device 200 sends indication information to the first electronic device 100. Accordingly, the first electronic device 100 can determine that the second electronic device 200 has switched to the low-power state according to the indication information.
[0175] It should be understood that the electronic devices in the distributed communication system can also determine the device state of the opposite device in other ways, which are not limited in the embodiments of the present application.
[0176] In some embodiments, during the process of generating the data of the first application and waiting for synchronization of the data of the first application with the second electronic device according to the predicted offline time of the second electronic device, the first electronic device receives a data synchronization request sent by a third electronic device in the communication system, and the data synchronization request is used to request synchronization of the data of the first application. Then, the first electronic device synchronizes the data of the first application with the third electronic device, and determines not to synchronize the data of the first application with the second electronic device which is still in the sleep state, such as stopping the timer corresponding to the predicted offline time. Then, the third electronic device determines the predicted offline time of the second electronic device (or the first electronic device sends the predicted offline time of the second electronic device to the third electronic device), and the third electronic device synchronizes the data of the first application with the second electronic device according to the predicted offline time.
[0177] In this way, the different versions of the data corresponding to the same application program in the distributed environment are avoided, the data synchronization requirement is met, and the data consistency conflict is avoided.
[0178] In some embodiments, after the electronic device is offline, the user has a higher use demand for part of the data and a lower use demand for part of the data. Then, the electronic device can also count the use frequency of different applications after the device is offline, so as to determine the use habit of the user, and subsequently, for the data which still has access demand after the device is offline, the consistency requirement of part of the data is higher, and the synchronization can be performed within a short time after the data is generated to meet the offline accessible requirement of the data. For another part of the data which has a lower consistency requirement, the synchronization can be delayed under the consideration of the communication overhead and wake-up.
[0179] Exemplarily, as shown in Table 3 below, the electronic device counts the frequency F of using different applications after the electronic device is offline. For example, the electronic device runs the application 1 twice in the process from offline to the next online. Alternatively, the electronic device counts the data usage information after offline, which is used to indicate the frequency of using different applications after the electronic device is offline. Subsequently, the data usage information can also be exchanged between the electronic devices in the process of exchanging offline statistical information. For example, in the process of device interaction, the electronic device shares the statistical information {ST(S), F} with other devices.
[0180] Table 3
[0181] Application 1 Application 2 Application 3 … 2 10 5 …
[0182] In some embodiments, after the first electronic device 100 generates data and determines the predicted offline time of the second electronic device 200 in the sleep state according to the offline statistical information, the first electronic device 100 can further determine the push delay corresponding to the currently generated data according to the data usage information of the second electronic device 200.
[0183] Alternatively, different push delays exist for different electronic devices and different data, that is, different hierarchical consistency. Alternatively, the longer the push delay is, the lower the data hierarchical consistency is, and the data synchronization can be temporarily suspended; the shorter the push delay is, the higher the data hierarchical consistency is, and the data synchronization needs to be performed as soon as possible.
[0184] Alternatively, after the first electronic device 100 generates data and determines the push delay, the first electronic device 100 takes the time node of generating the data as a starting time point, and wakes up the second electronic device 200 to synchronize the data corresponding to the push delay after waiting for the push delay based on the starting time point. The time point of waking up the second electronic device 200 based on the push delay is not later than the time point corresponding to the predicted offline time.
[0185] Alternatively, in the process of waiting for the second electronic device 200 to synchronize the application data corresponding to the push delay, if the first electronic device 100 generates multiple data of the application, the first electronic device 100 can record the data. After the waiting for the push delay is completed, the first electronic device 100 sends the recorded data to the corresponding second electronic device 200.
[0186] In this way, compared with the current coarse-grained consistency hierarchical strategy based on strong, arbitrary and eventual consistency, the data synchronization method provided in the embodiments of the present application can determine the push delay based on the user usage habit, and realize more fine-grained continuous consistency synchronization.
[0187] For example, the first electronic device 100 can obtain statistical information {ST(S),F} from other electronic devices in the distributed communication system. Figure 4 As shown, after generating data for application 1, the first electronic device 100 determines that the second electronic device 200 is in a sleep state. It then uses the offline statistical information ST(S) of the second electronic device 200 to fit a data distribution FST(S). Based on the fitted data distribution FST(S), it infers the expected offline time T of the second electronic device 200 under different device usage information S, i.e., T = FST(S). Figure 4 As shown, the first electronic device 100 determines the estimated offline time of the second electronic device 200 as t based on the current device usage information of the second electronic device 200. Furthermore, the first electronic device 100, in conjunction with the data usage information F in the statistical information {ST(S),F} of the second electronic device 200, obtains the normalized usage ratio of different applications in the second electronic device 200, such as the normalized usage ratio P1 = softmax(F1) for application 1, where F1 is the offline usage frequency of the second electronic device 200 for application 1. Then, as... Figure 4 As shown, the first electronic device 100 performs fine-grained adjustments to the expected offline time of the second electronic device 200 based on the determined expected offline time t of the second electronic device 200 and the normalized usage ratio P1 of application 1, thereby determining the push latency corresponding to application 1. Where m is an adjustment factor. Optionally, the adjustment factor is a preset value, which developers can determine through experiments or other methods. Afterwards, the first electronic device 100 can send the synchronization data of application 1 according to the push delay.
[0188] Corresponding to the above scenarios, such as Figure 5 As shown, after application 1 in electronic device A generates data, electronic device A determines the estimated offline time t of electronic device C using the method described above. Electronic device A can then determine the push latency t1 corresponding to application 1 in electronic device C. Therefore, after generating application 1's data, electronic device A can wait for t1 before sending a wake-up instruction to electronic device C. After waking up electronic device C, electronic device A sends the synchronization data of application 1 to electronic device C. It is evident that waking up electronic device C based on the push latency occurs earlier than the estimated offline time of electronic device C, thus achieving finer-grained data synchronization based on applications.
[0189] In some examples, the offline statistical time or data usage information corresponding to different electronic devices may be the same or different. Therefore, after the first electronic device 100 generates data for a specific application, the push latency for the same application on different peer devices may be the same or different. The first electronic device 100 performs data synchronization according to the push latency corresponding to each peer device.
[0190] Exemplarily, as shown in (a) of FIG. 1, in a communication system, there are an electronic device A, an electronic device B and an electronic device C. After the electronic device A generates data of an application 1, it is determined that the electronic device B and the electronic device C are both in a sleep state, and the data synchronization with the electronic device B and the electronic device C can be suspended. Then, as shown in (b) of FIG. 1, the electronic device A determines, according to statistical information of the electronic device B and statistical information of the electronic device C respectively, a predicted offline time corresponding to the electronic device B and a push delay t2 corresponding to the electronic device B, and a predicted offline time corresponding to the electronic device C and a push delay t1 corresponding to the electronic device C, and sets corresponding timers. The push delay t2 corresponding to the electronic device B is less than the push delay t1 corresponding to the electronic device C. Then, according to the timer corresponding to the application 1 of the electronic device B, as shown in (c) of FIG. 1, the electronic device A generates data of the application 1 and waits for t2, and then sends a wake-up indication to the electronic device B to wake up the electronic device B. After that, as shown in (d) of FIG. 1, the electronic device A sends synchronization data to the electronic device B to keep the data consistency between the electronic device A and the electronic device B for the application 1. According to the timer corresponding to the application 1 of the electronic device C, as shown in (e) of FIG. 1, the electronic device A generates data of the application 1 and waits for t1, and then sends a wake-up indication to the electronic device C to wake up the electronic device C. After that, as shown in (f) of FIG. 1, the electronic device A sends synchronization data to the electronic device C to keep the data consistency between the electronic device A and the electronic device C for the application 1. Figure 6-1 Figure 6-2 Figure 6-1 Figure 6-1 Figure 6-1 Figure 6-1
[0191] In this way, the electronic device A synchronizes the data consistency of different devices according to the use habits of the user on different devices, meets the data use requirements of the peer device after it goes offline, guarantees the data use success rate, and reduces the data transmission power consumption and the communication overhead.
[0192] In some embodiments, during the process of waiting for the synchronization of the application data corresponding to the second electronic device 200 according to the push delay, the first electronic device 100 determines that the second electronic device 200 switches from the sleep state to the active state, or switches from the low power state to the non-low power state. Then, the first electronic device 100 can directly send the unsynchronized data (such as the data that has been generated for multiple times but not synchronized) to the second electronic device 200, without continuing to wait for the data synchronization in the time window corresponding to the push delay.
[0193] Exemplarily, as shown in (a) of FIG. 1, in a communication system, there are an electronic device A, an electronic device B and an electronic device C. After the electronic device A generates data of an application 1, it is determined that the electronic device B and the electronic device C are both in a sleep state, and the data synchronization with the electronic device B and the electronic device C can be suspended. Then, as shown in (b) of FIG. 1, the electronic device A determines, according to statistical information of the electronic device B and statistical information of the electronic device C respectively, a predicted offline time corresponding to the electronic device B and a push delay t2 corresponding to the electronic device B, and a predicted offline time corresponding to the electronic device C and a push delay t1 corresponding to the electronic device C, and sets corresponding timers. The push delay t2 corresponding to the electronic device B is less than the push delay t1 corresponding to the electronic device C. Then, according to the timer corresponding to the application 1 of the electronic device B, as shown in (c) of FIG. 1, the electronic device A generates data of the application 1 and waits for t2, and then sends a wake-up indication to the electronic device B to wake up the electronic device B. After that, as shown in (d) of FIG. 1, the electronic device A sends synchronization data to the electronic device B to keep the data consistency between the electronic device A and the electronic device B for the application 1. According to the timer corresponding to the application 1 of the electronic device C, as shown in (e) of FIG. 1, the electronic device A generates data of the application 1 and waits for t1, and then sends a wake-up indication to the electronic device C to wake up the electronic device C. After that, as shown in (f) of FIG. 1, the electronic device A sends synchronization data to the electronic device C to keep the data consistency between the electronic device A and the electronic device C for the application 1. Figure 7 As shown, after the electronic device A generates the data of the application 1, according to the statistical information of the electronic device C, the electronic device A determines the predicted offline time and the push delay t1 corresponding to the electronic device C, and sets the corresponding timer. Then, during the process of waiting for the data of the application 1 of the electronic device C according to the push delay t1, the electronic device C is switched from the sleep state to the active state before the time window corresponding to the push delay t1. Therefore, the electronic device A can directly synchronize the data of the application 1 with the electronic device C without further waiting.
[0194] In this way, the data synchronization is performed in time based on the state switching of the second electronic device 200, and the consistency of the multi-terminal data is ensured, and the application running exception is avoided.
[0195] In some embodiments, during the process of generating the data of the first application and waiting for the data of the first application of the second electronic device according to the push delay corresponding to the first application in the second electronic device, the first electronic device receives a data synchronization request sent by a third electronic device in the communication system, and the data synchronization request is used to request to synchronize the data of the first application. Then, the first electronic device synchronizes the data of the first application with the third electronic device, and determines not to synchronize the data of the first application with the second electronic device still in the sleep state, such as stopping the timer corresponding to the push delay. Then, the third electronic device determines the push delay corresponding to the first application in the second electronic device (or the first electronic device sends the push delay corresponding to the first application in the second electronic device to the third electronic device), and the third electronic device synchronizes the data of the first application with the second electronic device according to the push delay.
[0196] In this way, the problem of different versions of data corresponding to the same application program existing in the distributed environment is avoided, the data synchronization requirement is met, and the data consistency conflict is avoided.
[0197] In some embodiments, during the process of waiting for the data of the corresponding application of the second electronic device 200 according to the predicted offline time or the push delay, the first electronic device 100 determines that the condition of switching to the sleep state or the low-power state is met, or determines that the first electronic device 100 is about to be offline. Then, the first electronic device 100 wakes up the second electronic device 200 which has not performed data synchronization before switching to the sleep state or the low-power state or before being offline, and performs data synchronization.
[0198] In this way, the problem of multi-terminal data consistency exception caused by the first electronic device 100 switching to the sleep state or the low-power state is avoided.
[0199] Exemplarily, Figure 8 A flowchart of a data synchronization method provided by the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, the method comprises the following steps. Figure 8 As shown in FIG. 1, the method comprises the following steps.
[0200] S801, the first electronic device obtains offline statistical information of the second electronic device.
[0201] The offline statistical information is used to indicate the offline time of the second electronic device under different device usage information. The device usage information of the second electronic device includes at least one of the device online duration, the use time, and the device power.
[0202] In some embodiments, the electronic devices in the communication system respectively count the offline statistical information of themselves in the current communication system under different device usage information, so as to subsequently estimate the corresponding offline time.
[0203] For example, as shown in Table 1 and Table 2 above, the electronic device counts the corresponding offline time 1 multiple times based on the device usage information 1 (such as the online duration of 1 hour, the use time of 10 am, and the device power of 90%). The offline time 1 counted multiple times is 10 hours, 9 hours, etc.
[0204] S802, the first electronic device generates data of the first application.
[0205] In some embodiments, the first electronic device determines to generate the data of the first application in response to a user operation, that is, the first application generates the data to be synchronized. The first application is a distributed application.
[0206] S803, the first electronic device determines the estimated offline time of the second electronic device according to the offline statistical information, wherein the second electronic device is currently in a sleep state.
[0207] In some embodiments, after determining to generate the first application data to be synchronized, the first electronic device determines that the electronic device to be synchronized with the first application data includes the second electronic device. The first electronic device determines that the second electronic device is currently in a sleep state. In order to avoid frequently waking up the second electronic device and increasing the power consumption of the second electronic device, the first electronic device can temporarily not synchronize the first application data to be synchronized with the second electronic device, but first determine the estimated offline time of the second electronic device, and then synchronize the first application data to be synchronized with the second electronic device based on the estimated offline time.
[0208] In some embodiments, the first electronic device obtains the current device usage information of the second electronic device. The first electronic device determines the estimated offline time according to the offline statistical information and the current device usage information of the second electronic device.
[0209] For example, the first electronic device determines the predicted offline time of the second electronic device according to the offline statistical information and the current device usage information of the second electronic device by any one of multiple manners such as normal distribution, Poisson distribution, mean value, mode, median, and the like.
[0210] S804, the first electronic device delays the data of the first application synchronized with the second electronic device according to the predicted offline time.
[0211] In some embodiments, the current first application data to be synchronized by the first electronic device can be data that is not needed by the second electronic device temporarily, or there can be multiple times of generating the data of the first application by the first electronic device before the user uses the first application of the second electronic device. Therefore, in the case that the second electronic device is in the sleep state, the first electronic device can determine to delay the data synchronization with the second electronic device, thereby avoiding unnecessary power consumption caused by invalid wake-up or frequent wake-up of the second electronic device.
[0212] Optionally, when the first electronic device determines that the data synchronization with the second electronic device is needed, the first electronic device can send a wake-up indication to the second electronic device to wake up the second electronic device.
[0213] In some embodiments, after the first electronic device determines the predicted offline time, the first electronic device sends a wake-up indication to the second electronic device in a first time window corresponding to the predicted offline time. After waking up the second electronic device, the first electronic device sends the first synchronization data corresponding to the first application to the second electronic device, and the first synchronization data is all the data of the first application that is not synchronized with the second electronic device before the first time window.
[0214] For example, as shown in Figure 5 After the application 1 in the electronic device A generates data, the electronic device C in the sleep state is not immediately woken up, but is delayed to wake up the electronic device C, such as sending a wake-up indication to the electronic device C in a first time window corresponding to the predicted offline time t of the electronic device C to wake up the electronic device C for data synchronization.
[0215] For example, the electronic device A wakes up the electronic device C and synchronizes data with the electronic device C N hours (or minutes or other time units) before the predicted offline time of the electronic device C determined by the electronic device A. For another example, after the electronic device A determines the predicted offline time of the electronic device C, the electronic device A starts timing from the current time, determines the time to wake up the electronic device C by forward timing or countdown, and the time is before the predicted offline time of the electronic device C. Then the electronic device C wakes up the electronic device C at the determined time and synchronizes data with the electronic device C.
[0216] For example, as shown in Figure 3As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain the online duration, usage time, device power and other device usage information of the peer device in a preset manner, such as obtaining the device usage information of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information of the electronic device C and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated so far that has not been synchronized with the electronic device C. Figure 3 As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain the online duration, usage time, device power and other device usage information of the peer device in a preset manner, such as obtaining the device usage information of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information of the electronic device C and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated so far that has not been synchronized with the electronic device C. Figure 3 As shown in (a), the communication system includes electronic device A, electronic device B and electronic device C, which can interact offline statistical information. In addition, the three electronic devices can obtain the online duration, usage time, device power and other device usage information of the peer device in a preset manner, such as obtaining the device usage information of the peer device in a preset period. Subsequently, the electronic device A generates data and synchronizes the data with the electronic device B in an active state. In the case that the electronic device C is in a sleep state, the electronic device A can determine the predicted offline time (such as 10 hours later) of the electronic device C according to the offline statistical information of the electronic device C and the current device usage information of the electronic device C. Then, as shown in (b), the electronic device A starts a timer, and when the timer indicates the time window corresponding to the predicted offline time of the electronic device C, the electronic device A sends a wake-up indication to the electronic device C to wake up the electronic device C. Then, as shown in (c), in response to the wake-up indication, the electronic device C switches from the sleep state to the active state, and the electronic device A can send synchronization data to the electronic device C, which is all the data accumulated so far that has not been synchronized with the electronic device C.
[0217] Thus, the first electronic device can determine the predicted offline time of the second electronic device according to the offline statistical information in the case that the second electronic device is in a sleep state, and perform data synchronization based on the predicted offline time, thereby effectively reducing the number of wake-ups of the second electronic device and reducing power consumption and transmission pressure.
[0218] In some embodiments, after determining the predicted offline time, the first electronic device determines that the second electronic device switches from the sleep state to the active state before the first time window corresponding to the predicted offline time. Then, the first electronic device sends the second synchronization data corresponding to the first application to the second electronic device, which is all the data accumulated before the second electronic device switches from the sleep state to the active state that has not been synchronized with the second electronic device.
[0219] Thus, based on the state switching of the second electronic device, the data synchronization is performed in time to ensure the consistency of multi-end data and avoid application running abnormally.
[0220] In some embodiments, after an electronic device goes offline, users may have a higher demand for some data and a lower demand for others. Therefore, the electronic device can also analyze the frequency of user usage of different applications after the device goes offline to determine user habits. Based on these habits, for data that still has access demand even when the device is offline, some data with high consistency requirements on some devices can be synchronized shortly after data generation to meet offline access requirements. For other data with lower consistency requirements, synchronization can be delayed due to communication overhead and wake-up considerations.
[0221] For example, before generating data for the first application, the first electronic device can obtain data usage information from the second electronic device. This information indicates the frequency with which the second electronic device uses different applications after going offline. Then, after generating data for the first application and determining the estimated offline time of the currently sleeping second electronic device, the first electronic device determines the push latency corresponding to the first application on the second electronic device based on the estimated offline time and data usage information. Afterward, the first electronic device sends a wake-up instruction to the second electronic device within the second time window corresponding to the push latency. Upon waking the second electronic device, the first electronic device sends third synchronization data corresponding to the first application to the second electronic device. The second time window is before the first time window corresponding to the estimated offline time, and the third synchronization data consists of all data from the first application that has not been synchronized with the second electronic device before the second time window.
[0222] For example, such as Figure 5 As shown, after application 1 in electronic device A generates data, it does not immediately wake up electronic device C, which is in a sleep state. Instead, it delays waking up electronic device C. Electronic device A determines the estimated offline time of electronic device C. Then, based on the estimated offline time of electronic device C and data usage information, electronic device A determines the push delay t1 corresponding to the first application in electronic device C. Subsequently, electronic device A can send a wake-up instruction to electronic device C within the second time window corresponding to the push delay t1 to wake up electronic device C for data synchronization.
[0223] For example, electronic device A wakes up electronic device C and synchronizes data with it N hours (or minutes, or other time units) before the determined push delay t1 of electronic device C ends. Alternatively, after determining the push delay t1 of electronic device C, electronic device A starts timing from the current time and determines the time to wake up electronic device C by using either forward or countdown timing; this time is before the push delay t1 of electronic device C ends.
[0224] Thus, compared to the current coarse-grained consistency grading strategy based on strong, arbitrary, and eventual consistency, the data synchronization method provided in this application embodiment can determine the push delay based on user habits and achieve finer-grained continuous consistency synchronization.
[0225] Furthermore, the first electronic device synchronizes data across different devices based on the user's usage habits on different devices. This ensures data usage requirements of the second electronic device after it goes offline, guarantees data usage success rate, and reduces data transmission power consumption and communication overhead.
[0226] In other embodiments, after generating data for the first application and determining the estimated offline time of the second electronic device, which is currently in a sleep state, the first electronic device determines the push latency corresponding to the first application in the second electronic device based on the estimated offline time and data usage information. Then, before the second time window corresponding to the push latency, the first electronic device determines that the second electronic device has switched from a sleep state to an active state and sends fourth synchronization data corresponding to the first application to the second electronic device. This fourth synchronization data consists of all data from the first application that was not synchronized with the second electronic device before the second electronic device switched from a sleep state to an active state.
[0227] For example, such as Figure 7 As shown, after generating data for Application 1, electronic device A determines the estimated offline time and push latency t1 for electronic device C based on the offline statistics and data usage information of electronic device C, and sets the corresponding timer. Then, while electronic device A waits for the push latency t1 to synchronize the data of Application 1 with electronic device C, before the time window corresponding to push latency t1 has arrived, electronic device C switches from sleep mode to active mode. Therefore, electronic device A no longer needs to wait and can directly synchronize the data of Application 1 with electronic device C.
[0228] In this way, data can be synchronized in a timely manner based on the state switching of the second electronic device, ensuring the consistency of data across multiple devices and avoiding application malfunctions.
[0229] The above combination Figures 3-8 The data synchronization method provided in the embodiments of this application is described in detail below. Figure 9 The first electronic device provided in the embodiments of this application is described in detail.
[0230] In one possible design, Figure 9 This is a schematic diagram of the structure of a first electronic device provided in an embodiment of this application. Figure 9 As shown, the first electronic device 900 may include a transceiver unit 901 and a processing unit 902. The first electronic device 900 can be used to implement the functions of the first electronic device 100 involved in the above method embodiments.
[0231] Optionally, the transceiver unit 901 is used to support the first electronic device 900 in performing... Figure 8 S801, S804, and S806.
[0232] Optionally, the processing unit 902 is configured to support the first electronic device 900 in performing [the following actions]. Figure 8 S802 and S803 in the example.
[0233] The transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or transceiver module. The operation and / or function of each unit in the first electronic device 900 are respectively to implement the corresponding process of the data synchronization method described in the above method embodiments. All relevant content of each step involved in the above method embodiments can be referred to the functional description of the corresponding functional unit, and will not be repeated here for the sake of brevity.
[0234] Optionally, Figure 9 The first electronic device 900 shown may also include a storage unit ( Figure 9 (not shown in the image), this storage unit stores a program or instruction. When the transceiver unit 901 and the processing unit 902 execute the program or instruction, it causes... Figure 9 The first electronic device 900 shown can perform the data synchronization method described in the above method embodiments.
[0235] Figure 9 The technical effects of the first electronic device 900 shown can be referred to the technical effects of the data synchronization method described in the above method embodiments, and will not be repeated here.
[0236] In addition to being in the form of a first electronic device 900, the technical solutions provided in this application may also be functional units or chips in the first electronic device, or devices used in conjunction with the first electronic device.
[0237] This application also provides a chip system, including: a processor coupled to a memory, the memory being used to store programs or instructions, wherein when the program or instructions are executed by the processor, the chip system implements the methods in any of the above method embodiments.
[0238] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.
[0239] Optionally, the memory in the chip system can also be one or more. The memory can be integrated with the processor, or can be arranged separately from the processor, and the embodiments of the present application are not limited. Exemplarily, the memory can be a non-transient processor, for example, a read-only memory (ROM), which can be integrated on the same chip as the processor, or can be arranged on different chips respectively, and the embodiments of the present application do not make specific limitations on the type of memory and the arrangement manner of the memory and the processor.
[0240] Exemplarily, the chip system can be a field programmable gate array (FPGA), can be an application specific integrated circuit (ASIC), can also be a system on chip (SoC), can also be a central processor unit (CPU), can also be a network processor (NP), can also be a digital signal processor (DSP), can also be a micro controller unit (MCU), can also be a programmable logic device (PLD) or other integrated chip.
[0241] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits of hardware in the processor or instructions in the form of software. The method steps disclosed in combination with the embodiments of the present application can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor.
[0242] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. When the computer program is executed on a computer, the computer is caused to execute the above related steps to realize the data synchronization method in the above embodiments.
[0243] The embodiments of the present application also provide a computer program product, which causes a computer to execute the above related steps to realize the data synchronization method in the above embodiments when the computer program product is executed on the computer.
[0244] In addition, the embodiments of the present application also provide an apparatus. The apparatus can be specifically a component or a module, and the apparatus can include one or more processors and memories connected thereto. The memories are used to store computer programs. When the computer programs are executed by the one or more processors, the apparatus executes the data synchronization method in the above method embodiments.
[0245] Among them, the device, computer readable storage medium, computer program product or chip provided by the embodiments of the present application are used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved are referred to the beneficial effects of the corresponding method provided above, which will not be described here.
[0246] The steps of the methods or algorithms described in connection with the disclosure of the embodiments of the present application can be implemented in hardware, or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in a random access memory (RAM), a flash memory, a read only memory (ROM), an erasable programmable ROM (EPROM), an electrically EPROM (EEPROM), a register, a hard disk, a mobile hard disk, a compact disc read only memory (CD-ROM), or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).
[0247] From the above description of the embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional modules is taken as an example. In actual application, the above-mentioned functions can be completed by different functional modules according to needs; that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0248] In several embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between modules or units, which can be electrical, mechanical or other forms.
[0249] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0250] The computer readable storage medium includes, but is not limited to, any one of the following: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
[0251] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this. Any change or replacement within the technical scope disclosed in the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data synchronization system, characterized by, The system comprises a first electronic device and a second electronic device; The first electronic device is configured to: obtain offline statistical information of the second electronic device; generate data of a first application; determine an estimated offline time of the second electronic device according to the offline statistical information, wherein the second electronic device is currently in a sleep state; delay sending a wake-up instruction to the second electronic device according to the estimated offline time; The second electronic device is configured to: switch from the sleep state to an active state in response to the received wake-up instruction; The first electronic device is further configured to: synchronize the data of the first application with the second electronic device.
2. The system of claim 1, wherein, The offline statistical information is used to indicate the offline time of the second electronic device under different device usage information; The first electronic device is configured to: obtain current device usage information of the second electronic device; determine the estimated offline time according to the offline statistical information and the current device usage information of the second electronic device.
3. The system of claim 1 or 2, wherein The first electronic device is configured to: send the wake-up instruction to the second electronic device at a first time window corresponding to the estimated offline time; after waking up the second electronic device, send first synchronization data corresponding to the first application to the second electronic device, the first synchronization data being all data of the first application that has not been synchronized with the second electronic device before the first time window.
4. The system of claim 1 or 2, wherein The first electronic device is further configured to: obtain data usage information of the second electronic device, the data usage information being used to indicate the frequency of using different applications after the second electronic device goes offline; determine a push delay corresponding to the first application in the second electronic device according to the estimated offline time and the data usage information; send the wake-up instruction to the second electronic device at a second time window corresponding to the push delay; after waking up the second electronic device, send third synchronization data corresponding to the first application to the second electronic device, the second time window being before the first time window corresponding to the estimated offline time, and the third synchronization data being all data of the first application that has not been synchronized with the second electronic device before the second time window.
5. The system of claim 4, wherein The first electronic device is configured to: determine that the second electronic device switches from the sleep state to the active state before the second time window corresponding to the push delay, and send fourth synchronization data corresponding to the first application to the second electronic device, the fourth synchronization data being all data of the first application that has not been synchronized with the second electronic device before the second electronic device switches from the sleep state to the active state.
6. A data synchronization method, characterized by, The method applied to the first electronic device comprises: obtaining offline statistical information of the second electronic device; generating data of a first application; According to the offline statistical information, a predicted offline time of the second electronic device is determined, wherein the second electronic device is currently in a sleep state; According to the predicted offline time, data of the first application is delayed to be synchronized with the second electronic device.
7. The method of claim 6, wherein, The offline statistical information is used to indicate offline times of the second electronic device under different device usage information, and the determination of the predicted offline time of the second electronic device according to the offline statistical information comprises: obtaining current device usage information of the second electronic device; determining the predicted offline time according to the offline statistical information and the current device usage information of the second electronic device.
8. The method according to claim 6 or 7, characterized in that, The determination of the predicted offline time according to the predicted offline time, the data of the first application is delayed to be synchronized with the second electronic device, comprises: sending a wake-up indication to the second electronic device at a first time window corresponding to the predicted offline time; after waking up the second electronic device, sending first synchronization data corresponding to the first application to the second electronic device, the first synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the first time window.
9. The method according to claim 6 or 7, characterized in that, The determination of the predicted offline time according to the predicted offline time, the data of the first application is delayed to be synchronized with the second electronic device, comprises: determining that the second electronic device is switched from the sleep state to an active state before the first time window corresponding to the predicted offline time, and sending second synchronization data corresponding to the first application to the second electronic device, the second synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the second electronic device is switched from the sleep state to the active state.
10. The method of claim 6 or 7, wherein, Before the data of the first application is generated, the method further comprises: obtaining data usage information of the second electronic device, the data usage information being used to indicate frequencies of using different applications after the second electronic device is offline; The determination of the predicted offline time according to the predicted offline time, the data of the first application is delayed to be synchronized with the second electronic device, comprises: determining a push delay corresponding to the first application in the second electronic device according to the predicted offline time and the data usage information; sending a wake-up indication to the second electronic device at a second time window corresponding to the push delay; after waking up the second electronic device, sending third synchronization data corresponding to the first application to the second electronic device, the second time window being before the first time window corresponding to the predicted offline time, and the third synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the second time window.
11. The method of claim 10, wherein, The method further comprises: determining that the second electronic device is switched from the sleep state to the active state before the second time window corresponding to the push delay, and sending fourth synchronization data corresponding to the first application to the second electronic device, the fourth synchronization data being all data of the first application that has not been synchronized with the second electronic device and accumulated before the second electronic device is switched from the sleep state to the active state.
12. The method according to any one of claims 7-11, characterized in that, The device usage information of the second electronic device includes at least one of a device online duration, a usage time, and a device power.
13. An electronic device, comprising: Comprise: A processor and a memory, the memory being coupled to the processor, the memory being configured to store computer program codes, the computer program codes comprising computer instructions, when the processor reads the computer instructions from the memory, causing the electronic device to perform the method as claimed in any one of claims 6-12.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises a computer program, when the computer program runs on an electronic device, causing the electronic device to perform the method as claimed in any one of claims 6-12.
15. A computer program product, characterised in that, When the computer program product runs on a computer, causing the computer to perform the method as claimed in any one of claims 6-12.
Citation Information
Patent Citations
Method for managing terminal equipment, electronic equipment and computer readable storage medium
CN116056190A
Dynamic Offline End-to-End Packet Processing based on Traffic Class
US20200412655A1