File saving method, file viewing method and electronic equipment

By simplifying the file saving process, directly saving files in mobile applications to preset public paths, and automatically managing file events by listening to file events, the problems of cumbersome file storage and scattered paths in the existing technology are solved, and file management efficiency is improved.

CN119311350APending Publication Date: 2025-01-14HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310863206.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-12
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the prior art, when receiving files, the process of saving files by mobile phone applications is cumbersome and inefficient. The file storage paths of different applications are scattered, making it difficult to manage and search uniformly.

Method used

Provide a file saving method, which can directly save the target file to a preset public path by displaying message prompt controls for notification messages, responding to user triggering operations, simplifying the saving process, and automatically collecting and updating events in file cache paths File attribute information.

Benefits of technology

It realizes the simplified process of file storage, improves the storage efficiency, facilitates file management and search, and avoids the problem of file dispersion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311350A_ABST
    Figure CN119311350A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file storage method, a file viewing method and electronic equipment, relates to the technical field of electronics, and is used for simplifying the file storage process and improving the storage efficiency. The file saving method specifically comprises the following steps: displaying a first interface of an application; in response to the received notification message, displaying a message prompt control of the notification message on the first interface; the notification message comprises a target file, and the target file comprises one or more of a document file, an image file, an audio file or a video file; in response to a first trigger operation for the message prompt control, displaying a prompt window, the prompt window comprising a control of the target file, and the control of the target file comprising a file name and / or an icon of the target file; and in response to a second trigger operation for the control of the target file, storing the target file to a preset public path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of electronic technology, and in particular to a file saving method and electronic device, and a file viewing method and electronic device. Background Art

[0002] Many mobile phone applications can support sending and receiving files. For received files, the mobile phone can save the files locally in response to user operations. However, in the related art, most applications need to perform a relatively cumbersome process for saving received files.

[0003] For example, in the application interface for receiving files, the mobile phone needs to first respond to the user's opening operation on the file and enter the file preview interface. Then, the mobile phone detects the user's triggering operation on the operation control provided in the file preview interface and displays various operation options. Finally, the mobile phone can save the file to the specified path only after detecting the user's triggering operation on the save option in the operation options. In this way, the file saving process is cumbersome and the saving efficiency is low. Summary of the invention

[0004] The embodiments of the present application provide a file saving method, a file viewing method and an electronic device, which are used to simplify the file saving process and improve the saving efficiency.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a file saving method is provided, the method being applied to an electronic device, the electronic device including an application having a file sending and receiving function, the method comprising:

[0007] The electronic device displays the first interface of the application. In response to receiving the notification message, the electronic device displays a message prompt control of the notification message on the first interface. The notification message includes a target file, and the target file includes one or more of a document file, an image file, an audio file, or a video file. It should be noted that the electronic device may first display the first interface of the application, and then receive the notification message in the first interface and display the message prompt control. Alternatively, the electronic device may first receive the notification message, then display the first interface, and display the message prompt control on the first interface.

[0008] Then, in response to the first trigger operation on the message prompt control, the electronic device displays a prompt window, wherein the prompt window includes a control of the target file, and the control of the target file may include a file name and / or an icon of the target file.

[0009] Afterwards, the electronic device can save the target file to the preset public path in response to the second trigger operation of the control for the target file.

[0010] In this solution, the electronic device displays a prompt window when detecting a first trigger operation for a message prompt control, and then saves the target file to a preset public path when detecting a second trigger operation for a control of a target file in the prompt window. Compared with the process of saving files received by an application in the related art, the process of saving files in this solution is relatively simple.

[0011] In a possible implementation of the first aspect, the method further includes: the electronic device saves the target file to the file cache path corresponding to the application in response to the first trigger operation. In this solution, the saving of the target file to the preset public path in response to the second trigger operation of the control for the target file may specifically include: the electronic device copies the target file stored in the file cache path corresponding to the application to the preset public path in response to the second trigger operation.

[0012] In this solution, in response to the first trigger operation on the message prompt control, the electronic device saves the target file to the file cache path corresponding to the application. Afterwards, when the second trigger operation is detected, the electronic device can copy files from different application caches to the same preset public path. This makes it easier to manage files and find files in the electronic device later.

[0013] In a possible implementation of the first aspect, the method further includes: the electronic device displays the target file in response to the first trigger operation. Specifically, the electronic device can display a file preview interface, and display the specific content of the target file in the file preview interface. Further, the electronic device displays the target file in response to the first trigger operation, which may specifically include: the electronic device obtains the target file from the file cache path corresponding to the application in response to the first trigger operation, and displays the target file. In this way, the electronic device supports the user to preview the target file through the above-mentioned application with file sending and receiving function.

[0014] In a possible implementation of the first aspect, the electronic device further includes a file viewing application. The method further includes: the electronic device may display a second interface of the file viewing application in response to the second trigger operation, and display the target file on the second interface. In this way, the electronic device supports the user to quickly open the file through the file viewing application by triggering the control of the target file in the prompt window.

[0015] In a possible implementation of the first aspect, the above-mentioned display prompt window may specifically include: the electronic device monitors the file cache path corresponding to the application. When the electronic device monitors the new file addition event, it can obtain the attribute information of the newly added target file from the cache path corresponding to the application. Then the electronic device can display the prompt window according to the attribute information of the target file. Among them, the attribute information of the target file includes: at least one of the file name, file type, file size, file reception time and file signature value of the target file. The new file addition event can save the corresponding target file to the file cache path corresponding to the application.

[0016] In this solution, the electronic device specifically triggers the display of a prompt window when it monitors a new file addition event in the file cache path corresponding to the application. The control of the target file displayed in the prompt window can be specifically determined based on the attribute information of the newly added target file obtained by the electronic device. By monitoring the file cache path of the application, the files cached by the application can be automatically collected and saved better.

[0017] In a possible implementation manner of the first aspect, the method further includes: in response to monitoring a file addition event in a file cache path corresponding to the application, the electronic device saves attribute information of the target file to a preset database.

[0018] In a possible implementation of the first aspect, when the electronic device monitors the file cache path corresponding to the application, it can also monitor whether a file deletion event, a file renaming event, a file content modification event, a directory creation event, a directory modification event, and a directory deletion event occur in the file cache path corresponding to the application. In this way, when a file changes in the original path (the file cache path corresponding to the application), the electronic device can immediately update the attribute information of the file stored in the preset database and the file stored in the preset public path.

[0019] In a possible implementation of the first aspect, the electronic device may specifically start monitoring the file cache path corresponding to the application when detecting the installation operation of the application, so as to ensure that all received files can be monitored after the application starts to be used, and the file storage service is more comprehensive.

[0020] In a possible implementation of the first aspect, the method further includes: in response to monitoring the presence of a file deletion event in the file cache path corresponding to the application, querying whether the preset public path stores a file corresponding to the file deletion event. It is understandable that if a file deletion event occurs in the file cache path, it must mean that the deleted file has previously triggered a file addition event in the file cache path corresponding to the application. In other words, the electronic device previously saved the attribute information of the file to a preset database. Therefore, if the preset public path does not store the file corresponding to the file deletion event, the attribute information of the file corresponding to the file deletion event in the preset database is deleted. Among them, the presence of a file deletion event in the file cache path corresponding to the application may specifically correspond to the user deleting the file sending and receiving record in the application interface, or the user deleting certain files in the file cache path corresponding to the application.

[0021] In addition, if the preset public path stores the file corresponding to the file deletion event, it means that the user has saved the file to the preset public path. Therefore, when the file is deleted in the original path, the file in the preset public path is not processed and is still retained. In this way, files can be better saved to avoid accidental deletion.

[0022] In a possible real-time manner of the first aspect, the above-mentioned deleting the attribute information of the file corresponding to the file deletion event in the preset database may specifically include: setting a deletion mark for the attribute information of the file corresponding to the file deletion event in the preset database. Afterwards, for files with the same content, the electronic device no longer repeatedly saves the attribute information of the files with the same content. In this way, the files can be better saved and the attribute information of the files can be prevented from being repeatedly stored in the database.

[0023] In a possible real-time mode of the first aspect, the method further includes: in response to monitoring the existence of a file renaming event in the file cache path corresponding to the application, the electronic device modifies the attribute information of the file corresponding to the saved file renaming event in the preset database, and queries whether the preset public path stores the file corresponding to the file renaming event. If the preset public path stores the file corresponding to the file renaming event, the file corresponding to the file renaming event stored in the preset public path is renamed. In this way, it can be ensured that the file name stored in the preset database and the preset public path is consistent with the file name of the same file in the original path of the file.

[0024] In a possible real-time manner of the first aspect, the method further includes: when the electronic device monitors a file content modification event in a cache path corresponding to an application, querying whether a preset public path stores a file corresponding to the file content modification event; if the preset public path stores a file corresponding to the file content modification event, modifying the content of the file corresponding to the file renaming event based on the file content modification event. In this way, it can be ensured that the content of the file stored in the preset public path is consistent with the original path of the file.

[0025] Furthermore, when a file content modification event occurs in a file in the file cache path corresponding to the application, the file size, file signature value and other attribute information of the file may change. Therefore, the above method also includes: when the electronic device responds to the file content modification event in the cache path corresponding to the application, it can also modify the attribute information of the file corresponding to the saved file content modification event in the preset database. In this way, it can be ensured that the file name saved in the preset database is consistent with the file name of the same file in the original path of the file.

[0026] In a possible real-time method of the first aspect, in response to monitoring the presence of a new file addition event in the file cache path corresponding to the application, before saving the attribute information of the target file to the preset database, the above method also includes: determining that the attribute information of the target file has not been saved to the preset database based on the file signature value of the target file. Since the signature value of the file is the same when the file content is the same, in this solution, before saving the attribute information of the target file, it is also possible to query the preset database based on the file signature value whether the attribute information of the file with the same content has been saved. If so, the electronic device may no longer repeatedly save the duplicate file attribute information. In this way, files with the same content are no longer saved repeatedly, which can save the storage space of the electronic device.

