File synchronization method, electronic device, and storage medium

By verifying temporary synchronized files and performing incremental synchronization, the security and accuracy issues in the file synchronization process are resolved, achieving efficient and secure file synchronization.

CN119248736BActive Publication Date: 2025-12-19HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410386081.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2025-12-19
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

The existing file synchronization process is insecure, prone to errors, and the synchronization results are inaccurate.

Method used

By verifying temporary synchronized files during the file synchronization process, including integrity, consistency, and functionality checks, it ensures that the files received by electronic devices are consistent with the source files. Filenames are modified in the file system to avoid conflicts. Incremental synchronization is used to reduce data transmission volume, and metadata comparison is used to ensure synchronization accuracy and security.

Benefits of technology

It improves the accuracy and security of file synchronization, reduces errors, saves bandwidth, reduces the power consumption of electronic devices, and ensures the integrity and consistency of file synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248736B_ABST
    Figure CN119248736B_ABST
Patent Text Reader

Abstract

The application provides a file synchronization method, an electronic device and a storage medium, and relates to the technical field of data processing. The method is applied to an electronic device, a trust ring in which the electronic device is located further comprises at least one trusted electronic device, and the method comprises the following steps: acquiring a to-be-synchronized file sent by the at least one trusted electronic device; generating a temporary synchronization file according to the to-be-synchronized file; checking the temporary synchronization file; and when the temporary synchronization file passes the check, synchronizing the temporary synchronization file to a file system. In this implementation, the temporary synchronization file is checked, so that the file received by the electronic device is consistent with the source file, the integrity of file synchronization is ensured, and the accuracy of file synchronization is improved. The temporary synchronization file is checked, so that the synchronized file cannot be tampered with, the system of the electronic device in the trust ring is prevented from being attacked by malicious software or viruses, and the security of the file synchronization process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a file synchronization method, an electronic device and a storage medium. BACKGROUND

[0002] With the development of communication technology, distributed technology is more and more applied to electronic devices. Distributed technology brings users a more relaxed and convenient experience in some scenarios such as office, data storage and data access.

[0003] For example, in a distributed file synchronization scenario, a mobile phone and other electronic devices (such as a tablet computer, a notebook computer, a home storage device, etc.) are connected through near field communication. For example, a local area network is formed by using wireless fidelity (Wi-Fi), bluetooth (BT), peer-to-peer (P2P) and other near field communication technologies, a trust ring is established, and files in the mobile phone are synchronized to other electronic devices.

[0004] However, it is found in use that the file synchronization process in the related art is not safe and is prone to errors. SUMMARY

[0005] The present application provides a file synchronization method, an electronic device and a storage medium, which can ensure the integrity of file synchronization, improve the accuracy of file synchronization and improve the security of the file synchronization process.

[0006] In a first aspect, the present application provides a file synchronization method applied to an electronic device, wherein a trust ring in which the electronic device is located further includes at least one trusted electronic device, and the method includes: obtaining a to-be-synchronized file sent by the at least one trusted electronic device; generating a temporary synchronization file according to the to-be-synchronized file; verifying the temporary synchronization file; and when the temporary synchronization file passes the verification, synchronizing the temporary synchronization file to a file system.

[0007] The to-be-synchronized file is a file that is intended to be synchronized. In the embodiments of the present application, the to-be-synchronized file can be a file sent by a trusted electronic device to the electronic device for synchronization.

[0008] Optionally, verifying the temporary synchronization file can include verifying the integrity of the temporary synchronization file, the consistency of the temporary synchronization file and a source file, whether the function of the temporary synchronization file is normal, etc.

[0009] In this implementation, since the temporary synchronization file is checked, it can be ensured that the file received by the electronic device is consistent with the source file, ensuring the integrity and consistency of file synchronization, making the finally synchronized file accurate and improving the accuracy of file synchronization. Checking the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is less prone to errors, effectively avoiding the system of the electronic device in the trust ring from being attacked by malicious software or viruses, and improving the security of the file synchronization process.

[0010] In combination with the first aspect, in some implementations of the first aspect, the checking the temporary synchronization file comprises: obtaining source end metadata sent by the at least one trusted electronic device; generating a check value corresponding to the temporary synchronization file and a check value corresponding to the source end metadata; and determining that the temporary synchronization file passes the check when the check value of the temporary synchronization file is consistent with the check value of the source end metadata.

[0011] Optionally, the check value of the temporary synchronization file and the check value of the source end metadata can each comprise a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, or the like.

[0012] In this implementation, the consistency of the temporary synchronization file and the source file is checked, and the files are synchronized when the temporary synchronization file and the source file are consistent, which can make the finally synchronized file accurate and improve the accuracy of file synchronization. Checking the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is less prone to errors, effectively avoiding the system of the electronic device in the trust ring from being attacked by malicious software or viruses, and improving the security of the file synchronization process.

[0013] In combination with the first aspect, in some implementations of the first aspect, the synchronizing the temporary synchronization file to the file system comprises: deleting a local file corresponding to the temporary synchronization file in the file system; modifying the file name of the temporary synchronization file; and storing the temporary synchronization file with the modified file name to the file system.

[0014] Optionally, the file name of the temporary synchronization file after modification is consistent with the file name of the local file.

[0015] In this implementation, the local file is deleted first, and then the file name of the temporary synchronization file is modified, which can avoid file name conflicts and reduce errors caused by inconsistent file names or file versions, and help ensure the integrity and consistency of file synchronization.

[0016] In combination with the first aspect, in some implementations of the first aspect, the generating the temporary synchronization file according to the file to be synchronized comprises: performing incremental synchronization on the local file and the file to be synchronized to generate the temporary synchronization file.

[0017] In this implementation, the multi-end synchronization of the file is completed in an incremental synchronization manner, which can effectively reduce the data amount of file transmission and save bandwidth. Moreover, due to the reduction of the data amount of transmission, the file synchronization process is accelerated, and the overall data synchronization efficiency is improved. Meanwhile, since the electronic device only needs to process the changed file, the load in the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0018] With reference to the first aspect, in some implementations of the first aspect, before obtaining the to-be-synchronized file sent by the at least one trusted electronic device, the file synchronization method can further include: obtaining local metadata; when it is detected that the local metadata matches the local file, comparing whether the local metadata is consistent with source-end metadata; and when the local metadata is consistent with the source-end metadata, updating the local file.

[0019] The local metadata is used to describe the name, file size, file creation time, file last modification time, file last access time, file type, file permission (such as read-write permission, write permission, execution permission, etc.), file owner, file attribute flag (such as a specific flag bit, used to indicate that the file belongs to a hidden file, or a system file, or a read-only file, etc.), file system information, file version, file extension attribute (such as a custom label), relative path, and the like of the local file.

[0020] The source-end metadata is used to describe the name, file size, file creation time, file last modification time, file last access time, file type, file permission (such as read-write permission, write permission, execution permission, etc.), file owner, file attribute flag (such as a specific flag bit, used to indicate that the file belongs to a hidden file, or a system file, or a read-only file, etc.), file system information, file version, file extension attribute (such as a custom label), relative path, and the like of the to-be-synchronized file.

[0021] In this implementation, the local metadata and the local file are checked, and the local metadata and the source-end metadata are checked, and when both checks pass, the subsequent file synchronization process is executed, which can ensure the accuracy of the subsequent file synchronization result.

[0022] With reference to the first aspect, in some implementations of the first aspect, after it is detected that the local metadata matches the local file and the local metadata and the source-end metadata are compared, the file synchronization method can further include: when the local metadata and the source-end metadata are inconsistent, determining difference data between the local metadata and the source-end metadata; and sending the difference data to the at least one trusted electronic device.

[0023] The difference data is used to trigger the at least one trusted electronic device to send the to-be-synchronized file to the electronic device.

[0024] In this implementation, when it is determined that the local file is different from the source file, the difference data is sent to the trusted electronic device, triggering the trusted electronic device to send the file to be synchronized to the electronic device, thereby providing guarantee for file synchronization.

[0025] With reference to the first aspect, in some implementations of the first aspect, the file synchronization method, after determining the difference data between the local metadata and the source metadata when the local metadata is inconsistent with the source metadata, can further include: sending the source metadata and the difference data to at least one trusted electronic device.

[0026] The source metadata is sent for the at least one trusted electronic device to check whether the source metadata matches the local file in the at least one trusted electronic device; and the difference data is sent for triggering the at least one trusted electronic device to send the file to be synchronized to the electronic device when the source metadata matches the local file in the at least one trusted electronic device.

[0027] In this implementation, the source file and the metadata of the trusted electronic device are checked first, and the subsequent file synchronization process is performed only when the source file is correct, thereby ensuring the accuracy of the subsequent file synchronization result.

[0028] In a second aspect, the present application provides an electronic device, which includes: one or more processors; one or more memories; a module installed with a plurality of application programs; and the memory stores one or more programs, when the one or more programs are executed by the processor, the electronic device executes the method in the first aspect and any possible implementation manner thereof.

[0029] In a third aspect, the present application provides a device for processing data, which includes units for executing any method in the first aspect. The device can be a server, an electronic device, or a chip in an electronic device. The device can include an input unit and a processing unit.

[0030] When the device is an electronic device, the processing unit can be a processor, and the input unit can be a communication interface. The electronic device can further include a memory for storing computer program codes, and when the processor executes the computer program codes stored in the memory, the electronic device executes any method in the first aspect.

[0031] When the device is a chip in an electronic device, the processing unit can be a processing unit inside the chip, and the input unit can be an output interface, a pin, or a circuit, etc. The chip can further include a memory, which can be a memory (e.g., a register, a cache, etc.) inside the chip, or a memory (e.g., a read-only memory, a random access memory, etc.) outside the chip. The memory is configured to store computer program code, and when the processor executes the computer program code stored in the memory, the chip is caused to perform the method in any one of the first aspect and any possible implementation manner thereof.

[0032] In a fourth aspect, the present application provides a chip, including a processor. The processor is configured to read and execute computer program stored in a memory, so as to perform the method in the first aspect and any possible implementation manner thereof.

[0033] Optionally, the chip further includes a memory, and the memory is connected to the processor through a circuit or a wire.

[0034] Optionally, the chip further includes a communication interface.

[0035] In a fifth aspect, the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the processor is caused to perform the method in the first aspect and any possible implementation manner thereof.

[0036] In a sixth aspect, the present application provides a computer program product, and the computer program product includes computer program code. When the computer program code is executed on an electronic device, the electronic device is caused to perform the method in the first aspect and any possible implementation manner thereof.

[0037] The technical effects obtained by the above-mentioned second aspect, third aspect, fourth aspect, fifth aspect and sixth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and thus will not be described here. BRIEF DESCRIPTION OF DRAWINGS

[0038] Figure 1 A system architecture diagram suitable for the file synchronization method shown in the embodiments of the present application;

[0039] Figure 2 Another system architecture diagram suitable for the file synchronization method shown in the embodiments of the present application;

[0040] Figure 3 An application scenario diagram of file synchronization shown in the embodiments of the present application;

[0041] Figure 4 An external storage backup data based diagram shown in the embodiments of the present application;

[0042] Figure 5 A backup data process schematic diagram shown in an embodiment of the present application;

[0043] Figure 6 A file synchronization process schematic diagram shown in an embodiment of the present application;

[0044] Figure 7 A file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0045] Figure 8 A incremental synchronization schematic diagram shown in an embodiment of the present application;

[0046] Figure 9 Another file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0047] Figure 10 Another file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0048] Figure 11 Another file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0049] Figure 12 Another file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0050] Figure 13 Another file synchronization method flow schematic diagram shown in an embodiment of the present application;

[0051] Figure 14 A hardware structure schematic diagram of an electronic device shown in an embodiment of the present application;

[0052] Figure 15 A software structure schematic diagram of an electronic device shown in an embodiment of the present application;

[0053] Figure 16 A chip structure schematic diagram shown in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The technical solutions in the present application will be described below with reference to the drawings.

[0055] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; the "and / or" in the present application only means 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 means that there are 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.

[0056] The terms "first", "second", etc. are used only for the purpose of description and do not imply or imply relative importance or imply that the indicated technical features are limited in number. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments, unless otherwise stated, the meaning of "a plurality" is two or more.

[0057] In the description of the present application, the reference to "one embodiment" or "some embodiments" means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in other some embodiments" and the like appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "include but not limited to", unless otherwise specifically emphasized.

[0058] In order to better understand the embodiments of the present application, the following first explains some terms involved in the embodiments of the present application, so as to facilitate the understanding of the skilled in the art.

