Processing method and apparatus, electronic device, storage medium, and program product
By establishing a dynamic link library information table and querying mapping relationships, the problems of duplicate storage and multiple loading of dynamic link libraries are solved, storage space and memory are optimized, and application installation and startup efficiency is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING YOUZHUJU NETWORK TECH CO LTD
- Filing Date
- 2021-09-07
- Publication Date
- 2026-06-02
Smart Images

Figure CN115774578B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an application processing method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] During application installation package development, the dynamic link library files to be used can be packaged into the installation package, including dynamic link libraries developed by the application itself and dynamic link libraries provided by third-party SDKs (Software Development Kits) used by the application. When the application is installed, these dynamic link libraries will be stored in the corresponding application directory.
[0003] Currently, different applications use the same dynamic link libraries (DLLs) through SDK integration. During application installation, these DLLs are stored in different application directories, resulting in wasted storage space. Furthermore, after application startup, these same DLLs are loaded multiple times across different applications, consuming unnecessary memory. Summary of the Invention
[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides an application processing method, apparatus, electronic device, storage medium and program product.
[0005] According to a first aspect of this application, an application processing method is provided, comprising:
[0006] In response to the application installation operation, the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed are obtained.
[0007] Check if the information of the first dynamic link library exists in the dynamic link library information table; wherein, the dynamic link library information table contains the mapping relationship between the dynamic link libraries stored in the system and their storage paths;
[0008] If the information of the first dynamic link library exists in the dynamic link library information table, a hard link is established from the installation path to the storage path of the first dynamic link library.
[0009] If the information of the first dynamic link library does not exist in the dynamic link library information table, the first dynamic link library is copied to the installation path, and a mapping relationship between the first dynamic link library and the storage path is added to the dynamic link library information table.
[0010] In one optional implementation, the dynamic link library information table further includes the number of times the dynamic link libraries stored in the system have been used;
[0011] The method further includes:
[0012] After establishing a hard link from the installation path to the storage path of the first dynamic link library, increment the usage count of the first dynamic link library by 1; or,
[0013] After adding the mapping relationship between the first dynamic link library and the storage path to the dynamic link library information table, the usage count of the first dynamic link library is set to 1.
[0014] In an optional implementation, the method further includes:
[0015] In response to an application uninstallation operation, obtain all secondary dynamic link libraries used by the application to be uninstalled;
[0016] For each second dynamic link library, query the storage path and usage count of that second dynamic link library in the dynamic link library information table;
[0017] If the second dynamic link library is used more than once, and the storage path of the second dynamic link library is in the application directory of the application to be uninstalled, the second dynamic link library is retained, the directory where the second dynamic link library is located is deleted, and the number of times the second dynamic link library is used in the dynamic link library information table is reduced by 1.
[0018] If the second dynamic link library is used more than once, and the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, the hard link to the storage path of the second dynamic link library will be removed, and the number of times the second dynamic link library is used in the dynamic link library information table will be decremented by 1.
[0019] If the number of uses equals 1, delete the second dynamic link library and remove the information of the second dynamic link library from the dynamic link library information table.
[0020] In one alternative implementation, before obtaining the first dynamic link library in the installation package of the application to be installed, the method further includes:
[0021] In response to ROM (Read-Only Memory Image) compilation operations, obtain third-party dynamic link libraries from the installation packages of multiple system-built-in applications;
[0022] If the third dynamic link libraries corresponding to the multiple system-built-in applications contain the same third dynamic link library, compile the same third dynamic link library into the system path;
[0023] For each system-provided application, the third dynamic link libraries (excluding the same third dynamic link libraries) in the corresponding third dynamic link library of the system-provided application are compiled into the installation path of the third dynamic link library in the application directory of the system-provided application to generate a ROM package.
[0024] In one optional implementation, the dynamic link library information table includes: the hash values of the dynamic link libraries already stored in the system and the storage paths corresponding to the dynamic link libraries already stored in the system.
[0025] In one optional implementation, the step of querying the dynamic link library information table to determine if information about the first dynamic link library exists includes:
[0026] Check if there exists a hash value in the dynamic link library information table that is the same as the hash value of the first dynamic link library.
[0027] According to a second aspect of this application, an application processing apparatus is provided, comprising:
[0028] The first dynamic link library acquisition module is used to acquire, in response to the application installation operation, the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed.
[0029] The information table query module is used to query whether the information of the first dynamic link library exists in the dynamic link library information table; wherein, the dynamic link library information table contains the mapping relationship between the dynamic link libraries stored in the system and their storage paths;
[0030] The hard link creation module is used to create a hard link from the installation path to the storage path of the first dynamic link library if the information of the first dynamic link library exists in the dynamic link library information table.
[0031] The dynamic link library copying module is used to copy the first dynamic link library to the installation path if the information of the first dynamic link library does not exist in the dynamic link library information table.
[0032] The dynamic link library information update module is used to add the mapping relationship between the first dynamic link library and the storage path to the dynamic link library information table.
[0033] In one optional implementation, the dynamic link library information table further includes the number of times the dynamic link libraries stored in the system have been used;
[0034] The device further includes:
[0035] The usage count update module is used to increment the usage count of the first dynamic link library by 1 after a hard link is established between the installation path and the storage path of the first dynamic link library.
[0036] The usage count setting module is used to set the usage count of the first dynamic link library to 1 after adding the mapping relationship between the first dynamic link library and the storage path in the dynamic link library information table.
[0037] In one alternative embodiment, the device further includes:
[0038] The second dynamic link library acquisition module is used to acquire all the second dynamic link libraries used by the application to be uninstalled in response to the application uninstallation operation.
[0039] The information table query module is also used to query the storage path and usage count of each second dynamic link library in the dynamic link library information table for each second dynamic link library;
[0040] The first uninstallation module is configured to retain the second dynamic link library, delete the directory where the second dynamic link library is located, and decrement the number of times the second dynamic link library is used in the dynamic link library information table if the number of times the second dynamic link library is used is greater than 1 and the storage path of the second dynamic link library is in the application directory of the application to be uninstalled.
[0041] The second uninstallation module is used to remove the hard link to the storage path of the second dynamic link library if the number of times the second dynamic link library is used is greater than 1 and the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, and to decrement the number of times the second dynamic link library is used in the dynamic link library information table by 1.
[0042] The third uninstallation module is used to delete the second dynamic link library and remove the information of the second dynamic link library from the dynamic link library information table if the number of uses is equal to 1.
[0043] In one alternative embodiment, the device further includes:
[0044] The third dynamic link library acquisition module is used to acquire the third dynamic link libraries in the installation packages of multiple system-built-in applications in response to ROM compilation operations.
[0045] The first compilation module is used to compile the same third dynamic link library into the system path if the third dynamic link libraries corresponding to the multiple system built-in applications contain the same third dynamic link library.
[0046] The second compilation module is used to compile, for each system-included application, the third dynamic link library (excluding the same third dynamic link library) in the corresponding third dynamic link library of the system-included application into the installation path of the third dynamic link library in the application directory of the system-included application, so as to generate a ROM package.
[0047] In one optional implementation, the dynamic link library information table includes: the hash values of the dynamic link libraries already stored in the system and the storage paths corresponding to the dynamic link libraries already stored in the system.
[0048] In one optional implementation, the information table query module is specifically used to query whether there is a hash value in the dynamic link library information table that is the same as the hash value of the first dynamic link library.
[0049] According to a third aspect of this application, an electronic device is provided, comprising: a processor configured to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the method described in the first aspect.
[0050] According to a fourth aspect of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0051] According to a fifth aspect of this application, a computer program product is provided that, when the computer program product is run on a computer, causes the computer to perform the method described in the first aspect.
[0052] The technical solution provided in this application has the following advantages compared with the prior art:
[0053] Because the Dynamic Link Library (DLL) information table contains a mapping between stored DLLs and their storage paths, during application installation, this table can be queried to confirm whether the system already contains the first DLL required for the application. If the table contains information about the first DLL, it means the system already has it, and a hard link can be created directly, avoiding storing the same DLL in different locations and saving storage space. Otherwise, the first DLL is stored in the appropriate directory, and a mapping between it and the storage path is added to the DLL information table. This way, when installing other applications, if those applications also use the first DLL, hard links can be created, avoiding duplicate storage. Consequently, when applications start, the same DLLs are loaded only once across different applications, instead of being loaded multiple times individually, saving memory and preventing lag due to insufficient memory, which negatively impacts user experience. Attached Figure Description
[0054] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0055] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 This is a schematic diagram illustrating an application scenario for the application processing method applicable to the embodiments of this application;
[0057] Figure 2 This is a flowchart of one application processing method in the embodiments of this application;
[0058] Figure 3 This is another flowchart illustrating the application of the processing method in the embodiments of this application;
[0059] Figure 4 This is another flowchart illustrating the application of the processing method in the embodiments of this application;
[0060] Figure 5 This is another flowchart illustrating the application of the processing method in the embodiments of this application;
[0061] Figure 6 This is a schematic diagram of the application processing device in one embodiment of this application;
[0062] Figure 7 This is a schematic diagram of the structure of an electronic device in an embodiment of this application. Detailed Implementation
[0063] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0064] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.
[0065] The development of the internet has brought convenience to people's work and life. Users can install various applications on electronic devices (such as smartphones, tablets, desktop computers, laptops, etc.) to meet their daily work and life needs.
[0066] like Figure 1 As shown, if a user wants to install application C, they can first obtain the installation package of application C, which typically contains multiple dynamic link libraries. Then, by clicking the "Install" button, application C will be installed on the smartphone. After installation, application C will have a corresponding directory containing the dynamic link libraries from its installation package.
[0067] Assuming that both application B and application C installed by the user integrate login account-related SDKs, the installation packages of application B and application C will contain the same dynamic link libraries. These identical dynamic link libraries will be stored twice, resulting in wasted storage space. If application B and application C are launched, the same dynamic link libraries will be loaded twice separately, consuming unnecessary memory.
[0068] To address the aforementioned problems, embodiments of this application provide an application processing method, apparatus, electronic device, storage medium, and program product to reduce memory and storage space requirements. The execution entity in these embodiments can be a service within the system. For example, in the Android system, the application processing procedure can be performed through the PackageManagerService service, including application installation and uninstallation.
[0069] See Figure 2 , Figure 2 This is a flowchart of an application processing method in an embodiment of this application, which may include the following steps:
[0070] Step S210: In response to the application installation operation, obtain the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed.
[0071] In this embodiment, the application to be installed can be any application the user wants to install. The format of the installation package differs across different operating systems. For example, on an Android system, the installation package is an APK (Android application package) file. On a Linux system, the installation package can be an RPM (Red Hat Package Manager) package, etc.
[0072] The first dynamic link library can be a dynamic link library in the installation package of the application to be installed. There can be one or more first dynamic link libraries. The processing procedure for multiple first dynamic link libraries is the same. Here, we will use one as an example for explanation.
[0073] Each application has its own application directory, and different directories can store different file contents. Typically, multiple dynamic link libraries (DLLs) can be stored in the same directory. The installation path of the first DLL within the application directory of the application to be installed is the path where the first DLL will be stored during application installation. For example, if the root directory of application 1 is app1, and all files related to application 1 are stored in app1, then if the installation path of DLL 1 is / data / app / app1 / lib / armeabi, then during application 1 installation, DLL 1 will be stored under the path / data / app / app1 / lib / armeabi.
[0074] Step S220: Query the dynamic link library information table to see if there is information about the first dynamic link library; wherein, the dynamic link library information table contains the mapping relationship between the dynamic link libraries stored in the system and their storage paths.
[0075] The dynamic link library information table is a pre-established table that records information about the dynamic link libraries currently stored in the system. Based on this table, the system can query the dynamic link libraries already stored and their corresponding storage paths. To avoid duplicate storage of the same dynamic link libraries used by different applications, this application queries the dynamic link library information table to confirm whether the first dynamic link library is already stored in the system.
[0076] If the dynamic link library information table contains information about the first dynamic link library, it means that the first dynamic link library has already been stored, and it is not necessary to store the first dynamic link library again; proceed to step S230. If the dynamic link library information table does not contain information about the first dynamic link library, it means that the first dynamic link library has not been stored, and step S240 can be executed to store the first dynamic link library.
[0077] Step S230: Create a hard link from the installation path to the storage path of the first dynamic link library.
[0078] In this embodiment, if the dynamic link library information table contains information about the first dynamic link library, it indicates that the first dynamic link library has already been stored in the system. Without duplicate storage, to enable the application to be installed to also use the first dynamic link library, a hard link to the storage path of the first dynamic link library can be created under the installation path of the first dynamic link library.
[0079] A hard link is an alias of another file within the same file system. A file can have multiple aliases, meaning it can have multiple hard links. Creating a hard link is equivalent to copying and renaming a file; reading, writing, or deleting one of the links will not affect the original file. Because hard link files are not physical files, they do not occupy storage space.
[0080] For example, the original first dynamic link library is xxx.so, and the installation path of the first dynamic link library is / data / app / app1 / lib / armeabi / . In existing technology, xxx.so needs to be copied to this path; this application can create...
[0081] A hard link from / data / app / app1 / lib / armeabi / xxx.so to the actual storage path of xxx.so. / data / app / app1 / lib / armeabi / xxx.so is a hard link file.
[0082] Step S240: Copy the first dynamic link library to the installation path and add the mapping relationship between the first dynamic link library and the storage path in the dynamic link library information table.
[0083] In this embodiment, if the first dynamic link library is not present in the dynamic link library information table, it indicates that the first dynamic link library is not currently stored in the system. In this case, the first dynamic link library can be copied to the installation path using existing methods. After copying, the first dynamic link library is now stored in the system, and therefore, the mapping relationship between the first dynamic link library and the storage path can be added to the dynamic link library information table. This way, when installing other applications subsequently, if those applications also use the same first dynamic link library, it will not need to be stored repeatedly, saving storage space. Since the same dynamic link library used by different applications is stored once, it only needs to be loaded once when different applications start, thus saving memory.
[0084] The application processing method in this embodiment of the application utilizes a dynamic link library (DLL) information table that contains a mapping relationship between DLLs already stored in the system and their storage paths. Therefore, when installing an application, the DLL information table can be queried to confirm whether the system already stores the first DLL required for the application to be installed. If the DLL information table contains information about the first DLL, it indicates that the system already stores the first DLL, and a hard link can be directly created, avoiding storing the same DLL in different locations within the system and saving storage space. Otherwise, the first DLL is stored in the corresponding directory, and a mapping relationship between the first DLL and its storage path is added to the DLL information table. This way, when installing other applications subsequently, if other applications also use the first DLL, a hard link can also be created, avoiding duplicate storage of the first DLL. Correspondingly, when an application starts, the same DLL is loaded only once across different applications, instead of being loaded multiple times individually, saving memory space and preventing lag due to insufficient memory, which could negatively impact the user experience.
[0085] See Figure 3 , Figure 3 This is another flowchart illustrating the application processing method in the embodiments of this application, which may include the following steps:
[0086] Step S310: In response to the application installation operation, obtain the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed.
[0087] This step and Figure 2 The steps in the embodiment S210 are the same; see below for details. Figure 2 The descriptions in the embodiments are sufficient and will not be repeated here.
[0088] Step S320: Query the dynamic link library information table to see if there is information about the first dynamic link library; wherein, the dynamic link library information table contains the storage path and usage count of the dynamic link libraries already stored in the system.
[0089] In this embodiment, the dynamic link library information table can be represented as a hash table. The dynamic link library information table may include: hash values (e.g., MD4, MD5 values, etc.) of the dynamic link libraries already stored in the system and the storage paths corresponding to the dynamic link libraries already stored in the system. The key value of the dynamic link library information table is the hash value of the dynamic link libraries already stored in the system, and the stored data is the storage path of the dynamic link libraries already stored in the system.
[0090] In addition to containing the storage paths of the dynamic link libraries (DLLs) already stored in the system, the dynamic link library information table can also contain the usage counts of these DLLs. In other words, the table can include a mapping between the DLLs stored in the system, their storage paths, and usage counts. In this case, the key of the table is the hash value of the DLL, and the stored data consists of the storage path and usage count of the DLL. The number of applications using the DLLs stored in the system can be determined based on the usage counts.
[0091] Accordingly, by querying the dynamic link library information table to see if there is a hash value identical to that of the first dynamic link library, it can be determined whether information about the first dynamic link library exists in the dynamic link library information table. Thus, even if two dynamic link libraries have different names but the same content, it can be correctly identified that the two dynamic link libraries are actually the same; and even if two dynamic link libraries have the same name but different content, it can be correctly identified that the two dynamic link libraries are actually different. Therefore, in this embodiment, "identical dynamic link libraries" refers to dynamic link libraries with identical content, while their names can be the same or different. If information about the first dynamic link library exists in the dynamic link library information table, step S330 can be executed; if information about the first dynamic link library does not exist in the dynamic link library information table, step S340 can be executed.
[0092] Step S330: Create a hard link from the installation path to the storage path of the first dynamic link library, and increment the usage count of the first dynamic link library by 1.
[0093] It is understandable that each time a hard link is established, it indicates that the usage count of the first dynamic link library increases by one. Therefore, the usage count of the first dynamic link library in the dynamic link library information table can be incremented by 1.
[0094] Step S340: Copy the first dynamic link library to the installation path, add the mapping relationship between the first dynamic link library and the storage path in the dynamic link library information table, and set the usage count of the first dynamic link library to 1.
[0095] Similarly, if the first dynamic link library is copied to the installation path, it means that the first dynamic link library is stored in the system for the first time. Therefore, while adding the mapping relationship between the first dynamic link library and the storage path in the dynamic link library information table, the number of times the first dynamic link library is used can be set to 1.
[0096] The application processing method in this application embodiment records the usage counts of stored dynamic link libraries in a dynamic link library information table, thus indicating the number of applications currently using the dynamic link library. Therefore, when uninstalling an application, the method can determine whether to delete the dynamic link library based on its usage count.
[0097] The following provides a detailed explanation of the application uninstallation process.
[0098] See Figure 4 , Figure 4 This is another flowchart illustrating the application processing method in the embodiments of this application, which may include the following steps:
[0099] Step S410: In response to the application uninstallation operation, obtain all the second dynamic link libraries used by the application to be uninstalled.
[0100] In this embodiment of the application, the user can also uninstall the application. After clicking "Uninstall", the user can obtain all the second dynamic link libraries used by the application to be uninstalled.
[0101] Step S420: For each second dynamic link library, query the dynamic link library information table to find the storage path and usage count of that second dynamic link library.
[0102] Similar to the application installation process, after obtaining the second dynamic link library (DLL), the storage path and usage count of that DLL are queried from the DLL information table. Unlike application installation, since the application to be uninstalled is already installed on the system, the second DLL is currently stored in the system, and the DLL information table contains its storage path and usage count. Therefore, the storage path and usage count of the second DLL can be directly queried here.
[0103] Step S430: Determine whether the number of times the second dynamic link library has been used is greater than 1.
[0104] As mentioned earlier, the number of applications currently using the second dynamic link library can be determined based on its usage count. If the usage count of the second dynamic link library is greater than 1, it means that other applications besides the application to be uninstalled are using the second dynamic link library, and the original file of the second dynamic link library cannot be deleted. Step S440 can be executed. If the usage count of the second dynamic link library is not greater than 1, i.e., equal to 1, it means that only the application to be uninstalled is using the second dynamic link library, and the second dynamic link library can be deleted directly. Step S470 can be executed.
[0105] Step S440: Determine whether the storage path of the second dynamic link library is in the application directory of the application to be uninstalled.
[0106] If the storage path of the second dynamic link library is in the application directory of the application to be uninstalled, proceed to step S450; if the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, proceed to step S460.
[0107] Step S450: Keep the second dynamic link library, delete the directory where the second dynamic link library is located, and decrement the number of times the second dynamic link library is used in the dynamic link library information table by 1.
[0108] If the storage path of the second dynamic link library is within the application directory of the application to be uninstalled, it means that the application to be uninstalled stored the second dynamic link library in the system. When the application to be uninstalled is uninstalled, since other applications are also using the second dynamic link library at this time, the second dynamic link library will not be deleted, but the directory containing the second dynamic link library will be deleted. The number of applications using the second dynamic link library is reduced by one, therefore, the usage count of the second dynamic link library in the dynamic link library information table is decremented by 1.
[0109] Step S460: Remove the hard link to the storage path of the second dynamic link library and decrement the usage count of the second dynamic link library in the dynamic link library information table by 1.
[0110] If the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, it means that the application to be uninstalled uses the second dynamic link library by creating a hard link. When uninstalling the application, simply remove the hard link. Similarly, decrement the usage count of the second dynamic link library in the dynamic link library information table by 1.
[0111] Step S470: Delete the second dynamic link library and remove the information of the second dynamic link library from the dynamic link library information table.
[0112] After deleting the second dynamic link library, it means that the second dynamic link library is no longer stored in the system. Therefore, the information of the second dynamic link library can be deleted from the dynamic link library information table.
[0113] As can be seen, by recording the storage path and usage count of the stored dynamic link libraries in the dynamic link library information table, the uninstallation operation can be performed based on the storage path and usage count when uninstalling the application. This prevents other applications from becoming unusable if they use the second dynamic link library; and it allows the second dynamic link library to be deleted if it is not used by other applications to avoid occupying storage space.
[0114] See Figure 5 , Figure 5 This is another flowchart illustrating the application processing method in the embodiments of this application, which may include the following steps:
[0115] Step S510: In response to the ROM compilation operation, obtain the third dynamic link library from the installation packages of multiple system-built-in applications.
[0116] When generating a ROM package, several applications are usually included pre-installed in the system, allowing users to use them directly after booting up without needing to install them. Similar to the manual installation process, the ROM compilation stage can also extract third-party dynamic link libraries from the installation packages of these pre-installed system applications.
[0117] Step S520: If multiple system-provided applications have the same third dynamic link library in their corresponding third dynamic link libraries, compile the same third dynamic link library to the system path.
[0118] When multiple system-provided applications contain the same third-party dynamic link library, to avoid duplicate storage, this identical third-party dynamic link library can be compiled into the system path. This way, multiple system-provided applications can all use the same third-party dynamic link library.
[0119] Step S530: For each system-provided application, compile the third dynamic link libraries (excluding the same third dynamic link libraries) in the third dynamic link library corresponding to the system-provided application into the installation path of the third dynamic link library in the application directory of the system-provided application to generate a ROM package.
[0120] For third-party dynamic link libraries other than the same ones, they can be copied to the corresponding installation path using the existing methods. Through these two different compilation methods, a ROM package is ultimately generated.
[0121] The application processing method of this application embodiment can compile the same dynamic link libraries used by different applications into the system path once during the ROM compilation stage, avoiding repeated compilation of the same dynamic link libraries, thereby saving memory and storage space.
[0122] Corresponding to the above method embodiments, this application embodiment also provides an application processing device, see [link to relevant documentation]. Figure 6 The application processing device 600 includes:
[0123] The first dynamic link library acquisition module 610 is used to acquire the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed, in response to the application installation operation.
[0124] The information table query module 620 is used to query whether the information of the first dynamic link library exists in the dynamic link library information table; wherein, the dynamic link library information table contains the storage paths corresponding to the dynamic link libraries already stored in the system;
[0125] The hard link creation module 630 is used to create a hard link from the installation path to the storage path of the first dynamic link library if the information of the first dynamic link library exists in the dynamic link library information table.
[0126] The dynamic link library copy module 640 is used to copy the first dynamic link library to the installation path if the information of the first dynamic link library is not found in the dynamic link library information table.
[0127] The dynamic link library information update module 650 is used to add the mapping relationship between the first dynamic link library and the storage path in the dynamic link library information table.
[0128] In one optional implementation, the dynamic link library information table also includes the number of times the dynamic link libraries stored in the system have been used.
[0129] The aforementioned application processing device 600 further includes:
[0130] The usage count update module is used to increment the usage count of the first dynamic link library by 1 after a hard link is created from the installation path to the storage path of the first dynamic link library.
[0131] The usage count setting module is used to add the mapping relationship between the first dynamic link library and the storage path to the dynamic link library information table, and then set the usage count of the first dynamic link library to 1.
[0132] In an optional embodiment, the application processing device 600 further includes:
[0133] The second dynamic link library acquisition module is used to acquire all the second dynamic link libraries used by the application to be uninstalled in response to the application uninstallation operation.
[0134] The information table query module is also used to query the storage path and usage count of each second dynamic link library in the dynamic link library information table;
[0135] The first uninstallation module is used to retain the second dynamic link library, delete the directory where the second dynamic link library is located, and decrement the number of times the second dynamic link library is used in the dynamic link library information table if the number of times the second dynamic link library is used is greater than 1 and the storage path of the second dynamic link library is in the application directory of the application to be uninstalled.
[0136] The second uninstallation module is used to remove the hard link to the storage path of the second dynamic link library if the number of times the second dynamic link library is used is greater than 1 and the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, and to decrement the number of times the second dynamic link library is used in the dynamic link library information table by 1.
[0137] The third uninstallation module is used to delete the second dynamic link library if the number of uses is equal to 1, and to delete the information of the second dynamic link library from the dynamic link library information table.
[0138] In an optional embodiment, the application processing device 600 further includes:
[0139] The third dynamic link library acquisition module is used to acquire the third dynamic link libraries in the installation packages of multiple system-built-in applications in response to the read-only memory image ROM compilation operation.
[0140] The first compilation module is used to compile the same third dynamic link library into the system path if multiple system-built-in applications have the same third dynamic link library.
[0141] The second compilation module is used to compile, for each system-provided application, all the third dynamic link libraries (excluding the same third dynamic link libraries) in the corresponding third dynamic link library of the system-provided application into the installation path of the third dynamic link library in the application directory of the system-provided application, so as to generate a ROM package.
[0142] In one optional implementation, the dynamic link library information table includes: the hash values of the dynamic link libraries already stored in the system and the storage paths corresponding to the dynamic link libraries already stored in the system.
[0143] In one optional implementation, the information table query module is specifically used to query whether there is a hash value in the dynamic link library information table that is the same as the hash value of the first dynamic link library.
[0144] The specific details of each module or unit in the above-mentioned device have been described in detail in the corresponding methods, so they will not be repeated here.
[0145] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0146] In an exemplary embodiment of this application, an electronic device is also provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the application processing method described in this example embodiment.
[0147] Figure 7This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. It should be noted that... Figure 7 The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0148] like Figure 7 As shown, the electronic device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on a program stored in a read-only memory (ROM) 702 or a program loaded from a storage section 708 into a random access memory (RAM) 703. The RAM 703 also stores various programs and data required for system operation. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0149] The following components are connected to I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a local area network (LAN) card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 710 as needed so that computer programs read from it can be installed into storage section 708 as needed.
[0150] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit 701, it performs the various functions defined in the apparatus of this application.
[0151] In this embodiment of the application, a computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, it implements the above-described application processing method.
[0152] It should be noted that the computer-readable storage medium shown in this application can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.
[0153] In this embodiment of the application, a computer program product is also provided, which, when run on a computer, causes the computer to execute the above-described application processing method.
[0154] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0155] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An application processing method, characterized in that, The method includes: In response to the application installation operation, the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed are obtained. Check if the information of the first dynamic link library exists in the dynamic link library information table; wherein, the dynamic link library information table contains the mapping relationship between the dynamic link libraries stored in the system and their storage paths; If the information of the first dynamic link library exists in the dynamic link library information table, a hard link is established from the installation path to the storage path of the first dynamic link library. If the information of the first dynamic link library does not exist in the dynamic link library information table, the first dynamic link library is copied to the installation path, and a mapping relationship between the first dynamic link library and the storage path is added to the dynamic link library information table.
2. The method according to claim 1, characterized in that, The dynamic link library information table also includes the number of times the dynamic link libraries stored in the system have been used; The method further includes: After establishing a hard link from the installation path to the storage path of the first dynamic link library, increment the usage count of the first dynamic link library by 1; or, After adding the mapping relationship between the first dynamic link library and the storage path to the dynamic link library information table, the usage count of the first dynamic link library is set to 1.
3. The method according to claim 2, characterized in that, The method further includes: In response to an application uninstallation operation, obtain all secondary dynamic link libraries used by the application to be uninstalled; For each second dynamic link library, query the storage path and usage count of that second dynamic link library in the dynamic link library information table; If the second dynamic link library is used more than once, and the storage path of the second dynamic link library is in the application directory of the application to be uninstalled, the second dynamic link library is retained, the directory where the second dynamic link library is located is deleted, and the number of times the second dynamic link library is used in the dynamic link library information table is reduced by 1. If the second dynamic link library is used more than once, and the storage path of the second dynamic link library is not in the application directory of the application to be uninstalled, the hard link to the storage path of the second dynamic link library will be removed, and the number of times the second dynamic link library is used in the dynamic link library information table will be decremented by 1. If the number of uses equals 1, delete the second dynamic link library and remove the information of the second dynamic link library from the dynamic link library information table.
4. The method according to claim 1, characterized in that, Before obtaining the first dynamic link library from the installation package of the application to be installed, the method further includes: In response to the read-only memory image ROM compilation operation, obtain the third-party dynamic link libraries from the installation packages of multiple system-built-in applications; If the third dynamic link libraries corresponding to the multiple system-built-in applications contain the same third dynamic link library, compile the same third dynamic link library into the system path; For each system-provided application, the third dynamic link libraries (excluding the same third dynamic link libraries) in the corresponding third dynamic link library of the system-provided application are compiled into the installation path of the third dynamic link library in the application directory of the system-provided application to generate a ROM package.
5. The method according to claim 1, characterized in that, The dynamic link library information table includes: the hash values of the dynamic link libraries already stored in the system and the storage paths corresponding to the dynamic link libraries already stored in the system.
6. The method according to claim 5, characterized in that, The query to see if the dynamic link library information table contains information about the first dynamic link library includes: Check if there exists a hash value in the dynamic link library information table that is the same as the hash value of the first dynamic link library.
7. An application processing device, characterized in that, The device includes: The first dynamic link library acquisition module is used to acquire, in response to the application installation operation, the first dynamic link library in the installation package of the application to be installed, and the installation path of the first dynamic link library in the application directory of the application to be installed. The information table query module is used to query whether the information of the first dynamic link library exists in the dynamic link library information table; wherein, the dynamic link library information table contains the mapping relationship between the dynamic link libraries stored in the system and their storage paths; The hard link creation module is used to create a hard link from the installation path to the storage path of the first dynamic link library if the information of the first dynamic link library exists in the dynamic link library information table. The dynamic link library copying module is used to copy the first dynamic link library to the installation path if the information of the first dynamic link library does not exist in the dynamic link library information table. The dynamic link library information update module is used to add the mapping relationship between the first dynamic link library and the storage path to the dynamic link library information table.
8. An electronic device, characterized in that, include: A processor for executing a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.
10. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the steps of the method according to any one of claims 1-6.