File synchronization method, electronic device, and storage medium

By transmitting the same file via a local area network among electronic devices within a trust ring, the problems of complex file synchronization and high power consumption are solved, achieving efficient and secure file synchronization.

CN119248737BActive Publication Date: 2026-01-16HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The file synchronization process in existing technologies is complex and cumbersome, resulting in low efficiency and increased power consumption of electronic devices.

Method used

By defining directories within trusted electronic devices and synchronizing the same file with trusted electronic devices, the number of file transfers is reduced. High-speed transmission within the local area network is used for file transfer, and metadata verification is combined to ensure file accuracy and security.

Benefits of technology

It improves the efficiency and security of file synchronization, reduces device power consumption and network bandwidth usage, and enhances transmission reliability and file integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248737B_ABST
    Figure CN119248737B_ABST
Patent Text Reader

Abstract

The application provides a file synchronization method, an electronic device and a storage medium, and relates to the technical field of data processing. The method is applied to an electronic device, a trust ring in which the electronic device is located further comprises at least one trusted electronic device, and the method comprises the following steps: determining that at least two directories in the electronic device are all synchronized with a 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; any directory is any one of the at least two directories; and any directory sends the obtained same file to other directories. In this implementation manner, for the electronic device and the trusted electronic device, the same file is transmitted only once across devices, and the whole file transmission process is simple and convenient. Since the number of file transmission times is small, the use of network bandwidth and processing time is reduced, the power consumption of the electronic device and the trusted electronic device is reduced, and the efficiency of file synchronization is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

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

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

[0004] However, it is found in use that the file synchronization process in the related art is complex and tedious, which reduces the efficiency of file synchronization and increases the power consumption of the electronic device. SUMMARY

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

[0006] In a first aspect, the present application provides a file synchronization method applied to an electronic device, wherein a trust ring to which the electronic device belongs further includes at least one trusted electronic device, and the method includes: determining that at least two directories in the electronic device synchronize a same file from the at least one trusted electronic device; requesting, by any directory, the same file from the at least one trusted electronic device; and sending, by any directory, the same file obtained to other directories.

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

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

[0009] Optionally, the directory hierarchy 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, respectively.

[0010] In this implementation, any directory in the electronic device first acquires 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, the same file is only transmitted across devices once for the electronic device and the trusted electronic device, and the entire file transmission process is simple and convenient. Because the number of file transmissions is small, the use of network bandwidth and processing time is reduced, which reduces the power consumption of the electronic device and the trusted electronic device, and also improves the efficiency of file synchronization. Reducing the number of file transmissions can also reduce the risk of data leakage and improve the security of file synchronization.

[0011] In addition, any directory in the electronic device sends the same file to other directories in the electronic device, and because the file is transmitted in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. In the transmission process, no additional network bandwidth is consumed, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, thereby improving the reliability of transmission. In addition, file operations are performed within the same electronic device, and the operating system and file system of the electronic device can better maintain the properties and permissions of the file to ensure the integrity of the file.

[0012] In combination with the first aspect, in some implementations of the first aspect, determining that the at least two directories synchronize the same file from the at least one trusted electronic device includes: acquiring a list of files to be synchronized; comparing the files to be synchronized corresponding to the at least two directories respectively; and when the files to be synchronized corresponding to the at least two directories are consistent, determining that the at least two directories synchronize the same file from the at least one trusted electronic device.

[0013] In this implementation, the list of files to be synchronized includes the files to be synchronized corresponding to the at least two directories respectively.

[0014] In this implementation, the files to be synchronized corresponding to the at least two directories are checked to ensure that the at least two directories indeed synchronize the same file from the trusted electronic device, which can ensure that the files finally synchronized to each directory are accurate and improve the accuracy of file synchronization.

[0015] In combination with the first aspect, in some implementations of the first aspect, comparing the files to be synchronized corresponding to the at least two directories includes: acquiring metadata of the files to be synchronized corresponding to the at least two directories; and when the metadata of the files to be synchronized corresponding to the at least two directories are consistent, determining that the at least two directories synchronize the same file from the at least one trusted electronic device.

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

[0017] In this implementation, the metadata of the to-be-synchronized files corresponding to the at least two directories is checked to ensure that the at least two directories are indeed synchronized with the same file from the trusted electronic device, so that the file finally synchronized into each directory is accurate, and the accuracy of file synchronization is improved.

[0018] With reference to the first aspect, in some implementations of the first aspect, any directory requesting the same file from the at least one trusted electronic device comprises: any directory initiating a file synchronization request to the at least one trusted electronic device, the file synchronization request being used to trigger the at least one trusted electronic device to send the same file to the electronic device; and marking other directories as synchronizing the same file with any directory.

[0019] In this implementation, after any directory initiates a file synchronization request to the at least one trusted electronic device, the other directories are marked, so that any directory can quickly and accurately send the same file to the marked other directories after obtaining the same file, the file finally synchronized into each directory is accurate, and the accuracy of file synchronization is improved.

[0020] With reference to the first aspect, in some implementations of the first aspect, any directory sending the obtained same file to other directories comprises: obtaining a file path of the marked other directories; and copying the same file into the file path of the marked other directories.

[0021] In this implementation, after any directory in the electronic device obtains the same file to be synchronized, the same file is copied into the file path of the other directories according to the file path of the marked other directories. Since the file is transmitted in the same electronic device, the transmission speed is fast and the risk is low, the efficiency and safety of file synchronization are improved. In the transmission process, no additional network bandwidth is consumed, the transmission cost is reduced, the transmission is not easily affected by network fluctuations or external interference, and the reliability of the transmission is improved. In addition, the file operation is performed in the same electronic device, and the operating system and file system of the electronic device can better maintain the attributes and permissions of the file, and ensure the integrity of the file.

[0022] With reference to the first aspect, in some implementations of the first aspect, the trust circle in which the electronic device is located further includes at least two trusted electronic devices, and the same synchronization file is stored in each of the at least two trusted electronic devices. The file synchronization method can further include: obtaining an influence factor of each trusted electronic device; determining a synchronization source device from the at least two trusted electronic devices according to the influence factor of each trusted electronic device; and synchronizing the synchronization file from the synchronization source device.

[0023] The influence factor is used to influence the determination of the synchronization source device, that is, the influence factor is a factor used to influence the decision of which trusted electronic device to be the synchronization source device. The synchronization source device is different, and the file synchronization effect is different, that is, the influence factor can be used to influence the file synchronization effect between the electronic device and the trusted electronic device.

[0024] The influence factor includes at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, and a user preference.

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

[0026] With reference to the first aspect, in some implementations of the first aspect, determining the synchronization source device from the at least two trusted electronic devices according to the influence factor of each trusted electronic device includes: calculating a synchronization suitability score for each trusted electronic device according to the influence factor of each trusted electronic device; and determining the synchronization source device from the at least two trusted electronic devices according to the synchronization suitability score of each trusted electronic device.

[0027] In this implementation, the synchronization suitability score of the trusted electronic device is calculated, and the synchronization source device is determined according to the synchronization suitability score to perform file synchronization, which can select the most suitable synchronization source device from the plurality of trusted electronic devices, which can ensure more efficient synchronization operation and help maintain the consistency and accuracy of the synchronized files. At the same time, it can avoid overloading and ensure that device resources are reasonably allocated and optimally used, reduce unnecessary resource consumption, reduce file synchronization cost, and enhance the reliability of file synchronization.

[0028] In a possible implementation of the first aspect, the device types of the at least two trusted electronic devices are different, and the synchronization source device is determined from the at least two trusted electronic devices according to the influence factors of each trusted electronic device, including: determining a priority of each trusted electronic device according to the influence factors of each trusted electronic device; and determining the synchronization source device from the at least two trusted electronic devices according to the priority of each trusted electronic device.

