Data processing method, electronic equipment and storage medium

By combining the associated file path scanning task during file synchronization, the problem of excessive scans during file synchronization is solved, efficiency is improved, power consumption is reduced, and resource allocation is optimized.

CN119248738AActive Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

During the file synchronization process, excessive file scans lead to low efficiency and high equipment power consumption, and the existing technology is difficult to effectively solve this problem.

Method used

By determining the existence of a file path containing relationships in the electronic device, the scanning tasks of associated file paths are merged, multiple scans of the same file path are avoided, resource allocation is optimized, and synchronization efficiency is improved.

Benefits of technology

It effectively reduces the number of scans during file synchronization, reduces the power consumption of electronic devices, and improves file synchronization efficiency and system resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248738A_ABST
    Figure CN119248738A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method, electronic equipment and a storage medium, and relates to the technical field of data processing. The method is applied to the electronic device, a trust ring where the electronic device is located further comprises at least one trusted electronic device, files in the electronic device can be synchronized to the trusted electronic device, and the method comprises the steps that a file synchronization request is obtained; determining a plurality of scanning tasks corresponding to the file synchronization request, wherein each scanning task corresponds to a file path; determining an associated file path in the plurality of file paths, wherein the associated file path is a file path having an inclusion relationship; and combining the scanning tasks corresponding to the associated file paths. According to the method, in the file synchronization process, the file scanning frequency can be reduced, the file synchronization efficiency is improved, and the equipment power consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

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

[0003] For example, in a distributed file synchronization scenario, mobile phones and other electronic devices (such as tablets, laptops, home storage devices, etc.) use near-field communications, such as wireless fidelity (Wi-Fi), Bluetooth (BT), and peer-to-peer (P2P) to form a local area network, establish a trust loop, and synchronize files in the mobile phone to other electronic devices.

[0004] However, it was found during use that during the file synchronization process, the file was scanned too many times, resulting in low file synchronization efficiency and high device power consumption. Summary of the invention

[0005] The present application provides a method for processing data, an electronic device and a storage medium, which can reduce the number of file scans during file synchronization, improve file synchronization efficiency and reduce device power consumption.

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

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

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

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

[0010] Optionally, the file synchronization request may be triggered by an electronic device or a trusted electronic device.

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

[0012] In combination with the first aspect, in certain implementations of the first aspect, the scanning tasks corresponding to the associated file paths are merged, including: 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 based on the at least two scanning time intervals.

[0013] Optionally, different file paths correspond to different scanning time intervals; the target scanning time interval is greater than or equal to the smallest scanning time interval among at least two scanning time intervals, and less than the largest scanning time interval among at least two scanning time intervals.

[0014] In this implementation, since the scanning tasks are merged, multiple scans of the same file path can be effectively avoided during the execution of the merged scanning tasks, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0015] In combination with the first aspect, in certain implementations of the first aspect, the method for processing data may further include: scanning a file path corresponding to the target scanning task according to a target scanning time interval to obtain a scanned file.

[0016] Optionally, the scanned file is used to synchronize to at least one trusted electronic device in the trust ring.

[0017] In this implementation, other file paths are not considered, and the file path corresponding to the target scanning task is scanned purposefully, which improves the scanning efficiency, thereby speeding up the entire file synchronization process and improving the subsequent file synchronization efficiency.

[0018] In combination with the first aspect, in certain implementations of the first aspect, the method for processing data may also include: obtaining a list to be scanned, scanning each file path in the list to be scanned according to a target scanning time interval, and when any file path in the associated file path is scanned, obtaining the scanning result of any file path; and feeding back the scanning result to the scanning task corresponding to each file path in the associated file path.

[0019] Optionally, the list to be scanned includes associated file paths, file paths not associated with scan tasks, and non-associated file paths associated with scan tasks. In other words, the list to be scanned includes all file paths.

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

[0021] In combination with the first aspect, in certain implementations of the first aspect, the method for processing data may further include: setting a scan start time of the target scan task according to a target scan time interval; and starting scanning when the current time reaches the scan start time.

[0022] In this implementation, the scanning start time is set first and then the file path is scanned, which can accurately record the execution time of each scanning operation to avoid scanning errors. And determining the start and end time of each scanning operation helps to reasonably allocate system resources.

[0023] In combination with the first aspect, in certain implementations of the first aspect, feeding back the scanning result to the scanning task corresponding to each file path in the associated file path includes: adding the scanning result to a preset notification list.

[0024] The notification list is used to feed back the scanning result to the scanning task corresponding to each file path in the associated file path.

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

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

[0027] In combination with the first aspect, in some implementations of the first aspect, the method for processing data may further include: after scanning each file path in the to-be-scanned list, deleting all scanning results in the notification list.

[0028] In this implementation, all scan results in the notification list are deleted at one time, which simplifies the deletion steps and improves the deletion efficiency.

[0029] In combination with the first aspect, in some implementations of the first aspect, the method for processing data may further include: after scanning any file path in the associated file paths, deleting the scanning result corresponding to any file path in the notification list.

[0030] In this implementation, each time a file path is scanned, a corresponding scan result is deleted, which can save storage space, avoid false feedback, and improve the accuracy of file synchronization.

[0031] In combination with the first aspect, in some implementations of the first aspect, the method for processing data may further include: acquiring a scan cancellation notification, and clearing a scan start time of a target scan task.

[0032] The cancel scan notification is used to cancel any scan task corresponding to the associated file path.

[0033] In this implementation, when a scan cancellation notification is received, the relevant information of the scan task is cleared, which can release more system resources, reduce the system processing burden, and improve the system processing speed. At the same time, it promptly responds to the different needs of users in file synchronization scenarios and improves the user experience.

[0034] In combination with the first aspect, in some implementations of the first aspect, clearing the scan start time of the target scan task includes: determining that there is no inclusion relationship between other multiple file paths; and clearing the scan start time of the target scan task.

[0035] The other multiple file paths are multiple file paths other than the file path corresponding to any scanning task.

[0036] This implementation method clears the relevant information of the scanning task when it is determined that there is no inclusion relationship between the other multiple file paths, thereby avoiding the influence of the clearing of the relevant information of the scanning task on other scanning tasks and ensuring that other scanning tasks can be successfully completed.

[0037] In combination with the first aspect, in certain implementations of the first aspect, after obtaining the cancellation scan notification, the method for processing data may also include: determining that there is an inclusion relationship between multiple other file paths; and merging the scan tasks corresponding to the multiple other file paths that have an inclusion relationship.

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

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

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

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

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

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

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

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

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

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

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

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

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

[0051] Figure 1 A schematic diagram of a system architecture applicable to the method for processing data shown in an embodiment of the present application;

[0052] Figure 2 A schematic diagram of another system architecture applicable to the method for processing data shown in the embodiment of the present application;

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

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

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

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

[0057] Figure 7 A schematic diagram of a file directory shown in an embodiment of the present application;

[0058] Figure 8 A flowchart of a method for processing data shown in an embodiment of the present application;

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

[0060] Fig.10 A flowchart of another method for processing data according to an embodiment of the present application;

[0061] Fig.11 A schematic diagram of a scanning process for a document shown in an embodiment of the present application;

[0062] Fig.12 A schematic diagram of a process for setting a timed scan according to an embodiment of the present application;

[0063] Fig.13 A schematic diagram of a flow chart of a timed scanning file path shown in an embodiment of the present application;

[0064] Fig.14 A schematic diagram of a process of canceling a scanning task shown in an embodiment of the present application;

[0065] Fig.15 A schematic diagram of another process of canceling a scanning task according to an embodiment of the present application;

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

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

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

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

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

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

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

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

[0074] 1. Trust Ring and Trusted Electronic Devices

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

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