[0059] 1, trust ring and trusted electronic device

[0060] Two or more electronic devices establish a trust relationship through trusted authentication, forming a trust ring.

[0061] Electronic devices can be authenticated through any of the following methods to establish a trust relationship and form a trust ring: 1) log in to the same account on two or more electronic devices, and the electronic devices under the same account trust each other, so that the two or more electronic devices form a trust ring. For example, two mobile phones of the same user, or the mobile phone, tablet computer, notebook computer, home storage device (Network Attached Storage, NAS) of the same user can be authenticated through the login of the user's account to establish a trust relationship and form a trust ring. 2) Two or more electronic devices establish a trust relationship through private protocol authentication, forming a trust ring. 3) Two or more electronic devices establish a trust relationship through cloud login authentication, forming a trust ring. It can be understood that the above methods of constructing a trust ring are only used for illustration and do not constitute any limitation on the present application.

[0062] The electronic devices in the trust circle form a local area network through near field communication, and data synchronization can be performed through the local area network to realize device cooperation. In the embodiments of the present application, the data synchronization includes but is not limited to file synchronization.

[0063] The electronic device that initiates the synchronization request in the trust circle can be referred to as a master device, and other electronic devices that are mutually authenticated with the master device and have a trust relationship are referred to as trusted electronic devices. For example, a mobile phone, a tablet computer and a notebook computer form a trust circle, the mobile phone initiates a synchronization request in the trust circle, and the application synchronizes files in the mobile phone to the tablet computer and the notebook computer, so the mobile phone is the master device, and the tablet computer and the notebook computer are trusted electronic devices.

[0064] 2. Cross-end mounting access to files

[0065] The storage device transmits, shares and accesses files between different operating systems and electronic devices.

[0066] 3. Trust circle application

[0067] The trust circle application refers to an application program in the electronic device in the trust circle. The user can set up file backup, file synchronization and other functions through the trust circle application.

[0068] Exemplarily, the trust circle application can include a file management application, a settings application, a near field transmission application, a gallery application, a third-party file synchronization application, a multimedia application, a social application, a network application, an education application, etc.

[0069] 4. Software Development Kit (SDK)

[0070] Generally refers to the collection of development tools used by software engineers when developing applications for a specific software package, software framework, hardware platform, operating system, etc. In other words, the SDK is a collection of related documents, examples and tools that assist in developing a certain type of application, which facilitates the creation of an application through a compiler, debugger, software framework, etc.

[0071] In the embodiments of the present application, the SDK can include a file synchronization SDK. The file synchronization SDK can be integrated into an application program, such as a trust circle application, thereby configuring the trust circle application with the ability of file synchronization.

[0072] 5. Directory and folder

[0073] Directory and folder generally refer to the same concept, and are containers used to organize and store files and other directories / folders. In the embodiments of the present application, the two words will be used interchangeably in different application scenarios, but they represent the same meaning and function.

[0074] 6. Water level synchronization

[0075] Water level synchronization is a concept in the field of real-time data processing, which is used to ensure the consistency and integrity of data in a distributed system. In the embodiments of the present application, water level synchronization is used to ensure the consistency and integrity of files in different electronic devices and different operating systems.

[0076] 7. Incremental synchronization

[0077] Incremental synchronization is a file synchronization technology, which focuses on synchronizing only the files that have changed since the last file synchronization.

[0078] The above is a brief introduction to the terms involved in the embodiments of the present application, which will not be repeated hereinafter.

[0079] The electronic devices in the trust ring form a local area network through near field communication, and data synchronization can be performed through the local area network. For example, file synchronization can be performed between the electronic devices in the trust ring.

[0080] Please refer to Figure 1 , Figure 1 a system architecture diagram suitable for the file synchronization method shown in the embodiments of the present application. As shown in Figure 1 , the electronic device 100, the electronic device 200 and the electronic device 300 establish a trust relationship through trusted authentication, and form a trust ring. It should be understood that the number of electronic devices included in the trust ring can also be more or less than the number of electronic devices shown in Figure 1 , and the actual demand is for reference, and no limitation is made thereto.

[0081] In the embodiments of the present application, the electronic device 100, the electronic device 200 and the electronic device 300 can be mutually the master device and the trusted electronic device.

[0082] Taking the electronic device 100 as a mobile phone, the electronic device 200 as a tablet computer, and the electronic device 300 as a notebook computer as an example for description. For example, when the mobile phone initiates a synchronization request to the tablet computer and the notebook computer, and applies to synchronize the files in the mobile phone to the tablet computer and the notebook computer, the mobile phone is the master device, and the tablet computer and the notebook computer are the trusted electronic devices. For another example, when the mobile phone and the tablet computer initiate a synchronization request to the notebook computer, and apply to synchronize the files in the mobile phone and the tablet computer to the notebook computer, the mobile phone and the tablet computer are the master devices, and the notebook computer is the trusted electronic device. Herein, only exemplary description is made, and no limitation is made thereto.

[0083] Please refer to Figure 2 , Figure 2This is a schematic diagram of another system architecture applicable to the file synchronization method illustrated in the embodiments of this application. For example... Figure 2 As shown, electronic devices 100, 200, and 400 establish a trust relationship through trusted authentication, forming a trust ring. Figure 1 The trust loop shown is different, Figure 2 The trust ring shown includes an electronic device 400, which can be a NAS (Network Attached Storage). In this embodiment, a mobile phone and / or tablet computer initiates a synchronization request to the NAS, requesting the synchronization of files from the mobile phone and / or tablet computer to the NAS. The NAS can also perform cross-device file access; for example, the NAS can transfer and share files to and from the mobile phone and / or tablet computer, and can also access files on the mobile phone and / or tablet computer.

[0084] The following description, with reference to the accompanying diagram, illustrates an application scenario of data synchronization between electronic devices within a trust ring.

[0085] The trust ring provided in this application embodiment may include a mobile phone and a NAS. Taking the synchronization of files from the mobile phone to the NAS as an example, the following explanation will be provided.

[0086] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating an application scenario of file synchronization, as shown in an embodiment of this application.

[0087] For example, open the Settings app on your phone, select the "System & updates" option in the Settings app's display, and your phone will display as follows: Figure 3 The interface shown in (a) is shown. Click... Figure 3 Control 101 in the interface shown in (a) is used when the "Backup and Restore" option is clicked. The phone then displays the following: Figure 3 The interface shown in (b) is shown in the middle.

[0088] exist Figure 3 The interface shown in (b) displays various data backup and recovery methods, such as cloud backup, external storage, and phone assistant. Cloud backup can be used to back up the entire phone's data to a cloud server, and if necessary, it can also restore the entire phone's data stored on the cloud server back to the phone. The entire phone's data can include gallery, contacts, SMS messages, call logs, memos, input method, call blocking, Wi-Fi settings, contextual intelligence, phone manager, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat history, browsing history, etc.

[0089] External storage is used to connect external storage devices for backup and recovery of data. External storage devices can include external memory cards, Universal Serial Bus (USB) storage devices, NAS, etc.

[0090] The mobile assistant is used to connect to a computer to back up and restore data.

[0091] In this embodiment, files on the mobile phone are backed up to a NAS via external storage. It's worth noting that synchronization is also a backup method, and this application also refers to synchronizing files on the mobile phone to a NAS. Furthermore, it's important to clarify that "files" and "data" in this application refer to the same content; that is, files on the mobile phone can include gallery, contacts, SMS messages, call logs, memos, input method, call blocking, wireless local area networks (WLAN) settings, contextual intelligence, phone manager, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat history, browsing history, etc.

[0092] Please see Figure 4 and Figure 5 , Figure 4 This is a schematic diagram illustrating backup data based on external storage, as shown in an embodiment of this application. Figure 5 This is a schematic diagram illustrating the data backup process in an embodiment of this application.

[0093] For example, click Figure 3 Control 102 in the interface shown in (b) indicates that clicking the "External Storage" option will display the following on the phone: Figure 4 The interface shown in (a) is shown in the image. Figure 4 The interface shown in (a) displays identification information for various external storage devices, such as external memory cards, USB storage, and shared folders. Specifically, the external memory card is used to back up data from the phone to the external memory card when it is detected; the USB storage is used to back up data from the phone to the USB drive when connected to a USB device; and the shared folder is used to back up data from the phone to the home NAS device when a shared folder on the same network is detected.

[0094] This example uses a shared folder to back up data from the phone to the NAS. For example, click... Figure 4 Control 103 in the interface shown in (a) is the option to click the "Shared Folder" option. The phone displays the following: Figure 4The interface shown in (b) is as follows. At this time, the mobile phone discovers NAS storage devices on the same network through WLAN scanning, or the mobile phone discovers NAS storage devices in the trust ring. After the NAS storage device appears, the user can click to access and add shared folders under the NAS storage device.

[0095] For example, click Figure 4 Control 104 in the interface shown in (c) is used when the "Device Name" option is clicked; the phone then displays the following... Figure 5 The interface shown in (a) is shown in the image. Figure 5 The interface shown in (a) displays the device name of the NAS storage device, the used storage space of the NAS storage device (1.58TB used) and the total storage space (e.g., 3.92TB).

[0096] exist Figure 5 The interface shown in (a) also displays an automatic backup control 105, a toggle control 106, and a backup data item selection control 107. The toggle control 106 is used to enable or disable the automatic backup function. Figure 5 The image in (a) shows a scenario where the automatic backup function is enabled.

[0097] For example, with the automatic backup function enabled, users can set the automatic backup cycle according to their needs. For instance, they can set the automatic backup every day when the phone screen is off, or every seven days when the phone screen is off.

[0098] The select backup data item control 107 is used by the user to select the data items that need to be backed up. For example, clicking... Figure 5 In the interface shown in (a), the control 107 for selecting backup data items, i.e., clicking the "Automatically back up data items" option, will display the following on the phone: Figure 5 The interface shown in (b) is shown in the middle.

[0099] exist Figure 5 The interface shown in (b) displays the Select All control 108 and the Start Backup control 109. Checking the Select All control 108 allows you to select all data items to be backed up with a single click, such as selecting... Figure 5 The data items shown in (b) include music, pictures, videos, contacts, documents, system settings, etc. It should be understood that this is merely an illustrative example, and users can select one or more data items they wish to back up according to their own needs.

[0100] After selecting the data items to be backed up, click Figure 5 In the interface shown in (b), the Start Backup control 109, i.e., clicking the "Start Backup" option, will display the following on the phone: Figure 5The interface shown in (c). The mobile phone performs data preparation processing, such as calculating the number of items and the data size of each data item to be backed up, and displaying the data in a list as shown in (d). Figure 5 When the data preparation is completed, the mobile phone starts backing up the data, that is, backing up the data items selected by the user in the mobile phone to the NAS, or synchronizing each file selected by the user in the mobile phone to the NAS.

[0101] In the embodiments of the present application, the distributed management service is used to manage each electronic device in the trust circle, so that the data can be stored and accessed between different electronic devices (such as mobile phones, tablet computers, notebook computers, NAS, etc.), different operating systems (such as Android system, IOS operating system, Symbian operating system, Black Berry operating system, Linux operating system, Windows operating system, etc.), realizing cross-device and cross-system data storage and access, and opening up the data access channel of near field communication between electronic devices.

[0102] The application scenarios of file synchronization in combination with user operations are described above, and the specific process of file synchronization between electronic devices in the trust circle is described below in combination with the drawings.

[0103] The trust circle provided in the embodiments of the present application can include a mobile phone and a personal computer (PC), and the PC can include a desktop computer, a notebook computer, a small notebook computer, a tablet computer, and an ultrabook, etc. Taking the example of synchronizing files in the mobile phone to the tablet computer, the process is described.

[0104] Please refer to Figure 6 , Figure 6 The process of file synchronization shown in the embodiments of the present application is shown in a process diagram.

[0105] In S101, the trust circle application acquires a file synchronization request and calls a file synchronization SDK.

[0106] The trust circle application represents an application program in the electronic device in the trust circle. The user can set to start file backup, file synchronization, etc. through the trust circle application, or close file backup, file synchronization, etc.

[0107] In the embodiments of the present application, the trust circle application can include a file management application, a setting application, a near field transmission application, a gallery application, a third-party file synchronization application, a multimedia application, a social application, a network application, an education application, etc.

[0108] The file synchronization SDK is pre-integrated in the trust circle application, so as to facilitate the trust circle application to create a shared directory / shared folder by calling the file synchronization SDK.

