Cross-device data synchronization method and device

By using relative time instead of absolute time in cross-device data synchronization, the length of broadcast messages is shortened, solving the problem of low success rate of cross-device copy and paste, and achieving more efficient data synchronization.

CN121187818APending Publication Date: 2025-12-23HUAWEI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410808050.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2025-12-23

AI Technical Summary

Technical Problem

The success rate of cross-device copy and paste is low, mainly because the copied information contains lengthy absolute times and copy serial numbers, which reduces the probability of the receiving end successfully receiving the data.

Method used

Relative time is used instead of absolute time as the time indicator in broadcast messages, which shortens the length of broadcast messages and reduces the transmission of redundant information by indexing data with relative time.

Benefits of technology

It improves the success rate and efficiency of cross-device data synchronization, ensuring the accuracy and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121187818A_ABST
    Figure CN121187818A_ABST
Patent Text Reader

Abstract

The invention provides a cross-device data synchronization method and device. The cross-device data synchronization method and device are used for improving the success rate of cross-device copying and pasting. The method comprises: the first device sending a first broadcast message, the first broadcast message being used for indicating synchronization of first data, the first broadcast message comprising a first relative time, the first relative time being used for indicating a time when the first device copies to obtain the first data; and after receiving the first broadcast message, the second device synchronizes the first data from the first device based on the first relative time.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminals, and in particular to a cross-device data synchronization method and device. BACKGROUND

[0002] A clipboard is a region in the memory of a computer, used for temporarily storing exchanged information. Different applications (APPs) can share information through the clipboard. For example, a user temporarily stores data of APP1 in the clipboard through a copy operation, and then sends the data of APP1 in the clipboard to APP2 through a paste operation, thereby completing information sharing.

[0003] For a cross-device copy-paste scenario, the copy end can broadcast copy information after copying data, to achieve synchronization of the data. Currently, in order to determine whether the current copy event is the latest copy event, the copy information broadcast by the copy end includes copy time and a copy sequence number used for indexing data, and the like, which results in long content of the broadcast copy information, and a low probability of successful reception of all copy information by the receiving end, thereby resulting in a low success rate of cross-device copy-paste. SUMMARY

[0004] The present application provides a cross-device data synchronization method and device, for improving the success rate of cross-device copy-paste.

[0005] In a first aspect, a cross-device data synchronization method is provided, which can be executed by a system including a first device and a second device. The method includes: the first device sending a first broadcast message, the first broadcast message being used for indicating synchronization of first data, and the first broadcast message including a first relative time, the first relative time being used for indicating a time at which the first data is copied by the first device; and the second device, after receiving the first broadcast message, synchronizing the first data from the first device based on the first relative time.

[0006] The first device and the second device can be terminal devices, for example, electronic devices, or other devices including electronic device functions, or chip systems (or chips) or other functional modules, which can implement the functions of electronic devices, for example, are arranged in electronic devices. The electronic devices can be electronic devices running a Harmony operation system (Harmony OS) or other operating systems such as Android. Hereinafter, the terminal devices are taken as examples of electronic devices.

[0007] In the embodiments of the present application, the first relative time carried in the first broadcast message can indicate the time at which the first device replicates the first data, or can be used as an index of the replication sequence number of the first data, thereby shortening the length of the content included in the first broadcast message and helping to improve the probability of successful synchronization of the second device to the first data.

[0008] In a possible implementation, before the first device sends the first broadcast message, the method further includes: determining, by the first device, the first relative time according to a first absolute time, the first absolute time being the time at which the first device replicates the first data, and the number of bytes occupied by the first relative time being less than the number of bytes occupied by the first absolute time. By using the relative time instead of the absolute time, the number of bytes occupied by the time in the first broadcast message can be reduced, the length of the content included in the first broadcast message is further shortened, and the probability of successful synchronization of the second device to the first data is improved.

[0009] In a possible implementation, the first device determines the first relative time according to a first absolute time, including: determining, by the first device, a second parameter and a first remainder according to the first absolute time and a first parameter, the first parameter being used to indicate an expected error; if the first remainder is less than a first threshold, determining, by the first device, the first relative time according to the second parameter, the first threshold being related to the first parameter; if the first remainder is greater than or equal to the first threshold, updating, by the first device, the second parameter, and determining, by the first device, the first relative time according to the updated second parameter. Taking an example of an expected error of 100 ms and a first threshold of 50 ms, when the first remainder is greater than or equal to 50 ms, the first remainder is processed according to 100 ms, and when the first remainder is less than 50 ms, the first remainder is processed according to 0. In this way, the maximum error between the first absolute time and the first relative time is 50 ms, that is, the time accuracy is lost by at most 50 ms in the process of processing the first absolute time to obtain the first relative time, and the error range of the expected error is met.

[0010] In a possible implementation, the method further includes: determining, by the second device, whether the first data is the latest copied data according to the first relative time and a second absolute time; or determining, by the second device, whether the first data is the latest copied data according to the second absolute time, wherein the second absolute time is a time at which the second device receives the first broadcast message; and determining, by the second device, to synchronize the first data if the first data is the latest copied data. Considering that the transmission time of the broadcast message is short, the second device can take the time at which the broadcast message is received as the time at which the first data is copied by the first device, thereby improving the efficiency of cross-device copy and paste while ensuring the success rate of cross-device copy and paste. In addition, the error between the time at which the first data is copied by the first device and determined by the second device according to the time at which the first broadcast message is received and the time included in the first broadcast message can be limited within a certain range, thereby shortening the length of the broadcast content while ensuring the accuracy of cross-device copy and paste.

[0011] In a possible implementation, the second device determines whether the first data is the latest copied data according to the first relative time and a second absolute time, including: determining, by the second device, a second relative time according to the second absolute time; determining, by the second device, a third absolute time according to the first relative time, the second relative time and the second absolute time, wherein the third absolute time is a time at which the first device copies the first data as determined by the second device; and determining, by the second device, whether the first data is the latest copied data based on the third absolute time.

[0012] In a possible implementation, the first data is synchronized from the first device based on the first relative time, including: when the historical paste probability of the second device is greater than or equal to a second threshold, obtaining the first data from the first clipboard of the first device based on the first relative time, and storing the first data to a second clipboard of the second device, wherein the second threshold is used to indicate a minimum paste requirement. According to the historical paste probability, the paste requirement is determined, and when the paste requirement is high, the first data is pre-synchronized, which helps to improve the paste efficiency of the second device.