[0077] The electronic devices in the trust ring form a local area network through near field communication, and data synchronization can be performed through the local area network to achieve device collaboration. In the embodiment of the present application, data synchronization includes but is not limited to file synchronization.

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

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

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

[0081] 3. Trust Ring Application

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

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

[0084] 4. Software Development Kit (SDK)

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

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

[0087] 5. Directories and folders

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

[0089] 6. Water level synchronization

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0132] The file synchronization configuration information may include the number of file synchronizations, the file synchronization version, the name of the trusted electronic device, the REPO identification information of the trusted electronic device, the file path of the trusted electronic device, the filter file, and the like.

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

[0134] The REPO identification information of the trusted electronic device is the ID of the REPO of the trusted electronic device, which is used to uniquely identify the REPO of the trusted electronic device. Exemplarily, when the REPO identification information of the mobile phone matches the REPO identification information of the tablet computer, the mobile phone and the tablet computer can synchronize files.

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

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

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

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

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

[0140] In the embodiment of the present application, the REPO directory can be stored in a local database of the mobile phone that can be persisted. In this way, after the user sets the file synchronization function, even if the mobile phone is restarted or the trusted ring application is restarted, the relevant information of the file synchronization function set by the user can be read from the local database to ensure that the relevant information of the REPO directory will not be lost. For the user, only the relevant information of the file synchronization function needs to be set once, and it can be used all the time, without having to reset the relevant information of the file synchronization function every time the mobile phone is restarted or the trusted ring application is restarted, which improves the user experience.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0169] It should be understood that the electronic device and the trusted electronic device perform file metadata synchronization processing. After the electronic device sends the file metadata to the trusted electronic device, the trusted electronic device needs to compare the file metadata sent by the electronic device with its own file metadata. Figure 6As shown, the comparison method specifically includes:

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

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

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

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

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

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

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

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

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

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

[0180] It is worth noting that the above description of the specific process of file synchronization between electronic devices in the trust ring is based on the example of synchronizing files in a mobile phone to a tablet computer, so the description is mainly based on the method performed on the mobile phone side. It is understandable that when it is necessary to synchronize files in a tablet computer to a mobile phone, the tablet computer can execute the steps executed by the mobile phone, and the mobile phone can execute the steps executed by the tablet computer.

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

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

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

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

[0185] like Figure 7 As shown, each letter represents a file directory, and each file directory corresponds to a file path. By scanning the file path, the file pointed to by the file path and the file content of the file can be found.

[0186] Exemplarily, the file directory associated with the scanning task is determined according to the file synchronization request. It can be generally understood that the file path corresponding to which file directory needs to be monitored and scanned is determined according to the file synchronization request, that is, which file directory is associated with the scanning task.

[0187] like Figure 7 As shown, assuming that the user wants to synchronize the files corresponding to the file directories D, D1, D2, and D221 in the mobile phone to the tablet computer, then when setting the file synchronization function, the file directories D, D1, D2, and D221 are specified. Afterwards, when the mobile phone obtains the file synchronization request, it determines the scanning tasks corresponding to the file directories D, D1, D2, and D221 according to the file synchronization request, and each scanning task corresponds to a file path.

[0188] As we know, there is usually a containment or inclusion relationship between directories. Figure 7As shown, in addition to the root directory " / ", each directory has a parent directory, and in different scenarios, each directory can also be used as a subdirectory. For example, the parent directories of file directory A and file directory E are both root directories " / ", and at the same time, file directory A and file directory E are also subdirectories of the root directory " / ". The parent directory of file directory D111 is file directory D11, the parent directory of file directory D11 is file directory D1, the parent directory of file directory D1 is file directory D, and the parent directory of file directory D is the root directory " / ". Correspondingly, file directory D111 is a subdirectory of file directory D11, file directory D111 and file directory D11 are both subdirectories of file directory D1, file directory D111, file directory D11, and file directory D1 are all subdirectories of file directory D, and file directory D111, file directory D11, file directory D1, and file directory D are all subdirectories of the root directory " / ". The same is true for file directories D221, D22, and D2, which will not be repeated here.

[0189] When file directories D, D1, D2, and D221 correspond to scanning tasks respectively, it is necessary to monitor and scan the file paths corresponding to the file directories D, D1, D2, and D221. Since there is an inclusion relationship between file directories D and D1, for the scanning task corresponding to file directory D1, all scanned files under file directory D1 and its subdirectories (such as file directory D11 and file directory D111) must notify the scanning task corresponding to file directory D in addition to notifying the scanning task corresponding to file directory D1; for the scanning task corresponding to file directory D, all scanned files under file directory D and its subdirectories (such as file directory D111, file directory D11, file directory D1) must notify the scanning task corresponding to file directory D. The same is true for file directories D, D2, and D221, which will not be repeated here.

[0190] In this case, even if all scanned files in file directory D1 and its subdirectories have been notified to the scanning task corresponding to file directory D when the scanning task corresponding to file directory D is completed, the file paths corresponding to file directory D and its subdirectories still need to be monitored and scanned when the scanning task corresponding to file directory D is completed. This is equivalent to multiple monitoring and scanning of the file paths corresponding to file directory D1 and its subdirectories, and each monitoring requires the creation of a corresponding monitoring task, or each monitoring requires the start of a corresponding monitoring thread, resulting in an increase in the number of started monitoring threads, an increase in the number of times the file path is scanned, and repeated monitoring and scanning, which ultimately leads to low file synchronization efficiency and high power consumption of electronic equipment.

[0191] In view of this, an embodiment of the present application provides a method for processing data, which is applied to an electronic device, wherein the trust ring in which the electronic device is located also includes at least one trusted electronic device, and files in the electronic device can be synchronized to at least one trusted electronic device, and the method for processing data includes: obtaining a file synchronization request; determining multiple scanning tasks corresponding to the file synchronization request, each scanning task corresponds to a file path; determining an associated file path among the multiple file paths, the associated file path is a file path with an inclusion relationship; the file path with an inclusion relationship includes at least one child file path and one parent file path, and the scanning result corresponding to the child file path is notified to the scanning task corresponding to the parent file path; and merging the scanning tasks corresponding to the associated file paths.

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

[0193] The method for processing data provided in the embodiment of the present application is applicable to any scenario in which monitoring and scanning of files are required in near field communications.

[0194] The following describes the method for processing data provided in the embodiment of the present application in conjunction with the flow chart.

[0195] See also Figure 8 , Figure 8 The following is a flow chart of a method for processing data according to an embodiment of the present application. The method includes:

[0196] S301: A file synchronization request is obtained.

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

[0198] Exemplarily, the file synchronization request can be triggered by an electronic device or a trusted electronic device. It can be generally understood that the file synchronization request can be actively triggered by the electronic device or the electronic device can passively receive the file synchronization request sent by a trusted electronic device in the trust ring.

[0199] In one example, when the trusted ring application installed on the mobile phone receives the user's operation to turn on the file synchronization function, a file synchronization request is triggered. For example, the user wants to synchronize pictures on the mobile phone to the tablet computer. After selecting pictures in the gallery through the trusted ring application, the "Start Synchronization" option is selected to trigger a file synchronization request, and the mobile phone sends the selected pictures to the tablet computer. It is understandable that when the user selects a picture in the gallery, he can also specify the storage location of the picture in the tablet computer.

[0200] In another example, a user wants to synchronize pictures on a mobile phone to a tablet computer, and the tablet computer initiates a file synchronization request to the mobile phone. The file synchronization request carries indication information of the pictures to be synchronized. The mobile phone receives the file synchronization request and synchronizes the pictures to the tablet computer according to the indication information of the pictures.

