A startup method, electronic equipment and computer storage medium

By stopping the scanning of unsafe installation packages during the startup process of the electronic device when it detects that the application signature is different from the system signature, the problem of startup failure in the prior art is solved, and normal startup and application installation of the electronic device are realized.

CN115562732BActive Publication Date: 2025-01-21HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210360658.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-07
Publication Date
2025-01-21
Estimated Expiration
2042-04-07

AI Technical Summary

Technical Problem

When the existing startup solution detects that the application signature in the target installation package is different from the system signature, it will interrupt the scanning of the subsequent installation package, resulting in the startup failure and affecting the use of electronic devices.

Method used

During the boot process of the electronic device, if it is detected that the application signature in the first installation package is different from the system signature, the scan of the first installation package will be stopped, the parsed information will not be loaded into the running memory, and other installation packages will be continued to be scanned to ensure the boot process. of normal execution.

Benefits of technology

By skipping the scanning of unsafe target installation packages, it prevents them from affecting the entire boot process, ensuring that the electronic device can boot normally and continue to complete the installation of other applications, thereby improving the usability of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115562732B_ABST
    Figure CN115562732B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a boot method, an electronic device, and a computer storage medium, which relate to the field of terminal technology, and can ensure that the electronic device can be normally booted on the basis of avoiding the installation of unsafe applications in the electronic device. Among them, the method includes: during the boot process of the electronic device, the electronic device starts to scan a first installation package, and the first installation package is an installation package of a first application with high authority. Scanning the first installation package includes: determining whether the first signature of the first application is the same as the system signature of the electronic device. If the first signature is different from the system signature, the electronic device stops scanning the first installation package, and does not load the parsed information of the first installation package into the running memory. The electronic device starts to scan the second installation package of the second application. Among them, the information loaded into the running memory is used to install the corresponding application. After the electronic device is turned on, the second application is installed on the electronic device, but the first application is not installed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a startup method, an electronic device and a computer storage medium. Background Art

[0002] During the startup process of electronic devices such as mobile phones and tablets, the installation packages of applications in the electronic devices will be scanned in sequence, and the installation of the applications will be completed. Taking an Android phone as an example, the installation package of the application can be an Android application package (APK). In this way, after the electronic device is successfully powered on, the user can skip the installation steps and directly use the installed application. Among them, in order to ensure the security of the electronic device, for the target installation package of the target application with high permissions (such as the default need to obtain the system permissions of the electronic device), when scanning it, it will detect whether the application signature in the target installation package is the same as the system signature of the electronic device. When the application signature is the same as the system signature, it can be confirmed that the target application is safe.

[0003] However, the inventors found in the process of implementing the embodiments of the present application that in the existing startup scheme, if it is detected that the application signature and the system signature in any target installation package are different, it is considered that there is a security threat, and the scanning of all subsequent installation packages is interrupted at this time. The interruption of scanning will cause the subsequent startup process to be unable to continue normally. Further, it will cause the startup failure, affecting the use of the electronic device. Summary of the invention

[0004] The embodiments of the present application provide a startup method, an electronic device, and a computer storage medium, which can ensure that the electronic device can be started normally while preventing the electronic device from installing unsafe applications.

[0005] In the first aspect, an embodiment of the present application provides a startup method, which is applied to the startup of electronic devices such as mobile phones, tablets, and watches. The electronic device includes multiple installation packages, and each installation package can be used to install a corresponding application. Among them, the multiple installation packages include a first installation package and a second installation package. The first installation package is an installation package for the first application, and the second installation package is an installation package for the second application. The first application is a high-privilege application, such as a system application. And, the first installation package includes a first signature of the first application. Normally, the publisher of the high-privilege application will use the system signature of the electronic device to sign the application. Then, the application signature of the first application, that is, the first signature, should be the same as the system signature of the electronic device. And, the installation package of the high-privilege application is usually stored in a specific directory of the electronic device, such as the first directory, so the first installation package can also be stored in the first directory.

[0006] Specifically, during the process of starting up an electronic device, the electronic device can usually scan multiple installation packages and complete the installation of multiple applications corresponding to the multiple installation packages according to the scanning results, so that after the electronic device is turned on, multiple applications can be directly used without the need for manual installation by the user. For the first installation package, the process of the electronic device scanning it includes: the electronic device starts scanning the first installation package and obtains a first signature from the first installation package; then, the electronic device determines whether the first signature is the same as the system signature of the electronic device.

[0007] If the first signature is different from the system signature, it indicates that the first application may have been tampered with, which will pose a security threat to the electronic device. At this time, the electronic device stops scanning the first installation package, and does not load any information parsed from scanning the first installation package into the running memory, such as the package name of the first installation package, the first signature, etc. However, the electronic device will continue to scan other installation packages, such as starting to scan the second installation package. Among them, the information loaded into the running memory is used to install the corresponding application. It should be understood that since the information parsed from scanning the first installation package is not loaded into the running memory, the information parsed from scanning the first installation package cannot be used to install the first application later. Finally, after the electronic device is turned on, the second application is installed on the electronic device, but the first application is not installed.

[0008] In summary, by using the method of the embodiment of the present application, even if the signature of the first application with high authority is different from the system signature of the electronic device, the electronic device will only stop scanning the first installation package, and will not load the parsed information of the first installation package scanned by the electronic device into the running memory, but will continue to scan other installation packages. The scanning process can continue, and then other applications, such as the installation of the second application, can be completed during the boot process. Finally, the boot is successful. In this way, under the premise of the existence of unsafe applications, the unsafe applications will not affect the normal execution of the entire boot process, so that the electronic device can be successfully booted without affecting the use of the electronic device.

[0009] In one possible design, the first directory is used to store the installation packages of preset applications, which are high-authority applications. Exemplarily, the preset applications are system applications of electronic devices. Another example is that the preset applications are enterprise applications issued by enterprise servers to electronic devices. These enterprise applications have high permissions, and users can only passively use these applications, but cannot actively uninstall or update them. Enterprise servers are used to manage applications in electronic devices.

[0010] That is to say, by adopting the method of this embodiment, the electronic device can store all installation packages of high-authority applications in the first directory, so as to facilitate the management of high-authority applications by the electronic device.

[0011] In another possible design, the electronic device includes at least one second directory, and the at least one directory is used to store installation packages. Then, the first directory for storing the first installation package naturally belongs to the second directory. During the process of starting up the electronic device, the electronic device scans each directory in the at least one second directory in turn, and when the electronic device scans a directory, it scans each installation package in the directory in turn. The second installation package is the next installation package to be scanned after scanning the first installation package.

[0012] That is to say, by adopting the method of this embodiment, the electronic device can scan the installation packages in the electronic device in an orderly manner to avoid confusion in the scanning.

[0013] In another possible design, the electronic device scans the installation package and parses the information including at least one of the following: the package name of the installation package, the version number of the application, the signature of the application, and the permissions of the application. For example, scanning the first installation package may parse at least one of the package name of the first installation package, the application version of the first application, the signature of the first application (i.e., the first signature), and the application permissions of the first application.