[0027] In a possible real-time mode of the first aspect, the method further includes: the electronic device responds to detecting the installation operation of the application, and when the application has logged into the user account, scans the file cache path corresponding to the application. And, when it is scanned that the file cache path corresponding to the application has saved a historical file, the attribute information of the historical file is obtained, and the attribute information of the historical file is saved to a preset database. In this way, for historical files for which no file addition event is monitored, the electronic device can also save its attribute information to the preset database, so that the user can save the historical file to the preset public path by triggering the attribute information in the preset database, so as to facilitate file management.

[0028] In a possible real-time manner of the first aspect, before monitoring the file cache path corresponding to the application, the method further includes: obtaining the original path and sub-path rules corresponding to the application, and determining the file cache path corresponding to the application according to the original path and sub-path rules. In this way, the file cache path that really needs to be monitored can be found from multiple paths for caching data of the application.

[0029] In a possible real-time manner of the first aspect, the above-mentioned determining the file cache path corresponding to the application according to the original path and the sub-path rule may specifically include: when the first target sub-path that uniquely satisfies the sub-path rule is found in the original path, the first target sub-path is used as the file cache path corresponding to the application. If the electronic device can find the only target sub-path that satisfies the sub-path rule in the original path, it means that the target sub-path is the file cache path corresponding to the application, and then the electronic device can monitor the target sub-path.

[0030] In a possible real-time method of the first aspect, when two or more second target sub-paths satisfying the sub-path rule are found in the original path, the one with the most recent update time among the two or more second target sub-paths is used as the file cache path corresponding to the application.

[0031] In a possible real-time method of the first aspect, when a sub-path satisfying the sub-path rule is not found in the original path, the target path is monitored until the third target sub-path that uniquely satisfies the sub-path rule is found in the target path, and the third target sub-path is determined as the file cache path corresponding to the application. Wherein, when the original path is a root path, the target path is the original path; when the original path is not a root path, the target path is the parent path of the original path. If the electronic device does not find a target sub-path satisfying the sub-path rule in the original path, the target path that already exists in the electronic device in the original path can be monitored first, so that once a target sub-path satisfying the above-mentioned sub-path rule is created in the target path, the target sub-path is the file cache path corresponding to the application. Afterwards, the electronic device can monitor the target sub-path.

[0032] In this solution, through the pre-set original path and sub-path rules, the file cache path used by the application to cache files can be accurately found from multiple paths included in the application.

[0033] In a possible real-time mode of the first aspect, the above method also includes: while monitoring the file cache path corresponding to the application, the electronic device can also monitor the original path corresponding to the application. And, in response to monitoring the directory creation event in the original path corresponding to the application, the file cache path corresponding to the application is re-determined according to the original path and sub-path rules. If a directory creation event occurs under the original path of the application, it is possible that the user has switched the user account in the application, and then it may be necessary to change the monitoring path. Therefore, after detecting the directory creation event of the original path, the electronic device redetermines the target path. In this way, the electronic device can update the monitoring path in time, so as to better provide file storage services.

[0034] In a possible real-time method of the first aspect, the file cache path corresponding to the application does not allow applications other than the application to access it. In this solution, in response to the second trigger operation, the target file stored in the file cache path corresponding to the application is copied to the preset public path, which may specifically include: in response to the second trigger operation, the target file stored in the file cache path corresponding to the application is copied to the preset public path through the preset process of the electronic device; wherein the preset process has the administrator root authority of the electronic device. In this way, it is ensured that the electronic device can obtain the target file from the file cache path of the application.

[0035] In a possible real-time manner of the first aspect, in response to the second trigger operation, copying the target file stored in the file cache path corresponding to the application to the preset public path includes: in response to the second trigger operation, if the electronic device cannot find the target file in the file cache path corresponding to the application according to the file name of the target file, the file signature value of the target file can be obtained. Then, the storage location of the target file in the file cache path is searched according to the file signature value of the target file, and finally, the target file is obtained from the storage location in the file cache path corresponding to the application.

[0036] When the application saves duplicate files with the same content, the duplicate files will be renamed to the file signature value corresponding to the file and saved. When the application copies files from the file cache path, the corresponding file may not be found according to the original file name. Therefore, in this solution, if the corresponding file cannot be found in the file cache path according to the original file name, the file signature value can be used to find the save location of the file. In this way, it can be ensured that the electronic device can find the corresponding file in the file cache path and execute the copying step.

[0037] In the second aspect, a file viewing method is also provided, which is applied to an electronic device, wherein the electronic device includes a first application with a file receiving and sending function, and a second application with a file viewing function; the method includes: displaying a first interface of the first application; in response to receiving a notification message, displaying a message prompt control of the notification message on the first interface; the notification message includes a target file, and the target file includes one or more of a document file, an image file, an audio file, or a video file; in response to a first trigger operation on the message prompt control, displaying the target file and displaying a prompt window; the prompt window includes a control of the target file, and the control of the target file includes the file name and / or icon of the target file; in response to a second trigger operation on the control of the target file, displaying a second interface of the second application, and displaying the target file on the second interface. In this solution, the electronic device provides a user with a method of triggering the opening and viewing of the target file through the prompt window, thereby improving the convenience of file viewing.

[0038] In a third aspect, an electronic device is provided, comprising: a display screen, a processor and a storage device; the display screen is used to display an interface of the electronic device; the storage device is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the storage device, so that the electronic device executes a file saving method or a file viewing method as described in any one of the first aspects above.

[0039] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer can execute any file saving method or file viewing method in the first aspect.

[0040] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute any one of the file saving methods or file viewing methods in the first aspect.

[0041] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a saver for saving program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0042] Among them, the technical effects brought about by any design method in the second to sixth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1A schematic diagram of an operation interaction of an electronic device to save a file through an application provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of a path for storing files in an electronic device provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0046] Figure 4 A software architecture block diagram of an electronic device provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of the operation interaction of saving a file in a file saving method provided in an embodiment of the present application;

[0048] Figure 6 A flowchart of a file storage method provided in an embodiment of the present application;

[0049] Figure 7 A flowchart of a file storage method provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of a process for determining a target path provided in an embodiment of the present application;

[0051] Fig. 9 A schematic diagram of a process of scanning a target path provided in an embodiment of the present application;

[0052] Fig.10 A schematic diagram of a process of monitoring a target path provided in an embodiment of the present application;

[0053] Fig.11 Schematic diagram of several different situations in which a mobile phone receives two files successively through an application provided in an embodiment of the present application;

[0054] Fig.12 A schematic diagram of a process flow of a mobile phone when adding and deleting files provided in an embodiment of the present application;

[0055] Fig.13 A schematic diagram of a process of copying a file and scanning a target path provided in an embodiment of the present application;

[0056] Fig.14 A structural block diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] Some applications of smart phones support receiving and sending files. If you need to save the received files to the mobile phone, you need to perform relatively cumbersome operations.

[0058] For example, if the application is an instant messaging application, please refer to Figure 1 , which shows a group message interface 101 of an instant messaging application of a mobile phone, in which the user receives a document 102 sent by Teacher Li. If the user wants to save the document 102 to the mobile phone, the user can click on the document 102 in the group message interface 101 to preview it, and then save it. Specifically, in response to the user's click operation on the document 102, the mobile phone displays a document preview interface 103, and displays the content of the document 102 in the document preview interface 103.

[0059] The document preview interface 103 also includes more operation controls 104. In response to the user clicking the more operation controls 104, the mobile phone can display an operation window 105. The operation window 105 includes a save option 106.

[0060] Furthermore, in response to the user clicking the save option 106, the mobile phone can save the document 102. Optionally, after the mobile phone saves the document, a prompt message 107 can be displayed on the interface to remind the user that the document has been saved and the save path. Alternatively, in other examples, after the mobile phone saves the document, a prompt message 108 can be displayed on the interface; the prompt message 108 may interrupt the user from browsing the file content.

[0061] It can be seen from this that for files received in an instant messaging application, if a mobile phone wants to save them locally, the saving process is cumbersome and the saving efficiency is low.

[0062] In addition, currently, the mobile phone does not usually support modifying the save path for files received through applications. The mobile phone usually creates a dedicated file cache path for the application, and then saves the file to the dedicated file cache path when a save operation is detected. Files saved by different applications will be saved to the file cache path corresponding to the application. In other words, files received at different times and through different applications will be saved in different paths. The following is combined with Figure 2 , briefly explains the file saving methods and paths for several types of applications.

[0063] When a user opens a file of application 1 for the first time, the mobile phone saves the file to the dedicated internal path of application 1 in response to the file opening operation. Furthermore, the mobile phone can save the file to the dedicated folder of application 1 under the public path in response to the user's save operation on the file.

[0064] When a user opens a file of application 2 for the first time, the mobile phone can save the file in a dedicated folder of application 2 under the public path in response to the file opening operation.

[0065] When a user opens a file of application 3 for the first time, the mobile phone can save the file to a dedicated external path of application 3 in response to the file opening operation.

[0066] Combination Figure 2 As shown in the diagram, if a user opens a file received in an application for the first time, the file may be saved in an internal path that is exclusive to the application. The internal path that is exclusive to the application is usually only accessible to the application itself, and other applications and the mobile phone system are not allowed to access it. In other words, when a user opens a file received in an application for the first time, although the mobile phone can save the file, the saved file in this case is not allowed to be accessed by other applications, which is not conducive to the user performing other operations on the file.

