File synchronization method, electronic equipment and storage medium

By reducing the number of file transfers in the trust ring and using metadata verification, the problems of low file synchronization efficiency and poor security in the prior art are solved, and an efficient and secure file synchronization process is achieved.

CN119248737AActive Publication Date: 2025-01-03HONOR DEVICE CO LTD

Patent Information

Application Number
CN202410389113.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2025-01-03
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

In the prior art, the file synchronization process is complicated and cumbersome, resulting in low file synchronization efficiency, increasing the power consumption of electronic devices, and reducing the security and accuracy of file synchronization.

Method used

By determining in the trust ring that at least two directories in the electronic device are synchronized with the same file from the trusted electronic device, the number of file transfers is reduced, and the file transfer is performed using the hierarchy of the directory, ensuring that files are transmitted within the same electronic device, and reducing the network Bandwidth usage and processing time, and ensure the accuracy of file synchronization through metadata verification.

Benefits of technology

Improves the efficiency and security of file synchronization, reduces power consumption of electronic devices and trusted electronic devices, reduces the risk of data leakage, and improves the accuracy and reliability of file synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248737A_ABST
    Figure CN119248737A_ABST
Patent Text Reader

Abstract

The invention provides a file synchronization method, electronic equipment and a storage medium, and relates to the technical field of data processing. The method is applied to the electronic device, a trust ring where the electronic device is located further comprises at least one trusted electronic device, and the method comprises the steps that it is determined that at least two directories in the electronic device synchronize the same file from the at least one trusted electronic device; any directory requests to acquire the same file from at least one trusted electronic device; any directory is any directory in the at least two directories; and any directory sends the same acquired file to other directories. In the implementation mode, for the electronic equipment and the trusted electronic equipment, the same file is only transmitted once across the equipment, and the whole file transmission process is simple and convenient. In addition, due to the fact that the number of file transmission times is small, the use and processing time of network bandwidth is reduced, and the file synchronization efficiency is improved while the power consumption of the electronic device and the trusted electronic device is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file synchronization method, an electronic device and a storage medium. Background Art

[0002] With the development of communication technology, distributed technology is increasingly being 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, mobile phones and other electronic devices (such as tablets, laptops, home storage devices, etc.) use near-field communications, such as wireless fidelity (Wi-Fi), Bluetooth (BT), and peer-to-peer (P2P) to form a local area network, establish a trust loop, and synchronize files in the mobile phone to other electronic devices.

[0004] However, it is found in use that the file synchronization process in the related art is complicated and cumbersome, which reduces the efficiency of file synchronization and increases the power consumption of electronic devices. Summary of the invention

[0005] The present application provides a file synchronization method, an electronic device and a storage medium, which can reduce the number of file transfers, reduce the use of network bandwidth and processing time during the file synchronization process, and improve the efficiency of file synchronization while reducing the power consumption of electronic devices and trusted electronic devices.

[0006] In a first aspect, the present application provides a file synchronization method, which is applied to an electronic device, wherein the trust ring in which the electronic device is located also 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 at least one trusted electronic device; any directory requests to obtain the same file from at least one trusted electronic device; and any directory sends the obtained same file to other directories.

[0007] Among them, any one directory is any one of the at least two directories, and other directories are directories other than any one of the at least two directories.

[0008] Optionally, the storage space corresponding to the directory in the electronic device is used to store files to be synchronized, that is, to store the same file sent by the trusted electronic device.

[0009] Optionally, the hierarchy of the directory can be represented by a file path. The at least two directories in the electronic device are different, that is, the at least two directories in the electronic device correspond to different file paths.

[0010] 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. During the entire file synchronization process, for the electronic device and the trusted electronic device, the same file is only transmitted across devices once, and the entire file transfer process is simple and convenient. Due to the small number of file transfers, the use of network bandwidth and processing time are reduced, while reducing the power consumption of the electronic device and the trusted electronic device, the efficiency of file synchronization is also improved. Reducing the number of file transfers can also reduce the risk of data leakage and improve the security of file synchronization.

[0011] Moreover, any directory in an electronic device sends the same file to other directories in the electronic device. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, which improves the reliability of transmission. Moreover, when performing file operations in the same electronic device, 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.

[0012] In combination with the first aspect, in certain implementations of the first aspect, determining that at least two directories in an electronic device synchronize the same file from at least one trusted electronic device includes: obtaining a list of files to be synchronized; comparing the files to be synchronized corresponding to the at least two directories; 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 at least one trusted electronic device.

[0013] The list of files to be synchronized includes files to be synchronized corresponding to at least two directories.

[0014] In this implementation, the to-be-synchronized files corresponding to at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0015] In combination with the first aspect, in certain implementations of the first aspect, comparing the files to be synchronized corresponding to at least two directories, includes: 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 at least one trusted electronic device.

[0016] Among them, the metadata of the file to be synchronized is used to describe the name of the file to be synchronized, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read and write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file is a hidden file, or a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative path, etc.

[0017] In this implementation, metadata of the files to be synchronized corresponding to at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0018] In combination with the first aspect, in certain implementations of the first aspect, any directory requests to obtain the same file from at least one trusted electronic device, including: any directory initiates a file synchronization request to at least one trusted electronic device, and the file synchronization request is used to trigger at least one trusted electronic device to send the same file to the electronic device; and marks other directories to synchronize the same file with any directory.

[0019] In this implementation, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after any subsequent directory obtains the same file, it can quickly and accurately send the same file to other marked directories, which can ensure that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0020] In combination with the first aspect, in some implementations of the first aspect, any directory sends the same acquired file to other directories, including: acquiring the file path of the other marked directories; and copying the same file to the file path of the other marked directories.

[0021] In this implementation, after any directory in the electronic device obtains the same file to be synchronized, it will copy the same file to the file path of other directories according to the marked file path of other directories. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost, is not easily affected by network fluctuations or external interference, and improves the reliability of transmission. In addition, when performing file operations in the same electronic device, 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.

[0022] In combination with the first aspect, in certain implementations of the first aspect, the trust ring in which the electronic device is located also includes at least two trusted electronic devices, and the same synchronization file is respectively stored in the at least two trusted electronic devices. The file synchronization method may also include: obtaining an influencing factor of each trusted electronic device; determining a synchronization source device among the at least two trusted electronic devices based on the influencing factor of each trusted electronic device; and synchronizing the synchronization file from the synchronization source device.

[0023] The influencing factors are used to influence the determination of the synchronization source device, that is, the influencing factors are factors used to influence the decision of which trusted electronic device to use as the synchronization source device. Different synchronization source devices have different file synchronization effects, that is, the influencing factors can be used to influence the file synchronization effect between the electronic device and the trusted electronic device.

[0024] The influencing factors include at least one of power status, device type, network status, device performance, current power consumption of the device, and user preference.

[0025] In this implementation, the influencing factors of each trusted electronic device are taken into consideration, so that the most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operations and help maintain the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0026] In combination with the first aspect, in certain implementations of the first aspect, a synchronization source device is determined among at least two trusted electronic devices based on an influencing factor of each trusted electronic device, including: calculating a synchronization suitability score for each trusted electronic device based on the influencing factor of each trusted electronic device; and determining a synchronization source device among at least two trusted electronic devices based on the synchronization suitability score of each trusted electronic device.

[0027] In this implementation, the synchronization suitability score is calculated for the trusted electronic device, and the synchronization source device is determined according to the synchronization suitability score to synchronize files. The most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operations and help maintain the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0028] In combination with the first aspect, in certain implementations of the first aspect, at least two trusted electronic devices are of different device types, and a synchronization source device is determined in the at least two trusted electronic devices based on an influencing factor of each trusted electronic device, including: determining a priority of each trusted electronic device based on the influencing factor of each trusted electronic device; and determining a synchronization source device in the at least two trusted electronic devices based on the priority of each trusted electronic device.

[0029] In this implementation, by determining the priority of the device to determine the synchronization source device, resources can be reasonably allocated according to the importance and function of different devices, and a suitable synchronization source device can be selected, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0030] In a second aspect, the present application provides an electronic device, comprising: one or more processors; one or more memories; a module with multiple applications installed; the memory stores one or more programs, and when one or more programs are executed by the processor, the electronic device executes the method in the above-mentioned first aspect and any possible implementation thereof.

[0031] In a third aspect, the present application provides a device for processing data, including a unit for executing any one of the methods in the first aspect. The device may be a server, an electronic device, or a chip in an electronic device. The device may include an input unit and a processing unit.

[0032] When the device is an electronic device, the processing unit may be a processor, and the input unit may be a communication interface; the electronic device may also include a memory for storing computer program code, and when the processor executes the computer program code stored in the memory, the electronic device executes any one of the methods in the first aspect.

[0033] When the device is a chip in an electronic device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect.

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

[0035] Optionally, the chip also includes a memory, and the memory is connected to the processor via a circuit or wire.

[0036] Optionally, the chip also includes a communication interface.

[0037] In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method in the first aspect and any possible implementation thereof.

[0038] In a sixth aspect, the present application provides a computer program product, the computer program product comprising: a computer program code, when the computer program code runs on an electronic device, enables the electronic device to execute the method in the first aspect and any possible implementation thereof.

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

[0040] Figure 1 A schematic diagram of a system architecture applicable to the file synchronization method shown in an embodiment of the present application;

[0041] Figure 2 A schematic diagram of another system architecture applicable to the file synchronization method shown in the embodiment of the present application;

[0042] Figure 3 A schematic diagram of an application scenario of file synchronization shown in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of backing up data based on external storage shown in an embodiment of the present application;

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

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

[0046] Figure 7 A schematic diagram of file transmission shown in an embodiment of the present application;

[0047] Figure 8 A flowchart of a file synchronization method shown in an embodiment of the present application;

[0048] Fig. 9 Another file transmission schematic diagram shown in an embodiment of the present application;

[0049] Fig.10 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0050] Fig.11 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0051] Fig.12 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0052] Fig.13 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0053] Fig.14 A schematic diagram of file synchronization shown in an embodiment of the present application;

[0054] Fig.15 A flowchart of a file synchronization method shown in an embodiment of the present application;

[0055] Fig.16 A schematic diagram of the hardware structure of an electronic device shown in an embodiment of the present application;

[0056] Fig.17 A schematic diagram of the software structure of an electronic device shown in an embodiment of the present application;

[0057] Fig.18 A schematic diagram of the structure of a chip shown in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0059] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0060] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0061] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0062] In order to better understand the embodiments of the present application, some terms involved in the embodiments of the present application are first explained below to facilitate understanding by those skilled in the art.

[0063] 1. Trust Ring and Trusted Electronic Devices

[0064] Two or more electronic devices establish a trust relationship and form a trust circle through trusted authentication.