[0029] In this implementation, the synchronization source device is determined by determining the priority of the device, which can reasonably allocate resources according to the importance and functions of different devices, and select a suitable synchronization source device, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0030] In the second aspect, the present application provides an electronic device, including: one or more processors; one or more memories; a module installed with a plurality of application programs; and one or more programs stored in the memory, which, when executed by the processor, cause the electronic device to perform the method in the first aspect and any possible implementation thereof.

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

[0032] When the device is an electronic device, the processing unit can be a processor, and the input unit can be a communication interface. The electronic device can further include a memory for storing computer program codes, which, when executed by the processor, cause the electronic device to perform any method in the first aspect.

[0033] When the device is a chip in an electronic device, the processing unit can be a processing unit inside the chip, and the input unit can be an output interface, a pin, or a circuit, etc. The chip can further include a memory, which can be a memory inside the chip (e.g., a register, a cache, etc.) or a memory outside the chip (e.g., a read-only memory, a random access memory, etc.). The memory is used to store computer program codes, which, when executed by the processor, cause the chip to perform any method in the first aspect.

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

[0035] Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.

[0036] Optionally, the chip further comprises a communication interface.

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

[0038] In a sixth aspect, the present application provides a computer program product, and the computer program product comprises: computer program code, when the computer program code is executed on an electronic device, the electronic device executes the method in the first aspect and any possible implementation manner thereof.

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

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

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

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

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

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

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

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

[0047] Figure 8 A flow schematic diagram of the file synchronization method shown in the embodiments of the present application;

[0048] Figure 9 Another file transmission schematic diagram shown in the embodiments of the present application;

[0049] Figure 10 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0050] Figure 11 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0051] Figure 12 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0052] Figure 13 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0053] Figure 14 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0054] Figure 15 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0055] Figure 16 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0056] Figure 17 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;

[0057] Figure 18 FIG. 1 is a flowchart illustrating another file synchronization method according to an embodiment of the present application; DETAILED DESCRIPTION

[0058] The technical solutions in the present application will be described below with reference to the 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" herein only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which means that there are three cases of A alone, A and B together, and B alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

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

[0061] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrases "in one embodiment", "in some embodiments", "in other embodiments", "in additional embodiments" and so on, in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily referring to some, but not all, embodiments, unless otherwise indicated by the context. The terms "including", "containing", "having" and variations thereof mean "including but not limited to", unless expressly specified otherwise.

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

[0063] 1. Trust circle and trusted electronic device

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

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

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

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

[0068] 2. Cross-platform mounting of access files

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

[0070] 3. Trust circle application

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

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

[0073] 4. Software Development Kit (SDK)

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

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

[0076] 5. Directory and folder

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