[0013] In a possible implementation, the first data is synchronized from the first device based on the first relative time, including: when the historical paste probability of the second device is less than the second threshold, and in response to a paste data operation, obtaining the first data from the first clipboard of the first device based on the first relative time, and storing the first data to a second clipboard of the second device. When the paste requirement is low, the data can be synchronized again when the paste operation is detected, which can reduce the probability that the synchronized data is not pasted.

[0014] In a possible implementation, a broadcast frame length of the first broadcast message is related to a version number of the first data stored in the first clipboard of the first device. By including the length of the content in the broadcast message, multi-version compatibility processing is performed, the version number of the first data stored in the first clipboard can not be carried in the broadcast message, the length of the broadcast message can be further shortened, and the success rate of cross-device data synchronization can be improved.

[0015] In a second aspect, a cross-device data synchronization method is provided, which can be performed by a first device in a system including the first device and a second device. The first device and the second device can be terminal devices, for example, electronic devices, or other devices including electronic device functions, or chip systems (or chips) or other functional modules capable of realizing the functions of electronic devices, for example, being arranged in electronic devices. Hereinafter, the terminal device is taken as an example of an electronic device. The method includes: the method includes: sending a first broadcast message, the first broadcast message being used to indicate synchronization of first data, and the first broadcast message including a first relative time.

[0016] In a possible implementation, before the first broadcast message is sent, the method further includes: determining the first relative time according to a first absolute time, the first absolute time being a time at which the first data is copied by the first device, and a number of bytes occupied by the first relative time being less than a number of bytes occupied by the first absolute time.

[0017] In a possible implementation, the first relative time is determined according to the first absolute time, including: determining a second parameter and a first remainder according to the first absolute time and a first parameter, the first parameter being used to indicate an expected error; if the first remainder is less than a first threshold, the first device determines the first relative time according to the second parameter, the first threshold being related to the first parameter; if the first remainder is greater than or equal to the first threshold, the second parameter is updated, and the first relative time is determined according to the updated second parameter.

[0018] In a possible implementation, a broadcast frame length of the first broadcast message is related to a version number of the first data stored in the first clipboard.

[0019] In a third aspect, a method for cross-device data synchronization is provided, which can be performed by a second device in a system including the second device and a first device. The first device and the second device can be terminal devices, such as electronic devices, or other devices including electronic device functions, or chip systems (or chips) or other functional modules capable of implementing the functions of electronic devices, such as those provided in electronic devices. Hereinafter, the terminal devices are taken as examples of electronic devices. The method includes: receiving a first broadcast message, the first broadcast message being used to indicate synchronization of first data, the first broadcast message including a first relative time; and synchronizing the first data from the first device based on the first relative time.

[0020] In a possible implementation, the synchronizing the first data from the first device based on the first relative time includes: when a historical paste probability of the second device is greater than or equal to a second threshold, the second threshold being used to indicate a minimum paste requirement, obtaining the first data from a first clipboard of the first device based on the first relative time, and storing the first data to a second clipboard of the second device.

[0021] In a possible implementation, the synchronizing the first data from the first device based on the first relative time includes: when the historical paste probability of the second device is less than the second threshold, and in response to a paste data operation, obtaining the first data from the first clipboard of the first device based on the first relative time, and storing the first data to the second clipboard of the second device.

[0022] In a possible implementation, the method further includes: determining whether the first data is newly copied data according to the first relative time and a second absolute time, or determining whether the first data is newly copied data according to the second absolute time, wherein the second absolute time is a time at which the first broadcast message is received by the second device; and determining to synchronize the first data if the first data is newly copied data.

[0023] In a possible implementation, the determining whether the first data is newly copied data according to the first relative time and the second absolute time includes: determining a second relative time according to the second absolute time; determining a third absolute time according to the first relative time, the second relative time, and the second absolute time, the third absolute time being a time at which the first data is copied by the first device as determined by the second device; and determining whether the first data is newly copied data according to the third absolute time.

[0024] In a fourth aspect, a communication apparatus is provided, which can be an electronic device, or a chip or chip system used in an electronic device. The communication apparatus comprises a communication interface and a processor, and optionally, a memory. The memory is configured to store a computer program, and the processor is coupled to the memory and the communication interface. When the processor reads the computer program or instructions, the communication apparatus performs the method performed by the first apparatus in the second aspect, or performs the method performed by the second apparatus in the third aspect.

[0025] In a fifth aspect, a computer readable storage medium is provided, which is configured to store a computer program, and when the computer program is run on a computer, the computer is caused to perform the method provided in the second aspect or the third aspect.

[0026] In a sixth aspect, a computer program product is provided, which comprises a computer program, and when the computer program is run on a computer, the computer is caused to perform the method provided in the second aspect or the third aspect.

[0027] In a seventh aspect, a graphical user interface on an electronic device is provided, the electronic device having a display screen, a memory, and a processor configured to execute one or more computer programs stored in the memory. The graphical user interface comprises the graphical user interface displayed when the electronic device performs the method provided in the second aspect or the third aspect.

[0028] In an eighth aspect, a chip system is provided, which comprises a processor and an interface. The processor is configured to call and run instructions from the interface, so that the chip system implements the method provided in the second aspect or the third aspect.

[0029] The advantages of the second aspect to the eighth aspect are the same as those of the first aspect, and are not repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0030] Figure 1A A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application;

[0031] Figure 1B A software structure schematic diagram of an electronic device provided by an embodiment of the present application;

[0032] Figure 1C Another software structure schematic diagram of an electronic device provided by an embodiment of the present application;

[0033] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present application;

[0034] Figure 3A flowchart of a process of cross-device copy-paste data;

[0035] Figure 4 A flowchart of a process of cross-device data synchronization method provided by an embodiment of the present application;

[0036] Figure 5 A flowchart of another process of cross-device data synchronization method provided by an embodiment of the present application;

[0037] Figure 6 A structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0039] In the following, some terms in the embodiments of the present application are explained to facilitate the understanding of those of ordinary skill in the art.