[0067] If the mobile phone saves the file to a public path in response to the user's operation; or when the user first opens a file of a certain application (such as the above application 2), the mobile phone saves the file to a dedicated external path or a public path, and the files in the dedicated external path and the public path are usually accessible to the mobile phone system and other applications. Figure 2 It can also be understood that when a mobile phone saves files from different applications, the files will be saved in the path or folder corresponding to the application. In this way, the files saved by the mobile phone are scattered, which is not conducive to the unified management of files. In addition, the paths of files saved by different applications in the above manner are different, which is not conducive to finding files.

[0068] Based on this, an embodiment of the present application proposes a file saving method that can be applied to an electronic device. The electronic device includes an application with a file sending and receiving function, and the application supports sending and receiving files. Specifically, the method may include: displaying a first interface of the application on the electronic device, and in response to receiving a notification message, displaying a message prompt control of the notification message on the first interface. The notification message includes a target file. In response to a first trigger operation on the message prompt control, the electronic device may display a prompt window, which includes a control for the target file. It can be understood that the above-mentioned first trigger operation is the first trigger operation on the message prompt control. Afterwards, when the electronic device detects a second trigger operation on the control of the target file in the prompt window, in response to the second trigger operation, the target file can be saved to a preset public path.

[0069] In some examples, the file may specifically refer to any one of a document file, an image file, an audio file, or a video file. In other examples, the file may also include multiple types of document files, image files, audio files, or video files, or the file may include multiple files of one file type, such as a compressed package, a folder, or the like, which includes multiple files.

[0070] In this solution, first, when a first trigger operation of a message prompt control corresponding to a target file is detected, the electronic device can display the control of the target file to the user in a prompt window. Then, in response to the user's second trigger operation of the control of the target file in the prompt window, the electronic device can save the target file to a preset public path. Figure 1 As for the file saving process shown, the process of the file saving method provided in the embodiment of the present application is relatively simple.

[0071] Secondly, compared with the related art, in the method provided in the embodiment of the present application, files saved by different applications can be saved to the same preset public path, which is convenient for file management and file search.

[0072] In addition, the embodiment of the present application also provides a file viewing method, which can be applied to an electronic device, wherein the electronic device includes a first application with a file sending and receiving function, and a second application with a file viewing function. The method includes: displaying a first interface of the first application; in response to receiving a notification message, displaying a message prompt control of the notification message on the first interface; the notification message includes a target file, and the target file includes one or more of a document file, an image file, an audio file, or a video file; in response to a first trigger operation on the message prompt control, displaying the target file and displaying a prompt window; the prompt window includes a control for the target file, and the control for the target file includes the file name and / or icon of the target file; in response to a second trigger operation on the control for the target file, displaying a second interface of the second application, and displaying the target file on the second interface.

[0073] In this solution, the electronic device provides the user with a method of triggering the opening and viewing of a target file through a prompt window, thereby improving the convenience of file viewing.

[0074] In some embodiments, the electronic device may be a mobile phone, a tablet computer, a personal computer (PC), a smart screen, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a smart watch and other wearable devices, an artificial intelligence (AI) speaker and a vehicle-mounted device, or various teaching aids (such as a learning machine, an early education machine), a smart toy, a portable robot, a personal digital assistant (PDA), an augmented reality (AR)\virtual reality (VR) device, a media player and other devices, or a device with a mobile office function, a device with a smart home function, a device with an audio-visual entertainment function, a device supporting smart travel, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the device.

[0075] like Figure 2 The figure shows a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. 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 sensor module 180, a button 190, a motor 191, a camera 192, a display screen 193, and a subscriber identification module (SIM) card interface 194, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.

[0076] It is to be understood that the structure illustrated 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 more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0077] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the file saving method in the embodiment of the present application.

[0078] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0079] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0080] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.

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

[0082] 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 can store an operating system and an application required for at least one function (such as a sound playback function, an image playback function, etc.).

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

[0084] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .

[0085] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 193, the camera 192, and the wireless communication module 160.

[0086] In some other embodiments, the power management module 141 may also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.

[0087] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0088] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0089] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0090] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0091] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0092] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.

[0093] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0094] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 193. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 193, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.

[0095] The touch sensor 180B is also called a "touch panel". The touch sensor 180B can be arranged on the display screen 193, and the touch sensor 180B and the display screen 193 form a touch screen, also called a "touch screen". The touch sensor 180B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 193. In other embodiments, the touch sensor 180B can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 193.

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

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

[0098] The camera 192 is used to capture still images or videos. In some embodiments, the electronic device 100 may include 1 or N cameras 192, where N is a positive integer greater than 1.

[0099] The electronic device 100 implements the display function through a GPU, a display screen 193, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 193 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0100] The display screen 193 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 193 , where N is a positive integer greater than 1.

[0101] The SIM card interface 194 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting or removing the SIM card interface 194. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.

[0102] The file saving methods in the following embodiments can all be implemented in the electronic device 100 having the above hardware structure.

[0103] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of a layered architecture as an example to exemplify the software structure of the electronic device 100.

[0104] Figure 2 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0105] 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 some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and the native C / C++ library (native layer), the hardware abstraction layer (HAL) and the kernel layer.

[0106] The application layer can include a series of application packages.

[0107] like Figure 2 As shown, the application package can include applications such as camera, gallery, calendar, map, navigation, WLAN, Bluetooth, music, SMS, video, document, and global favorites.

[0108] Among them, the document application supports opening, viewing and editing files. The global collection is used to save audio, video, pictures, documents and other files received or sent by the electronic device through the application, and a prompt window is displayed on the interface during the file saving process.

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

[0110] like Figure 2As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, an input manager, and a file manager, etc.

[0111] The file manager is used to manage files, pictures, videos, music, etc. stored in electronic devices.

[0112] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.

[0113] Content providers are used to store and retrieve data and make it accessible to applications. This data can include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0114] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0115] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0116] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0117] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.

[0118] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.

[0119] The Android runtime includes the core library and the Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly uses the ahead of time (AOT) compilation technology and the just in time (JIT) compilation technology.

[0120] The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks, etc. The core library provides an API for users to develop Android applications.

[0121] The native C / C++ library can include multiple functional modules, such as surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, and installd.

[0122] Wherein, installd is a process with administrator root authority. In the embodiment of the present application, the electronic device can monitor the specified path through the installd process to monitor the update of the file in the specified path.

[0123] The surface manager is used to manage the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES provides drawing and operation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 100.

[0124] The hardware abstraction layer runs in user space, encapsulates kernel layer drivers, and provides a calling interface to the upper layer.

[0125] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0126] The following will take the electronic device being a mobile phone, the application being an instant messaging application, and the target file being a document file as an example, and will describe in detail the file saving method provided in the embodiment of the present application in conjunction with the accompanying drawings.

[0127] The mobile phone displays the first interface of the instant messaging application, such as Figure 5 A group messaging interface 201 of an instant messaging application is shown.

[0128] In response to receiving the notification message, the mobile phone may display a message prompt control corresponding to the notification message received by the mobile phone through the instant messaging application in the group message interface 201, such as a file control 202 corresponding to a document file. In this embodiment, the mobile phone may first display the first interface, then receive the notification message, and display the notification message on the first interface.

[0129] In other embodiments, the mobile phone may first receive the notification message and then display the first interface including the message prompt control corresponding to the notification message. For example, after the mobile phone receives the notification message in the background through the instant messaging application, it opens the message interface corresponding to the notification message in response to the user's operation.

[0130] Typically, the user can save the target file to the file cache path of the instant messaging application by triggering the file control 202 in the group message interface 201 of the instant messaging application. In some embodiments, the file cache path may include Figure 2 Application-specific internal paths, specific external paths, or public paths as shown.

[0131] In some examples, the user can preview the content of the document file by triggering the file control 202. For example, in response to the triggering operation on the file control 202, the mobile phone can also display the file preview interface 203, and display the specific content of the document file in the file preview interface 203.

[0132] In other embodiments, the file control 202 may further include a download control corresponding to the received document file. In this case, the mobile phone, in response to a trigger operation on the file control 202, may save the document file to a file cache path corresponding to the instant messaging application.

[0133] In some embodiments, the mobile phone may record the first trigger operation detected for the file control 202 as the first trigger operation.

[0134] In an embodiment of the present application, in order to save files uniformly and provide users with a quick way to save files, the mobile phone can also display a prompt window when the trigger operation for the file control 202 is detected for the first time. Among them, the mobile phone can display the control corresponding to the document file in the prompt window. In some embodiments, the control corresponding to the document file can specifically be the file name and / or icon of the document file. In other embodiments, the control corresponding to the document file displayed in the prompt window can also include other attribute information of the document file, such as receiving time, size, and file type, etc.

[0135] In other embodiments, the prompt window may also display controls for multiple files that have been saved, so that the user can quickly open and view previously collected files through the prompt window.

[0136] In some embodiments, before the mobile phone displays the control of the document file in the prompt window, it needs to first obtain the attribute information of the document file. Then, according to the attribute information of the document file, the control of the document file is displayed in the prompt window. Specifically, the mobile phone can obtain the attribute information of the file from the file cache path of the instant messaging application. Furthermore, in some embodiments, after obtaining the attribute information of the document file, the mobile phone can also save the attribute information of the document file to a preset database.

[0137] It should be noted that, since the user has already collected the attribute information of the file when opening the file for the first time, the mobile phone may not repeatedly display the prompt window when detecting the trigger operation for the file control 202 again. The attribute information of the file may specifically include one or more of the file name, file size, receiving time, file type, and file signature (such as the MD5 value of the file).

[0138] In other embodiments, please refer to Figure 5 In the process of saving the attribute information of a file, the mobile phone may first display a floating window 204, and the floating window 204 is used to prompt the user that the attribute information of the file is being collected (saved); for example, the mobile phone may display the text content "collected" in the floating window 204. Afterwards, after the mobile phone successfully saves the attribute information of the file, the display content of the floating window 204 may be changed to "collected". It should be noted that the floating window prompting that the file is being collected and the file has been collected may specifically correspond to the attribute information of the file being collected and the attribute information of the file being collected. Afterwards, the user can click on the floating window to view the attribute information of the collected file. For example, in response to the user clicking on the floating window 204, the mobile phone displays a prompt window 205. The prompt window 205 displays the controls of the collected files.

