Method and device for migrating Android applications
By exporting and restoring the Ashmem resource information and Binder resource information of Android applications, the problem that existing tools cannot realize Android application migration is solved, and the complete migration and recovery of Android applications is achieved.
Patent Information
- Application Number
- CN202010569613.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-06-20
AI Technical Summary
Existing application migration tools cannot export and restore the Ashmem resource information and Binder resource information of Android applications, resulting in the inability to migrate Android applications.
By calling the Ashmem kernel driver and Binder kernel driver, export and restore the Ashmem resource information and Binder resource information of Android applications, and integrate this information into the resource information collection to achieve a complete migration of Android applications.
It realizes the export and recovery of the basic resources, Ashmem resources and Binder resources of Android applications, ensuring the smooth migration of Android applications between cloud computing nodes.
Smart Images

Figure CN113821333B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method and device for migrating Android applications. Background Art
[0002] With the continuous development of network technology, cloud phones have also begun to enter people's lives. Applications in cloud phones can be deployed in cloud computing nodes, which provide the computing resources required by the applications. In this way, problems such as heating and power consumption of physical phones can be effectively avoided. In some cases, applications need to be migrated from the current cloud computing node to other cloud computing nodes. For example, if a user wants an application to use hardware resources with higher configuration than the current cloud computing node, the application needs to be migrated to a cloud computing node that meets the user's needs.
[0003] Commonly used application migration tools, such as the Checkpoint / Restore InUserspace (CRIU) tool, can export the basic resource information of an application running in a Linux system, generate a resource information set of the application, and restore the basic resources of the application in a new cloud computing node based on the exported resource information set of the application to complete the migration of the application. The basic resource information may include process information, memory information, file information, etc. corresponding to the application.
[0004] However, currently cloud phones are mainly based on the Android system, that is, the applications running in the cloud computing nodes are Android applications. The Android system includes two basic services, anonymous shared memory (Ashmem) service and inter-process communication (Binder) service. Android applications need to use these two services when running, and will generate corresponding Ashmem resource information and Binder resource information. The above-mentioned CRIU tool can only export and restore the basic resource information of the application, but cannot export and restore the Ashmem resource information and Binder resource information corresponding to the application, that is, it is impossible to migrate Android applications. Summary of the invention
[0005] The embodiment of the present application provides a method and device for migrating an Android application, which can export and restore the resources of an Android application under the Android system in a computing node to achieve the migration of the Android application. The technical solution is as follows:
[0006] In a first aspect, a method for exporting resources of an Android application is provided, the method being applied to an original computing node, the method comprising:
[0007] Export the first basic resource information of the first Android application. Call the first anonymous shared memory Ashmem kernel driver to export the first Ashmem resource information of the first Android application. Call the first inter-process communication Binder kernel driver to export the first Binder resource information of the first Android application. Generate a resource information set of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information. Send the resource information set of the first Android application to the destination computing node, so that the destination computing node restores the basic resources of the first Android application based on the first basic resource information, calls the second Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information, and calls the second Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0008] In the solution provided in the embodiment of the present application, the computing node can be a server, a virtual machine, etc. An Android application export and recovery tool can be installed in the computing node. The original computing node can export the basic resource information of the first Android application through the basic resource management module in the Android application export and recovery tool and write it into the resource information set of the first Android application. The exported basic resource information of the first Android application may include process information, file information, memory information, etc. of the first Android application. The Ashmem kernel driver in the kernel driver module can also be called by the Ashmem resource management module in the Android application export and recovery tool to export the Ashmem resource information and write it into the resource information set of the first Android application. The Ashmem resource information may include target shared memory information and shared file information shared by multiple processes of the first Android application. The Binder kernel driver in the kernel driver module can also be called by the Binder resource management module to export the Binder resource information and write it into the resource information set of the first Android application. The Binder resource information may include the communication connection information between the client process of the first Android application and the server process of the target application.
[0009] After the original computing node writes the basic resource information, Ashmem resource information and Binder resource information of the first Android application into the resource information set of the first Android application, the resource information of the first Android application can be sent to the target computing node. The target computing node uses the Android application to export the recovery tool, based on the first basic resource information, restore the basic resources of the first Android application, call the second Ashmem kernel driver, based on the first Ashmem resource information, restore the Ashmem resources of the first Android application, call the second Binder kernel driver, based on the first Binder resource information, restore the Binder resources of the first Android application.
[0010] This solution can realize the export of basic resource information, Ashmem resource information and Binder resource information of Android applications under the Android system, and the target computing node can restore the above exported resources to realize the migration of Android applications.
[0011] In a possible implementation, the method further includes:
[0012] Detect whether the first Android application generates new basic resource information. If it is detected that the first Android application generates new basic resource information, export the newly generated basic resource information. Detect whether the first Android application generates new Ashmem resource information. If it is detected that the first Android application generates new Ashmem resource information, export the newly generated Ashmem resource information. Detect whether the first Android application generates new Binder resource information. If it is detected that the first Android application generates new Binder resource information, export the newly generated Binder resource information. Generate a newly added resource information set of the first Android application including the newly generated basic resource information, the newly generated Ashmem resource information and the newly generated Binder resource information. Send the newly added resource information set of the first Android application to the destination computing node.
[0013] In the scheme shown in the embodiment of the present application, in the scenario of hot migration of the first Android application, after the Android application export and recovery tool in the original computing node exports the basic resource information, Ashmem resource information and Binder resource information of the first Android application for the first time, it can also detect whether the first Android application has newly generated resource information in the original computing node according to a preset period, and if there is newly generated resource information, the newly generated resource information is exported and written into the newly added resource information set of the first Android application. If it is detected that the total amount of newly generated resource information of the first Android application in the original computing node is greater than a preset threshold, the operation of the first Android application in the original computing node can be stopped.
[0014] This solution can realize hot migration of Android applications from the original computing node to the destination computing node.
[0015] In a second aspect, a method for migrating an Android application is provided, the method being applied to a destination computing node, the method comprising:
[0016] Obtain a resource set of a first Android application sent by an original computing node, wherein the resource set of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application. Based on the first basic resource information, restore the basic resources of the first Android application. Call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information. Call a Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0017] In the scheme shown in the embodiment of the present application, an Android application export and recovery tool is also installed in the destination computing node. After receiving the basic resource information set of the first Android application sent by the original computing node, the destination computing node can use the Android application export and recovery tool to restore the basic resources of the first Android application based on the first basic resource information. Call the Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information. Call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0018] In a possible implementation, the first basic resource information includes process information and file information of the first Android application;
[0019] The restoring the basic resources of the first Android application based on the first basic resource information includes:
[0020] Based on the process information, a process corresponding to the process information is created. Based on the file information, a file corresponding to the file information is created in a file system.
[0021] In the solution shown in the embodiment of the present application, the process information may include a process identification ID, a process status, etc., and the file information may include a file name, a file descriptor, read and write permissions, etc. The basic resource management module in the Android application export and recovery tool can create a process based on the process information and configure the process status. The above-mentioned basic resource management module can create a process corresponding to the process information based on the process information, and create a file corresponding to the file information in the file system based on the file information.
[0022] In a possible implementation, the first Ashmem resource information includes target memory information of a shared memory shared by multiple processes of the first Android application and target file information of a shared file, the target memory information includes attribute information and storage data of the shared memory shared by the multiple target processes, and the file corresponding to the file information includes a target shared file corresponding to the target file information.
[0023] The restoring the Ashmem resource of the first Android application based on the first Ashmem resource information includes:
[0024] Based on the target memory information, a target shared memory is created, and based on the attribute information, the target shared memory is configured. The storage data is written into the target shared memory and used as the file content data of the target shared file.
[0025] In the scheme shown in the embodiment of the present application, the Ashmem resource information of the first Android application may include the target memory information of the shared memory shared by multiple processes of the first Android application and the target file information of the shared file. Among them, the target memory information includes the size, read and write permissions, storage data, etc. of the shared memory shared by the above multiple processes, and the target file information includes the name of the shared file, file descriptor, etc. The Android application export recovery tool can call the Ashmem kernel driver in the kernel driver module through the Ashmem resource management module, create the target shared memory based on the target memory information, and configure the target shared memory based on the attribute information. It can also write the storage data into the target shared memory and use it as the file content data of the target shared file.
[0026] In a possible implementation, the first Binder resource information includes communication connection information between the client process of the first Android application and the server process of the second Android application, and the process corresponding to the process information includes the client process of the first Android application;
[0027] The restoring the Binder resource of the first Android application based on the first Binder resource information includes:
[0028] Based on the communication connection information, a communication connection is established between the client process and the server process of the second Android application in the destination computing node.
[0029] In the scheme shown in the embodiment of the present application, the Binder resource information of the first Android application may include the communication connection information between the client process of the first Android application and the server process of the first Android application, and the communication connection information may include the basic data of the Binder client structure (binder_ref) of the client process of the first Android application and the identification information of the Binder server structure (binder_node) of the server process of the third Android application. The Android application export recovery tool can call the Binder kernel driver in the kernel driver module through the Binder resource management module, and according to the identification information of the above-mentioned Binder server structure (binder_node), search for the corresponding server process of the second Android application in the computing node, and then establish a communication connection between the client process of the first Android application and the server process of the second Android application.
[0030] In a third aspect, a method for restoring an Android application snapshot is provided, the method being applied to a computing node, the method comprising:
[0031] Receive a snapshot restore instruction for a first moment of a first Android application. Obtain a stored snapshot of the first Android application corresponding to the first moment, wherein the snapshot of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application. Based on the first basic resource information, restore the basic resources of the first Android application. Call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information. Call a Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0032] In the scheme shown in the embodiment of the present application, the computing node can store a snapshot of the first Android application generated at least at one time. When a problem occurs in the operation of the first Android application, the user can specify a snapshot at a time in the stored snapshots of the first Android application, and use the snapshot to perform snapshot recovery on the first Android application. The process of using the snapshot to recover the Android application is the same as the process of recovering the basic resources of the Android application during the Android application migration process in the second aspect above. The snapshot here and the resource information set in the first aspect above both include the basic resource information, Ashmem resource information and Binder resource information of the Android application.
[0033] In a possible implementation, the method further includes:
[0034] At the first moment, receiving a snapshot generation instruction for the first Android application. Exporting the first basic resource information. Calling the Ashmem kernel driver to export the first Ashmem resource information. Calling the Binder kernel driver to export the first Binder resource information. Generating a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information. Storing the snapshot of the first Android application in correspondence with the first moment.
[0035] In the scheme shown in the embodiment of the present application, in order to restore the first Android application in a timely manner when problems occur in the first Android application in the future, the user generates a snapshot of the first Android application through a computing node at at least one specified moment, and stores the generated snapshot of the first Android application and the first moment of generating the snapshot in correspondence.
[0036] In a fourth aspect, a device for migrating an Android application is provided, the device being applied to a destination computing node, the device comprising:
[0037] an acquisition module, used for acquiring a resource set of a first Android application sent by an original computing node, wherein the resource set of the first Android application includes first basic resource information, first Ashmem resource information and first Binder resource information of the first Android application; a basic resource management module, used for exporting the first basic resource information of the first Android application;
[0038] An Ashmem resource management module, configured to call a first anonymous shared memory Ashmem kernel driver to export first Ashmem resource information corresponding to the first Android application;
[0039] A Binder resource management module, used to call a first inter-process communication Binder kernel driver to export first Binder resource information corresponding to the first Android application;
[0040] A generating module, used to generate a resource information set of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information;
[0041] A sending module is used to send the resource information set of the first Android application to a destination computing node, so that the destination computing node restores the basic resources of the first Android application based on the first basic resource information, calls a second Ashmem kernel driver, and restores the Ashmem resources of the first Android application based on the first Ashmem resource information, and calls a second Binder kernel driver, and restores the Binder resources of the first Android application based on the first Binder resource information.
[0042] In a possible implementation, the sending module is further used to send the resource information set of the first Android application to the first computing node;
[0043] The basic resource management module is further used to detect whether the first Android application generates new basic resource information, and if it is detected that the first Android application generates new basic resource information, export the newly generated basic resource information;
[0044] The Ashmem resource management module is further used to detect whether the first Android application generates new Ashmem resource information, and if it is detected that the first Android application generates new Ashmem resource information, export the newly generated Ashmem resource information;
[0045] The Binder resource management module is further used to detect whether the first Android application generates new Binder resource information, and if it is detected that the first Android application generates new Binder resource information, export the newly generated Binder resource information;
[0046] The generating module is further used to generate a set of newly added resource information of the first Android application program including the newly generated basic resource information, the newly generated Ashmem resource information and the newly generated Binder resource information;
[0047] The sending module is further used to send the newly added resource information set of the first Android application to the destination computing node.
[0048] In a fifth aspect, a device for migrating an Android application is provided, the device being applied to a destination computing node, the device comprising:
[0049] An acquisition module, used to acquire a resource set of a first Android application sent by an original computing node, wherein the resource set of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application;
[0050] A basic resource management module, configured to restore the basic resources of the first Android application based on the first basic resource information;
[0051] An Ashmem resource management module, configured to call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information;
[0052] The Binder resource management module is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0053] In a possible implementation, the first basic resource information includes process information and file information of the first Android application;
[0054] The basic resource management module is used to:
[0055] Based on the process information, create a process corresponding to the process information;
[0056] Based on the file information, a file corresponding to the file information is created in the file system.
[0057] In a possible implementation, the first Ashmem resource information includes target memory information of a shared memory shared by multiple processes of the first Android application and target file information of a shared file, the target memory information includes attribute information and storage data of the shared memory shared by the multiple target processes, and the file corresponding to the file information includes a target shared file corresponding to the target file information;
[0058] The Ashmem resource management module is used to:
[0059] Based on the target memory information, create a target shared memory, and based on the attribute information, configure the target shared memory;
[0060] The stored data is written into the target shared memory and used as file content data of the target shared file.
[0061] In a possible implementation, the first Binder resource information includes communication connection information between the client process of the first Android application and the server process of the second Android application, and the process corresponding to the process information includes the client process of the first Android application;
[0062] The Binder resource management module is used to:
[0063] Based on the communication connection information, a communication connection is established between the client process and the server process of the second Android application in the destination computing node.
[0064] In a sixth aspect, a device for restoring an Android application snapshot is provided, the method being applied to a computing node, the device comprising:
[0065] A receiving module, configured to receive a snapshot recovery instruction for a first Android application at a first moment;
[0066] an acquisition module, configured to acquire a stored snapshot of the first Android application corresponding to the first moment, wherein the snapshot of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application;
[0067] A basic resource management module, configured to restore the basic resources of the first Android application based on the first basic resource information;
[0068] An Ashmem resource management module, configured to call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information;
[0069] The Binder resource management module is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0070] In a possible implementation, the receiving module is further configured to:
[0071] At the first moment, receiving a snapshot generation instruction for the first Android application;
[0072] The basic resource management module is further used to export the first basic resource information;
[0073] The Ashmem resource management module is further used to call the Ashmem kernel driver to export the first Ashmem resource information;
[0074] The Binder resource management module is further used to call the Binder kernel driver to export the first Binder resource information;
[0075] The device further includes a generating module, configured to generate a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information, and the first Binder resource information;
[0076] The device also includes a storage module, which is used to store the snapshot of the first Android application and the first moment in correspondence.
[0077] In the seventh aspect, a computing node is provided, the computing node comprising a processor and a memory, the memory storing at least one instruction, the instruction being loaded and executed by the processor to implement the operations performed by the method for migrating an Android application as described in the first aspect above, or to implement the operations performed by the method for migrating an Android application as described in the second aspect above, or to implement the operations performed by the method for snapshot recovery of an Android application as described in the third aspect above.
[0078] In an eighth aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the method for migrating an Android application as described in the first aspect above, or to implement the operations performed by the method for migrating an Android application as described in the second aspect above, or to implement the operations performed by the method for snapshot recovery of an Android application as described in the third aspect above.
[0079] In a ninth aspect, a computer program product comprising instructions is provided. When the computer program product is run on a vehicle lane change trend recognition device, the computing node executes the method for migrating an Android application as described in the first aspect above, or executes the method for migrating an Android application as described in the second aspect above, or executes the method for restoring an Android application snapshot as described in the third aspect above.
[0080] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0081] The technical solution provided in the embodiment of the present application can not only export the basic resource information of the Android application, but also export the Ashmem resource information and Binder resource information unique to the Android application. In addition, after generating a resource information set including various resource information, after sending the resource information set of the Android application to the destination computing node, the destination computing node can restore the basic resources, Ashmem resources and Binder resources of the Android application to achieve the migration of the Android application. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 This is a schematic diagram of a migration scenario of an Android application provided in an embodiment of the present application;
[0083] Figure 2 This is a schematic diagram of a snapshot recovery scenario of an Android application provided in an embodiment of the present application;
[0084] Figure 3 It is a structural diagram of an Android application export and recovery tool provided in an embodiment of the present application;
[0085] Figure 4 This is a schematic diagram of an Ashmem service principle provided in an embodiment of the present application;
[0086] Figure 5 This is a schematic diagram of a Binder service principle provided in an embodiment of the present application;
[0087] Figure 6 This is a flow chart of a method for migrating an Android application provided in an embodiment of the present application;
[0088] Figure 7 This is a schematic diagram of a quick start scenario of an Android application provided in an embodiment of the present application;
[0089] Figure 8 This is a flow chart of a method for restoring an Android application snapshot provided in an embodiment of the present application;
[0090] Fig. 9 It is a structural schematic diagram of an Android application migration device provided in an embodiment of the present application;
[0091] Fig.10 It is a structural schematic diagram of an Android application migration device provided in an embodiment of the present application;
[0092] Fig.11 It is a structural schematic diagram of a device for restoring an Android application snapshot provided in an embodiment of the present application;
[0093] Fig.12 It is a structural diagram of a computing node provided in an embodiment of the present application. DETAILED DESCRIPTION
[0094] The embodiment of the present application provides a method and device for Android application migration, which can be implemented by an original computing node and a destination computing node installed with an Android application export and recovery tool. Both the original computing node and the destination computing node can be servers, virtual machines, etc.
[0095] like Figure 1As shown, the method can be applied to the scenario of Android application migration. The original computing node installed with the Android application export and recovery tool can export the basic resource information, Ashmem resource information and Binder resource information of the first Android application through the Android application export and recovery tool, and write them into the resource information set. And send them to the destination computing node also installed with the Android application export and recovery tool, and the destination computing node will recover the first Android application.
[0096] like Figure 2 As shown, the method can also be applied to the Android application quick start scenario. The original computing node that deploys the Android application migration tool and the Android application export and recovery tool can have multiple Android applications installed. The original computing node can use the Android application export and recovery tool to export the first Android application (such as Figure 2 The target computing node can obtain the resource information set of the first Android application that needs to be quickly started in the startup resource storage device, and restore the target Android application through the Android application export and recovery tool to achieve the quick start of the first Android application in the target computing node.
[0097] The Android application export and recovery tool installed in the computing node may be a software tool such as Figure 3 As shown, the Android application export recovery tool may include three modules: an external interface gateway module, a resource management module, and a kernel driver module. Among them, the external interface gateway module and the resource management module run in the user space, and the kernel driver module runs in the kernel space. The external interface gateway module is used to provide the external interface of the Android application export recovery tool, such as a command line interface, a Hypertext Transfer Protocol (HTTP) interface, etc. The resource management module includes a basic resource management module, an anonymous shared memory (Anonymous shared memory, Ashmem) resource management module, and an inter-process communication (Binder) module. The kernel driver module includes an Ashmem kernel driver module and a Binder kernel driver module. Among them, the basic resource management module is used to export and recover the basic resource information of the Android application. The Ashmem resource management module is used to call the Ashmem kernel driver in the kernel driver module to realize the export and recovery of the Ashmem resource information. The Binder resource management module is used to call the Binder kernel driver in the kernel driver module to realize the export and recovery of the Binder resource information.
[0098] In order to facilitate the understanding of this application, some technical terms in this application are explained below.
[0099] 1. Ashmem Service
[0100] like Figure 4 As shown, the target Android application includes process A and process B, and process A and process B correspond to file descriptor tables (fdt) respectively. The file system (file sytem) includes files corresponding to each process, and the Ashmem module is a shared memory module. In the case where process A and process B have shared memory, the file descriptor tables corresponding to process A and process B respectively contain file descriptors pointing to the same file fileN in the file system, and the file content data of fileN is stored in the target shared memory in the Ashmem module.
[0101] 2. Binder Service
[0102] like Figure 5 As shown, Android application A includes a client process, and Android application B includes a server process. The client process in Android application A is a Binder module "BinderA" in the kernel space. The BinderA includes a Binder process structure (binder_proc), a Binder client structure (binder_ref) and a Binder thread information structure (binder_thread). The server process in Android application B has a Binder module "BinderB" in the kernel space. The BinderB includes a binder_proc, a binder_thread and a Binder server structure (binder_node). If you want to establish a communication connection between the client process in Android application A and the server process of Android application B, you need to make the node in the binder_ref of the client process point to the binder_node of the server process.
[0103] like Figure 6 The figure is a flow chart of a method for migrating an Android application provided by an embodiment of the present application. The processing flow of the method may include the following steps:
[0104] Step 601: The original computing node exports first basic resource information of a first Android application.
[0105] During implementation, an Android application export and recovery tool can be deployed in the original computing node. When the first Android application needs to be migrated, a resource migration instruction for the first Android application can be sent to the Android application export and recovery tool. The resource migration instruction can be in the form of a command line, an HTTP request, etc.
[0106] After receiving the resource migration instruction for the first Android application through the external interface gateway, the Android application export and recovery tool can export the basic resource information of the first Android application through the basic resource management module. The exported basic resource information of the first Android application may include process information, file information, memory information, etc. of the first Android application. Among them, the process information may include a process identifier (Identity document, ID), process status, etc., the file information may include file size, file read and write permissions, file modification time, etc., and the memory information may include a list of used memory areas, storage data in used memory, etc.
[0107] Step 602: The original computing node calls the first Ashmem kernel driver to export first Ashmem resource information of the first Android application.
[0108] In implementation, after receiving the resource migration instruction for the first Android application, the Android application export recovery tool can also call the first Ashmem kernel driver in the kernel driver module through the Ashmem resource management module to export the Ashmem resource information. The Ashmem resource information may include target shared memory information and shared file information shared by multiple processes of the first Android application. The target shared memory information includes the attributes of the shared memory, storage data, etc., and the shared file information includes the name, size, file descriptor, etc. of the shared file.
[0109] Step 603: The original computing node calls the first Binder kernel driver to export the first Binder resource information of the first Android application.
[0110] In implementation, after receiving the resource export instruction for the first Android application, the Android application export recovery tool can also call the Binder kernel driver in the kernel driver module through the Binder resource management module to export the Binder resource information. The Binder resource information may include the communication connection information between the client process of the first Android application and the server process of the second Android application. The communication connection information may include the identification information of the binder_ref of the client process of the first Android application and the binder_node of the server process in the second Android application, and the communication connection information is used to indicate that the binder_ref of the client process of the first Android application and the binder_node of the server process in the second Android application are connected.
[0111] Step 604: The original computing node generates a resource set of the first Android application including first basic resource information, first Ashmem resource information, and first Binder resource information.
[0112] In implementation, the exported first basic resource information, first Ashmem resource information, and first Binder resource information may be written into a resource collection of the first Android application.
[0113] Step 605: The original computing node sends the resource information set of the first Android application to the destination computing node.
[0114] In implementation, the user may specify that the first Android application needs to be migrated to the destination computing node. Then, after the original computing node generates the resource information set of the first Android application, the resource information set of the first Android application may be sent to the destination computing node.
[0115] Step 606: The destination computing node obtains the resource information set of the first Android application sent by the original computing node.
[0116] Step 607: The destination computing node restores the basic resources of the first Android application based on the first basic resource information. The second Ashmem kernel driver is called to restore the Ashmem resources of the first Android application based on the first Ashmem resource information. The second Binder kernel driver is called to restore the Binder resources of the first Android application based on the first Binder resource information.
[0117] In implementation, the destination computing node is also installed with an Android application export and recovery tool. After obtaining the resource information set of the first Android application sent by the original computing node, the destination computing node can restore the first Android application through the Android application export and recovery tool. The following describes the recovery of the basic resources, Ashmem resources, and Binder resources of the first Android application through the Android application export and recovery tool:
[0118] 1. First, restore the basic resources of Android applications.
[0119] The basic resource management module is used to restore the basic resource of the first Android application based on the first basic resource information of the first Android application.
[0120] The basic resource information of the first Android application includes process information, file information, memory information, etc. of the first Android application. The process information may include a process ID, a process status, etc., the file information may include a file name, a file read and write permission, a file modification time, a file descriptor, etc., and the memory information may include a list of used memory areas, storage data in the used memory, etc.
[0121] The basic resource management module can create the corresponding process according to the process information and set the process status. It can also create a list of used memory areas according to the memory information and write the corresponding storage data in the corresponding memory area. It can also create the corresponding file in the file system according to the file information, and configure the file read and write permissions, file modification time and other file attributes. It can also create a file descriptor table for the corresponding process and correspond the newly created file to the file descriptor in the corresponding file information in the file descriptor table.
[0122] 2. Ashmem resource recovery of the first Android application.
[0123] The Ashmem kernel driver in the kernel driver module is called through the Ashmem resource management module, and the Ashmem resource of the second Android application is restored based on the second Ashmem resource information.
[0124] The Ashmem resource information of the first Android application may include target memory information of the shared memory shared by multiple processes of the first Android application and target file information of the shared file. The target memory information includes the size, read / write permissions, storage data, etc. of the shared memory shared by the multiple processes, and the target file information includes the name and file descriptor of the shared file.
[0125] It should be noted that the multiple processes of the first Android application have been created when the basic resources are restored. The target shared file corresponding to the target file information has also been created when the basic resources are restored.
[0126] The Ashmem kernel driver can create a target shared memory according to the size of the shared memory shared by multiple processes in the target memory information, configure its read and write permissions, and write the storage data into the created target shared memory. Then the storage data in the target shared memory is used as the content data of the target shared file. The Ashmem resource recovery of the first Android application is completed.
[0127] 3. First, restore the Binder resources of the Android application.
[0128] The Binder kernel driver program in the kernel driver module is called through the Binder resource management module, and the Binder resource of the first Android application is restored based on the second Binder resource information.
[0129] The Binder resource information of the first Android application may include the communication connection information between the client process of the first Android application and the server process of the first Android application, and the communication connection information may include the basic data of binder_ref of the client process of the first Android application and the identification information of binder_node of the server process of the second Android application. In addition, the Binder resource information may also include configuration information, such as the basic data of binder_proc and the basic data of binder_thread of the client process of the second Android application. It may also include the communication data between the client process and the server process, etc.
[0130] It should be noted that the client process of the first Android application has been created when the basic resources are restored. The second Android application is usually a public application, and the second Android application must be installed in both the original computing node and the destination computing node.
[0131] The Binder kernel driver can create the binder_proc, binder_thread, and binder_ref of the client process of the first Android application in the computing node according to the above configuration information. Then, according to the identification information of the binder_node of the server process of the second Android application in the communication connection information, the server process of the second Android application is searched, and the node in the binder_ref of the client process of the first Android application is pointed to the binder_node of the server process of the second Android application found, so as to realize the communication connection between the client process of the first Android application and the server of the second Android application.
[0132] In a possible implementation, in the hot migration scenario of an Android application, the original computing node can send the resource set of the first Android application to the destination computing node, and the destination computing node can restore the first Android application based on the received resource set of the first Android application. In this scenario, the first Android application can still be in a running state in the original computing node, and the original computing node can detect whether the first Android application generates new resource information according to a preset detection cycle. Accordingly, the processing can be as follows:
[0133] Through the basic resource management module of the Android application export recovery tool, it is detected whether the first Android application generates new basic resource information. If it is detected that the first Android application generates new basic resource information, the newly generated basic resource information is exported.
[0134] Through the Ashmem resource management module of the Android application export recovery tool, it is detected whether the first Android application generates new basic resource information. If it is detected that the first Android application generates new basic resource information, the newly generated basic resource information is exported.
[0135] Through the Binder resource management module of the Android application export recovery tool, it is detected whether the first Android application generates new Binder resource information. If it is detected that the first Android application generates new Binder resource information, the newly generated Binder resource information is exported.
[0136] Generate a newly added resource set of the first Android application including newly generated basic resource information, newly generated Ashmem resource information and newly generated Binder resource information, and send the newly added resource set of the first Android application to a destination computing node.
[0137] In addition, if after the first Android application is migrated to the destination computing node, the total amount of the newly generated basic resource information, newly generated Ashmem resource information and newly generated Binder resource information of the first Android application detected in the original computing node is greater than a preset threshold, the operation of the first Android application in the original computing node is stopped.
[0138] In a possible implementation, multiple Android applications including a first Android application may be installed in this computing node, and the first Android application needs to be run in an independent computing node. In this case, the computing node may export the basic resource information, Ashmem resource information, and Binder resource information of the first Android application through an Android application export and recovery tool, and write the resource information set of the first Android application. Then, the first Android application is stopped in the original computing node and sent to a startup resource storage device for storage. After receiving an instruction to quickly start the first Android application, the destination computing node to be run may obtain the resource information set of the first Android application from the startup resource storage device, and perform the recovery of the basic resources, Ashmem resources, and Binder resources of the first Android application in the above step 707 to complete the quick start of the first Android application in the destination computing node.
[0139] In the embodiment of the present application, in addition to exporting the basic resource information of the Android application, the Ashmem resource information and Binder resource information unique to the Android application can also be exported. In addition, after generating a resource information set including various resource information, after sending the resource information set of the Android application to the destination computing node, the destination computing node can restore the basic resources, Ashmem resources and Binder resources of the Android application to achieve the migration of the Android application.
[0140] The embodiment of the present application also provides a method for restoring an Android application snapshot, which can be implemented by a computing node installed with an Android application export and recovery tool.
[0141] like Figure 7 As shown, the method can be applied to the scenario of Android application snapshot recovery. A computing node with an Android application migration tool installed can use the Android application migration tool to export the basic resource information, Ashmem resource information, and Binder resource information of a first Android application at at least one specified time, and write them into the snapshot of the first Android application. When a problem occurs in an Android application, a snapshot of the first Android application exported at a certain time can be obtained as needed, and the first Android application can be restored through the Android application export recovery tool.
[0142] like Figure 8 The figure is a flow chart of a method for migrating an Android application provided by an embodiment of the present application. The processing flow of the method may include the following steps:
[0143] Step 801: Receive a snapshot recovery instruction for a first Android application at a first moment.
[0144] In implementation, the computing node may store at least one snapshot of the first Android application generated at a time. When a problem occurs in the operation of the first Android application, the user may send a snapshot recovery instruction of the first application at a first time to the computing node.
[0145] Step 802: Obtain a snapshot of the first Android application program stored at the first moment.
[0146] The snapshot of the first Android application includes first basic resource information, first Ashmem resource information and first Binder resource information of the first Android application.
[0147] Step 803: Based on the first basic resource information, restore the basic resources of the first Android application, call the Ashmem kernel driver, and based on the first Ashmem resource information, restore the Ashmem resources of the first Android application; call the Binder kernel driver, and based on the first Binder resource information, restore the Binder resources of the first Android application.
[0148] It should be noted that in step 803, the implementation method of the computing node restoring the first Android application based on a snapshot of the first Android application at a certain moment is the same as the method in the above step 607, in which the destination computing node restores the first Android application based on the resource information set of the first Android application, and will not be repeated here.
[0149] In one possible implementation, a user can generate and store a snapshot of a first Android application through a computing node at at least one specified moment, so as to use it when a problem occurs in the first Android application. Accordingly, the processing can be as follows: at a first moment, receive a snapshot generation instruction for a first Android application. Export the first basic resource information. Call the Ashmem kernel driver to export the first Ashmem resource information. Call the Binder kernel driver to export the first Binder resource information. Generate a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information. Store the snapshot of the first Android application in correspondence with the first moment.
[0150] Based on the same technical concept, the embodiment of the present application also provides a device for migrating Android applications, which can be applied to a computing node, such as Fig. 9 As shown, the device comprises:
[0151] The basic resource management module 910 is used to export the first basic resource information of the first Android application program, and can specifically implement the basic resource information export function in the above step 601, as well as other implicit steps.
[0152] The Ashmem resource management module 920 is used for the first Ashmem kernel driver to export the first Ashmem resource information corresponding to the first Android application program, and can specifically implement the Ashmem resource information export function in the above step 602, as well as other implicit steps.
[0153] The Binder resource management module 930 is used to call the first Binder kernel driver to export the first Binder resource information corresponding to the first Android application. Specifically, it can implement the Binder resource information export function in the above step 603 and other implicit steps.
[0154] The generating module 940 is used to generate the resource information set of the first Android application program including the first basic resource information, the first Ashmem resource information and the first Binder resource information, and can specifically implement the generating function in the above step 604 and other implicit steps.
[0155] The sending module 950 is used to send the resource information set of the first Android application to the destination computing node, so that the destination computing node restores the basic resources of the first Android application based on the first basic resource information, calls the second Ashmem kernel driver, restores the Ashmem resources of the first Android application based on the first Ashmem resource information, calls the second Binder kernel driver, and restores the Binder resources of the first Android application based on the first Binder resource information. Specifically, the sending function in the above step 605 and other implicit steps can be implemented.
[0156] In a possible implementation, the sending module 950 is further configured to send the resource information set of the first Android application to the first computing node;
[0157] The basic resource management module is further used to detect whether the first Android application generates new basic resource information, and if it is detected that the first Android application generates new basic resource information, export the newly generated basic resource information;
[0158] The Ashmem resource management module 920 is further used to detect whether the first Android application generates new Ashmem resource information, and if it is detected that the first Android application generates new Ashmem resource information, export the newly generated Ashmem resource information;
[0159] The Binder resource management module 930 is further used to detect whether the first Android application generates new Binder resource information, and if it is detected that the first Android application generates new Binder resource information, export the newly generated Binder resource information;
[0160] The generating module 940 is further used to generate a set of newly added resource information of the first Android application program including the newly generated basic resource information, the newly generated Ashmem resource information and the newly generated Binder resource information;
[0161] The sending module 950 is further configured to send the newly added resource information set of the first Android application to the destination computing node.
[0162] It should also be noted that the Android application migration device provided in the above embodiment only uses the division of the above functional modules as an example when migrating Android applications. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the original computing node is divided into different functional modules to complete all or part of the functions described above. In addition, the Android application migration device provided in the above embodiment and the method embodiment of Android application migration belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0163] Based on the same technical concept, the embodiment of the present application also provides a device for migrating Android applications, which can be applied to a computing node, such as Fig.10 As shown, the device comprises:
[0164] The acquisition module 1010 is used to acquire the resource set of the first Android application sent by the original computing node, wherein the resource set of the first Android application includes the first basic resource information, the first Ashmem resource information and the first Binder resource information of the first Android application. Specifically, the acquisition function in the above step 606 and other implicit steps can be implemented.
[0165] The basic resource management module 1020 is used to restore the basic resources of the first Android application based on the first basic resource information, and can specifically implement the basic resource restoration function in the above step 607 and other implicit steps.
[0166] The Ashmem resource management module 1030 is used to call the Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information. Specifically, it can implement the Ashmem resource recovery function in the above step 607 and other implicit steps.
[0167] The Binder resource management module 1040 is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information, and can specifically implement the Binder resource restoration function in the above step 607 and other implicit steps.
[0168] In a possible implementation, the first basic resource information includes process information and file information of the first Android application;
[0169] The basic resource management module 1020 is used to:
[0170] Based on the process information, create a process corresponding to the process information;
[0171] Based on the file information, a file corresponding to the file information is created in the file system.
[0172] In a possible implementation, the first Ashmem resource information includes target memory information of a shared memory shared by multiple processes of the first Android application and target file information of a shared file, the target memory information includes attribute information and storage data of the shared memory shared by the multiple target processes, and the file corresponding to the file information includes a target shared file corresponding to the target file information;
[0173] The Ashmem resource management module 1030 is used to:
[0174] Based on the target memory information, create a target shared memory, and based on the attribute information, configure the target shared memory;
[0175] The stored data is written into the target shared memory and used as file content data of the target shared file.
[0176] In a possible implementation, the first Binder resource information includes communication connection information between the client process of the first Android application and the server process of the second Android application, and the process corresponding to the process information includes the client process of the first Android application;
[0177] The Binder resource management module 1040 is used to:
[0178] Based on the communication connection information, a communication connection is established between the client process and the server process of the second Android application in the destination computing node.
[0179] It should also be noted that the Android application migration device provided in the above embodiment only uses the division of the above functional modules as an example when migrating Android applications. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the destination computing node is divided into different functional modules to complete all or part of the functions described above. In addition, the Android application migration device provided in the above embodiment and the method embodiment of Android application migration belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0180] Based on the same technical concept, the embodiment of the present application also provides a device for restoring an Android application snapshot, which can be applied to a computing node, such as Fig.11 As shown, the device comprises:
[0181] The receiving module 1110 is used to receive a snapshot restoration instruction for a first Android application at a first moment;
[0182] The acquisition module 1120 is used to acquire the stored snapshot of the first Android application corresponding to the first moment, wherein the snapshot of the first Android application includes first basic resource information, first Ashmem resource information and first Binder resource information of the first Android application;
[0183] A basic resource management module 1130, configured to restore the basic resources of the first Android application based on the first basic resource information;
[0184] Ashmem resource management module 1140, configured to call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information;
[0185] The Binder resource management module 1150 is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
[0186] In a possible implementation, the receiving module 1110 is further configured to:
[0187] At the first moment, receiving a snapshot generation instruction for the first Android application;
[0188] The basic resource management module 1130 is further used to export the first basic resource information;
[0189] The Ashmem resource management module 1140 is further used to call the Ashmem kernel driver to export the first Ashmem resource information;
[0190] The Binder resource management module 1150 is further used to call the Binder kernel driver to export the first Binder resource information;
[0191] The device further includes a generating module, configured to generate a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information, and the first Binder resource information;
[0192] The device also includes a storage module, which is used to store the snapshot of the first Android application and the first moment in correspondence.
[0193] It should also be noted that the device for restoring an Android application snapshot provided in the above embodiment only uses the division of the above functional modules as an example when restoring an Android application snapshot. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the computing node is divided into different functional modules to complete all or part of the functions described above. In addition, the device for restoring an Android application snapshot provided in the above embodiment and the method embodiment for restoring an Android application snapshot belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0194] like Fig.12 FIG. 1 is a schematic diagram of a computing node 1200 provided in an embodiment of the present application. Fig.12 In the embodiment, the computing node may include a processor 1201 and a memory 1202. The processor 1201 may be a central processing unit (CPU). The processor 1201 may refer to one processor or may include multiple processors. The memory 1202 may include a volatile memory, such as a random access memory (RAM); the memory may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, etc. The memory may also include a combination of the above-mentioned types of memories. The memory 1202 may refer to one memory or may include multiple memories. The memory 1202 stores computer-readable instructions, which may be executed by the processor 1201 to implement the method for Android application migration or snapshot recovery provided in the above-mentioned embodiment.
[0195] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by the device or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk and a tape, etc.), or an optical medium (such as a digital video disk (Digital Video Disk, DVD), etc.), or a semiconductor medium (such as a solid-state hard disk, etc.).
[0196] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0197] The above description is only an embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for migrating an Android application, characterized in that: The method is applied to the original computing node, and the method includes: Exporting first basic resource information of a first Android application; Calling a first anonymous shared memory Ashmem kernel driver to export first Ashmem resource information of the first Android application; Calling a first inter-process communication Binder kernel driver to export first Binder resource information of the first Android application; Generate a resource information set of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information; The resource information set of the first Android application is sent to the destination computing node, so that the destination computing node restores the basic resources of the first Android application based on the first basic resource information, calls the second Ashmem kernel driver, restores the Ashmem resources of the first Android application based on the first Ashmem resource information, calls the second Binder kernel driver, and restores the Binder resources of the first Android application based on the first Binder resource information.
2. The method according to claim 1, characterized in that The method further comprises: detecting whether the first Android application generates new basic resource information, and if it is detected that the first Android application generates new basic resource information, exporting the newly generated basic resource information; detecting whether the first Android application generates new Ashmem resource information, and if it is detected that the first Android application generates new Ashmem resource information, exporting the newly generated Ashmem resource information; detecting whether the first Android application generates new Binder resource information, and if it is detected that the first Android application generates new Binder resource information, exporting the newly generated Binder resource information; Generate a new resource information set of the first Android application including the newly generated basic resource information, the newly generated Ashmem resource information and the newly generated Binder resource information; The newly added resource information set of the first Android application is sent to the destination computing node.
3. A method for migrating an Android application, characterized in that: The method is applied to a destination computing node, and the method comprises: Obtain a resource set of a first Android application sent by an original computing node, wherein the resource set of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application; Based on the first basic resource information, restore the basic resources of the first Android application; Calling an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information; The Binder kernel driver is called to restore the Binder resources of the first Android application based on the first Binder resource information.
4. The method according to claim 3, characterized in that The first basic resource information includes process information and file information of the first Android application; The restoring the basic resources of the first Android application based on the first basic resource information includes: Based on the process information, create a process corresponding to the process information; Based on the file information, a file corresponding to the file information is created in the file system.
5. The method according to claim 4, characterized in that The first Ashmem resource information includes target memory information of a shared memory shared by multiple processes of the first Android application and target file information of a shared file, the target memory information includes attribute information and storage data of the shared memory shared by the multiple processes, and the file corresponding to the file information includes a target shared file corresponding to the target file information; The restoring the Ashmem resource of the first Android application based on the first Ashmem resource information includes: Based on the target memory information, create a target shared memory, and based on the attribute information, configure the target shared memory; The stored data is written into the target shared memory and used as file content data of the target shared file.
6. The method according to claim 4 or 5, characterized in that The first Binder resource information includes communication connection information between the client process of the first Android application and the server process of the second Android application, and the process corresponding to the process information includes the client process of the first Android application; The restoring the Binder resource of the first Android application based on the first Binder resource information includes: Based on the communication connection information, a communication connection is established between the client process and the server process of the second Android application in the destination computing node.
7. A method for restoring an Android application snapshot, characterized in that: The method is applied to a computing node, and the method comprises: receiving a snapshot restoration instruction for a first moment of a first Android application; Acquire a stored snapshot of the first Android application corresponding to the first moment, wherein the snapshot of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application; Based on the first basic resource information, restore the basic resources of the first Android application; Calling an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information; The Binder kernel driver is called to restore the Binder resources of the first Android application based on the first Binder resource information.
8. The method according to claim 7, characterized in that The method further comprises: At the first moment, receiving a snapshot generation instruction for the first Android application; Exporting the first basic resource information; Calling the Ashmem kernel driver to export the first Ashmem resource information; Calling the Binder kernel driver to export the first Binder resource information; Generate a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information; The snapshot of the first Android application and the first moment are stored correspondingly.
9. A device for migrating an Android application, characterized in that: The device comprises: A basic resource management module, used for exporting first basic resource information of a first Android application; An Ashmem resource management module, configured to call a first Ashmem kernel driver to export first Ashmem resource information corresponding to the first Android application; A Binder resource management module, used for a first Binder kernel driver, to export first Binder resource information corresponding to the first Android application; A generating module, used to generate a resource information set of the first Android application including the first basic resource information, the first Ashmem resource information and the first Binder resource information; A sending module is used to send the resource information set of the first Android application to a destination computing node, so that the destination computing node restores the basic resources of the first Android application based on the first basic resource information, calls a second Ashmem kernel driver, and restores the Ashmem resources of the first Android application based on the first Ashmem resource information, and calls a second Binder kernel driver, and restores the Binder resources of the first Android application based on the first Binder resource information.
10. The device according to claim 9, characterized in that The sending module is further used to send the resource information set of the first Android application to the first computing node; The basic resource management module is further used to detect whether the first Android application generates new basic resource information, and if it is detected that the first Android application generates new basic resource information, export the newly generated basic resource information; The Ashmem resource management module is further used to detect whether the first Android application generates new Ashmem resource information, and if it is detected that the first Android application generates new Ashmem resource information, export the newly generated Ashmem resource information; The Binder resource management module is further used to detect whether the first Android application generates new Binder resource information, and if it is detected that the first Android application generates new Binder resource information, export the newly generated Binder resource information; The generating module is further used to generate a set of newly added resource information of the first Android application program including the newly generated basic resource information, the newly generated Ashmem resource information and the newly generated Binder resource information; The sending module is further used to send the newly added resource information set of the first Android application to the destination computing node.
11. A device for migrating an Android application, characterized in that: The device is applied to a destination computing node, and the device includes: An acquisition module, used for acquiring a resource set of a first Android application sent by an original computing node, wherein the resource set of the first Android application includes first basic resource information, first Ashmem resource information and first Binder resource information of the first Android application; A basic resource management module, configured to restore the basic resources of the first Android application based on the first basic resource information; An Ashmem resource management module, configured to call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information; The Binder resource management module is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
12. The device according to claim 11, characterized in that The first basic resource information includes process information and file information of the first Android application; The basic resource management module is used to: Based on the process information, create a process corresponding to the process information; Based on the file information, a file corresponding to the file information is created in the file system.
13. The device according to claim 12, characterized in that The first Ashmem resource information includes target memory information of a shared memory shared by multiple processes of the first Android application and target file information of a shared file, the target memory information includes attribute information and storage data of the shared memory shared by the multiple processes, and the file corresponding to the file information includes a target shared file corresponding to the target file information; The Ashmem resource management module is used to: Based on the target memory information, create a target shared memory, and based on the attribute information, configure the target shared memory; The stored data is written into the target shared memory and used as file content data of the target shared file.
14. The device according to claim 12 or 13, characterized in that The first Binder resource information includes communication connection information between the client process of the first Android application and the server process of the second Android application, and the process corresponding to the process information includes the client process of the first Android application; The Binder resource management module is used to: Based on the communication connection information, a communication connection is established between the client process and the server process of the second Android application in the destination computing node.
15. A device for restoring an Android application snapshot, characterized in that: The device is applied to a computing node, and comprises: A receiving module, configured to receive a snapshot recovery instruction for a first Android application at a first moment; an acquisition module, configured to acquire a stored snapshot of the first Android application corresponding to the first moment, wherein the snapshot of the first Android application includes first basic resource information, first Ashmem resource information, and first Binder resource information of the first Android application; A basic resource management module, configured to restore the basic resources of the first Android application based on the first basic resource information; An Ashmem resource management module, configured to call an Ashmem kernel driver to restore the Ashmem resources of the first Android application based on the first Ashmem resource information; The Binder resource management module is used to call the Binder kernel driver to restore the Binder resources of the first Android application based on the first Binder resource information.
16. The device according to claim 15, characterized in that The receiving module is also used for: At the first moment, receiving a snapshot generation instruction for the first Android application; The basic resource management module is further used to export the first basic resource information; The Ashmem resource management module is further used to call the Ashmem kernel driver to export the first Ashmem resource information; The Binder resource management module is further used to call the Binder kernel driver to export the first Binder resource information; The device further includes a generating module, configured to generate a snapshot of the first Android application including the first basic resource information, the first Ashmem resource information, and the first Binder resource information; The device also includes a storage module, which is used to store the snapshot of the first Android application and the first moment in correspondence.
17. A computing node, characterized in that: The computing node includes a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the operations performed by the method for migrating an Android application as described in any one of claims 1 to 2, or to implement the operations performed by the method for migrating an Android application as described in any one of claims 3 to 6, or to implement the operations performed by the method for snapshot recovery of an Android application as described in any one of claims 7 to 8.
18. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, which is loaded and executed by the processor to implement the operations performed by the method for migrating an Android application as described in any one of claims 1 to 2, or to implement the operations performed by the method for migrating an Android application as described in any one of claims 3 to 6, or to implement the operations performed by the method for snapshot restoration of an Android application as described in any one of claims 7 to 8.
Citation Information
Patent Citations
Method and device for migrating application programs of equipment
CN104516753A
Online migration method for container
CN108469982A