[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 embodiments of the present application, water level synchronization is used to ensure the consistency and integrity of files in different electronic devices and different operating systems.

[0080] 7. Incremental Synchronization

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

[0082] 8. Link

[0083] A link can include a hard link and a soft link (symbolic link).

[0084] A hard link is considered as an independent file in the file system, and a soft link is similar to a text file containing a path to the file. Both types of links can be created in different directories, thereby achieving the effect of accessing 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 described again below.

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

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

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

[0089] Taking the electronic device 100 as a mobile phone, the electronic device 200 as a tablet computer, and the electronic device 300 as a notebook computer as examples, the following is described. For example, when the mobile phone initiates a synchronization request to the tablet computer and the notebook computer, and applies to synchronize files in the mobile phone to the tablet computer and the notebook computer, the mobile phone is the master device, and the tablet computer and the notebook computer are trusted electronic devices. For another example, when the mobile phone and the tablet computer initiate a synchronization request to the notebook computer, and apply to synchronize files in the mobile phone and the tablet computer to the notebook computer, the mobile phone and the tablet computer are the master devices, and the notebook computer is a trusted electronic device. This is only an example, and is not limited thereto.

[0090] Referring to Figure 2 , Figure 2 is another system architecture diagram to which the file synchronization method shown in the embodiments of the present application is applicable. As shown in Figure 2 , the electronic device 100, the electronic device 200, and the electronic device 400 establish a trust relationship through trusted authentication, and form a trust circle. Unlike the trust circle shown in Figure 1 , the electronic device 400 included in the trust circle shown in Figure 2 may be a NAS. In the embodiments of the present application, the mobile phone and / or the tablet computer initiates a synchronization request to the NAS, and applies to synchronize files in the mobile phone and / or the tablet computer to the NAS. The NAS can also access files across terminals, for example, the NAS can transmit and share files to the mobile phone and / or the tablet computer, and can also access files in the mobile phone and / or the tablet computer.

[0091] The following describes the application scenario of data synchronization between electronic devices in the trust circle with reference to the accompanying drawings.

[0092] The trust circle provided by the embodiments of the present application can include a mobile phone and a NAS, and the following is described taking the example of synchronizing files in the mobile phone to the NAS.

[0093] Referring to Figure 3 , Figure 3 is an application scenario diagram of file synchronization shown in the embodiments of the present application.

[0094] For example, a setting application in the mobile phone is opened, and the "System and Updates" option is selected in the display interface corresponding to the setting application, and the mobile phone displays the interface shown in Figure 3 (a). The control 101 in the interface shown in Figure 3 (a) is clicked, that is, the "Backup and Restore" option is clicked, and the mobile phone displays the interface shown in Figure 3 (b).

[0095] In Figure 3In the interface shown in (b), various data backup and recovery modes are shown, such as cloud backup, external storage, mobile phone assistant, etc. Among them, the cloud backup can be used to backup the whole machine data of the mobile phone to the cloud server, and when necessary, the whole machine data stored in the cloud server can also be recovered to the mobile phone through the cloud backup. The whole machine data can include gallery, contacts, short message, call record, memo, input method, spam blocking, wireless local area network (WLAN) setting, scene intelligence, mobile phone manager, clock, weather, camera, calendar, desktop icon layout, system setting, application program, chat record, browsing record, etc.

[0096] The external storage is used to connect the external storage device to backup and recover data. The external storage device can include an external storage card, a universal serial bus (USB) storage device, a NAS, etc.

[0097] The mobile phone assistant is used to connect the computer to backup and recover data.

[0098] In the embodiment of the present application, the files in the mobile phone are backed up to the NAS through the external storage. It is worth noting that synchronization also belongs to a backup method, and in the present application, the files in the mobile phone are also referred to as being synchronized 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 can include gallery, contacts, short message, call record, memo, input method, spam blocking, wireless local area network (WLAN) setting, scene intelligence, mobile phone manager, clock, weather, camera, calendar, desktop icon layout, system setting, application program, chat record, browsing record, etc.

[0099] Please refer to Figure 4 and Figure 5 , Figure 4 is a schematic diagram of the backup data based on the external storage shown in the embodiment of the present application, Figure 5 is a backup data process schematic diagram shown in the embodiment of the present application.

[0100] Exemplarily, clicking the control 102 in the interface shown in (b), that is, clicking the "external storage" option, the mobile phone displays the interface shown in Figure 3 (a). In Figure 4 , the interface shown in (a) is a backup data interface based on the external storage. In the interface shown in (a), the user can click the "backup" button to backup the data in the mobile phone to the external storage, or click the "recovery" button to recover the data in the external storage to the mobile phone. Figure 4The interface shown in (a) displays identification information for various external storage devices, such as external memory cards, USB storage, and shared folders. Specifically, the external memory card is used to back up data from the phone to the external memory card when it is detected; the USB storage is used to back up data from the phone to the USB drive when connected to a USB device; and the shared folder is used to back up data from the phone to the home NAS device when a shared folder on the same network is detected.

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

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

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

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

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

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

[0107] After selecting the data items to be backed up, click Figure 5 In the interface shown in (b), the Start Backup control 109, i.e., clicking the "Start Backup" option, will display the following on the phone: Figure 5 The interface shown in (c) is as follows. The phone performs data preparation processing, such as calculating the number of items and the data size corresponding to each data item to be backed up, and displays it as shown in (c). Figure 5 In the interface shown in (c), once the data is ready, the phone begins backing up the data, that is, backing up the data items selected by the user on the phone to the NAS, or in other words, synchronizing the various files selected by the user on the phone to the NAS.

[0108] In this embodiment, a distributed management service is used to manage the various electronic devices within the trust ring, enabling data to be stored and accessed between different electronic devices (such as mobile phones, tablets, laptops, NAS, etc.) and different operating systems (such as Android, iOS, Symbian, BlackBerry, Linux, Windows, etc.). This achieves cross-device and cross-system data storage and access, and opens up data access channels for near-field communication between electronic devices.

[0109] The application scenarios of file synchronization have been described above in conjunction with user operations. The following section, with reference to the accompanying diagram, describes the specific process of file synchronization between electronic devices in a trust ring.

[0110] The trust ring provided in this application embodiment may include a mobile phone and a personal computer (PC). The PC may include a desktop computer, a laptop computer, a mini-laptop computer, a tablet computer, and an ultrabook, etc. Taking the synchronization of files from a mobile phone to a tablet computer as an example, the following explanation is provided.

[0111] Please see Figure 6 , Figure 6 This is a schematic diagram illustrating a file synchronization process according to an embodiment of this application.

[0112] S101. The trust ring application receives a file synchronization request and calls the file synchronization SDK.

[0113] The trust circle application represents an application program in an electronic device within the trust circle. A user can set up functions such as file backup, file synchronization, or turn off functions such as file backup, file synchronization through the trust circle application.

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

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

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

[0117] The file synchronization request can be triggered by the electronic device to which the trust circle application belongs, or by the trusted electronic device. Illustratively, the trust circle application installed on the mobile phone receives an operation of a user setting 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 trust circle application belongs. For example, the tablet computer initiates a file synchronization request to the mobile phone, and the mobile phone receives the file synchronization request.

[0118] Illustratively, when the trust circle application obtains the file synchronization request, the trust circle application calls the file synchronization SDK by using pre-written code in the trust circle application.

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

[0120] Illustratively, 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 embodiments of the present application, the shared directory can be represented by a REPO directory, and the electronic devices within the trust circle can share the REPO directory. The REPO directory can include a file path, a scanning start time, a scanning time interval, REPO identification information, an electronic device name, file synchronization configuration information, a callback function of the file path, and the like.

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

[0123] The scanning start time is the time when the electronic device starts to scan the file path. Generally, the time when the electronic device starts to scan the file path for the first time is determined according to the time when the user sets to start the file synchronization function for the first time. For example, the user selects to start to synchronize the file immediately when setting to start the file synchronization function for the first time. Then, the electronic device starts to scan the file path immediately, i.e., the scanning start time is the time when the user starts the file synchronization function.

[0124] The time when the electronic device starts to scan the file path for the second time is determined according to the file synchronization period set by the user, i.e., according to the scanning time interval. For example, the user sets to synchronize the file automatically every day or every seven days. Then, the electronic device scans the file path every day or every seven days after scanning the file path for the first time.

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

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

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

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

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

[0130] The filtered file is a file that does not need to be synchronized. In the embodiment of the present application, the filtered file can not be scanned, the power consumption of the electronic device can be reduced, the time for scanning the file in the file synchronization process can be effectively reduced, and the file synchronization efficiency can be improved.

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

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

[0133] The data persistence processing refers to long-term storage of data on a storage medium that can be persistently saved, so that the data can still be accessed after the application or the 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 persistently saved. 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 still be read from the local database, so that the relevant information of the REPO directory is ensured not to be lost. For the user, the relevant information of the file synchronization function only needs to be set once, and the file synchronization function can be applied all the time, without the need to set the relevant information of the file synchronization function again after the mobile phone is restarted or the trusted ring application is restarted, thereby improving the user experience.

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

[0136] This way of creating a REPO directory in advance in the electronic device is beneficial to subsequent file synchronization of the electronic device in the trusted ring by directly using the REPO directory, thereby improving the file synchronization efficiency.

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

[0138] S201, the trust ring application in the trusted electronic device acquires a file synchronization request and calls a file synchronization SDK.

[0139] S202, the file synchronization SDK calls a 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-S203, refer to the specific description in steps S101-S103 above, which will not be repeated here.

[0142] The steps S201-S203 above describe the scenario that the trusted electronic device, for example, a tablet computer, creates a shared directory / shared folder, for example, creates a REPO directory, when acquiring a file synchronization request. In a possible implementation manner, the trusted electronic device, for example, a tablet computer, can also create a shared directory / shared folder, for example, create a REPO directory in advance, that is, the trusted electronic device, for example, a tablet computer, creates a REPO directory before acquiring a file synchronization request.

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

[0144] S104, share the REPO directory with the trusted electronic device.

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

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

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

[0148] S105, REPO directory metadata synchronization processing is performed with the trusted electronic device.

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

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

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

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

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

[0154] When the change of the file to be synchronized is monitored or scanned, such as the addition, deletion, modification, etc. of the file to be synchronized, the change is notified to the file synchronization service module.

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

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

[0157] For example, the file change record is stored in the local database of the phone that can be persistently saved, so that even if the 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] For example, the file synchronization service module reads the file change record from the local database periodically according to the file synchronization period set by the user. For example, the electronic device monitors or scans the file system once, and the file synchronization service module reads the file change record from the local database once.

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

[0161] File metadata refers to file name, belonging to electronic device, file size, file addition time, file deletion time, file modification time, etc.

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

[0163] It should be understood that the electronic device and the trusted electronic device perform file metadata synchronization processing, and 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 for identifying 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 one by one with the file metadata sent by the mobile phone. If the comparison result is consistent, the file metadata recorded in the tablet computer is maintained; if the comparison result is 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 then the file content can be directly synchronized, improving the file synchronization efficiency and reducing the error.

[0168] Optionally, in a possible implementation, after the trusted electronic device performs file metadata comparison processing, the electronic device sends the file metadata for data persistence processing. For example, the modified file metadata is stored in a local database.

[0169] S109, file content synchronization processing is performed 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] For example, the file synchronization service module in the electronic device reads the file content from the file system and sends the read file content to the trusted electronic device. Correspondingly, the trusted electronic device needs to save the file content sent by the electronic device. For example, Figure 6 As shown, the saving method specifically includes:

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

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

[0174] It should be noted that, in the description of the specific process of file synchronization between electronic devices in the trust ring above, the file in the mobile phone is synchronized to the tablet computer, and thus the method executed by the mobile phone is mainly described. It should be understood that, when the file in the tablet computer needs to be synchronized to the mobile phone, the tablet computer can execute the steps executed by the mobile phone, and the mobile phone can execute the steps executed by the tablet computer.

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

[0176] In the embodiments 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 the core service 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 listening to and scanning the local file system. Meanwhile, the trust ring self-discovery and self-networking capability provided by the system can enable the electronic device to quickly discover the surrounding devices, and enable the electronic device to share the REPO directory, synchronize the REPO metadata, synchronize the file metadata, and synchronize the file content with the trusted electronic device in the trust ring, thereby realizing cross-device and cross-system data storage and access, and opening up the data access channel of near field communication between electronic devices.

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

[0178] For ease of understanding, please refer to Figure 7 , Figure 7 A file transmission diagram is shown in an embodiment of the present application.