[0139] In some embodiments, after the mobile phone displays the floating window 204 in response to the first trigger operation, if the user does not click on the floating window 204 to view the property information of the favorited file, the mobile phone can hide the floating window on the side of the display screen.

[0140] In some embodiments, the floating window 204 may further include a delete subcontrol 206, which is used to delete the file attribute information collected in the file collection. For example, when the mobile phone detects a trigger operation for the delete subcontrol 206, it may delete the attribute information corresponding to the file in the preset database.

[0141] Combination Figure 2 As can be seen from the file saving paths shown, the file cache paths of different applications may be different, which will cause the files from different applications saved in the mobile phone to be scattered everywhere, which is not conducive to file management. Therefore, in some embodiments, the method provided in the embodiments of the present application can provide users with an entry to save files to a unified path. For example, when the mobile phone detects the second trigger operation on the attribute information of the file in the prompt window, it can save the file to a preset public path.

[0142] Since the mobile phone saves the document file to the file cache path of the instant messaging application when detecting the first trigger operation on the file control 202, in some embodiments, the mobile phone saves the file to the preset public path in response to the second trigger operation, which may specifically include the mobile phone copying the document file saved in the file cache path of the instant messaging application to the preset public path in response to the second trigger operation.

[0143] In the technical solution provided in the embodiment of the present application, when a second trigger operation on a control corresponding to a target file displayed in the prompt window is detected, the corresponding target file can be saved to a preset public path, which can facilitate file management and file searching.

[0144] The above file preview interface is a file preview interface provided by an instant messaging application, and the file preview interface may not support users to modify the file content. Therefore, the user may want to open the file through other applications, edit the file through other applications, etc. For example, in response to the user's triggering operation on the attribute information of the favorited file displayed in the prompt window, the mobile phone can display the application interface of the first application and display the file content in the application interface of the first application. The first application may be an application that supports viewing and editing files.

[0145] In an embodiment in which the mobile phone saves a file to a proprietary external path or a public path of an instant messaging application in response to a first trigger operation, it can be seen from the above description that the proprietary external path and the public path of the application allow access by the mobile phone system and other applications. In other words, the proprietary external path and the public path of the instant messaging application allow access by non-instant messaging applications. In this embodiment, the mobile phone displays the file content in the application interface of the first application in response to a second trigger operation, which may specifically include: the mobile phone obtains the file content from the proprietary external path or the public path through the first application in response to the second trigger operation, and displays the file content in the application interface of the first application; Figure 5 The interface 207 shown. Figure 7 The process shown.

[0146] It should be noted that Figure 5The interface 207 shown is displayed in the form of a floating window. In other embodiments, the mobile phone can also jump from the file preview interface to the first application, and display the application interface of the first application and display the file content on the application interface of the first application.

[0147] In the embodiment in which the mobile phone saves the file to the proprietary internal path of the instant messaging application in response to the first trigger operation, it can be seen from the above description that the proprietary internal path of the application is usually only accessible to the application itself. In other words, the proprietary internal path of the instant messaging application does not allow non-instant messaging applications to access it. In this embodiment, the mobile phone displays the file content on the application interface of the first application in response to the second trigger operation, which may specifically include: the mobile phone copies the file from the proprietary internal path in response to the second trigger operation, and saves the file to a preset public path. Then, the mobile phone obtains the file content from the preset public path, and displays the file content on the application interface of the first application; Figure 5 The interface 207 is shown. It should be noted that the above-mentioned preset public path allows the mobile phone system and multiple applications of the mobile phone to access.

[0148] Further, in some embodiments, the mobile phone copies the file from the proprietary internal path and saves the file to the preset public path, which can be implemented specifically through a preset process of the mobile phone. The preset process of the mobile phone has administrator root privileges. In different electronic devices, the preset process can be named differently. For example, in some examples, the preset process can be specifically named as the installd daemon process.

[0149] In the technical solution provided in the embodiment of the present application, compared with the steps that the electronic device needs to perform when saving files received by the mobile phone through the instant messaging application in the related art, the process of the file saving method provided in the embodiment of the present application is relatively simple. Secondly, compared with the files saved by the mobile phone in different applications in the related art, which are usually saved to the file cache path of the corresponding application, resulting in the dispersion of the files saved in the electronic device, which is not conducive to file management, in the method provided in the embodiment of the present application, the files saved for different applications can be saved to the same preset public path. In this way, file management is convenient and search is convenient.

[0150] The following is an explanation of the interaction between the modules of the mobile phone during the implementation of the above file saving method. Figure 6 , which shows the process of the file saving method in some embodiments. In this example, the file is still described as a document file.

[0151] The mobile phone needs to install the application before it can send and receive files through the application. After that, the mobile phone can save the files received or sent in the application. Therefore, in some embodiments, in order to implement the above file saving method, it is necessary to monitor when the mobile phone installs the application.

[0152] Specifically, the mobile phone can monitor the installation operation of the application through the first file management service module. Taking the application as an instant messaging application as an example, when the installation operation of the instant messaging application is monitored, the first file management service module can start monitoring the file cache path of the instant messaging application in response to the installation operation. It should be noted that the file cache path of the above application can specifically refer to the path used by the mobile phone to save files when the user downloads or opens the file for the first time.

[0153] When an application is installed on a mobile phone, it may be necessary to create multiple paths corresponding to the application in the mobile phone, each of which is used to store different data of the application. For example, the path corresponding to the application may specifically include a path for storing application configuration files, a path for storing application files, etc. Therefore, before starting to monitor the file cache path of the instant messaging application, the mobile phone also needs to determine which path is the file cache path of the instant messaging application.

[0154] In some embodiments, path matching rules for file cache paths corresponding to different applications can be pre-configured in the mobile phone. After monitoring the installation operation of the instant messaging application, the first file management service module can obtain the path matching rules corresponding to the instant messaging application in response to the installation operation. Afterwards, according to the path matching rules corresponding to the instant messaging application, the file cache path corresponding to the instant messaging application can be determined. Then, the first file management service module can start monitoring the file cache path to monitor the update of files in the file cache path. It should be noted that the specific implementation method of the mobile phone determining the file cache path of the application according to the path matching rules will be described in detail in the following embodiments. The specific implementation method of starting monitoring of the file cache path to monitor the update of files in the file cache path can refer to the description in the relevant technology.

[0155] Because different applications save files in different paths when a user first opens or downloads a file, in some embodiments, the file cache paths monitored by different applications may be different. Figure 2 For the application 1 shown, the mobile phone can monitor the dedicated internal path corresponding to the application 1 (that is, the folder of the application 1 in the dedicated internal path). Figure 2 For application 2 shown, the mobile phone can monitor the folder corresponding to application 2 in the public path. Figure 2For the application 3 shown, the mobile phone can monitor the dedicated external path corresponding to the application 3 (ie, the folder of the application 3 in the dedicated external path).

[0156] The mobile phone can monitor the file cache path through the monitoring module. In an embodiment in which the mobile phone saves the file to the proprietary internal path of the application in response to the first trigger operation of the control corresponding to the target file, since the proprietary internal path of the application does not allow other applications to access it, the above-mentioned monitoring module can specifically refer to the program module corresponding to the preset process. The preset process has root authority. In an embodiment in which the mobile phone saves the file to the proprietary external path of the application in response to the first trigger operation of the file, since the proprietary external path allows other applications to access it, the above-mentioned monitoring module can be a program module corresponding to the preset process with root authority, or it can be another program module without root authority.

[0157] Instant messaging applications usually support sending and receiving files only after the user account has been logged in. If the instant messaging application is installed on the mobile phone for the first time and the user account has not been logged in, the file cache path corresponding to the instant messaging application is usually empty. However, some mobile phones support operations such as "copy application", which can copy application data from other electronic devices and save it to the mobile phone. Exemplarily, the mobile phone receives data from the instant messaging application of other electronic devices and saves it to the mobile phone. In this case, even if the mobile phone installs the instant messaging application for the first time, before logging in to the user account, it is possible that the file cache path corresponding to the instant messaging application may already contain files copied from other electronic devices to the instant messaging application. Therefore, in some embodiments, after detecting the installation operation of the instant messaging application, the mobile phone can first scan the file cache path of the instant messaging application to determine whether it contains historical files.

[0158] If a historical file has been saved in the file cache path of the instant messaging application during installation, the user may have a need to view the historical file. In some embodiments, when the mobile phone detects the installation operation of the instant messaging application and scans that the file cache path of the instant messaging application has a historical file saved, it can obtain and save the attribute information of the historical file saved in the file cache path.

[0159] Afterwards, if the user triggers the attribute information of the file, the mobile phone can obtain the file corresponding to the attribute information and save the file to the preset public path.

[0160] In some embodiments, when the mobile phone scans the file cache path of the instant messaging application after detecting the installation operation of the instant messaging application, the attribute information of the historical file scanned from the file cache path may be prompted to the user in real time without using a prompt window. The user can check whether the attribute information of the historical file exists in the path where the attribute information of the historical file is saved. If so, the user can trigger the attribute information of the historical file to enable the mobile phone to open the content of the corresponding historical file through the first application.

[0161] In some embodiments, after the instant messaging application is installed, the mobile phone may also first detect whether the user has logged into the user account in the instant messaging application before scanning the file cache path of the instant messaging application. And, after detecting that the instant messaging application is successfully installed and the user account is logged in, the scanning of the file cache path of the instant messaging application is started to determine whether there are historical files saved therein. Afterwards, when it is detected that historical files have been saved in the file cache path, the attribute information of the historical files is obtained and saved. In this way, the problem of files being viewed when the user has not logged into the user account, resulting in the leakage of files, can be avoided. In some embodiments, the mobile phone can scan the file cache path of the instant messaging application through the above-mentioned monitoring module.

