Shared library file loading method, electronic equipment and computer readable storage medium

By pre-installing encrypted source code in electronic devices and decrypting and compiling shared library files at startup, the problem of needing to compile separately for different device models is solved, improving delivery efficiency without affecting user experience.

CN121879856APending Publication Date: 2026-04-17HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-10-15
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies require compiling different shared library files for different models of electronic devices, resulting in long delivery chains and low delivery efficiency.

Method used

By pre-installing encrypted source code in electronic devices, the electronic devices decrypt and compile shared library files when launching the target application, thereby loading the shared library files and avoiding the repeated compilation process for different device models.

Benefits of technology

It shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121879856A_ABST
    Figure CN121879856A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a shared library file loading method, electronic equipment and a computer readable storage medium, in the method, in response to an operation of a user on a target application, the electronic equipment starts the target application, if the starting is the first starting, the electronic equipment loads a first shared library file of the target application, and if the starting is the second starting, the first shared library file loads the target application. The method comprises the following steps: acquiring an encrypted source code from a first shared library file, then acquiring a second shared library file on which the first shared library file depends according to the encrypted source code, and storing the second shared library file in a user partition, and finally, loading the second shared library file in the user partition by the electronic equipment, thereby realizing the purpose that when the shared library file is delivered, the shared library file can be quickly delivered. According to the technical scheme, only the encrypted source code needs to be preset in the electronic equipment, then the electronic equipment can obtain the shared library file according to the preset encrypted source code, different shared library files do not need to be compiled for different types of electronic equipment in advance, the delivery chain is shortened, the delivery efficiency is improved, and the user experience is not affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart terminal technology, and in particular to a method for loading shared library files, an electronic device, and a computer-readable storage medium. Background Technology

[0002] In mobile phones and other Linux-based electronic devices, shared object files (.so) are a form of dynamic link library. Shared object files are used to store reusable code and data so that multiple programs can share this code and data.

[0003] In existing related technologies, it is necessary to first compile the algorithm's source code files into corresponding shared library files for different electronic device models, and then pre-install the compiled shared library files into the corresponding electronic device models for application use. However, this approach requires compiling different shared library files for different electronic device models, resulting in a long delivery chain and low delivery efficiency. Summary of the Invention

[0004] This application provides a method for loading shared library files, an electronic device, and a computer-readable storage medium. When delivering shared library files, only encrypted source code needs to be pre-installed in the electronic device. The electronic device can then obtain the shared library file based on the pre-installed encrypted source code. This eliminates the need to compile different shared library files for different models of electronic devices, shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

[0005] In a first aspect, embodiments of this application provide a method for loading a shared library file, comprising: responding to a user's operation on a target application, an electronic device launches the target application; if this launch is the first time the electronic device has launched the target application, then loading a first shared library file of the target application; obtaining encrypted source code that the first shared library file depends on from the first shared library file of the target application; obtaining a second shared library file that the first shared library file depends on based on the encrypted source code; saving the second shared library file in a user partition of the electronic device; and loading the second shared library file in the user partition.

[0006] In one possible implementation, obtaining the second shared library file that the first shared library file depends on based on the encrypted source code includes: decrypting the encrypted source code to obtain the source code that the first shared library file depends on; and compiling the source code to obtain the second shared library file that the first shared library file depends on.

[0007] In one possible implementation, after the electronic device starts the target application, if this is not the first time the electronic device has started the target application, then the second shared library file in the user partition is loaded.

[0008] In one possible implementation, before the electronic device launches the target application, it encrypts the source code that the first shared library file depends on to obtain the encrypted source code that the first shared library file depends on; and then pre-installs the encrypted source code that the first shared library file depends on into the electronic device.

[0009] In one possible implementation, the first launch of the target application by the electronic device includes: launching the target application for the first time after the electronic device is newly powered on; or launching the target application for the first time after the electronic device is restored to factory settings; or launching the target application for the first time after the operating system of the electronic device is updated and the electronic device is restarted.

[0010] In one possible implementation, after saving the second shared library file in the user partition of the electronic device, if the second shared library file already exists in the user partition of the electronic device, the version number of the second shared library file already existing in the user partition is compared with the version number of the second shared library file saved this time; the second shared library file with the lower version number is deleted.

[0011] In one possible implementation, encrypting the source code that the first shared library file depends on includes: encrypting the source code that the first shared library file depends on using a preset key in the electronic device.

[0012] In one possible implementation, decrypting the encrypted source code includes: using a pre-installed key in the electronic device to decrypt the encrypted source code.

[0013] In the above-described method for loading shared library files, in response to a user's operation on the target application, the electronic device launches the target application. If this launch is the first time the electronic device has launched the target application, the electronic device loads the first shared library file of the target application, obtains the encrypted source code that the first shared library file depends on from the first shared library file, and then, based on the encrypted source code, obtains the second shared library file that the first shared library file depends on, and saves the second shared library file in the user partition of the electronic device. Finally, the electronic device loads the second shared library file from the user partition. This allows the delivery of shared library files to be achieved simply by pre-installing the encrypted source code in the electronic device. The electronic device can then obtain the shared library file based on the pre-installed encrypted source code, eliminating the need to compile different shared library files for different models of electronic devices. This shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

[0014] Secondly, embodiments of this application provide an electronic device, including: one or more processors; a memory; multiple application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to perform the method provided in the first aspect.

[0015] It should be understood that the second aspect of the embodiments of this application is consistent with the technical solution of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again.

[0016] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method provided in the first aspect.

[0017] Fourthly, embodiments of this application provide a computer program that, when executed by a computer, performs the method provided in the first aspect.

[0018] In one possible design, the program in the fourth aspect can be stored wholly or partially on a storage medium packaged with the processor, or it can be stored wholly or partially on a memory not packaged with the processor. Attached Figure Description

[0019] Figure 1 This is a schematic diagram illustrating how shared library files are pre-installed on a mobile phone in existing related technologies.

[0020] Figure 2 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application;

[0021] Figure 3 A software structure block diagram of an electronic device 100 provided in one embodiment of this application;

[0022] Figure 4 A flowchart illustrating a method for loading shared library files according to an embodiment of this application;

[0023] Figure 5 A schematic diagram illustrating the acquisition of a second shared library file provided in one embodiment of this application;

[0024] Figure 6 A flowchart illustrating a method for loading shared library files provided in another embodiment of this application;

[0025] Figure 7 A schematic diagram illustrating the acquisition of a second shared library file provided in another embodiment of this application;

[0026] Figure 8 A schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0027] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.

[0028] Figure 1 This is a diagram illustrating how shared library files are pre-installed on a mobile phone in existing related technologies. Figure 1 The following explanation uses AlgoK.so as an example of a shared library file.

[0029] The aforementioned AlgoK.so can provide image enhancement algorithms. For existing related technologies, see [link to relevant documentation]. Figure 1 The process involves first compiling the source code of the image enhancement algorithm into a shared library file (Algok.so) corresponding to the phone model, and then pre-installing the compiled shared library file into the product components of the corresponding phone model. This way, after the phone launches the gallery application, the gallery application can first call eHdr.so, and then eHdr.so calls AlgoK.so. eHdr.so is a shared library file specifically designed for processing high dynamic range (HDR) images or videos.

[0030] However, the process of pre-installing shared library files requires compiling different shared library files for different mobile phone models, resulting in a long delivery chain and low delivery efficiency.

[0031] Based on the above problems, this application provides a method for loading shared library files. When delivering shared library files, the encrypted source code only needs to be pre-installed in the electronic device. The electronic device can then obtain the shared library file based on the pre-installed encrypted source code. This eliminates the need to compile different shared library files for different models of electronic devices, shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

[0032] The method for loading shared library files provided in this application can be applied to electronic devices, which may include smartphones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. This application does not impose any restrictions on the specific type of electronic device.

[0033] For example, Figure 2 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application, as shown below. Figure 2 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0034] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0035] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0036] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0037] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0038] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0039] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0040] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0041] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0042] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0043] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0044] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0045] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0046] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0047] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0048] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP performs Fourier transforms on the frequency energy.

[0049] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.

[0050] Figure 3 This is a software structure block diagram of an electronic device 100 provided in one embodiment of this application.

[0051] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0052] The application layer can include a series of application packages.

[0053] like Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0054] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0055] like Figure 3 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0056] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0057] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0058] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0059] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).

[0060] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0061] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0062] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0063] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0064] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0065] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0066] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0067] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0068] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0069] A 2D graphics engine is a graphics engine for 2D drawing.

[0070] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0071] For ease of understanding, the following embodiments of this application will be described using the following methods: Figure 2 and Figure 3 Taking the electronic device with the structure shown as an example, and in conjunction with the accompanying drawings and application scenarios, the method for loading shared library files provided in this application embodiment will be specifically described.