[0014] That is, by using the method of this embodiment, the electronic device can obtain data by scanning the installation package for application installation, permission management, and other processing.

[0015] In another possible design, if the first signature is the same as the system signature, it indicates that the first application is safe, and the electronic device can continue to scan the first installation package. And, in response to the completion of scanning the first installation package, the electronic device can load the information parsed from scanning the first installation package into the running memory, and start scanning the second installation package. Then, after the scan is completed, the electronic device can also complete the installation of the first application based on the information in the running memory. In this way, after the electronic device is turned on, the first application and the second application are installed on the electronic device.

[0016] That is to say, using the method of this embodiment, if the first application is safe, the electronic device can complete the installation of the first application during the boot process, so that after booting, the electronic device can directly provide the first application to the user.

[0017] In another possible design, if the first signature is different from the system signature, the electronic device may also record an error log, which includes a preset error type and an identifier of the first installation package, and the preset error type indicates that the application signature is different from the system signature.

[0018] That is, by adopting the method of this embodiment, when an unsafe application is detected, the electronic device can record an error log to facilitate subsequent error correction.

[0019] In another possible design, in an enterprise management scenario, the first application is an enterprise application issued by an enterprise server to an electronic device, and the enterprise server is used to manage and control applications in the electronic device. After the electronic device records an error log, the electronic device can send the error log to the enterprise server. The electronic device receives a third installation package issued by the enterprise server, and the third installation package is an installation package for the first application. The third installation package includes a second signature of the first application, and the second signature is the same as the system signature. Then, the electronic device can store the third installation package in the first directory. During the process of starting up the electronic device again, the electronic device can successfully install the first application after completing the scan of the third installation package.

[0020] That is to say, by using the method of this embodiment, the enterprise server can re-sign the first application according to the error log and obtain a new installation package, namely the third installation package, thereby solving the error indicated by the error log. Then, during the restart process, the first application can be successfully installed.

[0021] In another possible design, the second installation package is also located in the first directory, that is, the second application is also a high-authority application. The second installation package includes the third signature of the second application. Then, during the scanning process for the second installation package, it is also necessary to determine whether the third signature is the same as the system signature. Moreover, only when the third signature is the same as the system signature, that is, when the second application is a safe application, can the second application be successfully installed. So that after the electronic device is turned on, the second application is installed on the electronic device.

[0022] That is to say, with the method of this embodiment, the electronic device needs to detect the safety of any high-authority application before completing the installation, thereby improving the security of the electronic device.

[0023] In another possible design, in an electronic device of the Android system, the package management service PKMS in the electronic device performs the scanning action of the installation package. Therefore, the electronic device starts scanning the first installation package as follows: the PKMS in the electronic device starts scanning the first installation package. The electronic device stops scanning the first installation package as follows: the PKMS stops scanning the first installation package. The electronic device starts scanning the second installation package as follows: the PKMS starts scanning the second installation package.

[0024] In a second aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising a first installation package and a second installation package, the first installation package being an installation package of a first application, the second installation package being an installation package of the second application, the first installation package being located in a first directory, the first installation package comprising a first signature of the first application, the electronic device further comprising: a memory and one or more processors, the memory being coupled to the processor; wherein the memory stores a computer program code, the computer program code comprising a computer instruction, and when the computer instruction is executed by the processor, the electronic device performs the following steps:

[0025] During the process of starting up the electronic device, the electronic device starts to scan the first installation package; wherein, the scanning of the first installation package includes: determining whether the first signature is the same as the system signature of the electronic device. If the first signature is different from the system signature, the electronic device stops scanning the first installation package, and the electronic device starts scanning the second installation package; wherein, the electronic device will not load the parsed information from scanning the first installation package into the running memory, and the information loaded into the running memory is used to install the corresponding application. After the electronic device is turned on, the second application is installed on the electronic device, and the first application is not installed.

[0026] In a possible design, the first directory is used to store installation packages of preset applications. The preset applications are system applications of the electronic device; and / or the preset applications are enterprise applications issued by an enterprise server to the electronic device, and the enterprise server is used to manage and control applications in the electronic device.

[0027] In another possible design, the electronic device includes at least one second directory, and the at least one second directory includes the first directory. When the computer instruction is executed by the processor, the electronic device performs the following steps: wherein, during the process of starting up the electronic device, the electronic device sequentially scans each directory in the at least one second directory, and when the electronic device scans a directory, it sequentially scans each installation package in the directory; the second installation package is the next installation package to be scanned after scanning the first installation package.

[0028] In another possible design, the information parsed by the electronic device when scanning the installation package includes at least one of the following: the package name of the installation package, the version number of the application, the signature of the application, and the permissions of the application.

[0029] In another possible design, when the computer instruction is executed by the processor, the electronic device performs the following steps: if the first signature is the same as the system signature, the electronic device continues to scan the first installation package. In response to the completion of scanning the first installation package, the electronic device loads the information parsed from scanning the first installation package into the running memory, and starts scanning the second installation package. After the electronic device is turned on, the first application and the second application are installed on the electronic device.

[0030] In another possible design, when the computer instructions are executed by the processor, the electronic device performs the following steps: if the first signature is different from the system signature, the electronic device records an error log, the error log includes a preset error type and an identifier of the first installation package, and the preset error type indicates that the application signature is different from the system signature.

[0031] In another possible design, the first application is an enterprise application issued by an enterprise server to the electronic device, and the enterprise server is used to manage and control applications in the electronic device. When the computer instruction is executed by the processor, the electronic device performs the following steps: the electronic device sends the error log to the enterprise server. The electronic device receives a third installation package issued by the enterprise server, the third installation package is an installation package of the first application, the third installation package includes a second signature of the first application, and the second signature is the same as the system signature. The electronic device stores the third installation package in the first directory.

[0032] In another possible design, the second installation package is also located in the first directory, and the second installation package includes the third signature of the second application. When the computer instruction is executed by the processor, the electronic device executes the following steps: if the third signature is the same as the system signature, the electronic device is powered on and the second application is installed on the electronic device.

[0033] In another possible design, when the computer instruction is executed by the processor, the electronic device executes the following steps: the package management service PKMS in the electronic device starts scanning the first installation package. The PKMS stops scanning the first installation package. The PKMS starts scanning the second installation package.

[0034] In a third aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device including a display screen and a memory; the chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected by lines; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method described in the first aspect and any possible design method thereof.

[0035] In a fourth aspect, the present application provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect and any possible design thereof.

[0036] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method as described in the first aspect and any possible design thereof.

[0037] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the chip system described in the third aspect, the computer storage medium described in the fourth aspect, and the computer program product described in the fifth aspect provided above can be referred to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of the principle of a startup method provided in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of another power-on method provided in an embodiment of the present application;

[0040] Figure 3 A schematic diagram of the hardware structure of a mobile phone provided in an embodiment of the present application;