[0162] The mobile phone can determine that the instant messaging application has logged in to the user account by obtaining the login status information of the instant messaging application. For example, the mobile phone can obtain the islogin parameter of the instant messaging application. When the islogin parameter is yes, it means that the instant messaging application is in the logged-in state, that is, the user account has been logged in.

[0163] When the same application logs in to different user accounts, the mobile phone will usually distinguish the storage paths of the files saved by the application. Therefore, in some embodiments, after detecting that the instant messaging application logs in to the user account, the monitoring of the file cache path is started to monitor the update of the files in the file cache path, and the scanning of the collection storage path when the instant messaging application is installed are all monitoring and scanning of the file cache path corresponding to the currently logged in user account.

[0164] Furthermore, the instant messaging application installed on the same mobile phone may have an event of switching user accounts. Combined with the above description, it can be seen that if the user account is switched, the file cache path will be updated. Therefore, after starting to monitor the file cache path to monitor the update of the files in the file cache path, the mobile phone can also monitor the user account currently logged in to the instant messaging application. Exemplarily, the mobile phone can monitor the account exit event of the instant messaging application, as well as the account switching event, etc. In some embodiments, when the mobile phone monitors the account switching event of the instant messaging application, it can re-match the file cache path that needs to be monitored after switching the account according to the path matching rules of the instant messaging application.

[0165] In some embodiments, the monitoring of the user account currently logged into the instant messaging application may be implemented through the monitoring management service module.

[0166] It can be seen from the description of the above embodiment that after the instant messaging application is installed and the user account is logged in, the mobile phone can continuously monitor the file cache path corresponding to the user account of the instant messaging application, and monitor the update of the files therein. Then, according to the update of the file, it is determined whether the file needs to be saved to the preset public path, and whether the corresponding file operation needs to be performed on the file saved in the preset public path. Among them, the update of the file in the file cache path can specifically include events such as file addition, file deletion, file movement, file renaming, file content modification, directory creation event, directory modification event, and directory deletion event.

[0167] by Figure 5 Taking the illustrated scenario as an example, in some embodiments, when the user triggers the file control 202 in the group message interface 201 for the first time, the mobile phone saves the file to the file cache path of the instant messaging application in response to the triggering operation. For the file cache path, a new file addition event occurs. In combination with the description of the above embodiments, it can be seen that after installing the instant messaging application and logging in to the user account, the monitoring module will monitor the file cache path. Therefore, when the mobile phone saves the file to the file cache path of the instant messaging application, the monitoring module can monitor the occurrence of a new file addition event in the file cache path.

[0168] When a user receives and sends files in an instant messaging application, it is possible that the user receives file 1 in the group message interface, and then receives file 2 sent by another friend. File 2 can be the same file as file 1. When the mobile phone receives the first trigger operation for file 1, it needs to save file 1 to the file cache path; when the mobile phone receives the first trigger operation for file 2, it needs to save file 2 to the file cache path.

[0169] As can be seen from the description of the above embodiments, in some embodiments, when the mobile phone detects the first trigger operation for the corresponding control of the file, it will obtain and save the attribute information of the file. And, after the mobile phone installs the instant messaging application and logs in the user account, it will monitor the file cache path to monitor the update of the file therein. In some embodiments, the mobile phone can specifically trigger the acquisition of the attribute information of the newly added file when it monitors the occurrence of a file addition event in the file cache path. Further, if the mobile phone successively monitors the occurrence of a file addition event of file 1 and a file addition event of file 2 in the file cache path, the attribute information of two identical files (file 1 and file 2) may be repeatedly saved. It is also possible to save two identical files afterwards. Saving two identical files may cause the storage space of the mobile phone to be wasted. Therefore, in order to avoid saving the same file, the mobile phone can perform deduplication processing when it obtains and saves the attribute information of the file when it monitors the occurrence of a file addition event in the file cache path, and then saves the attribute information of the file after deduplication. Among them, the specific implementation process of deduplication processing when the mobile phone saves the attribute information will be described in detail in the following embodiments.

[0170] In some embodiments, the above-mentioned deduplication processing can be specifically implemented through the second file management service module of the mobile phone.

[0171] In some embodiments, after the second file management service module performs deduplication processing, it can notify the first file collection service module to start collecting file attributes. At the same time, the first file collection service module can also notify the second file collection service module to display a prompt window and display "collecting" in the prompt window. The second file collection service module can also notify the third file collection service module to save the attribute information of the file. After the third file collection service module successfully saves the attribute information of the file, it can notify the second file collection service module to update the content displayed in the prompt window from "collecting" to "collected".

[0172] After the mobile phone starts monitoring the file cache path, when it monitors updates of files in the file cache path, such as file addition events, file deletion events, file modification events, file move events, file rename events, directory creation events, directory modification events, and directory deletion events, it can perform corresponding file operations on the files saved in the preset public path.

[0173] Exemplarily, a file addition event may specifically include: first creating a file, then modifying and writing the content, and finally closing it, such as an IN_CREATE event, an IN_MODIFY event, and an IN_CLOSE_WRITE event. In other examples, a file addition event may also include: a file is moved to a file cache path, such as an IN_MOVED_TO event.

[0174] The file deletion event may specifically include: the file is deleted, such as the IN_DELETE event. Alternatively, the file deletion event may specifically include the file is moved from the file cache path to another folder, such as the IN_MOVED_FROM event.

[0175] The file modification event may specifically include: file content modification, such as IN_MODIFY event. Or, the file modification event may specifically include file attribute modification, such as IN_ATTRIB event.

[0176] Directory creation events may specifically include: IN_ISDIR|IN_CREATE events.

[0177] Directory modification events may specifically include: IN_ISDIRI|N_MODIFY events.

[0178] Directory deletion events may specifically include: IN_ISDIR|IN_DELETE events.

[0179] Take the case where the mobile phone monitors a file addition event in the file cache path as an example. If the file 1 corresponding to the file addition event is not saved in the preset public path, the mobile phone can copy the file 1 saved in the file cache path to the preset public path when detecting a trigger operation for the attribute information of the file 1. In combination with the description of the above embodiment, it can be seen that the first trigger operation of the user on the file control displayed on the interface of the instant messaging application can trigger the mobile phone to save the file, that is, the file addition event of the file cache path.

[0180] Taking the case where the mobile phone monitors a file deletion event in the file cache path as an example, if the file 2 corresponding to the file deletion event is not saved to the file of the preset public path, the mobile phone does not need to perform an operation on the file saved in the preset public path. However, when the mobile phone saves the file 2 to the file cache path, the mobile phone will trigger the acquisition and saving of the file attribute information of the file 2. Therefore, when the mobile phone monitors a file deletion event in the file cache path, the mobile phone can delete the saved attribute information of the file 2 in response to the file deletion event.

[0181] If, when monitoring a file deletion event in the file cache path, it is detected that the file 2 corresponding to the file deletion event has been saved to the preset public path, it means that the file 2 has been saved locally on the mobile phone. At this time, in response to the file deletion event, the mobile phone may not delete the file 2 saved in the preset public path, nor may it delete the attribute information of the saved file 2.

[0182] In order to simplify the process of saving files and facilitate the management of saved files, when the mobile phone monitors the user's trigger operation on the attribute information of the file displayed in the prompt window, the mobile phone can save the file to a preset public path. It can be seen from the description of the above embodiment that the mobile phone saves the file to the file cache path in response to the first trigger operation on the file control. Therefore, in some embodiments, when the mobile phone responds to the user's trigger operation on the attribute information of the file displayed in the prompt window, the file is saved to the preset public path, which can specifically include: obtaining the file from the file cache path and saving the file to the preset public path. For example, the monitoring module of the mobile phone responds to the trigger operation on the attribute information of the file, copies the file from the file cache path, and pastes the file to the preset public path.

[0183] In combination with the description of the above embodiment, it can be known that the above file cache path can specifically refer to a dedicated internal path, a dedicated external path and a public path. In the case where the file cache path is a dedicated external path or a public path, the files saved in the two paths are allowed to be accessed by the mobile phone system and other applications. Therefore, in the case where the file cache path is a dedicated internal path, the monitoring module of the mobile phone responds to the triggering operation of the attribute information of the file, copies the file from the file cache path, and pastes the file in the preset public path. The preset public path allows the first application to access it, so the mobile phone can obtain the content of the file from the preset public path and display it in the application interface of the first application.

[0184] Combination Figure 5 As can be seen from the scenario shown, in some embodiments, the mobile phone can also display the application interface of the first application in response to the user's triggering operation on the attribute information of the file displayed in the prompt window, and display the content of the file on the application interface of the first application. Specifically, when the file cache path is a proprietary internal path, the listening module of the mobile phone obtains the file from the file cache path, and after saving the file to the preset public path, the listening module can notify the second file management service module. Afterwards, the mobile phone can obtain the uniform resource identifier (Uniform Resource Identifier, URI) of the file through the second file management service module. Afterwards, the second file management service module returns the URI of the file to the third file collection service module, and the file can be opened through the first application. Among them, the specific implementation method of the mobile phone obtaining the URI of the file can refer to the description in the relevant technology, and will not be repeated in the embodiments of the present application.

[0185] If the file cache path is a proprietary external path or a public path, the mobile phone can directly access the files in the file cache path through the first application. Therefore, in response to the triggering operation on the file attribute information, the mobile phone can display the content of the file obtained from the proprietary external path or the public path on the application interface of the first application. Specifically, in this embodiment, the URI of the corresponding file can be obtained through the second file management service module of the mobile phone, and the URI can be authorized. Afterwards, the second file management service module returns the URI to the third file collection service module to realize opening the content of the file through the first application. That is, the content of the file is obtained from the file cache path, and the content of the file is displayed on the application interface of the first application.