[0072] Figure 4 A flowchart illustrating a method for loading shared library files according to one embodiment of this application is shown below. Figure 4 As shown, the methods for loading the aforementioned shared library files may include:

[0073] Step 401: In response to the user's operation on the target application, the electronic device 100 launches the target application.

[0074] The target application mentioned above can be an application such as a gallery or camera. This embodiment does not limit the target application, as long as the shared library file that the target application needs to call is stored in the user partition of the electronic device 100.

[0075] The user's operation on the target application can be a click on the target application's icon. In response to the user's click on the target application's icon, the electronic device 100 starts the target application.

[0076] Step 402: If this startup is the first time the electronic device 100 has launched the target application, then the electronic device 100 loads the first shared library file of the target application.

[0077] The initial launch of the target application by the electronic device 100 may include: the initial launch of the target application after the electronic device 100 is powered on for the first time; or...

[0078] After electronic device 100 is restored to factory settings, the aforementioned target application is launched for the first time; or,

[0079] The operating system of electronic device 100 is updated, and after electronic device 100 restarts, the aforementioned target application is launched for the first time.

[0080] Step 403: Electronic device 100 obtains the encrypted source code that the first shared library file depends on from the first shared library file of the target application.

[0081] Figure 5 This is a schematic diagram illustrating the acquisition of a second shared library file according to one embodiment of this application. Figure 5 Let's take a gallery as an example to illustrate this.

[0082] See Figure 5 In box 52, when this startup is the first time electronic device 100 starts the gallery, electronic device 100 first loads eHdr.so, which is the first shared library file of the gallery. Then, electronic device 100 obtains the encrypted source code that eHdr.so depends on from eHdr.so.

[0083] Step 404: Electronic device 100 obtains the second shared library file that the first shared library file depends on, based on the above-mentioned encrypted source code.

[0084] Specifically, based on the aforementioned encrypted source code, obtaining the second shared library file that the first shared library file depends on can be achieved by: electronic device 100 decrypting the aforementioned encrypted source code to obtain the source code that the first shared library file depends on; then, electronic device 100 compiling the aforementioned source code to obtain the second shared library file that the first shared library file depends on. When electronic device 100 decrypts the aforementioned encrypted source code, it can employ a white-box decryption method.

[0085] Step 405: Electronic device 100 saves the second shared library file in the user partition of electronic device 100.

[0086] See also Figure 5 In box 52, after electronic device 100 obtains the encrypted source code that eHdr.so depends on, it can decrypt the encrypted source code to obtain the source code that eHdr.so depends on. Then, electronic device 100 compiles the source code to obtain AlgoK.so, which eHdr.so depends on. Here, AlgoK.so is the second shared library file that the first shared library file depends on. Afterwards, electronic device 100 can save AlgoK.so in its user partition.

[0087] Step 406: Electronic device 100 loads the second shared library file from the aforementioned user partition.

[0088] See Figure 5In box 53, after electronic device 100 saves AlgoK.so in the user partition of electronic device 100, electronic device 100 can load AlgoK.so from the aforementioned user partition.

[0089] In some examples, after step 401, if this startup is not the first time the electronic device 100 has started the target application, the electronic device 100 can directly load the second shared library file in the user partition.

[0090] Because the electronic device 100 saves the second shared library file in the user partition when it first launches the target application, it can directly load the second shared library file from the user partition when it launches the target application again. Figure 5 For example, if electronic device 100 is not launching the gallery for the first time, electronic device 100 first loads eHdr.so, and then loads AlgoK.so from the user partition via eHdr.so. The loading process is as follows: Figure 5 As shown in box 53.

[0091] In some other examples, before step 401, the source code that the first shared library file depends on can be encrypted to obtain encrypted source code that the first shared library file depends on; then, the encrypted source code that the first shared library file depends on is pre-installed in electronic device 100. Specifically, when encrypting the source code that the first shared library file depends on, a white-box encryption method can be used with the pre-installed key in electronic device 100. White-box encryption is a symmetric encryption method where the same key is used for encryption and decryption. Thus, in step 404, when electronic device 100 decrypts the encrypted source code, it can use the pre-installed key in electronic device 100 to perform white-box decryption of the encrypted source code.

[0092] Furthermore, the preset keys are the same across different models of electronic devices 100. Therefore, the operation of encrypting the source code to generate encrypted source code only needs to be performed once, generating only one copy of the encrypted source code. See [link / reference]. Figure 5 In box 51, after encrypting the source code and generating encrypted source code, this encrypted source code can be pre-installed into the product components of mobile phones 1, 2, and 3 respectively. In this embodiment, only one encrypted source code needs to be generated and pre-installed into different models of electronic devices 100. Subsequently, the electronic devices 100 can obtain the shared library file based on the pre-installed encrypted source code, without needing to compile different shared library files for different models of electronic devices in advance. This shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

[0093] In the above-described method for loading shared library files, in response to a user's operation on the target application, the electronic device 100 starts the target application. If this is the first time the electronic device 100 has started the target application, the electronic device 100 loads the first shared library file of the target application, obtains the encrypted source code that the first shared library file depends on from the first shared library file, and then, based on the encrypted source code, the electronic device 100 obtains the second shared library file that the first shared library file depends on, and saves the second shared library file in the user partition of the electronic device 100. Finally, the electronic device 100 loads the second shared library file from the user partition. This allows the delivery of shared library files to be achieved simply by pre-installing the encrypted source code in the electronic device 100, and then the electronic device 100 can obtain the shared library file based on the pre-installed encrypted source code. This eliminates the need to compile different shared library files for different models of electronic devices, shortens the delivery chain, improves delivery efficiency, and does not affect the user experience.

[0094] Figure 6 A flowchart of a method for loading shared library files provided in another embodiment of this application is shown below. Figure 6 As shown, this application Figure 4 In the illustrated embodiment, after step 405, the following may also be included:

[0095] Step 601: If a second shared library file already exists in the user partition of electronic device 100, then electronic device 100 compares the version number of the second shared library file already existing in the user partition with the version number of the second shared library file saved this time.

[0096] Step 602: Electronic device 100 deletes the second shared library file with a lower version number.

[0097] Specifically, after the electronic device 100 saves the second shared library file in the user partition, it discovers that the second shared library file already exists in the user partition of the electronic device 100. This situation mostly occurs when the operating system of the electronic device 100 is updated, the electronic device 100 is restarted, and the target application is launched for the first time.

[0098] See Figure 7 , Figure 7 This is a schematic diagram illustrating the acquisition of a second shared library file, provided as another embodiment of this application. Figure 7 The example below will still use a gallery as the target application. Figure 7 As shown in box 71, after the operating system of electronic device 100 is updated and electronic device 100 restarts, during the initial startup of the gallery, electronic device 100 executes the application. Figure 4After steps 401 to 405 in the illustrated embodiment, the electronic device 100 saves AlgoK.so, which eHdr.so depends on, in the user partition of the electronic device 100. It should be noted that if the electronic device 100 finds that AlgoK.so already exists in the user partition when saving AlgoK.so, which eHdr.so depends on, then the electronic device 100 needs to rename the saved AlgoK.so, such as... Figure 7 As shown in box 71, when the electronic device 100 saves the AlgoK.so obtained this time to the user partition, it renames the AlgoK.so obtained this time to AlgoK1.so.

[0099] See afterward. Figure 7 In box 72, electronic device 100 can compare the version number of AlgoK.so that already exists in the user partition with the version number of AlgoK1.so that is saved this time. If the version number of AlgoK1.so is higher, AlgoK.so is deleted, and after deleting AlgoK.so, AlgoK1.so is renamed to AlgoK.so; if the version number of AlgoK.so is higher, AlgoK1.so is deleted.

[0100] Subsequently, when electronic device 100 restarts the gallery, the process of loading AlgoK.so can be as follows: Figure 5 As shown in box 53, it will not be elaborated further here.

[0101] In addition, in this embodiment, since the second shared library file already exists in the user partition of the electronic device 100, after the electronic device 100 starts the target application and loads the first shared library file, it can directly load the second shared library file that already exists in the user partition through the first shared library file. The above-mentioned operations of comparing the version numbers of the two second shared libraries and deleting the second shared library file with the lower version number can be completed when the electronic device 100 is idle.

[0102] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and other operations or variations thereof can be performed in the embodiments of this application. Furthermore, the steps may be performed in different orders as presented in the above embodiments, and it is not necessary to perform all the operations in the above embodiments.