[0041] Figure 4 A schematic diagram of the software structure of a mobile phone provided in an embodiment of the present application;

[0042] Figure 5 A flowchart of a startup method provided in an embodiment of the present application;

[0043] Figure 6 A schematic diagram of the process of updating the system signature and issuing the installation package in the enterprise management scenario provided in the embodiment of the present application;

[0044] Figure 7A schematic diagram of the sequence of PKMS scanning the installation package in the startup method provided in an embodiment of the present application;

[0045] Figure 8 A schematic diagram of a process of a startup method provided in an embodiment of the present application;

[0046] Fig. 9 A schematic diagram of another power-on method provided in an embodiment of the present application;

[0047] Fig.10 Flow chart of another startup method provided in an embodiment of the present application

[0048] Fig.11 A schematic diagram of the composition of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0050] In an electronic device of the Android system, the Package Manager Service (PKMS) can be used to complete all preset processes related to the installation package of the application in the Android system. For example, the PKMS is responsible for the installation, uninstallation, update and permission management of the application.

[0051] During the boot process of an Android system electronic device, it is necessary to complete the PKMS initialization first to obtain the information required to perform the preset processing, and then call PKMS to complete the preset processing. During the PKMS initialization process, PKMS will scan each installation package in the electronic device in turn, and parse the package name, application version, application signature, application permissions and other information of the installation package for subsequent completion of the preset processing, such as the installation of the application. In addition, for some high-authority target applications (also referred to as the first application), for example, the target application can be an application that needs to obtain the system permissions of the electronic device by default, such as the setting application, the contact application and other system applications. After PKMS scans the target installation package of the target application (also referred to as the first installation package) and parses the application signature of the target application (also referred to as the first signature), it will further detect whether the application signature of the target application is the same as the system signature of the electronic device.

[0052] Normally, the publisher of the target application will use the system signature of the electronic device to sign the target application, so that the application signature of the target application is the same as the system signature. In this way, after the electronic device obtains the target installation package of the target application, it can confirm the security of the target application according to the application signature of the target application carried in the target installation package. It should be understood that if the target application is maliciously tampered with by an illegal user, since the illegal user cannot know the system signature of the electronic device, then the illegal user cannot use the system signature to sign the target application after maliciously tampering with the target application. Therefore, if PKMS detects that the application signature in the target installation package is different from the system signature, it can be confirmed that the target application may be tampered with by an illegal user. Since the target application has a high authority, it will bring great security threats to the electronic device after being illegally tampered. For example, the user privacy in the electronic device is stolen by the tampered target application. If PKMS detects that the application signature in the target installation package is different from the system signature, it can be confirmed that the target application has not been tampered with by an illegal user. In this case, the target application is safe.

[0053] Based on this, in some embodiments, it is considered that once the application signature is different from the system signature, a fatal error has occurred. Therefore, in order to improve the security of electronic devices, PKMS interrupts the scanning of all installation packages when it detects that the application signature in the target installation package is different from the system signature. The application signature in the target installation package is recorded as the application signature of the target application. For example, see Figure 1 During the boot process of an Android electronic device, PKMS should scan Figure 1 The installation package 1, installation package 2, installation package 3, and so on are shown as installation package n. Among them, installation package 2 is the target installation package. When the current installation package is installation package 2, if PKMS detects a match failure when scanning installation package 2, that is, the application signature and the system signature in installation package 2 are not the same, PKMS will interrupt the scanning of the installation package starting from installation package 2. In other words, the subsequent scanning process for installation package 2, such as the process of parsing application permissions, and the scanning process for installation package 3 and all subsequent installation packages will be interrupted.

[0054] Continue to see Figure 1 , interrupting the scanning of all installation packages is equivalent to interrupting the PKMS initialization, which will further cause the PKMS initialization to fail. Since the PKMS initialization fails, when the preset processing is subsequently executed, such as when installing the application, the call to PKMS fails, and all applications cannot be successfully installed. As a result, the target application cannot be successfully installed, which can avoid the great security threat to the electronic device caused by installing unsafe applications with high application permissions. For example, it leads to the leakage of user privacy data in the electronic device.

[0055] At the same time, if the call to PKMS fails, the subsequent boot process cannot continue normally, and the electronic device can only perform PKMS initialization again after restarting. However, the difference between the application signature and the system signature usually means that an error occurred when signing the target application, and even restarting cannot overcome it. Then, after the electronic device is restarted, the PKMS initialization will fail again. Normally, an electronic device will fail to boot after multiple (such as 3 times, 5 times, etc.) restart failures. For example, after an electronic device fails to restart 5 times, it will enter the engineering (recovery) mode and cannot boot normally. This makes the electronic device unusable.

[0056] See also Figure 2 , based on the above Figure 1 The technical problem in the embodiment shown in the figure, the embodiment of the present application provides a startup method, which can be applied to electronic devices such as mobile phones and tablets, and applications can be installed in the electronic devices. During the startup process of the electronic device, if the electronic device selects the target installation package currently scanned, such as Figure 2 In the installation package 2, if the parsed application signature is different from the system signature of the electronic device, the electronic device will skip scanning the target installation package currently being scanned. This can prevent the unsafe target application from affecting the normal boot. However, the electronic device will continue with the subsequent installation packages, such as continuing Figure 2 In this way, even if there is an unsafe target application, the scanning of the target application is simply skipped without interrupting the PKMS initialization, so that the PKMS initialization can be successful.

[0057] It should be understood that after the PKMS is successfully initialized, in the subsequent process of completing the preset processing, such as the installation of the application, the PKMS can be successfully called and the boot process can be successfully completed. Thus, the boot can be successful.

[0058] For example, the electronic device in the embodiment of the present application can be a mobile phone, a camera, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) or a virtual reality (VR) device, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device. Hereinafter, the present application scheme will be mainly explained by taking the electronic device being a mobile phone as an example.

[0059] See also Figure 3 , is a hardware structure diagram of a mobile phone 300 provided in an embodiment of the present application. Figure 3As shown, the mobile phone 300 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, a button 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a subscriber identification module (SIM) card interface 395, etc.

[0060] It is to be understood that the structure shown in this embodiment does not constitute a specific limitation on the mobile phone 300. In other embodiments, the mobile phone 300 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0061] The processor 310 may include one or more processing units, for example, the processor 310 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0062] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the mobile phone 300. In other embodiments, the mobile phone 300 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0063] The charging management module 340 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 may receive charging input from a wired charger through the USB interface 330. In some wireless charging embodiments, the charging management module 340 may receive wireless charging input through a wireless charging coil of the mobile phone 300. While the charging management module 340 is charging the battery 342, it may also power the mobile phone 300 through the power management module 341.

[0064] The power management module 341 is used to connect the battery 342, the charging management module 340 and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340, and supplies power to the processor 310, the internal memory 321, the external memory, the display screen 394, the camera 393, and the wireless communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 341 can also be set in the processor 310. In other embodiments, the power management module 341 and the charging management module 340 can also be set in the same device.