[0186] Understandably, Figure 6 The flowchart of the file saving method shown corresponds to the case where the file cache path is an application-specific internal path, a proprietary external path, or a public path. In some embodiments, the first file management service module, the second file management service module, and the listening module are three different program modules. In other embodiments, the first file management service module, the second file management service module, and the listening module may also be the same program module. In the case where the file cache path is an application-specific internal path, when the three modules are the same module, they may specifically be program modules corresponding to a preset process with root permissions, such as a program module corresponding to the installd process. The first file collection service module, the second file collection service module, and the third file collection service module may also correspond to different program modules, or may be the same program module. Exemplarily, the first file management service module may be an ObserverPathManager module, the second file management service module may specifically be a FileInfoProvider module; the listening module may specifically be a program module corresponding to the installd process. The first file collection service module may be a CollectService module; the second file collection service module may be a CapsuleView module; and the third file collection service module may be a ContentProv module.

[0187] Figure 7A flowchart of a file saving method is shown when the file cache path is an application-specific external path or a public path. Similarly, the first file management service module, the second file management service module and the listening module can be three different program modules, or they can be the same program module. Since the file cache path is an application-specific external path, when the three modules are the same module, they can specifically be program modules with access rights to the proprietary external path. The first file collection service module, the second file collection service module and the third file collection service module can correspond to different program modules respectively, or they can be the same program module. Exemplarily, the first file management service module can be an ObserverPathManager module, the second file management service module can specifically be a FileInfoProvider module; the listening module can specifically be a FileObserver module. The first file collection service module can be a CollectService module; the second file collection service module can be a CapsuleView module; the third file collection service module can be a ContentProv module.

[0188] exist Figure 6 and Figure 7 In the process of the first file management service module notifying the monitoring module to start scanning and monitoring, the monitoring module needs to first determine the target path to be scanned or monitored according to the path matching rule. Figure 8-Figure 10 The process of a mobile phone determining a target path to be scanned or monitored according to a path matching rule, and the process of scanning and monitoring the target path are described.

[0189] Please refer to Figure 8 , which shows the process of the mobile phone determining the target path of the application to be monitored according to the preset path matching rules. In some embodiments, different path matching rules can be defined according to different applications, such as application 1 corresponds to path matching rule 1, application 2 corresponds to path matching rule 2, and so on. Therefore, when the mobile phone detects the installation operation of the application, the path matching rule corresponding to the installed application can be obtained. The following is an example of the installed application being an instant messaging application.

[0190] In some embodiments, the path matching rules may specifically include original paths and sub-path rules (regular). The original path is the path used to store data in the mobile phone; the original paths in the path matching rules of different applications may be inconsistent. The sub-path rules define the setting rules for the paths corresponding to the applications in the original paths. Based on the original path and the sub-path rules, the mobile phone searches for a path that meets the sub-path rules in multiple paths of the mobile phone as the file cache path of the instant messaging application.

[0191] In some embodiments, when searching for the file cache path of an instant messaging application, the mobile phone may first search in the mobile phone whether the original path exists. After finding the original path, for the subpaths contained in the original path, each subpath under the original path is matched with the subpath rule respectively to find out whether there is a subpath that meets the subpath rule under the original path. If a subpath that meets the subpath rule is found under the original path, and there is only one subpath that meets the subpath rule, then the path can be used as the target path of the application, that is, the file cache path of the instant messaging application mentioned above.

[0192] If two or more sub-paths that meet the sub-path rule are found under the original path, they may be file cache paths corresponding to multiple user accounts that have logged in to the instant messaging application. File updates are more likely to occur in the file cache path corresponding to the most recently logged-in user account. In other words, among multiple paths that meet the sub-path rule, the path with the latest modification time is more likely to be the target path corresponding to the currently logged-in user account. Therefore, the mobile phone can select the path with the latest modification time in the path as the target path. In this way, the file cache path corresponding to the currently logged-in user account can be better monitored.

[0193] In some embodiments, the mobile phone matches each sub-path under the original path with the sub-path rule respectively, which can be specifically achieved through a regular model.

[0194] If no sub-path that meets the sub-path rule is found under the original path, it may be that the instant messaging application has not logged into the user account, resulting in the mobile phone not creating a sub-path for storing files for the instant messaging application. Therefore, if no sub-path that meets the sub-path rule is found under the original path, the original path is returned as the target path. After that, the mobile phone can monitor the target path. Specifically, the mobile phone can monitor whether a sub-path is created under the target path. If a new sub-path is created under the target path, the newly added sub-path can be matched with the sub-path rule to determine whether the newly added sub-path meets the sub-path rule.

[0195] If the original path is not found in the mobile phone, it is determined whether the original path is a root path. If so, even if the original path does not exist, the original path can be returned as the target path. The mobile phone monitors the target path.

[0196] If the original path is not the root path, the mobile phone can obtain the parent path of the original path and search the mobile phone for the parent path. If the parent path of the original path is found in the mobile phone, the parent path can be used as the target path for monitoring.

[0197] In other embodiments, if the original path is not a root path, and the parent path of the original path does not exist in the mobile phone, then similar to the case where the original path does not exist, the mobile phone can determine whether the parent path is a root path. If so, the parent path of the original path is used as the target path; if not, continue to obtain the next parent path to determine whether it exists and whether it is a root path, until the target path is determined. Figure 8 Not shown.

[0198] In other embodiments, the path matching rule also includes a maximum path depth parameter. The maximum path depth parameter can be specifically used to monitor the target path according to the maximum path depth parameter when monitoring the target path after finding the target path that meets the sub-path rule. For example, when the maximum path depth parameter is set to 1, during the monitoring of the target path, if it is monitored that a first-layer sub-path is created under the target path, the mobile phone monitors the update of the file in the first-layer sub-path of the target path. When the mobile phone monitors that a second-layer sub-path is created under the target path, since the maximum path depth parameter is 1, the mobile phone no longer monitors the file update in the second-layer sub-path. In this way, the files in the file cache path of the application can be better monitored, and when the files in the file cache path are added, deleted, moved, renamed, modified, directory creation events, directory modification events, and directory deletion events occur, the mobile phone can promptly perform corresponding operations on the files saved in the preset public path to ensure the synchronous update of the files.

[0199] Different path matching rules can be set for different applications. The following are several different path matching rules:

[0200] Path matching rule one: data / data / application package name / major category directory / account directory / file type directory. Among them, the original path may include: data / data / application package name / major category directory. The original path is the path for saving files commonly used by applications. Taking instant messaging applications as an example, the original path can be specifically set to: data / data / application package name of instant messaging applications / major category directory name. The sub-path rule corresponds to: / account directory / file type directory. Usually the sub-path is associated with the user account. Therefore, when setting the path matching rule, it is impossible to accurately define the user account information. Therefore, the naming rule of the sub-path can be defined when using the user account as the path matching rule. Exemplarily, the sub-path rule of the above path matching rule one can be set to: hexadecimal number (32 bits) after hashing of the currently logged in user account / file type. Thereby helping the mobile phone to find the file cache path that meets the path matching rule from a large number of paths.

[0201] Path matching rule 2: / data / data / application package name / category directory / account directory / file type directory / random number directory / random number directory. The original path may include: / data / data / application package name / category directory. The sub-path rule corresponds to: / account directory / file type directory / random number directory / random number directory.

[0202] Path matching rule three: / storage / emulated / 0 / Android / data / application package name / random / file receiving type directory. The original path may include: / storage / emulated / 0 / Android / data / application package name. The sub-path rule corresponds to: / random / file receiving type directory.

[0203] Path matching rule 4: / Application common file cache path / Application self-built directory. The original path may include: / Application common file cache path; the sub-path matching rule may correspond to: / Application self-built directory.

[0204] It can be understood that the above path matching rules are only examples. In other embodiments, the path matching rules can also be set to other contents.

[0205] In the technical solution provided in the embodiment of the present application, by setting the path matching rules, the mobile phone can locate the file cache path of the application and monitor the file cache path. Then, when the mobile phone monitors the addition, deletion, movement, renaming, modification, directory creation event, directory modification event and directory deletion event of the file in the file cache path, the mobile phone can update the files stored in the preset public path accordingly to ensure that the files stored in the preset public path are the latest.

[0206] Combination Fig. 9 ,right Figure 6 and Figure 7 The first file management service module notifies the monitoring module to start scanning the target path, and the monitoring module starts scanning. When the first file management service module attempts to start scanning, it can send a notification message to the monitoring module. The notification message can carry the path matching rule of the instant messaging application. The monitoring module, based on the notification message, Figure 8 The process shown can obtain the target path.

[0207] Combination Figure 8It can be seen from the process that the target path determined according to the path matching rule may not be the file cache path used by the instant messaging application to cache files. Therefore, after obtaining the target path, the monitoring module can first determine whether the target path satisfies the sub-path rule. If the target path satisfies the sub-path rule, it means that the target path is the file cache path of the instant messaging application. At this time, the mobile phone can determine whether the instant messaging application has logged in to the user account. In the case that the instant messaging application has logged in to the user account, the mobile phone can monitor the update of files in the file cache path, such as adding, deleting, moving, renaming, modifying, directory creation events, directory modification events, and directory deletion events, and perform corresponding operations on the files stored in the preset public path.

[0208] If the target path does not meet the sub-path rule, that is, the target path is not the file cache path of the instant messaging application, it means that the file cache path used by the instant messaging application to cache files has not been found. At this time, the data stored in the target path may not be the files sent or received in the instant messaging application, so the mobile phone does not need to scan the target path. In this way, it can avoid wasting resources caused by unnecessary scanning operations performed by the mobile phone.

[0209] If the target path meets the sub-path rule, it means that the target path is the file cache path of the instant messaging application. However, if the instant messaging application is not logged in to the user account, in order to avoid file leakage, the mobile phone will not perform a scan operation on the target path.