[0040] The application (APP) involved in the embodiments of the present application is a software program capable of realizing one or more specific functions. Usually, multiple applications can be installed in a terminal. For example, camera application, gallery application, short message application, multimedia message application, various mailbox applications, etc. The application mentioned below can be an application installed in the terminal when it is manufactured, or an application downloaded from a network or obtained from another terminal by a user during the use of the terminal.

[0041] The uniform resource identifier (URI) involved in the embodiments of the present application is used to indicate the storage location of a picture or a file.

[0042] The clipboard involved in the embodiments of the present application is a region in the memory of a computer, used for temporarily storing data, which may include, for example, copied, cut or to-be-pasted data, etc. Only one piece of data can exist in the clipboard, and when new data is stored in the clipboard, the previously stored data in the clipboard will disappear. The data stored in the clipboard is related to the copied content, for example, if the copied content is text data, the text data can be directly stored in the clipboard, and if the copied content is a picture or a video media file, the media file cannot be directly stored in the clipboard, and therefore the URI of the media file can be stored in the clipboard. The clipboard may be, for example, a key-value (KV) storage database, which can store keys and data.

[0043] 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, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; in this document, "and / or" is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0044] Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more features. In the description of the embodiments, unless otherwise specified, the meaning of "multiple" is two or more than two.

[0045] The following describes electronic devices, graphical user interfaces (GUIs) for such electronic devices, and embodiments for using such electronic devices. In some embodiments of the present application, the electronic device can be a mobile phone, a tablet computer, a wearable device (a smart watch), an extended reality (XR) device, a vehicle-mounted device (an in-vehicle infotainment), a customer terminal device (CPE), etc. The specific type of the electronic device is not limited in the embodiments of the present application.

[0046] Please refer to Figure 1A A structural diagram of an electronic device provided in the embodiments of the present application.

[0047] The electronic device can 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 speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyro sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0048] 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 memory, 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 can be integrated in one or more processors.

[0049] 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 hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.

[0050] The internal memory 121 can be used to store computer executable program codes including instructions. The processor 110 performs various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system and software codes of at least one application program (such as a camera application, a short message application, etc.), etc. The data storage area can store data (such as images, videos, etc.) generated during use of the electronic device, etc. 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 magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0051] The internal memory 121 can also store software codes of the cross-device data synchronization method provided by the embodiments of the present application. When the processor 110 runs the software codes, the flow steps of the cross-device data synchronization method are performed, and the cross-device data synchronization process is realized.

[0052] The internal memory 121 can also store data copied by the electronic device or synchronized from other electronic devices, etc. The data can include, for example, pictures, files, etc.

[0053] The external memory interface 120 can be used to connect an external memory card such as a Micro SD card, to realize expansion of the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to realize a data storage function.

[0054] Of course, the software codes of the cross-device data synchronization method provided by the embodiments of the present application can also be stored in the external memory. The processor 110 can run the software codes through the external memory interface 120 to perform the flow steps of the cross-device data synchronization method, and realize the cross-device data synchronization process. The images, videos, etc. captured by the electronic device can also be stored in the external memory.

[0055] It should be understood that the user can specify whether to store the images in the internal memory 121 or the external memory. For example, when the electronic device is currently connected with the external memory, if the electronic device captures an image, a prompt information can be popped up to prompt the user to store the image in the external memory or the internal memory 121. Of course, there are other specification methods, which are not limited by the embodiments of the present application. Alternatively, when the electronic device detects that the internal memory 121 has a memory amount less than a preset amount, the image can be automatically stored in the external memory.

[0056] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device 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.

[0057] In some embodiments, the software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The following embodiments take an Android system with a layered architecture as an example to illustrate the software structure of the electronic device.

[0058] Figure 1B is a software structure block diagram of an electronic device provided by an embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces.

[0059] In some embodiments, the Android system can be divided into four layers, from top to bottom, an application layer, an application framework layer, an Android runtime and system library, and a kernel layer. The application layer can include a series of application packages. As shown in Figure 1B , the application package can include camera, gallery, calendar, call, map, navigation, wireless local area network (WLAN), Bluetooth, music, video, short message, etc.

[0060] The application framework layer provides application programming interface (API) and programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions. As shown in Figure 1B , the application framework layer can include window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0061] The window manager is used to manage the window program. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, and intercept the screen, etc.

[0062] The content provider is used to store and obtain data, and make the data accessible to the application. The data can include video, image, image, audio, dialed and received calls, browsing history and bookmarks, phonebook, etc.

[0063] The view system includes visual controls, such as controls that display text, controls that display images, etc. 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 an image.

[0064] The telephony manager is used to provide communication functions of the phone 100. For example, management of call status (including call connection, call hang-up, etc.).

[0065] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc. The notification manager enables an application to display notification information in the status bar, which can be used to convey a message of the notification type, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify a download completion, a message reminder, etc.

[0066] The notification manager can also be a notification that appears in the form of a chart or a scroll bar text in the top status bar of the system, such as a notification of an application running in the background, and can also be a notification that appears in the form of a dialog window on the screen. For example, a text information is prompted in the status bar, a prompt sound is emitted, the electronic device is vibrated, a light flashes, etc.

[0067] The android runtime includes a core library and a virtual machine. The android runtime is responsible for scheduling and management of the android system. The core library includes two parts: one part is a function function that needs to be called by the java language, and the other part is the core library of the android. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java file of the application layer and the application framework layer into a binary file. The virtual machine is used to perform the management of the object life cycle, the stack management, the thread management, the security and the exception management, and the garbage collection, etc.

[0068] The system library can include a plurality of functional modules. For example: a surface manager, media libraries, a three-dimensional graphics processing library (for example: OpenGLES), a 2D graphics engine (for example: SGL), etc.

[0069] The three-dimensional graphics processing library is used to realize three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc.

[0070] The 2D graphics engine is a drawing engine for 2D drawing.

[0071] The kernel layer is a layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.

[0072] Figure 1Cis another software structure block diagram of the electronic device provided in the embodiments of the present application. In some embodiments, Harmony includes four layers, from bottom to top, a kernel layer, a system basic service layer, a framework layer, and an application layer.

