Cross-device data synchronization method and apparatus
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 caused by lengthy copied information and improving the success rate and efficiency of cross-device copy and paste.
Patent Information
- Application Number
- PCT/CN2024/143387
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-20
- Filing Date
- 2024-12-27
- Publication Date
- 2025-12-26
AI Technical Summary
In cross-device copy-paste scenarios, the copy information broadcast by the copying end is lengthy, resulting in a low probability that the receiving end will successfully receive the data, thus affecting the success rate of cross-device copy-paste.
Relative time is used instead of absolute time as the time indicator in broadcast messages, shortening the length of broadcast messages and reducing verbose information content by indexing data through relative time.
It improves the success rate of cross-device copy and paste, ensuring the accuracy and efficiency of data synchronization.
Smart Images

Figure CN2024143387_26122025_PF_FP_ABST
Abstract
Description
Cross-device data synchronization method and device
[0001] Cross-reference to Related Applications
[0002] This application claims priority to the Chinese Patent Application No. 202410808050.6, filed on June 20, 2024, and entitled "Cross-device data synchronization method and device", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0003] The present application relates to the field of communication technology, and in particular to a cross-device data synchronization method and device. BACKGROUND
[0004] 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.
[0005] 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 copy sequence number for indexing data, etc., resulting 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
[0006] The present application provides a cross-device data synchronization method and device, for improving the success rate of cross-device copy-paste.
[0007] 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 to indicate synchronization of first data, the first broadcast message including 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; and the second device, after receiving the first broadcast message, synchronizing the first data from the first device based on the first relative time.
[0008] The first device and the second device can be a terminal device, for example, an electronic device, or other device including electronic device functions, or a chip system (or chip) or other functional module capable of realizing the functions of an electronic device, for example, provided in an electronic device. The electronic device can be an electronic device running a Harmony OS (Harmony operation system) or other operating system such as Android. Hereinafter, the terminal device is taken as an example of an electronic device.
[0009] 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 first data by the second device.
[0010] 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 a relative time instead of an 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 first data by the second device is improved.
[0011] 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 value, determining, by the first device, 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, 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 value 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 by the first device to obtain the first relative time, and the error range of the expected error is met.
[0012] 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.
[0013] 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.
[0014] 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.
[0015] 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.
[0016] 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.
[0017] 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.
[0018] 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.
[0019] 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.
[0020] 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.
[0021] 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.
[0022] 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.
[0023] 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.
[0024] 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.
[0025] 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.
[0026] 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.
[0027] In a fifth aspect, a computer readable storage medium is provided, which is configured to store a computer program. 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.
[0028] In a sixth aspect, a computer program product is provided, which comprises a computer program. 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.
[0029] In a seventh aspect, a graphical user interface on an electronic device is provided, the electronic device comprising 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.
[0030] 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 performs the method provided in the second aspect or the third aspect.
[0031] 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
[0032] FIG. 1A is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application;
[0033] FIG. 1B is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application;
[0034] FIG. 1C is a schematic diagram of another software structure of an electronic device according to an embodiment of the present application;
[0035] FIG. 2 is a schematic diagram of an application scenario according to an embodiment of the present application;
[0036] FIG. 3 is a flowchart of a process of cross-device copying and pasting data;
[0037] FIG. 4 is a flow diagram of a cross-device data synchronization method according to an embodiment of the present application;
[0038] FIG. 5 is a flow diagram of another cross-device data synchronization method according to an embodiment of the present application;
[0039] FIG. 6 is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0040] 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 a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0041] Hereinafter, some terms in the embodiments of the present application will be explained to facilitate understanding by those skilled in the art.
[0042] The application (APP) involved in the embodiments of the present application is a software program capable of realizing one or more specific functions. Generally, 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 a terminal when it is manufactured, or an application downloaded from a network or obtained from another terminal by a user during use of the terminal.
[0043] 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.
[0044] 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 can include, for example, copied, cut or to-be-pasted data, etc. Only one piece of data can exist in the clipboard, and the previously stored data in the clipboard will disappear when new data is stored in the clipboard. 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 can be a key-value (KV) storage database, which can store keys and data.
[0045] 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; "and / or" in this document only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0046] Hereinafter, the terms "first" and "second" are used only 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 of the features. In the description of the embodiments, unless otherwise specified, the meaning of "multiple" is two or more than two.
[0047] 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 electronic device is not limited in the embodiments of the present application.
[0048] Please refer to FIG. 1A, which is a structural diagram of an electronic device provided in an embodiment of the present application.
[0049] 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.
[0050] 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.
[0051] 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 processor's 110 waiting time, thus improving the efficiency of the system.
[0052] 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 also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0053] 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.
[0054] 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.
[0055] The external memory interface 120 can be used to connect an external memory card such as a Micro SD card to realize the 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 the data storage function.
[0056] 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.
[0057] It should be understood that the user can specify whether to store the image 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.
[0058] It can be understood that the structure illustrated 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 those illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0059] 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.
[0060] FIG. 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, each of which has a clear role and division of labor. The layers communicate with each other through software interfaces.
[0061] In some embodiments, the Android system can be 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. The application layer can include a series of application packages. As shown in FIG. 1B, the application packages can include camera, gallery, calendar, call, map, navigation, wireless local area network (WLAN), Bluetooth, music, video, short message, etc.
[0062] 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. As shown in FIG. 1B, the application framework layer can include window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0063] 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.
[0064] 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.
[0065] 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.
[0066] 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.).
[0067] 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.
[0068] 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.
[0069] 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.
[0070] 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: OpenGL ES), a 2D graphics engine (for example: SGL), etc.
[0071] The three-dimensional graphics processing library is used to realize three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc.
[0072] The 2D graphics engine is a drawing engine for 2D drawing.
[0073] 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.
[0074] FIG. 1C is another software structure block diagram of an electronic device according to an embodiment of the present application. In some embodiments, Harmony includes four layers, from bottom to top, a kernel layer, a system foundation service layer, a framework layer, and an application layer.
[0075] The Harmony system adopts a multi-kernel design, which optionally includes a Linux kernel, a Harmony micro-kernel, and a Lite Operation System (LiteOS). With this design, devices with different device capabilities can select appropriate system kernels. The kernel layer also includes a kernel 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.
[0076] The system foundation service layer is a core capability set of the Harmony system, which supports the Harmony system to provide services to application services through the framework layer in the scenario of multi-device deployment. This layer optionally includes the following parts:
[0077] System basic capability subsystem set: provides basic capabilities for distributed applications running, scheduling, migration, and other operations on multiple devices of the Harmony system, which consists 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 basic system class library, and also provides a runtime for Java programs (i.e., application programs or parts developed using Java language in the framework layer) that are statically compiled using the Ark compiler. The code of the method for recording the calling path in the embodiments of the present application can be implemented in the Ark runtime.
[0078] Basic software service subsystem set: provides common and universal software services for the Harmony system, which consists 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 the functional granularity.
[0079] 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.
[0080] 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.
[0081] 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.
[0082] Special hardware service subsystem: provides differentiated hardware services for different devices for the Harmony system, and can optionally include tablet-specific hardware services, vehicle machine-specific hardware services, wearable-specific hardware services, IoT-specific hardware services, 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.
[0083] 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.
[0084] For ease of understanding, the following embodiments of the present application will take an electronic device with the structure shown in FIG. 1A, FIG. 1B, or FIG. 1C as an example to introduce the cross-device copy-paste method provided by the embodiments of the present application in combination with the drawings.
[0085] Please refer to FIG. 2, which is a schematic diagram of an application scenario provided by an embodiment of the present application.
[0086] In the scenario shown in FIG. 2, the mobile phone 1 and the mobile phone 2 are in a cooperative mode. In the scenario, the mobile phone 1 and the mobile phone 2 cooperatively work through a wireless connection. For example, the mobile phone 1 and the mobile phone 2 can establish a communication connection through a WLAN or Bluetooth, and the mobile phone 1 and the mobile phone 2 can transmit cooperative data through the communication connection when cooperatively working. It can be understood that the scenario shown in FIG. 2 is merely an example, and more electronic devices can be included in the scenario in actual application, which is not limited in the embodiments of the present application.
[0087] In FIG. 2, the display interface of the mobile phone 1 includes an image and a line of text, and the user can perform a copy operation on the image and / or the text. For example, the user can long press a position where the line of text is located, the mobile phone 1 detects the long press operation of the user, and a dialog box including dialog box options of "copy" and "forward" can be popped up, and the user can click "copy" in the popped-up dialog box. Subsequently, the user can paste the line of text on the mobile phone 2 to realize cross-device copy and paste, that is, cross-device data synchronization. For example, the user can long press the display interface of the mobile phone 2, the mobile phone 2 detects the long press operation of the user, and a "paste" dialog box and a dialog box of to-be-pasted content can be popped up. If the content displayed in the dialog box of to-be-pasted content is the content that the user wants to paste, the user can click "paste" to realize cross-device data synchronization.
[0088] Please refer to FIG. 3, which is a flowchart of cross-device copy and paste data. As shown in FIG. 3, after the mobile phone 1 copies data, the mobile phone 1 can store the copied data (data) and an event (event) into a KV storage-1 of the mobile phone 1, trigger event synchronization, and broadcast copy information. For example, the copy information can include absolute time of copying data of the mobile phone 1, which can also be understood as a time stamp, data type information of the data (for example, description information of whether the data is small data), a version number (version) of the data stored in the clipboard of the mobile phone 1, a copy sequence number of the data, and a user identifier (ID), and the like. The copy sequence number is used to index data, for example, the copy sequence number can be a key stored in the KV storage-1.
[0089] After the mobile phone 2 receives the broadcast message from the mobile phone 1, the mobile phone 2 can perform event pre-synchronization and determine whether the data copied by the mobile phone 1 needs to be synchronized to a KV storage-2. If the mobile phone 2 determines that the data copied by the mobile phone 1 needs to be synchronized to the KV storage-2, the mobile phone 2 can acquire the data from the KV storage-1 according to the copy sequence number carried in the broadcast message, and synchronize the acquired data to the KV storage-2.
[0090] In the process, many synchronization events, synchronization data, and the like are required. In addition, the copy information broadcast by the mobile phone 1 includes 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 operation, and thus the success rate of the cross-device copy and paste operation is low.
[0091] 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, which effectively improves the success probability of cross-device data synchronization.
[0092] Please refer to FIG. 4, which is a flowchart of a cross-device data synchronization method provided by the embodiment of the present application. The method can be implemented by a first device, which can be, for example, the electronic device shown in FIG. 1A, or the mobile phone 1 shown in FIG. 2.
[0093] S401: The first device obtains first data in response to a copy operation, and stores the first data to a first clipboard.
[0094] 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 a copy operation of a user, and generate a URI based on the storage path, and store the URI to the first clipboard.
[0095] 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.
[0096] 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 first device determines the first relative time (t_1) based on the first absolute time (T_1) as follows:
[0097] S11: The first device determines a second parameter based on T_1 and a first parameter.
[0098] 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 device copies the first data according to the first relative time determined by the second device. In the following embodiments, the time at which the first device copies the first data can also be referred to as the time at which the first device copies the first data.
[0099] 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 = T_1 / 100, where t_100 is the second parameter.
[0100] 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 T_1 and the first parameter, and determines the value of the second parameter according to the first remainder.
[0101] The first remainder (R) may, for example, be the remainder of T_1 with respect to the first parameter, i.e. R = T_1 % 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.
[0102] S13: The first device determines t_1 based on the second parameter.
[0103] The first device can determine a part of the bytes in the second parameter as t_1. 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 t_1. Alternatively, the first device can determine the last several bytes of the second parameter as the t_1. Taking the first relative time occupying 2 bytes as an example, 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 t_1.
[0104] S403: The first device sends the first broadcast message. Correspondingly, the second device receives the first broadcast message.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] S404: The second device synchronizes the first data from the first device based on the first relative time.
[0109] 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.
[0110] Optionally, the S404 is performed under the condition that the second device determines that the first data needs to be synchronized, and therefore 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 when the first device copies the first data and the copy time of the stored data in the second clipboard of the second device, if the first data is the latest copied data, it indicates that the second device can synchronize the first data, 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.
[0111] The second device determining the time when the first device copies the first data can include the following two manners:
[0112] Manner 1: Considering that the transmission time of the broadcast message is short, the second device can take the time when the first broadcast message is received (for example, the second absolute time) as the time when 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 copy time of the stored data in the second clipboard, 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. Wherein, the other copy operation can be a copy operation performed by the user on the second device, or can also be a copy operation performed by the user on another device, which is not limited in the embodiment 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 may have failed, and the second device has preferentially received the broadcast message from the other device.
[0113] If the second absolute time is later than the copy time of the stored data in the second clipboard, 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.
[0114] Manner 2: The second device can also determine whether the first data is the latest replicated data according to the first relative time and a time at which the first broadcast message is received (i.e., the aforementioned second absolute time). Wherein, the first relative time is a relative time obtained after processing the first absolute time. For example, the first relative time occupies 2 bytes, and the first relative time is a relative time with a value range of 0-65535 (2^16-1). In the process of determining the first relative time based on the first absolute time, the first device involves processes such as taking remainders and rounding. Therefore, the second device cannot determine the first absolute time according to the first relative time, so that the second device cannot directly determine whether the first data is the latest replicated data based on the first relative time. Therefore, the second device can also determine a time at which the first device replicates the first data according to the second absolute time and the first relative time. For example, the time at which the first device replicates the first data determined by the second device is a third absolute time. The second device can determine whether the first data is the latest replicated data based on the third absolute time.
[0115] 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 manner in which the second device determines the second relative time according to the second absolute time can refer to the manner 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, and when the second device determines the second relative time based on the second absolute time, the first parameter is also 100.
[0116] Wherein, the manner in which the second device determines the third absolute time (T_1^') according to the first relative time (t_1), the second absolute time (T_2) and the second relative time (t_2) can refer to the following formula 1, for example:
[0117] Wherein, X is the first parameter.
[0118] Optionally, if the first relative time approaches a position where the time interval (e.g., the first time interval) ends, for example, the first relative time occupies 2 bytes, if the first relative time approaches 65535, the value of the second relative time can approach a position where a next time interval (e.g., the second time interval) adjacent to the first time interval starts, i.e., the second relative time approaches 0, t_2 is less than t_1, at this time, the second device determines the third absolute time (T_1^') according to the first relative time (t_1), the second absolute time (T_2) and the second relative time (t_2) in the following formula 2, for example: T_1^' = T_2-(t_2+Y)*X+t_1*X (Formula 2)
[0119] Wherein, X is the first parameter. Y is used to represent the maximum value of the first relative time, 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 (2^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, i.e., 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 is also 50 ms, i.e., 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 whole 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, i.e., 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 to pre-synchronize the first data according to a historical paste probability. For example, the second device can determine a number of historical broadcast messages of copied data received by the second device, and determine a number of times of successful cross-device pasting, determine the historical paste probability based on the number of historical broadcast messages of copied data received by the second device and the number of times of successful cross-device pasting, if the historical paste probability is greater than or equal to a second threshold value, it indicates that the paste demand of the second device is high, and the second device can pre-synchronize the first data, if the historical paste probability is less than the second threshold value, it indicates that the paste demand of the second device is low, and the second device can not pre-synchronize the first data. Wherein, if the second device determines not to pre-synchronize the first data, the second device can synchronize the first data when detecting the paste data operation.
[0123] When the second device determines to synchronize the data, the second device can acquire the first data from the first clipboard based on the first relative time information, 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 to determine the synchronization manner of 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 to realize the synchronization of the first data; if the feature description information in the first broadcast message indicates that the first data is URI, the second device can acquire the URI from the first clipboard and store the URI to the second clipboard.
[0124] Wherein, if the first data is 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 paste data operation. For example, the second device can acquire the media file from the first device according to the URI through the distributed file system to realize the 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, 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, which can further shorten the length of the broadcast message, and help 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 the cutting, copying and pasting services to the outside through the clipboard service (for example, the driving framework service layer corresponding to the clipboard), and thus the process implemented by the first device in the embodiments of the present application can be understood as that the first device implements through the clipboard service (for example, the first clipboard service), and the process implemented by the second device can be understood as that the second device implements through the clipboard service (for example, the second clipboard service). Taking S401 as an example, the first device obtaining the first data in response to the copying operation can be understood as that the first device obtains the first data in response to the copying operation through the first clipboard service.
[0127] An embodiment is introduced below through FIG. 5, which is an example of the embodiment shown in FIG. 4. Please refer to FIG. 5, which is a flowchart of an example of the cross-device copying and pasting method provided for the embodiment shown in FIG. 4.
[0128] After the first device obtains the first data in response to 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 may, for example, include the first relative time and the characteristic description information of the first data. The first relative time can refer to the description of the first relative time in S402, and the related description of the characteristic description information of the first data can refer to the related description of the characteristic 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 it is determined that the first data is the latest copied data. For example, the second device can determine whether the first data is the latest copied data according to the time of receiving the first broadcast message (i.e., the second absolute time mentioned above), and the specific determination process can refer to the related 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 of receiving the first broadcast message (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 related 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 first data is obtained from the first clipboard of the first device based on the first relative time information, and the first data is stored to the second clipboard of the second device. The manner in which the second device determines whether the first data needs to be pre-synchronized can refer to the related 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 has been stored in the second clipboard and the first data 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 related 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 above technical solution, after the first device obtains the first data by performing the copy operation, the first device does not have to store the event in the first clipboard, nor does it have to push or pull the event to the second clipboard of the second device, that is, compared with the synchronization process shown in FIG. 3, the synchronization process of the event is reduced in the embodiment of the present application. In addition, the number of bytes occupied by the time carried in the first broadcast message is smaller 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] The structure of an electronic device provided in an embodiment of the present application will be introduced below, which is shown in FIG. 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 are configured to be executed by the one or more processors 601, and 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] An 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 program causes the computer to execute the method in the above embodiments.
[0135] The embodiments of the present application also provide 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 comprising the graphical user interface displayed when the electronic device executes the method in the above embodiments.
[0136] The embodiments of the present application also provide a chip system, comprising a processor and an interface, the processor being configured to call and run instructions from the interface, so that the chip system implements the method in the above embodiments.
[0137] The above embodiments of the present application are described from the perspective of the electronic device (the first device or the second device) as an execution subject. In order to implement each function in the above 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 a hardware structure, a software module, or a hardware structure plus a software module. Whether a certain function in the above embodiments is implemented in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.
[0138] In the above embodiments, according to the context, the term “when” can be interpreted to mean “if” or “after”. Similarly, according to the context, the phrase “on determining” or “if detecting (the stated condition or event)” can be interpreted to mean “if determining” or “in response to determining” or “on detecting (the stated condition or event)” or “in response to detecting (the stated condition or event)”.
[0139] In the embodiments described above, all or some of the embodiments can be implemented by hardware, firmware, software, or any combination thereof. When implemented by software, the computer program product includes one or more computer instructions stored on a computer-readable storage medium. When loaded and executed by a computer, the computer program instructions cause the computer to perform the steps described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable apparatus. 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, such as from a website, a computer, a server, or a data center to another website, computer, server, or data center through wired (for example, coaxial cable, optical fiber, digital subscriber line) or wireless (for example, infrared, wireless, microwave, etc.) manner. 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, floppy disk, hard disk, magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, solid state disk), etc.
[0140] For the purpose of explanation, the foregoing description has been set forth with reference to specific embodiments. However, the exemplary discussion above is not intended to be exhaustive or to limit the application to the precise form disclosed. Many modifications and variations are possible in light of the above teachings. The embodiments were chosen and described in order to best explain the principles of the application and its practical application to thereby enable others skilled in the art to best utilize the application and various embodiments with various modifications as are suited to the particular use contemplated.
Claims
1. A communication method, characterized in that, Applied to a system including a first device and a second device, the method includes: The first device sends a first broadcast message, which is used to indicate the synchronization of first data. The first broadcast message includes a first relative time, which is used to indicate the time when the first device copied and obtained the first data. After receiving the first broadcast message, the second device synchronizes the first data from the first device based on the first relative time.
2. The method as described in claim 1, characterized in that, Before the first device sends the first broadcast message, the method further includes: The first device determines the first relative time based on the first absolute time, where the first absolute time is the time when the first device copies the first data, and the number of bytes occupied by the first relative time is less than the number of bytes occupied by the first absolute time.
3. The method as described in claim 2, characterized in that, The first device determines the first relative time based on the first absolute time, including: The first device determines a second parameter and a first remainder based on the first absolute time and the first parameter, wherein the first parameter is used to indicate the expected error; If the first remainder is less than the first threshold, the first device determines the first relative time based on the second parameter, wherein the first threshold is related to the first parameter. If the first remainder is greater than or equal to the first threshold, the first device updates the second parameter and determines the first relative time based on the updated second parameter.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The second device determines whether the first data is the most recently copied data based on the first relative time and the second absolute time; or, the second device determines whether the first data is the most recently copied data based on the second absolute time; wherein, the second absolute time is the time when the second device receives the first broadcast message; If the first data is the most recently copied data, the second device determines to synchronize the first data.
5. The method as described in claim 4, characterized in that, The second device determines whether the first data is the most recently copied data based on the first relative time and the second absolute time, including: The second device determines the second relative time based on the second absolute time; The second device determines a third absolute time based on the first relative time, the second relative time, and the second absolute time. The third absolute time is the time determined by the second device for the first device to copy the first data. The second device determines whether the first data is the most recently copied 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 includes: When the historical pasting probability of the second device is greater than or equal to the 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 in the second clipboard of the second device. The second threshold is used to indicate the minimum pasting 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 includes: When the historical pasting probability of the second device is less than the second threshold, and in response to the operation of pasting data, 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 in the second clipboard of the second device.
8. The method according to any one of claims 1 to 7, characterized in that, The broadcast frame length of the first broadcast message is related to the version number of the first data stored in the first clipboard of the first device.
9. A cross-device data synchronization method, characterized in that, Applied to a first device, the method includes: Send a first broadcast message, the first broadcast message being used to indicate the synchronization of first data, the first broadcast message including a first relative time, the first relative time being used to indicate the time when the first device copied and obtained the first data.
10. The method as described in claim 9, characterized in that, Before sending the first broadcast message, the method further includes: The first relative time is determined based on the first absolute time, where the first absolute time is the time when the first device copies the first data, and the number of bytes occupied by the first relative time is less than the number of bytes occupied by the first absolute time.
11. The method as described in claim 10, characterized in that, Determining the first relative time based on the first absolute time includes: A second parameter and a first remainder are determined based on the first absolute time and the first parameter, wherein the first parameter is used to indicate the expected error; If the first remainder is less than the first threshold, the first device determines the first relative time based on the second parameter, wherein the first threshold is 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 based on the updated second parameter.
12. The method according to any one of claims 9 to 11, characterized in that, The broadcast frame length of the first broadcast message is related to the version number of the first data stored in the first clipboard.
13. A cross-device data synchronization method, characterized in that, Applied to a second device, the method includes: The first broadcast message is received, which is used to indicate the synchronization of the first data. The first broadcast message includes a first relative time, which is used to indicate the time when the first device copied and obtained the first data. The first data is synchronized from the first device based on the first relative time.
14. The method as described in claim 13, characterized in that, Synchronizing the first data from the first device based on the first relative time includes: When the historical pasting probability of the second device is greater than or equal to the 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 in the second clipboard of the second device. The second threshold is used to indicate the minimum pasting requirement.
15. The method as described in claim 13 or 14, characterized in that, Synchronizing the first data from the first device based on the first relative time includes: When the historical pasting probability of the second device is less than the second threshold, and in response to the operation of pasting data, 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 in the second clipboard of the second device.
16. The method according to any one of claims 13 to 15, characterized in that, The method further includes: Whether the first data is the most recently copied data is determined based on the first relative time and the second absolute time; or, whether the first data is the most recently copied data is determined based on the second absolute time; wherein, the second absolute time is the time when the second device receives the first broadcast message; If the first data is the most recently copied data, then determine to synchronize the first data.
17. The method as described in claim 16, characterized in that, Determining whether the first data is the most recently copied data based on the first relative time and the second absolute time includes: The second relative time is determined based on the second absolute time; A third absolute time is determined based on the first relative time, the second relative time, and the second absolute time, wherein the third absolute time is the time determined by the second device for the first device to copy the first data; The third absolute time determines whether the first data is the most recently copied data.
18. An electronic device, characterized in that, include: Processor, memory, and one or more programs; The one or more programs are stored in the memory, and the one or more programs include instructions that, when executed by the processor, cause the electronic device to perform the steps of the method as described in any one of claims 9 to 17.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 9 to 17.
20. A computer program product, characterized in that, The computer program product includes a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 9 to 17.
Citation Information
Patent Citations
Copy and paste between devices
CN109644201A
Copying and pasting among networked devices
US10015230B1
clipboard
US20150207850A1
Data exchange across multiple computing devices through a proactive intelligent clipboard
US20160342449A1
Roaming clipboard copy / paste
US20180335998A1