[0201] Optionally, in a possible implementation, a file synchronization request can be automatically triggered by an electronic device. For example, the user sets the file to be automatically synchronized every other day, or every seven days, etc. Then, after the first synchronization of files, the mobile phone automatically triggers a file synchronization request every other day. For another example, the user sets the time to start automatic file synchronization after reaching a preset time point (such as 8 o'clock, 12 o'clock, 23 o'clock, etc.), then, when the mobile phone detects that the current time has reached the preset time point, it automatically triggers a file synchronization request. This is only an exemplary description and is not limited to this.

[0202] Optionally, in another possible implementation, the trusted electronic device within the trust ring may also automatically trigger a file synchronization request, and send the file synchronization request to the electronic device after each trigger. Please refer to the relevant description of the electronic device, which will not be repeated here.

[0203] S302: Determine multiple scanning tasks corresponding to the file synchronization request.

[0204] The file synchronization request is used to trigger the electronic device to synchronize the file that the user wants to synchronize with the trusted electronic device. In some descriptions of the embodiments of the present application, the file that the user wants to synchronize is also referred to as a to-be-synchronized file.

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

[0206] In an embodiment of the present application, the scanning task may include monitoring and scanning the file path.

[0207] It is understandable that when a user wants to synchronize a file, the electronic device needs to monitor and scan the file, and the file synchronization request is generated based on the file that the user wants to synchronize. Therefore, the file synchronization request can carry the corresponding scanning task, or in other words, multiple scanning tasks corresponding to the file synchronization request can be determined based on the file synchronization request.

[0208] For easier understanding, see Fig. 9 , Fig. 9 Another file directory diagram shown in the embodiment of the present application. Fig. 9 As shown, each letter represents a file directory, and a letter with a gray background indicates that the file path corresponding to the file directory is associated with a scan task, that is, a letter with a gray background indicates that the file directory corresponds to a scan task. For example, according to the file synchronization request, it is determined that the file directories A, E, D, D1, D2, and D221 each correspond to a scan task, and the file paths corresponding to the file directories A, E, D, D1, D2, and D221 are the file paths that need to be monitored and scanned for each scan task.

[0209] S303: Determine an associated file path among multiple file paths.

[0210] Exemplarily, the associated file path is a file path with a containment relationship, and the file path with a containment relationship includes at least one child file path and one parent file path. It can be understood that the containment relationship is divided into containment and being contained. In different scenarios, for the same file path, it may be a child file path contained in another parent file path, or it may be a parent file path containing another child file path. The actual situation shall prevail and no limitation is made to this.

[0211] Since each file directory has a corresponding file path, there is an inclusion relationship between multiple file paths, and accordingly, there is also an inclusion relationship between multiple file directories.

[0212] Exemplarily, multiple file paths corresponding to multiple scanning tasks can be traversed through graph structures, graph algorithms, trees, graph databases, function writing, etc., to determine file paths with inclusion relationships among the multiple file paths.

[0213] For the convenience of description, in the embodiment of the present application, the letters of the file directory are used to represent the file path corresponding to the file directory. For example, the file paths corresponding to the file directories A, E, D, D1, D2 and D221 are A, E, D, D1, D2 and D221 respectively.

[0214] Combination Fig. 9 , the parent file paths of file path A and file path E are both " / ", and both file path A and file path E are also child file paths of " / ". The child file path of file path D is file path D1, and the parent file path of file path D is " / ". The parent file path of file path D2 is file path D, the child file path of file path D2 is file path D22, and the parent file path of file path D221 is file path D22.

[0215] File paths A, E, D, D1, D2, and D221 are all associated with scanning tasks, and file paths A, E, D, D1, D2, and D221 need to be monitored and scanned. Among file paths A, E, D, D1, D2, and D221, there is an inclusion relationship between file paths D and D1, and there is an inclusion relationship between file paths D, D2, and D221, that is, file paths D and D1 are associated file paths, and file paths D, D2, and D221 are associated file paths.

[0216] Exemplarily, the scanning result corresponding to the child file path is notified to the scanning task corresponding to the parent file path. For example, for the associated file paths D and D1, all the scanned files under the file path D1 and its child file paths (such as file path D11 and file path D111) are notified to the scanning task corresponding to the file path D1, and also to the scanning task corresponding to the file path D.

[0217] For another example, for the associated file paths D, D2, and D221, for all scanned files under file path D221, in addition to notifying the scanning task corresponding to file path D221, the scanning task corresponding to file path D2 and file path D must also be notified; for all scanned files under file path D2 and its sub-file paths (such as file path D22 and file path D221), in addition to notifying the scanning task corresponding to file path D2, the scanning task corresponding to file path D must also be notified.

[0218] For the above-mentioned associated file paths D and D1, when completing the scanning task corresponding to file path D, it is also necessary to monitor and scan file path D and all its sub-file paths (such as file path D1, file path D11, and file path D111). In other words, in the process of completing the scanning task corresponding to associated file paths D and D1, file path D1 and its sub-file paths are repeatedly monitored and scanned, resulting in an increase in the number of started monitoring threads and the number of times the file paths are scanned, which ultimately leads to low file synchronization efficiency and high power consumption of electronic equipment. Therefore, the method for processing data provided in the embodiment of the present application merges the scanning tasks corresponding to the associated file paths. The same is true for associated file paths D, D2, and D221, which will not be repeated here.

[0219] S304: Merge the scan tasks corresponding to the associated file paths.

[0220] Exemplarily, at least two scanning tasks corresponding to the associated file paths are merged into one scanning task. Take the associated file paths D and D1 as an example for illustration. For example, the scanning task corresponding to the file path D is recorded as ScanTask1, and the scanning task corresponding to the file path D1 is recorded as ScanTask2. The scanning tasks corresponding to the file paths D and D1 are merged to obtain the target scanning task ScanTask2. Since when the scanning task ScanTask2 is completed, all the scanned files under the file path D1 and its sub-file paths will notify the scanning task corresponding to the file path D in addition to notifying the scanning task corresponding to the file path D1, so that when the scanning task ScanTask2 is completed, the scanning task corresponding to the file path D is also completed. At the same time, because the scanning tasks are merged, in the process of executing the merged scanning tasks, it is possible to avoid multiple scans of the same file path, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of the electronic device, optimizing the resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

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

[0222] Optionally, in a possible implementation, the above step S304 may also include step S3041 and step S3042, as follows.

[0223] See also Fig.10 , Fig.10 A flowchart of another method for processing data according to an embodiment of the present application is shown.

[0224] The method includes:

[0225] S3041. Obtain at least two scanning time intervals corresponding to the associated file path.

[0226] The scanning interval is determined by the file synchronization cycle set by the user, and different file paths have different scanning intervals. For example, the user sets the synchronization of files corresponding to file path D every 120 minutes and files corresponding to file path D1 every 60 minutes, that is, the scanning interval corresponding to file path D is 120 minutes, and the scanning interval corresponding to file path D1 is 60 minutes.

[0227] In an example, the file synchronization request may carry the scanning time interval corresponding to each file path, and the scanning time interval corresponding to each file path in the associated file path may be obtained in the file synchronization request.

[0228] In another example, the scanning time interval corresponding to each file path in the associated file paths may be obtained from a pre-created REPO directory.

[0229] S3042: Merge at least two scanning tasks corresponding to the associated file paths into a target scanning task, and set a target scanning time interval of the target scanning task according to at least two scanning time intervals.

[0230] The target scanning time interval is greater than or equal to a minimum scanning time interval among the at least two scanning time intervals, and less than a maximum scanning time interval among the at least two scanning time intervals.

[0231] Exemplarily, at least two scanning tasks corresponding to the associated file paths are merged into a target scanning task. Take the associated file paths D and D1 as an example. For example, the scanning task corresponding to file path D is recorded as ScanTask1, and the scanning time interval corresponding to ScanTask1 is 120 minutes. The scanning task corresponding to file path D1 is recorded as ScanTask2, and the scanning time interval corresponding to ScanTask2 is 60 minutes. When setting ScanTask2, the scanning tasks corresponding to file path D and file path D1 are merged, and the target scanning time interval is used as the scanning time interval after the merged tasks. For example, the scanning tasks corresponding to file path D and file path D1 are merged to obtain the target scanning task ScanTask2, and the target scanning time interval corresponding to the target scanning task is 60 minutes. Subsequently, the scanning start time of each file path is uniformly set according to the merged target scanning time interval.

[0232] Optionally, the target scanning time interval can also be set to the scanning time interval of each scanning task corresponding to the associated file path, so that changes in the files corresponding to each file path can be discovered in a timely manner. For example, the target scanning time interval is set to the scanning time interval corresponding to ScanTask1, and then ScanTask1 is completed at the target scanning time interval. For example, the file path D is monitored and scanned every 60 minutes, so that changes in the files corresponding to the file path D can be discovered in a timely manner.

[0233] In the above implementation, since the scanning tasks are merged, multiple scans of the same file path can be effectively avoided during the execution of the merged scanning tasks, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0234] Optionally, in a possible implementation, the method for processing data provided by the embodiment of the present application may further include: scanning the file path corresponding to the target scanning task according to the target scanning time interval to obtain the scanned file.

[0235] The scanned file is used to be synchronized to at least one trusted electronic device.

[0236] Exemplarily, the file synchronization service module in the electronic device may include a REPO management module, a monitoring and scanning management module, and a timer. The REPO management module may include a REPO directory, and the REPO management module may be used to manage the REPO directory.

[0237] The file path corresponding to the target scanning task determined above and the target scanning time interval of the target scanning task may be stored in the REPO directory.

[0238] The timer can set the scan start time of each target scan task according to the target scan time interval. When the current time reaches the scan start time, the timer triggers the monitoring scan management module to start scanning. The monitoring scan management module searches for the file path corresponding to the target scan task, scans the file path corresponding to the target scan task, obtains the scan file, and synchronizes the scan file to the trusted electronic device in the trust ring. For example, every 60 minutes, the file path corresponding to the target scan task is searched, the file path corresponding to the target scan task is monitored and scanned once, and the corresponding scan file is obtained.

[0239] In this implementation, other file paths are not considered, and the file path corresponding to the target scanning task is scanned purposefully, which improves the scanning efficiency, thereby speeding up the entire file synchronization process and improving the subsequent file synchronization efficiency.

[0240] Optionally, in a possible implementation, the present application embodiment further provides a method for scanning a file, see Fig.11 , Fig.11 This is a schematic diagram of a scanning process for a document according to an embodiment of the present application. The method includes:

[0241] S401, obtaining a list to be scanned.

[0242] The list to be scanned includes associated file paths, file paths not associated with scan tasks, and non-associated file paths associated with scan tasks. It can be understood that the list to be scanned includes all file paths.

[0243] In one example, the pre-created REPO directory includes a list to be scanned, and the list to be scanned can be directly obtained from the REPO directory. In another example, the pre-created REPO directory includes various file paths, and the list to be scanned can be generated according to the file paths included in the REPO directory.

[0244] by Fig. 9 Taking the file directory shown as an example, the list to be scanned may include the file paths corresponding to the file directories A, E, D, D1, D11, D111, D2, D21, D22, D221, D23, D3 and the root directory " / ". Among them, the file paths corresponding to the file directories A and E are non-associated file paths associated with the scanning task, that is, the file directories A and E correspond to scanning tasks respectively, but the file paths corresponding to the file directories A and E are not associated file paths; the file paths corresponding to the file directories D and D1 are associated file paths, and the file paths corresponding to the file directories D, D2, and D221 are also associated file paths; the file paths corresponding to the file directories D11, D111, D21, D22, D23, D3 and the root directory " / " are file paths not associated with the scanning task.

[0245] S402: Scan each file path in the to-be-scanned list according to the target scanning time interval, and when any file path in the associated file paths is scanned, obtain the scanning result of any file path.