[0109] The file synchronization request is used to request to synchronize a file in the electronic device where the trust circle application belongs to, to at least one trusted electronic device included in the trust circle. For example, the electronic device where the trust circle application belongs to is a mobile phone, and the trusted electronic device included in the trust circle is a tablet computer, and the file synchronization request is used to request to synchronize the file in the mobile phone to the tablet computer.

[0110] The file synchronization request can be triggered by the electronic device where the trust circle application belongs to, or triggered by the trusted electronic device. For example, the trust circle application installed on the mobile phone receives an operation of setting to turn on the file synchronization function by the user, and triggers the file synchronization request. Alternatively, the trusted electronic device initiates the file synchronization request to the electronic device where the trust circle application belongs to, and the electronic device where the trust circle application belongs to receives the file synchronization request. For example, the tablet computer initiates the file synchronization request to the mobile phone, and the mobile phone receives the file synchronization request.

[0111] For example, when the trust circle application obtains the file synchronization request, the code pre-written in the trust circle application is used to call the file synchronization SDK.

[0112] S102, the file synchronization SDK calls the file synchronization service module to create a shared directory / shared folder.

[0113] For example, the file synchronization service module is deployed in the application program framework layer, and is a software component specially designed in the application to synchronize files between different electronic devices and different operating systems.

[0114] In the embodiment of the application, the shared directory can be represented by a REPO directory, and the electronic devices in the trust circle can share the REPO directory. The REPO directory can include file path, scanning start time, scanning time interval, REPO identification information, electronic device name, file synchronization configuration information, callback function of file path, and the like.

[0115] The file path refers to the path of the file to be synchronized, i.e., the path of the file that needs to be synchronized to the trusted electronic device. For example, the user wants to synchronize the pictures on the mobile phone to the tablet computer, selects the path corresponding to the gallery on the mobile phone, or in other words, selects the directory corresponding to the gallery on the mobile phone, and the selected path or the selected directory is the file path.

[0116] The scanning start time is the time when the electronic device starts to scan the file path. Generally, the time when the electronic device starts to scan the file path for the first time is determined according to the time when the user sets to turn on the file synchronization function for the first time. For example, when the user sets to turn on the file synchronization function for the first time, the user selects to start to synchronize the file immediately, and then the electronic device starts to scan the file path immediately, i.e., the scanning start time is the time when the user turns on the file synchronization function.

[0117] The time when the electronic device starts to scan the file path for the first time is determined according to the file synchronization period set by the user, that is, determined according to the scanning time interval. For example, the user sets to automatically synchronize files once every day or once every seven days, and the like, and then the electronic device scans the file path once every day or once every seven days after scanning the file path for the first time.

[0118] The REPO identification information is an identifier (ID) of the REPO, and is used to uniquely identify the REPO of the electronic device.

[0119] The file synchronization configuration information can include the file synchronization times, the file synchronization version, the name of the trusted electronic device, the REPO identification information of the trusted electronic device, the file path of the trusted electronic device, and the filtered file, and the like.

[0120] The file synchronization version is used to indicate that the synchronized file has been changed. For example, when the file synchronization is performed for the first time, the file synchronization version is recorded as 1.0; when the file synchronization is performed for the second time, if the file has been changed, the file synchronization version is recorded as 1.1; when the file synchronization is performed for the third time, if the file has been changed, the file synchronization version is recorded as 1.2, and the like.

[0121] The REPO identification information of the trusted electronic device is an ID of the REPO of the trusted electronic device, and is used to uniquely identify the REPO of the trusted electronic device. For example, when the REPO identification information of the mobile phone matches the REPO identification information of the tablet computer, the mobile phone and the tablet computer can perform file synchronization.

[0122] The file path of the trusted electronic device refers to a path for storing the file to be synchronized, that is, a path for storing the file synchronized from the electronic device. For example, the user wants to synchronize the picture on the mobile phone to a specified path in the tablet computer, and the specified path is the file path of the trusted electronic device.

[0123] The filtered file refers to a file that is not synchronized. In the embodiments of the present application, the filtered file can not be scanned, which can reduce the power consumption of the electronic device, effectively reduce the time for scanning the file in the file synchronization process, and improve the file synchronization efficiency.

[0124] For example, the file synchronization SDK calls the file synchronization service module, and the file synchronization service module creates a shared directory / shared folder by using the application programming interface (API) function or method provided by the file synchronization SDK, for example, creates a REPO directory.

[0125] S103, the file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0126] Data persistence processing refers to long-term storage of data on a persistent storage medium, so that the data can still be accessed after the application or operating system is restarted.

[0127] In the embodiments of the present application, the REPO directory can be stored in the local database of the persistent mobile phone. In this way, after the user sets the file synchronization function, even if the mobile phone is restarted or the trusted ring application is restarted, the relevant information of the file synchronization function set by the user can be read from the local database, ensuring that the relevant information of the REPO directory is not lost. For the user, only the relevant information of the file synchronization function needs to be set once, and it can be applied all the time, without the need to set the relevant information of the file synchronization function again after the mobile phone is restarted or the trusted ring application is restarted, improving the user experience.

[0128] The above steps S101 to S103 describe the scenario in which the electronic device (such as a mobile phone) creates a shared directory / shared folder, such as the REPO directory, after obtaining a file synchronization request. In a possible implementation manner, the electronic device (such as a mobile phone) can also pre-create a shared directory / shared folder, such as pre-creating the REPO directory, that is, the electronic device (such as a mobile phone) creates the REPO directory before obtaining the file synchronization request. For example, the trusted ring application calls the file synchronization SDK, the file synchronization SDK calls the file synchronization service module to create the REPO directory, and the file synchronization service module performs data persistence processing on the REPO directory.

[0129] This way of pre-creating the REPO directory in the electronic device is beneficial to subsequent file synchronization of the electronic device in the trusted ring using the REPO directory directly, improving the efficiency of file synchronization.

[0130] Optionally, in a possible implementation manner, the trusted electronic device can create a shared directory / shared folder, such as the REPO directory, by using a method similar to the above steps S101 to S103. As shown in the method, the method specifically includes: Figure 6

[0131] S201, the trusted ring application in the trusted electronic device obtains a file synchronization request and calls the file synchronization SDK.

[0132] S202, the file synchronization SDK calls the file synchronization service module in the trusted electronic device to create a shared directory / shared folder.

[0133] ​S203, the file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0134] For the description of steps S201 to S203, refer to the specific description in steps S101 to S103 described above, which will not be repeated here.

[0135] The above steps S201 to S203 describe the scenario that the trusted electronic device (such as a tablet computer) creates a shared directory / shared folder, such as a REPO directory, when obtaining a file synchronization request. In one possible implementation, the trusted electronic device (such as a tablet computer) can also pre-create a shared directory / shared folder, such as a REPO directory, that is, the trusted electronic device (such as a tablet computer) creates a REPO directory before obtaining a file synchronization request.

[0136] This way of pre-creating a REPO directory in a trusted electronic device is beneficial for subsequent electronic devices in the trust ring to directly use the REPO directory for file synchronization, improving the efficiency of file synchronization.

[0137] S104, sharing the REPO directory with the trusted electronic device.

[0138] For example, the electronic device (such as a mobile phone) determines the to-be-synchronized file according to the file synchronization request, scans the file path in the electronic device (such as a mobile phone) based on the to-be-synchronized file, and records the file synchronization version for each scan result.

[0139] For example, the first time the electronic device (such as a mobile phone) scans the file path in the electronic device (such as a mobile phone) based on the to-be-synchronized file, the file synchronization version 1.0 is recorded for the first scan result; the second time the electronic device (such as a mobile phone) scans the file path in the electronic device (such as a mobile phone) based on the to-be-synchronized file, it is detected that the to-be-synchronized file has changed compared with the first time, and the file synchronization version 1.1 is recorded for the second scan result; the third time the electronic device (such as a mobile phone) scans the file path in the electronic device (such as a mobile phone) based on the to-be-synchronized file, it is detected that the to-be-synchronized file has not changed compared with the second time, and the file synchronization version 1.1 is recorded for the third scan result, and so on.

[0140] The electronic device (such as a mobile phone) shares each recorded file synchronization version with the trusted electronic device (such as a tablet computer). For example, the electronic device (such as a mobile phone) records each recorded file synchronization version in the REPO directory and shares it with the trusted electronic device (such as a tablet computer), and the trusted electronic device (such as a tablet computer) can read the change of the file synchronization version from the REPO directory, thereby quickly determining the change of the synchronized file.

[0141] S105, synchronizing REPO directory metadata with the trusted electronic device.

[0142] Metadata is used to describe data attributes, and REPO directory metadata refers to file paths, scanning start time, scanning time interval, REPO identification information, electronic device name, file synchronization configuration information and other information included in the REPO directory.

[0143] REPO directory metadata synchronization can be understood as that the electronic device (such as a mobile phone) and the trusted electronic device (such as a tablet computer) synchronize the water level based on the REPO directory. For example, the electronic device (such as a mobile phone) synchronizes the file paths, scanning start time, scanning time interval, REPO identification information, electronic device name, file synchronization configuration information and other information included in the REPO directory with the trusted electronic device (such as a tablet computer), which provides guarantee for the consistency and integrity of subsequent files in different electronic devices and different operating systems.

[0144] S106, the file synchronization service module listens to the file system.

[0145] The file synchronization service module can include a listening and scanning management module for listening to and scanning the file system in the electronic device (such as a mobile phone).

[0146] Illustratively, the mobile phone determines the to-be-synchronized file according to the file synchronization request and listens to and scans the file path of the to-be-synchronized file in the file system. For example, the user wants to synchronize the pictures on the mobile phone to the tablet computer, and listens to and scans the path corresponding to the gallery on the mobile phone.

[0147] When the to-be-synchronized file changes, such as addition, deletion or modification, the change is notified to the file synchronization service module.

[0148] For example, the to-be-synchronized file is a picture, and any application related to the picture finds a change, which will affect the to-be-synchronized file. For example, the camera application, social application, sharing application and the like add, and / or delete, and / or modify the picture, and the corresponding change is notified to the file synchronization service module.

[0149] The file synchronization service module generates a file change record according to the change of the file, and performs data persistence processing on the file change record. The file change record can include addition, deletion, modification and other operations on the file, as well as the operation time corresponding to each operation.

[0150] Exemplarily, the file change record is stored into a local database of the persistent phone, so that the file change record can be read from the local database even if the phone is restarted, or the trust ring application is restarted, or any application related to the file to be synchronized is restarted.

[0151] S107, the file synchronization service module reads the file change record from the local database.

[0152] Exemplarily, the file synchronization service module reads the file change record from the local database periodically according to a file synchronization period set by the user. For example, the file synchronization service module reads the file change record from the local database once every time the electronic device listens to and scans the file system.

[0153] S108, file metadata synchronization processing is performed with the trusted electronic device.

[0154] The file metadata refers to the file name, the electronic device to which the file belongs, the file size, the file addition time, the file deletion time, the file modification time, and the like.

[0155] The file metadata synchronization can be understood as that the electronic device (such as a phone) synchronizes the file metadata with the trusted electronic device (such as a tablet). In this implementation manner, the file metadata is synchronized with the trusted electronic device first, and the file content can be directly synchronized subsequently, which improves the file synchronization efficiency and is less prone to errors.

[0156] It should be understood that, after the electronic device sends the file metadata to the trusted electronic device, the trusted electronic device needs to compare the file metadata sent by the electronic device with the file metadata of the trusted electronic device. For example, Figure 6 The comparison method specifically includes:

[0157] S204, the trusted electronic device performs file metadata comparison processing.

[0158] The comparison processing is a data analysis technology for identifying the differences and similarities between the file metadata sent by the electronic device and the file metadata of the trusted electronic device.

[0159] For example, the tablet uses the file synchronization service module to compare the file metadata in the file system of the tablet with the file metadata sent by the phone one by one. If the comparison result is consistent, the file metadata recorded in the tablet is maintained; if the comparison result is inconsistent, the file metadata sent by the phone is used as the criterion, that is, the file metadata in the tablet is modified to the file metadata sent by the phone.

[0160] In this implementation, the file metadata in the electronic device is first synchronized with the file metadata in the trusted electronic device, and then the file content can be directly synchronized, thereby improving the file synchronization efficiency and reducing errors.

[0161] Optionally, in a possible implementation, after the trusted electronic device performs the file metadata comparison process, the file metadata sent by the electronic device is subjected to data persistence processing. For example, the modified file metadata is stored in a local database.