[0073] The Harmony system adopts a multi-kernel design, and optionally includes a Linux kernel, a Harmony micro-kernel, and a Lite operation system (LiteOS). Through this design, devices with different device capabilities can select appropriate system kernels. The kernel layer also includes a kernal abstract layer (KAL) that provides basic kernel capabilities to other Harmony layers, such as process management, thread management, memory management, file system management, network management, and peripheral management.

[0074] The system basic service layer is a core capability set of the Harmony system, and supports the Harmony system to provide services to application services through the framework layer in a multi-device deployment scenario. This layer optionally includes the following parts:

[0075] System basic capability subsystem set: provides basic capabilities for distributed applications to run, schedule, migrate, and the like on multiple devices of the Harmony system, and is composed of a distributed software bus, distributed data management and file management, distributed task scheduling, Ark runtime, distributed security and privacy protection, and the like. Among them, the Ark runtime provides a C / C++ / JavaScript multi-language runtime and a basic system class library, and also provides a runtime for a Java program (i.e., an application program or a part developed using the Java language in the framework layer) that is statically compiled using the Ark compiler. The code of the method for recording a calling path in the embodiments of the present application can be implemented in the Ark runtime.

[0076] Basic software service subsystem set: provides common and universal software services for the Harmony system, and is composed of a graphics image, a distributed media, a distributed artificial intelligence (AI), a multi-modal input, a mobile sensing development platform (MSDP) & device virtualization (DV), an event notification, a telephone service, a distributed DFX, and the like. The basic software service subsystem set can be cut according to the deployment environment of different device forms, and each subsystem can be cut according to a functional granularity.

[0077] Enhanced software service subsystem set: provides differentiated capability-enhanced software services for different devices for the Harmony system, composed of tablet business software, smart screen business software, vehicle machine business software, internet of things (IoT) business software, and the like. The enhanced software service subsystem set can be tailored according to the deployment environment of different device forms, at the granularity of a subsystem, and each subsystem can be tailored at the granularity of a function.

[0078] Harmony driver framework (HDF) and hardware abstraction adaptation layer (HAL): is the basis for the hardware ecological openness of the Harmony system, providing hardware capability abstraction to hardware upwards and providing a development framework and a running environment for various peripheral drivers downwards.

[0079] Hardware service subsystem set: provides common and adapted hardware services for the Harmony system, composed of generic Sensor, location, power supply, USB, biometric identification, and the like. The hardware service subsystem set can be tailored according to the deployment environment of different device forms, and each subsystem can be tailored at the granularity of a function.

[0080] Special hardware service subsystem: provides differentiated hardware services for different devices for the Harmony system, and can optionally include tablet special hardware service, vehicle machine special hardware service, wearable special hardware service, IoT special hardware service, and the like. The special hardware service subsystem can be tailored at the granularity of a subsystem, and each subsystem can be tailored at the granularity of a function.

[0081] The framework layer provides a user program framework and a meta-capability framework in multiple languages such as Java / C / C++ / JavaScript for applications of the Harmony system, and a multi-language framework API exposed by various software and hardware services. The application layer includes system applications and third-party applications, which can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, and the like. Applications in the Harmony system are constructed based on meta services PA and FA.

[0082] For ease of understanding, the following embodiments of the present application will take an electronic device with the structure shown in Figure 1A , Figure 1B or Figure 1C as an example, and introduce a cross-device copy and paste method provided by the embodiments of the present application in combination with the drawings.

[0083] Please refer to Figure 2 , which is a schematic diagram of an application scenario provided by the embodiments of the present application.

[0084] Figure 2In the scenario shown, mobile phone 1 and mobile phone 2 are in a collaborative working mode. Specifically, mobile phone 1 and mobile phone 2 collaborate via a wireless connection. For example, mobile phone 1 and mobile phone 2 can establish a communication connection via WLAN or Bluetooth, and transmit collaborative work data through this communication connection during collaborative work. It is understandable that... Figure 2 The scenario shown is merely an example. In practical applications, this scenario may include more electronic devices, and this application embodiment does not limit this.

[0085] Figure 2 In this scenario, the display on phone 1 includes an image and a line of text, which the user can copy. For example, the user can long-press the text; phone 1 detects this and displays a dialog box with options for "copy" and "forward," allowing the user to click "copy." The user can then paste the text onto phone 2, enabling cross-device copy-paste and data synchronization. Alternatively, the user can long-press the display on phone 2; phone 2 detects this and displays a "paste" dialog box and a dialog box showing the content to be pasted. If the content displayed in the "paste" dialog box matches the desired content, the user can click "paste," achieving cross-device data synchronization.

[0086] Please refer to Figure 3 This is a flowchart for copying and pasting data across devices, such as... Figure 3 As shown, after copying data, phone 1 can store the copied data and events in phone 1's KVstore-1, triggering event synchronization and broadcasting copy information. This copy information may include, for example, the absolute time when phone 1 copied the data (which can be understood as a timestamp), the data type information (e.g., a description of whether the data is small), the version number of the data stored in phone 1's clipboard, the copy serial number, and the user identifier (ID). The copy serial number is used to index the data; for example, the copy serial number can be a key stored in KVstore-1.

[0087] After receiving the broadcast message from mobile phone 1, mobile phone 2 can perform event pre-synchronization and determine whether it needs to synchronize the data copied by mobile phone 1 to KVstore-2. If mobile phone 2 determines that it needs to synchronize the data copied by mobile phone 1 to KVstore-2, mobile phone 2 can obtain the data from KVstore-1 according to the copy sequence number carried in the broadcast message and synchronize the obtained data to KVstore-2.

[0088] In the process, synchronization events, synchronization data, and the like are required, and the synchronization process is more. In addition, the copy information broadcast by the mobile phone 1 includes an absolute time, and the absolute time generally occupies 8 bytes (Byte). The content of the copy information is lengthy, which causes the mobile phone 1 to need to split the content included in the copy information into multiple data packets for broadcasting, and the mobile phone 2 needs to successfully receive the multiple data packets to complete data synchronization. Therefore, if the mobile phone 2 does not successfully receive a data packet in the multiple data packets, the data may not be successfully synchronized, resulting in a failure of the paste, thereby causing the success rate of cross-device copy and paste to be low.