[0065] Electronic devices can perform trusted authentication, establish a trust relationship, and form a trust circle through any of the following methods: 1) Log in to the same account on two or more electronic devices respectively, and the electronic devices under the same account trust each other, then the above two or more electronic devices constitute a trust circle. For example, two mobile phones of the same user, or the mobile phone, tablet computer, laptop computer, home storage device (Network Attached Storage, NAS), etc. of the same user can perform trusted authentication by logging into the user's account, establish a trust relationship, and form a trust circle. 2) Two or more electronic devices perform trusted authentication through a private protocol, establish a trust relationship, and form a trust circle. 3) Two or more electronic devices perform trusted authentication by logging into the cloud, establish a trust relationship, and form a trust circle. It can be understood that the above methods of building a trust circle are only used for illustration and do not constitute any limitation on this application.

[0066] 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 to achieve device collaboration. In the embodiment of the present application, data synchronization includes but is not limited to file synchronization.

[0067] The electronic device that actively initiates a synchronization request in the trust ring can be called the master device, and other electronic devices that have a trust relationship with the master device through mutual trust authentication are called trusted electronic devices. For example, a mobile phone, a tablet computer, and a laptop computer form a trust ring. The mobile phone actively initiates a synchronization request in the trust ring and applies to synchronize files in the mobile phone to the tablet computer and laptop computer. In this case, the mobile phone is the master device, and the tablet computer and laptop computer are trusted electronic devices.

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

[0069] Storage devices transfer, share, and access files between different operating systems and electronic devices.

[0070] 3. Trust Ring Application

[0071] Trusted ring applications refer to applications in electronic devices within the trusted ring. Users can use trusted ring applications to set up file backup, file synchronization and other functions.

[0072] Exemplarily, the trusted ring applications may include file management applications, setting applications, near field transmission applications, gallery applications, third-party file synchronization applications, multimedia applications, social applications, network applications, educational applications, etc.

[0073] 4. Software Development Kit (SDK)

[0074] Usually refers to a collection of development tools that software engineers use to build applications for specific software packages, software frameworks, hardware platforms, operating systems, etc. In other words, SDK is a collection of related documents, examples, and tools that assist in the development of a certain type of application. It facilitates the creation of applications through compilers, debuggers, software frameworks, etc.

[0075] In an embodiment of the present application, the SDK may include a file synchronization SDK. The file synchronization SDK may be integrated into an application, such as a trusted ring application, thereby configuring the trusted ring application with a file synchronization capability.

[0076] 5. Directories and folders

[0077] Directories and folders usually refer to the same concept, which are containers for organizing and storing files and other directories / folders. In the present application embodiment, these two words are used interchangeably in different application scenarios, but the meanings and functions they represent are the same.

[0078] 6. Water level synchronization

[0079] 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 embodiment 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.

[0080] 7. Incremental Synchronization

[0081] Incremental synchronization is a file synchronization technique that focuses on synchronizing only the files that have changed since the last file synchronization.

[0082] 8. Link

[0083] Links can include hard links and symbolic links.

[0084] A hard link is considered an independent file in the file system, while a soft link is similar to a text file containing a path to a file. Both types of links can be created in different directories, thus enabling access to the same file in multiple storage locations.

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

[0086] The electronic devices in the trust ring form a local area network through near field communication, and data can be synchronized through the local area network. For example, files can be synchronized between electronic devices in the trust ring.

[0087] See also Figure 1 , Figure 1 A schematic diagram of a system architecture applicable to the file synchronization method shown in the embodiment of the present application. Figure 1 As shown, electronic device 100, electronic device 200 and electronic device 300 establish a trust relationship through trusted authentication to form a trust ring. It should be understood that the number of electronic devices included in the trust ring may be more or less than Figure 1 The number of electronic devices shown is subject to actual needs and is not limited.

[0088] In the embodiment of the present application, the electronic device 100, the electronic device 200 and the electronic device 300 can be a master device and a trusted electronic device to each other.

[0089] For example, the electronic device 100 is a mobile phone, the electronic device 200 is a tablet computer, and the electronic device 300 is a laptop computer. For example, when the mobile phone initiates a synchronization request to the tablet computer and the laptop computer, and applies to synchronize the files in the mobile phone to the tablet computer and the laptop computer, the mobile phone is the main device, and the tablet computer and the laptop computer are trusted electronic devices. For another example, when the mobile phone and the tablet computer initiate a synchronization request to the laptop computer, and apply to synchronize the files in the mobile phone and the tablet computer to the laptop computer, the mobile phone and the tablet computer are the main devices, and the laptop computer is the trusted electronic device. This is only an exemplary description and is not limited to this.

[0090] See also Figure 2 , Figure 2 FIG. 1 is another schematic diagram of a system architecture applicable to the file synchronization method shown in the embodiment of the present application. Figure 2 As shown, electronic device 100, electronic device 200 and electronic device 400 establish a trust relationship through trusted authentication to form a trust loop. Figure 1 The difference between the trust rings shown is that Figure 2 The electronic device 400 included in the trust ring shown may be a NAS. In an embodiment of the present application, a mobile phone and / or a tablet initiates a synchronization request to the NAS, requesting to synchronize files in the mobile phone and / or a tablet to the NAS. The NAS may also perform cross-end mount access to files, for example, the NAS may transfer and share files to the mobile phone and / or a tablet, and may also access files in the mobile phone and / or a tablet.

[0091] The following describes an application scenario of data synchronization between electronic devices in a trust ring in conjunction with the accompanying drawings.

[0092] The trust ring provided in the embodiment of the present application may include a mobile phone and a NAS, and synchronization of files in a mobile phone to a NAS is used as an example for explanation.

[0093] See also Figure 3 , Figure 3 A schematic diagram of an application scenario of file synchronization shown in an embodiment of the present application.

[0094] For example, open the settings application in the mobile phone, select the "System and Update" option in the display interface corresponding to the settings application, and the mobile phone displays the following: Figure 3 Click the interface shown in (a). Figure 3 In the control 101 in the interface shown in (a), click the "Backup and Restore" option, and the mobile phone displays the following Figure 3 The interface shown in (b).

[0095] exist Figure 3The interface shown in (b) shows a variety of data backup and recovery methods, such as cloud backup, external storage, mobile assistant, etc. Among them, cloud backup can be used to back up the entire data of the mobile phone to the cloud server. If necessary, the entire data stored in the cloud server can also be restored to the mobile phone through cloud backup. The entire data can include gallery, contacts, text messages, call logs, memos, input methods, harassment blocking, wireless local area network (WLAN) settings, scenario intelligence, mobile phone housekeeper, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat history, browsing history, etc.

[0096] External storage is used to connect to external storage devices to back up and restore data. External storage devices may include external memory cards, Universal Serial Bus (USB) storage devices, NAS, etc.

[0097] Mobile Assistant is used to connect to a computer to back up and restore data.

[0098] In the embodiment of the present application, the files in the mobile phone are backed up to the NAS by means of external storage. It is worth noting that synchronization is also a backup method, and the present application also refers to synchronizing the files in the mobile phone to the NAS. In addition, it is also worth noting that the files and data in the present application refer to the same content, that is, the files in the mobile phone may include gallery, contacts, text messages, call logs, memos, input methods, harassment blocking, wireless local area networks (WLAN) settings, scenario intelligence, mobile phone housekeeper, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat records, browsing history, etc.

[0099] See also Figure 4 and Figure 5 , Figure 4 This is a schematic diagram of backing up data based on external storage shown in an embodiment of the present application. Figure 5 This is a schematic diagram of the data backup process shown in an embodiment of the present application.

[0100] For example, click Figure 3 In the interface shown in (b), the control 102 is clicked, that is, the "external storage" option is displayed on the mobile phone. Figure 4 The interface shown in (a) in the figure. Figure 4The interface shown in (a) shows the identification information of various external storage devices, such as external storage card, USB storage, shared folder, etc. Among them, the external storage card is used to back up the data in the mobile phone to the external storage card when the external storage card is detected; the USB storage is used to back up the data in the mobile phone to the USB when connected to the USB; the shared folder is used to back up the data in the mobile phone to the home NAS device when the shared folder in the same network is scanned and found.

[0101] In this example, a shared folder is used to back up the data in the mobile phone to the NAS. Figure 4 In the interface shown in (a), the control 103 is clicked, that is, the "share folder" option is displayed on the mobile phone. Figure 4 At this time, the mobile phone discovers the NAS storage device in the same network through WLAN scanning, or the mobile phone discovers the NAS storage device in the trusted circle. After the NAS storage device appears, the user can click to access and add the shared folder under the NAS storage device.

[0102] For example, click Figure 4 In the interface shown in (c), the control 104 is clicked, that is, the "Device Name" option is displayed on the mobile phone. Figure 5 The interface shown in (a) in the figure. Figure 5 In the interface shown in (a), the device name of the NAS storage device, the storage space used by the NAS storage device (1.58 TB used) and the total storage space (eg, 3.92 TB) are displayed.

[0103] exist Figure 5 In the interface shown in (a), an automatic backup control 105, a switch control 106, and a backup data item selection control 107 are also displayed. The switch control 106 is used to turn on or off the automatic backup function. Figure 5 (a) shows the scenario where the automatic backup function is enabled.

[0104] For example, when the automatic backup function is turned on, the user can set the automatic backup cycle according to the needs, for example, automatic backup every other day when the phone screen is off, automatic backup every seven days when the phone screen is off, etc.

[0105] The Select Backup Data Items control 107 is used by the user to select the data items that need to be backed up. Figure 5 In the interface shown in (a), select the backup data item control 107, that is, click the "automatically backup data item" option, and the mobile phone displays the following Figure 5 The interface shown in (b).

[0106] exist Figure 5In the interface shown in (b), a select all control 108 and a start backup control 109 are displayed. By checking the select all control 108, all data items to be backed up can be selected with one click, such as Figure 5 The data items shown in (b) are music, pictures, videos, contacts, documents, system settings, etc. It should be understood that this is only an exemplary description, and the user can also check one or more data items to be backed up according to their own needs.

[0107] After selecting the data items to be backed up, click Figure 5 In the interface shown in (b), click the "Start backup" option, and the mobile phone displays the following Figure 5 The mobile phone performs data preparation processing, such as calculating the number of items and data size corresponding to each data item to be backed up, and displays it in Figure 5 In the interface shown in (c) in the figure. When the data is prepared, the mobile phone starts to back up the data, that is, back up the data items selected by the user in the mobile phone to the NAS, or synchronize the files selected by the user in the mobile phone to the NAS.

[0108] In an embodiment of the present application, a distributed management service is used to manage each electronic device within the trust ring, so that data can be stored and accessed between different electronic devices (such as mobile phones, tablets, laptops, NAS, etc.) and different operating systems (such as Android system, IOS operating system, Symbian operating system, BlackBerry operating system, Linux operating system, Windows operating system, etc.), realizing cross-device and cross-system data storage and access, and opening up a data access channel for near-field communication between electronic devices.