[0065] The wireless communication function of the mobile phone 300 can be realized through the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor and the baseband processor.

[0066] The wireless communication module 360 ​​can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the mobile phone 300. The wireless communication module 360 ​​can be one or more devices integrating at least one communication processing module. The wireless communication module 360 ​​receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 310. The wireless communication module 360 ​​can also receive the signal to be sent from the processor 310, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0067] The mobile phone 300 implements the display function through a GPU, a display screen 394, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 may include one or more GPUs, which execute program instructions to generate or change display information.

[0068] The mobile phone 300 can realize the shooting function through the ISP, the camera 393, the video codec, the GPU, the display screen 394 and the application processor. The ISP is used to process the data fed back by the camera 393. The camera 393 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. In some embodiments, the mobile phone 300 may include 1 or N cameras 393, where N is a positive integer greater than 1.

[0069] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 300. The external memory card communicates with the processor 310 through the external memory interface 320 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0070] The internal memory 321 can be used to store computer executable program codes, which include instructions. The processor 310 executes various functional applications and data processing of the mobile phone 300 by running the instructions stored in the internal memory 321. For example, the processor 310 can display different contents on the display screen 384 in response to the user's operation of unfolding the display screen 394 by executing the instructions stored in the internal memory 321. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile phone 300 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0071] The mobile phone 300 can implement audio functions such as music playing and recording through the audio module 370, the speaker 370A, the receiver 370B, the microphone 370C, the earphone interface 370D, and the application processor.

[0072] The key 390 includes a power key (also called a power key), a volume key, etc. The key 390 may be a mechanical key or a touch key. The mobile phone 300 may receive key inputs and generate key signal inputs related to user settings and function control of the mobile phone 300. In some embodiments, when the mobile phone 300 is in a powered-off state, the user's pressing of the power key may trigger the mobile phone 300 to power on.

[0073] Motor 391 can generate vibration prompts. Motor 391 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. Indicator 392 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc. SIM card interface 395 is used to connect a SIM card. The SIM card can be connected to and separated from the mobile phone 300 by inserting it into the SIM card interface 395 or pulling it out from the SIM card interface 395. The mobile phone 300 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.

[0074] In the embodiment of the present application, the software system of the mobile phone 300 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture or a cloud architecture. Or other operating systems. In the following embodiments, the Android system with a layered architecture is mainly used as an example to illustrate the software architecture of the mobile phone 300.

[0075] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, see Figure 4 , divides the Android system into four layers, from top to bottom: application layer, application framework layer, Android runtime and system library, and kernel layer.

[0076] like Figure 4 As shown, the application layer can be installed with applications such as calls, memos, browsers, contacts, cameras, gallery, calendars, maps, Bluetooth, music, videos, short messages, etc. By using the boot method provided in the embodiment of the present application, the installation of these applications can be completed during the boot process, so that after booting, the mobile phone 300 can directly provide these installed applications to the user.

[0077] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0078] The application framework layer can include a window manager, a resource manager, a notification manager, etc. Among them, the window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make the data accessible to the application. The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify the completion of downloads, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, a vibration is made, and an indicator light flashes.

[0079] In some embodiments, the application framework layer may also include an initialization (init) process, an incubation (Zygote) process, a system service (SystemServer) process, and PKMS. During the boot process of the mobile phone 300, the init process, the Zygote process, and the SystemServer process in the application framework layer may be started in sequence, and finally the SystemServer process may start the PKMS. The PKMS may be used to complete the scanning of the installation package during the boot process, and complete the preset processing related to the installation package, such as the installation of the application.

[0080] The system library can include multiple functional modules. For example: layer integrator (SurfaceFlinger), media library (Media Libraries), 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc. SurfaceFlinger is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0081] Android Runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system. The core library includes two parts: one part is the function that the Java language needs to call, and the other part is the Android core library. In some embodiments, the core library includes an initialization script file (init.rc), which can be used to start the init process in the application framework layer.

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

[0083] The kernel layer is a layer between hardware and software. The kernel layer includes at least a camera driver, an audio driver, a sensor driver, etc., and the present application embodiment does not impose any restrictions on this. In some embodiments, the kernel layer may also include a bootloader (BootLoader), and after the mobile phone 300 is powered on, the BootLoader may be loaded to boot the Linux kernel.

[0084] The boot method provided in the embodiment of the present application can be implemented in a mobile phone 300 having the above hardware structure and software system. The specific implementation of the boot method provided in the embodiment of the present application will be further described in detail with reference to the accompanying drawings. Hereinafter, the embodiment of the present application will be mainly described by taking the operating system being an Android system as an example. It should be understood that the system kernel of the Android system is the Linux kernel.

[0085] See also Figure 5 The power-on method of the embodiment of the present application includes the following steps:

[0086] Power on the phone. For example, when the phone is powered off, the user presses the power button to trigger the phone to power on. For another example, when the phone is powered on, the user clicks the shutdown and restart control to trigger the phone to power on again after being powered off.

[0087] S501, the boot loader (BootLoader) boots and starts the Linux kernel.

[0088] A boot process is required from powering on the phone to starting the Linux kernel. After the phone is powered on, the processor chip of the phone is also powered on. After that, the processor chip can load the BootLoader into the memory. The Bootloader is a program executed before the Linux kernel runs. After the BootLoader is loaded into the memory, it can be used to boot the Linux kernel. In the process of booting the Linux kernel by the Bootloader, the software and hardware environment required for the Linux kernel to run is first established, and then the Linux kernel is started.

[0089] S502. The Linux kernel searches for an initialization script (init.rc) file from a system library.

[0090] S503: The Linux kernel starts an initialization (init) process.

[0091] Among them, the init process is the first user-level process started by the kernel. The init process can complete the initialization of the hardware and software environment, virtual machine and other resources required for the operation of the Linux kernel based on the init.rc file. And, the init process can also start the Zygote process based on the init.rc file. The details are shown in S504 below.

[0092] S504, the init process starts the incubation (Zygote) process.

[0093] Among them, the Zygote process is the first Java process of the Android system, which is used to incubate all Java processes in the Android system. In other words, the Zygote process is the parent process of all Java processes.

[0094] The Zygote process is introduced in the init.rc file. Specifically, the init process parses the init.rc file and calls the start method of the application runtime file (AppRuntime.cpp) in the main method of the app_main.cpp file in the init.rc file to start the Zygote process.

[0095] After the Zygote process is started, Java-related resources can be created. For example, a Java virtual machine is created, Java classes are loaded, and Android core resources are loaded. Then, the Zygote process can copy the Zygote process through the fork mechanism and create a new process based on it. Since the Zygote process has already created a large number of Java-related resources, after the fork mechanism is used to copy the Zygote process, the newly created process can directly reuse these Java-related resources. There is no need to create Java-related resources after creating each new process. In this way, the time required to create Java-related resources for new processes can be saved.

[0096] S505. The hatching (Zygote) process hatches the system service (SystemServer) process.