[0246] The scanning results may include files obtained by scanning any file path, file names, file quantity, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read-write permissions, write permissions, execute permissions, etc.), file owners, file attribute flags (such as specific flags used to indicate that the file is a hidden file, a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative paths, etc.

[0247] Among them, files may include text files, document files, image files, audio files, video files, compressed files, encrypted files, executable files, web page files, etc.

[0248] Exemplarily, with the target scan time interval as a period, the monitoring scan management module scans each file path in the list to be scanned in sequence. It should be understood that each node in the file path represents a directory level, and these nodes are usually arranged in order from top to bottom. For example, a file path may be: / ...... / D / D2 / D22 / D221, and in an embodiment of the present application, each file path in the list to be scanned may be scanned in order from top to bottom. Optionally, in an embodiment of the present application, each file path in the list to be scanned may also be scanned in order from bottom to top. Optionally, in an embodiment of the present application, each file path in the list to be scanned may also be scanned in an order defined by the user. This is only an exemplary description and is not limited to this.

[0249] During the process of scanning the file path, the monitoring scan management module determines whether there is a corresponding scan task for each file path scanned. If there is no corresponding scan task for the file path, the next file path can be scanned directly, thereby reducing the scan time and improving the efficiency of file synchronization. If there is a corresponding scan task for the file path, the scan result corresponding to the file path is obtained, so that the scan result can be fed back to the scan task corresponding to the file path. If there is a corresponding scan task for the file path, and the file path is any file path in the associated file path, the scan result of any file path is obtained, so that the scan result can be fed back to the scan task corresponding to each file path in the associated file path.

[0250] Optionally, in a possible implementation, all scan results may be sent / notified to the REPO management module to provide a guarantee for subsequent file synchronization.

[0251] In this implementation, each file path in the scan list is scanned to ensure that no scanning task is missed, thereby ensuring that no file is missed during subsequent file synchronization.

[0252] S403: Feedback the scanning result to the scanning task corresponding to each file path in the associated file path.

[0253] Taking the associated file paths D and D1 as an example, when the monitoring scan management module scans the file path D, it is determined that the file path D has a corresponding scan task, and the file path D is one of the associated file paths D and D1, and the scan result corresponding to the file path D is obtained. The scan result corresponding to the file path D is fed back / notified to the scan task corresponding to the file path D and the scan task corresponding to the file path D1.

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

[0255] Optionally, in a possible implementation, the method for processing data provided in the embodiment of the present application may further include: adding the scanning result to a preset notification list.

[0256] Exemplarily, a notification list may be pre-set in the monitoring scan management module, and 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.

[0257] In the embodiment of the present application, the scan result can be obtained by calling a callback function. In order to save storage space and improve file synchronization efficiency, the scan result is added to a preset notification list, specifically, the callback corresponding to the scan result is added to the preset notification list.

[0258] For example, the monitoring scan management module scans a file path and determines that the file path has a corresponding scan task, then searches for a callback corresponding to the file path and adds the callback to a preset notification list.

[0259] For another example, the monitoring scan management module scans any file path in the associated file path, obtains the callback of any file path, and adds the callback to the preset notification list. Adding the callback to the preset notification list can ensure that the scan result notification / feedback is sent to the scan tasks of other file paths associated with the file path.

[0260] Take the associated file paths D and D1 as an example to explain, add the callback corresponding to file path D to the preset notification list, and the scan results of file path D and its sub-file paths will notify / feed back to the scan task corresponding to file path D, as well as the scan task corresponding to file path D1. This is conducive to the subsequent synchronization of files scanned by each scanning task to the trusted electronic device, which reduces the number of scans and the power consumption of electronic devices while ensuring the accuracy of file synchronization.

[0261] Optionally, in a possible implementation, the method for processing data provided by the embodiment of the present application may further include: after scanning each file path in the to-be-scanned list, deleting all scanning results in the notification list.

[0262] For example, the monitoring scan management module periodically scans all file paths in the to-be-scanned list, and after each round of scanning of the file paths in the to-be-scanned list, deletes all scan results in the notification list, that is, deletes all scan result callbacks in the notification list. This method of deleting all callbacks in the notification list at one time simplifies the deletion steps and improves the deletion efficiency.

[0263] Optionally, in a possible implementation, the method for processing data provided by the embodiment of the present application may further include: after scanning any file path in the associated file paths, deleting the scanning result corresponding to any file path in the notification list.

[0264] Exemplarily, after the monitoring scan management module scans a file path, it deletes the scan result corresponding to the file path in the notification list. For example, after the monitoring scan management module scans any file path in the associated file path, it deletes the callback corresponding to any file path from the notification list. This method of deleting a callback after scanning a file path can save storage space, avoid false feedback, and improve the accuracy of file synchronization.

[0265] In the above-mentioned embodiments, when scanning the file path, the first scan may be performed first, and then the next scan start time (such as the second scan start time) may be set according to the scan time interval, and the second round of scanning may be started when the current time reaches the next scan start time (such as the second scan start time). When performing the second round of scanning, the next scan start time (such as the third scan start time) may continue to be set according to the scan time interval, and so on. In this way, the setting of a scan start time may be reduced, the power consumption of the electronic device may be reduced, and system resources may be saved.

[0266] Optionally, in a possible implementation, when scanning a file path, a scan start time may be set first, and when the current time reaches the scan start time, the scan starts. For example, the first scan start time is set according to the scan time interval, and when the current time reaches the first scan start time, the first round of scanning starts. When performing the first round of scanning, the next scan start time (such as the second scan start time) is set according to the scan time interval, and so on.

[0267] Exemplarily, according to the target scanning time interval, the scanning start time of the target scanning task is set, and the scanning starts when the current time reaches the scanning start time. After the current round of scanning is completed, the monitoring scanning management module is automatically triggered to set the next scanning start time to the timer. For example, the target scanning time interval is 2 hours, and the time required to scan the file path corresponding to a round of target scanning tasks is 5 minutes. The first scanning start time of the target scanning task is set to 1:55. When the timer detects that the current time reaches 1:55, it triggers the monitoring scanning management module to start the scan. The monitoring scanning management module takes 5 minutes to complete this round of scanning, and sets the next scanning start time to the timer as 3:55, and so on.

[0268] This method of setting the scan start time before starting to scan the file path can accurately record the execution time of each scan operation to avoid scanning errors. And determining the start and end time of each scan operation helps to reasonably allocate system resources.

[0269] The following describes the scenario of setting a timed scan in the embodiment of the present application in conjunction with the accompanying drawings. Fig.12 , Fig.12 This is a schematic diagram of a process for setting a timed scan according to an embodiment of the present application. The method includes:

[0270] S501. The REPO management module sends a notification of setting a scheduled scan to the monitoring scan management module.

[0271] Exemplarily, the REPO management module may be used to manage the REPO directory, obtain parameters included in setting the scheduled scan notification from the REPO directory, and send the parameters to the monitoring scan management module.

[0272] The setting of the scheduled scan notification may include parameters such as each file path, the scan time interval corresponding to each file path, and the callback of the file path.

[0273] S502: The monitoring scanning management module performs parameter verification.

[0274] Exemplarily, the monitoring scan management module verifies parameters such as each file path, the scan time interval corresponding to each file path, and the callback of the file path to ensure that these parameters are valid. For example, it verifies whether the types of these parameters are consistent with expectations, whether the formats are correct, whether they are consistent with the data in the local file system, whether the scan results corresponding to the file path can be accurately obtained through the callback, and whether the scan time interval is the scan time interval of the scan task corresponding to the file path.

[0275] S503: The monitoring scanning management module determines the inclusion relationship between multiple file paths.

[0276] The monitoring scanning management module may determine the inclusion relationship between the multiple file paths in the manner described in the above step S303.

[0277] S504: The monitoring scanning management module sets a timer for a scheduled scan.

[0278] For each file path associated with the scan task, if there is no inclusion relationship between the file path and other file paths, the scan start time corresponding to the file path is directly determined according to the scan time interval corresponding to the file path, and the scan time interval and the scan start time are sent to the timer. When the timer detects that the current time reaches the scan start time, it notifies the monitoring scan management module to scan the file path.

[0279] S505. The monitoring scanning management module sets a timer for a scheduled scan according to a target scanning time interval.

[0280] For each file path of the associated scanning task, if there is an inclusion relationship between the file path and other file paths, the scanning tasks corresponding to the file paths with the inclusion relationship are merged to obtain the target scanning task. The scanning start time corresponding to the target scanning task is determined according to the target scanning time interval, and the target scanning time interval and the scanning start time are sent to the timer. Among them, the target scanning time interval can be the smallest scanning time interval among the multiple scanning time intervals corresponding to the file paths with the inclusion relationship.

[0281] S506: The monitoring and scanning management module returns the setting result to the REPO management module.

[0282] The setting result may include setting success or setting failure. For example, when the application, system, etc. are abnormal, the setting may fail. The monitoring scanning management module returns the setting result to the REPO management module according to the actual setting situation, and the REPO management module may record the setting result in the REPO directory.

[0283] In this implementation, different scan start times and scan time intervals are set for file paths of different associated scan tasks, which helps to reasonably allocate system resources and provides a guarantee for reducing the number of scans and the power consumption of electronic devices in subsequent scanning processes.

[0284] The above describes the scenario of setting a timed scan in the embodiment of the present application in combination with the accompanying drawings. The following describes the scenario of regularly scanning a file path in the embodiment of the present application in combination with the accompanying drawings. Fig.13 , Fig.13 This is a schematic diagram of a process of regularly scanning a file path according to an embodiment of the present application. The method includes:

[0285] S601. The timer notifies the monitoring scanning management module to start scanning.

[0286] The timer continuously monitors the time, and when it detects that the current time reaches the scanning start time, it notifies the monitoring scanning management module to start scanning.

[0287] Optionally, when the timer notifies the monitoring scanning management module to start scanning, it may carry a list to be scanned.

[0288] S602: The monitoring scan management module determines whether the file path is associated with a scan task.

[0289] In one example, the monitoring scan management module may traverse all file paths in the to-be-scanned list, and determine whether there is an associated scan task for each file path scanned.

[0290] S603: The monitoring scanning management module adds the callback function to a preset notification list.

[0291] Exemplarily, when the monitoring scan management module determines that a certain file path has an associated scan task, it searches for a callback corresponding to the file path and adds the callback to a preset notification list.

[0292] S604: The monitoring scanning management module notifies the REPO management module of the start of scanning and starts scanning the file path.

[0293] S605: The monitoring scanning management module obtains the scanning result from the file system.

[0294] S606: The monitoring scanning management module makes a notification according to the notification list.

[0295] The monitoring scanning management module feeds back the scanning result to the scanning task corresponding to each file path in the associated file path according to the notification list.

[0296] Optionally, the monitoring and scanning management module may send the notification result to the REPO management module.

[0297] S607: The monitoring scanning management module notifies the REPO management module that the scanning is finished.

[0298] S608: The monitoring scanning management module deletes the callback function in the notification list.

[0299] S609: The monitoring scan management module sets the next scan start time in the timer.

[0300] For detailed contents of step S601 to step S609, reference may be made to the relevant descriptions in the aforementioned embodiments, which will not be repeated here.

[0301] The following describes the scenario of canceling a scanning task in the embodiment of the present application in conjunction with the accompanying drawings. Fig.14 , Fig.14 This is a flow chart of canceling a scanning task according to an embodiment of the present application. The method includes:

[0302] S701: Obtain a scan cancellation notification.

[0303] The cancel scan notification is used to cancel any scan task corresponding to the associated file path.

[0304] It should be understood that the cancellation of the scan notification is similar to the file synchronization request, and can be triggered by an electronic device or a trusted electronic device. Exemplarily, when an electronic device or a trusted electronic device receives an operation from the user such as turning off the file synchronization function, canceling a previously synchronized file, changing the scan time interval, etc., it will trigger the cancellation of the scan notification. For example, the original setting was to automatically synchronize pictures every 6 hours, but now it is changed to automatically synchronize pictures every 3 hours; for another example, the original setting was to synchronize pictures and music in the mobile phone to the tablet computer, but now it is set to only synchronize music in the mobile phone to the tablet computer, etc.

[0305] S702: Clear the scan start time of the target scan task.

[0306] In one example, when the cancellation notification is used to cancel the scanning task corresponding to the non-associated file path of the associated scanning task, the timing setting related to the non-associated file path in the timer is deleted. For example, the file path corresponding to the file directory A is the non-associated file path of the associated scanning task, and when the cancellation notification is used to cancel the scanning task corresponding to the file directory A, the scanning start time corresponding to the file directory A in the timer is cleared.

[0307] Optionally, all information related to the non-associated file path can be cleared by the monitoring and scanning management module, and the monitoring and scanning management module no longer monitors and scans the non-associated file path. For example, the information related to the non-associated file path in the REPO directory is deleted.

[0308] In another example, when the cancellation notification is used to cancel any scan task corresponding to the associated file path, the scan start time of the target scan task in the timer is cleared.

[0309] In this implementation, when a scan cancellation notification is received, the relevant information of the scan task is cleared, which can release more system resources, reduce the system processing burden, and improve the system processing speed. At the same time, it promptly responds to the different needs of users in file synchronization scenarios and improves the user experience.

[0310] Optionally, in a possible implementation, in the method for processing data provided in an embodiment of the present application, the above-mentioned step S702 may include step S7021 and step S7022, as follows.

[0311] S7021. Determine that there is no inclusion relationship between other multiple file paths.

[0312] S7022. Clear the scan start time of the target scan task.

[0313] The other multiple file paths are multiple file paths except the file path corresponding to any scanning task.

[0314] Exemplarily, when the cancellation notification is used to cancel any scanning task corresponding to the associated file path, it is determined whether there is still an inclusion relationship between the other multiple file paths. If it is determined that there is no inclusion relationship between the other multiple file paths by traversing the other multiple file paths through a graph structure, a graph algorithm, a tree, a graph database, a written function, etc., the scanning start time of the target scanning task is cleared.

[0315] This implementation method clears the relevant information of the scanning task when it is determined that there is no inclusion relationship between the other multiple file paths, thereby avoiding the influence of the clearing of the relevant information of the scanning task on other scanning tasks and ensuring that other scanning tasks can be successfully completed.

[0316] Optionally, in a possible implementation, the method for canceling a scan task provided in the present application, after obtaining a cancellation scan notification, may also include: determining that there is an inclusion relationship between multiple other file paths, and merging the scan tasks corresponding to the multiple other file paths that have the inclusion relationship.

[0317] Exemplarily, if multiple other file paths are traversed by means of graph structure, graph algorithm, tree, graph database, function writing, etc., and it is determined that there is a containment relationship between the multiple other file paths, then the scanning time intervals corresponding to the file paths with the containment relationship are obtained, the scanning tasks corresponding to the file paths with the containment relationship are merged into a new target scanning task, and according to the scanning time intervals corresponding to the file paths with the containment relationship, a new scanning time interval corresponding to the new target scanning task is set. The specific method can be referred to the description in the above step S304, which will not be repeated here.

[0318] Combination Fig. 9 In one implementation scenario, assume that the scanning tasks corresponding to the file directories D, D1, D2, and D221 have all been started, where the file path corresponding to the file directory D is / ...... / D, and the scanning interval is 1 day; the file path corresponding to the file directory D1 is / ...... / D / D1, and the scanning interval is 3 days; the file path corresponding to the file directory D2 is / ...... / D / D2, and the scanning interval is 2 hours; the file path corresponding to the file directory D221 is

[0319] / ...... / D / D2 / D22 / D221, the scanning interval is 6 hours.

[0320] D, D1, D2 and D221 represent the scanning tasks corresponding to the file directories D, D1, D2 and D221 respectively. A scan cancellation notification is obtained, which is used to cancel the scan task D. The remaining scan tasks are D1, D2 and D221. The file path corresponding to the scan task D1 is not associated with the file paths corresponding to other tasks. The scan time interval corresponding to the scan task D1 is set to 3 days. There is an inclusion relationship between the file paths corresponding to the scan tasks D2 and D221 respectively. The scan time interval corresponding to the scan task D2 is less than the scan time interval corresponding to the scan task D221. The scan time intervals corresponding to the scan tasks D2 and D221 are updated to 2 hours respectively.

[0321] Optionally, the scanning tasks D2 and D221 may be combined into a target scanning task D221, and the scanning time interval corresponding to the target scanning task D221 is set to 2 hours.

[0322] Optionally, if the monitoring scan management module is currently scanning the file path corresponding to the file directory D3, the notification of the scan result will not be affected. If the monitoring scan management module is currently scanning the file path corresponding to the file directory D1 or D2, the scan result will only notify the scan task corresponding to the file directory D1, or only notify the scan task corresponding to the file directory D2, and will no longer notify the scan task corresponding to the file directory D.

[0323] In another implementation scenario, a scan cancellation notification is obtained, which is used to cancel the scan task D2, and the remaining scan tasks are D, D1, and D221. There is an inclusion relationship between the file paths corresponding to the scan tasks D, D1, and D221, and the minimum scan time interval between them is 6 hours, so the scan time intervals corresponding to the scan tasks D, D1, and D221 are updated to 6 hours.

[0324] Optionally, scanning tasks D and D1 may be merged into target scanning task D1, and the scanning time interval corresponding to target scanning task D1 may be updated to 6 hours; scanning tasks D and D221 may be merged into target scanning task D221, and the scanning time interval corresponding to target scanning task D221 may be updated to 6 hours.

[0325] Optionally, if the monitoring scanning management module is currently scanning the file path corresponding to the file directory D21, the scanning result only notifies the scanning task corresponding to the file directory D; if the monitoring scanning management module is currently scanning the file path corresponding to the file directory D11, the scanning result notifies the scanning tasks corresponding to the file directories D and D1 respectively; if the monitoring scanning management module is currently scanning the file path corresponding to the file directory D221, the scanning result only notifies the scanning tasks corresponding to the file directories D and D221 respectively, and no longer notifies the scanning task corresponding to the file directory D2.

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

[0327] See also Fig.15 , Fig.15 This is another flowchart of canceling a scanning task according to an embodiment of the present application. The method includes:

[0328] S801. The REPO management module sends a cancellation notification of scheduled scanning to the monitoring scanning management module.

[0329] Exemplarily, the REPO management module may be used to manage the REPO directory, obtain a cancellation notification of scheduled scanning from the REPO directory, and send the notification to the monitoring scanning management module.

[0330] The cancel scheduled scan notification is used to cancel any scan task, and the cancel scheduled scan notification may include parameters such as the file path corresponding to any scan task to be canceled, the scan time interval corresponding to the file path, and the callback of the file path.

[0331] S802: The monitoring scanning management module performs parameter verification.

[0332] For the description of step S802, reference may be made to the specific implementation process of the aforementioned step S502, which will not be repeated here.

[0333] S803: The monitoring scanning management module determines the inclusion relationship between other multiple file paths.

[0334] The monitoring scanning management module may determine the inclusion relationship between the multiple file paths in the manner described in the above step S303.

[0335] When the file path of the canceled scan task does not have an inclusion relationship with other multiple file paths, execute the following steps S804 to S805; when the file path of the canceled scan task does have an inclusion relationship with other multiple file paths, execute the following steps S806 to S812.

[0336] S804. The monitoring scan management module deletes the timing setting of the file path of the cancelled scan task.

[0337] It is worth noting that the canceled scanning task and any of the aforementioned canceled scanning tasks are just differently expressed, and the contents they refer to are the same.

[0338] Exemplarily, the timing setting refers to the scanning time interval and scanning start time related to the canceled scanning task set before it is canceled. The monitoring scanning management module sends an instruction to delete the timing setting to the timer, and the timer deletes the timing setting related to the file path of the canceled scanning task. After that, the timer no longer monitors the time related to the canceled scanning task, and the monitoring scanning management module no longer monitors and scans the file path of the canceled scanning task.

[0339] S805. The monitoring scan management module clears the relevant information of the file path of the cancelled scan task.

[0340] The relevant information of the file path of the canceled scan task may include the scan start time, scan time interval, file synchronization configuration information, callback function of the file path and other information related to the file path in the REPO directory.

[0341] Exemplarily, the information related to the file path of the canceled scan task in the REPO directory is deleted.

[0342] When the file path of the canceled scan task is included in a relationship with multiple other file paths, execute the following steps S806 to S808; when the file path of the canceled scan task is included in a relationship with multiple other file paths, execute the following steps S809 to S811.

[0343] S806. The monitoring scanning management module determines the minimum scanning time intervals corresponding to the other multiple file paths.

[0344] Exemplarily, when the file path of the canceled scan task is included in any file path among other multiple file paths, the monitoring scan management module obtains the scan time intervals corresponding to the other multiple file paths respectively, and determines the minimum scan time interval among the scan time intervals corresponding to the other multiple file paths respectively.

[0345] S807. The monitoring scan management module sets the scan start time corresponding to other multiple file paths.

[0346] The monitoring scan management module determines the minimum scan time interval as the minimum scan time intervals corresponding to the other multiple file paths, and determines the scan start times corresponding to the other multiple file paths according to the minimum scan time interval. Afterwards, the monitoring scan management module sends the scan start times corresponding to the other multiple file paths and the minimum scan time interval to the timer.

[0347] S808: If it is detected that scanning is in progress, update the list to be scanned.

[0348] Exemplarily, scanning in progress means that a scanning task is being executed. If a scanning task is being executed, such as monitoring or scanning a file path, when the cancellation notification of scheduled scanning is obtained, the file path of the cancelled scanning task is deleted from the to-be-scanned list.

[0349] S809: If it is detected that scanning is in progress, remove the file paths in the to-be-scanned list that are not related to the file paths of the canceled scanning tasks.

[0350] Exemplarily, the file paths in the to-be-scanned list that are not related to the file path of the canceled scan task are determined. If a scan task is being executed, such as monitoring or scanning a file path, when the cancellation of the scheduled scan notification is obtained, the file paths in the to-be-scanned list that are not related to the file path of the canceled scan task are removed / deleted.

[0351] It should be understood that the monitoring and scanning management module will still monitor and scan the file path associated with the file path of the cancelled scanning task, and feedback the scanning result.

[0352] S810: Determine the list to be scanned after deleting the file path of the cancelled scan task, and the scanning time intervals corresponding to the other multiple file paths.

[0353] S811. The monitoring scan management module deletes the timing setting of the file path of the cancelled scan task.

[0354] S812. Set the next scan start time for other multiple file paths.

[0355] S813. The monitoring and scanning management module returns the setting result to the REPO management module.

[0356] For the specific implementation of steps S810 to S813, reference may be made to the relevant descriptions in the aforementioned embodiments, which will not be repeated here.

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

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

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

[0360] In this implementation, since the temporary synchronization file is verified, it can ensure that the file received by the electronic device is consistent with the source file, ensure the integrity of file synchronization, and improve the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with, avoid the system of the electronic device in the trust ring from being attacked by malware or viruses, and improve the security of the file synchronization process.

[0361] Optionally, verifying the temporary synchronization file includes: obtaining source metadata sent by at least one trusted electronic device; generating a check value corresponding to the temporary synchronization file and a check value corresponding to the source metadata; when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source metadata, determining that the temporary synchronization file has passed the verification. Optionally, the check value of the temporary synchronization file and the check value of the source metadata can both include a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, etc. In this implementation, it is equivalent to performing a consistency check on the temporary synchronization file and the source file, and synchronizing the file when the temporary synchronization file and the source file are consistent, which can make the final synchronized file accurate and improve the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively avoiding the system of the electronic device in the trust ring from being attacked by malware or viruses, and improving the security of the file synchronization process.

[0362] Optionally, synchronizing the temporary synchronization file to the file system includes: deleting the local file corresponding to the temporary synchronization file in the file system; modifying the file name of the temporary synchronization file; and storing the temporary synchronization file after the file name is modified in the file system. Optionally, the modified file name of the temporary synchronization file is consistent with the file name of the local file. In this implementation, deleting the local file first and then modifying the file name of the temporary synchronization file can avoid file name conflicts, reduce errors caused by inconsistent file names or file versions, and help ensure the integrity and consistency of file synchronization.

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

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

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

[0366] The difference data is used to trigger at least one trusted electronic device to send the file to be synchronized to the electronic device. In this implementation, when it is determined that the local file is different from the source file, the difference data is sent to the trusted electronic device to trigger the trusted electronic device to send the file to be synchronized to the electronic device, which provides a guarantee for achieving file synchronization.

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

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

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

[0370] In this implementation, any directory in the electronic device first obtains the same file to be synchronized from the trusted electronic device, and then sends the same file to other directories in the electronic device. During the entire file synchronization process, for the electronic device and the trusted electronic device, the same file is only transmitted across devices once, and the entire file transfer process is simple and convenient. Due to the small number of file transfers, the use of network bandwidth and processing time are reduced, while reducing the power consumption of the electronic device and the trusted electronic device, the efficiency of file synchronization is also improved. Reducing the number of file transfers can also reduce the risk of data leakage and improve the security of file synchronization.

[0371] Moreover, any directory in an electronic device sends the same file to other directories in the electronic device. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, which improves the reliability of transmission. Moreover, when performing file operations in the same electronic device, the operating system and file system of the electronic device can better maintain the attributes and permissions of the file and ensure the integrity of the file.

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

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

[0374] Optionally, any directory requests to obtain the same file from at least one trusted electronic device, including: any directory initiates a file synchronization request to at least one trusted electronic device, the file synchronization request is used to trigger at least one trusted electronic device to send the same file to the electronic device; marking other directories to synchronize the same file with any directory. In this implementation, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after any subsequent directory obtains the same file, it can quickly and accurately send the same file to other marked directories, so that the files finally synchronized to each directory are accurate, and the accuracy of file synchronization is improved.

[0375] Optionally, any directory sends the same acquired file to other directories, including: acquiring the file path of other marked directories; copying the same file to the file path of other marked directories. In this implementation, after any directory in the electronic device acquires the same file to be synchronized, it copies the same file to the file path of other directories according to the file path of other marked directories. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost, is not easily affected by network fluctuations or external interference, and improves the reliability of transmission. In addition, when performing file operations in the same electronic device, the operating system and file system of the electronic device can better maintain the attributes and permissions of the file and ensure the integrity of the file.

[0376] Optionally, the trust ring in which the electronic device is located also includes at least two trusted electronic devices, and the same synchronization file is respectively stored in at least two trusted electronic devices. The file synchronization method may also include: obtaining the influencing factor of each trusted electronic device; determining the synchronization source device in at least two trusted electronic devices according to the influencing factor of each trusted electronic device; synchronizing the synchronization file from the synchronization source device. The influencing factor is used to influence the determination of the synchronization source device, that is, the influencing factor is a factor used to influence the decision of which trusted electronic device to use as the synchronization source device. Different synchronization source devices have different file synchronization effects, that is, the influencing factor can be used to affect the file synchronization effect between the electronic device and the trusted electronic device. The influencing factors include at least one of the power status, device type, network status, device performance, current device power consumption, and user preference.

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

[0378] Optionally, according to the influencing factors of each trusted electronic device, a synchronization source device is determined in at least two trusted electronic devices, including: calculating a synchronization suitability score for each trusted electronic device according to the influencing factors of each trusted electronic device; determining a synchronization source device in at least two trusted electronic devices according to the synchronization suitability score of each trusted electronic device. In this implementation, the synchronization suitability score is calculated for the trusted electronic device, 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 that the synchronization operation is more efficient and is conducive to maintaining the consistency and accuracy of the synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0379] Optionally, at least two trusted electronic devices are of different device types, and according to the influencing factors of each trusted electronic device, a synchronization source device is determined in at least two trusted electronic devices, including: determining the priority of each trusted electronic device according to the influencing factors of each trusted electronic device; and determining the synchronization source device in at least two trusted electronic devices according to the priority of each trusted electronic device. In this implementation, by determining the synchronization source device by determining the priority of the device, resources can be reasonably allocated according to the importance and functions of different devices, and a suitable synchronization source device can be selected, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0380] The method for processing data provided in the embodiment of the present application is described above in conjunction with the flow chart. The hardware structure of the electronic device involved in the embodiment of the present application is briefly introduced below in conjunction with the drawings.