[0179] As Figure 7 indicated, the source side represents the side where the source file is located, i.e., 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 represents the source side and device B represents the target side. Device A includes Repo2 directory and Repo1 directory, and Repo2 directory is a subdirectory of Repo1 directory. Correspondingly, Repo1 directory is the parent directory of 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, and it is worth noting that the Repo1 directory and the Repo2 directory in device B correspond to different file paths. Among them, the storage space corresponding to the Repo1 directory in device B is used to store the file to be synchronized sent by device A (i.e., the same file mentioned above), and the storage space corresponding to the Repo2 directory in device B is also used to store the file to be synchronized 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, the Repo2 directory in device A is directly mapped to the Repo2 directory in device B, and 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 are authenticated and trusted, and a trust relationship is established to form a trust ring. File 1 in the Repo2 directory of device A needs to be synchronized / backup to the Repo1 directory and the Repo2 directory of device B, or in other words, the Repo1 directory and the Repo2 directory of device B need to synchronize / backup file 1 from the Repo2 directory of device A. In this application scenario, 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 of device B, and then device A sends file 1 in the Repo2 directory to the Repo2 directory of device B.

[0183] In this processing manner, file 1 is transmitted across devices twice, and file 1 needs to be verified each time it is transmitted, resulting in a complex and tedious file transmission process. Repeated transmission of file 1 increases network bandwidth usage and processing time, not only affecting other file synchronization, but also reducing the efficiency of file synchronization. Moreover, repeated transmission also increases the power consumption of electronic devices and trusted electronic devices, increases the risk of data leakage, and reduces the security of file synchronization.

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

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

[0186] Any directory in the electronic device sends the same file to other directories in the electronic device, since the file is transmitted in the same electronic device, the transmission speed is high, the risk is low, the efficiency and security of file synchronization are improved. In the transmission process, no additional network bandwidth is consumed, the transmission cost is reduced, and the transmission is not easily affected by network fluctuations or external interference, and the reliability of the transmission is improved. And the file operation is carried out in the same electronic device, 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 by the embodiment of the application will be described below in conjunction with a flowchart.

[0188] Please refer to Figure 8 , Figure 8 The flowchart of the file synchronization method shown in the embodiment of the application. The method comprises:

[0189] S301, determine that at least two directories in the 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, form a trust ring. In the embodiment of the application, the trust ring in which the electronic device is located also includes at least one trusted electronic device, 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 file 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, according to the file synchronization request, it is determined that at least two directories in the 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, the user wants to synchronize the pictures on the trusted electronic device (such as a mobile phone) to different two directories of the 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 can include the identification information of the file to be synchronized by each directory, the requested file content, and the file path of the file to be synchronized. Wherein, the picture is the file to be synchronized.

[0194] By comparing the identification information of the files 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 to-be-synchronized list can be obtained, the to-be-synchronized file list including files to be synchronized by each directory respectively, and when the files to be synchronized by each directory respectively are consistent, it is determined that at least two directories in the electronic device are to synchronize the same file from the trusted electronic device.

[0196] For ease of understanding, please refer to Figure 9 , Figure 9 Another file transmission diagram shown in the embodiments of the present application.

[0197] As Figure 9 indicated, the source side represents the side where the source file is located, that is, the source side is the side that sends the to-be-synchronized file, that is, the side where the same file is located. The target side is the side that receives the to-be-synchronized file, that is, the side that receives the same file. In the embodiments of the present application, device A can be a trusted electronic device, and device B can be an electronic device. Device A and device B establish a trusted relationship through trusted authentication, forming a trust ring.

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

[0199] Optionally, in a possible implementation, a 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 a parent directory where the same file in the trusted electronic device is located is directly mapped to another of the at least two directories of the electronic device. As Figure 9 indicated, the Repo1 directory in device A is directly mapped to the Repo1 directory of device B, and the Repo2 directory in device A is directly mapped to the Repo2 directory of device B.

[0200] Optionally, in a possible implementation, the directories to which the same file in the trusted electronic device belongs have a containing relationship, or in other words, the file paths corresponding to the directories to which the same file in the trusted electronic device belongs have a containing relationship. As Figure 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 a parent directory of the Repo2 directory. Correspondingly, 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 a parent file path of the file path corresponding to the Repo2 directory. In this case, the same file in the trusted electronic device subdirectory is synchronized / backup to different directories in the electronic device, which 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, one directory is randomly selected from at least two directories, and a file synchronization request is initiated to the trusted electronic device through the randomly selected directory, the file synchronization request being used to trigger the trusted electronic device to send the same file to the directory of the electronic device initiating the file synchronization request, i.e., to any directory.

[0204] The file synchronization request can include identification information of the file, requested file content, a file path, and a specified storage location, etc. The specified storage location refers to a location in the electronic device for storing the same file, such as any directory. It should be noted that the actual storage of the file content is the storage space corresponding to the directory, i.e., the file content of the same file is actually stored in the storage space corresponding to any directory. In order to facilitate description, in some application scenarios, it is described as being stored in a directory, or the specified storage location is described as a certain directory in the embodiments of the present application.

[0205] 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 to obtain the same file, and then sends the same file to any directory of the electronic device according to the specified storage location.

[0206] In combination Figure 9 For illustration, the Repo1 directory is selected from the Repo1 directory and the Repo2 directory of device B, a file synchronization request is initiated to device A through the Repo1 directory in device B, and device A scans in the file system to obtain file 1 under the Repo2 directory according to the file synchronization request. 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 request corresponding to the other directory except the any directory among the at least two directories is deleted, and the file synchronization request is initiated to the trusted electronic device through the any directory. The trusted electronic device scans in the file system thereof according to the identification information of the file, the requested file content, and the file path, and the like, obtains the same file, and sends the same file to any directory of the electronic device according to the specified storage location.

[0208] In this implementation, the file synchronization request corresponding to the other directory is deleted, so that only the any directory initiates the file synchronization request to the trusted electronic device, the repeated initiation of the file synchronization request by the other directory is avoided, and the number of cross-device transmissions is reduced.

[0209] S303, the any directory sends the obtained same file to the other directory.

[0210] The other directory is a directory except the any directory among 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. The any directory sends the link corresponding to the same file to the other directory. For example, the any directory sends the link corresponding to the same file to the other directory through a move command. For another example, the link corresponding to the same file is cut in the any directory, and the paste operation is performed in the other directory, so that the link corresponding to the same file is moved to the other directory.

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

[0213] In this implementation, any directory in the electronic device first acquires 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, the same file is only transmitted across devices once for the electronic device and the trusted electronic device, and the entire file transmission process is simple and convenient. Since the number of file transmissions is small, the use of network bandwidth and processing time is reduced, which reduces the power consumption of the electronic device and the trusted electronic device, and also improves the efficiency of file synchronization. Reducing the number of file transmissions can also reduce the risk of data leakage and improve the security of file synchronization.

[0214] In addition, any directory in the electronic device sends the same file to other directories in the electronic device, and since the file is transmitted in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. In the transmission process, no additional network bandwidth is consumed, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, thereby improving the reliability of the transmission. In addition, file operations are performed within the same electronic device, and the operating system and file system of the electronic device can better maintain the properties and permissions of the file to 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 also trigger a request to acquire the changed same file from the trusted electronic device, and when the changed same file is acquired, the changed same file will be sent to other directories. In this implementation, the updated file is synchronized in time, which 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 step S301 can further include steps S3011 and S3013, which are specifically as follows.

[0217] Please refer to Figure 10 , Figure 10 Another flowchart of a file synchronization method is shown in the embodiments of the present application. The method includes:

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

[0219] Exemplarily, the list of files to be synchronized can include at least two directories corresponding to files to be synchronized respectively, and each file to be synchronized can 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 embodiments of the present application, the REPO directory created as described above can include the list of files to be synchronized, and the list of files to be synchronized can be directly acquired from the REPO directory.

[0221] S3012, compare the to-be-synchronized files corresponding to the at least two directories respectively.

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

[0223] In combination Figure 9 It is illustrated that, for example, the file name, file path, file size, creation date, last modification time, file type, file version of the file 1 corresponding to the Repo1 directory of the device B are compared with the file name, file path, file size, creation date, last modification time, file type, file version of the file 1 corresponding to the Repo2 directory of the device B respectively.

[0224] S3013, when the to-be-synchronized files corresponding to the at least two directories respectively are consistent, it is determined that the at least two directories synchronize the same file from the at least one trusted electronic device.

[0225] Exemplarily, when the comparison result is that the to-be-synchronized files corresponding to the at least two directories respectively 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, the directories need to respectively initiate a file synchronization request to the trusted electronic device, so as to obtain the files required by the directories respectively from the trusted electronic device through the respective file synchronization request.

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

[0227] In this implementation, the to-be-synchronized files corresponding to the at least two directories are verified to ensure that the at least two directories indeed synchronize the same file from the trusted electronic device, so that the file finally synchronized into each directory is accurate, and the accuracy of file synchronization is improved.

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

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

[0230] In this implementation, the list of to-be-synchronized files corresponding to each directory is traversed, which can avoid the case that the list of to-be-synchronized files corresponding to each directory is different, and ensure that the subsequent synchronization operation can be correctly performed.

[0231] Optionally, in a possible implementation, the step S3012 can further include steps S30121 and S30122, and the details are as follows.

[0232] Please refer to Figure 11 , Figure 11 Another file synchronization method is shown in the flowchart of the embodiment of the present application. The method includes:

[0233] S30321, obtaining the metadata of the to-be-synchronized files corresponding to at least two directories.

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

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

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

[0237] For example, a check value corresponding to each metadata is generated. The check value can 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 can be calculated by MD5 (Message Digest Algorithm 5) algorithm, SHA-1 (Secure Hash Algorithm 1) algorithm, SHA-2 (Secure Hash Algorithm 2) algorithm, etc.

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

[0240] For example, the metadata of the file to be synchronized is obtained, and a hash function corresponding to the MD5 algorithm is determined. The metadata of the file to be synchronized is input into the hash function, the hash function 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 is simple and efficient to calculate, the efficiency of subsequent file synchronization can be improved while ensuring the safety of the file synchronization process, thereby improving the user experience.

[0242] Alternatively, the check value corresponding to each metadata can also be generated by a check tool (such as md5sum, sha1sum, sha256sum, etc.).

[0243] When it is detected that the check values 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.

[0244] In combination Figure 9 For example, the metadata of file 1 corresponding to the Repo1 directory of device B and the metadata of file 1 corresponding to the Repo2 directory of device B are obtained. The check value of the metadata of file 1 corresponding to the Repo1 directory is generated, and the check value of the metadata of file 1 corresponding to the Repo2 directory is generated. When the two check values are consistent, it is determined that the Repo1 directory and the Repo2 directory of device B both synchronize file 1 from device A.

[0245] In this implementation, the metadata of the file to be synchronized corresponding to the at least two directories is checked to ensure that the at least two directories indeed synchronize the same file from the trusted electronic device, so that the file finally synchronized into each directory is accurate, thereby improving the accuracy of file synchronization.

[0246] Alternatively, in a possible implementation, the step S302 can further include steps S3021 and S3022, which are specifically as follows.

[0247] Please refer to Figure 12 , Figure 12FIG. 1 is a flow diagram illustrating another file synchronization method according to an embodiment of the present application. The method comprises the following steps.

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

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

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

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

[0252] Optionally, in the embodiment of the present application, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories can also be marked, for example, the file synchronized by other directories with the any directory is the same file.

[0253] In one example, a state file can be created in each directory, and the state file is used to store synchronization state information of each directory. The synchronization state information is used to record that the directory synchronizes the same file with any directory.

[0254] In another example, the file extension attribute in the metadata of the to-be-synchronized file corresponding to the other directory is used to customize a tag, and the file extension attribute of the other directory can be changed to use the customized tag of the file extension attribute to represent that the to-be-synchronized file to which the metadata belongs is the same file to be synchronized with any directory.

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

[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 any directory can quickly and accurately send the same file to the marked other directories after obtaining the same file, and the file synchronized to each directory is accurate, and the accuracy of file synchronization is improved.

[0257] Optionally, in a possible implementation manner, the step S303 can further include steps S3031 and S3032, specifically as follows.

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

[0259] S3031, obtaining the file path of the marked other directory.

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

[0261] In another example, the marked other directory can be determined by detecting the file extension attribute in the metadata of the to-be-synchronized file corresponding to each directory, and then the file path of the marked other directory can be obtained by using a command line tool.

[0262] In yet another example, the marked other directory can be determined by detecting the file name corresponding to each directory, and then the file path of the marked other directory can be obtained by using a command line tool.

[0263] S3032, copying the same file into the file path of the marked other directory.

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

[0265] When the number of other directories is multiple, multiple copies of the same file can be copied in any directory first, and the copied multiple same files are sent to the file paths of the marked other directories respectively by a move command; or one copy of the same file can be copied in any directory first, and the copied same file is sent to the file path of one marked other directory by a move command, and then another copy of the same file is copied in any directory, and the copied same file is sent to the file path of another marked other directory by a move command, and so on.

[0266] In this implementation, any directory in the electronic device acquires the same file to be synchronized, and then according to the file path of the other directory marked, the same file is copied to the file path of the other directory. Since the file is transmitted in the same electronic device, the transmission speed is fast, the risk is low, the efficiency and safety of file synchronization are improved. In the transmission process, no additional network bandwidth is consumed, the transmission cost is reduced, and the transmission is not easily affected by network fluctuations or external interference, and the reliability of the transmission is improved. And the file operation is carried out in the same electronic device, and the operating system and file system of the electronic device can better maintain the attributes and permissions of the file, and ensure the integrity of the file.

[0267] When the electronic devices in the trust ring perform file synchronization, if the file that needs to be synchronized by the electronic device is stored in at least two trusted electronic devices, or in other words, the file that needs to be synchronized by the electronic device is in at least two source devices (i.e. trusted electronic devices). Therefore, 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, to determine the synchronization source device finally used for synchronization.

[0268] For ease of understanding, please refer to Figure 14 , Figure 14 A file synchronization diagram is shown in an embodiment of the present application.

[0269] As shown in Figure 14 , device A and device B represent source devices (i.e. trusted electronic devices), and device C represents a target device (i.e. an electronic device). Device A and device B are on the side of sending the file to be synchronized, and device C is on the side of receiving the file to be synchronized.

[0270] As shown in Figure 14 , the Repo1 directory in device A includes a file 1 in the storage space corresponding to the Repo1 directory, which is used to store the source file (i.e. the file to be synchronized). Figure 14 The Repo1 directory in device B also includes a file 1 in the storage space corresponding to the Repo1 directory, which is used to store the source file (i.e. the file to be synchronized). Figure 14

[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 version of the file 1 is the latest version. The Repo1 directory in device A and the Repo1 directory in device B correspond to different file paths, such as Figure 14 file path 1 and file path 2 shown in

[0272] ​Since the latest version of file 1 is stored in both device A and device B, before the file synchronization starts, it is necessary to determine whether to synchronize the file from device A or device B, that is, to determine the synchronization source device for synchronizing file 1 to device C.

[0273] Therefore, the embodiment of the present application further provides a file synchronization method applied to an electronic device, wherein a trust circle in which the electronic device is located further includes at least two trusted electronic devices, and the same synchronization file is stored in the at least two trusted electronic devices respectively, the method further includes: calculating a synchronization suitability score for each trusted electronic device according to a preset synchronization strategy; determining a synchronization source device in 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, the process of calculating the synchronization suitability score for the trusted electronic device according to the preset synchronization strategy and determining the synchronization source device for file synchronization according to the synchronization suitability score can select the most suitable synchronization source device from the multiple trusted electronic devices, can ensure that the synchronization operation is more efficient, and is beneficial to maintaining the consistency and accuracy of the synchronized file. At the same time, it can avoid the situation of overload, ensure that the device resources are reasonably allocated and optimally used, reduce unnecessary resource consumption, reduce the file synchronization cost, and enhance the reliability of file synchronization.

[0275] And the suitable synchronization source device is selected by the preset synchronization strategy automatic scoring, which simplifies the complexity of manual decision and reduces human errors.

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

[0277] Please refer to Figure 15 , Figure 15 The flowchart of a file synchronization method shown in the embodiment of the present application. The method includes:

[0278] S401, obtaining the influence factors of each trusted electronic device.

[0279] The trusted relationship is established between the two or more electronic devices through trusted authentication, and the trust circle is formed. In the embodiment of the present application, the trust circle in which the electronic device is located further includes at least two trusted electronic devices, and the same file to be synchronized by the electronic device is stored in the at least two trusted electronic devices.

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

[0281] The influencing factor is used to affect the determination of the synchronization source device, that is, the influencing factor is a factor used to affect the choice of which trusted electronic device as the synchronization source device. Different synchronization source devices have different file synchronization effects, that is, the influencing factor can be used to affect the file synchronization effect between the electronic device and the trusted electronic device.

[0282] The influencing factor can include at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, a device usage frequency, and a user preference.

[0283] The device type can include a NAS, a PC, a mobile phone, a wearable device, an augmented reality (AR) / virtual reality (VR) device, a television, a personal digital assistant (PDA), and the like. The PC can include a desktop computer, a notebook computer, a subnotebook computer, a tablet computer, a netbook computer, and an ultrabook computer, and the like.

[0284] The network state can include a network bandwidth, a network load, a network security, and the like. The network bandwidth is used to represent a data transmission rate, usually in units of bits per second; the network load is used to represent the amount of data transmitted, reflecting the degree of network congestion; and the network security is represented by the running state of a firewall, an intrusion detection system, an intrusion prevention system, and the like, indicating whether the trusted electronic device is currently secure.

[0285] The device performance can include a processor performance, a memory capacity, a storage performance, a network connection speed, a heat dissipation efficiency, an operating system performance, a multitasking processing capability, stability, and the like. The processor performance is embodied by a CPU model, a core number, a clock frequency, a cache size, an instruction set, and the like; the storage performance is embodied by the capacity, read / write speed, and interface type of a hard disk or a solid state disk; the network connection speed is embodied by the speed, quality, and supported network standards of a network interface; the heat dissipation efficiency is embodied by the design of a heat dissipation system, fan speed, and heat dissipation material; the operating system performance is embodied by the startup time, application program loading time, system update and maintenance efficiency, and the like; the multitasking processing capability is embodied by the performance when running multiple application programs or processes simultaneously; and the stability is used to represent the stability of the trusted electronic device under long-time running or high load.

[0286] For example, since the electronic device and the at least two trusted electronic devices are in the same trust circle, the electronic device in the trust circle can obtain the power state, the device type, the network state, the device performance, the current power consumption of the device, and the user preference of the trusted electronic device connected thereto through the trust circle technology.

[0287] For example, the electronic device obtains the influencing factors of the trusted electronic device through system service and application programming interface (API) calls with the trusted electronic device.

[0288] Optionally, the user preferences can be stored in the account settings of the user, and the electronic device can access the user preference settings of the user on different electronic devices by using the trust circle.

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

[0290] S402, determining a synchronization source device from the at least two trusted electronic devices according to the influencing factors of each trusted electronic device.

[0291] In one example, the synchronization source device is determined from the at least two trusted electronic devices according to any one of the influencing factors. The any one of the influencing factors can be randomly selected or specified by the user, and no limitation is made thereto.

[0292] For example, the any one of the influencing factors is the power state, which can include the remaining power. The remaining power of each trusted electronic device obtained is compared, and the trusted electronic device with more remaining power is determined as the synchronization source device.

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

[0294] S403, synchronizing the synchronization file from the synchronization source device.

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

[0296] In combination Figure 14 For illustration, it is exemplarily determined that device A is the 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 considered, so that the most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operation, help maintain the consistency and accuracy of the synchronized files. At the same time, it can avoid the situation of overload, ensure that the device resources are reasonably allocated and optimally used, reduce unnecessary resource consumption, reduce the cost of file synchronization, and enhance the reliability of file synchronization.

[0298] And the appropriate synchronization source device is selected by the preset synchronization strategy and automatic scoring, which simplifies the complexity of manual decision and reduces human errors.

[0299] Optionally, in a possible implementation, determining the synchronization source device from the at least two trusted electronic devices according to the influence factors of each trusted electronic device can include: calculating a synchronization suitability score for each trusted electronic device according to the influence factors of each trusted electronic device; and determining the synchronization source device from the at least two trusted electronic devices according to the synchronization suitability score of each trusted electronic device.

[0300] For example, the score strategy for each of the influence factors is set in advance, and the score strategy can include a score interval and a score rule. For example, the score interval corresponding to the power state is 0-100 points, and the score rule is that the power is greater than 80% for 100 points, the power is greater than 40% and less than or equal to 80% for 50 points, and the power is less than or equal to 40% for 0 point; the score interval corresponding to the device type is 0-80 points, and the score rule is that the device type is NAS for 80 points, the device type is PC for 60 points, the device type is PAD for 40 points, and the device type is mobile phone for 20 points; the score interval corresponding to the network state is 0-100 points, and the score rule is that the network state is a strong network connection state (such as low delay and high speed) for 100 points, the network state is a medium network connection state for 50 points, and the network state is a weak network connection state (such as high delay and low speed) for 10 points; the score interval corresponding to the device usage frequency is 1-50 points, and the score rule is that the usage frequency is frequent for 50 points, the usage frequency is occasional for 25 points, and the usage frequency is seldom for 0 point, and the like. This is only an exemplary description, and is not limited thereto.

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

[0302] In this implementation, the synchronization suitability score of the trusted electronic device is calculated, and the process of determining the synchronization source device for file synchronization according to the synchronization suitability score can select the most suitable synchronization source device from multiple trusted electronic devices, which can ensure more efficient synchronization operation and is conducive to maintaining the consistency and accuracy of the synchronized files. At the same time, it can avoid overloading and ensure that device resources are reasonably allocated and optimally used, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0303] Optionally, a weight value is assigned to each of the influence factors based on pre-setting a scoring strategy for each of the influence factors, and the weight value can be determined based on a percentage or be a fixed value.

[0304] For example, the score of each factor is calculated according to the scoring strategy, the scores of each factor are weighted by using a weighted average method, the weighted score of each factor is calculated, and 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 influence factors, the accuracy of the final synchronization suitability score can be improved, so that a more suitable synchronization source device can be determined.

[0306] Optionally, in a possible implementation, a machine learning model, such as a scoring model, can be pre-trained to calculate the synchronization suitability score of each trusted electronic device. For example, the influence factors corresponding to each trusted electronic device are obtained, each of the influence 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 of each trusted electronic device is calculated by using the 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 the device types of the at least two trusted electronic devices are different, the synchronization source device is determined from the at least two trusted electronic devices according to the influence factors of each trusted electronic device, which can include: determining the priority of each trusted electronic device according to the influence factors of each trusted electronic device; and determining the synchronization source device from the at least two trusted electronic devices according to the priority of each trusted electronic device.

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

[0310] For example, any one of the factors is the power state, and the trusted electronic device with a high remaining power has a higher priority than the trusted electronic device with a low remaining power. The trusted electronic device with a high remaining power is assigned a first priority, and the trusted electronic device with a low remaining power is assigned a 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 example, the plurality of factors include the power state and the device type, and the device type of each trusted electronic device in the trust circle is different. For example, the plurality of trusted electronic devices are respectively a NAS, a PC, a PAD, and a mobile phone, and the priority of the NAS is greater than that of the PC, the priority of the PC is greater than that of the PAD, and the priority of the PAD is greater than that of the mobile phone according to the power state and the device type. The NAS in the trust circle is determined as the synchronization source device.

[0312] Optionally, in a possible implementation, different priorities of the trusted electronic devices of different device types are determined according to any one or more of the factors in advance. The device type of each trusted electronic device in the trust circle is acquired, and the trusted electronic device of the device type with the higher priority is determined as the synchronization source device. For example, the priority of the NAS is greater than that of the PC, the priority of the PC is greater than that of the PAD, and the priority of the PAD is greater than that of the mobile phone according to the power state and the device type. The device types of the plurality of trusted electronic devices in the current trust circle are acquired as the NAS and the PAD, and the NAS is determined as the synchronization source device.

[0313] In this implementation, the synchronization source device is determined by determining the priority of the device, the resource can be reasonably allocated according to the importance and function of different devices, and the appropriate synchronization source device is selected, so that the efficiency and accuracy of subsequent file synchronization are improved.

[0314] Optionally, if the synchronization source device has a problem, other devices can also be automatically determined as backup synchronization source devices, so that the continuity of the file synchronization operation is ensured.

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

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

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

[0318] The associated file path is a file path having a containing relationship, and the file path having the containing relationship comprises at least one child file path and one parent file path, wherein the scanning result corresponding to the child file path is notified to the scanning task corresponding to the parent file path, and the scanning result corresponding to the child file path in the file path having the containing relationship is notified to the parent file path in the file path having the containing relationship.

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

[0320] Optionally, the scanning task can comprise monitoring and scanning of the file path.

[0321] In this implementation, after the file path having the containing relationship is determined, the scanning tasks corresponding to the file path having the containing relationship are merged, and since the scanning result corresponding to the child file path in the file path having the containing relationship is notified to the scanning task corresponding to the parent file path, even if the scanning tasks are merged, the scanning tasks corresponding to the file path having the containing relationship can be successfully completed. Moreover, since the scanning tasks are merged, in the process of executing the merged scanning tasks, multiple scanning of the same file path can be avoided, thereby effectively reducing the number of scans, reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the allocation of resources in the system, accelerating the entire file synchronization process, and improving the subsequent file synchronization efficiency.

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

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

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

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

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

[0327] Optionally, the feeding back of the scan result to the scan task corresponding to each file path in the associated file path comprises: adding the scan result to a preset notification list. 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] In this implementation, it is beneficial to subsequently synchronize the files scanned based on the scan tasks to the trusted electronic device, which provides a guarantee for the accuracy of file synchronization while reducing the number of scans and reducing the power consumption of the electronic device.

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

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