[0109] The application scenario of file synchronization is described above in combination with user operations. The specific process of file synchronization between electronic devices in a trust ring is described below in combination with the accompanying drawings.

[0110] The trust ring provided in the embodiment of the present application may include a mobile phone and a personal computer (PC). The PC may include a desktop computer, a laptop computer, a small laptop computer, a tablet computer, and an ultrabook, etc. Synchronizing files in a mobile phone to a tablet computer is used as an example for explanation.

[0111] See also Figure 6 , Figure 6 A schematic diagram of a file synchronization process shown in an embodiment of the present application.

[0112] S101. The trusted ring application obtains a file synchronization request and calls a file synchronization SDK.

[0113] Trusted ring applications refer to applications in electronic devices within the trusted ring. Users can enable or disable functions such as file backup and file synchronization through trusted ring application settings.

[0114] In an embodiment of the present application, the trust ring application may include file management applications, setting applications, near-field transmission applications, gallery applications, third-party file synchronization applications, multimedia applications, social applications, network applications, educational applications, etc.

[0115] The file synchronization SDK is pre-integrated in the trusted ring application, making it easy for the trusted ring application to create shared directories / shared folders by calling the file synchronization SDK.

[0116] The file synchronization request is used to request that a file in the electronic device to which the trusted ring application belongs be synchronized to at least one trusted electronic device included in the trusted ring. For example, the electronic device to which the trusted ring application belongs is a mobile phone, and the trusted electronic device included in the trusted ring is a tablet computer. The file synchronization request is used to request that a file in the mobile phone be synchronized to the tablet computer.

[0117] The file synchronization request can be triggered by the electronic device to which the trusted ring application belongs, or by a trusted electronic device. For example, the trusted ring application installed on the mobile phone receives the user's operation to turn on the file synchronization function, triggering the file synchronization request. Alternatively, the trusted electronic device initiates a file synchronization request to the electronic device to which the trusted ring application belongs, and the electronic device to which the trusted ring application belongs receives the file synchronization request, such as a tablet computer initiating a file synchronization request to a mobile phone, and the mobile phone receives the file synchronization request.

[0118] Exemplarily, when the trusted ring application obtains a file synchronization request, the file synchronization SDK is called using the pre-written code in the trusted ring application.

[0119] S102: The file synchronization SDK calls the file synchronization service module to create a shared directory / shared folder.

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

[0121] In the embodiment of the present application, the shared directory can be represented by a REPO directory, and the electronic devices in the trust ring can share the REPO directory. The REPO directory may include information such as the file path, the scan start time, the scan time interval, the REPO identification information, the electronic device name, the file synchronization configuration information, and the callback function of the file path.

[0122] The file path refers to the path corresponding to the file to be synchronized, that is, the path where the file to be synchronized to the trusted electronic device is located. For example, if a user wants to synchronize pictures on a mobile phone to a tablet computer, he selects the path corresponding to the gallery on the mobile phone, or selects the directory corresponding to the gallery on the mobile phone. The selected path or directory is the file path.

[0123] The scanning start time is the time when the electronic device starts scanning the file path. Usually, the time when the electronic device first starts scanning the file path is determined according to the time when the user first sets up the file synchronization function. For example, when the user first sets up the file synchronization function, if he selects to start synchronizing files immediately, then the electronic device immediately starts scanning the file path, that is, the scanning start time is the time when the user turns on the file synchronization function.

[0124] The time when the electronic device starts scanning the file path for a non-first time is determined according to the file synchronization cycle set by the user, that is, according to the scanning time interval. For example, the user sets to automatically synchronize files every other day, or every seven days, etc., then, after the electronic device scans the file path for the first time, it scans the file path every other day, or every seven days, etc.

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

[0126] The file synchronization configuration information may include the number of file synchronizations, 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, the filter file, and the like.

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

[0128] The REPO identification information of the trusted electronic device is the ID of the REPO of the trusted electronic device, which is used to uniquely identify the REPO of the trusted electronic device. Exemplarily, 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 synchronize files.

[0129] The file path of the trusted electronic device refers to the path where the files to be synchronized are stored, that is, the path where the files synchronized from the electronic device are stored. For example, if a user wants to synchronize pictures on a mobile phone to a specified path in a tablet computer, the specified path is the file path of the trusted electronic device.

[0130] Filter files refer to files that do not need to be synchronized. In the embodiment of the present application, the filter files may not be scanned, which can reduce the power consumption of the electronic device, effectively reduce the time of scanning files during file synchronization, and improve the efficiency of file synchronization.

[0131] Exemplarily, the file synchronization SDK calls the file synchronization service module, so that the file synchronization service module uses the application programming interface (API) function or method provided by the file synchronization SDK to create a shared directory / shared folder, such as creating a REPO directory.

[0132] S103: The file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0133] Data persistence refers to the 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.

[0134] In the embodiment of the present application, the REPO directory can be stored in a local database of the mobile phone that can be persisted. 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 to ensure that the relevant information of the REPO directory will not be lost. For the user, only the relevant information of the file synchronization function needs to be set once, and it can be used all the time, without having to reset the relevant information of the file synchronization function every time the mobile phone is restarted or the trusted ring application is restarted, which improves the user experience.

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

[0136] This method of creating a REPO directory in an electronic device in advance is conducive to the electronic devices in the subsequent trust ring directly using the REPO directory for file synchronization, thereby improving the efficiency of file synchronization.

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

[0138] S201: A trusted ring application in a trusted electronic device obtains a file synchronization request and calls a file synchronization SDK.

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

[0140] S203: The file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0141] For the description of steps S201 to S203 , reference may be made to the specific description of steps S101 to S103 above, which will not be repeated here.

[0142] The above steps S201 to S203 describe a scenario in which a trusted electronic device (such as a tablet computer) creates a shared directory / shared folder, such as a REPO directory, when a file synchronization request is obtained. In a possible implementation, the trusted electronic device (such as a tablet computer) may 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.

[0143] This method of creating a REPO directory in a trusted electronic device in advance is conducive to the subsequent electronic devices in the trust ring directly using the REPO directory for file synchronization, thereby improving the efficiency of file synchronization.

[0144] S104. Share the REPO directory with trusted electronic devices.

[0145] Exemplarily, the electronic device (such as a mobile phone) determines the files to be synchronized according to the file synchronization request, scans the file path in the electronic device (such as a mobile phone) based on the files to be synchronized, and records the file synchronization version for each scanning result.

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

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

[0148] S105. Synchronize REPO directory metadata with the trusted electronic device.

[0149] Metadata is used to describe data attributes. REPO directory metadata refers to the file path, scan start time, scan time interval, REPO identification information, electronic device name, file synchronization configuration information, etc. included in the REPO directory.

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

[0151] S106: The file synchronization service module monitors the file system.

[0152] The file synchronization service module may include a monitoring and scanning management module, which is used to monitor and scan the file system in the electronic device (such as a mobile phone).

[0153] Exemplarily, the mobile phone determines the file to be synchronized according to the file synchronization request, and monitors and scans the file path of the file to be synchronized in the file system. For example, if the user wants to synchronize pictures on the mobile phone to the tablet computer, the path corresponding to the gallery on the mobile phone is monitored and scanned.

[0154] When changes are detected in the files to be synchronized, such as addition, deletion, modification, etc., the changes are notified to the file synchronization service module.

[0155] For example, if the file to be synchronized is a picture, any change in the picture in any application related to the picture will affect the file to be synchronized. For example, if a picture is added, deleted, or modified in a camera application, a social application, or a sharing application, the corresponding change will be notified to the file synchronization service module.

[0156] The file synchronization service module generates a file change record according to the changes in the file, and performs data persistence processing on the file change record. Among them, the file change record may include operations such as adding, deleting, and modifying the file, as well as the operation time corresponding to each operation.

[0157] Exemplarily, the file change record is stored in a local database of the mobile phone that can be persisted, so that even if the mobile phone is restarted, or the trusted ring application is restarted, or any application related to the file to be synchronized is restarted, the file change record can be read from the local database.

[0158] S107: The file synchronization service module reads the file change record from the local database.

[0159] Exemplarily, the file synchronization service module periodically reads the file change record from the local database according to the file synchronization period set by the user. For example, each time the electronic device monitors and scans the file system, the file synchronization service module reads the file change record from the local database.

[0160] S108: Synchronize file metadata with the trusted electronic device.

[0161] File metadata refers to information such as the file name, the electronic device it belongs to, file size, file addition time, file deletion time, and file modification time.

[0162] File metadata synchronization can be understood as an electronic device (such as a mobile phone) synchronizing file metadata with a trusted electronic device (such as a tablet). In this implementation, the file metadata is first synchronized with the trusted electronic device, and the file content can be synchronized directly afterwards, which improves the efficiency of file synchronization and is less prone to errors.

[0163] It should be understood that the electronic device and the trusted electronic device perform file metadata synchronization processing. 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 its own file metadata. Figure 6As shown, the comparison method specifically includes:

[0164] S204: The trusted electronic device performs file metadata comparison processing.

[0165] Comparison Processing is a data analysis technique used to identify differences and similarities between file metadata sent by an electronic device and file metadata of a trusted electronic device.

[0166] For example, the tablet computer uses the file synchronization service module to compare the file metadata in its own file system with the file metadata sent by the mobile phone one by one. If the comparison results are consistent, the file metadata recorded in the tablet computer is maintained; if the comparison results are inconsistent, the file metadata sent by the mobile phone is used as the standard, that is, the file metadata in the tablet computer is modified to the file metadata sent by the mobile phone.

[0167] In this implementation, the file metadata in the electronic device is first synchronized with the file metadata in the trusted electronic device, and the file content can be directly synchronized subsequently, which improves the efficiency of file synchronization and is less prone to errors.

[0168] 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.

[0169] S109: Synchronize the file content with the trusted electronic device.

[0170] 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.

[0171] Exemplarily, 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. Accordingly, the trusted electronic device needs to save the file content sent by the electronic device. Figure 6 As shown, the saving method specifically includes:

[0172] S205: The trusted electronic device writes the file content to a disk.

[0173] File dropping usually refers to writing data from a temporary storage area to a permanent storage device. In an embodiment of the present application, the trusted electronic device saves the file content sent by the electronic device to a 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 a file system, and then saves the file content in the file system to a local database. In this way, even if the trusted electronic device is restarted, or the trusted ring application is restarted, it will not affect the synchronized files, and the synchronized files can still be read from the local database.

[0174] It is worth noting that the above description of the specific process of file synchronization between electronic devices in the trust ring is based on the example of synchronizing files in a mobile phone to a tablet computer, so the description is mainly based on the method performed on the mobile phone side. It is understandable that when it is necessary to synchronize files in a tablet computer to a 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.

