CN105278942B - Component management method and device - Google Patents

Component management method and device Download PDF

Info

Publication number
CN105278942B
CN105278942B CN201410353837.4A CN201410353837A CN105278942B CN 105278942 B CN105278942 B CN 105278942B CN 201410353837 A CN201410353837 A CN 201410353837A CN 105278942 B CN105278942 B CN 105278942B
Authority
CN
China
Prior art keywords
component
target component
target
library file
assembly
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410353837.4A
Other languages
Chinese (zh)
Other versions
CN105278942A (en
Inventor
方敏
苏可
何飞
李龙彬
饶孟良
郭辛华
李英各
罗坤
王璟瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410353837.4A priority Critical patent/CN105278942B/en
Publication of CN105278942A publication Critical patent/CN105278942A/en
Application granted granted Critical
Publication of CN105278942B publication Critical patent/CN105278942B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a component management method and device, and belongs to the technical field of computers. The method comprises the following steps: determining a target component to be loaded according to a currently running application program; acquiring a library file corresponding to a target component; and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component. The method comprises the steps of determining a target component to be loaded, acquiring a library file corresponding to the target component, and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is small.

Description

Component management method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for managing components.
Background
With the rapid development of computer technology, the application range of processing information by an application program is wider and wider. When an application processes information, the application generally needs to process the information by using components corresponding to the application. How to manage the components of an application is thus a key to improving the application use experience.
The related art provides a component management method in which a component is fixedly loaded in an application program. In specific implementation, in the process of application program development, the components are loaded in the application program in the form of codes. When the component is managed subsequently, the component is a fixed component loaded in the application program, so that the operation of the component is related to the software and hardware environment where the application program is currently located. If the current software and hardware environment of the application program does not meet the running condition of the loaded fixed component, the application program loading the fixed component is forced to exit, or the loaded fixed component is crashed.
In the process of implementing the invention, the inventor finds that the method at least has the following problems:
because the component is a fixed component loaded in the application program, when the current software and hardware environment of the application program does not meet the running condition of the loaded fixed component, the loaded fixed component directly crashes or the application program loading the fixed component forcibly exits, so that the flexibility of the component management method is poor, and the use of the application program is greatly influenced.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for managing a component, where the technical solution is as follows:
in one aspect, a component management method is provided, the method comprising:
determining a target component to be loaded according to a currently running application program;
acquiring a library file corresponding to the target component;
and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
In another aspect, there is provided a component management apparatus, the apparatus comprising:
the determining module is used for determining a target component to be loaded according to the currently running application program;
the acquisition module is used for acquiring the library file corresponding to the target component;
and the loading module is used for dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
and acquiring a library file corresponding to the target component by determining the target component to be loaded, and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram illustrating a component management method in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a component management method in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram illustrating the structure of a component management apparatus according to an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating the structure of a component management apparatus according to an exemplary embodiment;
FIG. 5 is a schematic diagram illustrating the structure of a component management apparatus according to an exemplary embodiment;
FIG. 6 is a schematic diagram illustrating the structure of a component management apparatus in accordance with an exemplary embodiment;
FIG. 7 is a schematic diagram illustrating the structure of a component management apparatus in accordance with an exemplary embodiment;
fig. 8 is a block diagram of a terminal according to an example embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Because the loaded component is the fixed component in the application program when the component is managed in the related art, when the current software and hardware environment of the application program does not meet the running condition of the loaded fixed component, the loaded fixed component directly crashes or the application program loading the fixed component forcibly exits, so that the flexibility of the component management method is poor, and the use of the application program is greatly influenced.
In order to prevent the foregoing situation, improve flexibility of component management, and reduce influence on an application program, an embodiment of the present invention provides a component management method, where the method is applied to a terminal, where the terminal includes but is not limited to a mobile phone, a computer, a tablet computer, and the like, and referring to fig. 1, a method flow provided in this embodiment includes:
101: determining a target component to be loaded according to a currently running application program;
102: acquiring a library file corresponding to a target component;
as an optional embodiment, before obtaining the library file corresponding to the target component, the method further includes:
saving library files of each component locally in advance;
acquiring a library file corresponding to a target component, wherein the library file comprises:
and acquiring a library file corresponding to the target component from a library file stored in advance locally.
103: and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
As an optional embodiment, after dynamically loading the target component into the currently running application according to the library file corresponding to the target component, the method further includes:
and if the target component is loaded successfully, initializing component resources corresponding to the target component, and operating the target component after the component resources are initialized successfully.
As an optional embodiment, after dynamically loading the target component into the currently running application according to the library file corresponding to the target component, the method further includes:
if the target component is not successfully loaded, the replaced functionality of the target component is used.
As an alternative embodiment, after the target component is run, the method further comprises:
detecting whether the pulling-out condition of the target assembly is met;
and if the condition that the pulling-out condition of the target assembly is met is detected, stopping running the target assembly, and releasing the assembly resource corresponding to the target assembly.
As an alternative embodiment, detecting whether the pull-out condition of the target component is satisfied includes:
detecting whether a pulling-out instruction of a target assembly is acquired;
and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
As an alternative embodiment, detecting whether the pull-out condition of the target component is satisfied includes:
detecting whether the current operating environment meets the operating requirement of the target assembly;
and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
In the method provided by this embodiment, a library file corresponding to a target component is obtained by determining the target component to be loaded, and the target component is dynamically loaded into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
The embodiment of the invention provides a component management method, which relates to a terminal and is combined with the content in the embodiment to exemplify the method provided by the embodiment. Referring to fig. 2, the method flow provided by this embodiment includes:
201: determining a target component to be loaded according to a currently running application program;
the present embodiment does not specifically limit the manner of determining the target component to be loaded according to the currently running application, which includes but is not limited to: determining the functions to be executed by the currently running application program, and determining the target components to be loaded according to the functions to be executed. The number of target components to be loaded may be one or multiple, and the number of target components to be loaded is not specifically limited in this embodiment.
For example, if it is determined that the currently running application needs to perform a function to play a video, a corresponding video playing component may be loaded. Here, the video playing component is a target component that needs to be loaded, and the number of the target components is one. In addition, when the video is played, a video acceleration component is often required to be loaded to accelerate the video playing, that is, the video acceleration component is also a target component that needs to be loaded. At this time, the number of target components is plural.
202: acquiring a library file corresponding to a target component;
the embodiment does not specifically limit the manner of obtaining the library file corresponding to the target component, and includes but is not limited to: saving library files of each component locally in advance; and acquiring a library file corresponding to the target component from a library file stored in advance locally. Each target component corresponds to at least one library file, and the number of library files corresponding to each target component is not specifically limited in this embodiment.
Regarding the manner of obtaining the library file corresponding to the target component from the library file stored in advance locally, this embodiment is not particularly limited to this, and includes but is not limited to: and acquiring a library file corresponding to the target component from library files stored in advance locally according to the attribute of the target component. The attribute of the target component may include an identifier of the target component, and the like, which is not specifically limited in this embodiment.
For example, taking the attribute of the target component as the identifier of the target component, and taking the example that each target component corresponds to one unique identifier, the library file of each component is stored locally in advance, and since each target component corresponds to one identifier, the identifier of each target component can be associated with the corresponding library file. If a library file corresponding to a certain target component needs to be acquired, the library file corresponding to the identifier can be acquired by locally searching according to the identifier of the target component.
It should be noted that, in the foregoing process, the library file of each component may be stored in local system firmware, such as a local ROM (Read-Only Memory), and the present embodiment does not specifically limit the location where the library file of each component is locally stored. In addition, the library files of the components can be packaged and placed into an APK (Android PacKage, Android installation PacKage), and when the APK containing the library files needs to be installed, the library files can be decompressed from the APK and stored at the same time. The storage medium may be stored in the system firmware in the above process, or may be stored in an external storage device, which is not specifically limited in this embodiment.
In addition, when the target component is released to the system firmware such as the local ROM or the external storage device, the target component is limited by conditions such as the size of the device space, whether the device file system is normal, whether the device file system has read/write permission, and the like. When the target component is loaded, it may be detected whether the pull-out condition is currently met, and if the pull-out condition is currently met, the replaced function of the target component may be used, that is, the target component may be replaced by a component or an application program or a system function that executes the same function, which is not limited in this embodiment. The present embodiment does not specifically limit the manner of detecting whether the pull-out condition is currently satisfied, and includes but is not limited to: when a target component is released to system firmware such as a local ROM or an external storage device, detecting whether the corresponding device space size is enough, and if the device space size is not enough, determining that a pull-out condition is met currently; or, whether the device file system is in a normal state and whether the device file system has a read-write permission or not is detected, and if the device file system is not in the normal state or does not have the read-write permission, the current unplugging condition is determined to be met.
203: dynamically loading the target component into the currently running application program according to the library file corresponding to the target component;
since the target component is actually a process after executing the code, the library file corresponding to the target component contains the corresponding code. Therefore, regarding the manner of dynamically loading the target component into the currently running application according to the library file corresponding to the target component, this embodiment is not specifically limited to this, and includes but is not limited to: and loading the library file corresponding to the target component into the code corresponding to the currently running application program. If the currently running application needs to use the target component, the code in the library file corresponding to the target component can be executed, so that the target component is dynamically loaded into the currently running application.
204: if the target component is loaded successfully, initializing component resources corresponding to the target component, and operating the target component after the component resources are initialized successfully;
through the above step 203, the target component can be dynamically loaded into the currently running application program, and if the target component is successfully loaded, the component resource corresponding to the target component is initialized. The component resource may include a context code required for running the target component, a hardware resource required by the target component, and the like, which is not specifically limited in this embodiment. The present embodiment does not specifically limit the manner of initializing the component resource corresponding to the target component, and includes but is not limited to: and initializing the component resources according to the component resource type corresponding to the target component. For example, when the component resource is context code required for running the target component, the context code may be loaded into the memory to complete initialization of the component resource. When the component resource is a hardware resource printer, the initial parameters of the printer can be reset to complete initialization of the component resource.
Through the above process, if the initialization of the component resource is successful, the target component can be operated to execute different functions. For example, if the target component is a video playing component, the video playing component may be run to play a video through the video playing component.
It should be noted that, since there is a possibility of loading failure in the process of loading the target component in step 203, when the target component is not successfully loaded, the replaced function of the target component may also be used.
For example, when the library file corresponding to the target component is loaded into the code corresponding to the currently running application program, the file system storing the code corresponding to the application program has a failure or does not have write permission. At this time, since the library file of the target component cannot be loaded, which may cause a failure in loading the target component, the replaced function of the target component may be used. For example, taking the target component as an audio playing component as an example, when the audio playing component fails to be loaded, since the Windows Media Player audio playing component is often still provided in the Windows system, the audio playing component provided in the system can play audio to complete the function to be executed by the audio playing component that has failed to be loaded previously. Alternatively, the target component may be a browser, and when the browser fails to load, since the Windows system often has an Internet Explorer browser, the browser of the system can be used for a user to browse a webpage.
In addition, since the component resource corresponding to the target component may also fail to be initialized in this step, at this time, the replaced function of the target component may also be used, and the specific process may refer to the above contents, which is not described herein again. Through the replaced function of the target component, the correctness of the logic of the application program can be ensured, so that the application program can normally run without forced quitting under the condition that the target component fails to be loaded or cannot be used, and the running stability of the application program is further improved.
Optionally, after the component resource is initialized successfully and the target component is run, a run identifier may be set for each run target component to indicate that the target component has been loaded and run successfully, which is not specifically limited in this embodiment.
Optionally, since the method provided by this embodiment is to dynamically load components, the components are extremely independent. Therefore, in addition to the above process of loading components, the present embodiment also provides a method of dynamically unloading components, and the specific process is described in the following optional steps.
205: detecting whether the pulling-out condition of the target assembly is met;
because the target component may be in failure when the target component is operated, the pulling-out condition when the target component is operated can be predefined, and after the target component is operated, whether the pulling-out condition when the target component is operated is met currently is detected, so that subsequent processing steps are taken according to the detection result, and the stability of the application program is ensured. The present embodiment does not specifically limit the manner of detecting whether the pull-out condition of the target component is satisfied, and includes, but is not limited to, the following two detection manners:
the first detection mode is as follows: detecting whether a pulling-out instruction of a target assembly is acquired; and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
For the first detection mode, the present embodiment does not specifically limit the mode of detecting whether to acquire the pull-out instruction of the target component, and includes but is not limited to: and setting a target component unloading option in the application program for loading the target component in advance, and displaying the target component unloading option in an interactive interface of the application program in a preset interactive mode. And when an unloading target assembly instruction input by a user according to an unloading option in the interactive interface is acquired, taking the acquired unloading target assembly instruction as a pull-out instruction of the target assembly. The interaction form can be preset according to requirements, and the preset interaction form is not limited in the embodiment.
For example, the interactive interface of the application program may display the currently loaded target components in a list form, and set an uninstall option, such as in a button form, behind the list item corresponding to each target component. And when detecting that a user clicks an unloading option button corresponding to a certain target component, determining that the pulling-out instruction of the target component is obtained.
Through the process, after the pulling-out instruction of the target assembly is obtained, the detection result is that the pulling-out condition of the target assembly is met.
The second detection mode is as follows: detecting whether the current operating environment meets the operating requirement of the target assembly; and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
For the second detection mode, the operation requirement of the target component may be an operation resource required by the target component, and the content of the operation requirement of the target component is not specifically limited in this embodiment. Such as memory resources required to run the target component, etc. The present embodiment does not specifically limit the manner of detecting whether the current operating environment meets the operating requirement of the target component, and includes but is not limited to: and comparing the operation requirement of the target assembly with the current operation environment, and determining whether the current operation environment meets the operation requirement of the target assembly according to the comparison result.
For example, taking the operation requirement of the target component as a requirement for a certain memory resource, if the remaining available memory resource of the current operation environment is 50M (megabyte), the memory resource required for operating the target component is 100M. Comparing the two, it can be known that the remaining available memory resources of the current operating environment are less than the memory resources required for operating the target component, and at this time, it can be determined that the current operating environment does not meet the operating requirement of the target component.
Through the process, after the current operation environment is detected to not meet the operation requirement of the target assembly, the detection result is that the pulling-out condition of the target assembly is met.
206: and if the condition that the pulling-out condition of the target assembly is met is detected, stopping running the target assembly, and releasing the assembly resource corresponding to the target assembly.
Through the above step 205, if it is detected that the pulling-out condition of the target component is satisfied, the target component may stop running, and the component resource corresponding to the target component is released. The released component resource is a component resource corresponding to the target component initialized in step 204, and all or part of the component resources corresponding to the target component during initialization may be released during the release.
In addition, in step 204, after the target component is executed, an execution identifier may be set for each executed target component. Therefore, in this step, the operation identifier corresponding to the target component that has stopped operating may be cleared, which is not specifically limited in this embodiment. When the system detects that the operation identifier corresponding to the target component that is originally operating is cleared, the replaced function of the target component may be used to ensure the logic of the application program itself, and the specific process may refer to the content in step 204, which is not specifically limited in this embodiment.
In the method provided by this embodiment, a library file corresponding to a target component is obtained by determining the target component to be loaded, and the target component is dynamically loaded into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
The embodiment of the invention provides a component management device, which is used for executing the component management method provided by the embodiment. Referring to fig. 3, the apparatus includes:
a determining module 301, configured to determine, according to a currently running application program, a target component that needs to be loaded;
an obtaining module 302, configured to obtain a library file corresponding to a target component;
and the loading module 303 is configured to dynamically load the target component into the currently running application program according to the library file corresponding to the target component.
As an alternative embodiment, referring to fig. 4, the apparatus further comprises:
a storage module 304, configured to store library files of each component locally in advance;
the obtaining module 302 is configured to obtain a library file corresponding to the target component from library files stored in advance locally.
As an alternative embodiment, referring to fig. 5, the apparatus further comprises:
an initialization module 305, configured to initialize a component resource corresponding to a target component when the target component is successfully loaded;
and the running module 306 is used for running the target component after the component resource is initialized successfully.
As an alternative embodiment, referring to fig. 6, the apparatus further comprises:
a processing module 307 for using the replaced function of the target component when the target component is not successfully loaded.
As an alternative embodiment, referring to fig. 7, the apparatus further comprises:
a detection module 308, configured to detect whether a pull-out condition of the target component is satisfied;
a stopping module 309, configured to stop running the target component when it is detected that the pull-out condition of the target component is met;
a releasing module 310, configured to release the component resource corresponding to the target component.
As an optional embodiment, the detecting module 308 is configured to detect whether a pulling instruction of the target component is obtained; and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
As an alternative embodiment, the detecting module 308 is configured to detect whether the current operating environment meets the operating requirement of the target component; and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
The device provided by this embodiment obtains the library file corresponding to the target component by determining the target component to be loaded, and dynamically loads the target component into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
The present embodiment provides a terminal, which can be used to execute the component management methods provided in the above embodiments. Referring to fig. 8, the terminal 800 includes:
the terminal 800 may include components such as an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a WiFi (Wireless Fidelity) module 170, a processor 180 including one or more processing cores, and a power supply 190. Those skilled in the art will appreciate that the terminal structure shown in fig. 8 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information from a base station and then sends the received downlink information to the one or more processors 180 for processing; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuitry 110 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (short messaging Service), etc.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal 800, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 120 may further include a memory controller to provide the processor 180 and the input unit 130 with access to the memory 120.
The input unit 130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may include a touch-sensitive surface 131 as well as other input devices 132. The touch-sensitive surface 131, also referred to as a touch display screen or a touch pad, may collect touch operations by a user on or near the touch-sensitive surface 131 (e.g., operations by a user on or near the touch-sensitive surface 131 using a finger, a stylus, or any other suitable object or attachment), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. Additionally, the touch-sensitive surface 131 may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by or provided to a user and various graphical user interfaces of the terminal 800, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 140 may include a Display panel 141, and optionally, the Display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when a touch operation is detected on or near the touch-sensitive surface 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although in FIG. 8, touch-sensitive surface 131 and display panel 141 are shown as two separate components to implement input and output functions, in some embodiments, touch-sensitive surface 131 may be integrated with display panel 141 to implement input and output functions.
The terminal 800 can also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or a backlight when the terminal 800 is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the terminal 800, further description is omitted here.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user and terminal 800. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then to the RF circuit 110 to be transmitted to, for example, another terminal, or outputs the audio data to the memory 120 for further processing. The audio circuitry 160 may also include an earbud jack to provide communication of peripheral headphones with the terminal 800.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 800 can help a user send and receive e-mails, browse web pages, access streaming media, and the like through the WiFi module 170, and provides wireless broadband internet access for the user. Although fig. 8 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the terminal 800, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the terminal 800, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 800 and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby performing overall monitoring of the mobile phone. Optionally, processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
The terminal 800 further includes a power supply 190 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 180 via a power management system to manage charging, discharging, and power consumption management functions via the power management system. The power supply 190 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal 800 may further include a camera, a bluetooth module, etc., which will not be described herein. In this embodiment, the display unit of the terminal is a touch screen display, and the terminal further includes a memory and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors. The one or more programs include instructions for:
determining a target component to be loaded according to a currently running application program;
acquiring a library file corresponding to a target component;
and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
Assuming that the above is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
saving library files of each component locally in advance;
acquiring a library file corresponding to a target component, wherein the library file comprises:
and acquiring a library file corresponding to the target component from a library file stored in advance locally.
In a third possible implementation manner provided as a basis for the first possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
and if the target component is loaded successfully, initializing component resources corresponding to the target component, and operating the target component after the component resources are initialized successfully.
In a fourth possible implementation manner provided as a basis for the first possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
if the target component is not successfully loaded, the replaced functionality of the target component is used.
In a fifth possible implementation manner provided as a basis for the third possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
detecting whether the pulling-out condition of the target assembly is met;
and if the condition that the pulling-out condition of the target assembly is met is detected, stopping running the target assembly, and releasing the assembly resource corresponding to the target assembly.
In a sixth possible implementation manner provided as a basis for the fifth possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
detecting whether a pulling-out instruction of a target assembly is acquired;
and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
In a seventh possible implementation manner provided as a basis for the fifth possible implementation manner, the memory of the terminal further includes instructions for performing the following operations:
detecting whether the current operating environment meets the operating requirement of the target assembly;
and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
According to the terminal provided by the invention, the target component needing to be loaded is determined, the library file corresponding to the target component is obtained, and the target component is dynamically loaded into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be a computer-readable storage medium contained in the memory in the foregoing embodiment; or it may be a separate computer-readable storage medium not incorporated in the terminal. The computer-readable storage medium stores one or more programs for execution by one or more processors to implement a component management method, the method comprising:
determining a target component to be loaded according to a currently running application program;
acquiring a library file corresponding to a target component;
and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
Assuming that the foregoing is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, before the acquiring the library file corresponding to the target component, the method further includes:
saving library files of each component locally in advance;
acquiring a library file corresponding to a target component, wherein the library file comprises:
and acquiring a library file corresponding to the target component from a library file stored in advance locally.
In a third possible implementation manner provided on the basis of the first possible implementation manner, after the dynamically loading the target component into the currently running application according to the library file corresponding to the target component, the method further includes:
and if the target component is loaded successfully, initializing component resources corresponding to the target component, and operating the target component after the component resources are initialized successfully.
In a fourth possible implementation manner provided on the basis of the first possible implementation manner, after the dynamically loading the target component into the currently running application according to the library file corresponding to the target component, the method further includes:
if the target component is not successfully loaded, the replaced functionality of the target component is used.
In a fifth possible implementation manner provided as a basis for the third possible implementation manner, after the running of the target component, the method further includes:
detecting whether the pulling-out condition of the target assembly is met;
and if the condition that the pulling-out condition of the target assembly is met is detected, stopping running the target assembly, and releasing the assembly resource corresponding to the target assembly.
In a sixth possible implementation manner provided as the basis for the fifth possible implementation manner, the detecting whether the pull-out condition of the target component is satisfied includes:
detecting whether a pulling-out instruction of a target assembly is acquired;
and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
In a seventh possible implementation form that is provided on the basis of the fifth possible implementation form, the detecting whether the pull-out condition of the target component is satisfied includes:
detecting whether the current operating environment meets the operating requirement of the target assembly;
and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
The computer-readable storage medium provided in the embodiment of the present invention obtains a library file corresponding to a target component by determining the target component to be loaded, and dynamically loads the target component into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
The embodiment of the invention provides a graphical user interface, which is used on a terminal, wherein the terminal comprises a touch screen display, a memory and one or more processors for executing one or more programs; the graphical user interface comprises:
determining a target component to be loaded according to a currently running application program;
acquiring a library file corresponding to a target component;
and dynamically loading the target component into the currently running application program according to the library file corresponding to the target component.
According to the graphical user interface provided by the embodiment of the invention, the target component needing to be loaded is determined, the library file corresponding to the target component is obtained, and the target component is dynamically loaded into the currently running application program according to the library file corresponding to the target component. The components can be dynamically loaded as required when the application program runs, so that the management flexibility of the components is improved, and the influence on the application program is reduced.
It should be noted that: in the component management apparatus provided in the foregoing embodiment, when managing components, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to complete all or part of the functions described above. In addition, the component management apparatus and the component management method provided in the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments and are not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (12)

1. A method for component management, the method comprising:
determining a target component to be loaded according to a currently running application program;
acquiring a library file corresponding to the target component;
dynamically loading the target component into the currently running application program according to the library file corresponding to the target component;
if the target component is loaded successfully, initializing component resources corresponding to the target component, and running the target component after the component resources are initialized successfully, wherein each running target component corresponds to a running identifier which is used for indicating that the target component is loaded and run successfully;
detecting whether the pulling-out condition of the target assembly is met;
if the condition that the target assembly is pulled out is met, stopping running the target assembly, releasing assembly resources corresponding to the target assembly, and clearing running marks corresponding to the target assembly which is stopped to run;
and when detecting that the operation identification corresponding to the target component which is operated originally is removed, replacing the target component with a component or an application program or a system function which executes the same function.
2. The method according to claim 1, wherein before the obtaining the library file corresponding to the target component, further comprising:
saving library files of each component locally in advance;
the obtaining of the library file corresponding to the target component includes:
and acquiring a library file corresponding to the target component from a library file stored in advance locally.
3. The method according to claim 1, wherein after dynamically loading the target component into the currently running application according to the library file corresponding to the target component, the method further comprises:
if the target component is not successfully loaded, the replaced functionality of the target component is used.
4. The method of claim 1, wherein the detecting whether the condition for pulling out the target component is satisfied comprises:
detecting whether a pulling-out instruction of the target assembly is acquired;
and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
5. The method of claim 1, wherein the detecting whether the condition for pulling out the target component is satisfied comprises:
detecting whether the current operating environment meets the operating requirement of the target assembly;
and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
6. A component management apparatus, the apparatus comprising:
the determining module is used for determining a target component to be loaded according to the currently running application program;
the acquisition module is used for acquiring the library file corresponding to the target component;
the loading module is used for dynamically loading the target component into the currently running application program according to the library file corresponding to the target component;
the initialization module is used for initializing component resources corresponding to the target component when the target component is loaded successfully;
the running module is used for running the target components after the initialization of the component resources is successful, each running target component corresponds to a running identifier, and the running identifiers are used for indicating that the target components are loaded and run successfully;
the detection module is used for detecting whether the pulling-out condition of the target assembly is met or not;
the stopping module is used for stopping running the target assembly when the condition that the pulling-out condition of the target assembly is met is detected, releasing the assembly resource corresponding to the target assembly and clearing the running identifier corresponding to the target assembly which is stopped running;
and the replacing module is used for replacing the target component with the component or the application program or the system function which executes the same function after detecting that the operation identifier corresponding to the target component which is operated originally is cleared.
7. The apparatus of claim 6, further comprising:
the storage module is used for locally storing library files of all the components in advance;
the acquisition module is used for acquiring the library file corresponding to the target component from the library file stored in advance locally.
8. The apparatus of claim 6, further comprising:
and the processing module is used for replacing the target component with a component or an application program or a system function which executes the same function when the target component is not loaded successfully.
9. The device according to claim 6, wherein the detecting module is configured to detect whether a pull-out instruction of the target component is obtained; and if the pulling-out instruction of the target assembly is obtained, the pulling-out condition of the target assembly is met.
10. The apparatus of claim 6, wherein the detecting module is configured to detect whether a current operating environment meets an operating requirement of the target component; and if the current operating environment does not meet the operating requirement of the target assembly, the pulling-out condition of the target assembly is met.
11. A terminal comprising one or more processors and one or more memories or storage media storing programs that, when executed by the one or more processors, implement the component management method of any of claims 1-5.
12. A computer-readable storage medium, characterized in that a program is stored in the computer-readable storage medium, which is loaded and executed by a processor to implement the component management method of any one of claims 1 to 5.
CN201410353837.4A 2014-07-23 2014-07-23 Component management method and device Active CN105278942B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410353837.4A CN105278942B (en) 2014-07-23 2014-07-23 Component management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410353837.4A CN105278942B (en) 2014-07-23 2014-07-23 Component management method and device

Publications (2)

Publication Number Publication Date
CN105278942A CN105278942A (en) 2016-01-27
CN105278942B true CN105278942B (en) 2020-11-06

Family

ID=55148004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410353837.4A Active CN105278942B (en) 2014-07-23 2014-07-23 Component management method and device

Country Status (1)

Country Link
CN (1) CN105278942B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108132844B (en) * 2016-12-01 2020-11-10 腾讯科技(深圳)有限公司 Plug-in downloading method and device
CN108737324B (en) * 2017-04-13 2021-03-02 腾讯科技(深圳)有限公司 Method and device for generating artificial intelligence service assembly and related equipment and system
CN112148342A (en) * 2019-06-27 2020-12-29 北京达佳互联信息技术有限公司 Component configuration method and device, electronic equipment and storage medium
CN111258555A (en) * 2020-01-15 2020-06-09 上海知白智能科技有限公司 Software implementation device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999352A (en) * 2012-11-15 2013-03-27 中国科学院声学研究所 Embedded system assembly loading method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915511B2 (en) * 2001-05-22 2005-07-05 Sun Microsystems, Inc. Dynamic class reloading mechanism
CN101989203A (en) * 2010-01-05 2011-03-23 深圳中兴网信科技有限公司 Software component management system
CN103294457B (en) * 2012-02-27 2017-02-01 百度在线网络技术(北京)有限公司 Method and device for dynamically substituting C/C + + function in main program

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999352A (en) * 2012-11-15 2013-03-27 中国科学院声学研究所 Embedded system assembly loading method

Also Published As

Publication number Publication date
CN105278942A (en) 2016-01-27

Similar Documents

Publication Publication Date Title
US10853437B2 (en) Method and apparatus for invoking application programming interface
CN107734616B (en) Application program closing method and device, storage medium and electronic equipment
US20150163232A1 (en) Method, device and system for detecting malware in a mobile terminal
US20160315999A1 (en) Device and method for associating applications
WO2016000586A1 (en) Method and apparatus for displaying popup box message
CN106775833B (en) Device driver loading method, terminal and system
CN106502703B (en) Function calling method and device
CN106775828B (en) Application program installation method and device and computer equipment
CN108039963B (en) Container configuration method and device and storage medium
CN103544033A (en) Method, device and associated equipment for rolling back application program
CN103473163A (en) Application program detection method and device
WO2015078342A1 (en) Method for acquiring memory information, and terminal
US20170097725A1 (en) Device and method for starting mobile terminal application and mobile terminal
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
EP2979177A1 (en) Method for controlling process of application and computer system
CN105278942B (en) Component management method and device
WO2014166307A1 (en) Method for determining performance of process of application and computer system
CN107015866B (en) Data processing method and device
CN106095423B (en) Method, terminal and server for providing browsing service
CN106919458B (en) Method and device for Hook target kernel function
EP3129883B1 (en) Method and apparatus for repairing dynamic link library file
US11150913B2 (en) Method, device, and terminal for accelerating startup of application
CN106709330B (en) Method and device for recording file execution behaviors
CN107967203B (en) Function judgment method and device based on executable file
EP2869233A1 (en) Method, device and terminal for protecting application program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant