Data recovery method and device
By storing an additional copy of chat data in the chat application and recovering data from the storage when the data is deleted or withdrawn, the problem of lack of chat data recovery methods in the existing technology is solved, and the recovery of chat data is achieved, and behaviors such as investigation and evidence collection and review and supervision are supported.
Patent Information
- Application Number
- CN202410024003.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-01-05
AI Technical Summary
There is a lack of methods for recovering withdrawn or deleted chat messages in the prior art, which has affected investigation, evidence collection, review and supervision and other behaviors.
After the chat application receives the chat data, a copy of the chat data is acquired and stored in a first storage space different from the chat application storage space, when the chat data is detected to be deleted or withdrawn, the chat data to be recovered is read and restored from the first storage space.
It realizes the recovery of deleted or withdrawn chat data, ensuring that chat data is stored in other storage spaces in the chat application, thereby supporting investigation, evidence collection, review and supervision.
Smart Images

Figure CN117851128B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information processing technology, and in particular, relates to a data recovery method and device. Background Art
[0002] When a user chats on a chat application (such as WhatsApp), he can withdraw or delete the sent messages. In some scenarios, such as investigation and evidence collection, review and supervision, it may be necessary to obtain the user's chat history. When the user withdraws or deletes the message, it will affect the investigation and evidence collection, review and supervision. That is, in the related art, there is a lack of methods for recovering withdrawn or deleted messages. Summary of the invention
[0003] The embodiments of the present application provide a data recovery method and device, which can solve the problem that there is a lack of a method for recovering withdrawn or deleted messages in the related art.
[0004] In a first aspect, an embodiment of the present application provides a method for recovering data, including:
[0005] When the chat application receives the chat data, it obtains the chat data and stores the chat data in a first storage space, where the first storage space is different from a second storage space used by the chat application;
[0006] When it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space;
[0007] Restore the chat data to be restored.
[0008] The beneficial effect of the embodiment of the present application compared with the prior art is: after the chat application receives the chat data, the embodiment of the present application obtains the chat data and stores the chat data in the first storage space. When it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, and the chat data to be restored is restored. The embodiment of the present application obtains an additional copy of the chat data received by the chat application and stores it in the first storage space, so that there are other storage spaces storing chat data in addition to the second storage space where the chat application is located. When the chat data in the second storage space is deleted or withdrawn, the embodiment of the present application can read the chat data to be restored from the first storage space, that is, read the chat data deleted or withdrawn in the second storage space from the first storage space, and restore the chat data to be restored, thereby realizing the recovery of the deleted or withdrawn chat data.
[0009] In a second aspect, an embodiment of the present application provides a data recovery device, including:
[0010] An acquisition module, configured to acquire the chat data after the chat application receives the chat data, and store the chat data in a first storage space, where the first storage space is different from a second storage space used by the chat application;
[0011] A reading module, configured to read the chat data to be restored from the chat data in the first storage space when it is detected that the chat data in the second storage space is deleted or withdrawn, wherein the chat data to be restored corresponds to the chat data deleted or withdrawn in the second storage space;
[0012] The recovery module is used to recover the chat data to be recovered.
[0013] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the data recovery method described in the first aspect when executing the computer program.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data recovery method described in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the data recovery method described in the first aspect above.
[0016] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 It is a schematic diagram of an implementation flow of a data recovery method provided in an embodiment of the present application;
[0019] Figure 2 This is a schematic diagram of the implementation process of obtaining text data provided by an embodiment of the present application;
[0020] Figure 3This is a schematic diagram of an implementation process of reading chat data to be restored provided in an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of the implementation process of obtaining the withdrawn text data ID provided in the embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the implementation process of obtaining the second parameter and the third parameter provided in an embodiment of the present application;
[0023] Figure 6 This is a schematic diagram of the implementation process of obtaining file data provided by an embodiment of the present application;
[0024] Figure 7 This is another implementation flow diagram of reading chat data to be restored provided in an embodiment of the present application;
[0025] Figure 8 This is a schematic diagram of the implementation process of obtaining newly added file data provided in an embodiment of the present application;
[0026] Fig. 9 This is a schematic diagram of a structure for keeping a process alive provided in an embodiment of the present application;
[0027] Fig.10 It is a structural schematic diagram of a data recovery device provided in an embodiment of the present application;
[0028] Fig.11 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are protected by the present application.
[0030] It should be noted that the terms "include", "comprises" and "have" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, terminal, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. In the claims, specification and drawings of the present application, relational terms such as "first" and "second" are merely used to distinguish one entity / operation / object from another entity / operation / object, and do not necessarily require or imply any such real-time relationship or order between these entities / operations / objects.
[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] When a user chats on a chat application (such as WhatsApp), he can withdraw or delete the sent messages. In some scenarios, such as investigation and evidence collection, review and supervision, it may be necessary to obtain the user's chat history. When the user withdraws or deletes the message, it will affect the investigation and evidence collection, review and supervision. That is, in the related art, there is a lack of methods for recovering withdrawn or deleted messages.
[0033] In view of this, the embodiment of the present application obtains an additional copy of the chat data received by the chat application and stores it in the first storage space, so that in addition to the second storage space where the chat application is located, there are other storage spaces storing chat data. When the chat data in the second storage space is deleted or withdrawn, the embodiment of the present application can read the chat data to be restored from the first storage space, that is, read the chat data deleted or withdrawn in the second storage space from the first storage space, and restore the chat data to be restored, thereby realizing the recovery of the deleted or withdrawn chat data.
[0034] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.
[0035] Figure 1The present invention provides a data recovery method according to an embodiment of the present invention, which can be applied to a terminal device, such as a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, etc.
[0036] Specifically, the above data recovery method may include the following steps S101 to S106.
[0037] Step S101: After receiving chat data, the chat application obtains the chat data and stores the chat data in a first storage space.
[0038] Among them, the first storage space is different from the second storage space used by the chat application. It should be understood that the first storage space and the second storage space can both be storage spaces inside the terminal device. The relevant data in the chat application is usually stored in the folder where the chat application is located, that is, stored in the second storage space. The first storage space is a storage space different from the second storage space, for example, it can be another folder. Chat data is the data generated by the user communicating with the chat object when using the chat application, and can include text data and file data, etc.
[0039] In the implementation of the present application, when the chat application receives the chat data, the terminal device can obtain the chat data and store the chat data in the first storage space. It is understandable that for different types of chat data, such as text data and file data, different methods can be used to obtain the chat data.
[0040] Step S102: when it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space.
[0041] The chat data to be restored corresponds to the chat data deleted or withdrawn in the second storage space.
[0042] In the implementation of the present application, the terminal device can detect the chat data in the second storage space, and when it is detected that the chat data in the second storage space is deleted or withdrawn, the terminal device can read the chat data to be restored from the chat data in the first storage space. It is also understandable that for different types of chat data, such as text data and file data, different methods can be used to read the chat data to be restored from the first storage space.
[0043] Step S103, restoring the chat data to be restored.
[0044] In an implementation manner of the present application, after reading the chat data to be restored from the chat data in the first storage space, the terminal device can restore the text data to be restored and display the text data to be restored.
[0045] It is understandable that in some implementations of the present application, the terminal device can convert the text data to be restored into a file, and upload the file to the server and / or notify the user.
[0046] The beneficial effect of the embodiment of the present application compared with the prior art is: after the chat application receives the chat data, the embodiment of the present application obtains the chat data and stores the chat data in the first storage space. When it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, and the chat data to be restored is restored. The embodiment of the present application obtains an additional copy of the chat data received by the chat application and stores it in the first storage space, so that there are other storage spaces storing chat data in addition to the second storage space where the chat application is located. When the chat data in the second storage space is deleted or withdrawn, the embodiment of the present application can read the chat data to be restored from the first storage space, that is, read the chat data deleted or withdrawn in the second storage space from the first storage space, and restore the chat data to be restored, thereby realizing the recovery of the deleted or withdrawn chat data.
[0047] like Figure 2 As shown, in some embodiments of the present application, the chat data includes text data. When the chat application receives the chat data, it obtains the chat data and stores the chat data in the first storage space, which may specifically include steps S201 to S203.
[0048] Step S201, when the chat application receives the text data, the first parameter is obtained through the notification bar.
[0049] The first parameter is converted from text data and a corresponding text data ID, and is sent to the notification bar by the chat application. The text data is text data. The text data ID is used to represent each piece of text data. It should be understood that after receiving the text data, the chat application can assign a corresponding text data ID to each piece of text data.
[0050] In an embodiment of the present application, when a chat application (such as WhatsApp) receives text data, the chat application can convert the received text data into a parameter that the notification bar can understand, that is, a first parameter, and send the first parameter to the notification bar of the terminal device through the application notification API. After the notification bar receives the first parameter, the first parameter can be forwarded to the terminal device, and the terminal device can receive the first parameter.
[0051] Step S202, parsing the first parameter to obtain text data and corresponding text data ID.
[0052] In the implementation of the present application, after obtaining the first parameter, the terminal device can parse the first parameter to obtain text data and a corresponding text data ID. Specifically, the terminal device can parse Notification.EXTRA_TEXT (Notification.EXTRA_TEXT is the first parameter, which is a constant of Notification in Android and is used to represent the text content of the notification) to obtain text data and a corresponding text data ID.
[0053] Step S203: storing the text data and the corresponding text data ID into the first storage space.
[0054] The first storage space is different from the second storage space used by the chat application. It should be understood that both the first storage space and the second storage space can be storage spaces inside the terminal device. The relevant data in the chat application is usually stored in the folder where the chat application is located, that is, stored in the second storage space. The first storage space is a storage space different from the second storage space, for example, it can be other folders.
[0055] In the implementation manner of the present application, the terminal device can store the text data and the corresponding text data ID in the first storage space, that is, the first storage space can store the text data in the second storage space.
[0056] like Figure 3 As shown, in some specific embodiments of the present application, when it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, which may specifically include steps S301 to S303.
[0057] Step S301, when it is detected that any text data in the second storage space is deleted or withdrawn, the withdrawn text data ID of the withdrawn text data is obtained through the notification bar.
[0058] The withdrawn text data is text data withdrawn by the chat partner, and the withdrawn text data ID is the text data ID of the withdrawn text data.
[0059] In an implementation manner of the present application, when any text data is withdrawn, the chat application may send a message withdrawal notification and the text data ID of the withdrawn text data, that is, the withdrawn text data ID, to the notification bar. After the notification bar receives the withdrawn text data ID, it may forward the withdrawn text data ID to the terminal device. The terminal device may detect whether any text data in the second storage space has been deleted or withdrawn by detecting whether the withdrawn text data ID has been received. When the terminal device detects that any text data in the second storage space has been deleted or withdrawn, the terminal device may receive the withdrawn text data ID of the withdrawn text data.
[0060] Step S302, searching the first storage space for the text data ID to be restored that is consistent with the withdrawn text data ID.
[0061] In the implementation manner of the present application, after obtaining the withdrawn text data ID, the terminal device can search the first storage space for a text data ID that is consistent with the withdrawn text data ID, that is, the text data ID to be restored.
[0062] Step S303, reading the text data to be restored corresponding to the text data ID to be restored from the first storage space.
[0063] In the implementation manner of the present application, after the ID of the text data to be restored is determined, the terminal device can read the text data to be restored corresponding to the ID of the text data to be restored from the first storage space through the ID of the text data to be restored.
[0064] After the chat application receives the text data, the implementation mode of the present application obtains the first parameter through the notification bar, and parses the first parameter to obtain the text data and the corresponding text data ID, and then stores the text data and the corresponding text data ID in the first storage space. When any text data is withdrawn, the withdrawn text data ID of the withdrawn text data is obtained through the notification bar, and the text data ID to be restored that is consistent with the withdrawn text data ID is searched in the first storage space, and then the text data to be restored corresponding to the text data ID to be restored is read from the first storage space. The implementation mode of the present application obtains the text data received by the chat application through the notification bar, and stores these text data in the first storage space. When the text data in the chat application is withdrawn, the corresponding text data in the first storage space can be obtained and restored. Thus, the recovery of the withdrawn text data is achieved.
[0065] like Figure 4 As shown, in some specific implementations of the present application, the above-mentioned obtaining the withdrawn text data ID of the withdrawn text data through the notification bar may specifically include step S401 and step S402.
[0066] Step S401, start the notification bar service.
[0067] In the implementation manner of the present application, the specific implementation process can refer to the above-mentioned step S201, which will not be repeated here.
[0068] Step S402, when the notification bar receives the withdrawal text data ID sent by the chat application, the withdrawal text data ID forwarded by the notification bar is obtained.
[0069] In the implementation mode of the present application, when the chat partner withdraws the text message, the chat application can send the text data of the withdrawn text data (that is, the withdrawn text data ID) to the notification bar. After the notification bar receives the withdrawn text data ID, it can forward the withdrawn text data ID to the terminal device. At this time, the terminal device can receive the withdrawn text data ID.
[0070] In some specific implementations of the present application, the obtaining of the first parameter through the notification bar may specifically include the following steps:
[0071] Enable the notification bar service;
[0072] After the notification bar receives the first parameter sent by the chat application, the first parameter forwarded by the notification bar is obtained.
[0073] In the implementation of the present application, the terminal device can enable the NotificationListenerService notification bar service. Among them, the NotificationListenerService notification bar service is a system-level service that enables third-party applications to monitor changes in the notification bar and respond accordingly. When the application initiates a notification, the system will call back the notified application, action, and information to NotificationListenerService1. When the notification bar receives the first parameter sent by the chat application, the notification bar can forward the received first parameter to the terminal device, so that the terminal device can obtain the first parameter.
[0074] When restoring a text message withdrawn by a chat partner, in addition to restoring the content of the text message, it is also necessary to restore the name and avatar of the chat partner so as to have a comprehensive understanding of the withdrawn text message.
[0075] In view of this, if Figure 5 As shown, in some implementations of the present application, the above method may further include steps S501 to S504.
[0076] Step S501, after receiving the text data, the chat application obtains the second parameter and the third parameter through the notification bar.
[0077] The second parameter is converted from the sender corresponding to the text data, and the sender is the name of the chat partner. The third parameter is converted from the sender's avatar corresponding to the text data, and the sender's avatar is the avatar of the chat partner. Both the second and third parameters are sent to the notification bar by the chat application.
[0078] In the implementation mode of the present application, after the chat application receives the text data, the chat application may also convert the sender and the sender's avatar corresponding to the text data into the second parameter and the third parameter, respectively, and send the second parameter and the third parameter to the notification bar. The notification bar may forward the second parameter and the third parameter to the terminal device. At this time, the terminal device may obtain the second parameter and the third parameter.
[0079] Step S502, parse the second parameter to obtain the sender.
[0080] In the implementation of the present application, after obtaining the second parameter, the terminal device can parse the second parameter to obtain the sender. Specifically, the terminal device can parse Notification.EXTRA_TITLE (Notification.EXTRA_TITLE is the second parameter, which is a constant of Notification in Android, used to indicate the title of the notification) to obtain the sender corresponding to the text data.
[0081] Step S503: parse the third parameter to obtain the sender's portrait.
[0082] In an implementation manner of the present application, after obtaining the third parameter, the terminal device can parse the third parameter to obtain the sender's avatar. Specifically, the terminal device can parse largeIcon to obtain the sender's avatar corresponding to the text data. It should be understood that largeIcon is the third parameter, which is a way to display important information to users in the Android system. Each notification can contain a small icon and a large icon for display in the notification bar. The largeIcon attribute is used to set the large icon of the notification, which is usually used to display larger images or application icons. Here it can be understood as the sender's avatar in the chat application.
[0083] Step S504: store the sender and the sender's portrait in the first storage space.
[0084] In an implementation manner of the present application, after obtaining the sender and sender's avatar corresponding to the text data, the terminal device can associate the text data, the corresponding text data ID, the sender and the sender's avatar, and store them together in the first storage space.
[0085] In some specific implementations of the present application, the above-mentioned reading of the text data to be restored corresponding to the text data ID to be restored from the first storage space and restoring the text data to be restored may specifically include the following steps:
[0086] Reading the text data to be restored, the sender and the sender's head portrait corresponding to the text data ID to be restored from the first storage space;
[0087] Recover the text data, sender and sender's portrait to be recovered.
[0088] In the implementation mode of the present application, after determining the ID of the text data to be restored, the terminal device can read the text data to be restored, the sender, and the sender's head portrait corresponding to the text data to be restored ID from the first storage space through the text data to be restored ID. The terminal device can restore the text data to be restored, the sender, and the sender's head portrait, and display the text data to be restored, the sender, and the sender's head portrait.
[0089] like Figure 6 As shown, in some embodiments of the present application, the chat data includes file data. When the chat application receives the chat data, it obtains the chat data and stores the chat data in the first storage space, which may specifically include steps S601 to S604.
[0090] Step S601, start the file monitoring service.
[0091] The file monitoring service is a listener for monitoring file access, creation, modification, deletion, and movement operations, and can be specifically a FileObserver file monitoring service. Each FileObserver object monitors a single file or folder. If a folder is monitored, changes to all files and cascaded subdirectories under the folder will trigger the monitored event.
[0092] In an implementation manner of the present application, the terminal device may enable a file monitoring service to monitor the folder (ie, the second storage space) where the chat application stores chat data.
[0093] Step S602: When the chat application receives the file data and the file monitoring service monitors that a new file event has occurred in the second storage space used by the chat application, a first monitoring parameter generated by the file monitoring service based on the new file event is obtained.
[0094] In an implementation of the present application, after the chat application receives the file data, and the file monitoring service monitors that a new file event has occurred in the second storage space, the file monitoring service can generate a corresponding first monitoring parameter according to the new file event, and send the first monitoring parameter to the terminal device. At this time, the terminal device can receive the first monitoring parameter.
[0095] Step S603: Acquire the newly added file data corresponding to the newly added file event according to the first monitoring parameter.
[0096] The file data is non-text data, such as images, documents, compressed packages, etc. The first storage space is different from the second storage space. The newly added file data is the file data newly added in the second storage space.
[0097] In an implementation manner of the present application, the terminal device may parse the first monitoring parameter to obtain corresponding newly added file data.
[0098] Step S604: storing the newly added file data in the first storage space.
[0099] In the implementation manner of the present application, after obtaining the corresponding newly added file data, the terminal device can store the newly added file data corresponding to the newly added file event in the first storage space. That is, the first storage space can store the file data in the second storage space.
[0100] like Figure 7 As shown, in some specific embodiments of the present application, when it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, which may specifically include step S701 and step S702.
[0101] Step S701: When the file monitoring service detects that a file deletion event occurs in the second storage space, a second monitoring parameter generated by the file monitoring service based on the file deletion event is obtained.
[0102] The file deletion event corresponds to the chat data being deleted or withdrawn, that is, when the chat data in the second storage space is deleted or withdrawn, it can be regarded as a file deletion event occurring in the second storage space.
[0103] In the implementation of the present application, when the chat partner or the user withdraws or deletes the file data in the chat application, the file monitoring service can monitor that a file deletion event has occurred in the second storage space. At this time, the file monitoring service can generate a corresponding second monitoring parameter according to the file deletion event, and send the second monitoring parameter to the terminal device. At this time, the terminal device can receive the second monitoring parameter.
[0104] Step S702: Read the to-be-recovered file data corresponding to the second monitoring parameter from the first storage space according to the second monitoring parameter.
[0105] In an implementation manner of the present application, the terminal device may parse the second monitoring parameter to determine the deleted file data, and read the file data corresponding to the second monitoring parameter (ie, the file data to be restored) from the first storage space based on the deleted file data.
[0106] The embodiment of the present application starts the file monitoring service. When the file monitoring service monitors that a new file event has occurred in the second storage space used by the chat application, the first monitoring parameter generated by the file monitoring service based on the new file event is obtained, and according to the first monitoring parameter, the new file data corresponding to the new file event is stored in the first storage space. When the file monitoring service monitors that a file deletion event has occurred in the second storage space, the second monitoring parameter generated by the file monitoring service based on the file deletion event is obtained, and according to the second monitoring parameter, the file data to be restored corresponding to the second monitoring parameter is read from the first storage space. The implementation method of the present application monitors the second storage space used by the chat application through the file monitoring service. When the second storage space has new file data, the new file data is stored in the first storage space. When the second storage space deletes the file data, the deleted file data can be read from the first storage space and restored. Thus, the recovery of the withdrawn or deleted file data is achieved.
[0107] like Figure 8 As shown, in some specific implementations of the present application, the above-mentioned obtaining the newly added file data corresponding to the newly added file event according to the first monitoring parameter may specifically include step S801 and step S802.
[0108] Step S801: parse the first monitoring parameter to obtain the file path and file name of the newly added file data.
[0109] Step S802: copy the newly added file data from the second storage space according to the file path and the file name to obtain the copied newly added file data.
[0110] In the implementation mode of the present application, after obtaining the first monitoring parameter, the terminal device can parse the first monitoring parameter to obtain the file path and file name of the newly added file data. Then, according to the file path and file name, the newly added file data is found in the second storage space, the newly added file data is copied, and the copied newly added file data is stored in the first storage space.
[0111] In some specific implementations of the present application, the above-mentioned reading the to-be-recovered file data corresponding to the second monitoring parameter from the first storage space according to the second monitoring parameter may specifically include the following steps:
[0112] Parse the second monitoring parameter to obtain the file path and file name of the file data to be restored;
[0113] According to the file path and file name of the file data to be restored, the corresponding file data to be restored is read from the first storage space.
[0114] like Fig. 9 As shown, in some implementations of the present application, the above method may further include step S901 and step S902.
[0115] Step S901, start the process keep-alive service.
[0116] The process keep-alive service is used to keep alive the process that executes the above data recovery method.
[0117] Specifically, the process keep-alive service may be an AccessibilityService auxiliary function service.
[0118] Step S902: Use the process keepalive service to keep the process alive.
[0119] In the implementation manner of the present application, the terminal device can use the process keep alive service to keep alive the process that executes the above-mentioned data recovery method. Specifically, the terminal device can run the AccessibilityService auxiliary function service in the background and receive callbacks for specified events through AccessibilityEvent. Events are issued when the view changes, and responses can also be made when view operation requests are received. When the process that executes the above-mentioned data recovery method is killed, the AccessibilityService auxiliary function service can still simulate user operations to start the process.
[0120] Fig.10 A schematic diagram of the structure of a data recovery device provided in an embodiment of the present application is shown. The data recovery device 10 may be configured on a terminal device. Specifically, the data recovery device 10 may include:
[0121] An acquisition module 1001 is used for acquiring the chat data after the chat application receives the chat data, and storing the chat data in a first storage space, where the first storage space is different from a second storage space used by the chat application;
[0122] The reading module 1002 is used to read the chat data to be restored from the chat data in the first storage space when it is detected that the chat data in the second storage space is deleted or withdrawn, where the chat data to be restored corresponds to the chat data deleted or withdrawn in the second storage space;
[0123] The recovery module 1003 is used to recover the chat data to be recovered.
[0124] The beneficial effect of the embodiment of the present application compared with the prior art is: after the chat application receives the chat data, the embodiment of the present application obtains the chat data and stores the chat data in the first storage space. When it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, and the chat data to be restored is restored. The embodiment of the present application obtains an additional copy of the chat data received by the chat application and stores it in the first storage space, so that there are other storage spaces storing chat data in addition to the second storage space where the chat application is located. When the chat data in the second storage space is deleted or withdrawn, the embodiment of the present application can read the chat data to be restored from the first storage space, that is, read the chat data deleted or withdrawn in the second storage space from the first storage space, and restore the chat data to be restored, thereby realizing the recovery of the deleted or withdrawn chat data.
[0125] In some embodiments of the present application, the chat data includes text data, and the above-mentioned acquisition module 1001 can also be used for: when the chat application receives the text data, obtaining a first parameter through the notification bar, the first parameter is converted from the text data and the corresponding text data ID, and sent by the chat application to the notification bar; parsing the first parameter to obtain the text data and the corresponding text data ID; storing the text data and the corresponding text data ID in the first storage space.
[0126] In some embodiments of the present application, the above-mentioned reading module 1002 can also be used for: when it is detected that any of the text data in the second storage space is deleted or withdrawn, obtaining the withdrawn text data ID of the withdrawn text data through the notification bar; searching for the text data ID to be restored that is consistent with the withdrawn text data ID in the first storage space; and reading the text data to be restored corresponding to the text data ID to be restored from the first storage space.
[0127] In some embodiments of the present application, the reading module 1002 may also be used to: enable a notification bar service; and when the notification bar receives the withdrawal text data ID sent by the chat application, obtain the withdrawal text data ID forwarded by the notification bar.
[0128] In some embodiments of the present application, the data recovery device 9 may further include a parsing module, which is used to: when the chat application receives text data, obtain a second parameter and a third parameter through the notification bar, the second parameter is converted from the sender corresponding to the text data, and the third parameter is converted from the sender's avatar corresponding to the text data, and the second parameter and the third parameter are both sent by the chat application to the notification bar; parse the second parameter to obtain the sender; parse the third parameter to obtain the sender's avatar; store the sender and the sender's avatar in the first storage space.
[0129] In some embodiments of the present application, the chat data includes file data, and the above-mentioned acquisition module 1001 can also be used to: start a file monitoring service; when the chat application receives the file data, and the file monitoring service monitors that a new file event has occurred in the second storage space used by the chat application, obtain the first monitoring parameter generated by the file monitoring service based on the new file event; according to the first monitoring parameter, obtain the new file data corresponding to the new file event, and the new file data is non-text data; store the new file data in the first storage space.
[0130] In some embodiments of the present application, the above-mentioned reading module 1002 can also be used for: when the file monitoring service detects that a file deletion event has occurred in the second storage space, obtaining a second monitoring parameter generated by the file monitoring service based on the file deletion event, and the file deletion event corresponds to the chat data being deleted or withdrawn; according to the second monitoring parameter, reading the file data to be recovered corresponding to the second monitoring parameter from the first storage space.
[0131] In some embodiments of the present application, the above-mentioned acquisition module 1001 can also be used to: parse the first monitoring parameter to obtain the file path and file name of the newly added file data; according to the file path and the file name, copy the newly added file data from the second storage space to obtain the copied newly added file data.
[0132] In some implementations of the present application, the data recovery device 10 may further include a keep-alive module, which is used to: start a process keep-alive service; and use the process keep-alive service to keep the process alive.
[0133] like Fig.111 is a schematic diagram of a terminal device provided in an embodiment of the present application. The terminal device 11 may include: a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and executable on the processor 1101, such as a data recovery program. When the processor 1101 executes the computer program 1103, the steps in the above data recovery method embodiment are implemented, such as Figure 1 Alternatively, when the processor 1101 executes the computer program 1103, the functions of each module / unit in the above-mentioned device embodiment are realized, for example Fig.10 The acquisition module 1001, the reading module 1002, and the recovery module 1003 are shown.
[0134] The computer program may be divided into one or more modules / units, which are stored in the memory 1102 and executed by the processor 1101 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the terminal device.
[0135] The terminal device may include, but is not limited to, a processor 1101 and a memory 1102. Those skilled in the art will appreciate that Fig.11 It is only an example of a terminal device and does not constitute a limitation of the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access equipment, buses, etc.
[0136] The processor 1101 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0137] The memory 1102 may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. The memory 1102 may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device. Further, the memory 1102 may also include both an internal storage unit of the terminal device and an external storage device. The memory 1102 is used to store the computer program and other programs and data required by the terminal device. The memory 1102 may also be used to temporarily store data that has been output or is to be output.
[0138] It should be noted that, for the convenience and brevity of description, the structure of the above-mentioned terminal device can also refer to the specific description of the structure in the method embodiment, which will not be repeated here.
[0139] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0140] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned data recovery method can be implemented.
[0141] An embodiment of the present application provides a computer program product. When the computer program product is run on a mobile terminal, the steps in the above-mentioned data recovery method can be implemented when the mobile terminal executes the computer program product.
[0142] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0143] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0144] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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.
[0145] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] 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.
[0147] If the integrated module / 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 computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0148] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data recovery method, characterized in that: include: When the chat application receives the chat data, the chat application obtains the chat data and stores the chat data in a first storage space, where the first storage space is different from a second storage space used by the chat application; When it is detected that the chat data in the second storage space is deleted or withdrawn, the chat data to be restored is read from the chat data in the first storage space, and the chat data to be restored corresponds to the chat data deleted or withdrawn in the second storage space; Restoring the chat data to be restored; The chat data includes text data, and when the chat application receives the chat data, obtaining the chat data and storing the chat data in the first storage space includes: When the chat application receives the text data, it obtains a first parameter through the notification bar, where the first parameter is converted from the text data and the corresponding text data ID and is sent by the chat application to the notification bar; Parsing the first parameter to obtain the text data and the corresponding text data ID; Storing the text data and the corresponding text data ID in a first storage space; The chat data includes file data, and when the chat application receives the chat data, acquiring the chat data and storing the chat data in the first storage space includes: Enable file monitoring service; When the chat application receives the file data, and the file monitoring service monitors that a new file event occurs in the second storage space used by the chat application, obtaining a first monitoring parameter generated by the file monitoring service based on the new file event; According to the first monitoring parameter, acquiring the newly added file data corresponding to the newly added file event, wherein the newly added file data is non-text data; Storing the newly added file data in the first storage space; Wherein, when it is detected that the chat data in the second storage space is deleted or withdrawn, reading the chat data to be restored from the chat data in the first storage space includes: When the file monitoring service detects that a file deletion event occurs in the second storage space, obtaining a second monitoring parameter generated by the file monitoring service based on the file deletion event, wherein the file deletion event corresponds to the chat data being deleted or withdrawn; The to-be-restored file data corresponding to the second monitoring parameter is read from the first storage space according to the second monitoring parameter.
2. The data recovery method according to claim 1, characterized in that: When it is detected that the chat data in the second storage space is deleted or withdrawn, reading the chat data to be restored from the chat data in the first storage space includes: When it is detected that any of the text data in the second storage space is deleted or withdrawn, obtaining the withdrawn text data ID of the withdrawn text data through the notification bar; Searching the first storage space for the text data ID to be restored that is consistent with the withdrawn text data ID; The text data to be restored corresponding to the text data ID to be restored is read from the first storage space.
3. The data recovery method according to claim 2, characterized in that: The step of obtaining the withdrawn text data ID of the withdrawn text data through the notification bar includes: Enable the notification bar service; When the notification bar receives the withdrawal text data ID sent by the chat application, the withdrawal text data ID forwarded by the notification bar is obtained.
4. The data recovery method according to claim 1, characterized in that: The method further comprises: When the chat application receives the text data, the second parameter and the third parameter are obtained through the notification bar, wherein the second parameter is converted from the sender corresponding to the text data, and the third parameter is converted from the sender's avatar corresponding to the text data, and both the second parameter and the third parameter are sent to the notification bar by the chat application; Parsing the second parameter to obtain the sender; Parsing the third parameter to obtain the sender's portrait; The sender and the sender's portrait are stored in the first storage space.
5. The data recovery method according to claim 3, characterized in that: The acquiring, according to the first monitoring parameter, the newly added file data corresponding to the newly added file event includes: Parsing the first monitoring parameter to obtain the file path and file name of the newly added file data; According to the file path and the file name, the newly added file data is copied from the second storage space to obtain the copied newly added file data.
6. The data recovery method according to any one of claims 1 to 5, characterized in that: The method further comprises: Enable the process keep-alive service; The process keep alive service is used to keep the process alive.
7. A data recovery device, characterized in that: include: An acquisition module, configured to acquire the chat data after the chat application receives the chat data, and store the chat data in a first storage space, where the first storage space is different from a second storage space used by the chat application; a reading module, configured to read the chat data to be restored from the chat data in the first storage space when it is detected that the chat data in the second storage space is deleted or withdrawn, wherein the chat data to be restored corresponds to the chat data deleted or withdrawn in the second storage space; A recovery module, used for recovering the chat data to be recovered; Wherein, the chat data includes text data, and the acquisition module is further used for: When the chat application receives the text data, it obtains a first parameter through the notification bar, where the first parameter is converted from the text data and the corresponding text data ID and is sent by the chat application to the notification bar; Parsing the first parameter to obtain the text data and the corresponding text data ID; Storing the text data and the corresponding text data ID in a first storage space; The acquisition module can also be used for: Enable file monitoring service; When the chat application receives the file data, and the file monitoring service monitors that a new file event occurs in the second storage space used by the chat application, obtaining a first monitoring parameter generated by the file monitoring service based on the new file event; According to the first monitoring parameter, acquiring the newly added file data corresponding to the newly added file event, wherein the newly added file data is non-text data; Storing the newly added file data in the first storage space; The reading module can also be used for: When the file monitoring service detects that a file deletion event occurs in the second storage space, obtaining a second monitoring parameter generated by the file monitoring service based on the file deletion event, wherein the file deletion event corresponds to the chat data being deleted or withdrawn; The to-be-restored file data corresponding to the second monitoring parameter is read from the first storage space according to the second monitoring parameter.
Citation Information
Patent Citations
Message processing method and electronic equipment
CN113179207A
Data backup method and device, equipment and storage medium
CN116932286A