[0162] S109, performing file content synchronization processing with the trusted electronic device.

[0163] The file content refers to the file itself. For example, if the file to be synchronized is a picture, the file content is the picture itself; if the file to be synchronized is music, the file content is the audio itself.

[0164] For example, the file synchronization service module in the electronic device reads the file content from the file system and sends the read file content to the trusted electronic device. Correspondingly, the trusted electronic device needs to save the file content sent by the electronic device. As shown in Figure 6 the saving method specifically includes:

[0165] S205, the trusted electronic device performs file landing processing on the file content.

[0166] File landing generally refers to writing data from a temporary storage area to a permanent storage device. In the embodiment of the present application, the trusted electronic device saves the file content sent by the electronic device to the local database of the trusted electronic device. Optionally, in a possible implementation, the trusted electronic device saves the file content sent by the electronic device to the file system, and then saves the file content in the file system to the local database. In this way, even if the trusted electronic device is restarted or the trust ring application is restarted, the synchronized file will not be affected and the synchronized file can still be read from the local database.

[0167] It should be noted that, when the above describes the specific process of file synchronization between electronic devices in the trust ring, the process is described by taking the example of synchronizing files in a mobile phone to a tablet computer, and therefore the method mainly executed by the mobile phone is described. It can be understood that, when files in the tablet computer need to be synchronized to the mobile phone, the tablet computer can execute the steps executed by the mobile phone, and the mobile phone can execute the steps executed by the tablet computer.

[0168] It can be understood that, in the embodiments of the present application, although the Android operating system is taken as an example for description, the basic principles are also applicable to electronic devices based on IOS, Symbian, Black Berry, Linux, Windows and other operating systems.

[0169] In the embodiments of the present application, the file synchronization SDK integrated in the trust circle application configures the file synchronization capability for the trust circle application, and the file synchronization service module provides the core service for the file synchronization between the electronic devices in the trust circle. Exemplarily, the file synchronization service module completes the perception of file changes and the generation of file metadata by listening to and scanning the local file system. Meanwhile, the trust circle self-discovery and ad hoc networking capability provided by the system can enable the electronic device to quickly discover the surrounding devices, and enable the electronic device to share the REPO directory, synchronize the REPO metadata, synchronize the file metadata and synchronize the file content with the trusted electronic devices in the trust circle, thereby realizing the cross-device and cross-system data storage and access, and opening up the data access channel of the near field communication between the electronic devices.

[0170] In the related art, when the electronic devices in the trust circle synchronize files, the synchronized files are not checked, which may cause the synchronized files to be inconsistent with the source files, and affect the integrity of the file synchronization. If the synchronized files are tampered with, it will also bring security risks to the electronic devices in the trust circle, and cause the entire file synchronization process to be insecure and prone to errors.

[0171] For example, the pictures in the trusted electronic device are synchronized to the electronic device. Considering that the electronic device and the trusted electronic device are in the same trust circle, the environment of the file synchronization is safe and trusted by default, and therefore the synchronized pictures are not checked. The trusted electronic device directly sends the pictures to the electronic device, and the electronic device stores the pictures in the file system after receiving the pictures. This may cause the pictures synchronized by the electronic device to be inconsistent with the pictures in the trusted electronic device, and affect the integrity of the file synchronization. If the synchronized pictures are tampered with, it may cause the systems of the electronic device and the trusted electronic device to be attacked by malicious software or viruses. If an error occurs in the synchronization process, it will also cause the synchronized pictures to be damaged, lost, etc. It can be seen that the file synchronization process in the related art is not secure and is prone to errors.

[0172] Therefore, the embodiments of the present application provide a file synchronization method applied to an electronic device, and a trust circle in which the electronic device is located also includes at least one trusted electronic device. The method includes: obtaining a to-be-synchronized file sent by at least one trusted electronic device; generating a temporary synchronization file according to the to-be-synchronized file; checking the temporary synchronization file; and when the temporary synchronization file passes the check, synchronizing the temporary synchronization file to a file system.

[0173] In this implementation, when the to-be-synchronized file sent by the trusted electronic device is acquired, the to-be-synchronized file is not directly stored in the file system, but a temporary synchronization file is generated according to the to-be-synchronized file, the temporary synchronization file is checked, and when the temporary synchronization file passes the check, the temporary synchronization file is synchronized to the file system. Since the temporary synchronization file is checked, it can be ensured that the file received by the electronic device is consistent with the source file, ensuring the integrity of file synchronization and improving the accuracy of file synchronization. Checking the temporary synchronization file can also ensure that the synchronized file is not tampered with, avoid the system of the electronic device in the trust ring from being attacked by malicious software or viruses, and improve the security of the file synchronization process.

[0174] The file synchronization method provided by the embodiments of the present application will be described below in combination with a flowchart.

[0175] Please refer to Figure 7 , Figure 7 A flowchart of a file synchronization method according to an embodiment of the present application is shown. The method comprises:

[0176] S301, acquiring a to-be-synchronized file sent by at least one trusted electronic device.

[0177] Two or more electronic devices establish a trust relationship through trusted authentication, forming a trust ring. In the embodiments of the present application, the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the files in the electronic device can be synchronized to the trusted electronic devices in the trust ring.

[0178] In one example, the trusted electronic device triggers a file synchronization request, which is used to indicate that the trusted electronic device sends a to-be-synchronized file (i.e., a file that wants to be synchronized) to the electronic device, and the electronic device receives the to-be-synchronized file sent by the trusted electronic device. For example, a user wants to synchronize pictures on a trusted electronic device (such as a mobile phone) to an electronic device (such as a tablet computer), selects the pictures in the gallery through the trust ring application installed on the mobile phone, selects the "start synchronization" option, triggers the file synchronization request, and the mobile phone sends the selected pictures to the tablet computer, and the tablet computer receives the pictures sent by the mobile phone. Among them, the pictures are to-be-synchronized files.

[0179] In another example, the electronic device triggers a file synchronization request, the file synchronization request being used to request the trusted electronic device to send the to-be-synchronized file to the electronic device, and the electronic device receives the to-be-synchronized file sent by the trusted electronic device. For example, a user wants to synchronize pictures on a trusted electronic device (e.g., a mobile phone) to an electronic device (e.g., a tablet computer), and the tablet computer initiates a file synchronization request to the mobile phone, the file synchronization request carrying indication information of the pictures to be synchronized. The mobile phone receives the file synchronization request and sends the pictures to the tablet computer according to the indication information of the pictures, and the tablet computer receives the pictures sent by the mobile phone.

[0180] It can be understood that when the user selects the pictures in the gallery, the user can also specify the storage location of the tablet computer where the pictures are stored.

[0181] Optionally, in a possible implementation, the file synchronization request can be triggered automatically by the trusted electronic device. For example, the user sets to automatically synchronize files every day or every seven days, and the mobile phone automatically triggers a file synchronization request every day after the first synchronization. For another example, the user sets to automatically synchronize files after the time reaches a preset time point (e.g., 8:00, 12:00, 23:00, etc.), and the mobile phone automatically triggers a file synchronization request when it is detected that the current time reaches the preset time point. This is only an example and is not limited thereto.

[0182] Optionally, in another possible implementation, the electronic device in the trust circle can also automatically trigger a file synchronization request and send the file synchronization request to the trusted electronic device after each triggering. For details, refer to the related description of the electronic device, which will not be described herein again.

[0183] S302, generating a temporary synchronization file according to the to-be-synchronized file.

[0184] The to-be-synchronized file is a file that is intended to be synchronized. In the embodiments of the present application, the to-be-synchronized file can be a file sent by the trusted electronic device to the electronic device for synchronization. For example, a user wants to synchronize pictures on a trusted electronic device (e.g., a mobile phone) to an electronic device (e.g., a tablet computer), and the mobile phone sends the pictures to the tablet computer, and the pictures sent by the mobile phone to the tablet computer are the to-be-synchronized file.

[0185] In a possible implementation, the temporary synchronization file is generated directly according to the to-be-synchronized file. For example, a full-synchronization manner is used to generate the temporary synchronization file according to the to-be-synchronized file. For example, a temporary storage location is created, the to-be-synchronized file is copied to the temporary storage location, and the to-be-synchronized file stored in the temporary storage location is determined as the temporary synchronization file. The temporary storage location can include a REPO directory.

[0186] In another possible implementation manner, a local file corresponding to the to-be-synchronized file is acquired in a file system of the electronic device, and a temporary synchronization file is generated according to the local file and the to-be-synchronized file.

[0187] The local file refers to a file stored in a designated storage location of the electronic device before the to-be-synchronized file is synchronized. The designated storage location is used to store the to-be-synchronized file. It can be understood that the storage location of the local file in the electronic device is consistent with the storage location of the to-be-synchronized file in the electronic device.

[0188] For example, when the user selects the to-be-synchronized file (such as a picture in a gallery) on the mobile phone, the storage location of the picture in the tablet computer is designated as the D disk, and the file stored in the D disk before the to-be-synchronized file is synchronized is the local file.

[0189] S303, verifying the temporary synchronization file.

[0190] For example, verifying the temporary synchronization file can include verifying the integrity of the temporary synchronization file, verifying the consistency of the temporary synchronization file and the source file, verifying whether the function of the temporary synchronization file is normal, and the like.

[0191] Verifying the integrity of the temporary synchronization file and verifying the consistency of the temporary synchronization file and the source file can ensure that the to-be-synchronized file is not damaged or changed in the transmission process, and can improve the security of the file synchronization process.

[0192] In the embodiments of the present application, the integrity of the temporary synchronization file and the consistency of the temporary synchronization file and the source file can be verified by means of hash verification, file checksum, digital signature, file content comparison, and the like.

[0193] In the embodiments of the present application, hash verification is taken as an example for description. For example, the source file corresponding to the temporary synchronization file is acquired, the hash value of the temporary synchronization file and the hash value of the source file are calculated, and whether the hash value of the temporary synchronization file is consistent with the hash value of the source file is compared. When the hash value of the temporary synchronization file is consistent with the hash value of the source file, it is determined that the temporary synchronization file is complete, that is, the integrity of the temporary synchronization file is not a problem, and it is also determined that the consistency of the temporary synchronization file and the source file is verified.

[0194] For example, the hash value of the temporary synchronization file and the hash value of the source file can be calculated by means of MD5 (Message Digest Algorithm 5) algorithm, SHA-1 (Secure Hash Algorithm 1) algorithm, SHA-2 (Secure Hash Algorithm 2) algorithm, and the like.

[0195] Optionally, the integrity of the temporary synchronization file can also be checked by a verification tool (such as md5sum, sha1sum, sha256sum, etc.).

[0196] The file checksum is a method similar to the hash check. In the embodiments of the present application, the checksum of the temporary synchronization file can be calculated by a command line tool (such as the cksum command), and the integrity of the temporary synchronization file and the consistency between the temporary synchronization file and the source file are checked by the checksum.

[0197] Optionally, when the temporary synchronization file is a compressed file, the integrity of the compressed file can be verified by using a decompression tool corresponding to the compression tool. It can be understood that the decompression work will check the file when decompressing, and if the temporary synchronization file is damaged or incomplete, the decompression process will fail.

[0198] Optionally, when the temporary synchronization file is a text file or a data file, the file content comparison can be directly performed to check whether the content of the source file and the temporary synchronization file is completely the same. For example, a script (such as a Python script, a PowerShell script) is used to automatically check whether the file list and the number of files in the temporary synchronization file are consistent with the file list and the number of files in the source file. When the file list and the number of files in the temporary synchronization file are consistent with the file list and the number of files in the source file, it is determined that the integrity of the temporary synchronization file is not a problem, and it is determined that the consistency between the temporary synchronization file and the source file is checked.

[0199] Optionally, when the temporary synchronization file is a binary file, the file content comparison can be performed by using a file comparison tool (such as a diff tool) to check whether the content of the source file and the temporary synchronization file is completely the same.

[0200] Checking whether the function of the temporary synchronization file is normal can ensure that the temporary synchronization file can still work normally after synchronization, and improve the stability of file synchronization. Exemplarily, when the temporary synchronization file is an executable file or an application file, the functional test is performed on the temporary synchronization file. For example, the temporary synchronization file is run, and the running output result is checked; the temporary synchronization file is opened, and it is checked whether the file content is correctly displayed, etc.

[0201] S304, when the temporary synchronization file passes the check, the temporary synchronization file is synchronized to the file system.