[0097] The SystemServer process is the first Java process hatched by the Zygote process. The SystemServer process is responsible for starting and managing key services in the entire Java framework (FrameWork).

[0098] Exemplarily, the SystemServer process is responsible for starting and managing the window management service (ActivityManagerService, such as Figure 4 Services corresponding to the window manager in the program), task management service (WorkManagerService), power management service (PowerManagerService) and other services.

[0099] As another example, the SystemServer process can also start and manage the Package Manager Service (PKMS), as shown in S506 below:

[0100] S506. The system service (SystemServer) process starts PKMS.

[0101] The main method in the SystemServer process calls the package management Java file (PackageManagerService.java) to start PKMS. PKMS is mainly used to complete the preset processing related to the application installation package. For example, PKMS is responsible for the installation, uninstallation, update and permission management of the application. After PKMS is started, it is necessary to complete PKMS initialization first to obtain the information required to complete the preset processing.

[0102] In the embodiment of the present application, the process of PKMS initialization includes scanning the installation package, as shown in S507 below:

[0103] S507, PKMS scans the installation packages in the preset directory. If the current installation package is the target installation package, scanning the installation package needs to detect whether the application signature in the current installation package is the same as the system signature of the mobile phone.

[0104] For convenience of explanation, the preset directory may be referred to as at least one second directory.

[0105] In some embodiments, the preset directory includes a directory for storing installation packages of system applications (referred to as Directory 1). System applications are applications that are pre-installed in the mobile phone and cannot be uninstalled. For example, system applications include settings applications, contact applications, recorder applications, clock applications, etc. In this embodiment, before the mobile phone leaves the factory, the mobile phone manufacturer can store the installation package of the system application under Directory 1. When the mobile phone is turned on, PKMS scans the installation package under Directory 1, and then obtains the relevant information of the system application.

[0106] In some other embodiments, the preset directory includes a directory for storing installation packages of prefabricated applications (referred to as directory 2). Prefabricated applications are also pre-installed in the mobile phone, but prefabricated applications are usually uninstallable. It should be understood that prefabricated applications can be third-party applications, such as Taobao. TM Apps, Dianping TM Applications, etc. Alternatively, pre-made applications can be non-system applications released by mobile phone manufacturers, such as sports and health TM In this embodiment, before the mobile phone leaves the factory, the mobile phone manufacturer may store the installation package of the prefabricated application in directory 2. When the mobile phone is turned on, PKMS scans the installation package in directory 2 and obtains the relevant information of the prefabricated application.

[0107] In some other embodiments, the preset directory includes a directory (referred to as directory 3) for storing installation packages of third-party applications that the user installs by himself during the use of the mobile phone. In this embodiment, when the user uses the mobile phone, the user can request to download various third-party applications, such as clicking on WeChat in the application store. TM The download button of the app can request to download WeChat TMApplication. In response to the request, the mobile phone can download the installation package of the corresponding third-party application. After downloading the installation package of the third-party application, the mobile phone can store the installation package of the third-party application in directory 4 of the mobile phone. For example, directory 4 is a directory for storing download files of application stores. For another example, directory 4 is a directory for storing download files of browsers. Then, the mobile phone can complete the installation of the corresponding third-party application based on the installation package under directory 4. After the installation of the third-party application is completed, the mobile phone can save the installation package of the third-party application to directory 3. It should be noted that after installing the third-party application, the mobile phone can delete the installation package under directory 4 to free up the storage space of the mobile phone. However, the installation package under directory 3 will usually be deleted only after the corresponding third-party application is uninstalled. When the mobile phone is turned on, PKMS scans the installation package under directory 3, and then the relevant information of the third-party application installed by the user can be obtained.

[0108] In other embodiments, in the enterprise management scenario, the mobile phone manufacturer releases customized mobile phones for the enterprise, and the enterprise distributes the customized mobile phones to employees as their work mobile phones. And. The enterprise can control the applications in these work mobile phones. Exemplarily, when the enterprise needs to configure a unified clock-in application or communication application for employees, the installation packages of these enterprise applications can be sent to the employees' work mobile phones through the enterprise server (i.e., the server used by the enterprise to manage the employees' work mobile phones). In this enterprise management scenario, the preset directory may include a directory (referred to as directory 5) for storing the installation packages of enterprise applications sent by the enterprise server. In this embodiment, during the operation of the mobile phone, after receiving the installation package sent by the enterprise server, the mobile phone can store the installation package under directory 5. When the mobile phone is turned on, PKMS scans the installation package under directory 5, and then obtains the relevant information of the installation package sent by the enterprise server. It should be noted that the enterprise server can directly send the installation package to the work mobile phone. Alternatively, the enterprise server can also first send the installation package to the control device of the mobile phone, and then the control device forwards the installation package to the mobile phone. The control device is specially used to maintain enterprise-customized mobile phones, and can be developed by mobile phone manufacturers and provided to enterprises.

[0109] In other embodiments, in the scenario of upgrading the mobile phone operating system, in order to make the system application compatible with the updated operating system, the mobile phone manufacturer may update the system application and send the updated system application and the upgraded operating system to the mobile phone through the manufacturer server (i.e., the server of the mobile phone manufacturer). In this embodiment, during the operation of the mobile phone, after receiving the installation package sent by the enterprise server, the mobile phone can store the installation package in directory 6. When the mobile phone is turned on, PKMS scans the installation package in directory 6, and then obtains the relevant information of the installation package of the updated system application.

[0110] At this point, it should be noted that the actual implementation is not limited to the preset directories listed above. In addition, the various embodiments and / or implementation methods in S507 can be combined, that is, the preset directory can also be a combination of at least two of Directory 1, Directory 2, Directory 3, Directory 5, and Directory 6. In addition, Directory 1, Directory 2, Directory 3, Directory 5, and Directory 6 can be different directories, or they can be partially or completely the same directories. For example, Directory 1 and Directory 6 can be the same directory, both used to store installation packages for system applications. Alternatively, any directory in Directory 1, Directory 2, Directory 3, Directory 5, and Directory 6 can also be divided into multiple directories. For example, Directory 2 can be further divided into two directories, one of which is used to store third-party applications in prefabricated applications, such as Taobao. TM Apps, Dianping TM Applications, another for storing non-system applications in pre-made applications, such as sports and health TM application.

[0111] PKMS can scan each installation package in the preset directory in turn. PKMS scans each installation package and can parse out the package name, application version, application signature and other information of the installation package. Furthermore, if the current installation package (i.e. the currently scanned installation package) is the target installation package (such as the installation package of the system application), the scanning process also includes: after parsing and obtaining the application signature, checking whether the application signature is the same as the system signature to determine whether the target application is safe.