[0210] Combination Fig.10 , the process of the mobile phone monitoring the target path is explained. Similarly, when starting monitoring, the mobile phone will first Figure 8 The method shown obtains the target path. And determines whether the target path satisfies the sub-path rule. If the target path does not satisfy the sub-path rule, it means that the currently monitored target path is not the file cache path of the instant messaging application. At this time, the mobile phone can monitor the event of creating a sub-path under the target path. The current target path is not a file cache path, but the target path may be an upper-level path of the file cache path. Therefore, the sub-path created under the target path may be a file cache path of the instant messaging application. Therefore, when it is monitored that a sub-path is created under the target path, the target path can be retrieved. That is, through Figure 8 The method shown is used to re-search whether there is a path that meets the path matching rule.

[0211] After re-determining the target path, the new target path is compared with the previous target path. If they are consistent, it means that the target path has not been updated. At this time, the mobile phone can continue to monitor the target path without processing. If the new target path is inconsistent with the previous target path, the mobile phone can determine whether the new target path meets the sub-path rules.

[0212] When the mobile phone starts monitoring the target path, if the target path meets the sub-path rule, it means that the target path is the file cache path of the instant messaging application. At this time, the mobile phone can monitor the update of the files in the target path, such as adding, deleting, moving, renaming, modifying, directory creation events, directory modification events, and directory deletion events, and perform corresponding operations on the files stored in the preset public path.

[0213] In addition, when the target path satisfies the sub-path rule, that is, when the mobile phone monitors the file cache path, there may also be a situation where the user switches user accounts. It can be seen from the description of the above embodiments that when a user switches user accounts, the corresponding file cache path will usually be updated accordingly. Take the example of a user logging in to a new user account (logging in on the mobile phone for the first time) in the mobile phone's instant messaging application. When logging in to the new user account, the mobile phone will create a new folder corresponding to the new user account under the corresponding path to cache the files generated by the new user account. Therefore, in some embodiments, when the mobile phone monitors the file cache path, it can also monitor the original path in the path matching rule. When monitoring the event of creating a sub-path under the original path, the mobile phone can also re-acquire the target path, that is, re-acquire the target path through Figure 8 The method shown determines the target path that currently needs to be monitored.

[0214] In the technical solution provided in the embodiment of the present application, specific monitoring content when the mobile phone monitors the target path is provided. When a target path that meets the path matching rules is found, the file update of the target path can be monitored, and according to the update of the file in the target path, the corresponding file operation is performed on the file in the preset public path. And, in the case where the target path that meets the path matching rules is not found, the file cache path of the instant messaging application can be located by monitoring the creation event of the sub-path in the target path. In this way, it is ensured that the update of the file in the file cache path of the instant messaging application can be monitored, so that the files can be automatically collected and saved better.

[0215] As can be seen from the description in the above embodiments, the mobile phone may repeatedly receive the same file through the instant messaging application. In some embodiments, the same file may represent a file with the same name and the same content. In other embodiments, the same file may also represent a file with different names and the same content.

[0216] In some embodiments, when the mobile phone repeatedly receives files with the same name, it will rename the files, such as adding a prefix to the files. When the mobile phone repeatedly receives files with the same content, it will rename the files, such as adding a suffix; at the same time, the MD5 value of the file is saved in the file cache path in the renamed file, and the original file is named with the unique MD5 value and stored in another path of the file cache path. Fig.11 , describes different situations in which a mobile phone receives two files through an instant messaging application.

[0217] In the first case, the mobile phone receives file A for the first time through the instant messaging application, and then receives file B for the first time. The contents of file A and file B are different. In this case, after the mobile phone receives file A, when it detects the user's first trigger operation on file A, the mobile phone will save file A to the file cache path. Similarly, after receiving file B, when it detects the user's first trigger operation on file B, the mobile phone will save file B to the file cache path. That is, file A and file B are added to the file cache path one after another.

[0218] The mobile phone can obtain the MD5 values ​​of the two files to determine whether the file contents of the two files are the same. The MD5 values ​​of files with the same file contents are the same; the MD5 values ​​of two files with different file contents are different.

[0219] In the second case, the mobile phone receives file A for the first time through the instant messaging application, and the mobile phone receives file A again, and the contents of file A received twice are the same. In this case, after the mobile phone receives file A for the first time, when the user's first trigger operation on file A is detected, the mobile phone will save file A to the file cache path. When the mobile phone receives file A again, the mobile phone responds to the first trigger operation on the second received file A, and before saving the second received file A, it will rename the second received file A. For example, file A is renamed 1-A. Then, the renamed file 1-A (i.e., file A received for the second time) is saved to the file cache path. Afterwards, when file A with the same content is received again, it can be named 2-A, 3-A, and so on. It can be understood that the above-mentioned file renaming method is only for example, and it can also be named in other ways in other embodiments.

[0220] Furthermore, in order to avoid the problem of wasting storage space due to repeated storage of the same file, for file A and file 1-A saved in the file cache path, the mobile phone can modify the content of file A and file 1-A to the MD5 value of the file. At the same time, the real file content of file A and file 1-A is stored in another path of the file cache path. That is, in the file cache path, the content of file A and file 1-A is stored as an MD5 value, and the same file content of file A and file 1-A is stored in only one physical file, and stored in another path of the file cache path, such as the path ".ref / d".

[0221] In the third case, the mobile phone receives file B for the first time through the instant messaging application, and the mobile phone receives file B again, wherein the contents of file B received twice are different. In this case, after the mobile phone receives file B for the first time, upon detecting the user's first trigger operation on file B, the mobile phone will save file B to the file cache path. When the mobile phone receives file B again, it detects that the file contents of file B received twice are different, then the mobile phone responds to the trigger operation on file B received for the second time, and before saving file B received for the second time, it will rename file B received for the second time. For example, file B is renamed 1-B. Then the renamed file 1-B is saved to the file cache path.

[0222] In the fourth case, the mobile phone receives file A for the first time through the instant messaging application, and then receives the renamed file A1, and the contents of file A and file A1 are the same. In this case, after the mobile phone receives file A for the first time, when the user's first trigger operation for file A is detected, the mobile phone will save file A to the file cache path. When the mobile phone receives file A1, it detects that the content of the received file A1 is the same as that of file A, and then the mobile phone can save file A1 to the file cache path in response to the trigger operation for the second received file A1. Then, in order to avoid the problem of repeated storage of the same file resulting in a waste of storage space, for file A and file A1 saved to the file cache path, the mobile phone can modify the contents of file A and file 1-A to the MD5 value of the file. At the same time, the real file contents of file A and file 1-A are stored in another path of the file cache path. That is, in the file cache path, the contents of file A and file A1 are stored as MD5 values, and only one physical file is stored for the same file contents of file A and file A1, and stored in another path of the file cache path.

[0223] The above-mentioned several situations refer to different situations in which the mobile phone receives files through the instant messaging application. When the mobile phone sends files through the instant messaging application, the mobile phone also needs to save the files. In some embodiments, the mobile phone can save the files received through the instant messaging application for the first time and the files sent through the instant messaging application in the same path.

[0224] The mobile phone receives file A through the instant messaging application, and in response to the first trigger operation on file A, the mobile phone saves file A to the file cache path. Afterwards, when the mobile phone sends file A through the instant messaging application again, file 1-A will be created in the file cache path. Then, for file A and file 1-A in the file cache path, A* corresponding to file A and 1-A* corresponding to file 1-A are created respectively. Afterwards, the mobile phone can modify the contents of the newly created file A* and file 1-A* to the MD5 value of file A (i.e., the MD5 value of file 1-A). Then, the mobile phone can delete file 1-A and move the physical file of file A to another path in the file cache path.

[0225] Further, in the embodiment of the present application, for the above-mentioned situation where the mobile phone receives duplicate files through the instant messaging application, or the mobile phone receives a file through the instant messaging application and then sends the file, the mobile phone needs to save the file to a preset public path or delete the file in the preset public path under certain conditions. Based on the above-mentioned special situations of repeated sending and receiving files, the file saving method provided in the embodiment of the present application identifies duplicate files and saves them after deduplication.

[0226] In some embodiments, the mobile phone identifies duplicate files and removes duplicates before saving them. Specifically, the duplicates can be removed when saving the attribute information of the files. Figure 6 and Figure 7 In this embodiment, when a file deletion event in the file cache path is monitored, when the file deletion event is reported to the second file management service module, it is necessary to carry in the file deletion event whether the corresponding file itself is deleted. When scanning the file cache path, multiple files with the same MD5 value can be reported; and the files are renamed and saved. In this way, the preset database storage is simple.

[0227] In other embodiments, the mobile phone identifies duplicate files and saves them after deduplication. Specifically, when a new file addition event in the file cache path is monitored, the new file can be deduplicated before deciding whether it needs to be reported to the second file management service module for storage. That is, when the first file management service module or the monitoring module detects files with the same MD5 value, it does not report the new file addition event to the second file management service module. In this embodiment, when a file is received and then sent repeatedly, multiple duplicate file data will be reported, and the file attribute information of multiple files will be saved, as well as controls for displaying multiple files in the prompt window. At the same time, multiple duplicate files are renamed and displayed. In this way, a file is actually added / deleted in the file cache path of the application, and the attribute information of the file is synchronously updated in the preset database, which corresponds to the actual file addition / deletion logic and is easy to maintain.

[0228] In other embodiments, the mobile phone identifies duplicate files and saves them after removing duplicates. Specifically, the duplicates can be removed when saving the attribute information of the file. At the same time, the second file management service module does not repeatedly display the attribute information of the file. In this way, the file attribute information saved in the preset database is not repeatedly displayed, which is convenient for viewing.

[0229] Please refer to Fig.12 , which shows the specific process executed by the mobile phone when the mobile phone detects a file addition event and a file deletion event in the file cache path in the file saving method.