[0202] Exemplarily, when the temporary synchronization file passes the check, the temporary synchronization file is copied to a specified storage location in the file system by using a preset copy command or copy tool.

[0203] In this implementation, the temporary synchronization file is copied to a designated storage location in the file system, and the temporary synchronization file can also be temporarily retained in a temporary storage location. When a write error or system failure occurs in the designated storage location, the temporary synchronization file in the temporary storage location can be used as a backup file to restore the file when needed. If an error is found in the file synchronization process, the temporary synchronization file in the temporary storage location can be used to verify and correct the error, ensuring that the finally synchronized file is accurate.

[0204] Optionally, when the temporary synchronization file passes the verification, the temporary synchronization file is moved to the designated storage location in the file system using a preset moving command or moving tool.

[0205] In this implementation, the temporary synchronization file is moved to the designated storage location in the file system, and the temporary storage space is released in time, facilitating the system to continue to perform other file synchronization tasks or store new files, and improving the efficiency of file synchronization.

[0206] The file synchronization method provided by the embodiments of the present application, when the trusted electronic device sends the to-be-synchronized file, does not directly store the to-be-synchronized file in the file system, but generates a temporary synchronization file according to the to-be-synchronized file, verifies the temporary synchronization file, and synchronizes the temporary synchronization file to the file system when the temporary synchronization file passes the verification. Since the temporary synchronization file is verified, it can be ensured that the file received by the electronic device is consistent with the source file, ensuring the integrity and consistency of file synchronization, making the finally synchronized file accurate and correct, and improving the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively avoiding the system of the electronic device in the trust ring from being attacked by malicious software or viruses, and improving the security of the file synchronization process.

[0207] Optionally, in a possible implementation, the step S302 of generating the temporary synchronization file according to the local file and the to-be-synchronized file can further include: performing incremental synchronization on the local file and the to-be-synchronized file to generate the temporary synchronization file.

[0208] For example, by comparing the differences between the local file and the to-be-synchronized file, the file that has changed since the last synchronization is determined, the temporary synchronization file is generated according to the changed file, and the temporary synchronization file is stored in the temporary storage location. Alternatively, the changed file is moved or copied to the temporary storage location, and the changed file is recorded as the temporary synchronization file. Then, the temporary synchronization file is moved or copied from the temporary storage location to the designated storage location in the file system, and the synchronization is completed.

[0209] For example, the data blocks corresponding to the local file and the data blocks corresponding to the file to be synchronized are obtained. The data blocks of the local file and the data blocks of the file to be synchronized are compared one by one to find out where they are different. The data blocks that are different are the data blocks corresponding to the changed file. The data blocks corresponding to the temporary synchronization file are generated according to the different data blocks, and the data blocks corresponding to the temporary synchronization file are stored in the temporary storage location. Then, the data blocks of the temporary synchronization file are moved or copied from the temporary storage location to the specified storage location in the file system, and the synchronization is completed.

[0210] Optionally, in order to improve the speed of comparing the local file and the file to be synchronized, thereby improving the speed of generating the temporary synchronization file, and further improving the efficiency of file synchronization, the local metadata of the local file and the metadata of the file to be synchronized can be compared.

[0211] For example, the local metadata of the local file and the source metadata of the file to be synchronized are obtained. The differences between the local metadata and the source metadata are compared one by one. The local metadata is used to describe the name, file size, file creation time, file last modification time, file last access time, file type, file permission (such as read-write permission, write permission, execution permission, etc.), file owner, file attribute flag (such as specific flag bit, used to indicate that the file belongs to hidden file, or system file, or read-only file, etc.), file system information, file version, file extension attribute (such as custom label), relative path, etc. of the local file. It should be understood that the source metadata is similar to the local metadata, and the difference is that the source metadata is used to describe the file to be synchronized, and the local metadata is used to describe the local file.

[0212] For ease of understanding, please refer to Figure 8 , Figure 8 An incremental synchronization diagram is shown in the embodiments of the present application.

[0213] As Figure 8 shown, the source metadata includes data block 1, data block 2, data block 3, data block 4, data block 5, data block 6, the new file includes data block 1, data block 2, changed data block 1, data block 3, changed data block 2, data block 5, changed data block 6, and the local metadata includes data block 1, data block 2, data block 3, data block 4, data block 5.

[0214] For example, the first data block of the local metadata and the source metadata is compared first, that is, the data block 1 of the local metadata and the data block 1 of the source metadata are compared. The comparison result is that the data block 1 of the local metadata is consistent with the data block 1 of the source metadata. That is, the file indicated by the data block 1 of the source metadata has not changed compared with the file indicated by the data block 1 of the local metadata.

[0215] The other data blocks of the local metadata and the source metadata are compared sequentially. Data block 2 of the source metadata is identical to data block 2 of the local metadata. However, compared to data block 3 of the local metadata, data block 3 of the source metadata has an additional element preceding it, such as... Figure 8 The changed data block 1 in the new file is shown, and correspondingly, the position of data block 3 of the source metadata is shifted backward. Figure 8 Data 3 shown is the offset local metadata data block 3. Compared to local metadata data block 4, source metadata data block 4 has had local metadata data block 4 deleted and new data blocks such as... Figure 8 The changed data block 2 in the new file is shown. Compared to the local metadata data block 5, the source metadata data block 5 is shifted to the right due to the addition of the changed data block 2. Figure 8 Data 5 shown is data block 5 of the offset local metadata. Compared with the local metadata, the source metadata also includes data such as... Figure 8 The changed data block 3 in the new file shown.

[0216] like Figure 8 As shown, the new file displays the differences between the source metadata and the local metadata, which is equivalent to identifying the files that have changed since the last synchronization. Based on the changed files, a temporary synchronization file can be generated and stored in a temporary storage location, so that the temporary synchronization file can be synchronized to the file system of the electronic device later.

[0217] This incremental synchronization method for multi-device file synchronization effectively reduces the amount of data transferred, saving bandwidth. Furthermore, the reduced data transfer speeds up the file synchronization process, improving overall data synchronization efficiency. Simultaneously, since electronic devices only need to process the changed files, the load on the file synchronization process is effectively reduced, lowering the power consumption of the electronic devices.

[0218] Alternatively, in one possible implementation, Figure 8 The corresponding implementation can also be carried out in a trusted electronic device. For example, the trusted electronic device compares the metadata of the current file, i.e., the source metadata, with the metadata of the file at the time of the last synchronization. By identifying the differences between the two, the trusted electronic device can determine the files that have changed since the last synchronization. Based on the changed files, a file to be synchronized can be generated, which can then be sent to the electronic device to achieve file synchronization.

[0219] It is worth noting that, in the implementation scenario of the electronic device, or in the implementation scenario of the trusted electronic device, when comparing the source end metadata and the local metadata, the local metadata can be taken as a reference, and each data block in the source end metadata is traversed in sequence to determine whether each data block in the source end metadata has a consistent data block in the local metadata. If not, it is determined as a change data block. Alternatively, the source end metadata is taken as a reference, and each data block in the local metadata is traversed in sequence to determine whether each data block in the local metadata has a consistent data block in the source end metadata. If not, it is determined as a change data block.

[0220] Optionally, in a possible implementation, the step S303 can further include steps S3031 and S3033, which are specifically as follows.

[0221] Referring to Figure 9 , Figure 9 Another file synchronization method is shown in the flowchart of the embodiment of the present application. The method includes:

[0222] S3031, obtaining source end metadata sent by at least one trusted electronic device.

[0223] The source end metadata is used to describe the name, file size, file creation time, file last modification time, file last access time, file type, file permission (such as read-write permission, write permission, execution permission, etc.), file owner, file attribute flag (such as a specific flag bit, used to indicate that the file belongs to a hidden file, or a system file, or a read-only file, etc.), file system information, file version, file extension attribute (such as a custom tag), relative path, etc. of the file to be synchronized.

[0224] In one example, the electronic device or the trusted electronic device triggers a file synchronization request, and the trusted electronic device carries the source end metadata in the file to be synchronized sent to the electronic device. The electronic device extracts the source end metadata from the file to be synchronized.

[0225] In another example, the electronic device sends a metadata acquisition request to the trusted electronic device, the metadata acquisition request being used to trigger the trusted electronic device to send the source end metadata to the electronic device, and the electronic device receives the source end metadata sent by the trusted electronic device.

[0226] S3032, generating a check value corresponding to the temporary synchronization file and a check value corresponding to the source end metadata.

[0227] The check value of the temporary synchronization file and the check value of the source end metadata can each include a weak hash value, a strong hash value, a checksum, a Hash-based Message Authentication Code (HMAC), and the like.

[0228] Exemplarily, the hash value corresponding to the temporary synchronization file and the hash value corresponding to the source end metadata can be calculated by an MD5 (Message Digest Algorithm 5) algorithm, an SHA-1 (Secure Hash Algorithm 1) algorithm, an SHA-2 (Secure Hash Algorithm 2) algorithm, and the like.

[0229] The MD5 algorithm and the SHA-1 algorithm can be used to calculate the weak hash value corresponding to the temporary synchronization file and the weak hash value corresponding to the source end metadata.

[0230] In the embodiments of the present application, the check value of the temporary synchronization file can be represented by the check value of the metadata of the temporary synchronization file. Exemplarily, the metadata of the temporary synchronization file is acquired, and a hash function corresponding to the MD5 algorithm is determined. The metadata of the temporary synchronization file is input into the hash function, the hash function processes the metadata of the temporary synchronization file, and outputs a weak hash value of a fixed length. Similarly, the source end metadata is input into the hash function, the hash function processes the source end metadata, and outputs a weak hash value of a fixed length.

[0231] In this implementation manner, since the weak hash value is simple and efficient to calculate, the efficiency of file synchronization can be improved in the case of ensuring the safety of the file synchronization process, and the user experience is improved.

[0232] Optionally, the check value corresponding to the temporary synchronization file and the check value corresponding to the source end metadata can also be generated by a check tool (such as md5sum, sha1sum, sha256sum, and the like).

[0233] S3033, when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source end metadata, it is determined that the temporary synchronization file passes the check.

[0234] Exemplarily, when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source end metadata, it indicates that the temporary synchronization file to be synchronized by the electronic device is consistent with the source file in the trusted electronic device. It can be popularly understood that when the check value of the temporary synchronization file is consistent with the check value of the source end metadata, the file to be synchronized sent by the trusted electronic device to the electronic device is correct, and the electronic device synchronizes based on the temporary synchronization file, and the finally synchronized file is accurate.

[0235] After determining that the temporary synchronization file passes the verification, the temporary synchronization file can be moved or copied to a designated storage location in the file system.

[0236] Optionally, when the check value of the temporary synchronization file is detected to be inconsistent with the check value of the source end metadata, it indicates that the temporary synchronization file to be synchronized by the electronic device is inconsistent with the source file in the trusted electronic device, and if the file synchronization is continued, the accuracy of the file synchronization result can be affected, and therefore the file synchronization is not performed.

[0237] In this implementation manner, the consistency of the temporary synchronization file and the source file is checked, and the file is synchronized when the temporary synchronization file and the source file are consistent, so that the finally synchronized file is accurate and correct, and the accuracy of the file synchronization is improved. The temporary synchronization file is checked, and the synchronized file is ensured not to be tampered with and the synchronization process is less likely to be erroneous, so that the system of the electronic device in the trust ring is effectively prevented from being attacked by malicious software or viruses, and the security of the file synchronization process is improved.

[0238] Optionally, in a possible implementation manner, the step S304 can further include steps S3041 to S3043, and details are as follows.

[0239] Please refer to Figure 10 , Figure 10 Another file synchronization method is shown in a flowchart of an embodiment of the present application. The method includes the following steps.

[0240] S3041, deleting the local file corresponding to the temporary synchronization file in the file system.

[0241] S3042, modifying the file name of the temporary synchronization file.

[0242] S3043, storing the temporary synchronization file with the modified file name to the file system.

[0243] For example, if the temporary synchronization file is generated based on the difference between the local file and the file to be synchronized, that is, the temporary synchronization file is generated based on the file changed since the last synchronization, the temporary synchronization file is stored to the designated storage location in the file system by the incremental synchronization, that is, the changed file is stored to the designated storage location based on the local file. For example, based on the local metadata shown in Figure 8 , the added changed data block 1, changed data block 2 and changed data block 3 are added to the corresponding storage location of the local metadata, and the data block 4 in the local metadata is deleted, to obtain the new file after synchronization.

[0244] The file multi-terminal synchronization is completed by using the incremental synchronization, which can effectively reduce the data amount of file transmission, save bandwidth, and improve the overall data synchronization efficiency due to the reduced data amount of file transmission and the accelerated file synchronization process. Meanwhile, the load in the file synchronization process is effectively reduced due to the fact that the electronic device only needs to process the changed file, and the power consumption of the electronic device is reduced.

[0245] If the changed file and the local file are included in the temporary synchronization file, that is, the temporary synchronization file is the synchronized file, the local file corresponding to the temporary synchronization file is deleted in the file system. The file name of the temporary synchronization file is modified to a file name different from the local file name, so that the user can distinguish the synchronized file through the file name.

[0246] Optionally, the file name of the temporary synchronization file can also be modified to a file name consistent with the local file name, that is, the modified file name of the temporary synchronization file is consistent with the file name of the local file. In this way, the consistency before and after the file synchronization can be better ensured, and the user and the file system can identify and process the synchronized file.

[0247] Then, the temporary synchronization file with the modified file name is copied or moved from the temporary storage location to the specified storage location in the file system, so as to realize the file synchronization.

[0248] In this implementation, the local file is deleted first, and then the file name of the temporary synchronization file is modified, so that the file name conflict can be avoided, the error caused by the inconsistent file name or file version can be reduced, and the integrity and consistency of the file synchronization can be ensured.

[0249] Optionally, in a possible implementation, the file synchronization method provided by the embodiment of the application can further include steps S401 to S405 before the at least one trusted electronic device sends the to-be-synchronized file.

[0250] Please refer to Figure 11 , Figure 11 Another flowchart of a file synchronization method is shown in the embodiment of the application. The method includes the following steps.

[0251] S401, obtaining local metadata.

[0252] The file synchronization service module in the electronic device can include a REPO management module and a file synchronization management module. The REPO management module can include a REPO directory, and the REPO management module can be used to manage the REPO directory.

[0253] Exemplarily, for a local file, there is local metadata corresponding to the local file in the file system, and the file synchronization management module obtains the local metadata from the file system of the electronic device.

[0254] The file synchronization management module detects whether the local metadata matches the local file. For example, the file synchronization management module detects whether the file name, file size, file creation time, file last modification time, file last access time, file type, file permission, file owner, file attribute flag, file system information, file version, file extended attribute, relative path and other information in the local metadata are consistent with the file name, file size, file creation time, file last modification time, file last access time, file type, file permission, file owner, file attribute flag, file system information, file version, file extended attribute, relative path and other information of the local file.

[0255] If the information is inconsistent, it indicates that the local file has changed in the electronic device or that the local file has a problem. If the file synchronization is continued, the accuracy of the file synchronization result will be affected. Therefore, the file synchronization management module notifies the REPO management module that the file synchronization fails.

[0256] If the information is consistent, it indicates that the local file has not changed in the electronic device or that the local file has no problem. Then, step S402 is executed.

[0257] In this implementation, the local metadata and the local file are verified first, and the subsequent file synchronization process is executed when the local metadata and the local file match. This can ensure the accuracy of the subsequent file synchronization result.

[0258] S402, when it is detected that the local metadata matches the local file, comparing whether the local metadata and the source-end metadata are consistent.

[0259] The file synchronization management module compares whether the local metadata and the source-end metadata are consistent, which is essentially to compare whether the data blocks of the local metadata and the source-end metadata are consistent. For details, refer to the description in the corresponding embodiments, which will not be described here. Figure 8

[0260] When the local metadata and the source-end metadata are consistent, step S403 is executed; when the local metadata and the source-end metadata are inconsistent, step S404 is executed.

[0261] S403, when the local metadata and the source-end metadata are consistent, updating the local file.

[0262] ​Exemplarily, when the local metadata is consistent with the source-end metadata, it indicates that the to-be-synchronized file has not changed compared with the local file, i.e., the to-be-synchronized file has not changed since the last time the trusted electronic device and the electronic device performed file synchronization. At this time, no operation can be performed on the local file, or the attribute of the local file can be updated. For example, the file synchronization management module sends the synchronization time, the file last access time, etc. to the file system, and the file system updates the synchronization time, the file last access time, etc. of the local file.

[0263] Exemplarily, when the local metadata is inconsistent with the source-end metadata, it indicates that the to-be-synchronized file has changed compared with the local file, i.e., the to-be-synchronized file has changed since the last time the trusted electronic device and the electronic device performed file synchronization, and the local file needs to be synchronized. At this time, step S404 can be performed.

[0264] In this implementation, the local metadata and the local file are checked, and the local metadata and the source-end metadata are checked, and the subsequent file synchronization process is performed only when both checks pass, which can ensure the accuracy of the subsequent file synchronization result.

[0265] S404, when the local metadata is inconsistent with the source-end metadata, determining the difference data between the local metadata and the source-end metadata.

[0266] Exemplarily, when the local metadata is inconsistent with the source-end metadata, the file synchronization management module can determine the difference data block between the data block of the local metadata and the data block of the source-end metadata when comparing the data block of the local metadata with the data block of the source-end metadata, i.e., determining the difference data between the local metadata and the source-end metadata. For details, refer to Figure 8 For related descriptions in the corresponding embodiments, details are not described herein.

[0267] S405, sending the difference data to at least one trusted electronic device.

[0268] The difference data is used to trigger the at least one trusted electronic device to send the to-be-synchronized file to the electronic device.

[0269] The file synchronization management module sends the difference data to the file synchronization management module of the trusted electronic device, and the file synchronization management module of the trusted electronic device sends the to-be-synchronized file to the file synchronization management module of the electronic device.

[0270] In this implementation, when it is determined that the local file is different from the source file, the difference data is sent to the trusted electronic device to trigger the trusted electronic device to send the to-be-synchronized file to the electronic device, which provides a guarantee for implementing file synchronization.

[0271] Optionally, in one possible implementation, when the file synchronization management module determines the first different data block, the file synchronization management module sends the first different data block to the file synchronization management module of the trusted electronic device. The first different data block refers to the first different data block between the source end metadata and the local metadata, and the first different data block is used to trigger the trusted electronic device to send the file to be synchronized to the electronic device.

[0272] It should be understood that when the file synchronization management module of the electronic device sends the first different data block to the file synchronization management module of the trusted electronic device, the first different data block carries the position information of the first different data block.

[0273] In this implementation, when the first different data block between the source end metadata and the local metadata is determined, the first different data block is sent to the trusted electronic device, and the comparison of all data is not needed, which can significantly reduce the computing resources, improve the file synchronization efficiency, and save the file synchronization time. In addition, only the first different data block is sent, which can reduce the use of network bandwidth, reduce the load of the electronic device, and improve the overall performance of the system.

[0274] Optionally, in one possible implementation, the file synchronization method provided by the present application can further include: sending the source end metadata and the difference data to at least one trusted electronic device.

[0275] The source end metadata is used for the at least one trusted electronic device to check whether the source end metadata matches the local file in the at least one trusted electronic device; and the difference data is used to trigger the at least one trusted electronic device to send the file to be synchronized to the electronic device when the source end metadata matches the local file in the at least one trusted electronic device.

[0276] For example, the file synchronization management module of the electronic device sends the previously obtained source end metadata and the determined difference data or the first different data block to the file synchronization management module of the trusted electronic device.

[0277] For example, for the local file of the trusted electronic device, there is also a piece of metadata corresponding to the local file in the file system of the trusted electronic device, and the file synchronization management module of the trusted electronic device obtains the metadata from the file system of the trusted electronic device. The file synchronization management module of the trusted electronic device detects whether the metadata matches the local file of the trusted electronic device. The specific detection manner can refer to the similar description in the above step S401, and will not be described here.

[0278] When the metadata does not match the local file of the trusted electronic device, it indicates that the local file has been changed in the trusted electronic device or that the local file has a problem, and if the file synchronization is continued, the accuracy of the file synchronization result will be affected. Therefore, the file synchronization management module of the trusted electronic device notifies the file synchronization management module of the electronic device that the file synchronization fails.

[0279] When the metadata matches the local file of the trusted electronic device, it indicates that the local file has not been changed in the trusted electronic device or that the local file has no problem. Then, the file synchronization management module of the trusted electronic device determines a starting point (such as the beginning of the source file, the position after the last synchronization, etc.) in the file system, reads the source file block by block from the starting point, and generates a to-be-synchronized file. The file synchronization management module of the trusted electronic device sends the to-be-synchronized file to the file synchronization management module of the electronic device, and the file synchronization management module of the electronic device generates a temporary synchronization file based on the to-be-synchronized file, and then performs synchronization based on the temporary synchronization file.

[0280] In this implementation, the source file of the trusted electronic device and the metadata are checked first, and the subsequent file synchronization process is performed only when the source file has no problem, which can ensure the accuracy of the subsequent file synchronization result.

[0281] Please refer to Figure 12 , Figure 12 This is another file synchronization method according to an embodiment of the present application. The method comprises the following steps:

[0282] S501: The file synchronization management module of the electronic device acquires local metadata.

[0283] S502: The file synchronization management module of the electronic device checks whether the local metadata matches the local file.

[0284] S503: When the file synchronization management module of the electronic device detects that the local metadata does not match the local file, the file synchronization management module of the electronic device notifies the REPO management module that the file synchronization fails.

[0285] S504: When the file synchronization management module of the electronic device detects that the local metadata matches the local file, the file synchronization management module of the electronic device compares the local metadata with source metadata.

[0286] S505: When the file synchronization management module of the electronic device detects that the local metadata matches the source metadata, the file synchronization management module of the electronic device updates the local file.

[0287] S506: When the file synchronization management module of the electronic device detects that the local metadata does not match the source metadata, the file synchronization management module of the electronic device determines the difference data between the local metadata and the source metadata.

[0288] S507, the file synchronization management module of the electronic device sends the source end metadata and the difference data to the file synchronization management module of the trusted electronic device.

[0289] S508, the file synchronization management module of the trusted electronic device acquires the metadata from the file system of the trusted electronic device.

[0290] S509, the file synchronization management module of the trusted electronic device checks whether the source end metadata and the metadata of the local file are consistent.

[0291] S510, the file synchronization management module of the trusted electronic device detects that the source end metadata and the metadata of the local file are inconsistent, and the file synchronization management module of the trusted electronic device informs the file synchronization management module of the electronic device that the file synchronization fails.

[0292] S511, the file synchronization management module of the trusted electronic device detects that the source end metadata and the metadata of the local file are consistent, and generates a to-be-synchronized file based on the file system of the trusted electronic device.

[0293] S512, the file synchronization management module of the trusted electronic device sends the to-be-synchronized file to the file synchronization management module of the electronic device.

[0294] S513, the file synchronization management module of the electronic device generates a temporary synchronization file based on the to-be-synchronized file.

[0295] The specific implementation in the above steps S501 to S513 can refer to the related description in the foregoing embodiments, and will not be described herein.

[0296] Please refer to Figure 13 , Figure 13 Another file synchronization method is shown in the flowchart of the embodiment of the present application. The method comprises:

[0297] S601, the file synchronization management module of the electronic device generates a check value corresponding to a temporary synchronization file.

[0298] S602, the file synchronization management module of the electronic device checks whether the check value of the temporary synchronization file is consistent with the check value of the source end metadata.

[0299] S603, when the check value of the temporary synchronization file is consistent with the check value of the source end metadata, the local file corresponding to the temporary synchronization file is deleted from the file system.

[0300] S604, the file name of the temporary synchronization file is modified, and the temporary synchronization file after the file name is modified is stored in the file system.

[0301] S605, the file synchronization management module of the electronic device notifies the REPO management module that the file synchronization is successful.

[0302] The specific implementation in the steps S601 to S605 can refer to the related description in the foregoing embodiments, and will not be described herein.

[0303] The file synchronization method provided in the embodiments of the present application is applicable to any near field communication scenario that needs file synchronization.

[0304] In the process of file synchronization between electronic devices in a trust circle, the files in the electronic devices need to be monitored and scanned, or the file paths / file directories corresponding to the files need to be monitored and scanned. When multiple file paths / file directories need to be monitored and scanned, even if there is a containing relationship between the multiple file paths / file directories, each file path / file directory still needs to be monitored and scanned in the related technology, and a corresponding monitoring task needs to be created or a corresponding monitoring thread needs to be started each time the monitoring is performed, which increases the number of monitoring threads started and the number of times of scanning file paths / file directories, and finally leads to low file synchronization efficiency and high power consumption of the electronic device.