[0112] Among them, the target application is a high-authority application, such as an application that can obtain the system permissions of the mobile phone by default, and the target installation package is the installation package of the target application. Exemplarily, system applications, such as settings applications, contacts applications, etc., usually can obtain the system permissions of the mobile phone by default, and have very high application permissions. Therefore, the target application can be a system application of the mobile phone. Correspondingly, the target installation package can be the installation package stored in the above directory 1 and / or directory 6. Another exemplary example, the work mobile phone distributed by the enterprise to employees is a mobile phone specially customized for the enterprise by the mobile phone manufacturer, so the enterprise can have a higher authority over the customized mobile phone. For example, the enterprise can use the system signature of the mobile phone to sign the enterprise application, and then send the installation package of the enterprise application to the mobile phone. When the enterprise application is installed on the mobile phone, it can obtain a very high system permission, such as the user can only use the enterprise application, but cannot perform operations such as uninstalling and updating it. Correspondingly, the installation package sent by the enterprise server can also be considered as an installation package of a high-authority application, which can obtain the system permissions of the mobile phone by default. Therefore, the target application can be an application that the installation package sent by the enterprise server is used to install. Correspondingly, the target installation package can be the installation package stored in the above directory 5. For the convenience of explanation, directory 1, directory 5 and / or directory 6 may be referred to as a first directory, which belongs to the at least one second directory mentioned above.

[0113] Furthermore, in order to facilitate the management of the target application, no installation packages other than the target installation package (also referred to as non-target installation packages) will be stored in the directory storing the target installation package. Based on this, in some embodiments, the PKMS can determine whether the current installation package is the target installation package based on the directory where the current installation package is located. For example, if the current installation package is located in directory 1, directory 5, or directory 6, it can be determined that the currently scanned installation package is the target installation package.

[0114] It should be noted that in actual implementation, the above method of determining the target installation package is not limited. Exemplarily, in other embodiments, a preset identifier can also be preset in the target installation package, and when PKMS resolves the preset identifier in the current installation package, it can confirm that the current installation package is the target installation package.

[0115] After determining that the current installation package is the target installation package, PKMS further detects whether the application signature in the current installation package is the same as the system signature of the mobile phone. Usually, if the target application is maliciously tampered by an illegal user, the application signature of the target application will be different from the system signature. In addition, the inventors have also found the following scenarios that may cause the application signature of the target application to be different from the system signature:

[0116] See also Figure 6 In order to improve the security of mobile phones, or after the operating system of the mobile phone is upgraded, the mobile phone manufacturer may update the system signature of the mobile phone, and then send the operating system version signed with the updated system signature to the mobile phone through the manufacturer's server. In the enterprise management scenario, the enterprise server may not obtain the updated system signature in time. For example, the manufacturer's server did not synchronize the system signature of the mobile phone to the enterprise server. Then, the enterprise server can only use the old system signature to sign the application and then add it to the installation package (such as Figure 6 In this way, the mobile phone will detect that the application signature in the installation package sent by the enterprise server is different from the updated system signature.

[0117] In an embodiment of the present application, if PKMS detects that the application signature in the current installation package is the same as the system signature of the mobile phone, S508 is executed to continue the subsequent scanning process of the current installation package, such as parsing the application permissions. If PKMS detects that the application signature in the current installation package is different from the system signature of the mobile phone, that is, when the target application used to install the current installation package is unsafe, the scanning process of the current installation package is skipped. On the one hand, skipping the scanning process of the current installation package includes: not continuing the subsequent scanning process of the current installation package, such as parsing the application permissions. That is to say, when the target application is unsafe, the current installation package is no longer scanned. In this way, computing resources can be saved during the boot process. On the other hand, skipping the scanning process of the current installation package also includes: not loading the information that has been parsed by scanning the current installation package into the running memory, for example, the parsed package name, application version, and application signature information will not be loaded into the running memory, and the information loaded into the running memory is used to install the corresponding information. In this way, it can be avoided that the subsequent use of these parsed information to complete the preset processing, such as the installation of the application, causes an abnormality in the boot process. Thereby affecting the processing of other applications. Furthermore, after skipping the current installation package, PKMS will continue to execute S507 and subsequent steps for the next installation package in the preset directory until all installation packages in the preset directory are scanned. In this way, even if there is an unsafe target application, the scanning of subsequent installation packages will not be interrupted, thereby not interrupting the initialization of PKMS. For the sake of convenience, the target application whose application signature is different from the system signature can be recorded as target application a, and the target installation package of the target application whose application signature is different from the system signature can be recorded as target installation package a.

[0118] It should be noted that if the current installation package is not the target installation package, when PKMS scans the current installation package, it only needs to parse the package name, application version, application signature and other information from the current installation package, without detecting whether the application signature is the same as the system signature. In addition, the mobile phone can load the information obtained by scanning the current installation package into the running memory for use in subsequent application installation. This article does not elaborate on this situation.

[0119] S508. PKMS continues the subsequent scanning process of the current installation package, loads the information parsed from scanning the current installation package into the running memory, and after completing the scanning of the current installation package, executes S507 for the next installation package in the preset directory.

[0120] For the sake of convenience, the next installation package in the preset directory may be referred to as the second installation package, the application signature in the next installation package in the preset directory may be referred to as the third signature, and the application used to install the next installation package in the preset directory may be referred to as the second application. It should be understood that the second installation package may not be the target installation package, or it may be the target installation package. If the second installation package is the target installation package, the second installation package may further be the target installation package a, or it may not be the target installation package a. The embodiments of the present application do not specifically limit this. Normally, if the second installation package is not the target installation package, or the second installation package is not the target installation package a, PKMS will not skip the scanning process of the second installation package, and will retain the information obtained by scanning the second installation package.

[0121] In order to facilitate the understanding of the above S507-S508, the following Figure 7 The example of S507-S508 is used to illustrate the specific implementation of the above. Assume that the current installation package is Figure 7 The installation package k in the target installation package is the target installation package, and the target installation package to be scanned includes Figure 7 The processes shown include parsing the package name, parsing the application version, parsing the application signature, signature matching (i.e., detecting whether the application signature is the same as the system signature), and parsing the application permissions. After parsing the package name, parsing the application version, and parsing the application signature in S507, the package name of the installation package k, the application version in the installation package k, and the application signature in the installation package k can be obtained respectively. And, after the signature matching in 507, it can be detected whether the application signature in the installation package k is the same as the system signature. If the match is successful (i.e., the application signature in the installation package k is the same as the system signature), S508 can be continued. After parsing the application permissions in S508, information such as the application permissions in the installation package k can be obtained, and after completing the scanning process of the installation package k, the scanning of the installation package k+1 can be started. On the contrary, if it is detected in S507 that the application signature in the installation package k is not the same as the system signature (i.e., the matching fails), S508 will no longer be continued to continue the subsequent scanning process of the installation package k, such as parsing the application permissions, but the scanning of the installation package k+1 will be started directly.

[0122] Continue to see Figure 7 , execute the above S507-S508 until all installation packages in the preset directory are scanned, and the PKMS can be initialized successfully.

[0123] Conventional technology does not consider scenarios similar to enterprise management, and believes that if the application signature is different from the system signature, it will cause a great security threat to the mobile phone. Based on this, after detecting that the application signature in the current installation package is different from the system signature of the mobile phone, the state exception (i.e., IllegalStateException) method will be called to throw an IllegalStateException. For example, the code for throwing a state exception is as follows:

[0124] throw new IllegalStateException( / / Call the IllegalStateException method to throw IllegalStateException).

[0125] IllegalStateException will interrupt PKMS initialization. For example, for installation package k, when it is detected that the application signature in installation package k is different from the system signature, an IllegalStateException will be thrown, which will interrupt PKMS scanning of all installation packages, that is, it will no longer continue to scan installation package k, nor will it continue to scan installation package k+1 and subsequent installation packages, thereby interrupting PKMS initialization. Ultimately, PKMS initialization fails.

[0126] Different from conventional techniques, the method of the embodiment of the present application adopts the above S507-S509, and when the application signature is different from the system signature, it jumps to the next installation package to continue scanning without interrupting the PKMS initialization. For example, the code that throws an exception in the above example is replaced with return, and after detecting that the application signature is different from the system signature, it can directly start scanning from the next installation package and continue the PKMS initialization.

[0127] After the PKMS is initialized, the PKMS can be called to complete the preset processing related to the application installation package, such as application installation, permission management, etc.

[0128] S509. In response to being called, PKMS executes a preset process.

[0129] In an embodiment of the present application, even if it is detected that the application signature is different from the system signature, the PKMS initialization can still be completed, so PKMS can be successfully called to perform the preset processing later. Then, PKMS can complete the preset processing, such as application installation, permission management, etc., so that the user can directly use the application after booting. It should be noted that when the scan of the target installation package a is skipped, the package name, application version, application signature and other information parsed from the scan of the target installation package a are not loaded into the running memory, so when the preset processing is executed, the target installation package a cannot be processed. For example, the target application a cannot be installed. For another example, if the next installation package (i.e., the second installation package) in the preset directory is not the target installation package or is not the target installation package a, the information parsed when scanning the next installation package can be obtained from the running memory, thereby successfully installing the application (i.e., the second application) used to be installed by the next installation package (i.e., the second installation package) in the preset directory.

[0130] Moreover, after completing the preset processing, the subsequent boot process can be continued, such as time synchronization, desktop startup, etc., and finally the boot is successful. After the boot is successful, the successfully installed applications can be displayed on the mobile phone desktop.

[0131] However, if conventional technology is used, the subsequent call to PKMS will fail due to the failure of PKMS initialization. For example, a null pointer exception (NullPointerException--System zygotedied with exception) will occur when calling PKMS, resulting in the failure of calling PKMS. Since PKMS is started by the SystemServer process, after the PKMS call fails, the SystemServer process will be restarted through the Zygote process, and then the SystemServer process will restart PKMS, so that PKMS initialization can be re-executed. Normally, if the number of restarts exceeds the preset number, such as 3 times, 5 times, etc., the mobile phone will enter recovery mode and will not be able to start normally.

[0132] Further, in some embodiments, if it is detected in S508 that the application signature in the current installation package is different from the system signature of the mobile phone, an error log (log) may also be recorded. The error log may include a preset error type, an identifier of the target installation package a (such as a package name) and / or a timestamp of the error. Among them, the preset error type indicates that the application signature is different from the system signature. After the mobile phone is successfully turned on, the mobile phone's control personnel (such as the mobile phone's developer or the enterprise's network manager) can obtain the authorization of the mobile phone owner remotely or on-site, and retrieve the error log and analyze it after obtaining the authorization. After the analysis determines that the error type is a signature mismatch, and the target installation package a is determined, the updated system signature can be used to re-sign the target application a to generate an updated application signature (also referred to as a second signature) for the target application a. Then, the updated application signature is added to the installation package of the target application a to obtain the target installation package A (also referred to as the third installation package), and the target installation package A is re-sent to the mobile phone. When the mobile phone receives the target installation package A, it stores the target installation package A in a preset directory, such as under directory 1.

[0133] Taking the enterprise management scenario as an example, after the enterprise's network manager remotely obtains the authorization of the mobile phone owner through the enterprise server, the mobile phone can send the error log to the enterprise server. After analyzing the error log, the network manager can re-sign the target application a and obtain the target installation package A. Then, the network manager sends the target installation package A to the mobile phone through the enterprise server. After receiving the target installation package A, the mobile phone stores the target installation package A in directory 5.

[0134] Finally, after the mobile phone is turned on again, the target installation package A can be scanned. At this time, the application signature in the target installation package A is the same as the system signature, and the installation of the target application a and other preset processes can be completed subsequently.

[0135] In order to further clarify the difference between the implementation and effect of the present application scheme and the conventional technology, Figure 8 and Fig. 9 , take the preset number of times as 5 as an example to compare and explain:

[0136] See also Figure 8In the embodiment of the present application, after the user presses the power button to trigger the startup, the initialization (init) process, the incubation (Zygote) process, the system service (SystemServer) process and the package management service (PKMS) can be started in sequence. After starting PKMS, PKMS scans the installation packages in the preset directory. If there is no target installation package (such as target installation package a) whose signature matching fails, that is, the application signatures in all target installation packages are the same as the system signature, then PKMS completes the PKMS initialization after completing the scanning of all installation packages. On the contrary, even if there is a target installation package whose signature matching fails, that is, the application signature in the target installation package is different from the system signature, PKMS will only output the error log, skip the target installation package whose signature matching fails, and then continue to complete the scanning of subsequent installation packages. Similarly, after completing the scanning of all installation packages, the PKMS initialization is completed. Subsequently, PKMS can be successfully called to complete the preset processing, such as the installation of the application. Finally, after completing all the startup processes, the startup can be successful. In other words, in the present application scheme, even if there is a target installation package whose signature matching fails, PKMS initialization can be completed and the startup can be successfully completed.

[0137] See also Fig. 9 In conventional technology, only when there is no target installation package with signature matching failure, can the scanning of all installation packages be successfully completed, thereby completing the PKMS initialization. If there is a target installation package with signature matching failure, a state exception, i.e., IllegalStateException, will be thrown, thereby interrupting the PKMS initialization and causing the PKMS initialization to fail. Due to the failure of PKMS initialization, when the preset processing is subsequently executed, such as the installation of the application, a null pointer exception will occur when calling PKMS, such as NullPointerException--System zygote died with exception, i.e., the call failed, resulting in the need to restart the system to re-execute PKMS initialization. If the number of system restarts during this startup is less than 5 times, the restart can continue. Generally speaking, signature matching failure cannot be overcome by restarting the system. Therefore, after restarting the system, there will still be a signature mismatch, resulting in PKMS initialization failure. The subsequent call to PKMS will still fail, resulting in another triggering of the restart system, until the number of system restarts is not less than (i.e., greater than or equal to) 5 times, which will cause the startup to fail, i.e., enter the engineering (recovery) mode. In other words, in conventional technology, the startup can only be successful when there is no application with signature mismatch.

[0138] Since the PKMS service in the above embodiment belongs to the software system of the mobile phone, the scanning of the target installation package by PKMS in the above embodiment can also be completed by the mobile phone as the execution subject. Fig.10 , taking the mobile phone as the execution subject, the startup method of the embodiment of the present application may include the following steps:

[0139] S1001. During the process of starting up the mobile phone, the mobile phone starts to scan the target installation package. Scanning the target installation package requires detecting whether the application signature in the target installation package is the same as the system signature of the mobile phone. If so, execute S1002; if not, execute S1003. For details, please refer to the description of S507 above.

[0140] In some embodiments, during the process of starting up the mobile phone, the mobile phone may scan the installation packages in the preset directories in sequence, and needs to identify whether the current installation package is the target installation package. Generally, if the current installation package is in the directory 1, directory 5 or directory 6 mentioned above, it can be determined that the current installation package is the target installation package.

[0141] S1002: The mobile phone skips scanning the target installation package and starts scanning the next installation package. For details, please refer to the description of S507 above.

[0142] S1003, the mobile phone continues to complete the subsequent scanning process of the target installation package, and loads the information parsed from the scanning of the target installation package into the running memory, until the scanning of the target installation package is completed, and the mobile phone continues to scan the next installation package. For details, please refer to the description of S508 above.

[0143] S1004: After the mobile phone is turned on, applications are installed in the mobile phone, and the applications do not include applications installed by the target installation package whose signature matching fails.

[0144] The target installation package for which the signature matching fails is the target installation package a.

[0145] In summary, by using the method of the embodiment of the present application, when there is a target installation package a, the mobile phone skips scanning the target installation package a, so that the target installation package a will not affect the processing of other installation packages, thereby increasing the probability of successful startup. In addition, the mobile phone will continue to scan subsequent installation packages, so that the PKMS initialization can be completed, and finally the startup can be successful.

[0146] In the above embodiments, the processing of one target installation package is mainly described in detail. It should be understood that in actual implementation, if there are multiple target installation packages, each target installation package can be processed according to the processing of the above one target installation package.

[0147] The present application also provides an electronic device, which may include: a memory and one or more processors. The memory and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device may perform various functions or steps performed by the device in the above method embodiment.

[0148] The present application also provides a chip system, such as Fig.11 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1102 can be used to send signals to other devices (such as processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in the memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the electronic device can execute the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0149] This embodiment further provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image processing method in the above-mentioned embodiment.

[0150] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the image processing method in the above-mentioned embodiment.

[0151] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the image processing method in the above-mentioned method embodiments.

[0152] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.

[0153] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0154] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0155] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.