[0332] Optionally, the method for processing data further comprises: 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, the relevant information of the scan task is cleared when the scan cancellation notification is obtained, which can release more system resources, reduce the processing burden of the system, and improve the processing speed of the system. At the same time, the different needs of the user in the file synchronization scenario are responded to in a timely manner, and the user experience is improved.

[0333] Optionally, the method further comprises: determining that there is no containing relationship between the other plurality of file paths; and clearing the scan start time of the target scan task. The other plurality of file paths are file paths other than the file path corresponding to any scan task. In this way, when it is determined that there is no containing relationship between the other plurality of file paths, the relevant information of the scan task is cleared, so that the relevant information of the scan task does not affect other scan tasks, and the other scan tasks can be completed smoothly.

[0334] Optionally, after receiving the scan cancellation notification, the method further comprises: determining that there is a containing relationship between the other plurality of file paths; and merging the scan tasks corresponding to the other plurality of file paths having the containing relationship.

[0335] Optionally, the method further comprises: determining that there is a containing relationship between the other plurality of file paths; obtaining the scan time intervals corresponding to the file paths having the containing relationship; merging the scan tasks corresponding to the file paths having the containing relationship into a new target scan task; and setting a new scan time interval corresponding to the new target scan task according to the scan time intervals corresponding to the file paths having the containing relationship.

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

[0337] In this way, after the scan cancellation notification is obtained, the scan tasks corresponding to the remaining file paths having the containing relationship are merged, so that when the merged scan task is executed, the same file path is not scanned multiple times, thereby effectively reducing the number of scans, reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the allocation of resources in the system, speeding up the entire file synchronization process, and improving the subsequent file synchronization efficiency.

[0338] It should be noted that the method provided by the present application can be applied to any scenario in which files need to be monitored and scanned. When the electronic devices in the trust circle synchronize files, the method can be applied to the electronic devices or the trusted electronic devices.

[0339] In the related art, when the electronic devices in the trust circle synchronize files, the synchronized files are not checked, which may result in inconsistency between the synchronized files and the source files, affecting the integrity of the file synchronization. If the synchronized files are tampered with, the electronic devices in the trust circle may be at risk, resulting in an unsafe and error-prone file synchronization process.

[0340] Therefore, the embodiment of the present application further provides a file synchronization method applied to an electronic device, wherein a trust circle in which the electronic device is located further comprises at least one trusted electronic device, and the method comprises the following steps: obtaining a to-be-synchronized file sent by the at least one trusted electronic device; generating a temporary synchronization file according to the to-be-synchronized file; checking the temporary synchronization file; and synchronizing the temporary synchronization file to a file system when the temporary synchronization file passes the check. Optionally, the checking of the temporary synchronization file can comprise checking the integrity of the temporary synchronization file, the consistency of the temporary synchronization file and a source file, whether the function of the temporary synchronization file is normal, and the like.

[0341] In this implementation, since the temporary synchronization file is checked, it can be ensured that the file received by the electronic device is consistent with the source file, the integrity of file synchronization is ensured, and the accuracy of file synchronization is improved. The checking of 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 circle from being attacked by malicious software or viruses, and improve the security of the file synchronization process.

[0342] Optionally, the checking of the temporary synchronization file comprises the following steps: obtaining source end metadata sent by the at least one trusted electronic device; generating a check value corresponding to the temporary synchronization file and a check value corresponding to the source end metadata; and determining that the temporary synchronization file passes the check when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source end metadata. Optionally, the check value of the temporary synchronization file and the check value of the source end metadata can each comprise a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, and the like. In this implementation, the consistency of the temporary synchronization file and the source file is checked, and the file is synchronized when the temporary synchronization file and the source file are consistent, so that the finally synchronized file is accurate and reliable, and the accuracy of file synchronization is improved. The checking of 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 circle from being attacked by malicious software or viruses, and improving the security of the file synchronization process.

[0343] Optionally, the synchronizing of the temporary synchronization file to the file system comprises the following steps: deleting a local file corresponding to the temporary synchronization file in the file system; modifying the file name of the temporary synchronization file; and storing the temporary synchronization file with the modified file name to the file system. Optionally, the file name of the temporary synchronization file after modification is consistent with the file name of the local file. In this implementation, the local file is deleted first, and then the file name of the temporary synchronization file is modified, so that the file name conflict can be avoided, errors caused by inconsistent file names or file versions can be reduced, and the integrity and consistency of file synchronization can be ensured.

[0344] Optionally, the temporary synchronization file is generated according to the file to be synchronized, including: performing incremental synchronization on the local file and the file to be synchronized to generate the temporary synchronization file. In this implementation manner, the multi-end synchronization of the file is completed in the incremental synchronization manner, which can effectively reduce the data amount of file transmission and save the bandwidth. Moreover, due to the reduction of the data amount of transmission, the file synchronization process is accelerated, and the overall data synchronization efficiency is improved. Meanwhile, since the electronic device only needs to process the changed file, the load in the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0345] Optionally, before the file to be synchronized sent by the at least one trusted electronic device is acquired, the file synchronization method can further include: acquiring the local metadata; detecting that the local metadata matches the local file; comparing whether the local metadata is consistent with the source-end metadata; and updating the local file when the local metadata is consistent with the source-end metadata. In this implementation manner, the local metadata and the local file are verified, and the local metadata and the source-end metadata are verified. When the verification is passed, the subsequent file synchronization process is performed, which can ensure the accuracy of the subsequent file synchronization result.

[0346] Optionally, after the local metadata is detected to match the local file and the local metadata is compared with the source-end metadata, the file synchronization method can further include: when the local metadata is inconsistent with the source-end metadata, determining difference data between the local metadata and the source-end metadata; and sending the difference data to the at least one trusted electronic device. In this implementation manner, when the local file is determined to be 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 guarantee for the file synchronization.