[0175] It is understandable that in the embodiments of the present application, although the Android operating system is used as an example for description, its basic principles are also applicable to electronic devices based on operating systems such as IOS, Symbian, Black Berry, Linux, and Windows.

[0176] In an embodiment of the present application, the file synchronization SDK integrated in the trust ring application configures the file synchronization capability for the trust ring application, and the file synchronization service module provides core services for file synchronization between electronic devices in the trust ring. Exemplarily, the file synchronization service module completes the perception of file changes and the generation of file metadata by monitoring and scanning the local file system. At the same time, the trust ring self-discovery and self-organizing networking capabilities provided by the system enable electronic devices to quickly discover surrounding devices, realize REPO directory sharing, REPO metadata synchronization, file metadata synchronization, and file content synchronization between electronic devices and trusted electronic devices in the trust ring, realize cross-device and cross-system data storage and access, and open up data access channels for near-field communication between electronic devices.

[0177] In the related art, when files are synchronized between electronic devices within a trusted ring, if at least two different directories in the electronic device need to synchronize the same file from the trusted electronic device, or in other words, the same file in the source device (i.e., the trusted electronic device) needs to be synchronized to different directories in the electronic device. Normally, the trusted electronic device will send the same file to the electronic device at least twice, that is, the trusted electronic device sends the same file to different directories in the electronic device. However, in the process of file synchronization, each time a file is sent across devices, the file needs to be verified. The trusted electronic device sends the same file to the electronic device multiple times, which means that the same file needs to be verified multiple times, resulting in a complex and cumbersome file transfer process. Repeated transmission of the same file will increase the use of network bandwidth and processing time, which will not only affect the synchronization of other files, but also reduce the efficiency of file synchronization. And repeated transmissions will also increase the power consumption of electronic devices and trusted electronic devices, increase the risk of data leakage, and reduce the security of file synchronization.

[0178] For easier understanding, see Figure 7 , Figure 7 A schematic diagram of file transfer shown in an embodiment of the present application.

[0179] like Figure 7 As shown, the source side indicates the side where the source file is located, that is, the source side is the side that sends the file to be synchronized, and the target side is the side that receives the file to be synchronized. In the embodiment of the present application, device A indicates the source side, and device B indicates the target side. Device A includes a Repo2 directory and a Repo1 directory. The Repo2 directory is a subdirectory of the Repo1 directory. Accordingly, the Repo1 directory is the parent directory of the Repo2 directory. The storage space corresponding to the Repo2 directory is used to store the source file (i.e., the file to be synchronized, i.e., the same file mentioned above).

[0180] Device B includes Repo1 directory and Repo2 directory. It is worth noting that Repo1 directory and Repo2 directory in device B correspond to different file paths. The storage space corresponding to Repo1 directory in device B is used to store the to-be-synchronized file sent by device A (i.e., the same file mentioned above), and the storage space corresponding to Repo2 directory in device B is also used to store the to-be-synchronized file sent by device A (i.e., the same file mentioned above).

[0181] The Repo1 directory in device A is directly mapped to the Repo1 directory in device B, and the Repo2 directory in device A is directly mapped to the Repo2 directory in device B. File 1 in device A belongs to both the Repo1 directory and the Repo2 directory in device A.

[0182] In a file synchronization scenario, device A and device B establish a trust relationship through trusted authentication to form a trust loop. File 1 in the Repo2 directory of device A needs to be synchronized / backed up to the Repo1 directory and Repo2 directory of device B, or in other words, both the Repo1 directory and the Repo2 directory in device B need to synchronize / back up file 1 from the Repo2 directory of device A. In this application scenario, in the related technology, device A usually sends file 1 in the Repo2 directory to device B twice. For example, device A first sends file 1 in the Repo2 directory to the Repo1 directory in device B, and then device A sends file 1 in the Repo2 directory to the Repo2 directory in device B.

[0183] In this processing method, File 1 is transferred across devices twice, and File 1 needs to be verified each time it is transferred, which makes the file transfer process complicated and cumbersome. Repeated transmission of File 1 will increase the use of network bandwidth and processing time, which will not only affect the synchronization of other files, but also reduce the efficiency of file synchronization. In addition, repeated transmission will increase the power consumption of electronic devices and trusted electronic devices, increase the risk of data leakage, and reduce the security of file synchronization.

[0184] In view of this, an embodiment of the present application provides a file synchronization method, which is applied to an electronic device, and the trust ring in which the electronic device is located also includes at least one trusted electronic device. The method includes: determining that at least two directories in the electronic device synchronize the same file from at least one trusted electronic device; any directory requests to obtain the same file from at least one trusted electronic device; any directory is any one of the at least two directories; any directory sends the obtained same file to other directories, and the other directories are directories of the at least two directories except any one of the directories.

[0185] 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. During the entire file synchronization process, for the electronic device and the trusted electronic device, the same file is only transmitted across devices once, and the entire file transfer process is simple and convenient. Due to the small number of file transfers, the use of network bandwidth and processing time are reduced, while reducing the power consumption of the electronic device and the trusted electronic device, the efficiency of file synchronization is also improved. Reducing the number of file transfers can also reduce the risk of data leakage and improve the security of file synchronization.

[0186] Moreover, any directory in an electronic device sends the same file to other directories in the electronic device. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, which improves the reliability of transmission. Moreover, when performing file operations in the same electronic device, 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.

[0187] The file synchronization method provided in the embodiment of the present application is described below in conjunction with the flow chart.

[0188] See also Figure 8 , Figure 8 The following is a flowchart of a file synchronization method according to an embodiment of the present application. The method includes:

[0189] S301: Determine that at least two directories in an electronic device synchronize the same file from at least one trusted electronic device.

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

[0191] The storage space corresponding to the directory in the electronic device is used to store the files to be synchronized, that is, to store the same file sent by the trusted electronic device.

[0192] The hierarchical structure of the directory can be represented by a file path. At least two directories in the electronic device are different, that is, at least two directories in the electronic device correspond to different file paths.

[0193] In one example, it is determined based on a file synchronization request that at least two directories in an electronic device synchronize the same file from at least one trusted electronic device. The electronic device triggers a file synchronization request, and the file synchronization request is used to request the trusted electronic device to send the file to be synchronized to the electronic device. For example, a user wants to synchronize pictures on a trusted electronic device (such as a mobile phone) to two different directories of an electronic device (such as a tablet computer), and initiates a file synchronization request through the electronic device (such as a tablet computer). The file synchronization request may include identification information of the files to be synchronized in each directory, the requested file content, and the file path of the files to be synchronized. Among them, the pictures are the files to be synchronized.

[0194] By comparing the identification information of the file to be synchronized in each directory, the requested file content, and the file path of the file to be synchronized, it can be determined whether at least two directories in the electronic device are to synchronize the same file from the trusted electronic device. It should be understood that when it is determined that at least two directories in the electronic device are to synchronize the picture from the trusted electronic device, the picture is the same file.

[0195] In another example, a list of files to be synchronized may be obtained, the list of files to be synchronized including files to be synchronized in each directory respectively, and the files to be synchronized in each directory respectively are compared. When the files to be synchronized in each directory respectively are consistent, it is determined that at least two directories in the electronic device need to synchronize the same file from the trusted electronic device.

[0196] For easier understanding, see Fig. 9 , Fig. 9 Another file transfer schematic diagram shown in an embodiment of the present application.

[0197] like Fig. 9 As shown, the source side indicates the side where the source file is located, that is, the source side is the side that sends the file to be synchronized, that is, the side where the same file is located. The target side is the side that receives the file to be synchronized, that is, the side that receives the same file. In the embodiment of the present application, device A can be a trusted electronic device, and device B can be an electronic device. A trust relationship is established between device A and device B through trusted authentication to form a trust loop.

[0198] In a file synchronization scenario, file 1 in the Repo2 directory of device A is determined according to a file synchronization request or a list to be synchronized, and needs to be synchronized / backed up to the Repo1 directory and the Repo2 directory of device B. In other words, both the Repo1 directory and the Repo2 directory of device B need to synchronize / back up file 1 from the Repo2 directory of device A.

[0199] Optionally, in a possible implementation, the subdirectory where the same file in the trusted electronic device is located is directly mapped to one of the at least two directories of the electronic device, and the parent directory where the same file in the trusted electronic device is located is directly mapped to the other of the at least two directories of the electronic device. Fig. 9 As shown, the Repo1 directory in device A is directly mapped to the Repo1 directory in device B, and the Repo2 directory in device A is directly mapped to the Repo2 directory in device B.

[0200] Optionally, in a possible implementation, the directories to which the same file in the trusted electronic device belongs have an inclusion relationship, or in other words, the file paths corresponding to the directories to which the same file in the trusted electronic device belongs have an inclusion relationship. Fig. 9As shown, file 1 in device A belongs to both the Repo1 directory and the Repo2 directory in device A. The Repo2 directory in device A is a subdirectory of the Repo1 directory, and the Repo1 directory is the parent directory of the Repo2 directory. Accordingly, the file path corresponding to the Repo2 directory in device A is a subfile path of the file path corresponding to the Repo1 directory, and the file path corresponding to the Repo1 directory is the parent file path of the file path corresponding to the Repo2 directory. In this case, synchronizing / backing up the same file in the subdirectory of the trusted electronic device to different directories in the electronic device can better ensure the security of the same file.

[0201] S302: Any directory requests to obtain the same file from at least one trusted electronic device.

[0202] Any directory is any one of at least two directories.

[0203] In one example, a directory is randomly selected from at least two directories, and a file synchronization request is initiated to a trusted electronic device through the randomly selected directory. The file synchronization request is used to trigger the trusted electronic device to send the same file to the directory where the electronic device initiates the file synchronization request, that is, to any of the directories.

[0204] The file synchronization request may include the identification information of the file, the requested file content, the file path, and the specified storage location, etc. Among them, the specified storage location refers to the location in the electronic device used to store the same file, such as any directory. It is worth noting that the actual storage of the file content is the storage space corresponding to the directory, that is, the file content of the same file is actually stored in the storage space corresponding to any directory. For the convenience of description in the embodiments of the present application, in some application scenarios, it is described as being stored in a directory, or as being described as the specified storage location being a directory.

[0205] The trusted electronic device scans the file system according to the identification information of the file, the requested file content and the file path, obtains the same file, and then sends the same file to any directory of the electronic device according to the designated storage location.

[0206] Combination Fig. 9 For illustration, for example, the Repo1 directory is selected from the Repo1 directory and the Repo2 directory of device B, and a file synchronization request is initiated to device A through the Repo1 directory in device B. Device A scans the file system according to the file synchronization request to obtain file 1 under the Repo2 directory. Device A sends file 1 to the Repo1 directory of device B.

