Plug-in loading method and information processing method and device for plug-in loading
By establishing mapping information between component classes and plug-ins in the application, and monitoring component startup, querying and loading corresponding plug-ins when the application is running, the problem of plug-in loading in the existing technology is solved, and the rapid reloading of plug-ins and the improvement of application startup efficiency is achieved.
Patent Information
- Application Number
- CN202411673581.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
AI Technical Summary
During the restart process of an application, the existing technology needs to traverse the class loader, which causes the plug-in loading process to take a long time and affects the startup efficiency of the application.
Through pre-set mapping information, a mapping relationship between the component's class and the plug-in is established. During the application running, the startup information of the specified component is monitored, and the corresponding plug-in is queried and loaded into memory.
It realizes fast reloading of plug-ins in the application, avoids class loading traversal, and improves plug-in reloading efficiency when the application restarts.
Smart Images

Figure CN119621175A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a plug-in loading method, and an information processing method and device for plug-in loading. Background Art
[0002] During the application development process, developers can develop plug-ins for the application to extend the functionality of the application.
[0003] During the restart of an application containing a plug-in, the plug-ins related to the application also need to be reloaded to ensure the normal operation of each functional module. In the related art, developers can inject a custom class loader into the class loader, rewrite the class loading method in the custom class loader, and try to reload the plug-in through the custom class loader when a plug-in loading exception occurs.
[0004] However, since a class loader is re-customized in the related art, the class loading will be traversed again each time the plug-in is loaded, which increases unnecessary time consumption during the restart process of the application. Summary of the invention
[0005] The embodiment of the present application provides a plug-in loading method, an information processing method and a device for plug-in loading, which can realize the rapid reloading of plug-ins in an application program; the technical solution proposed in the present application is as follows:
[0006] According to one aspect of an embodiment of the present application, a plug-in loading method is provided, the method comprising:
[0007] During the running of the application, the startup information of a specified component in the operating system is obtained; the specified component is a component related to plug-in reloading;
[0008] Obtaining an identifier of a startup class according to the startup information; the startup class is a class for starting the specified component this time;
[0009] According to the identifier of the startup class, searching the preset mapping information for a first plug-in in the application corresponding to the startup class;
[0010] The first plug-in found is loaded into the memory.
[0011] According to one aspect of an embodiment of the present application, a method for processing information for plug-in loading is provided, the method comprising:
[0012] During the compilation of the plug-in of the application, scanning the code logic of the plug-in;
[0013] In the case where it is scanned that the inherited object in the plug-in is a class of a specified component, obtaining the identifier of the class that inherits the specified component; the specified component is a component related to plug-in reloading;
[0014] Adding a mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information;
[0015] The mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
[0016] According to one aspect of an embodiment of the present application, a plug-in loading device is provided, the device comprising:
[0017] An information acquisition module, used to acquire startup information of a specified component in the operating system during the running of the application; the specified component is a component related to plug-in reloading;
[0018] An identification acquisition module, used to acquire an identification of a startup class according to the startup information; the startup class is a class for starting the specified component this time;
[0019] A plug-in query module, configured to query the first plug-in corresponding to the startup class in the application program in preset mapping information according to the identifier of the startup class;
[0020] The plug-in loading module is used to load the first plug-in found by the query into the memory.
[0021] In some embodiments, the mapping information stores a mapping relationship between an identifier of a plug-in in the application and an identifier of a class in the plug-in that inherits the specified component;
[0022] The plug-in query module is used to query the mapping information for an identifier of the plug-in that has a mapping relationship with the identifier of the startup class, as the identifier of the first plug-in.
[0023] In some embodiments, the plug-in loading module is used to query the file path of the first plug-in according to the identifier of the first plug-in;
[0024] The plug-in loading module is used to call the interface of the hot repair tool and pass the file path of the first plug-in to the hot repair tool so that the hot repair tool loads the first plug-in into the memory.
[0025] In some embodiments, the information acquisition module is used to receive a first monitoring message to the component management class during the running of the application, wherein the first monitoring message is used to instruct the component management class to start the behavior of the specified component;
[0026] The information acquisition module is used to acquire the first monitoring message as the startup information.
[0027] In some embodiments, the information acquisition module is used to receive a second monitoring message of the component management class during the running of the application, and the second monitoring message is used to indicate the management behavior of the component management class on the system component; the specified component is all or part of the system components;
[0028] The information acquisition module is used to acquire the second monitoring message as the startup information when the management behavior indicated by the second monitoring message is a behavior of starting the designated component.
[0029] In some embodiments, the identification acquisition module is used to obtain the identification of the startup class carried in the startup information.
[0030] According to one aspect of an embodiment of the present application, there is provided an information processing device for plug-in loading, the device comprising:
[0031] A scanning module, used to scan the code logic of the plug-in during the compilation process of the plug-in of the application;
[0032] an acquisition module, configured to acquire the identifier of the class that inherits the specified component when the inherited object in the plug-in is found to be a class of a specified component; the specified component is a component related to plug-in reloading;
[0033] An adding module, used for adding a mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information;
[0034] The mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
[0035] In some embodiments, the scanning module is used to scan the code of the inherited object of the class in the plug-in;
[0036] The scanning module is used to determine the currently scanned class as the class whose inheritance object is the designated component when the code of the inheritance object contains keywords matching the designated component.
[0037] In some embodiments, the scanning module is used to scan the code of the inherited object of the class in the plug-in by means of instrumentation.
[0038] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned plug-in loading method and the information processing method for plug-in loading.
[0039] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned plug-in loading method and the information processing method for plug-in loading.
[0040] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being loaded and executed by a processor to implement the above-mentioned plug-in loading method and the information processing method for plug-in loading.
[0041] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:
[0042] A mapping relationship between a class and a plug-in is established through pre-set mapping information; thereafter, during the running of the application, when the startup of a designated component related to plug-in reloading (such as the four major components of the Android system) is monitored, the plug-in corresponding to the class of the designated component started this time in the above mapping information is queried; if the corresponding plug-in can be found, it is determined that the plug-in needs to be reloaded, and the queried plug-in can be loaded into the memory at this time; the above scheme of the present application flexibly loads plug-ins by pre-setting mapping information and monitoring component startup, without traversing class loading, and can load plug-ins related to the started component in a timely manner, thereby realizing rapid reloading of plug-ins in the application and improving the efficiency of plug-in reloading when the application is restarted. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0045] Figure 2is a flow chart of a plug-in loading method provided by an exemplary embodiment of the present application;
[0046] Figure 3 is a flowchart of an information processing method for plug-in loading provided by an exemplary embodiment of the present application;
[0047] Figure 4 is a schematic diagram of establishing and applying mapping information provided by an exemplary embodiment of the present application;
[0048] Figure 5 is a flowchart of a method for reloading a plug-in after a process restart provided by an exemplary embodiment of the present application;
[0049] Figure 6 is a flowchart of a method for reloading a plug-in after a process restart provided by an exemplary embodiment of the present application;
[0050] Figure 7 is a block diagram of a plug-in loading device provided by an exemplary embodiment of the present application;
[0051] Figure 8 is a block diagram of an information processing device for plug-in loading provided by an exemplary embodiment of the present application;
[0052] Fig. 9 It is a structural block diagram of a computer device provided by an embodiment of the present application.
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0055] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0056] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0057] It should be understood that although the terms first, second, etc. may be used in the present disclosure to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first listening message may also be referred to as the second listening message, and similarly, the second listening message may also be referred to as the first listening message. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0058] First, several terms involved in this application are introduced and explained:
[0059] 1) Plugin: A small independent module that extends the functionality of an application. Plugins usually follow the interface specifications defined by the application and can be dynamically loaded and unloaded to enhance or modify the behavior of the application. Plugins can flexibly add new features without recompiling or reinstalling the entire application.
[0060] 2) Class: It is the basis for information encapsulation in object-oriented programming (OOP). A class is a user-defined reference data type, also known as a class type. Each class contains a data description and a set of functions that operate on data or pass messages. An instance of a class is called an object.
[0061] 3) Classloader: It is a core component of the Java Virtual Machine (JVM) and is responsible for loading class files at runtime. It is used to load classes (such as compiled .class files) into the JVM so that these classes can be recognized and used by the JVM.
[0062] 4) Application Not Responding (ANR): The Android system requires some events to be completed within a certain time frame. If there is still no effective response after the scheduled time or the response time is too long, ANR will occur.
[0063] 5) Key-Value Pair: A data structure used to store and identify two related data. In a key-value pair, each key is associated with a value. The key is unique and is used to quickly find the corresponding value. In other words, a value is associated with a unique key, and the corresponding value can be quickly accessed and obtained through the key.
[0064] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present application. Figure 1 As shown, the implementation environment may include: a development terminal device 110, a user terminal device 120, and a server 130. The development terminal device 110 and the server 130, and the user terminal device 120 and the server 130 may communicate with each other through a network.
[0065] The development terminal device 110 can provide an application development environment. Optionally, the above-mentioned application can be a mobile application, a desktop application, a Web application, a video application, an animation application, a social application, a virtual reality application, an augmented reality application, etc. The specific category of the application is not limited in the embodiment of the present application.
[0066] Exemplarily, after completing the development, testing, and packaging of the application, the developer may upload the installation package of the application to the server 130. The user may run the application on the user terminal device 120 by downloading the installation package from the server 130.
[0067] The user terminal device 120 may be a mobile phone, tablet computer, laptop computer, desktop computer, game console, e-book reader, multimedia player, wearable device, smart TV, vehicle-mounted terminal, etc. The specific category of the user terminal device is not limited in the present application embodiment. Taking a mobile phone as an example, a client running the above application program is developed in the terminal device 110, and the icon of the application program is displayed in the display interface of the mobile phone.
[0068] The server 130 is used to provide background services for the client of the application installed and running in the user terminal device 120. The server 130 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center. Optionally, the server 130 provides background services for the client of the application in multiple user terminal devices 120 at the same time.
[0069] In the development process of the above application, in order to enhance the scalability, flexibility and maintainability of the application, the developer can split one or more functional modules in the application into independent plug-ins. An application can contain one or more plug-ins. Each plug-in provides specific functions or features and can be dynamically loaded and used in an application, making the application easier to expand. Plug-ins can be added or deleted as needed without modifying the code of the entire application.
[0070] For example, the installation package of the application may include plug-in 1, plug-in 2, etc. For example, plug-in 1 may provide additional text editing functions, such as spelling check, grammar check, etc.; plug-in 2 may provide a theme switching function, allowing the user to change the appearance and style of the application.
[0071] Among them, during the restart of the application containing the plug-in, the plug-in related to the application also needs to be reloaded to ensure the normal operation of each functional module. Therefore, the ability to dynamically load and manage plug-ins is very important, which not only improves the flexibility of the application, but also simplifies the maintenance and upgrade process.
[0072] In an embodiment of the present application, the development terminal device 110 can be used to implement an information processing method for plug-in loading. Exemplarily, during the compilation of the plug-in of the application, the development terminal device 110 can scan the code logic of the plug-in; when the inherited object in the scanned plug-in is a class of a specified component, the development terminal device 110 can obtain the identifier of the class that inherits the specified component; the development terminal device 110 can add the mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information; wherein the mapping information is used to obtain the startup information of the specified component during the operation of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
[0073] In the embodiment of the present application, the user terminal device 120 can be used to implement the plug-in loading method. Exemplarily, the user terminal device 120 can be an electronic device based on the Android operating system; during the running of the application, the user terminal device 120 can obtain the startup information of the four basic components in the operating system; then, the user terminal device 120 can obtain the identification of the startup class according to the startup information; the startup class is the class of the four basic components started this time; then, the user terminal device 120 can query the first plug-in corresponding to the startup class in the application according to the identification of the startup class in the pre-set mapping information; then, the user terminal device 120 can load the queried first plug-in into the memory.
[0074] In a plug-in loading scheme involved in the present application, a custom ClassLoader can be injected into the class loader (ClassLoader), and the class loading method can be rewritten in the custom ClassLoader to capture and process the exceptions in the class loading process. When an exception occurs during the class loading process, the custom ClassLoader will try to reload the class to restore the normal operation of the program. The above scheme can indeed improve the robustness of the program to a certain extent, and prevent the entire program from crashing due to the failure of a single class loading.
[0075] However, this method in the above scheme also has obvious disadvantages. First, when a class loading exception occurs, by catching the exception and trying to reload the class, the application may be in a non-responsive state for a long time, that is, the ANR phenomenon. This is because the process of reloading the class may be very time-consuming, especially when the class dependencies are complex and multiple classes need to be reloaded, which will undoubtedly increase the burden on the system and cause performance problems.
[0076] In addition, since a custom ClassLoader needs to be injected into the ClassLoader in advance, this means that all class loading requests will go through this custom ClassLoader. Even if some class loading requests do not require special fault tolerance processing, they will be processed by this custom ClassLoader, which not only increases the delay of class loading, but also may cause unnecessary performance overhead. For example, in a large application, if each class loading needs to go through a custom ClassLoader, then even normal class loading will be affected, resulting in a decrease in the performance of the entire application.
[0077] Based on this, the subsequent embodiments of this application provide a new information processing method for plug-in loading and a method for implementing plug-in loading. Through this method, developers do not need to pre-inject custom ClassLoader in advance, and can monitor when one of the four basic components pulls up the plug-in after the process is restarted, and automatically load the plug-in into the memory to prevent crashes caused by loading failures.
[0078] Please refer to Figure 2 , which shows a flow chart of a plug-in loading method provided by an exemplary embodiment of the present application. The execution subject of each step of the method may be a computer device, and the computer device may be any electronic device with data storage and processing capabilities. Optionally, the computer device may also be Figure 1 The user terminal device 20 in the system shown. Figure 2 As shown, the method may include steps 210 to 240.
[0079] Step 210: During the running of the application, the startup information of the designated component in the operating system is obtained; the designated component is a component related to the plug-in reloading.
[0080] In the embodiment of the present application, the operating system is an Android operating system, that is, the application is an application running on the basis of the Android operating system.
[0081] Accordingly, the above-mentioned specified components can be one or more of the four basic components of Android. Each component in the Android system has its specific role and life cycle, and works together to achieve complex functions. Among them, the four basic components of Android include:
[0082] Activity: It is a visual interface for user operations, used to provide users with a window to complete operation instructions, that is, it is responsible for the display and interaction of the user interface;
[0083] Service: used to perform long-running operations in the background, such as tasks that do not require user interaction but still need to run for a long time, such as downloading files, playing music, etc.
[0084] BroadcastReceiver: used to receive broadcast messages from the system or other applications, and perform corresponding operations as needed, such as starting Activity, displaying notifications, etc.;
[0085] Content Provider: It can provide a standard data access method for sharing data between multiple applications. For example, the address book data is used by multiple applications and must be stored in a ContentProvider.
[0086] The startup information of the specified component may be information related to one or more of the four basic components of Android being gradually started. For example, the startup information may include information related to the class that starts the specified component.
[0087] For example, in order to obtain the startup information of the four basic components of Android, the computer device (such as the above application running in the computer device) can add corresponding codes in the life cycle callback methods of the four basic components of Android, and obtain the relevant information when the four basic components of Android are started through the corresponding codes. For example:
[0088] For Activity: you can add code in methods such as onCreate(), onStart(), and onResume();
[0089] For Service: you can add code to methods such as onCreate() and onStartCommand();
[0090] For BroadcastReceiver: you can add code in the onReceive() method;
[0091] For ContentProvider: You can add code in the onCreate() method.
[0092] Step 220: Obtain the identifier of the startup class according to the startup information; the startup class is the class of the specified component to be started this time.
[0093] Among them, the identifier of the above-mentioned startup class can include one or more of a string, an integer, a unique identification number (IdentityDocument, ID), a class name, or other identifiers, which are not limited in this application.
[0094] For example, in the life cycle methods of the four basic components of Android, the currently started class can be directly obtained.
[0095] Step 230: According to the identifier of the startup class, search the preset mapping information for the first plug-in in the application corresponding to the startup class.
[0096] The mapping information is used to indicate the corresponding relationship between the startup class and the plug-in in the application program. By querying the mapping information, the plug-in corresponding to the startup class can be quickly found.
[0097] The above mapping information may be information pre-set by developers during the compilation process of the application.
[0098] For example, the above mapping information may be a data structure composed of multiple key-value pairs, wherein the key corresponds to the class identifier and the value corresponds to the plug-in name information, such as the path or name of the plug-in.
[0099] Optionally, the above mapping information may be loaded into the memory when the application is started; or, the above mapping information may be dynamically loaded from a configuration file or a database when needed.
[0100] Step 240: Load the first plug-in found in the search into the memory.
[0101] Exemplarily, the application program in the computer device may load the first plug-in into the memory by using a dynamic loading technology, for example, DexClassLoader or PathClassLoader may be used to load the plug-in file of the first plug-in into the memory.
[0102] After the plugin is loaded, the classes in the plugin can be instantiated and used by the application.
[0103] To summarize, the technical solution provided in the embodiment of the present application establishes a mapping relationship between a component class and a plug-in through pre-set mapping information; thereafter, during the running of the application, when monitoring the startup of a designated component related to plug-in reloading (such as the four major components of the Android system), query the above mapping information for the plug-in corresponding to the class of the designated component started this time. If the corresponding plug-in can be queried, it is determined that the plug-in needs to be reloaded, and the queried plug-in can be loaded into the memory at this time; the above solution of the present application flexibly loads plug-ins by pre-setting mapping information and monitoring component startup. There is no need to traverse class loading, and plug-ins related to the started component can be loaded in a timely manner, thereby achieving rapid reloading of plug-ins in the application and improving the efficiency of plug-in reloading when the application is restarted.
[0104] Based on the above Figure 2 In the solution of the embodiment shown, in a possible implementation manner, the mapping information stores a mapping relationship between the identifier of the plug-in in the application and the identifier of the class that inherits the specified component in the plug-in; the above step 230 can be implemented as follows:
[0105] The mapping information is searched for an identifier of a plug-in that has a mapping relationship with the identifier of the startup class, and the identifier is used as the identifier of the first plug-in.
[0106] Exemplarily, the plug-in identifier may include one or more of a string, an integer, an ID, a file path, or a URL, or other identifiers, which are not limited in this application. Among them, the file path or the Uniform Resource Locator (URL) may directly point to the storage location of the plug-in, facilitating dynamic loading.
[0107] The class that inherits the specified component in the above plug-in indicates that the inheritance object of the plug-in class is one or more of the four basic components of Android.
[0108] An embodiment of the present application provides information content stored in mapping information. Specifically, the above-mentioned mapping information can be a mapping relationship between two identifiers, one identifier is the identifier of a plug-in in an application, and the other is the identifier of a class in the plug-in that inherits a specified component.
[0109] In the process of querying the first plug-in, the identifier of the startup class can be compared with the identifier of the class in the mapping relationship, and the identifier of the class that is the same as the identifier of the startup class can be found in the mapping information, and the identifier of the plug-in corresponding to the identifier of the class can be used as the identifier of the first plug-in; then, the application in the computer device can obtain the first plug-in according to the identifier of the first plug-in. Therefore, this solution can accurately find the identifier of the plug-in corresponding to the startup class, and can improve the accuracy of determining the first plug-in.
[0110] Based on the solutions in the above embodiments of the present application, in a possible implementation, the above step 240 can be implemented as step 240a and step 240b.
[0111] Step 240a: Query the file path of the first plug-in according to the identifier of the first plug-in.
[0112] The computer device stores a plug-in associated with the application program. Therefore, in the scenario of loading the first plug-in, the application program in the computer device needs to obtain the file path of the first plug-in.
[0113] The plug-in can be an APK file or a DEX file. For example, when the computer device is a mobile phone, the mobile phone has downloaded and stored the plug-in associated with the application from the server when the application is installed. For example, the plug-in can be stored in the mobile phone's memory card (Secure Digital Card, SD card), and the file path of the plug-in can be / sdcard / your_app_directory / .
[0114] Exemplarily, a mapping table may be stored in the memory of the computer device, and the mapping table stores the correspondence between the plug-in identifier and the plug-in file path. Accordingly, the application in the computer device may query the file path corresponding to the first plug-in identifier in the above mapping table according to the first plug-in identifier. Exemplarily, the mapping table may be a hash table.
[0115] Step 240b: Call the interface of the hot repair tool and pass the file path of the first plug-in to the hot repair tool so that the hot repair tool loads the first plug-in into the memory.
[0116] Optionally, the above-mentioned hot repair tool is an execution tool of a hot repair solution for an Android application, which can repair errors that occur in the application without restarting the application.
[0117] The above-mentioned hot repair tool may provide a specified application programming interface (Application Programming Interface, API) for processing the loading of the plug-in.
[0118] In the embodiment of the present application, once the file path of the first plug-in is found, the application program in the computer device can load the first plug-in into the memory through the API of the hot repair tool.
[0119] Through the technical solution provided in the embodiment of the present application, the application in the computer device can find the corresponding file path according to the identifier of the first plug-in, and then load the first plug-in through any hot repair tool; compared with the class loader, the hot repair tool can dynamically load DEX files to hot repair the code logic. Therefore, this solution can avoid ANR during the operation of the application.
[0120] Based on the solutions in the above embodiments of the present application, in a possible implementation, the above step 210 can be implemented as step 210a1 and step 210a2.
[0121] Step 210a1: During the running of the application, a first monitoring message to the component management class is received, where the first monitoring message is used to instruct the component management class to start the behavior of a specified component.
[0122] The component management class may be a class in the Android framework, which is used to manage the four basic components of Android. For example, the component management class may be AppComponentFactory, which creates and manages component instances of an application through a factory mode.
[0123] Each component has its own life cycle. For example, the life cycle of an Activity includes creation, startup, operation, and destruction. The above component management class can be used to manage the life cycle of the four basic components of Android to ensure that the components can correctly perform the corresponding operations at each stage, thereby improving the stability and performance of the application.
[0124] During the running of the application, the application in the computer device can obtain whether the specified component is started by monitoring whether the above-mentioned component management class starts the specified component. For example, taking the above-mentioned specified component as an Activity component, the application pre-registers with AppComponentFactory to monitor the start event of the Activity component. When AppComponentFactory starts the Activity component, it returns a first monitoring message to the application, and the first monitoring message is used to indicate whether a certain class starts the Activity component.
[0125] Step 210a2: Acquire the first monitoring message as the startup information.
[0126] The application in the computer device can determine to obtain the above startup information by monitoring whether the above component management class starts the specified component when one or more of the four basic components of Android have startup behavior.
[0127] Through the technical solution provided in the embodiment of the present application, by monitoring whether the above-mentioned component management class starts the specified component, the application in the computer device can obtain the startup information of the specified component in a timely manner, thereby improving the efficiency and accuracy of obtaining the startup status of the specified component, thereby improving the efficiency and accuracy of plug-in loading.
[0128] Based on the solutions in the above-mentioned embodiments of the present application, in a possible implementation manner, the above-mentioned step 210 can be implemented as step 210b1 and step 210b2.
[0129] Step 210b1: During the running of the application, a second monitoring message for the component management class is received, where the second monitoring message is used to indicate the management behavior of the component management class on the system components; the specified component is all or part of the system components.
[0130] In an embodiment of the present application, the above-mentioned system components may be the main functional components in the operating system, and the above-mentioned designated components may be all or part of the system components; for example, taking the Android system as an example, the above-mentioned system components may be the four major components in the Android system, and the designated components may be all or part of the four major components in the Android system.
[0131] The above management behaviors may include creation, startup, operation, and destruction of system components.
[0132] In the embodiment of the present application, the application in the computer device can monitor the management behavior of the above-mentioned component management class on the system components. For example, taking the Android system as an example, assuming that the specified component is an Activity component, the application in the computer device can monitor all the events corresponding to the management behaviors such as creation, startup, operation, and destruction of the four major components.
[0133] Step 210b2: When the management behavior indicated by the second monitoring message is a behavior of starting a specified component, the second monitoring message is obtained as the start information.
[0134] When a second monitoring message indicating the management behavior of the above-mentioned component management class on the system component is obtained, the application in the computer device can determine whether the management behavior corresponding to the second monitoring message is to start one or more specified ones of the four basic components of Android (i.e., the above-mentioned specified components); if the management behavior is to start one or more specified ones of the four basic components of Android, the application in the computer device can determine that the monitored second monitoring message is the startup information that needs to be obtained.
[0135] Through the technical solution provided in the embodiment of the present application, by fully monitoring the management behavior of the above-mentioned component management class on the system components, the application in the computer device can filter out the startup information of the specified component from the management behavior of the component management class on the system components, thereby executing the process of filtering the startup information of the specified component on the application side, reducing the complexity of the processing logic of the component management class and ensuring the smoothness of operation at the operating system level.
[0136] Based on the solutions in the above embodiments of the present application, in a possible implementation manner, the above step 220 can be implemented as follows:
[0137] Get the ID of the startup class carried in the startup information.
[0138] After obtaining the startup information of the designated component, the application in the computer device can parse the startup information to obtain the identifier of the startup class.
[0139] That is to say, the above startup information may include the identifier of the startup class.
[0140] In an embodiment of the present application, after the application registers a listener with the component management class, when the specified component or system component is started, the component management class can directly carry the identifier of the class that starts the specified component or system component in the startup information and return it to the application. The application does not need to separately obtain the identifier of the class that starts the specified component; therefore, this solution can simplify the process of obtaining the identifier of the startup class and can shorten the overall time consumption of plug-in loading.
[0141] The mapping information involved in the above-mentioned embodiments of the present application can be generated during the compilation process of the application program / plug-in.
[0142] Please refer to Figure 3 , which shows a flowchart of an information processing method for plug-in loading provided by an exemplary embodiment of the present application. The execution subject of each step of the method can be a computer device, and the computer device can be any electronic device with data storage and processing capabilities. Optionally, the computer device can be the above-mentioned Figure 1 The development terminal device 10 in the solution implementation environment shown. Figure 3As shown, the method may include step 310 , step 320 , and step 330 .
[0143] Step 310: During the compilation of the plug-in of the application, the code logic of the plug-in is scanned.
[0144] In the process of scanning the code logic of the plug-in, the computer device may scan the code logic of the plug-in through a preset tool or script.
[0145] Exemplarily, the computer device may scan bytecode files (such as .class files) in the application program and search for the class of the plug-in.
[0146] Step 320: when it is scanned that the inherited object in the plug-in is a class of a specified component, obtain the identifier of the class that inherits the specified component; the specified component is a component related to plug-in reloading.
[0147] The inherited object in the above plug-in is the class of the specified component, which means that the plug-in inherits the class of the system component (one or more of the four basic components of Android), or the class of the plug-in is a subclass of the system component.
[0148] Among them, the identifier of the class that inherits the specified component can include one or more of a string, an integer, an ID, a class name, or other identifiers, which is not limited in this application.
[0149] There may be one or more classes that inherit the specified component. If there are multiple classes that inherit the specified component, the identifiers of the classes that inherit the specified component may have a unified naming method to maintain data consistency.
[0150] Step 330: Add the mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information.
[0151] The mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
[0152] For example, taking the mapping information as a data structure consisting of multiple key-value pairs, the computer device can use the plug-in identifier as a value, the identifier of the class that inherits the specified component as a key, and store each key-value pair in the mapping information.
[0153] The application process of the above mapping relationship is detailed in the above Figure 2 The embodiments shown will not be described in detail here.
[0154] In summary, the technical solution provided by the embodiment of the present application is that, during the compilation process of the application, the computer device can scan the plug-ins to screen out the plug-ins whose inheritance objects of the class are the specified components, and establish a mapping relationship between the plug-in and the corresponding class to obtain mapping information; during the operation of the application, when monitoring the startup of the specified component related to plug-in reloading (such as the four major components of the Android system), query the above mapping information for the plug-in corresponding to the class of the specified component started this time. If the corresponding plug-in can be queried, it is determined that the plug-in needs to be reloaded, and the queried plug-in can be loaded into the memory at this time; the above scheme of the present application flexibly loads plug-ins by pre-setting mapping information and monitoring component startup. There is no need to traverse class loading, and plug-ins related to the started component can be loaded in time, thereby realizing rapid reloading of plug-ins in the application and improving the efficiency of plug-in reloading when the application is restarted.
[0155] Based on the solutions in the above embodiments of the present application, in a possible implementation, the above step 310 can be implemented as step 310a and step 310b.
[0156] Step 310a: Scan the code of the inherited objects of the class in the plug-in.
[0157] The computer device may scan the code of the inherited object of the class in the plug-in through a preset tool or script.
[0158] Step 310b: When the code of the inherited object contains a keyword matching the designated component, the currently scanned class is determined as the class of the inherited object being the designated component.
[0159] The keyword that matches the specified component may be the name of the four basic components of Android; for example, the keyword that matches the specified component may be one of Activity, Service, BroadcastReceiver, and ContentProvider.
[0160] In an embodiment of the present application, the computer device may search for the above-mentioned keywords in the code of the inherited object of the class in the plug-in; if the above-mentioned keywords exist, the computer device may determine that the class is a class whose inherited object is a specified component.
[0161] The embodiment of the present application provides a feasible method for scanning the code logic of the plug-in. By matching keywords, the process of finding the class whose inherited object is a specified component can be simplified, thereby improving the work efficiency and accuracy of the present application.
[0162] Based on the solutions in the above embodiments of the present application, in a possible implementation manner, the above step 310a may be implemented as follows:
[0163] Scan the code of inherited objects of classes in the plug-in by means of instrumentation.
[0164] In the embodiment of the present application, the above-mentioned method of inserting a stub refers to inserting a new code logic into the first line of a function during the compilation period of the application's plug-in to scan the code.
[0165] Among them, a function, or method, is a code block used to perform a specified task of an application, and different function methods may perform different tasks. Optionally, in Android development, a function or method refers to a function or method in Java or Kotlin language, which are code blocks that perform specific tasks.
[0166] Exemplarily, all classes of plug-ins in the application may be scanned through a specified interface of a specified tool.
[0167] The embodiment of the present application provides a feasible method for scanning the code of the inherited objects of the class in the plug-in. By inserting stubs, the scanning can be achieved without modifying the original code of the plug-in, thereby reducing the complexity of the scanning.
[0168] Based on the solutions shown in the above embodiments, this application proposes a method for reloading plug-ins after a process restart. Through this method, developers do not need to pre-inject custom classloaders in advance. When one of the four major components pulls up a plug-in after the process restarts, the plug-in can be automatically loaded into memory to prevent crashes caused by loading failures.
[0169] Please refer to Figure 4 , which shows a schematic diagram of the establishment and application of mapping information provided by an exemplary embodiment of the present application.
[0170] in, Figure 4 Part (a) in the above corresponds to phase 1: during the compilation of the application, mapping information is established. Figure 4 As shown in part (a) of FIG, before generating the installation package of the application, the computer device can scan the code logic of the plug-in by means of stubs. Specifically, before generating the installation package of the application, the computer device can compile the .java file into a .class file through a compiler, and before the DEX tool compiles the .class file into a .dex file, the computer device can determine an insertion point, find the .class file corresponding to the plug-in, and scan all classes of the plug-in through a specified interface of a specified tool.
[0171] Afterwards, when the code of the inherited object contains a keyword matching the designated component, the class name of the currently scanned class and the plug-in name of the plug-in are obtained and stored in the mapping information 01.
[0172] in, Figure 4 Part (b) in the figure corresponds to phase 2: during the running of the application, the mapping information is applied. Figure 4 As shown in part (b) of the figure, the computer device can monitor whether the four major components are started through the pre-registered appComponentFactory; when any of the four major components is started, the class name of the class started this time is obtained. Afterwards, according to the class name, whether there is the same key (Key) in the mapping information 01 is queried; if there is the same key (Key), the value (Value) corresponding to the key (Key) is obtained, and then the target plug-in (i.e. the first plug-in mentioned above) corresponding to the plug-in name of the value (Value) is obtained. Afterwards, the target plug-in is loaded into the memory through the hot repair tool.
[0173] Please refer to Figure 5 , which shows a flowchart of a method for reloading a plug-in after a process restart provided by an exemplary embodiment of the present application.
[0174] like Figure 5 As shown, the developer can upload the installation package and mapping information of the application in the development terminal device 10 to the server 30. Taking the user running the application using the mobile phone 20 as an example, when installing the client of the application, the installation package and mapping information of the application are downloaded to the mobile phone 20 together. The steps performed by the mobile phone 20 are as follows:
[0175] Step 1: During the running of the application, the application can register with the component management class to listen for the startup events of the four major components;
[0176] Step ②: When the component management class starts one of the four major components, the component management class can return a startup message to the application, and the startup message carries the identifier of the startup class;
[0177] Step 3: According to the startup class identifier carried in the startup message, the application can query the plug-in identifier corresponding to the startup class identifier in the mapping information stored in the memory;
[0178] Step ④: According to the identifier of the plug-in, the application program can obtain the first plug-in and load the first plug-in into the memory.
[0179] Please refer to Figure 6 , which shows a flowchart of a method for reloading a plug-in after a process restart provided by an exemplary embodiment of the present application. Figure 6 As shown, the above-mentioned method for reloading the plug-in after the process is restarted may include the following steps:
[0180] S1, scan the classes in the plugin:
[0181] The computer device may scan the code of the inherited object of the class in the plug-in by means of stub insertion.
[0182] S2, determine whether the class inherits one of the four major components:
[0183] If the class inherits one of the four major components, execute step S3; otherwise, end the process.
[0184] The computer device may search for one or more of Activity, Service, BroadcastReceiver, and ContentProvider in the code of the inherited object of the class in the plug-in.
[0185] Accordingly, if it is found that one or more of Activity, Service, BroadcastReceiver, and ContentProvider exist in the code of the inherited object of the class in the plug-in, it can be determined that the class in the plug-in inherits one of the four major components.
[0186] S3, written to MAP:
[0187] The computer device may be written into the MAP (ie, the above-mentioned mapping information) with the class name as the key (Key) and the plug-in name as the value (Value) as the correspondence.
[0188] S4, monitors the startup of four major components:
[0189] Among them, the computer device can obtain which one or which components of the four major components to start through the pre-registered appComponentFactory.
[0190] Among them, when any one of the four major components is started, the computer device can obtain the class name of the class started this time.
[0191] S5: Determine whether the startup class exists in MAP:
[0192] If the startup class exists in the MAP, execute step S6; otherwise, end the process.
[0193] The computer device can query whether there is an identical key (Key) in MAP according to the class name of the startup class; if there is an identical key (Key), obtain the value (Value) corresponding to the key (Key), and then obtain the target plug-in corresponding to the plug-in name of the value (Value).
[0194] S6, execute plugin loading:
[0195] The computer device may load the target plug-in into the memory through a hot repair tool.
[0196] Specifically, the computer device may call the interface of the hot repair tool and pass the file path of the first plug-in to the hot repair tool.
[0197] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0198] Please refer to Figure 7 , which shows a block diagram of a plug-in loading device provided by an exemplary embodiment of the present application. The device has the functions of implementing the above examples, and the functions can be implemented by hardware or by hardware executing corresponding software. Figure 7 As shown, the device may include: an information acquisition module 701 , an identification acquisition module 702 , a plug-in query module 703 and a plug-in loading module 704 .
[0199] The information acquisition module 701 is used to acquire startup information of a specified component in the operating system during the running of the application; the specified component is a component related to plug-in reloading;
[0200] The identification acquisition module 702 is used to obtain the identification of the startup class according to the startup information; the startup class is the class of the specified component started this time;
[0201] A plug-in query module 703, configured to query the first plug-in corresponding to the startup class in the application program in the preset mapping information according to the identifier of the startup class;
[0202] The plug-in loading module 704 is used to load the found first plug-in into the memory.
[0203] In some embodiments, the mapping information stores a mapping relationship between an identifier of a plug-in in the application and an identifier of a class in the plug-in that inherits a specified component;
[0204] The plug-in query module 703 is used to query the mapping information for an identifier of a plug-in that has a mapping relationship with the identifier of the startup class, as the identifier of the first plug-in.
[0205] In some embodiments, the plug-in loading module 704 is used to query the file path of the first plug-in according to the identifier of the first plug-in;
[0206] The plug-in loading module 704 is used to call the interface of the hot repair tool and pass the file path of the first plug-in to the hot repair tool so that the hot repair tool loads the first plug-in into the memory.
[0207] In some embodiments, the information acquisition module 701 is used to receive a first monitoring message to the component management class during the running of the application, where the first monitoring message is used to instruct the component management class to start the behavior of the specified component;
[0208] The information acquisition module 701 is used to acquire the first monitoring message as startup information.
[0209] In some embodiments, the information acquisition module 701 is used to receive a second monitoring message of the component management class during the running of the application, and the second monitoring message is used to indicate the management behavior of the component management class on the system component; the specified component is all or part of the system components;
[0210] The information acquisition module 701 is used to acquire the second monitoring message as the startup information when the management behavior indicated by the second monitoring message is the behavior of starting the specified component.
[0211] In some embodiments, the identification acquisition module 702 is used to acquire the identification of the startup class carried in the startup information.
[0212] The technical solution provided in the embodiment of the present application establishes a mapping relationship between a component class and a plug-in through pre-set mapping information; thereafter, during the operation of the application, when monitoring the startup of a designated component related to plug-in reloading (such as the four major components of the Android system), the plug-in corresponding to the class of the designated component started this time in the above mapping information is queried; if the corresponding plug-in can be queried, it is determined that the plug-in needs to be reloaded, and the queried plug-in can be loaded into the memory at this time; the above-mentioned solution of the present application flexibly loads plug-ins by pre-setting mapping information and monitoring component startup, without traversing class loading, and can load plug-ins related to the started component in a timely manner, thereby realizing rapid reloading of plug-ins in the application and improving the efficiency of plug-in reloading when the application is restarted.
[0213] Please refer to Figure 8 , which shows a block diagram of an information processing device for plug-in loading provided by an exemplary embodiment of the present application. The device has the functions of implementing the above examples, and the functions can be implemented by hardware or by hardware executing corresponding software. Figure 8 As shown, the device 800 may include: a scanning module 801 , an acquisition module 802 , and an adding module 803 .
[0214] The scanning module 801 is used to scan the code logic of the plug-in during the compilation process of the plug-in of the application program;
[0215] The acquisition module 802 is used to acquire the identifier of the class that inherits the specified component when the inherited object in the plug-in is scanned to be the class of the specified component; the specified component is a component related to plug-in reloading;
[0216] An adding module 803, used to add a mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information;
[0217] The mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
[0218] In some embodiments, the scanning module 801 is used to scan the code of the inherited object of the class in the plug-in;
[0219] The scanning module 801 is used to determine the currently scanned class as the class of the inherited object being the designated component when the inherited object's code contains a keyword matching the designated component.
[0220] In some embodiments, the scanning module 801 is used to scan the code of the inherited object of the class in the plug-in by means of instrumentation.
[0221] According to the technical solution provided by the embodiment of the present application, during the compilation process of the application, the computer device can scan the plug-ins to screen out the plug-ins whose inheritance objects of the class are the specified components, and establish a mapping relationship between the plug-in and the corresponding class to obtain mapping information; during the operation of the application, when monitoring the startup of the specified component related to the plug-in reloading (such as the four major components of the Android system), query the above mapping information for the plug-in corresponding to the class of the specified component started this time. If the corresponding plug-in can be queried, it is determined that the plug-in needs to be reloaded, and the queried plug-in can be loaded into the memory at this time; the above scheme of the present application flexibly loads plug-ins by pre-setting mapping information and monitoring component startup. There is no need to traverse class loading, and plug-ins related to the started component can be loaded in time, thereby realizing rapid reloading of plug-ins in the application and improving the efficiency of plug-in reloading when the application is restarted.
[0222] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0223] Please refer to Fig. 9 , which shows a block diagram of a computer device 900 provided in one embodiment of the present application. The computer device 900 may be any electronic device with data computing, processing and storage capabilities. The computer device 900 may be used to implement the plug-in loading method and the information processing method for plug-in loading provided in the above embodiments.
[0224] Typically, the computer device 900 includes a processor 901 and a memory 902 .
[0225] The processor 901 may include one or more processing cores, such as a 4-core processor, a 9-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0226] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-mentioned plug-in loading method and the information processing method for plug-in loading.
[0227] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the computer device 900, and the computer device 900 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.
[0228] In an exemplary embodiment, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned plug-in loading method and the information processing method for plug-in loading are implemented. Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0229] In an exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned plug-in loading method and the information processing method for plug-in loading.
[0230] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0231] The above description is only an exemplary 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 shall be included in the protection scope of the present application.
Claims
1. A plug-in loading method, characterized in that: The method comprises: During the running of the application, the startup information of a specified component in the operating system is obtained; the specified component is a component related to plug-in reloading; Obtaining an identifier of a startup class according to the startup information; the startup class is a class for starting the specified component this time; According to the identifier of the startup class, searching the preset mapping information for a first plug-in in the application corresponding to the startup class; The first plug-in found is loaded into the memory.
2. The method according to claim 1, characterized in that: The mapping information stores a mapping relationship between an identifier of a plug-in in the application and an identifier of a class in the plug-in that inherits the specified component; The step of searching, according to the identifier of the startup class, the preset mapping information for a first plug-in in the application corresponding to the startup class includes: The mapping information is searched for an identifier of the plug-in that has a mapping relationship with the identifier of the startup class, and the identifier is used as the identifier of the first plug-in.
3. The method according to claim 2, characterized in that The step of loading the first plug-in found in the query into the memory includes: According to the identifier of the first plug-in, query the file path of the first plug-in; The interface of the hot repair tool is called, and the file path of the first plug-in is passed to the hot repair tool, so that the hot repair tool loads the first plug-in into the memory.
4. The method according to claim 1, characterized in that The step of obtaining startup information of a specified component in the operating system during the running of the application program includes: During the running of the application, a first monitoring message to the component management class is received, wherein the first monitoring message is used to instruct the component management class to start the behavior of the specified component; The first monitoring message is obtained as the startup information.
5. The method according to claim 1, characterized in that The step of obtaining startup information of a specified component in the operating system during the running of the application program includes: During the running of the application, a second monitoring message for the component management class is received, wherein the second monitoring message is used to indicate the management behavior of the component management class on the system components; the designated components are all or part of the system components; In a case where the management behavior indicated by the second monitoring message is a behavior of starting the designated component, the second monitoring message is acquired as the startup information.
6. The method according to claim 4 or 5, characterized in that: The step of obtaining the identifier of the startup class according to the startup information includes: Obtain an identifier of the startup class carried in the startup information.
7. An information processing method for plug-in loading, characterized in that: The method comprises: During the compilation of the plug-in of the application, scanning the code logic of the plug-in; In the case where it is scanned that the inherited object in the plug-in is a class of a specified component, obtaining the identifier of the class that inherits the specified component; the specified component is a component related to plug-in reloading; Adding a mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information; Among them, the mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
8. The method according to claim 7, characterized in that During the compilation of the plug-in of the application, scanning the code logic of the plug-in includes: Scan the code of the inherited objects of the class in the plug-in; In the case where the code of the inherited object contains a keyword matching the designated component, the currently scanned class is determined as a class whose inherited object is the designated component.
9. The method according to claim 8, characterized in that The code for scanning the inherited objects of the class in the plug-in includes: The code of the inherited object of the class in the plug-in is scanned by means of instrumentation.
10. A plug-in loading device, characterized in that: The device comprises: An information acquisition module, used to acquire startup information of a specified component in the operating system during the running of the application; the specified component is a component related to plug-in reloading; An identification acquisition module, used to acquire an identification of a startup class according to the startup information; the startup class is a class for starting the specified component this time; A plug-in query module, configured to query the first plug-in corresponding to the startup class in the application program in preset mapping information according to the identifier of the startup class; The plug-in loading module is used to load the first plug-in found by the query into the memory.
11. The device according to claim 10, characterized in that The mapping information stores a mapping relationship between an identifier of a plug-in in the application and an identifier of a class in the plug-in that inherits the specified component; The plug-in query module is used to query the mapping information for an identifier of the plug-in that has a mapping relationship with the identifier of the startup class, as the identifier of the first plug-in.
12. The device according to claim 11, characterized in that The plug-in loading module is used to query the file path of the first plug-in according to the identifier of the first plug-in; The plug-in loading module is used to call the interface of the hot repair tool and pass the file path of the first plug-in to the hot repair tool so that the hot repair tool loads the first plug-in into the memory.
13. The device according to claim 10, characterized in that The information acquisition module is used to receive a first monitoring message to the component management class during the running of the application, wherein the first monitoring message is used to instruct the component management class to start the behavior of the specified component; The information acquisition module is used to acquire the first monitoring message as the startup information.
14. The device according to claim 10, characterized in that The information acquisition module is used to receive a second monitoring message of the component management class during the running of the application, wherein the second monitoring message is used to indicate the management behavior of the component management class on the system components; the specified components are all or part of the system components; The information acquisition module is used to acquire the second monitoring message as the startup information when the management behavior indicated by the second monitoring message is a behavior of starting the designated component.
15. The device according to claim 13 or 14, characterized in that The identification acquisition module is used to obtain the identification of the startup class carried in the startup information.
16. An information processing device for plug-in loading, characterized in that: The device comprises: A scanning module, used to scan the code logic of the plug-in during the compilation process of the plug-in of the application; an acquisition module, configured to acquire the identifier of the class that inherits the specified component when the inherited object in the plug-in is found to be a class of a specified component; the specified component is a component related to plug-in reloading; An adding module, used for adding a mapping relationship between the identifier of the plug-in and the identifier of the class that inherits the specified component to the mapping information; Among them, the mapping information is used to obtain the startup information of the specified component during the running of the application, obtain the identifier of the startup class according to the startup information, query the first plug-in corresponding to the startup class according to the identifier of the startup class, and load the queried first plug-in into the memory.
17. The device according to claim 16, characterized in that The scanning module is used to scan the code of the inherited object of the class in the plug-in; The scanning module is used to determine the currently scanned class as the class whose inheritance object is the designated component when the code of the inheritance object contains keywords matching the designated component.
18. The device according to claim 17, characterized in that The scanning module is used to scan the code of the inherited object of the class in the plug-in by means of plug-in.
19. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the plug-in loading method according to any one of claims 1 to 6 and the information processing method for plug-in loading according to any one of claims 7 to 9.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the plug-in loading method according to any one of claims 1 to 6 and the information processing method for plug-in loading according to any one of claims 7 to 9.
21. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the plug-in loading method according to any one of claims 1 to 6 and the information processing method for plug-in loading according to any one of claims 7 to 9.