[0347] Optionally, after the local metadata is detected to match the local file and the local metadata is compared with the source-end metadata, the file synchronization method can further include: when the local metadata is inconsistent with the source-end metadata, determining difference data between the local metadata and the source-end metadata; and sending the difference data to the at least one trusted electronic device. In this implementation manner, when the local file is determined to be 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 guarantee for the file synchronization.

[0348] Optionally, after the local metadata is detected to match the local file and the local metadata is compared with the source-end metadata, the file synchronization method can further include: when the local metadata is inconsistent with the source-end metadata, determining difference data between the local metadata and the source-end metadata; and sending the difference data to the at least one trusted electronic device. In this implementation manner, when the local file is determined to be 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 guarantee for the file synchronization.

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

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

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

[0352] As shown in Figure 16 , the electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge 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 loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0353] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown in Figure 16 , or the electronic device 100 can include Figure 16combinations of some of the illustrated components, or the electronic device 100 can include Figure 16 sub-components of some of the illustrated components. Figure 16 The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

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

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

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

[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 all home screens of the electronic device 100. Generally, the size of the display screen 194 of the electronic device 100 is fixed, and only a limited number of controls can be displayed in the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component included in an application program, controlling all data processed by the application program and interactive operations related to the data, and a user can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally, a control can include 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 embodiments of the present application can be a touch screen. The display screen 194 can be integrated with a touch sensor 180K. The touch sensor 180K can also be referred to as a "touch panel". That is, the display screen 194 can include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch panel". The touch sensor 180K is used to detect a touch operation acting on or near it. After the touch operation detected by the touch sensor 180K, the touch operation can be transmitted to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event. The visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can 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 realize the data storage function. For example, files such as music and video are saved 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 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one APP required by a function (such as a sound playing function, an image playing function, etc.), and the like. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), and the like.

[0361] In addition, the internal memory 121 can include a high-speed random access memory; the internal memory 121 can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.

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

[0363] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompt and also 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 with the hardware structure described above.

[0365] The file synchronization method provided in the present application will be described below in combination with the software structure. Please refer to Figure 17 , Figure 17 The software structure of the electronic device shown in the embodiments of the present application is schematically shown in the figure.

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

[0367] The Application layer can include a series of application packages, such as a trust circle application. In the embodiments of the present application, the file synchronization SDK is integrated in the trust circle application, thereby configuring the trust circle application with the capability of file synchronization.

[0368] Optionally, the Application layer can also include a database. The database provides the application with functions such as data storage, data modification, data deletion, data addition, and data query.

[0369] The Framework layer provides the application in the Application layer with an Application Programming Interface (API) and a programming framework. The Framework layer includes some pre-defined functions.

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

[0371] Optionally, the Framework layer can also include a database.

[0372] Optionally, the database can also interact with the Hardware Abstraction layer, such as by calling and managing data in the file system through the operating system.

[0373] Optionally, the Hardware Abstraction layer can include a file system.

[0374] The trust circle application, the file synchronization service module, the database, and the file system interact to implement the data processing method and the file synchronization method in the above method embodiments. For details, refer to the related description in the foregoing embodiments, which will not be repeated here.

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

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

[0377] It should be noted that all related content of each step involved in the above method embodiments can be cited to the function description of the corresponding functional module, which will not be repeated here.

[0378] The electronic device provided by the embodiments of the present application is used to execute the above file synchronization method, and thus can achieve the same effect as the above implementation method.

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

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

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

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

[0383] The embodiments of the present application also provide a computer program product, which, when running on a computer, enables the computer to execute the above related steps to implement the file synchronization method in the above embodiments.

[0384] The embodiments of the present application also provide a chip. Please refer to Figure 18 , Figure 18 Fig. 1 shows a structural schematic diagram of a chip according to an embodiment of the present application. Figure 18 The chip shown in Fig. 1 can be a general-purpose processor or a special-purpose processor. The chip includes a processor 210. The processor 210 is used to execute the data processing method and the file synchronization method in any of the above embodiments.

[0385] Optionally, the chip further includes a transceiver 220, which is used to accept the control of the processor and is used to support the communication device to execute the above-mentioned technical solutions.

[0386] Optionally, Figure 18 The chip shown in Fig. 1 can further include a storage medium 230.

[0387] It should be noted that, Figure 18The illustrated chip can be implemented using one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gated logic, discrete hardware components, any other suitable circuitry, or any combination thereof capable of implementing the various functions described throughout this application.

[0388] Wherein, the electronic device, computer readable storage medium, computer program product or chip provided by the embodiment are used for executing the corresponding method provided above, thus the beneficial effects achieved thereby can refer to the beneficial effects of the corresponding method provided above, which will not be repeated here.

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

[0390] In 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 actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

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

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

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

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

Claims

1. A file synchronization method, characterized by, The method is applied to an electronic device, a trust ring in which the electronic device is located also includes at least two trusted electronic devices, and the method comprises the following steps: Obtaining an influencing factor of each trusted electronic device; the influencing factor comprises at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, and a user preference; According to the influencing factor, a synchronization suitability score corresponding to each trusted electronic device is calculated; and according to the synchronization suitability score of each trusted electronic device, a synchronization source device is determined from the at least two trusted electronic devices; It is determined that at least two directories in the electronic device synchronize a same file from the synchronization source device; Any directory requests to obtain the same file from the synchronization source device; the any directory is any one of the at least two directories; After the any directory obtains the same file, a link corresponding to the same file is created; the link is used to point to the same file; the any directory sends the link to other directories through a move command; the other directories are directories other than the any directory in the at least two directories; wherein, a directory to which the same file belongs has a containing relationship, a subdirectory to which the same file belongs is directly mapped to the any directory, and a parent directory to which the same file belongs is directly mapped to the other directories.

2. The method of claim 1, wherein, The determination that at least two directories in the electronic device synchronize a same file from the synchronization source device comprises: Obtaining a to-be-synchronized file list, the to-be-synchronized file list comprising to-be-synchronized files corresponding to the at least two directories respectively; Comparing the to-be-synchronized files corresponding to the at least two directories respectively; When the to-be-synchronized files corresponding to the at least two directories are consistent, it is determined that the at least two directories synchronize a same file from the synchronization source device.

3. The method of claim 2, wherein, The comparison of the to-be-synchronized files corresponding to the at least two directories comprises: Obtaining metadata of the to-be-synchronized files 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 synchronize a same file from the synchronization source device.

4. The method according to any one of claims 1 to 3, characterized in that, The request of the any directory to obtain the same file from the synchronization source device comprises: The any directory initiates a file synchronization request to the synchronization source device, and the file synchronization request is used to trigger the synchronization source device to send the same file to the electronic device; The other directories are marked to synchronize the same file with the any directory.

5. The method of claim 4, wherein, After the any directory requests to obtain the same file from the synchronization source device, the method further comprises: Obtaining a file path of the marked other directories; Copying the same file into the file path of the marked other directories.

6. The method of claim 1, wherein, The device types of the at least two trusted electronic devices are different, and the method further comprises: According to the influencing factor of each trusted electronic device, a priority of each trusted electronic device is determined; According to the priority of each trusted electronic device, the synchronization source device is determined from the at least two trusted electronic devices.

7. An electronic device, comprising: Comprise: One or more processors; one or more memories; The memory stores one or more programs, which, when executed by the processor, cause the electronic device to perform the method of any one of claims 1-6.

8. A chip, characterized by comprising: a processor configured to call and run a computer program from the memory, so that the electronic device installed with the chip performs the method of any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which, when executed by the processor, causes the processor to perform the method of any one of claims 1-6.

Citation Information

Patent Citations

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

    CN115348259A

  • File transmission method and device

    CN116932479A