Method for accelerating application startup, electronic device, and computer storage medium
A system service detects a first trigger event of a target application, loads an application program of the target application in response to the first trigger event, and transmits a communication address to the application program. The application program performs preloading, and waits to receive a message based on the communication address. The system service detects a second trigger event of the target application. The system service generates a startup instruction in response to the second trigger event of the target application, and sends the startup instruction to the application program. The application program receives the startup instruction by using the communication address, and starts the target application in response to the startup instruction.
1 . A method, wherein the method comprises:
detecting, by a system service, a first trigger event of a target application, wherein detecting the first trigger event of the target application comprises:
when detecting a touch operation on the target application, determining, by the system service, that the first trigger event occurs on the target application;
loading, by the system service, an application program of the target application in response to the first trigger event, and transmitting a communication address to the application program;
performing, by the application program, preloading;
waiting, by the application program, to receive a startup instruction based on the communication address, wherein the application program does not startup while waiting for the startup instruction;
detecting, by the system service, a second trigger event of the target application, wherein detecting the second trigger event of the target application comprises:
after detecting the first trigger event of the target application, when determining that the target application is touched, performing, by the system service, timing to obtain a timing time;
determining whether the touch operation on the target application ends within a first preset time range; and
in response to determining the touch operation on the target application ends within the first preset time range, determining that the second trigger event occurs on the target application;
generating, by the system service, the startup instruction in response to detecting the second trigger event of the target application, and sending the startup instruction to the application program;
receiving, by the application program, the startup instruction by using the communication address; and
starting, by the application program, the target application in response to receiving the startup instruction.
2 . The method according to claim 1 , wherein waiting, by the application program, to receive the startup instruction based on the communication address comprises:
creating, by the application program, a server or a client based on the communication address; and
waiting, by the server or the client, to receive the startup instruction based on the communication address.
3 . The method according to claim 1 , wherein determining, by the system service when detecting the touch operation on the target application, that the first trigger event occurs on the target application comprises:
in response to detecting the touch operation, determining, by the system service, a touch location corresponding to the touch operation;
determining, based on the touch location, whether the target application is touched; and
when it is determined that the target application is touched, determining that the first trigger event occurs on the target application.
4 . The method according to claim 1 , wherein the method further comprises:
in response to determining the touch operation on the target application does not end within the first preset time range, determining, by the system service, whether the touch operation on the target application ends within a second preset time range; and
in response to determining the touch operation ends within the second preset time range, sleeping, by the system service, for a preset period of time; or
in response to determining the touch operation does not end within the second preset time range, determining, by the system service, that a third trigger event occurs on the target application, and displaying a shortcut menu of the target application in response to the third trigger event.
5 . The method according to claim 1 , wherein the target application is an application of a preset type.
6 . The method according to claim 1 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining usage frequency of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on a usage frequency of each target application; and
sequentially preloading the plurality of target applications according to the sorting.
7 . The method according to claim 1 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining a high-frequency usage time period of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on a high-frequency usage time period of each target application; and
sequentially preloading the plurality of target applications according to the sorting.
8 . An electronic device, wherein the electronic device comprises a memory and at least one processor, wherein the memory stores program instructions; and
wherein the at least one processor is configured to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device is enabled to perform:
detecting, by a system service of the electronic device, a first trigger event of a target application of the electronic device, wherein detecting, by the system service, the first trigger event of the target application comprises:
obtaining, by the system service, a first speech instruction;
analyzing whether an operation object of the first speech instruction is the target application;
when the operation object of the first speech instruction is the target application, determining whether the first speech instruction comprises a first control instruction; and
when it is determined that the first speech instruction comprises the first control instruction, determining that the first trigger event occurs on the target application;
loading, by the system service, an application program of the target application in response to the first trigger event, and transmitting a communication address to the application program;
performing, by the application program, preloading;
waiting, by the application program, to receive a startup instruction based on the communication address, wherein the application program does not startup while waiting for the startup instruction;
detecting, by the system service, a second trigger event of the target application;
generating, by the system service, the startup instruction in response to the second trigger event of the target application, and sending the startup instruction to the application program;
receiving, by the application program, the startup instruction by using the communication address; and
starting, by the application program, the target application in response to the startup instruction.
9 . The electronic device according to claim 8 , wherein waiting, by the application program, to receive the startup instruction based on the communication address comprises:
creating, by the application program, a server or a client based on the communication address; and
waiting, by the server or the client, to receive the startup instruction based on the communication address.
10 . The electronic device according to claim 8 , wherein detecting, by the system service, the second trigger event of the target application comprises:
obtaining, by the system service, a second speech instruction;
analyzing whether an operation object of the second speech instruction is the target application;
when the operation object of the second speech instruction is the target application, determining whether the second speech instruction comprises a second control instruction; and
when it is determined that the second speech instruction comprises the second control instruction, determining that the second trigger event occurs on the target application.
11 . The electronic device according to claim 8 , wherein the target application is an application of a preset type.
12 . The electronic device according to claim 8 , wherein waiting, by the application program, to receive the startup instruction based on the communication address comprises:
creating, by the application program, a server or a client based on the communication address; and
waiting, by the server or the client, to receive the startup instruction based on the communication address.
13 . The electronic device according to claim 8 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining a high-frequency usage time period of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on a high-frequency usage time period of each target application; and
sequentially preloading the plurality of target applications according to the sorting.
14 . The electronic device according to claim 8 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining a usage frequency of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on a usage frequency of each target application; and
sequentially preloading the plurality of target applications according to the sorting.
15 . A non-transitory computer storage medium, wherein the computer storage medium stores program instructions, and when the program instructions are run on an electronic device, the electronic device is enabled to perform:
detecting, by a system service of the electronic device, a first trigger event of a target application of the electronic device, wherein detecting, by the system service, the first trigger event of the target application comprises:
obtaining, by the system service, eyeball tracking information of a user; and
determining, based on the eyeball tracking information, that the first trigger event occurs on a target application whose gaze duration exceeds a first preset duration;
loading, by the system service, an application program of the target application in response to the first trigger event, and transmitting a communication address to the application program;
performing, by the application program, preloading;
waiting, by the application program, to receive a startup instruction based on the communication address, wherein the application program does not startup while waiting for the startup instruction;
detecting, by the system service, a second trigger event of the target application;
generating, by the system service, the startup instruction in response to the second trigger event of the target application, and sending the startup instruction to the application program;
receiving, by the application program, the startup instruction by using the communication address; and
starting, by the application program, the target application in response to the startup instruction.
16 . The non-transitory computer storage medium according to claim 15 , wherein detecting, by the system service, the second trigger event of the target application comprises:
determining, based on the eyeball tracking information, whether a gaze duration of the target application exceeds a second preset duration; and
in response to determining that the gaze duration of the target application exceeds the second preset duration, determining that the second trigger event occurs on the target application.
17 . The non-transitory computer storage medium according to claim 15 , wherein the target application is an application of a preset type.
18 . The non-transitory computer storage medium according to claim 15 , wherein waiting, by the application program, to receive the startup instruction based on the communication address comprises:
creating, by the application program, a server or a client based on the communication address; and
waiting, by the server or the client, to receive the startup instruction based on the communication address.
19 . The non-transitory computer storage medium according to claim 15 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining a high-frequency usage time period of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on a high-frequency usage time period of each target application; and
sequentially preloading the plurality of target applications according to the sorting.
20 . The non-transitory computer storage medium according to claim 15 , wherein loading, by the system service, the application program of the target application in response to the first trigger event comprises:
when the system service detects that the target application comprises a plurality of target applications, obtaining second historical data of the plurality of target applications;
determining a usage frequency of the plurality of target applications based on the second historical data of the plurality of target applications;
sorting the plurality of target applications based on usage frequency of each target application; and
sequentially preloading the plurality of target applications according to the sorting.