[0381] In some embodiments of the present application, the electronic device may be a mobile phone, a tablet computer, a wearable device, a television, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., or may be other devices or apparatuses capable of performing scene recognition. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.

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

[0383] like Fig.16As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0384] It is to be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Fig.16 More or fewer components than those shown, or the electronic device 100 may include Fig.16 Combinations of some of the components shown, or the electronic device 100 may include Fig.16 Subassemblies of some of the components shown. Fig.16 The components shown may be implemented in hardware, software, or a combination of software and hardware.

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

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

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

[0388] The display screen 194 can be used to display images or videos, and can also display a series of graphical user interfaces (GUIs), which are the main screens of the electronic device 100. Generally speaking, the size of the display screen 194 of the electronic device 100 is fixed, and only limited controls can be displayed on the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component included in an application program, and controls all data processed by the application program and interactive operations on the data. Users can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.

[0389] The display screen 194 in the embodiment of the present application may be a touch screen. A touch sensor 180K may be integrated in the display screen 194. The touch sensor 180K may also be referred to as a "touch panel". In other words, the display screen 194 may include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. After the touch operation detected by the touch sensor 180K, it can be passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event. Visual output related to the touch operation can be provided by the display screen 194. In other embodiments, the touch sensor 180K may also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

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

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

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

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

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

[0395] The data processing method and file synchronization method provided in the embodiments of the present application can be implemented in an electronic device 100 having the above-mentioned hardware structure.

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

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

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

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

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

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

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

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

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

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

[0406] The above describes in detail an example of a method for processing data provided by an embodiment of the present application. It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered to exceed the scope of the present application.

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

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

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

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

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

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

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

[0414] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the method for processing data in the above-mentioned embodiment.

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

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

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

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

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

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

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

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

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

[0424] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

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

Claims

1. A method for processing data, characterized in that: Applied to an electronic device, the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the file in the electronic device can be synchronized to the at least one trusted electronic device, and the method includes: Get the file synchronization request; Determine a plurality of scanning tasks corresponding to the file synchronization request, each scanning task corresponding to a file path; Determine an associated file path from among the multiple file paths, wherein the associated file path is a file path with a containment relationship; the file path with a containment relationship includes at least one child file path and one parent file path, and a scan result corresponding to the child file path is notified to a scan task corresponding to the parent file path; The scanning tasks corresponding to the associated file paths are merged.

2. The method according to claim 1, characterized in that: The merging of the scanning tasks corresponding to the associated file paths includes: Obtain at least two scanning time intervals corresponding to the associated file path; different file paths correspond to different scanning time intervals; At least two scanning tasks corresponding to the associated file path are merged into a target scanning task, and a target scanning time interval of the target scanning task is set according to the at least two scanning time intervals, wherein the target scanning time interval is greater than or equal to the smallest scanning time interval of the at least two scanning time intervals and less than the largest scanning time interval of the at least two scanning time intervals.