[0156] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0157] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A startup method, characterized in that: Applied to an electronic device, the electronic device includes a first installation package and a second installation package, the first installation package is an installation package of a first application, the second installation package is an installation package of a second application, the first installation package is located in a first directory, the first installation package includes a first signature of the first application, and the method includes: The stage of PKMS initialization during the startup process of the electronic device: The electronic device starts scanning the first installation package; wherein the scanning the first installation package includes: determining whether the first signature is the same as the system signature of the electronic device; If the first signature is different from the system signature of the electronic device, the electronic device stops scanning the first installation package and starts scanning the second installation package; wherein the electronic device does not load the parsed information from scanning the first installation package into the running memory, and the information loaded into the running memory is used to install the corresponding application; After completing the scanning operation on the second installation package and sequentially performing the scanning operations on the remaining installation packages, the PKMS in the electronic device is successfully initialized, and the electronic device installs the application through the PKMS; After the electronic device is turned on, the second application is installed on the electronic device, but the first application is not installed; Among them, the first directory is used to store installation packages of preset applications, and the preset applications include system applications issued by the manufacturer server of the electronic device to the electronic device and enterprise applications issued by the enterprise server to the electronic device; the enterprise server obtains the system signature of the electronic device and signs the enterprise application with the system signature of the electronic device and then issues it to the electronic device, but if the enterprise server does not obtain the system signature of the electronic device, the enterprise server uses the old system signature of the electronic device to sign the enterprise application and adds it to the installation package of the enterprise application, then the signature in the installation package of the enterprise application is different from the system signature of the electronic device.

2. The method according to claim 1, characterized in that The electronic device comprises at least one second directory, the at least one second directory comprising the first directory; Wherein, during the process of starting up the electronic device, the electronic device scans each directory in the at least one second directory in turn, and when the electronic device scans a directory, it scans each installation package in the directory in turn; in the first directory, the second installation package is the next installation package after the first installation package.

3. The method according to claim 1, characterized in that The information parsed by the electronic device when scanning the installation package includes: at least one of the package name of the installation package, the version number of the application, the signature of the application, and the permissions of the application.

4. The method according to any one of claims 1 to 3, characterized in that The scanning of the first installation package further includes: If the first signature is the same as the system signature of the electronic device, the electronic device continues to scan the first installation package; The method further comprises: In response to completing the scanning of the first installation package, the electronic device loads the information parsed by scanning the first installation package into the running memory, and starts scanning the second installation package; After the electronic device is turned on, the first application and the second application are installed on the electronic device.

5. The method according to any one of claims 1 to 3, characterized in that: If the first signature is different from the system signature of the electronic device, the method further includes: The electronic device records an error log, wherein the error log includes a preset error type and an identifier of the first installation package, wherein the preset error type indicates that a signature of the application is different from a system signature.

6. The method according to claim 5, characterized in that The first application is an enterprise application sent by an enterprise server to the electronic device, and the enterprise server is used to manage and control applications in the electronic device; After the electronic device records the error log, the method further includes: The electronic device sends the error log to the enterprise server; The electronic device receives a third installation package sent by the enterprise server according to the error log, where the third installation package is an installation package of the first application, and the third installation package includes a second signature of the first application, where the second signature is the same as a system signature of the electronic device; The electronic device stores the third installation package in the first directory.

7. The method according to any one of claims 1 to 3, characterized in that The second installation package is located in the first directory, and the second installation package includes a third signature of the second application; After the electronic device is turned on, the second application is installed on the electronic device, including: If the third signature is the same as the system signature of the electronic device, the second application is installed on the electronic device after the electronic device is turned on.

8. The method according to any one of claims 1 to 3, characterized in that The electronic device starts scanning the first installation package, including: The package management service PKMS in the electronic device starts scanning the first installation package; The electronic device stops scanning the first installation package, including: The PKMS stops scanning the first installation package; The electronic device starts scanning the second installation package, including: The PKMS starts scanning the second installation package.

9. An electronic device, characterized in that: The electronic device includes a video to be processed, and the electronic device includes: a memory and one or more processors, wherein the memory is coupled to the processor; wherein computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-8.

10. A computer storage medium, characterized in that: The computer storage medium comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 8.

11. A chip system, characterized in that: The chip system is applied to an electronic device including a display screen and a memory; the chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through lines; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Exception handling method and related equipment

    CN110825396A

  • Application installation management method under multi-signature mechanism, intelligent terminal and storage medium

    CN111382425A