[0103] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithm steps of the examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0104] This embodiment can divide the electronic device into functional modules according to the above method embodiment. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0105] Figure 8 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. In the case where functional modules are divided according to their respective functions, Figure 8 A schematic diagram of a possible composition of the electronic device 800 involved in the above embodiments is shown, such as... Figure 8 As shown, the electronic device 800 may include: a receiving unit 801, a processing unit 802, and a transmitting unit 803;

[0106] The processing unit 802 can be used to support the electronic device 800 in executing steps 401 to 406, steps 601 to 602 and / or other processes used in the technical solutions described in the embodiments of this application.

[0107] It should be noted that the above application Figures 4-7 All relevant content of each step involved in the illustrated embodiment can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0108] The electronic device 800 provided in this embodiment is used to execute this application. Figures 4-7 The shared library file loading method provided in the illustrated embodiment can achieve the same effect as the method described above.

[0109] It should be understood that electronic device 800 can correspond to Figure 2 The electronic device 100 shown. The functions of the receiving unit 801 and the transmitting unit 803 can be determined by... Figure 2The processor 110, antenna 1, and mobile communication module 150 in the electronic device 100 shown are, and / or, implemented by the processor 110, antenna 2, and wireless communication module 160; the function of the processing unit 802 can be implemented by... Figure 2 The processor 110, touch sensor 180K, and display screen 194 in the illustrated electronic device 100 are implemented.

[0110] When using integrated units, the electronic device 800 may include a processing module, a storage module, and a communication module.

[0111] The processing module can be used to control and manage the actions of the electronic device 800. For example, it can support the electronic device 800 in executing the steps performed by the receiving unit 801, processing unit 802, and sending unit 803. The storage module can support the electronic device 800 in storing program code and data. The communication module can support communication between the electronic device 800 and other devices.

[0112] The processing module can be a processor or controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as radio frequency circuitry, a Bluetooth chip, and / or a Wi-Fi chip.

[0113] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device 800 involved in this embodiment can be a device having... Figure 2 The device with the structure shown.

[0114] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute this application. Figures 4-7 The method provided in the illustrated embodiment.

[0115] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute this application. Figures 4-7 The method provided in the illustrated embodiment.

[0116] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0117] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0119] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0120] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A method for loading a shared library file, characterized in that, include: In response to a user's action on the target application, the electronic device launches the target application; If this is the first time the electronic device has launched the target application, then the first shared library file of the target application is loaded; Obtain the encrypted source code that the first shared library file depends on from the first shared library file of the target application; Based on the encrypted source code, obtain the second shared library file that the first shared library file depends on; Save the second shared library file in the user partition of the electronic device; Load the second shared library file from the user partition.

2. The method according to claim 1, characterized in that, The step of obtaining the second shared library file that the first shared library file depends on based on the encrypted source code includes: Decrypt the encrypted source code to obtain the source code that the first shared library file depends on; The source code is compiled to obtain the second shared library file that the first shared library file depends on.

3. The method according to claim 1, characterized in that, After the electronic device launches the target application, it also includes: If this startup is not the first time the electronic device has launched the target application, then the second shared library file in the user partition is loaded.

4. The method according to claim 1, characterized in that, Before the electronic device launches the target application, it also includes: The source code that the first shared library file depends on is encrypted to obtain the encrypted source code that the first shared library file depends on. The encrypted source code that the first shared library file depends on is pre-installed into the electronic device.

5. The method according to claim 1, characterized in that, The initial launch of the target application by the electronic device includes: The target application is launched for the first time upon the first power-on of a new electronic device; or... After the electronic device is restored to factory settings, the target application is launched for the first time; or... The target application is launched for the first time after the electronic device's operating system is updated and the electronic device restarts.

6. The method according to claim 1, characterized in that, After saving the second shared library file in the user partition of the electronic device, the method further includes: If a second shared library file already exists in the user partition of the electronic device, then compare the version number of the existing second shared library file in the user partition with the version number of the second shared library file saved this time. Delete the second shared library file with the lower version number.

7. The method according to claim 4, characterized in that, The encryption of the source code that the first shared library file depends on includes: The source code that the first shared library file depends on is encrypted using a pre-installed key in the electronic device.

8. The method according to claim 2, characterized in that, The decryption of the encrypted source code includes: The encrypted source code is decrypted using a pre-installed key in the electronic device.

9. An electronic device, characterized in that, include: One or more processors; Memory; Multiple applications; And one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs including instructions that, when executed by the electronic device, cause the electronic device to perform the method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-8.