[0207] In another example, each directory corresponds to a file synchronization request, the file synchronization request of any directory is retained, the file synchronization requests corresponding to the other directories except any directory in at least two directories are deleted, and the file synchronization request is initiated to the trusted electronic device through any directory. The trusted electronic device scans in its file system according to the identification information of the file, the requested file content, and the file path, etc., obtains the same file, and then sends the same file to any directory of the electronic device according to the specified storage location.

[0208] In this implementation, deleting the file synchronization requests corresponding to other directories can ensure that only one directory initiates a file synchronization request to the trusted electronic device, avoiding other directories from repeatedly initiating file synchronization requests, and providing a guarantee for reducing the number of cross-device transmissions.

[0209] S303: Any directory sends the same acquired file to other directories.

[0210] The other directories are directories other than any one of the at least two directories.

[0211] In one example, a link corresponding to the same file is created, and the link is used to point to the same file. Any directory sends the link corresponding to the same file to other directories. For example, any directory sends the link corresponding to the same file to other directories through a move command. For another example, a cut-and-paste operation is performed on the link corresponding to the same file in any directory, and a paste operation is performed in other directories to move the link corresponding to the same file to other directories.

[0212] In another exemplary embodiment, any directory copies the obtained same file to other directories. For example, when the number of other directories is one, copy the same file in any directory, and send the copied same file to the other directory through a move command. When the number of other directories is multiple, you can first copy the same number of multiple identical files in any directory, and send the copied multiple identical files to each other directory through a move command; you can also first copy one identical file in any directory, send the copied identical file to one other directory through a move command, and then copy another identical file in any directory, and send the copied identical file to another other directory through a move command, and so on.

[0213] 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. During the entire file synchronization process, for the electronic device and the trusted electronic device, the same file is only transmitted across devices once, and the entire file transfer process is simple and convenient. Due to the small number of file transfers, the use of network bandwidth and processing time are reduced, while reducing the power consumption of the electronic device and the trusted electronic device, the efficiency of file synchronization is also improved. Reducing the number of file transfers can also reduce the risk of data leakage and improve the security of file synchronization.

[0214] Moreover, any directory in an electronic device sends the same file to other directories in the electronic device. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, which improves the reliability of transmission. Moreover, when performing file operations in the same electronic device, 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.

[0215] Optionally, in a possible implementation, when the same file in the trusted electronic device changes, any directory will be triggered to request to obtain the changed same file from the trusted electronic device, and when the changed same file is obtained, the changed same file will be sent to other directories. In this implementation, timely synchronization of updated files can ensure that the files in all directories are the latest, thereby improving the consistency of file synchronization.

[0216] Optionally, in a possible implementation, the above step S301 may also include step S3011 and step S3013, as follows.

[0217] See also Fig.10 , Fig.10 This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0218] S3011. Obtain a list of files to be synchronized.

[0219] Exemplarily, the list of files to be synchronized may include files to be synchronized corresponding to at least two directories respectively, and each file to be synchronized may include a file name, a file path, a file size, a creation date, a last modification time, a file type, a file version, etc.

[0220] In the embodiment of the present application, the aforementioned created REPO directory may include a list of files to be synchronized, and the list of files to be synchronized is directly obtained from the REPO directory.

[0221] S3012. Compare the files to be synchronized corresponding to at least two directories.

[0222] Exemplarily, the information such as the file name, file path, file size, creation date, last modification time, file type, file version, etc. of the files to be synchronized corresponding to at least two directories are compared one by one.

[0223] Combination Fig. 9 To illustrate, for example, the file name, file path, file size, creation date, last modification time, file type, and file version of file 1 corresponding to the Repo1 directory of device B are compared with the file name, file path, file size, creation date, last modification time, file type, and file version of file 1 corresponding to the Repo2 directory of device B.

[0224] S3013: When the to-be-synchronized files corresponding to the at least two directories are consistent, determine that the at least two directories synchronize the same file from at least one trusted electronic device.

[0225] Exemplarily, when the comparison result shows that the to-be-synchronized files corresponding to at least two directories are inconsistent, it is determined that the files synchronized from the trusted electronic device by the at least two directories are inconsistent. In this scenario, these directories need to initiate file synchronization requests to the trusted electronic device respectively, so as to obtain the files required by these directories from the trusted electronic device through the file synchronization requests sent by each.

[0226] When the comparison result shows that the files to be synchronized corresponding to at least two directories are consistent, it is determined that at least two directories synchronize the same file from at least one trusted electronic device. Afterwards, any one of the at least two directories requests to obtain the same file from the trusted electronic device, and any one of the at least two directories sends the obtained same file to the other directory.

[0227] In this implementation, the to-be-synchronized files corresponding to at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0228] Optionally, in one possible implementation, a list of files to be synchronized corresponding to at least two directories is obtained, each list of files to be synchronized includes the files to be synchronized corresponding to each directory, and each file to be synchronized may include the file name, file path, file size, creation date, last modification time, file type, file version, etc.

[0229] Traverse the to-be-synchronized file list corresponding to each directory to determine whether the to-be-synchronized files corresponding to at least two directories are consistent. When it is detected that the to-be-synchronized files corresponding to at least two directories are consistent, determine that at least two directories synchronize the same file from at least one trusted electronic device.

[0230] In this implementation, the to-be-synchronized file list corresponding to each directory is traversed, which can avoid the situation where the to-be-synchronized file list corresponding to each directory is different, and ensure that subsequent synchronization operations can be performed correctly.

[0231] Optionally, in a possible implementation, the above step S3012 may also include step S30121 and step S30122, as follows.

[0232] See also Fig.11 , Fig.11 This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0233] S30321. Obtain metadata of files to be synchronized corresponding to at least two directories.

[0234] The metadata of the file to be synchronized is used to describe the name of the file to be synchronized, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read-write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file is a hidden file, a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative path, etc.

[0235] Exemplarily, metadata of the files to be synchronized corresponding to each directory can be obtained by traversing the list of files to be synchronized. For example, a script (such as a Python script, a PowerShell script, etc.) can be used to traverse the list of files to be synchronized and extract metadata of the files to be synchronized corresponding to each directory.

[0236] S30322: When the metadata of the to-be-synchronized files corresponding to at least two directories are consistent, determine that at least two directories synchronize the same file from at least one trusted electronic device.

[0237] Exemplarily, a check value corresponding to each metadata is generated. The check value may include a weak hash value, a strong hash value, a checksum, a Hash-based Message Authentication Code (HMAC), etc.

[0238] For example, the hash value corresponding to each metadata may be calculated by using the MD5 (Message Digest Algorithm 5) algorithm, the SHA-1 (Secure Hash Algorithm 1) algorithm, the SHA-2 (Secure Hash Algorithm 2) algorithm, and the like.

[0239] Among them, the MD5 algorithm and the SHA-1 algorithm can be used to calculate the weak hash value corresponding to each metadata.

[0240] Exemplarily, metadata of the file to be synchronized is obtained, a hash function corresponding to the MD5 algorithm is determined, and the metadata of the file to be synchronized is input into the hash function, which processes the metadata of the file to be synchronized and outputs a weak hash value of a fixed length.

[0241] In this implementation, since the weak hash value calculation is simple and efficient, it can not only ensure the security of the file synchronization process, but also improve the efficiency of subsequent file synchronization and enhance the user experience.

[0242] Optionally, a verification value corresponding to each metadata may be generated by a verification tool (such as md5sum, sha1sum, sha256sum, etc.).

[0243] When it is detected that the check values ​​corresponding to at least two directories are consistent, it is determined that the at least two directories synchronize the same file from at least one trusted electronic device.

[0244] Combination Fig. 9 To illustrate, exemplarily, obtain the metadata of file 1 corresponding to the Repo1 directory of device B, and the metadata of file 1 corresponding to the Repo2 directory. Generate a check value for the metadata of file 1 corresponding to the Repo1 directory, and a check value for the metadata of file 1 corresponding to the Repo2 directory. When the two check values ​​are consistent, it is determined that both the Repo1 directory and the Repo2 directory of device B synchronize file 1 from device A.

[0245] In this implementation, metadata of the files to be synchronized corresponding to at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0246] Optionally, in a possible implementation, the above step S302 may also include step S3021 and step S3022, as follows.

[0247] See also Fig.12 , Fig.12This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0248] S3021. Any directory initiates a file synchronization request to at least one trusted electronic device.

[0249] Exemplarily, the file synchronization request is used to trigger at least one trusted electronic device to send the same file to any directory of the electronic device. The file synchronization request may include identification information of the file, requested file content, file path, and designated storage location, etc.

[0250] For example, a file synchronization request is initiated to device A through the Repo1 directory in device B. Device A scans the file system and obtains file 1 under the Repo2 directory according to the file synchronization request. Device A sends file 1 to the Repo1 directory of device B.

[0251] S3022. Mark other directories to synchronize the same file with any directory.

[0252] Optionally, in an embodiment of the present application, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories may also be marked, for example, marking that the files synchronized in other directories and the any directory are the same.

[0253] In one example, a state file may be created in each directory, and the state file is used to store synchronization state information of each directory, wherein the synchronization state information is used to record synchronization of the same file between the directory and any other directory.

[0254] In another example, the file extension attributes in the metadata of the to-be-synchronized files corresponding to other directories are used for custom tags. The file extension attributes corresponding to other directories can be changed, and the custom tags of the file extension attributes are used to indicate that the to-be-synchronized files to which the metadata belongs are the same as the files to be synchronized in any directory.

[0255] In another example, the file path of other directories is marked, and the marked file path represents that the directory corresponding to it is synchronized with any directory with the same file. For example, the file path can be marked by adding a specific extension or prefix to the file name corresponding to the other directories.

[0256] In this implementation, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after any subsequent directory obtains the same file, it can quickly and accurately send the same file to other marked directories, which can ensure that the files ultimately synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0257] Optionally, in a possible implementation, the above step S303 may also include step S3031 and step S3032, as follows.

[0258] See also Fig.13 , Fig.13 This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0259] S3031. Obtain the file paths of other marked directories.

[0260] In one example, the other marked directories can be determined by detecting the synchronization status information in the status file corresponding to each directory, and the file paths of the other marked directories can be obtained using a command line tool (such as a command prompt, an ls command, etc.).

[0261] In another example, the marked other directories may be determined by detecting the file extension attributes in the metadata of the to-be-synchronized file corresponding to each directory, and then a command line tool may be used to obtain the file paths of the marked other directories.

[0262] In yet another example, the other marked directories may be determined by detecting the file name corresponding to each directory, and then a command line tool may be used to obtain the file paths of the other marked directories.

[0263] S3032. Copy the same file to the file path of other marked directories.

[0264] Exemplarily, when the number of other directories is one, a copy of the same file is made in any directory, and the copied same file is sent to the file path of the marked other directory through a move command.

[0265] When there are multiple other directories, you can first copy the same number of identical files in any directory, and use the move command to send the copied files to the file paths of the marked other directories respectively; you can also first copy an identical file in any directory, and use the move command to send the copied files to the file path of a marked other directory, and then copy another identical file in any directory, and use the move command to send the copied files to the file path of another marked other directory, and so on.

[0266] In this implementation, after any directory in the electronic device obtains the same file to be synchronized, it will copy the same file to the file path of other directories according to the marked file path of other directories. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost, is not easily affected by network fluctuations or external interference, and improves the reliability of transmission. In addition, when performing file operations in the same electronic device, 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.

[0267] When files are synchronized between electronic devices in a trusted ring, if the files that need to be synchronized by the electronic device are stored in at least two trusted electronic devices, or in other words, the files that need to be synchronized by the electronic device are stored in at least two source devices (i.e., trusted electronic devices), then before the file synchronization starts, it is necessary to determine which source device (i.e., trusted electronic device) to synchronize the file from, that is, it is necessary to determine the synchronization source device that is ultimately used for synchronization.

[0268] For easier understanding, see Fig.14 , Fig.14 A schematic diagram of file synchronization shown in an embodiment of the present application.

[0269] like Fig.14 As shown, device A and device B represent source devices (ie, trusted electronic devices), and device C represents a target device (ie, electronic device). Device A and device B are the side that sends the file to be synchronized, and device C is the side that receives the file to be synchronized.

[0270] like Fig.14 As shown, device A includes a Repo1 directory, and the storage space corresponding to the Repo1 directory is used to store source files (i.e., files to be synchronized). Fig.14 In the example, file 1 is used to represent the file. Device B includes the Repo1 directory, and the storage space corresponding to the Repo1 directory is also used to store source files (i.e., files to be synchronized). Fig.14 In the example, file 1 is used to represent it.

[0271] The file 1 corresponding to the Repo1 directory in device A is the same as the file 1 corresponding to the Repo1 directory in device B, and the versions of file 1 are both the latest versions. The Repo1 directory in device A and the Repo1 directory in device B correspond to different file paths, such as Fig.14 File path 1 and file path 2 are shown.

[0272] Since both device A and device B store the latest version of file 1, before file synchronization begins, it is necessary to determine whether to synchronize the file from device A or device B, that is, it is necessary to determine the synchronization source device that will ultimately be used to synchronize file 1 to device C.

[0273] In view of this, an embodiment of the present application also provides a file synchronization method, which is applied to an electronic device, wherein the trust ring in which the electronic device is located also includes at least two trusted electronic devices, and the same synchronization file is respectively stored in at least two trusted electronic devices. The method also includes: calculating a synchronization suitability score for each trusted electronic device according to a preset synchronization strategy; determining a synchronization source device among the at least two trusted electronic devices according to the synchronization suitability score; and obtaining the synchronization file from the synchronization source device.

[0274] In this implementation, according to the preset synchronization strategy, the synchronization suitability score is calculated for the trusted electronic device, and the synchronization source device is determined according to the synchronization suitability score to synchronize files. The most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure that the synchronization operation is more efficient and is conducive to maintaining the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0275] And through automatic scoring based on preset synchronization strategies to select the appropriate synchronization source device, the complexity of manual decision-making is simplified and human errors are reduced.

[0276] The file synchronization method provided in the embodiment of the present application is described below in conjunction with the flow chart.

[0277] See also Fig.15 , Fig.15 The following is a flowchart of a file synchronization method according to an embodiment of the present application. The method includes:

[0278] S401: Obtain influencing factors of each trusted electronic device.

[0279] Two or more electronic devices establish a trust relationship through trusted authentication to form a trust ring. In the embodiment of the present application, the trust ring in which the electronic device is located also includes at least two trusted electronic devices, and at least two trusted electronic devices store files to be synchronized by the electronic devices.

[0280] For example, the same synchronization file is stored in at least two trusted electronic devices respectively, and the versions of the synchronization files in at least two trusted electronic devices are both the latest versions.

[0281] The influencing factors are used to influence the determination of the synchronization source device, that is, the influencing factors are factors used to influence the decision of which trusted electronic device to use as the synchronization source device. Different synchronization source devices have different file synchronization effects, that is, the influencing factors can be used to influence the file synchronization effect between the electronic device and the trusted electronic device.

[0282] The influencing factors may include at least one of power status, device type, network status, device performance, current power consumption of the device, device usage frequency, and user preference.

[0283] Among them, the device types may include NAS, PC, mobile phone, wearable device, augmented reality (AR) / virtual reality (VR) device, TV, personal digital assistant (PDA), etc. PC may include desktop, laptop, small laptop, tablet, netbook, ultrabook, etc.

[0284] The network status may include network bandwidth, network load, network security, etc. Among them, network bandwidth is used to indicate the data transmission rate, usually in bits per second; network load is used to indicate the amount of data transmitted, reflecting the busyness of the network; network security indicates whether the trusted electronic device is currently safe through the operating status of firewalls, intrusion detection systems, intrusion prevention systems, etc.

[0285] Device performance may include processor performance, memory capacity, storage performance, network connection speed, heat dissipation efficiency, operating system performance, multi-tasking capability, stability, etc. Among them, processor performance is reflected by CPU model, number of cores, clock frequency, cache size, instruction set, etc.; storage performance is reflected by hard disk or solid state drive capacity, read and write speed, interface type, etc.; network connection speed is reflected by network interface speed, quality and supported network standards; heat dissipation efficiency is reflected by heat dissipation system design, fan speed, heat dissipation materials, etc.; operating system performance is reflected by startup time, application loading time, system update and maintenance efficiency, etc.; multi-tasking capability is reflected by performance when running multiple applications or processes at the same time; stability is used to indicate the stability of trusted electronic devices under long-term operation or high load.

[0286] Exemplarily, since the electronic device and at least two trusted electronic devices are in the same trust ring, the electronic devices in the trust ring can obtain the power status, device type, network status, device performance, current power consumption of the device, and user preferences of the trusted electronic devices connected to it through the trust ring technology.

[0287] For example, the electronic device obtains the influencing factors of the trusted electronic device by calling the system services and application programming interface (API) between the electronic device and the trusted electronic device.

[0288] Optionally, user preferences may be stored in the user's account settings, and the electronic device may utilize the trust ring to access the user's user preference settings on different electronic devices.

[0289] Optionally, the trusted electronic device may also send the respective influencing factors to the electronic device.

[0290] S402: Determine a synchronization source device among at least two trusted electronic devices according to the influencing factors of each trusted electronic device.

[0291] In an exemplary embodiment, the synchronization source device is determined from at least two trusted electronic devices according to any one of the influencing factors. Any one of the factors may be randomly selected or specified by the user, and this is not limited.

[0292] For example, any one of the factors is a power state, and the power state may include a remaining power. The remaining power of each of the obtained trusted electronic devices is compared, and the trusted electronic device with a larger remaining power is determined as the synchronization source device.

[0293] In another example, the synchronization source device is determined from at least two trusted electronic devices according to any number of influencing factors. The any number of factors may be randomly selected or specified by the user, and there is no limitation on this.

[0294] S403: Synchronize the synchronization file from the synchronization source device.

[0295] The electronic device initiates a file synchronization request to the synchronization source device, and after receiving the file synchronization request, the synchronization source device sends the synchronization file to the electronic device.

[0296] Combination Fig.14 For illustration, illustratively, it is determined that device A is a synchronization source device, and device C initiates a file synchronization request to device A. Device A sends file 1 in the Repo1 directory to the Repo1 directory of device C.

[0297] In this implementation, the influencing factors of each trusted electronic device are taken into consideration, so that the most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operations and help maintain the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0298] And through automatic scoring based on preset synchronization strategies to select the appropriate synchronization source device, the complexity of manual decision-making is simplified and human errors are reduced.

[0299] Optionally, in one possible implementation, determining a synchronization source device among at least two trusted electronic devices based on an influencing factor of each trusted electronic device may include: calculating a synchronization suitability score for each trusted electronic device based on the influencing factor of each trusted electronic device; and determining a synchronization source device among at least two trusted electronic devices based on the synchronization suitability score of each trusted electronic device.

[0300] Exemplarily, a scoring strategy is set in advance for each of the influencing factors, and the scoring strategy may include a scoring interval and a scoring rule. For example, the scoring range for the power status is 0 to 100 points, and the scoring rule is that the power level is greater than 80% is 100 points, the power level is greater than 40% and less than or equal to 80% is 50 points, and the power level is less than or equal to 40% is 0 points; the scoring range for the device type is 0 to 80 points, and the scoring rule is that the device type is 80 points for NAS, 60 points for PC, 40 points for PAD, and 20 points for mobile phone; the scoring range for the network status is 0 to 100 points, and the scoring rule is that the network status is a strong network connection status (such as low latency and high speed) is 100 points, the network status is a medium network connection status is 50 points, and the network status is a weak network connection status (such as high latency and low speed) is 10 points; the scoring range for the frequency of device use is 1 to 50 points, and the scoring rule is that frequent use is 50 points, occasional use is 25 points, and rarely used is 0 points, etc. This is only an exemplary explanation and is not limited to this.

[0301] For example, for each trusted electronic device, the influencing factors of the trusted electronic device are obtained, the score of each factor is calculated according to the scoring strategy corresponding to each factor, and then the sum of the scores corresponding to each factor is calculated to obtain the synchronization suitability score of each trusted electronic device.

[0302] In this implementation, the synchronization suitability score is calculated for the trusted electronic device, and the synchronization source device is determined according to the synchronization suitability score to synchronize files. The most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operations and help maintain the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0303] Optionally, on the basis of setting a scoring strategy for each of the influencing factors in advance, a weight value is assigned to each of the influencing factors. The weight value may be determined based on a percentage or may be a fixed value.

[0304] Exemplarily, the score of each factor is calculated according to the scoring strategy, and the score of each factor is weighted by weighted average to calculate the corresponding score of each weighted factor, and then the sum of the weighted scores of each factor is calculated to obtain the synchronization suitability score of each trusted electronic device.

[0305] In this implementation, by assigning different weights to different influencing factors, the accuracy of the final synchronization suitability score can be improved, thereby determining a more suitable synchronization source device.

[0306] Optionally, in a possible implementation, a machine learning model, such as a scoring model, may be pre-trained, and the scoring model may be used to calculate a synchronization suitability score for each trusted electronic device. For example, the influencing factors corresponding to each trusted electronic device are obtained, and each of the influencing factors is input into the scoring model for processing, and the scoring model outputs the synchronization suitability score corresponding to each trusted electronic device.

[0307] In this implementation, the synchronization suitability score corresponding to each trusted electronic device is calculated by using a pre-trained scoring model, which can improve the efficiency and accuracy of calculating the synchronization suitability score, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0308] Optionally, in a possible implementation, when at least two trusted electronic devices are of different device types, determining a synchronization source device among the at least two trusted electronic devices based on an influencing factor of each trusted electronic device may include: determining a priority of each trusted electronic device based on the influencing factor of each trusted electronic device; and determining a synchronization source device among the at least two trusted electronic devices based on the priority of each trusted electronic device.

[0309] Exemplarily, a priority is assigned to each trusted electronic device according to any one or more factors of the influencing factors of each trusted electronic device, and a trusted electronic device with a high priority is determined as a synchronization source device.

[0310] For example, if any one of the factors is the power state, the priority of the trusted electronic device with more remaining power is higher than the priority of the trusted electronic device with less remaining power, the trusted electronic device with more remaining power is assigned the first priority, and the trusted electronic device with less remaining power is assigned the second priority. The first priority is higher than the second priority. The trusted electronic device corresponding to the first priority is determined as the synchronization source device.

[0311] For another example, any number of factors are power status and device type, and each trusted electronic device in the trust ring has a different device type. For example, multiple trusted electronic devices are NAS, PC, PAD, and mobile phone. According to the power status and device type, it is determined that the priority of NAS is higher than PC, the priority of PC is higher than PAD, and the priority of PAD is higher than mobile phone, then the NAS in the trust ring is determined as the synchronization source device.

[0312] Optionally, in a possible implementation, different priorities are determined in advance for trusted electronic devices of different device types based on any one or more of the influencing factors. The device type of each trusted electronic device in the trust ring is obtained, and the trusted electronic device of the device type with a high priority is determined as the synchronization source device. For example, based on the power status and device type, it is determined that the priority of NAS is greater than that of PC, the priority of PC is greater than that of PAD, and the priority of PAD is greater than that of mobile phone. If the device types of multiple trusted electronic devices in the current trust ring are obtained as NAS and PAD, respectively, NAS is determined as the synchronization source device.

[0313] In this implementation, by determining the priority of the device to determine the synchronization source device, resources can be reasonably allocated according to the importance and function of different devices, and a suitable synchronization source device can be selected, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0314] Optionally, if a problem occurs with the synchronization source device, other devices can be automatically identified as backup synchronization source devices to ensure the continuity of the file synchronization operation.

[0315] The file synchronization method provided in the embodiment of the present application is applicable to any scenario requiring file synchronization in near field communication.

[0316] In the process of file synchronization between electronic devices within the trust ring, it is necessary to monitor and scan the files in the electronic devices, or to monitor and scan the file paths / file directories corresponding to the files. When it is necessary to monitor and scan multiple file paths / file directories, even if there is an inclusion relationship between the multiple file paths / file directories, the relevant technology still requires monitoring and scanning each file path / file directory, and each monitoring requires the creation of a corresponding monitoring task, or each monitoring requires the start of a corresponding monitoring thread, resulting in an increase in the number of started monitoring threads and excessive scanning of file paths / file directories, which ultimately leads to low file synchronization efficiency and high power consumption of electronic devices.

[0317] In view of this, an embodiment of the present application also provides a method for processing data, which is applied to an electronic device. The trust ring in which the electronic device is located also includes at least one trusted electronic device. Files in the electronic device can be synchronized to at least one trusted electronic device. The method for processing data includes: obtaining a file synchronization request; determining multiple scanning tasks corresponding to the file synchronization request; determining an associated file path among multiple file paths, and merging the scanning tasks corresponding to the associated file path.

[0318] Among them, the associated file path is a file path with an inclusion relationship; the file path with an inclusion relationship includes at least one child file path and one parent file path, and the scanning result corresponding to the child file path is notified to the scanning task corresponding to the parent file path, that is, the scanning result corresponding to the child file path in the file path with an inclusion relationship will be notified to the parent file path in the file path with an inclusion relationship.

[0319] Optionally, each scanning task corresponds to a file path, and each file path corresponds to a file directory. By scanning the file path, the file pointed to by the file path and the file content of the file can be found.

[0320] Optionally, the scanning task may include monitoring and scanning of a file path.

[0321] In this implementation, after determining the file paths with inclusion relationships, the scanning tasks corresponding to the file paths with inclusion relationships are merged. Since the sub-file paths in the file paths with inclusion relationships have their corresponding scanning results notified to the scanning tasks corresponding to the parent file paths, even if the scanning tasks are merged, it can be ensured that the scanning tasks corresponding to the file paths with inclusion relationships are successfully completed. And since the scanning tasks are merged, in the process of executing the merged scanning tasks, it is possible to avoid multiple scans of the same file path, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0322] Optionally, merging the scanning tasks corresponding to the associated file paths includes: 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 of at least two scanning time intervals, and less than the largest scanning time interval of at least two scanning time intervals. In this implementation, since the scanning tasks are merged, multiple scans of the same file path can be effectively avoided during the execution of the merged scanning tasks, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0323] Optionally, the method for processing data may further include: scanning the file path corresponding to the target scanning task according to the target scanning time interval to obtain a scanned file. The scanned file is used to synchronize to at least one trusted electronic device in the trust ring. In this implementation, other file paths are not considered, and the file path corresponding to the target scanning task is scanned purposefully, which improves the scanning efficiency, thereby speeding up the entire file synchronization process and improving the subsequent file synchronization efficiency.

[0324] Optionally, the method for processing data may further include: obtaining a list to be scanned, scanning each file path in the list to be scanned according to a target scanning time interval, and when any file path in the associated file path is scanned, obtaining a scanning result of any file path; and feeding back the scanning result to a scanning task corresponding to each file path in the associated file path. The list to be scanned includes associated file paths, file paths not associated with scanning tasks, and non-associated file paths associated with scanning tasks. In other words, the list to be scanned includes all file paths.

[0325] In this implementation, when an associated file path is scanned, it can ensure that each scanning task corresponding to the associated file path receives a scanning result notification, which facilitates the subsequent synchronization of the files scanned based on each scanning task to the trusted electronic device, thereby reducing the number of scans and the power consumption of electronic devices while providing a guarantee for the accuracy of file synchronization.

[0326] Optionally, the method for processing data may further include: setting the scanning start time of the target scanning task according to the target scanning time interval; and starting scanning when the current time reaches the scanning start time. In this implementation, the method of setting the scanning start time first and then starting to scan the file path can accurately record the execution time of each scanning operation to avoid scanning errors. And determining the start and end time of each scanning operation helps to reasonably allocate system resources.

[0327] Optionally, feeding back the scan result to the scan task corresponding to each file path in the associated file path includes: adding the scan result to a preset notification list, wherein the notification list is used to feed back the scan result to the scan task corresponding to each file path in the associated file path.

[0328] Optionally, the scan result can be obtained by calling a callback function.

[0329] This implementation method is conducive to the subsequent synchronization of files scanned based on each scanning task to the trusted electronic device, thereby reducing the number of scans and the power consumption of the electronic device while providing a guarantee for the accuracy of file synchronization.

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

[0331] Optionally, the method for processing data may further include: after scanning any file path in the associated file path, deleting the scan result corresponding to any file path in the notification list. In this implementation, deleting a corresponding scan result after scanning each file path can save storage space, avoid false feedback, and improve the accuracy of file synchronization.

[0332] Optionally, the method for processing data may further include: obtaining a scan cancellation notification, and clearing the scan start time of the target scan task. The scan cancellation notification is used to cancel any scan task corresponding to the associated file path. In this implementation, when the scan cancellation notification is obtained, clearing the relevant information of the scan task can release more system resources, reduce the system processing burden, and improve the system processing speed. At the same time, it promptly responds to the different needs of users in the file synchronization scenario and improves the user experience.

[0333] Optionally, clearing the scan start time of the target scan task includes: determining that there is no inclusion relationship between the other multiple file paths; clearing the scan start time of the target scan task. The other multiple file paths are multiple file paths other than the file path corresponding to any scan task. In this implementation, when it is determined that there is no inclusion relationship between the other multiple file paths, the relevant information of the scan task is cleared to avoid the clearing of the relevant information of the scan task affecting other scan tasks, thereby ensuring that other scan tasks can be successfully completed.

[0334] Optionally, after receiving the scan cancellation notification, the method for processing data may further include: determining that a containment relationship exists between other multiple file paths; and merging scan tasks corresponding to other multiple file paths having the containment relationship.

[0335] Optionally, determine whether there is an inclusion relationship between multiple other file paths, obtain the scanning time interval corresponding to each of the file paths with the inclusion relationship, merge the scanning tasks corresponding to the file paths with the inclusion relationship into a new target scanning task, and set a new scanning time interval corresponding to the new target scanning task according to the scanning time interval corresponding to each of the file paths with the inclusion relationship.

[0336] 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 inclusion relationship, and is less than the largest scanning time interval among the scanning time intervals corresponding to the file paths having the inclusion relationship.

[0337] In this implementation, after receiving the scan cancellation notification, the scan tasks corresponding to the remaining file paths with inclusion relationships are merged, so that when executing the merged scan tasks, it is possible to avoid multiple scans of the same file path, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0338] It is worth noting that the method for processing data provided by the present application can be applied to any scenario where files need to be monitored or scanned. When files are synchronized between electronic devices within a trusted ring, the method for processing data can be applied to electronic devices or to trusted electronic devices.

[0339] In the related art, when electronic devices in a trust ring synchronize files, the synchronized files are not verified, which may cause the synchronized files to be inconsistent with the source files, affecting the integrity of file synchronization. If the synchronized files are tampered with, it will also bring security risks to the electronic devices in the trust ring, making the entire file synchronization process unsafe and prone to errors.

[0340] In view of this, an embodiment of the present application also provides a file synchronization method, which is applied to an electronic device, and the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the method includes: obtaining a file to be synchronized sent by at least one trusted electronic device; generating a temporary synchronization file according to the file to be synchronized; verifying the temporary synchronization file; when the temporary synchronization file passes the verification, synchronizing the temporary synchronization file to the file system. Optionally, verifying the temporary synchronization file may include verifying the integrity of the temporary synchronization file, the consistency of the temporary synchronization file with the source file, whether the function of the temporary synchronization file is normal, etc.

[0341] In this implementation, since the temporary synchronization file is verified, it can ensure that the file received by the electronic device is consistent with the source file, ensure the integrity of file synchronization, and improve the accuracy of file synchronization. Verifying 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 malware or viruses, and improve the security of the file synchronization process.

[0342] Optionally, verifying the temporary synchronization file includes: obtaining source metadata sent by at least one trusted electronic device; generating a check value corresponding to the temporary synchronization file and a check value corresponding to the source metadata; when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source metadata, determining that the temporary synchronization file has passed the verification. Optionally, the check value of the temporary synchronization file and the check value of the source metadata can both include a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, etc. In this implementation, it is equivalent to performing a consistency check on the temporary synchronization file and the source file, and synchronizing the file when the temporary synchronization file and the source file are consistent, which can make the final synchronized file accurate and improve 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 malware or viruses, and improving the security of the file synchronization process.