[0089] In view of this, the embodiment of the present application provides a cross-device data synchronization method. In the method, the first relative time information included in the first broadcast message can be used to indicate the time at which the first device copies the first data, and can also be used as an index for the second device to obtain the first data from the first device. The length of the content included in the broadcast message is reduced, and the number of bytes occupied by the first relative time information is less than the number of bytes occupied by the absolute time, thereby effectively improving the success probability of cross-device data synchronization.

[0090] For reference Figure 4 A flowchart of a cross-device data synchronization method provided by the embodiment of the present application is shown in FIG. 1. The method can be implemented by a first device, for example, the electronic device shown in FIG. 2, or the mobile phone 1 shown in FIG. 3. Figure 1A The first device can also be the mobile phone 1 shown in FIG. 3. Figure 2

[0091] S401: The first device obtains first data in response to a copy operation, and stores the first data to a first clipboard.

[0092] The copy operation can be used to copy text data and / or media files such as images or videos. The first data can be copied text data, and / or the first data can also be a URI of a copied media file. If the first data is text data, the first device can transmit the first data from a copy APP to the first clipboard after detecting a copy operation of a user, that is, store the first data to the first clipboard. If the first data is a URI of a media file, the first device can obtain description information (for example, a storage path) of the media file after detecting the copy operation of the user, and generate the URI based on the storage path, and store the URI to the first clipboard.

[0093] S402: The first device determines a first absolute time at which the first data is copied, and determines a first relative time based on the first absolute time.

[0094] ​As described above, the absolute time generally occupies 8 bytes (i.e. 64 bits), and the broadcasted copy information content is lengthy, resulting in a low success rate of cross-device copy and paste. Therefore, in order to improve the success rate of cross-device copy and paste, the first device can shorten the number of bytes occupied by the time in the broadcast information. For example, the first device can process the first absolute time to obtain a first relative time occupying a smaller number of bytes. The process of determining the first relative time (t1) based on the first absolute time (T1) by the first device is as follows:

[0095] S11: The first device determines a second parameter based on T1 and a first parameter.

[0096] The first parameter is used to indicate an expected error range of the first absolute time and a third absolute time in S403. The third absolute time is a time at which the first data is copied by the first device according to the first relative time determined by the second device. In the following embodiments, the time at which the first data is copied by the first device can also be referred to as the time at which the first data is copied by the first device.

[0097] The minimum time unit of the second parameter is related to the first parameter. For example, the first parameter is 100, and the second parameter is a time parameter of hundreds of milliseconds. For example, t 100 = T1 / 100, where t 100 is the second parameter.

[0098] Optionally, there can be a certain error between the first absolute time and the first relative time. Therefore, in order to ensure that the error between the third absolute time restored by the second device according to the first relative time and the first absolute time satisfies the expected error range described above, the first device can further perform S12: The first device determines a first remainder based on T1 and the first parameter, and determines the value of the second parameter according to the first remainder.

[0099] The first remainder (R) may, for example, be the remainder of T1 with respect to the first parameter, i.e. R = T1 % X, where X is the first parameter. If the first remainder is greater than or equal to a first threshold, the first device can determine that the value of the second parameter is t 100 + 1. If the first remainder is less than the first threshold, the first device can determine that the value of the second parameter is t 100 . The first threshold is related to the first parameter, and the first threshold may, for example, be a middle value of the first parameter. For example, the first parameter is 100, and the first threshold can be 50.

[0100] S13: The first device determines t1 based on the second parameter.

[0101] The first device can determine a part of the bytes in the second parameter as t1. For example, the first device can obtain information of a corresponding number of bytes from the second parameter according to a number of bytes occupied by the first relative time, and take the obtained information as the t1. Alternatively, the first device can determine the last several bytes of the second parameter as the t1. For example, when the first relative time occupies 2 bytes, the first device can determine the last 2 bytes of the second parameter (i.e., the last 16 bits of the second parameter) as the t1.

[0102] S403: The first device sends the first broadcast message. Correspondingly, the second device receives the first broadcast message.

[0103] The first broadcast message is used to indicate the synchronization of the first data, and the first broadcast message includes the first relative time. As described in S402, the first absolute time occupies 8 bytes, and the first relative time occupies 2 bytes, i.e., the number of bytes occupied by the first relative time is less than the number of bytes occupied by the first absolute time. In this way, carrying the first relative time in the first broadcast message can shorten the length of the content included in the first broadcast message, which helps to improve the probability of successful synchronization of the second device to the first data.

[0104] Alternatively, the first broadcast message can further include characteristic description information of the first data. The characteristic description information of the first data, for example, includes one or more of the following information: data type information of the first data, i.e., description information of whether the first data is text data, description information of whether the first data is a URI, and description information of whether the first data is carried in the first broadcast message.

[0105] For example, the first broadcast message includes a byte used to describe the characteristics of the data. One bit in the byte can be used to identify one data characteristic. For example, the last bit in the byte can be used to identify whether the data is text data, the second last bit can be used to identify whether the data is a URI, and the third last bit can be used to identify whether the first data is carried in the first broadcast message.

[0106] S404: The second device synchronizes the first data from the first device based on the first relative time.

[0107] The first relative time can be used to identify the replication sequence number of the first data, i.e., the first relative time can also serve as the replication sequence number of the first data. In this way, the first device can not carry the replication sequence number of the first data in the first broadcast message, which shortens the length of the first broadcast message and helps to improve the success rate of cross-device data synchronization.

[0108] Optionally, the S404 is performed under the condition that the second device determines that the first data needs to be synchronized, and thus before performing the S404, the second device can further determine whether the first data needs to be synchronized. For example, the second device can determine whether the first data is the latest copied data according to the time at which the first device copies the first data and the time at which the data stored in the second clipboard is copied, if the first data is the latest copied data, it indicates that the second device can synchronize the first data, and if the first data is not the latest copied data, it indicates that there is another updated copy operation after the first data is copied, and the second device can not synchronize the first data.

[0109] The time at which the second device determines that the first device copies the first data can include the following two manners:

[0110] Manner 1: Considering that the transmission time of the broadcast message is short, the second device can take the time at which the first broadcast message is received (for example, the second absolute time) as the time at which the first device copies the first data, and determine whether the first data is the latest copied data based on the second absolute time. For example, if the second absolute time is earlier than the time at which the data stored in the second clipboard is copied, it indicates that there is another copy operation after the first device copies the first data, that is, the first data is not the latest copied data. The other copy operation can be a copy operation performed by the user on the second device, or can be a copy operation performed by the user on another device, which is not limited in the embodiments of the present application. It can be understood that when the other copy operation is a copy operation performed by the user on another device, it indicates that the network link between the first device and the second device can have failed, and the second device has preferentially received the broadcast message from the other device.

[0111] If the second absolute time is later than the time at which the data stored in the second clipboard is copied, it indicates that there is no other copy operation after the first device copies the first data, that is, the first data is the latest copied data.

[0112] Manner 2: The second device can also determine whether the first data is the latest copied data according to the first relative time and the time at which the first broadcast message is received (that is, the second absolute time mentioned above). The first relative time is a relative time obtained after processing the first absolute time. For example, taking the first relative time occupying two bytes as an example, the first relative time is 0-65535 (2 16the first device determines the first relative time based on the first absolute time, and the process of the first device determining the first relative time based on the first absolute time involves a process of taking remainder, rounding, etc., so that the second device cannot determine the first absolute time according to the first relative time, thereby causing the second device to be unable to directly determine whether the first data is the latest copied data based on the first relative time. Therefore, the second device can also determine the time at which the first device copies the first data according to the second absolute time and the first relative time, for example, the third absolute time. The second device can determine whether the first data is the latest copied data based on the third absolute time.

[0113] For example, the second device can determine the second relative time according to the second absolute time, and determine the third absolute time according to the first relative time, the second absolute time and the second relative time. Wherein, the way in which the second device determines the second relative time according to the second absolute time can refer to the way in which the first device determines the first relative time based on the first absolute time, which will not be described here. It can be understood that the first parameter and the first threshold used by the second device when determining the second relative time according to the second absolute time are the same as the first parameter and the first threshold used by the first device when determining the first relative time according to the first absolute time. For example, when the first device determines the first relative time based on the first absolute time, the first parameter is 100, then when the second device determines the second relative time based on the second absolute time, the first parameter is also 100.

[0114] For example, the way in which the second device determines the third absolute time (T'1) according to the first relative time (t1), the second absolute time (T2) and the second relative time (t2) can refer to the following formula 1:

[0115] T'1 = T2 - t2 * X + t1 * X (Formula 1)

[0116] Wherein, X is the first parameter.

[0117] Optionally, if the first relative time approaches the position at which the time interval (for example, the first time interval) ends, for example, the first relative time occupies 2 bytes, if the first relative time is close to 65535, the value of the second relative time may approach the position at which the next time interval (for example, the second time interval) adjacent to the first time interval starts, that is, the second relative time is close to 0, t2 is less than t1, at this time, the way in which the second device determines the third absolute time (T'1) according to the first relative time (t1), the second absolute time (T2) and the second relative time (t2) can refer to the following formula 2:

[0118] T'1 = T2 - (t2 + Y) * X + t1 * X (Formula 2)

[0119] Wherein, X is a first parameter. Y is used to represent a maximum value of the first relative time, and the maximum value of Y is related to the number of bytes occupied by the first relative time. For example, if the first relative time occupies 2 bytes, Y is 65535; if the first relative time occupies 1 byte, Y is 255. 8 -1).

[0120] In the above embodiment, taking X as 100 and the first threshold value as 50 as an example, when the first remainder is greater than or equal to 50 ms, the first remainder is processed according to 100 ms, and when the first remainder is less than 50 ms, the first remainder is processed according to 0. In this way, the maximum error of the first absolute time and the first relative time is 50 ms, that is, the time accuracy will be lost by at most 50 ms in the process of the first device processing the first absolute time to obtain the first relative time. Similarly, the maximum error of the second absolute time and the second relative time described below is also 50 ms, that is, the time accuracy will also be lost by at most 50 ms in the process of the second device processing the second absolute time to obtain the second relative time. Therefore, in the entire time processing process, the time accuracy will be lost by at most 100 ms, so that the error of the first absolute time and the third absolute time can be within 100 ms.

[0121] Optionally, after determining that the first data needs to be synchronized, the second device can also determine whether the first data needs to be pre-synchronized, that is, whether the first data needs to be synchronized in the second clipboard in advance. For example, when the first data is data with high demand for pasting, the second device can pre-synchronize the first data; when the first data is data with low demand for pasting, the second device can synchronize the first data when detecting the operation of pasting data.

[0122] Optionally, the second device can determine whether the first data needs to be pre-synchronized according to a historical pasting probability. For example, the second device can determine the number of historical broadcast messages receiving copied data and the number of successful cross-device pasting, determine the historical pasting probability based on the number of historical broadcast messages receiving copied data and the number of successful cross-device pasting, if the historical pasting probability is greater than or equal to a second threshold value, it indicates that the demand for pasting of the second device is high, and the second device can pre-synchronize the first data, if the historical pasting probability is less than the second threshold value, it indicates that the demand for pasting of the second device is low, and the second device can not pre-synchronize the first data. Wherein, if the second device determines that the first data does not need to be pre-synchronized, the second device can synchronize the first data when detecting the operation of pasting data.

[0123] The second device can acquire the first data from the first clipboard based on the first relative time information when determining that the data needs to be synchronized, and store the first data to the second clipboard. Optionally, the second device can also determine the data type information of the first data according to the feature description information in the first broadcast message, and determine the manner of synchronizing the first data. For example, if the feature description information in the first broadcast message indicates that the first data is text data, the second device can acquire the first data from the first clipboard and store the first data to the second clipboard, so as to synchronize the first data; if the feature description information in the first broadcast message indicates that the first data is a URI, the second device can acquire the URI from the first clipboard and store the URI to the second clipboard.

[0124] If the first data is a URI, the second device can acquire the media file from the first device according to the URI stored in the second clipboard when detecting the operation of pasting data. For example, the second device can acquire the media file from the first device according to the URI through a distributed file system, so as to realize cross-device copy and paste of the media file. Optionally, the communication link used by the second device to acquire the media file from the first device through the distributed file system can be the communication link used by the second device to acquire the URI from the first clipboard.

[0125] Optionally, the length of the content included in the first broadcast message can be related to the version of the first data stored in the first clipboard. For example, if the version of the first data stored in the first clipboard is version 1, the length of the content included in the first broadcast message is 3 bytes, and if the version of the first data stored in the first clipboard is version 2, the length of the content included in the first broadcast message is 4 bytes. In this way, by including the length of the content in the broadcast message to realize multi-version compatibility processing, the version number of the first data stored in the first clipboard can not be carried in the broadcast message, and the length of the broadcast message can be further shortened, which helps to improve the success rate of cross-device data synchronization.

[0126] In the embodiments of the present application, the first device and the second device can provide cut, copy and paste services to the outside through a clipboard service (for example, a drive framework service layer corresponding to the clipboard), so the process implemented by the first device in the embodiments of the present application can be understood as being implemented by the first device through a clipboard service (for example, a first clipboard service), and the process implemented by the second device can be understood as being implemented by the second device through a clipboard service (for example, a second clipboard service). Taking S401 as an example, the first device obtaining the first data in response to the copy operation can be understood as the first device obtaining the first data in response to the copy operation through the first clipboard service.

[0127] The following is achieved by Figure 5 An embodiment is introduced, which is Figure 4An example of the embodiment shown. Please refer to Figure 5 An example of the embodiment shown. Please refer to Figure 4 An example of the embodiment shown. Please refer to

[0128] After the first device obtains the first data by the copying operation, the first device can store the first data to the first clipboard, and send the first broadcast message. The first broadcast message can include the first relative time and the feature description information of the first data, for example. The first relative time can refer to the description of the first relative time in S402, and the feature description information of the first data can refer to the description of the feature description information of the first data in S403, which will not be repeated here.

[0129] After the second device receives the first broadcast message from the first device, the second device can determine whether the first data is the latest copied data according to the first broadcast message, and synchronize the first data from the first clipboard based on the first time information when the first data is determined to be the latest copied data. For example, the second device can determine whether the first data is the latest copied data according to the time when the first broadcast message is received (i.e., the second absolute time described above), and the specific determination process can refer to the description of the second device determining whether the first data is the latest copied data according to the second absolute time in S404, which will not be repeated here. Alternatively, the second device can also determine whether the first data is the latest copied data according to the time when the first broadcast message is received (i.e., the second absolute time) and the first relative time included in the first broadcast message, and the specific determination process can refer to the description of the second device determining the third absolute time according to the second absolute time and the first relative time, and determining whether the first data is the latest copied data according to the third absolute time in S404, which will not be repeated here.

[0130] Optionally, the second device can also synchronize the first data from the first device based on the first relative time information when it is determined that the first data needs to be pre-synchronized or when the first operation of pasting data is detected, that is, the second device can obtain the first data from the first clipboard of the first device based on the first relative time information, and store the first data to the second clipboard of the second device. The way in which the second device determines whether the first data needs to be pre-synchronized can refer to the description of the second device determining whether the first data needs to be pre-synchronized in S404, which will not be repeated here.

[0131] Optionally, when the second device detects the first operation of pasting data, if the first data is stored in the second clipboard and is a URI, the second device can also directly obtain the media file from the first device based on the URI. The related description of the second device obtaining the media file from the first device based on the URI can refer to the description of the second device obtaining the media file from the first device based on the URI in S404, which will not be repeated here.

[0132] In the technical solution, after the first device obtains the first data by performing the copy operation, the first device does not need to store the event in the first clipboard, and does not need to push or pull the event to the second clipboard of the second device, that is, the first device does not need to perform the synchronization process of the event relative to the second device. Therefore, the synchronization process of the event is reduced. Figure 3 According to the synchronization process shown in the figure, the embodiment of the present application reduces the synchronization process of the event. In addition, the number of bytes occupied by the time carried in the first broadcast message is less than the number of bytes occupied by the absolute time, which reduces the length of the broadcast message broadcast frame and helps to improve the success rate of cross-device copy and paste.

[0133] Next, a structure schematic diagram of an electronic device provided by an embodiment of the present application is introduced, which is shown in the figure. Figure 6 The electronic device 600 can be the first device or the second device in the foregoing. The electronic device 600 can include one or more processors 601, one or more memories 602, a communication interface 603, and one or more computer programs 604. The above devices can be connected through one or more communication buses 605. The one or more computer programs 604 are stored in the memory 602 and configured to be executed by the one or more processors 601. The one or more computer programs 604 include instructions. For example, the instructions can be used to perform the related steps of the mobile phone in the above embodiments. The communication interface 603 is used to realize the communication between the mobile phone and other devices (such as a drone). For example, the communication interface can be a transceiver.

[0134] The embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program runs on a computer, the computer is caused to execute the method in the above embodiments.

[0135] The embodiment of the present application also provides a graphical user interface on an electronic device, the electronic device having a display screen, a memory, and a processor configured to execute one or more computer programs stored in the memory. The graphical user interface includes a graphical user interface displayed when the electronic device executes the method in the above embodiments.

[0136] The embodiment of the present application also provides a chip system, which includes a processor and an interface. The processor is configured to call and run instructions from the interface, so that the chip system implements the method in the above embodiments.

[0137] In the embodiments of the present application provided above, the method provided by the embodiments of the present application is introduced from the perspective of the electronic device (the first device or the second device) as an execution subject. To implement each function in the method provided by the embodiments of the present application, the electronic device can include a hardware structure and / or a software module, and each function is implemented in the form of the hardware structure, the software module, or the hardware structure plus the software module. Whether a certain function in the above functions is implemented in the form of the hardware structure, the software module, or the hardware structure plus the software module depends on the specific application of the technical solution and the design constraint conditions.

[0138] In the above embodiments, according to the context, the term “when” can be interpreted as meaning “if” or “after”. Similarly, according to the context, the phrase “upon determining” or “if detecting (the stated condition or event)” can be interpreted as meaning “if determining” or “in response to determining” or “upon detecting (the stated condition or event)” or “in response to detecting (the stated condition or event)”.

[0139] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state disk), etc.

[0140] For purposes of explanation, the preceding description is provided in the context of specific embodiments. However, the illustrative discussions are not intended to be exhaustive or to limit the application to the precise forms disclosed. Many modifications and variations are possible in light of the above teachings. It is to be understood that the application can be practiced otherwise than as specifically described without departing from the spirit and essential characteristics of the application. The preceding description, therefore, is to be considered as illustrative only, and the scope of the application is indicated by the appended claims, rather than by the foregoing description.

Claims

1. A cross-device data synchronization method, characterized in that, The method is applied to a system comprising a first device and a second device, and comprises: The first device sends a first broadcast message, the first broadcast message being used to indicate synchronization first data, and the first broadcast message comprising a first relative time, the first relative time being used to indicate a time at which the first device replicates the first data; After the second device receives the first broadcast message, the second device synchronizes the first data from the first device based on the first relative time.

2. The method of claim 1, wherein, Before the first device sends the first broadcast message, the method further comprises: The first device determines the first relative time according to a first absolute time, the first absolute time being a time at which the first device replicates the first data, and the first relative time occupying a number of bytes smaller than a number of bytes occupied by the first absolute time.

3. The method of claim 2, wherein, The first device determines the first relative time according to a first absolute time, comprising: The first device determines a second parameter and a first remainder according to the first absolute time and a first parameter, the first parameter being used to indicate an expected error; If the first remainder is smaller than a first threshold value, the first device determines the first relative time according to the second parameter, the first threshold value being related to the first parameter; If the first remainder is greater than or equal to the first threshold value, the first device updates the second parameter, and determines the first relative time according to the updated second parameter.

4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: The second device determines whether the first data is newly replicated data according to the first relative time and a second absolute time, or the second device determines whether the first data is newly replicated data according to a second absolute time; wherein the second absolute time is a time at which the second device receives the first broadcast message; If the first data is newly replicated data, the second device determines to synchronize the first data.

5. The method of claim 4, wherein, The second device determines whether the first data is newly replicated data according to the first relative time and a second absolute time, comprising: The second device determines a second relative time according to the second absolute time; The second device determines a third absolute time according to the first relative time, the second relative time and the second absolute time, the third absolute time being a time at which the second device determines that the first device replicates the first data; The second device determines whether the first data is newly replicated data based on the third absolute time.

6. The method according to any one of claims 1 to 5, characterized in that, Synchronizing the first data from the first device based on the first relative time, comprising: When a historical paste probability of the second device is greater than or equal to a second threshold value, the second device acquires the first data from a first clipboard of the first device based on the first relative time, and stores the first data to a second clipboard of the second device, the second threshold value being used to indicate a minimum paste requirement.

7. The method according to any one of claims 1 to 6, characterized in that, Synchronizing the first data from the first device based on the first relative time, comprising: When a history paste probability of the second device is less than a second threshold, and in response to a paste data operation, the first data is obtained from the first clipboard of the first device based on the first relative time, and the first data is stored to a second clipboard of the second device.

8. The method according to any one of claims 1 to 7, characterized in that, A broadcast frame length of the first broadcast message is related to a version number of the first data stored in the first clipboard of the first device.

9. A cross-device data synchronization method, characterized by, The method applied to a first device comprises: sending a first broadcast message, the first broadcast message being used to indicate synchronization of first data, and the first broadcast message comprising a first relative time, the first relative time being used to indicate a time at which the first data is copied by the first device.

10. The method of claim 9, wherein, Before sending the first broadcast message, the method further comprises: determining the first relative time according to a first absolute time, the first absolute time being the time at which the first data is copied by the first device, and a number of bytes occupied by the first relative time being less than a number of bytes occupied by the first absolute time.

11. The method of claim 10, wherein, Determining the first relative time according to the first absolute time comprises: determining a second parameter and a first remainder according to the first absolute time and a first parameter, the first parameter being used to indicate an expected error; if the first remainder is less than a first threshold, the first device determines the first relative time according to the second parameter, the first threshold being related to the first parameter; if the first remainder is greater than or equal to the first threshold, updating the second parameter, and determining the first relative time according to the updated second parameter.

12. The method according to any one of claims 9 to 11, characterized in that, A broadcast frame length of the first broadcast message is related to a version number of the first data stored in the first clipboard.

13. A cross-device data synchronization method, comprising: The method applied to a second device comprises: receiving the first broadcast message, the first broadcast message being used to indicate synchronization of first data, and the first broadcast message comprising a first relative time, the first relative time being used to indicate a time at which the first data is copied by the first device; synchronizing the first data from the first device based on the first relative time.

14. The method of claim 13, wherein, Synchronizing the first data from the first device based on the first relative time comprises: When a history paste probability of the second device is greater than or equal to a second threshold, the first data is obtained from the first clipboard of the first device based on the first relative time, and the first data is stored to a second clipboard of the second device, the second threshold being used to indicate a minimum paste requirement.

15. The method of claim 13 or 14, wherein, Synchronizing the first data from the first device based on the first relative time comprises: When a history paste probability of the second device is less than a second threshold, and in response to a paste data operation, the first data is obtained from the first clipboard of the first device based on the first relative time, and the first data is stored to a second clipboard of the second device.

16. The method according to any one of claims 13 to 15, characterized in that, The method further comprises: determining whether the first data is the latest replicated data according to the first relative time and the second absolute time; or, determining whether the first data is the latest replicated data according to the second absolute time; wherein the second absolute time is a time at which the second device receives the first broadcast message; if the first data is the latest replicated data, determining to synchronize the first data.

17. The method of claim 16, wherein, determining whether the first data is the latest replicated data according to the first relative time and the second absolute time, comprises: determining a second relative time according to the second absolute time; determining a third absolute time according to the first relative time, the second relative time and the second absolute time, the third absolute time being a time at which the second device determines that the first device replicates the first data; the third absolute time determines whether the first data is the latest replicated data.

18. An electronic device, comprising: comprises: a processor, a memory, and one or more programs; wherein the one or more programs are stored in the memory and comprise instructions which, when executed by the processor, cause the electronic device to perform the method steps of any one of claims 9-17.

19. A computer-readable storage medium, characterized in that, The computer readable storage medium is used to store a computer program, when the computer program runs on a computer, causes the computer to execute the method of any one of claims 9-17.

20. A computer program product, characterised in that, The computer program product comprises a computer program, when the computer program runs on a computer, causes the computer to execute the method of any one of claims 9-17.

Citation Information

Cited By

  • Cross-device data synchronization method and apparatus

    EP4779474A1