[0230] Taking the addition of files as an example, this process can be specifically corresponded to Figure 6 or Figure 7 The process of receiving files in the ...

[0231] It can be seen from the description of the above embodiment that when the mobile phone adds a new file A1 with the same content as file A in the file cache path, it will rename file A and save it after adding a special suffix. After monitoring the event of adding a new file A1 with the same content, report the addition of file A1 to the first file management service module. The first file management service module notifies the second file management service module to store the file attributes. The second file management service module searches and determines that the attribute information of file A has been saved to the preset database based on the MD5 value of file A1, and then no longer saves the attribute information of file A1.

[0232] File deletion event: When a file deletion event is detected, the mobile phone can determine whether there is a special suffix for the file corresponding to the file deletion event. If so, it is necessary to remove the special suffix first and then report the deletion event of the original file name to the upper layer. The second file management service module can query whether the file is saved to the preset public path. If so, no processing will be performed; otherwise, the file attribute information will be deleted.

[0233] Please refer to Fig.13 , which shows the specific process executed by the mobile phone in the file saving method and when scanning the target path.

[0234] Among them, copying can specifically correspond to: Figure 6 The mobile phone shown responds to the trigger operation on the attribute information of the file, and the monitoring module copies the file from the file cache path. In response to the trigger operation on the attribute information of the file, the second file management service module sends a notification of the file copy event to the monitoring module. After receiving the notification, the monitoring module searches for the original file in the file cache path according to the name of file A. If the file with the file name A cannot be found in the file cache path, the save path of the real file is searched again according to the file name obtained by splicing the special suffix of file name A. If the save path of file A still cannot be found, a failure is returned to the second file management service module.

[0235] Among them, scanning can specifically correspond to Figure 6 or Figure 7 In the process of scanning the file cache path when the mobile phone detects the installation operation of the instant messaging application. When the monitoring module scans a file containing a special suffix, it needs to remove the special suffix and report the file name. The second file management service module queries whether the attribute information of the file has been saved to the database according to MD5. If so, it will not be saved again; if not, the attribute information of the file will be saved to the database.

[0236] In the technical solution provided in the embodiment of the present application, for duplicate files saved (i.e., newly added) in the file cache path of the mobile phone, the file attribute information can be saved after deduplication based on the MD5 value of the file to avoid collecting duplicate files. In this way, the file collection does not repeat the attribute information of the included files, which can avoid the problem of the mobile phone saving duplicate files with the same content in the preset public path, resulting in a waste of storage space. When it is necessary to copy the file and save it to the preset public path, the lower layer can obtain the file name of the original file after removing the special suffix according to the renaming rules for files with the same content, and then search for the storage path of the original file according to the file name of the original file. In this way, in the special case of the mobile phone saving duplicate files, the problem of being unable to find the location of the file due to the file name being renamed in the file cache path can be avoided.

[0237] Some other embodiments of the present application provide an electronic device (such as a mobile phone). The electronic device may include: a memory and one or more processors. The memory is coupled to the processor. The memory is also used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform the various functions or steps performed by the mobile phone in the above method embodiment. The structure of the electronic device can refer to Figure 3 The structure of the electronic device 100 is shown.

[0238] The present application also provides a chip system, such as Fig.14 As shown, the chip system 140 includes at least one processor 1401 and at least one interface circuit 1402. The processor 1401 and the interface circuit 1402 can be interconnected via lines. For example, the interface circuit 1402 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1402 can be used to send signals to other devices (such as the processor 1401). Exemplarily, the interface circuit 1402 can read instructions stored in the memory and send the instructions to the processor 1401. When the instruction is executed by the processor 1401, the electronic device can execute the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0239] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as a mobile phone), the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.

[0240] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment. The computer may be an electronic device, such as a mobile phone.

[0241] Through the description of the above implementation methods, technical personnel in the relevant field can clearly 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.

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

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

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

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

[0246] 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 changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A file storage method, characterized in that: The method is applied to an electronic device, wherein the electronic device includes an application having a file sending and receiving function; the method includes: Displaying a first interface of the application; In response to receiving a notification message, displaying a message prompt control of the notification message on the first interface; the notification message includes a target file, and the target file includes one or more of a document file, an image file, an audio file, or a video file; In response to a first trigger operation on the message prompt control, displaying a prompt window, the prompt window including a control for the target file, the control for the target file including a file name and / or an icon of the target file; In response to a second trigger operation of the control for the target file, the target file is saved to a preset public path.

2. The method according to claim 1, characterized in that: The method further comprises: In response to the first trigger operation, saving the target file to a file cache path corresponding to the application; The step of saving the target file to a preset public path in response to the second triggering operation of the control on the target file includes: In response to the second trigger operation, the target file stored in the file cache path corresponding to the application is copied to the preset public path.

3. The method according to claim 2, characterized in that The display prompt window includes: Monitor the file cache path corresponding to the application; In response to monitoring a file addition event in the file cache path corresponding to the application, acquiring attribute information of the newly added target file from the cache path corresponding to the application; the attribute information of the target file includes: at least one of the file name, file type, file size, file receiving time and file signature value of the target file; The prompt window is displayed according to the attribute information of the target file.

4. The method according to claim 2 or 3, characterized in that: The method further comprises: In response to monitoring that a file addition event exists in the file cache path corresponding to the application, the attribute information of the target file is saved in a preset database.

5. The method according to claim 4, characterized in that The method further comprises: In response to monitoring that there is a file deletion event in the file cache path corresponding to the application, querying whether the preset public path stores a file corresponding to the file deletion event; If the preset public path does not store the file corresponding to the file deletion event, the attribute information of the file corresponding to the file deletion event in the preset database is deleted.

6. The method according to claim 4 or 5, characterized in that: The method further comprises: In response to monitoring that there is a file renaming event in the file cache path corresponding to the application, modifying the attribute information of the file corresponding to the file renaming event saved in the preset database, and querying whether the preset public path stores the file corresponding to the file renaming event; If the preset public path stores a file corresponding to the file renaming event, the file corresponding to the file renaming event stored in the preset public path is renamed.

7. The method according to any one of claims 2 to 6, characterized in that: The method further comprises: In response to monitoring a file content modification event in the cache path corresponding to the application, querying whether the preset public path stores a file corresponding to the file content modification event; If the preset public path stores a file corresponding to the file content modification event, the content of the file corresponding to the file renaming event is modified based on the file content modification event.

8. The method according to any one of claims 4 to 7, characterized in that: In response to monitoring that a file addition event exists in the file cache path corresponding to the application, before saving the attribute information of the target file to a preset database, the method further includes: According to the file signature value of the target file, it is determined that the attribute information of the target file is not saved in the preset database.

9. The method according to any one of claims 2 to 7, characterized in that: The method further comprises: In response to detecting the installation operation of the application, if the application has logged into a user account, scanning a file cache path corresponding to the application; When it is scanned that the file cache path corresponding to the application has stored a historical file, the attribute information of the historical file is obtained, and the attribute information of the historical file is saved in the preset database.

10. The method according to any one of claims 2 to 9, characterized in that: The method further comprises: Obtaining the original path and sub-path rules corresponding to the application; A file cache path corresponding to the application is determined according to the original path and the sub-path rule.

11. The method according to claim 10, characterized in that The determining, according to the original path and the sub-path rule, a file cache path corresponding to the application includes: When a first target sub-path that uniquely satisfies the sub-path rule is found in the original path, the first target sub-path is used as a file cache path corresponding to the application; When two or more second target sub-paths satisfying the sub-path rule are found in the original path, one of the two or more second target sub-paths with the latest update time is used as the file cache path corresponding to the application; When a sub-path satisfying the sub-path rule is not found in the original path, the target path is monitored until a third target sub-path that uniquely satisfies the sub-path rule is found in the target path, and the third target sub-path is determined as the file cache path corresponding to the application; wherein, when the original path is a root path, the target path is the original path; when the original path is not a root path, the target path is an upper-level path of the original path.

12. The method according to claim 10 or 11, characterized in that: The method further comprises: Monitoring the original path corresponding to the application; In response to monitoring a directory creation event in the original path corresponding to the application, a file cache path corresponding to the application is re-determined according to the original path and the sub-path rule.

13. The method according to any one of claims 2 to 12, characterized in that: The file cache path corresponding to the application does not allow any application other than the application to access it; In response to the second trigger operation, copying the target file stored in the file cache path corresponding to the application to the preset public path includes: In response to the second trigger operation, the target file stored in the file cache path corresponding to the application is copied to the preset public path through a preset process of the electronic device; wherein the preset process has the administrator root authority of the electronic device.

14. The method according to any one of claims 2 to 13, characterized in that In response to the second trigger operation, copying the target file stored in the file cache path corresponding to the application to the preset public path includes: In response to the second trigger operation, when the target file cannot be found in the file cache path corresponding to the application according to the file name of the target file, obtaining a file signature value of the target file; Finding the storage location of the target file in the file cache path according to the file signature value of the target file; The target file is obtained from a storage location in a file cache path corresponding to the application.

15. A file viewing method, characterized in that: The method is applied to an electronic device, the electronic device comprising a first application having a file sending and receiving function, and a second application having a file viewing function; the method comprises: Displaying a first interface of the first application; In response to receiving a notification message, displaying a message prompt control of the notification message on the first interface; the notification message includes a target file, and the target file includes one or more of a document file, an image file, an audio file, or a video file; In response to a first trigger operation on the message prompt control, the target file is displayed, and a prompt window is displayed; the prompt window includes a control for the target file, and the control for the target file includes a file name and / or an icon of the target file; In response to a second trigger operation on the control of the target file, a second interface of the second application is displayed, and the target file is displayed on the second interface.

16. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a display screen; the memory and the display screen are respectively coupled to the processor; The display screen is used to display the interface of the electronic device; the memory stores computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-15.

17. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 15.