[0305] Therefore, the embodiments of the present application further provide a method for processing data, applied to an electronic device, a trust circle in which the electronic device is located further includes at least one trusted electronic device, and files in the electronic device can be synchronized to the at least one trusted electronic device. The method for processing data includes: obtaining a file synchronization request; determining a plurality of scanning tasks corresponding to the file synchronization request; determining an associated file path in a plurality of file paths, and merging scanning tasks corresponding to the associated file path.

[0306] The associated file path is a file path having a containing relationship; the file path having the containing relationship includes at least one child file path and one parent file path, and a scanning result corresponding to the child file path is notified to a scanning task corresponding to the parent file path, that is, a scanning result corresponding to a child file path in a file path having a containing relationship is notified to a parent file path in the file path having the containing relationship.

[0307] Optionally, each scanning task corresponds to a file path, and each file path corresponds to a file directory. The file path can be scanned to find a file pointed to by the file path and file content of the file.

[0308] Optionally, the scanning task can include monitoring and scanning of the file path.

[0309] In this implementation, after the file path with the existence relationship is determined, the scanning tasks corresponding to the file path with the existence relationship are merged. Since there is a sub-file path in the file path with the existence relationship, the scanning result corresponding to the sub-file path is notified to the scanning task corresponding to the parent file path. Thus, even if the scanning tasks are merged, the scanning tasks corresponding to the file paths with the existence relationship can be successfully completed. Moreover, since the scanning tasks are merged, in the process of executing the merged scanning task, multiple scanning of the same file path can be avoided, thereby effectively reducing the number of scanning, reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the resource allocation in the system, accelerating the entire file synchronization process, and improving the subsequent file synchronization efficiency.

[0310] Optionally, the merging the scanning tasks corresponding to the associated file paths comprises: obtaining at least two scanning time intervals corresponding to the associated file paths; merging the at least two scanning tasks corresponding to the associated file paths into a target scanning task, and setting a target scanning time interval of the target scanning task according to the at least two scanning time intervals. The scanning time intervals corresponding to different file paths are different. The target scanning time interval is greater than or equal to the smallest scanning time interval in the at least two scanning time intervals, and is less than the largest scanning time interval in the at least two scanning time intervals. In this implementation, since the scanning tasks are merged, in the process of executing the merged scanning task, multiple scanning of the same file path can be effectively avoided, thereby effectively reducing the number of scanning, reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the resource allocation in the system, accelerating the entire file synchronization process, and improving the subsequent file synchronization efficiency.

[0311] Optionally, the method for processing data can further comprise: scanning the file path corresponding to the target scanning task according to the target scanning time interval to obtain a scanning file. The scanning file is used for synchronization to at least one trusted electronic device in the trust circle. In this implementation, the file path corresponding to the target scanning task is scanned purposefully without considering other file paths, thereby improving the scanning efficiency, further accelerating the entire file synchronization process, and improving the subsequent file synchronization efficiency.

[0312] Optionally, the method for processing data can further comprise: obtaining a to-be-scanned list, scanning each file path in the to-be-scanned list according to the target scanning time interval, and obtaining a scanning result of any file path in the associated file paths when any file path is scanned. The scanning result is fed back to the scanning task corresponding to each file path in the associated file paths. The to-be-scanned list comprises the associated file paths, the file paths without associated scanning tasks, and the non-associated file paths associated with the scanning tasks. Alternatively, the to-be-scanned list comprises all the file paths.

[0313] In this implementation, when the associated file paths are scanned, each scanning task corresponding to the associated file paths can be ensured to receive the scanning result notification, which facilitates subsequent synchronization of the files scanned based on the scanning tasks to the trusted electronic device, and provides a guarantee for the accuracy of file synchronization while reducing the number of scans and reducing the power consumption of the electronic device.

[0314] Optionally, the method for processing data can further include: setting a scanning start time of the target scanning task according to a target scanning time interval; and starting scanning when the current time reaches the scanning start time. In this implementation, the scanning start time is set before the scanning of the file path is started, which can accurately record the execution time of each scanning operation and avoid scanning errors. Determining the start and end times of each scanning operation helps to reasonably allocate system resources.

[0315] Optionally, feeding back the scanning result to the scanning task corresponding to each file path in the associated file paths includes: adding the scanning result to a preset notification list. The notification list is used to feed back the scanning result to the scanning task corresponding to each file path in the associated file paths.

[0316] Optionally, the scanning result can be obtained by calling a callback function.

[0317] In this implementation, it is beneficial for subsequent synchronization of the files scanned based on the scanning tasks to the trusted electronic device, and provides a guarantee for the accuracy of file synchronization while reducing the number of scans and reducing the power consumption of the electronic device.

[0318] Optionally, the method for processing data can further include: deleting all scanning results in the notification list after scanning each file path in the to-be-scanned list. In this implementation, all scanning results in the notification list are deleted at one time, which simplifies the deletion step and improves the deletion efficiency.

[0319] Optionally, the method for processing data can further include: deleting the scanning result corresponding to any file path in the notification list after scanning any file path in the associated file paths. In this implementation, one corresponding scanning result is deleted after scanning one file path, which can save storage space, avoid false feedback, and improve the accuracy of file synchronization.

[0320] Optionally, the method for processing data can further include: obtaining a cancel scanning notification, and clearing the scanning start time of the target scanning task. The cancel scanning notification is used to cancel any scanning task corresponding to the associated file path. In this implementation, when the cancel scanning notification is obtained, the relevant information of the scanning task is cleared, which can release more resources of the system, reduce the processing burden of the system, and improve the processing speed of the system. At the same time, the different needs of the user in the file synchronization scenario are responded in a timely manner, and the user experience is improved.

[0321] Optionally, the clearing of the scanning start time of the target scanning task includes: determining that there is no containing relationship between the other multiple file paths; and clearing the scanning start time of the target scanning task. The other multiple file paths are multiple file paths other than the file path corresponding to any scanning task. In this implementation, when it is determined that there is no containing relationship between the other multiple file paths, the relevant information of the scanning task is cleared, which avoids affecting other scanning tasks when the relevant information of the scanning task is cleared, and ensures that other scanning tasks can be completed smoothly.

[0322] Optionally, after receiving the cancel scanning notification, the method for processing data can further include: determining that there is a containing relationship between the other multiple file paths; and merging the scanning tasks corresponding to the other multiple file paths having the containing relationship.

[0323] Optionally, the determining that there is a containing relationship between the other multiple file paths includes: obtaining the scanning time intervals corresponding to the file paths having the containing relationship, merging the scanning tasks corresponding to the file paths having the containing relationship into a new target scanning task, and setting a new scanning time interval corresponding to the new target scanning task according to the scanning time intervals corresponding to the file paths having the containing relationship.

[0324] The new scanning time interval is greater than or equal to the smallest scanning time interval among the scanning time intervals corresponding to the file paths having the containing relationship, and is less than the largest scanning time interval among the scanning time intervals corresponding to the file paths having the containing relationship.

[0325] In this implementation, after the cancel scanning notification is obtained, the scanning tasks corresponding to the remaining file paths having the containing relationship are merged, so that when the merged scanning task is executed, multiple scanning of the same file path can be avoided, thereby effectively reducing the number of scans, i.e., reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the allocation of resources in the system, speeding up the entire file synchronization process, and improving the subsequent file synchronization efficiency.

[0326] It should be noted that the method for processing data provided in the present application can be applied to any scenario requiring file monitoring and scanning. When performing file synchronization between electronic devices in a trust circle, the method for processing data can be applied in the electronic devices or in the trusted electronic devices.

[0327] In the related art, when performing file synchronization between electronic devices in a trust circle, if at least two different directories in the electronic devices need to synchronize the same file from a trusted electronic device, or the same file in the source device (i.e., the trusted electronic device) needs to be synchronized to different directories in the electronic devices, the trusted electronic device usually sends the same file to the electronic devices at least twice, i.e., the trusted electronic device sends the same file to different directories in the electronic devices. However, in the file synchronization process, each cross-device transmission of the file needs to be checked, and multiple transmissions of the same file from the trusted electronic device to the electronic devices means that the same file needs to be checked multiple times, resulting in a complex and tedious file transmission process. Repeated transmission of the same file increases network bandwidth usage and processing time, not only affecting other file synchronization, but also reducing the efficiency of file synchronization. Moreover, multiple repeated transmissions also increase the power consumption of the electronic devices and the trusted electronic devices, increase the risk of data leakage, and reduce the security of file synchronization.

[0328] Therefore, the embodiments of the present application further provide a file synchronization method applied to an electronic device, wherein a trust circle in which the electronic device is located further includes at least one trusted electronic device, and the method includes: determining that at least two directories in the electronic device synchronize the same file from the at least one trusted electronic device; any directory requesting to obtain the same file from the at least one trusted electronic device; any directory being any one of the at least two directories; and any directory sending the obtained same file to other directories, the other directories being the directories other than the any directory among the at least two directories.

[0329] In this implementation, any directory in the electronic device first obtains the same file to be synchronized from the trusted electronic device, and then sends the same file to other directories in the electronic device. In the entire file synchronization process, the same file is only transmitted across devices once for the electronic device and the trusted electronic device, and the entire file transmission process is simple and convenient. Since the number of file transmissions is small, the network bandwidth usage and processing time are reduced, which reduces the power consumption of the electronic device and the trusted electronic device, and also improves the efficiency of file synchronization. Reducing the number of file transmissions also reduces the risk of data leakage and improves the security of file synchronization.

[0330] The same file is sent by any directory in the electronic device to other directories in the electronic device, and since the file is transmitted in the same electronic device, the transmission speed is fast, the risk is low, the efficiency and safety of file synchronization are improved. In the transmission process, no additional network bandwidth is consumed, the transmission cost is reduced, and the transmission is not easily affected by network fluctuations or external interference, and the reliability of the transmission is improved. And the file operation is carried out in the same electronic device, and the operating system and file system of the electronic device can better maintain the attributes and permissions of the file, and ensure the integrity of the file.

[0331] Optionally, determining that the at least two directories in the electronic device synchronize the same file from the at least one trusted electronic device comprises: obtaining a list of files to be synchronized; comparing the files to be synchronized corresponding to the at least two directories respectively; when the files to be synchronized corresponding to the at least two directories are consistent, determining that the at least two directories synchronize the same file from the at least one trusted electronic device. The list of files to be synchronized includes the files to be synchronized corresponding to the at least two directories respectively. In this implementation, the files to be synchronized corresponding to the at least two directories are verified to ensure that the at least two directories indeed synchronize the same file from the trusted electronic device, which can ensure that the files finally synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0332] Optionally, comparing the files to be synchronized corresponding to the at least two directories comprises: obtaining metadata of the files to be synchronized corresponding to the at least two directories; when the metadata of the files to be synchronized corresponding to the at least two directories are consistent, determining that the at least two directories synchronize the same file from the at least one trusted electronic device. In this implementation, the metadata of the files to be synchronized corresponding to the at least two directories are verified to ensure that the at least two directories indeed synchronize the same file from the trusted electronic device, which can ensure that the files finally synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0333] Optionally, any directory requesting to obtain the same file from the at least one trusted electronic device comprises: any directory initiating a file synchronization request to the at least one trusted electronic device, the file synchronization request being used to trigger the at least one trusted electronic device to send the same file to the electronic device; and marking other directories to synchronize the same file with any directory. In this implementation, after any directory initiates a file synchronization request to the at least one trusted electronic device, other directories are marked, which facilitates any directory to quickly and accurately send the same file to the marked other directories after obtaining the same file, thereby ensuring that the files finally synchronized to each directory are accurate, and improving the accuracy of file synchronization.

[0334] Optionally, any directory sends the acquired same file to other directories, including: acquiring the file path of the marked other directory; and copying the same file into the file path of the marked other directory. In this implementation, any directory in the electronic device acquires the same file to be synchronized, and then copies the same file into the file path of the other directory according to the file path of the marked other directory. Since the file is transmitted in the same electronic device, the transmission speed is fast, the risk is low, the efficiency and safety of file synchronization are improved. In the transmission process, no additional network bandwidth is consumed, the transmission cost is reduced, the transmission is not easily affected by network fluctuations or external interference, and the reliability of the transmission is improved. In the same electronic device, the operating system and file system of the electronic device can better maintain the properties and permissions of the file, and ensure the integrity of the file.