3. The method according to claim 2, characterized in that The method further comprises: According to the target scanning time interval, the file path corresponding to the target scanning task is scanned to obtain a scan file, and the scan file is used to be synchronized to the at least one trusted electronic device.

4. The method according to claim 2, characterized in that: The method further comprises: Acquire a list to be scanned, the list to be scanned including the associated file path, the file path not associated with the scan task, and the non-associated file path associated with the scan task; Scan each file path in the to-be-scanned list according to the target scanning time interval, and when any file path in the associated file paths is scanned, obtain a scanning result of the any file path; The scanning result is fed back to the scanning task corresponding to each file path in the associated file path.

5. The method according to claim 3 or 4, characterized in that: The method further comprises: According to the target scanning time interval, setting the scanning start time of the target scanning task; When the current time reaches the scanning start time, scanning starts.

6. The method according to claim 4 or 5, characterized in that: Feeding back the scanning result to the scanning task corresponding to each file path in the associated file path includes: The scanning result is added to a preset notification list, where the notification list is used to feed back the scanning result to the scanning task corresponding to each file path in the associated file path.

7. The method according to claim 6, characterized in that The method further comprises: After scanning each file path in the to-be-scanned list, all scanning results in the notification list are deleted.

8. The method according to claim 6, characterized in that The method further comprises: After scanning any file path in the associated file paths, the scanning result corresponding to the any file path in the notification list is deleted.

9. The method according to any one of claims 5 to 8, characterized in that: The method further comprises: A scan cancellation notification is obtained, where the scan cancellation notification is used to cancel any scan task corresponding to the associated file path; Clear the scan start time of the target scan task.

10. The method according to claim 9, characterized in that The scanning start time of clearing the target scanning task includes: Determining that there is no inclusion relationship between the other multiple file paths, the other multiple file paths are multiple file paths other than the file path corresponding to any one of the scanning tasks; Clear the scan start time of the target scan task.

11. The method according to claim 10, characterized in that After obtaining the scan cancellation notification, the method further includes: Determine that there is an inclusion relationship between the other multiple file paths; Merge the scan tasks corresponding to multiple other file paths that have an inclusion relationship.

12. An electronic device, characterized in that: include: one or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method according to any one of claims 1 to 11.

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

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Multimedia file scanning method and device and terminal equipment

    CN114647746A

  • File synchronization method and device and electronic equipment

    CN115878573A

  • Equipment file management method and device

    CN116841960A

  • Method and apparatus for selective subfolder synchronization in a cloud-based environment

    US20130268480A1

  • Media data processing method and apparatus, and terminal device

    WO2022156484A1