[0343] Optionally, synchronizing the temporary synchronization file to the file system includes: deleting the 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 after the file name is modified in the file system. Optionally, the modified file name of the temporary synchronization file is consistent with the file name of the local file. In this implementation, deleting the local file first and then modifying the file name of the temporary synchronization file can avoid file name conflicts, reduce errors caused by inconsistent file names or file versions, and help ensure the integrity and consistency of file synchronization.

[0344] Optionally, a temporary synchronization file is generated based on the file to be synchronized, including: incremental synchronization of the local file and the file to be synchronized to generate a temporary synchronization file. In this implementation, the incremental synchronization method is used to complete the multi-terminal synchronization of the file, which can effectively reduce the amount of data transferred by the file and save bandwidth. And because the amount of data transmitted is reduced, the file synchronization process is accelerated, and the overall data synchronization efficiency is improved. At the same time, since the electronic device only needs to process the changed files, the load during the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0345] Optionally, before obtaining the file to be synchronized sent by at least one trusted electronic device, the file synchronization method may also include: obtaining local metadata; when it is detected that the local metadata matches the local file, comparing the local metadata with the source metadata to see if they are consistent; when the local metadata is consistent with the source metadata, updating the local file. In this implementation, the local metadata and the local file, as well as the local metadata and the source metadata are verified, and the subsequent file synchronization process is executed when the verification passes, which can ensure the accuracy of the subsequent file synchronization results.

[0346] Optionally, when the file synchronization method detects that the local metadata matches the local file, after comparing the local metadata with the source metadata to see if they are consistent, it may also include: when the local metadata is inconsistent with the source metadata, determining the difference data between the local metadata and the source metadata; and sending the difference data to at least one trusted electronic device.

[0347] The difference data is used to trigger at least one trusted electronic device to send the file to be synchronized to the electronic device. 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 file to be synchronized to the electronic device, which provides a guarantee for achieving file synchronization.

[0348] Optionally, when the local metadata is inconsistent with the source metadata, after determining the difference data between the local metadata and the source metadata, the file synchronization method may also include: sending the source metadata and the difference data to at least one trusted electronic device. Sending the source metadata is used for at least one trusted electronic device to verify whether the source metadata matches the local file in at least one trusted electronic device; sending the difference data is used to trigger 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 at least one trusted electronic device. In this implementation, the source file and metadata of the trusted electronic device are first verified, and the subsequent file synchronization process is executed when there is no problem with the source file, which can ensure the accuracy of the subsequent file synchronization results.

[0349] The file synchronization method provided in the embodiment of the present application is described above in conjunction with the flow chart. The hardware structure of the electronic device involved in the embodiment of the present application is briefly introduced below in conjunction with the accompanying drawings.

[0350] In some embodiments of the present application, the electronic device may 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 laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., or may be other devices or apparatuses capable of performing scene recognition. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.

[0351] Please refer to Fig.16 , Fig.16 A schematic diagram of the hardware structure of an electronic device shown in an embodiment of the present application.

[0352] like Fig.16 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air 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.

[0353] It is to be understood that the structure shown in the embodiment 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 may include Fig.16 More or fewer components than those shown, or the electronic device 100 may include Fig.16Combinations of some of the components shown, or the electronic device 100 may include Fig.16 Subassemblies of some of the components shown. Fig.16 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0354] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (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.

[0355] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0356] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU can also be used to perform mathematical and posture calculations for graphics rendering, etc. The processor 110 may include one or more GPUs, which can generate or change display information by executing program instructions.

[0357] 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 the main screens of the electronic device 100. Generally speaking, the size of the display screen 194 of the electronic device 100 is fixed, and only limited controls can be displayed on 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, and controls all data processed by the application program and interactive operations on the data. Users can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.

[0358] The display screen 194 in the embodiment of the present application may be a touch screen. A touch sensor 180K may be integrated in the display screen 194. The touch sensor 180K may also be referred to as a "touch panel". In other words, the display screen 194 may include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also known 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, it can be passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event. Visual output related to the touch operation can be provided by the display screen 194. In other embodiments, the touch sensor 180K may also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0359] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0360] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an APP required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.

[0361] In addition, the internal memory 121 may include a high-speed random access memory; the internal memory 121 may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc.

[0362] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0363] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.

[0364] 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 above-mentioned hardware structure.

[0365] The following describes the file synchronization method provided by this application in conjunction with the software structure. Fig.17 , Fig.17 A schematic diagram of the software structure of an electronic device shown in an embodiment of the present application.

[0366] Exemplarily, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In the embodiment of the present application, the electronic device is an Android system as an example for explanation. The Android system is divided into an application (Application, App) layer, an application framework (Framework) layer, and a hardware abstraction layer.

[0367] The application layer may include a series of application packages, such as a trusted ring application. In the embodiment of the present application, a file synchronization SDK is integrated into the trusted ring application, thereby configuring the trusted ring application with the capability of file synchronization.

[0368] Optionally, the application layer may also include a database, which provides functions such as data storage, data modification, data deletion, data addition, and data query for the application.

[0369] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

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

[0371] Optionally, the application framework layer may also include a database.

[0372] Optionally, the database can also interact with the hardware abstraction layer, such as through operating system calls and manage data in the file system.

[0373] Optionally, the hardware abstraction layer may include a file system.

[0374] The trusted ring application, the file synchronization service module, the database and the file system interact with each other to implement the data processing method and the file synchronization method in the above-mentioned method embodiments. For details, please refer to the relevant descriptions in the above-mentioned embodiments, which will not be repeated here.

[0375] The above describes in detail an example of a file synchronization method provided by an embodiment of the present application. It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of 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 to exceed the scope of the present application.

[0376] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each function can be divided into each functional module, or two or more functions can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0377] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0378] The electronic device provided in this embodiment is used to execute the above-mentioned file synchronization method, and thus can achieve the same effect as the above-mentioned implementation method.

[0379] In the case of an integrated unit, the electronic device may further include a processing module, a storage module and a communication module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device to execute stored program codes and data, etc. The communication module may be used to support the electronic device to communicate with other devices.

[0380] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a WiFi chip, etc.

[0381] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the file synchronization method of any of the above embodiments.

[0382] An embodiment of the present application also provides a device, which may specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory so that the chip executes the data processing method and the file synchronization method in the above-mentioned method embodiments.

[0383] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the file synchronization method in the above-mentioned embodiment.

[0384] The present application also provides a chip. Fig.18 , Fig.18 A schematic diagram of the structure of a chip shown in an embodiment of the present application. Fig.18 The chip shown can be a general-purpose processor or a dedicated processor. The chip includes a processor 210. The processor 210 is used to execute the data processing method and file synchronization method of any of the above embodiments.

[0385] Optionally, the chip further includes a transceiver 220, which is used to accept control of the processor and to support the communication device in executing the technical solution shown above.

[0386] Optional, Fig.18 The chip shown may further include: a storage medium 230 .

[0387] It should be noted that Fig.18The chip shown can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits that can perform the various functions described throughout this application.

[0388] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.

[0389] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0390] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0391] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0392] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0393] If the integrated unit is implemented 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0394] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A file synchronization method, characterized in that: Applied to an electronic device, the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the method includes: determining that at least two directories in the electronic device both synchronize the same file from the at least one trusted electronic device; Any directory requests to obtain the same file from the at least one trusted electronic device; the any directory is any one of the at least two directories; Any one of the directories sends the acquired same file to other directories, and the other directories are directories other than any one of the directories in the at least two directories.

2. The method according to claim 1, characterized in that The determining that at least two directories in the electronic device both synchronize the same file from the at least one trusted electronic device comprises: Obtain a list of files to be synchronized, wherein the list of files to be synchronized includes the files to be synchronized corresponding to the at least two directories respectively; Comparing the files to be synchronized corresponding to the at least two directories respectively; When the to-be-synchronized files respectively corresponding to the at least two directories are consistent, it is determined that the at least two directories both synchronize the same file from the at least one trusted electronic device.

3. The method according to claim 2, characterized in that The comparing the to-be-synchronized files corresponding to the at least two directories respectively includes: Obtain metadata of the files to be synchronized corresponding to the at least two directories; When the metadata of the to-be-synchronized files corresponding to the at least two directories are consistent, it is determined that the at least two directories both synchronize the same file from the at least one trusted electronic device.

4. The method according to any one of claims 1 to 3, characterized in that: The any directory request to obtain the same file from the at least one trusted electronic device comprises: The any directory initiates a file synchronization request to the at least one trusted electronic device, wherein the file synchronization request is used to trigger the at least one trusted electronic device to send the same file to the electronic device; Mark the other directory to synchronize the same file with the any directory.

5. The method according to claim 4, characterized in that Any directory sends the same file obtained to other directories, including: Get the file path of other marked directories; Copy the same file to the file path of the other directory marked.

6. The method according to any one of claims 1 to 5, characterized in that: The trust ring where the electronic device is located also includes at least two trusted electronic devices, and the at least two trusted electronic devices respectively store the same synchronization file, and the method also includes: Obtain the influencing factors of each trusted electronic device; Determining a synchronization source device among the at least two trusted electronic devices according to the influencing factor of each trusted electronic device; The synchronization file is synchronized from the synchronization source device.

7. The method according to claim 6, characterized in that The influencing factors include at least one of power status, device type, network status, device performance, current power consumption of the device, and user preference.

8. The method according to claim 6 or 7, characterized in that: The step of determining a synchronization source device among the at least two trusted electronic devices according to the influencing factor of each trusted electronic device comprises: Calculating a synchronization suitability score for each trusted electronic device based on the influencing factors of each trusted electronic device; The synchronization source device is determined among the at least two trusted electronic devices according to the synchronization suitability score of each trusted electronic device.

9. The method according to any one of claims 6 to 8, characterized in that: The at least two trusted electronic devices are of different device types, and determining the synchronization source device among the at least two trusted electronic devices according to the influencing factor of each trusted electronic device includes: Determining the priority of each trusted electronic device according to the influencing factors of each trusted electronic device; The synchronization source device is determined among the at least two trusted electronic devices according to the priority of each of the trusted electronic devices.

10. An electronic device, characterized in that: include: 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 executes the method according to any one of claims 1 to 9.

11. A chip, characterized in that: include: A processor, used to call and run a computer program from a memory, so that an electronic device equipped with the chip executes a method as claimed in any one of claims 1 to 9.

12. 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 is caused to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Cross-device file processing method, client sides and server

    CN103618795A

  • File transmission method, device and equipment and readable storage medium

    CN115348259A

  • File synchronization method and system, electronic equipment and storage medium

    CN116319826A

  • File transmission method and device

    CN116932479A

  • File synchronization method and device, equipment and storage medium

    CN117201510A

Cited By

  • File synchronization method and electronic equipment

    CN121116937A