[0335] Optionally, the trust circle in which the electronic device is located further includes at least two trusted electronic devices, and the same synchronization file is stored in each of the at least two trusted electronic devices. The file synchronization method can further include: acquiring an influence factor of each trusted electronic device; determining a synchronization source device in the at least two trusted electronic devices according to the influence factor of each trusted electronic device; and synchronizing the synchronization file from the synchronization source device. The influence factor is used to influence the determination of the synchronization source device, that is, the influence factor is a factor used to influence the choice of which trusted electronic device as the synchronization source device. The synchronization source device is different, and the file synchronization effect is different, that is, the influence factor can be used to influence the file synchronization effect between the electronic device and the trusted electronic device. The influence factor includes at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, and a user preference.

[0336] In this implementation, the influence factor of each trusted electronic device is considered, so that the most suitable synchronization source device can be selected from the multiple trusted electronic devices, which can ensure more efficient synchronization operation and help maintain the consistency and accuracy of the synchronized file. At the same time, it can avoid the situation of overload, ensure that the device resources are reasonably allocated and optimally used, reduce unnecessary resource consumption, reduce the cost of file synchronization, and enhance the reliability of file synchronization.

[0337] Optionally, the trusted electronic device with the highest influence factor is determined as the synchronization source device from the at least two trusted electronic devices according to the influence factors of each trusted electronic device. In this implementation, the synchronization source device is determined according to the influence factors of each trusted electronic device, and the process of calculating the synchronization suitability score of each trusted electronic device and determining the synchronization source device according to the synchronization suitability score can select the most suitable synchronization source device from the plurality of trusted electronic devices, which can ensure more efficient synchronization operation and help maintain the consistency and accuracy of the synchronized files. At the same time, it can avoid overloading and ensure reasonable allocation and optimized use of device resources, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0338] Optionally, the device types of the at least two trusted electronic devices are different, and the trusted electronic device with the highest influence factor is determined as the synchronization source device from the at least two trusted electronic devices according to the influence factors of each trusted electronic device. In this implementation, the priority of each trusted electronic device is determined according to the influence factors of each trusted electronic device, and the trusted electronic device with the highest priority is determined as the synchronization source device from the at least two trusted electronic devices, which can allocate resources according to the importance and functions of different devices and select a suitable synchronization source device, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0339] The file synchronization method provided by the embodiments of the present application is described above in combination with the flowchart, and the hardware structure of the electronic device involved in the embodiments of the present application is briefly introduced below in combination with the drawings.

[0340] In some embodiments of the present application, the electronic device can be a mobile phone, a tablet computer, a wearable device, a television, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., or can be other devices or apparatuses capable of scene recognition. The specific type of the electronic device is not limited in the embodiments of the present application.

[0341] Please refer to Figure 14 , Figure 14 The hardware structure of the electronic device shown in the embodiments of the present application is shown in the following figure.

[0342] AsFigure 14 As shown, the electronic device 100 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 interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope 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.

[0343] 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 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 14 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 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 14 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 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 14 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 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 14 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 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown.

[0344] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.

[0345] It can be understood that the interface connection relationship between the modules shown in the embodiments is only illustrative and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 can also use different interface connection modes or a combination of multiple interface connection modes.

[0346] The electronic device 100 can implement the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU can also be used to perform mathematical and pose calculations for graphics rendering, etc. The processor 110 can include one or more GPUs, and execution of program instructions by the GPU can generate or change display information.

[0347] The display screen 194 can be used to display images or videos, and can also display a series of graphical user interfaces (GUIs), which are all home screens of the electronic device 100. Generally, the size of the display screen 194 of the electronic device 100 is fixed, and only limited controls can be displayed in the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component included in an application program, controls all data processed by the application program and interaction operations related to the data, and a user can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally, a control can include an icon, a button, a menu, a tab, a text box, a dialog box, a status bar, a navigation bar, a widget, and other visual interface elements.

[0348] The display screen 194 in the embodiments of the present application can be a touch screen. The display screen 194 can be integrated with a touch sensor 180K. The touch sensor 180K can also be referred to as a "touch panel". That is, the display screen 194 can include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. After the touch operation detected by the touch sensor 180K, the kernel layer driver (such as the TP driver) can pass it to the upper layer to determine the touch event type. The display screen 194 can provide visual output related to the touch operation. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0349] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.

[0350] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various function applications and data processing of the electronic device 100 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, at least one APP (such as a sound playing function, an image playing function, etc.) required by a function, and the like. The data storage area can store data (such as audio data, a phonebook, etc.) created during use of the electronic device 100, and the like.

[0351] 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), and the like.

[0352] The keys 190 include a power-on key, a volume key, and the like. The keys 190 can be mechanical keys. Alternatively, the keys 190 can be touch keys. The electronic device 100 can receive a key input and generate a key signal input related to user settings and function control of the electronic device 100.

[0353] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts and also for touch vibration feedback.

[0354] The file synchronization method and the file synchronization method provided in the embodiments of the present application can be implemented in the electronic device 100 having the hardware structure described above.

[0355] The file synchronization method provided in the embodiments of the present application is described below in combination with a software structure. Please refer to Figure 15 , Figure 15 The software structure of the electronic device shown in the embodiments of the present application is schematically shown in the following figure.

[0356] By way of example, the layered architecture divides the software into several layers, each of which has a clear role and division of labor. Layers communicate with each other through software interfaces. In the embodiments of the present application, the electronic device is taken as an example of an Android system, and the Android system is divided into an Application (App) layer, a Framework layer, and a hardware abstraction layer.

[0357] The application program layer can include a series of application packages, such as a trust circle application. In the embodiments of the present application, a file synchronization SDK is integrated in the trust circle application, so that the trust circle application is configured with the capability of file synchronization.

[0358] Optionally, the application program layer can also include a database. The database provides the application program with functions of data storage, data modification, data deletion, data addition, data query, and the like.

[0359] The application program framework layer provides the application program of the application program layer with an application programming interface (API) and a programming framework. The application program framework layer includes some pre-defined functions.

[0360] As an example of the present application, the application program framework layer includes a file synchronization service module, which can include a REPO management module, a listening scanning management module, and a timer. The REPO management module can include a REPO directory, and the REPO management module can be used to manage the REPO directory.

[0361] Optionally, the application program framework layer can also include a database.

[0362] Optionally, the database can also interact with the hardware abstraction layer, such as calling and managing data in the file system through the operating system.

[0363] Optionally, the hardware abstraction layer can include a file system.

[0364] The trust circle application, the file synchronization service module, the database, and the file system interact with each other to implement the method of processing data and the file synchronization method in the above-mentioned method embodiments. For details, please refer to the related description in the foregoing embodiments, which will not be described here.

[0365] The above describes an example of the file synchronization method provided by the embodiments of the present application in detail. It can be understood that the electronic device includes hardware and / or software modules corresponding to each function to implement the above-mentioned functions. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of the examples described in the embodiments disclosed in the present text, the present application can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered beyond the scope of the present application.

[0366] The embodiments of the present application can divide the function modules of the electronic device according to the above method examples. For example, each function module can be divided according to each function, or two or more functions can be integrated into one module. The integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of the modules in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, another division method can be used.

[0367] It should be noted that all related contents of each step involved in the above method embodiments can be cited in the function description of the corresponding function module, and will not be repeated here.

[0368] The electronic device provided by the embodiments can be used to execute the above file synchronization method, and thus the same effect as the above implementation method can be achieved.

[0369] In the case of using an integrated unit, the electronic device can further include a processing module, a storage module and a communication module. The processing module can be used to control and manage the actions of the electronic device. The storage module can be used to support the electronic device to execute program codes and data. The communication module can be used to support the communication between the electronic device and other devices.

[0370] The processing module can be a processor or a controller. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present application. The processor can also be a combination of computing functions, such as one or more microprocessor combinations, a combination of digital signal processing (DSP) and microprocessor, etc. The storage module can be a memory. The communication module can be a device for interacting with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a WiFi chip, etc.

[0371] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor executes the file synchronization method of any one of the above embodiments.

[0372] The embodiments of the present application also provide a device, which can be a chip, a component or a module. The device can include a processor and a memory connected to each other. The memory is used to store computer execution instructions. When the device is running, the processor can execute the computer execution instructions stored in the memory, so that the chip executes the data processing method and the file synchronization method in the above method embodiments.

[0373] The embodiment of the present application further provides a computer program product, which, when running on a computer, causes the computer to execute the related steps to realize the file synchronization method in the above embodiment.

[0374] The embodiment of the present application further provides a chip. Please refer to Figure 16 , Figure 16 FIG. 1 shows a structural schematic diagram of a chip according to the embodiment of the present application. Figure 16 The chip shown in FIG. 1 can be a general-purpose processor or a special-purpose processor. The chip includes a processor 210. The processor 210 is configured to execute the method for processing data and the file synchronization method in any of the above embodiments.

[0375] Optionally, the chip further includes a transceiver 220, which is configured to be controlled by the processor and support the communication device to execute the technical solutions shown above.

[0376] Optionally, Figure 16 The chip shown in FIG. 1 can further include a storage medium 230.

[0377] It should be noted that, Figure 16 Figure 16 The chip shown in FIG. 1 can be implemented by using one or more field programmable gate arrays (FPGA), programmable logic devices (PLD), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits capable of performing the various functions described throughout this application.

[0378] The electronic device, computer readable storage medium, computer program product or chip provided by the embodiment are all used to execute the corresponding method provided above, and thus the beneficial effects that can be achieved are referable to the beneficial effects in the corresponding method provided above, which will not be described herein again.

[0379] Through the description of the above embodiments, those skilled in the art can understand that, for the convenience and brevity, only the division of the above functional modules is taken as an example for illustration, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0380] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other manners. For example, the apparatus embodiments described above are merely illustrative, for example, the division of the modules or units is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another apparatus, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, apparatuses or units, and can be electrical, mechanical or other forms.

[0381] The units described as separate components can or can not be physically separate, and the components shown as units can be one physical unit or a plurality of physical units, that is, can be located in one place, or can be distributed to a plurality of different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0382] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0383] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application essentially or the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing an apparatus (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage media that can store program codes.

[0384] The above is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A file synchronization method, characterized by, The method is applied to an electronic device, a trust ring in which the electronic device is located further comprises at least one trusted electronic device, and a trust ring application is installed in the electronic device, and the method comprises the following steps: A REPO directory is created by calling a file synchronization SDK integrated in the trust ring application; Local metadata and source metadata of the at least one trusted electronic device are obtained; when it is detected that the local metadata matches a local file and the local metadata is inconsistent with the source metadata, difference data between the local metadata and the source metadata is determined; the local file is a file in the electronic device before a file synchronization operation is performed; The difference data is sent to the at least one trusted electronic device; the difference data is used to trigger the at least one trusted electronic device to send a to-be-synchronized file to the electronic device; The to-be-synchronized file sent by the at least one trusted electronic device is obtained; The to-be-synchronized file is temporarily stored in the REPO directory to form a temporary synchronization file; A check value corresponding to the temporary synchronization file and a check value corresponding to the source metadata are generated; when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source metadata, it is determined that the temporary synchronization file passes the check; The local file is deleted in a file system; a file name of the temporary synchronization file is modified; and the temporary synchronization file after the file name is modified is stored in the file system; the file name of the temporary synchronization file after the modification is consistent with a file name of the local file.

2. The method of claim 1, wherein, The method further comprises: Incremental synchronization is performed on the local file and the to-be-synchronized file to generate the temporary synchronization file.

3. The method of claim 1, wherein, The method further comprises: When it is detected that the local metadata matches the local file and the local metadata is consistent with the source metadata, the local file is updated.

4. The method of claim 1, wherein, After the determination of the difference data between the local metadata and the source metadata, the method further comprises: The source metadata and the difference data are sent to the at least one trusted electronic device; the source metadata is used for the at least one trusted electronic device to check whether the source metadata matches a local file in the at least one trusted electronic device; and the difference data is used to trigger the at least one trusted electronic device to send the to-be-synchronized file to the electronic device when the source metadata matches the local file in the at least one trusted electronic device.

5. The method according to any one of claims 1 to 4, characterized in that, The check value of the temporary synchronization file comprises a weak hash value.

6. An electronic device, comprising: Comprise: One or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device performs the method in any one of claims 1 to 5.

7. A chip, characterized by Comprise: A processor is configured to call and run a computer program from a memory, so that an electronic device in which the chip is installed performs the method in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data sharing method, electronic equipment and system

    CN114329020A

  • File verification method and device, electronic equipment and storage medium

    CN117763627A