Mini-program startup method and terminal device
By increasing the priority of the thread in the mini program startup operation, the problem of slow startup speed of the mini program is solved, achieving faster startup speed and better user experience.
Patent Information
- Application Number
- CN202211286189.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-10-20
AI Technical Summary
Existing mini programs start slowly, which affects the user experience, causing it to take a long time for users to click on the mini program icon until the main interface of the mini program is presented.
By detecting the startup operation of the applet, determine the priority of the thread used to display the applet interface and/or the thread accessing the network, and increase its priority when necessary to run these threads first and shorten the time the thread waits for scheduling. This shortens the time from starting the mini program to the mini program display interface.
Improved the startup speed of mini programs, reduced user waiting time, and improved user experience.
Smart Images

Figure CN116700814B
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method for starting a mini-program and a terminal device. Background Art
[0002] With the rapid development of mini-program related technologies, more and more services are provided in the form of mini-programs, and more and more applications have the ability to run mini-programs. The application has the ability to run information query applets, express delivery applets, game applets, and online supermarket applets.
[0003] Currently, when users open mini programs, the mini program often starts slowly. That is, it takes a long time for the user to click the mini program icon until the mini program main interface appears, which seriously affects the user experience. Summary of the invention
[0004] The present application provides a method and terminal device for starting a mini program, which can shorten the time from starting a mini program to presenting the mini program main interface, thereby helping to increase the startup speed of the mini program.
[0005] In a first aspect, the present application provides a method for starting a mini-program, which can be applied to a terminal device. The method includes: detecting a startup operation of the mini-program; in response to the startup operation, determining a first priority preset for a first thread in the terminal device, the first thread including a thread for displaying the interface of the mini-program and / or a thread for accessing a network; if the mini-program is a program that needs to increase the priority of the first thread, running the first thread according to a second priority, the second priority being higher than the first priority.
[0006] There are many possible implementations of the first thread. In one possible implementation, the first thread includes a thread for displaying the interface of the mini-program. There may be one or more threads for displaying the interface of the mini-program, which is not limited in this application.
[0007] Exemplarily, if the "JSRuntimeLooper" thread and the "Chrome" thread are threads in the applet for displaying the interface of the applet, the first thread may include the "JSRuntimeLooper" thread and the "Chrome" thread.
[0008] In another possible implementation, the first thread includes a thread for accessing a network, wherein the thread for accessing a network may be one or more, which is not limited in the present application.
[0009] Exemplarily, if the "mars" thread is a thread in the applet for displaying the interface of the applet, the first thread may include the "mars" thread.
[0010] In yet another possible implementation, the first thread includes a thread for displaying an interface of the applet and a thread for accessing a network.
[0011] Exemplarily, if the "JSRuntimeLooper" thread and the "Chrome" thread are threads in the applet used to display the interface of the applet, and the "mars" thread is a thread in the applet used to display the interface of the applet, then the first thread may include the "JSRuntimeLooper" thread, the "Chrome" thread and the "mars" thread.
[0012] The level of priority (including the first priority and the second priority) can be expressed by numbers or words, and this application does not limit this.
[0013] Exemplarily, the priority is represented by a number, and a higher number indicates a lower priority. If the first priority is 100, the second priority may be any number less than 100. The lower the number corresponding to the second priority, the higher the priority, and the more likely the terminal device can run the first thread first.
[0014] The program that needs to increase the priority of the first thread is used to represent a preset small program that needs to increase the startup speed. The program that needs to increase the priority of the first thread can be one or more, and this application does not limit it.
[0015] Exemplarily, the program that needs to increase the priority of the first thread may be a small program for querying information, such as a small program for querying health status, a small program for querying QR codes, and a small program for querying identity information.
[0016] The terminal device may detect the start-up operation of the mini-program in a variety of situations. In one possible situation, the application has the ability to run the mini-program and displays the icon of the mini-program. The user can click the icon of the mini-program in the application to start the mini-program. When the user clicks the icon of the mini-program in the application, the terminal device detects the start-up operation of the mini-program. In another possible situation, the desktop of the terminal device displays the icon of the mini-program, and the user can start the mini-program by clicking the icon of the mini-program on the desktop. When the user clicks the icon of the mini-program on the desktop, the terminal device detects the start-up operation of the mini-program.
[0017] The terminal device detects the start-up operation of the applet; in response to the start-up operation, the first priority preset for the first thread in the terminal device can be determined. In other words, the priority of the first thread preset in the terminal device is the first priority. If the started applet is a program that needs to increase the priority of the first thread, the terminal device can run the first thread at the second priority.
[0018] The specific implementation method of the terminal device determining whether the launched applet is a program that needs to increase the priority of the first thread can be: the terminal device determines whether the identifier of the launched applet matches the identifier of the program that needs to increase the priority of the first thread. If the match is successful, the terminal device determines that the launched applet is a program that needs to increase the priority of the first thread. If the match is unsuccessful, the terminal device determines that the launched applet is not a program that needs to increase the priority of the first thread.
[0019] It should be noted that the identifier of the mini program can be represented by the symbol app_id, which is a unique attribute that identifies the mini program, similar to the user's ID number. The identifier of the mini program can be represented by at least one of numbers, letters, or symbols, and this application does not limit this.
[0020] For example, if the applet is a applet for querying health status, the applet identifier may be "wxfe0e405895cafdf9###0". If the applet identifier "wxfe0e405895cafdf9###0" matches the identifier of the program that needs to increase the priority of the first thread, the terminal device determines that the started applet is the program that needs to increase the priority of the first thread.
[0021] The mini-program startup method provided in the present application runs the first thread at a second priority level with a higher priority level in response to the startup operation of the mini-program. Compared with running the first thread at a first priority level with a lower priority level, the first thread can be run preferentially, thereby shortening the time the first thread waits for running, thereby shortening the time it takes for the mini-program to start up to the mini-program display interface, which is beneficial to improving the startup speed of the mini-program.
[0022] In combination with the first aspect, in certain implementations of the first aspect, the terminal device includes first configuration information, and the first configuration information is used to indicate the priorities of multiple threads in the terminal device, and the multiple threads include a first thread; wherein, determining the first priority preset for the first thread in the terminal device includes: determining the first priority of the first thread based on the first configuration information.
[0023] The terminal device may be preset with first configuration information, which includes priorities of multiple threads, and the terminal device may run threads based on the priorities indicated by the first configuration information. The multiple threads in the first configuration information include the above-mentioned first thread, and the terminal device may determine the first priority of the first thread based on the first configuration information.
[0024] The mini-program startup method provided in the present application indicates the priorities of multiple threads in the terminal device through the first configuration information. The terminal device can determine the priority of the thread based on the first configuration information and run the thread based on the priority, which is conducive to ensuring that the terminal device runs the threads in an orderly manner.
[0025] In combination with the first aspect, in certain implementations of the first aspect, the terminal device includes second configuration information, and the second configuration information is used to indicate a program for which the priority of the first thread needs to be increased; wherein the method further includes: if the program indicated by the second configuration information includes a mini-program, then determining that the mini-program is a program for which the priority of the first thread needs to be increased.
[0026] The second configuration information is different from the first configuration information, and the second configuration information is used to indicate the program for which the priority of the first thread needs to be increased. In other words, the second configuration information may include the program for which the priority of the first thread needs to be increased. If the program indicated by the second configuration information includes a small program, the terminal device may determine that the small program is the program for which the priority of the first thread needs to be increased.
[0027] A specific implementation manner of including the mini-program in the program indicated by the second configuration information may be that the identifier of the program indicated by the second configuration information includes the identifier of the mini-program.
[0028] Exemplarily, the programs indicated by the second configuration information include a mini-program for querying health status and a mini-program for querying QR codes. The second configuration information may include the identifier of the mini-program for querying health status, "wxfe0e405895cafdf9###0", and the identifier of the mini-program for querying QR codes, "wx82d43fee89cdc7df###1". If the identifier of the mini-program is "wxfe0e405895cafdf9###0", the second configuration information includes the identifier of the mini-program, and the terminal device can determine that the mini-program is a program that needs to increase the priority of the first thread.
[0029] The method for starting a mini-program provided by the present application indicates the program that needs to increase the priority of the first thread through the second configuration information. When the program indicated by the second configuration information includes the mini-program, the terminal device can determine that the mini-program is the program that needs to increase the priority of the first thread. In this implementation, the program that needs to increase the priority of the first thread is preset in the second configuration information, and the terminal device can obtain the program that needs to increase the priority of the first thread based on the second configuration information. The operation is simple and efficient.
[0030] In combination with the first aspect, in some implementations of the first aspect, the method further includes: running the first thread according to the first priority after the mini program starts running for a preset time or the mini program ends running.
[0031] The preset duration of the mini program startup can be understood as the preset duration of the mini program startup or the preset duration after the mini program displays the main interface, wherein the preset duration can be 10 seconds or 12 seconds, but the present application is not limited thereto. The mini program termination can be understood as the terminal device detecting the mini program exit operation.
[0032] After the mini program starts running for a preset time or the mini program ends running, the terminal device can run the first thread according to the first priority. That is to say, the terminal device does not always run the first thread at the second priority. If the mini program starts running for a preset time or the mini program ends running, the terminal device can run the first thread according to the first priority.
[0033] The mini-program startup method provided in the present application runs the first thread at the first priority after the mini-program starts and runs for a preset time or the mini-program ends. Instead of always running the first thread at the second priority, the priority of the first thread can be restored to the original priority (i.e., the first priority) after quickly starting the mini-program, which is beneficial to ensuring orderly running threads of the terminal device.
[0034] In combination with the first aspect, in certain implementations of the first aspect, the above method also includes: obtaining a first frequency preset for a central processing unit (CPU) in the terminal device; if the applet is a program that needs to increase the priority of the first thread, controlling the CPU to run the first thread at a second frequency, and the second frequency is higher than the first frequency.
[0035] The CPU in the terminal device can run at a preset first frequency. If the applet is a program that needs to increase the priority of the first thread, the terminal device can also control the CPU to run the first thread at a second frequency higher than the first frequency.
[0036] The mini-program startup method provided in the present application runs the first thread at a second frequency higher than the first frequency, which can shorten the running time of the first thread, is conducive to quickly displaying the interface of the mini-program and / or quickly accessing the network to quickly display the interface of the mini-program, and is conducive to shortening the time from starting the mini-program to the mini-program display interface, thereby improving the mini-program startup speed.
[0037] In combination with the first aspect, in some implementations of the first aspect, the method further includes: after the mini program starts running for a preset time or the mini program ends running, controlling the CPU to run the first thread at a first frequency.
[0038] After the mini program starts running for a preset time or the mini program ends running, the terminal device can control the CPU to run the first thread at the first frequency. That is to say, the terminal device does not always run the first thread at the second frequency. If the mini program starts running for a preset time or the mini program ends running, the terminal device can control the CPU to run the first thread at the first frequency.
[0039] The mini-program startup method provided in the present application runs the first thread at the first frequency after the mini-program starts and runs for a preset time or the mini-program ends, instead of always running the first thread at the second frequency. After quickly starting the mini-program, the CPU frequency can be restored to the original frequency (i.e., the first frequency), which is beneficial to ensuring that the CPU runs threads in an orderly manner.
[0040] In combination with the first aspect, in some implementations of the first aspect, the method further includes: if the mini program can provide a camera service, preloading resources required for the camera service.
[0041] If the launched mini program can provide camera services, the terminal device can preload the resources required for the camera service. The launched mini program can provide camera services, which means that the launched mini program can call the camera based on the user's selection. If the mini program can provide camera services, the terminal device can load the resources required for the camera service even if the user does not select the camera service. When the terminal device calls the camera based on the user's selection, it is not necessary to load the resources required for the camera service.
[0042] For example, the mini program launched is a mini program for querying health status. The mini program for querying health status includes a "photo taking" control. The terminal device can pre-load the resources required when the "photo taking" control is triggered. When the terminal device detects that the "photo taking" control is triggered, there is no need to load the required resources.
[0043] The mini-program startup method provided in the present application, if the mini-program can provide camera service, even if the user does not select the camera service, the terminal device can also load the resources required for the camera service. When the terminal device calls the camera based on the user's selection, there is no need to load the resources required for the camera service, which is conducive to improving the efficiency of camera use.
[0044] In a second aspect, the present application provides a terminal device, which includes: a detection module and a processing module. The detection module is used to: detect the startup operation of the applet; the processing module is used to: in response to the startup operation, determine the first priority preset for the first thread in the terminal device, the first thread includes a thread for displaying the interface of the applet and / or a thread for accessing the network; if the applet is a program that needs to increase the priority of the first thread, the first thread is run according to the second priority, and the second priority is higher than the first priority.
[0045] In combination with the second aspect, in certain implementations of the second aspect, the terminal device includes first configuration information, and the first configuration information is used to indicate the priorities of multiple threads in the terminal device, and the multiple threads include the first thread; wherein the above-mentioned processing module is also used to: determine the first priority of the first thread based on the first configuration information.
[0046] In combination with the second aspect, in certain implementations of the second aspect, the terminal device includes second configuration information, and the second configuration information is used to indicate a program for which the priority of the first thread needs to be increased; wherein the above-mentioned processing module is also used to: if the program indicated by the second configuration information includes a mini-program, then determine that the mini-program is a program for which the priority of the first thread needs to be increased.
[0047] In combination with the second aspect, in some implementations of the second aspect, the processing module is further used to: run the first thread according to the first priority after the mini program starts running for a preset time or the mini program ends running.
[0048] In combination with the second aspect, in certain implementations of the second aspect, the above-mentioned processing module is also used to: obtain a first frequency preset for the central processing unit CPU in the terminal device; if the mini program is a program that needs to increase the priority of the first thread, then control the CPU to run the first thread at a second frequency, and the second frequency is higher than the first frequency.
[0049] In combination with the second aspect, in some implementations of the second aspect, the processing module is also used to: control the CPU to run the first thread at a first frequency after the mini program starts running for a preset time or the mini program ends running.
[0050] In combination with the second aspect, in certain implementations of the second aspect, the processing module is further used to: if the mini program can provide camera service, preload resources required for the camera service.
[0051] In combination with the second aspect, in some implementations of the second aspect, the target shooting mode is a time-lapse shooting mode, a portrait shooting mode, or a normal shooting mode.
[0052] In a third aspect, the present application provides a terminal device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc.
[0053] The terminal device comprises: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method of the first aspect.
[0054] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect is implemented.
[0055] In a fifth aspect, the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect.
[0056] In a sixth aspect, the present application provides a chip, the chip comprising a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.
[0057] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a schematic diagram for launching a small program;
[0059] Figure 2 This is another schematic diagram for launching a small program;
[0060] Figure 3 It is a schematic diagram of the startup process of a small program for querying health status;
[0061] Figure 4 It is a schematic diagram of the operation of the interface process for querying health status;
[0062] Figure 5 It is a software structure block diagram of a terminal device applicable to the embodiment of the present application;
[0063] Figure 6 is a schematic flow chart of a method for starting a mini-program provided in an embodiment of the present application;
[0064] Figure 7 is a schematic flow chart of another method for starting a mini-program provided in an embodiment of the present application;
[0065] Figure 8 is a schematic flow chart of a method for identifying a mini-program provided in an embodiment of the present application;
[0066] Fig. 9 is a schematic flow chart of another method for starting a mini-program provided in an embodiment of the present application;
[0067] Fig.10 is a schematic block diagram of a terminal device provided in an embodiment of the present application;
[0068] Fig.11 It is a schematic block diagram of another terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0070] Mini programs are applications that can be used without downloading or installing. They realize the dream of "apps at your fingertips". Users can open apps by scanning or searching. Mini programs also embody the concept of "use it and leave it". Users don't have to worry about installing too many apps. Apps will be everywhere and available at any time, but there is no need to install or uninstall them.
[0071] With the rapid development of mini-program related technologies, more and more services are provided in the form of mini-programs, and more and more applications have the ability to run mini-programs. Apps and Payments All applications have the ability to run mini-programs.
[0072] For example, the terminal device is equipped with a micro Application, Micro The application has the ability to run mini-programs. Taking the mini-program for checking health status as an example, users can Use a health status query applet on the app. The health status query applet can be used to display the user's health status and can be used to take photos to obtain information.
[0073] Currently, users can use two methods to start a mini program. One method is that the application has the ability to run a mini program and displays an icon of the mini program. The user can click the icon of the mini program in the application to start the mini program.
[0074] For example, the application may be a micro The application program or mini program can be a mini program for querying health status, and the terminal device can be a mobile phone. Figure 1 A schematic diagram of starting a mini program is shown. The operation of displaying the applet on the application program can be displayed in response to the operation. Figure 1 In the a interface. Figure 1 As shown in the a interface in the figure, the mobile phone is in the micro The app can display the user's recently used mini-programs, including the health status query mini-program (referred to as the health mini-program), mini-program A, mini-program B, and mini-program C. Users can view more recently used mini-programs by clicking the "More" option. Figure 1 When the health app icon is clicked in the a interface in the mobile phone, in response to the operation, the mobile phone can display the health main interface, that is, display Figure 1 In the b interface. Figure 1 As shown in interface b in the figure, the health main interface includes the user's name "Zhao*", ID number "11********22" and the user's health condition "excellent". The health main interface also includes a "photograph" control, through which the user can control the phone to obtain information by taking photos.
[0075] Another method of starting the mini program is that the mini program icon is displayed on the desktop of the terminal device, and the user can click the mini program icon on the desktop to start the mini program.
[0076] Exemplarily, the mini program may be a health mini program, and the terminal device may be a mobile phone. Figure 2 Another schematic diagram of starting a small program is shown. Figure 2 As shown in interface a in FIG, the desktop of the mobile phone includes an icon of the health applet. The mobile phone detects that the user clicks the icon of the health applet. In response to the operation, the mobile phone displays the health main interface, that is, displays Figure 2 In the b interface. Figure 2As shown in interface b in the figure, the health main interface includes the user's name "Zhao*", ID number "11********22" and the user's health condition "excellent". The health main interface also includes a "photograph" control, through which the user can control the phone to obtain information by taking photos.
[0077] When users open mini programs, the mini program often starts slowly, that is, it takes a long time for the user to click the mini program icon and then the mini program main interface appears, which seriously affects the user experience.
[0078] For example, in the above Figure 1 In the example shown, when the user opens the health applet, the health applet starts slowly. That is, the time from when the phone detects that the user clicks the icon of the health applet to when the main interface of the health applet is displayed is long. Figure 1 In the a interface to display Figure 1 The b interface lasts for a long time, which seriously affects the user experience.
[0079] For example, in the above Figure 2 In the example shown, when the user opens the health applet, the health applet starts slowly. That is, the time from when the phone detects that the user clicks the icon of the health applet to when the main interface of the health applet is displayed is long. Figure 2 In the a interface to display Figure 2 The b interface lasts for a long time, which seriously affects the user experience.
[0080] In order to understand the reasons why the mini program starts slowly, the present application embodiment uses the above Figure 2 Taking the startup process of the health applet shown in FIG. 1 as an example, the startup process of the applet is studied.
[0081] Figure 3 A schematic diagram of the startup process of a health applet is shown. Figure 3 As shown, the mobile phone detects the user clicking the health applet icon at 37.580 seconds (second, s). In response to this operation, the mobile phone sends WXShotcutEntryActivity (micro The desktop shortcut startup interface) process is dispatched to the central processing unit (CPU) to run to start the microprocessor. The application ends the running of the WXShotcutEntryActivity process at 37.626s. The running time of the WXShotcutEntryActivity process is 37.626-37.592=0.034s=340 milliseconds (ms).
[0082] The phone sent AppBrandLaunchProxyUI (micro Internal proxy interface) process to schedule the thread to run on the CPU to start the micro The main interface of the health applet appears, and the AppBrandLaunchProxyUI process ends at 37.819s. The running time of the AppBrandLaunchProxyUI process is 37.819-37.791=0.028s=280ms.
[0083] At 37.989s, the mobile phone dispatches the thread in the initialization process of the health applet to the CPU to run to initialize the health applet, and ends the initialization process at 40.439s. The running time of the initialization process is 40.439-37.989=2.450s=2450ms. After running the initialization process, the mobile phone dispatches the thread in the health applet main interface process (AppBrandUI) to the CPU to run to display the health applet main interface, and ends the health applet main interface process at 40.769s. At this time, the mobile phone displays the health applet main interface (i.e., the above-mentioned Figure 2 b interface in the diagram).
[0084] From the above Figure 3 It can be seen that the time from when the mobile phone detects that the user clicks the health applet icon to when the health applet main interface is displayed is 40.769-37.580=3.189s=3189ms, which is relatively long and seriously affects the user experience.
[0085] If the running time of the above-mentioned health applet main interface process (AppBrandUI) is too long, a blank page will appear when the phone displays the health applet main interface. That is, as the health applet main interface process (AppBrandUI) runs, the health applet main interface content will gradually appear on the blank page, causing the user to wait too long, affecting the user experience. In particular, when the phone performance is poor or the network is weak, the user will wait longer.
[0086] The health applet main interface process (AppBrandUI) can include multiple threads. The sum of the running time of these multiple threads is the running time of the health applet main interface process. The mobile phone dispatches these multiple threads to the CPU to run in sequence. If the running time is too long, the mobile phone can first display a blank interface, and as the threads run, the health applet main interface content is gradually displayed on the blank page.
[0087] For example, Figure 4 A schematic diagram of the main interface process of a health applet is shown. Figure 4 As shown in the figure, the black filled rectangle is a thread. The health applet main interface process includes 4 threads, namely thread 1, thread 2, thread 3 and thread 4. The sum of the running time of these 4 threads is the running time of the health applet main interface process. The mobile phone schedules these 4 threads to run on the CPU in sequence. If the running time is too long, the mobile phone can display a blank interface first, and as the thread runs, the health applet main interface content is gradually displayed on the blank page.
[0088] In view of this, an embodiment of the present application provides a method for starting a mini-program and a terminal device. When the terminal device detects a user's operation to start a mini-program, in response to the operation, the priority of the thread used to display the mini-program interface or the thread used to access the network is increased. The terminal device can schedule the thread to run on the CPU earlier, reducing the waiting time for scheduling, thereby shortening the time from detecting the user clicking the mini-program icon to displaying the mini-program main interface, which is beneficial to improving the startup speed of the mini-program.
[0089] The method provided in the embodiments of the present application can be applied to any terminal device capable of running a small program, for example, a mobile phone, a tablet computer, a personal computer (PC), and a wearable terminal device such as a smart watch, and can also be various teaching aids (such as a learning machine, an early education machine), a smart toy, a portable robot, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, etc., and can also be a device with a mobile office function, a device with a smart home function, a device with an audio-visual entertainment function, a device supporting smart travel, etc. It should be understood that the embodiments of the present application do not limit the specific technology and specific device form adopted by the terminal device.
[0090] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The layered architecture can adopt an Android system, an Apple (IOS) system, or other operating systems, which are not limited in the embodiments of the present application. The following takes the Android system of the layered architecture as an example to illustrate the software structure of the terminal device.
[0091] Figure 5 A software structure block diagram of a terminal device applicable to the embodiments of the present application. The layered architecture divides the software system of the terminal device into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers, from top to bottom, namely, the application layer (applications), the application framework layer (application framework), the Android runtime (Android runtime) and the system library, and the kernel layer (kernel).
[0092] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. Figure 3 As shown, the application package can include camera, micro , desktop, memo, map and other applications. The application layer may also include a mini-program module, a system perception module and a protocol module. The mini-program module is used to obtain the identifier of the mini-program started by the user, and based on the identifier, determine the mini-program started by the user. The system perception module includes preset configuration information, and the preset configuration information includes the identifier of the preset mini-program and the preset thread. The preset mini-program is a program that needs to increase the priority of the preset thread. The preset thread may include a thread for displaying the interface of the mini-program and / or a thread for accessing the network. The preset thread may also be referred to as the first thread, which is not limited in the embodiments of the present application. The protocol module is used to adjust the network of the terminal device and allocate network resources.
[0093] The application framework layer provides API and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 5 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, and an application service module, etc.
[0094] The window manager is used to manage window programs. The window manager can obtain the display size, 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 applications. The data can include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying pictures. The phone manager is used to provide communication functions for terminal devices. For example, the management of call status (including connected, hung up, etc.). The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables applications 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 download completion, message reminders, etc. The application service module is used to obtain the identifier of the mini-program launched by the user, and match the identifier with the configuration information preset in the system perception module, and determine the strategy for launching the mini-program based on the matching situation.
[0095] The Android system runtime includes the core library and the virtual machine. The Android system runtime is responsible for the scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the 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. The system library can contain modules with multiple functions, such as: surface manager, media library, and 3D graphics processing library.
[0096] The surface manager 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 multiple common audio and video formats, as well as static image files. The media library can support multiple audio and video encoding formats, such as JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing.
[0097] The kernel layer is a layer between hardware and software. The kernel layer is used to drive the hardware to make the hardware work. The kernel layer at least includes a display driver, a camera driver, and a Bluetooth driver, etc., which are not limited in the embodiments of the present application. The kernel layer may also include an execution module, which is used to execute the policy determined by the above-mentioned application service module.
[0098] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.
[0099] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0100] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or multiple.
[0101] Figure 6 A schematic flow chart of a method 600 for starting a mini-program provided in an embodiment of the present application is shown. The method 600 may be applicable to the above Figure 1 and Figure 2 The scenario shown in FIG. 6 is a schematic diagram of a method 600, but the embodiment of the present application is not limited thereto. The method 600 may be executed by a terminal device, such as a mobile phone. The software structure of the terminal device may be as described above. Figure 5 As shown, the embodiments of the present application are not limited thereto.
[0102] like Figure 6 As shown, the method 600 may include the following steps:
[0103] S601: Detecting a startup operation of a mini program.
[0104] The terminal device can detect the startup operation of the applet in various situations.
[0105] In one possible scenario, the application has the ability to run a mini-program, displays an icon of the mini-program, and the user can click the icon of the mini-program in the application to start the mini-program. When the user clicks the icon of the mini-program in the application, the terminal device detects the start operation of the mini-program.
[0106] For example, in the above Figure 1 The scene shown, such as Figure 1 As shown in the a interface in the figure, the micro The app has the ability to run mini-programs and displays the icon of the health mini-program. Users can In the app, click the icon of the health applet to start the applet. When you click the icon of the health applet in the app, the phone detects the startup operation of the health applet.
[0107] In another possible situation, the desktop of the terminal device displays an icon of the mini-program, and the user can start the mini-program by clicking the icon of the mini-program on the desktop. When the user clicks the icon of the mini-program on the desktop, the terminal device detects the start-up operation of the mini-program.
[0108] For example, in the above Figure 2 The scene shown, such as Figure 2 As shown in interface a in the figure, the mobile phone desktop displays an icon of the health applet, and the user can start the applet by clicking the icon of the health applet on the desktop. When the user clicks the icon of the health applet on the desktop, the mobile phone detects the start operation of the health applet.
[0109] S602: In response to a start operation, determine a first priority preset for a first thread in a terminal device, where the first thread includes a thread for displaying an interface of a mini-program and / or a thread for accessing a network.
[0110] The first thread is preset by the developer, and may also be referred to as a preset thread, and may be stored in a configuration file. The terminal device may obtain the first thread from the configuration file in response to the startup operation. Figure 4 In the example shown, the first thread may be at least one of thread 1, thread 2, thread 3, or thread 4.
[0111] There are many possible implementations of the first thread. In one possible implementation, the first thread includes a thread for displaying the interface of the mini-program. There may be one or more threads for displaying the interface of the mini-program, which is not limited in this application.
[0112] Exemplarily, if the "JSRuntimeLooper" thread and the "Chrome" thread are threads in the applet for displaying the interface of the applet, the first thread may include the "JSRuntimeLooper" thread and the "Chrome" thread.
[0113] In another possible implementation, the first thread includes a thread for accessing a network, wherein the thread for accessing a network may be one or more, which is not limited in the present application.
[0114] Exemplarily, if the "mars" thread is a thread in the applet for displaying the interface of the applet, the first thread may include the "mars" thread.
[0115] In yet another possible implementation, the first thread includes a thread for displaying an interface of the applet and a thread for accessing a network.
[0116] Exemplarily, if the "JSRuntimeLooper" thread and the "Chrome" thread are threads in the applet used to display the interface of the applet, and the "mars" thread is a thread in the applet used to display the interface of the applet, then the first thread may include the "JSRuntimeLooper" thread, the "Chrome" thread and the "mars" thread.
[0117] After the terminal device acquires the first thread, it can determine the first priority preset for the first thread in the terminal device. It can be understood that the priority of the first thread preset in the terminal device is the first priority.
[0118] Optionally, the terminal device includes first configuration information, which includes priorities of multiple threads. The first configuration information can be used to indicate the priorities of multiple threads in the terminal device. If the multiple threads include the first thread, the terminal device can determine the first priority of the first thread based on the first configuration information.
[0119] In this implementation, the priorities of multiple threads in the terminal device are indicated by the first configuration information. The terminal device can determine the priority of the thread based on the first configuration information and run the thread based on the priority, which is conducive to ensuring that the terminal device runs the threads in an orderly manner.
[0120] S603: If the applet is a program that needs to increase the priority of the first thread, run the first thread according to the second priority, and the second priority is higher than the first priority.
[0121] The level of priority (including the first priority and the second priority) can be expressed by numbers or words, and this embodiment of the present application is not limited to this.
[0122] Exemplarily, the priority is represented by a number, and a higher number indicates a lower priority. If the first priority is 100, the second priority may be any number less than 100. The lower the number corresponding to the second priority, the higher the priority, and the more likely the terminal device can run the first thread first.
[0123] The program that needs to increase the priority of the first thread is used to represent a preset small program that needs to increase the startup speed. The program that needs to increase the priority of the first thread can be one or more, and this application does not limit it.
[0124] Exemplarily, the program that needs to increase the priority of the first thread may be a mini-program for querying information, for example, a mini-program for querying health status such as a health mini-program, a mini-program for querying QR codes, and a mini-program for querying identity information.
[0125] If the started applet is a program that requires increasing the priority of the first thread, the terminal device may run the first thread at a second priority that is higher than the first priority.
[0126] This implementation method, in response to the startup operation of the mini-program, runs the first thread at a second priority level with a higher priority level. Compared with running the first thread at a first priority level with a lower priority level, the first thread can be run preferentially, shortening the time the first thread waits to run, thereby shortening the time it takes for the mini-program to start up to the mini-program display interface, which is beneficial to improving the startup speed of the mini-program.
[0127] Optionally, if the terminal device includes second configuration information, and the second configuration information includes a program for which the priority of the first thread needs to be increased, the second configuration information is used to indicate the program for which the priority of the first thread needs to be increased; if the program indicated by the second configuration information includes a small program, the terminal device can determine that the small program is a program for which the priority of the first thread needs to be increased. The second configuration information may also include the above-mentioned first thread, but the embodiments of the present application are not limited thereto.
[0128] In this implementation, the program that needs to increase the priority of the first thread is preset in the second configuration information, and the terminal device can obtain the program that needs to increase the priority of the first thread based on the second configuration information. The operation is simple and efficient.
[0129] Optionally, after the mini program starts running for a preset time or the mini program ends running, the terminal device can run the first thread according to the first priority.
[0130] The preset duration of the mini program startup can be understood as the preset duration of the mini program startup or the preset duration after the mini program displays the main interface, wherein the preset duration can be 10 seconds or 12 seconds, but the embodiments of the present application are not limited thereto. The mini program termination can be understood as the terminal device detecting the mini program exit operation.
[0131] After the mini program starts running for a preset time or the mini program ends running, the terminal device can run the first thread according to the first priority. That is to say, the terminal device does not always run the first thread at the second priority. If the mini program starts running for a preset time or the mini program ends running, the terminal device can run the first thread according to the first priority.
[0132] With this implementation, after the mini program starts running for a preset time or ends running, the first thread is run at the first priority instead of always running at the second priority. After quickly starting the mini program, the priority of the first thread can be restored to the original priority (i.e., the first priority), which is beneficial to ensuring orderly running threads of the terminal device.
[0133] S604, obtaining a first frequency preset for a central processing unit CPU in the terminal device;
[0134] The first frequency is the operating frequency before the terminal device schedules the first thread to the CPU.
[0135] S605: If the applet is a program that needs to increase the priority of the first thread, control the CPU to run the first thread at a second frequency, where the second frequency is higher than the first frequency.
[0136] The CPU in the terminal device can run at a preset first frequency. If the applet is a program that needs to increase the priority of the first thread, the terminal device can control the CPU to run the first thread at a second frequency higher than the first frequency.
[0137] This implementation method runs the first thread at a second frequency higher than the first frequency, which can shorten the running time of the first thread, is conducive to quickly displaying the interface of the mini program and / or quickly accessing the network to quickly display the interface of the mini program, and is conducive to shortening the time from starting the mini program to the mini program display interface, thereby improving the startup speed of the mini program.
[0138] Optionally, after the mini program starts running for a preset time or the mini program ends running, the terminal device controls the CPU to run the first thread at the first frequency.
[0139] After the mini program starts running for a preset time or the mini program ends running, the terminal device can control the CPU to run the first thread at the first frequency. That is to say, the terminal device does not always run the first thread at the second frequency. If the mini program starts running for a preset time or the mini program ends running, the terminal device can control the CPU to run the first thread at the first frequency.
[0140] With this implementation, after the mini program starts running for a preset time or ends running, the first thread is run at the first frequency instead of always running at the second frequency. After quickly starting the mini program, the CPU frequency can be restored to the original frequency (i.e., the first frequency), which is beneficial to ensure that the CPU runs threads in an orderly manner.
[0141] The terminal device may run the first thread only at a second priority level higher than the first priority level, or may run the first thread only at a second frequency higher than the first frequency, or may run the first thread both at a second priority level higher than the first priority level and at a second frequency higher than the first frequency. The embodiments of the present application are not limited to this.
[0142] If the embodiment of the present application runs the first thread at a second priority higher than the first priority, and runs the first thread at a second frequency higher than the first frequency, the first thread can be run preferentially, shortening the time the first thread waits to run, and shortening the running time of the first thread, which is beneficial to shortening the time from starting the mini program to the mini program display interface, and can increase the mini program startup speed.
[0143] As an optional embodiment, if the applet can provide a camera service, the resources required for the camera service are preloaded.
[0144] If the launched mini program can provide camera services, the terminal device can preload the resources required for the camera service. The launched mini program can provide camera services, which means that the launched mini program can call the camera based on the user's selection. If the mini program can provide camera services, the terminal device can load the resources required for the camera service even if the user does not select the camera service. When the terminal device calls the camera based on the user's selection, it is not necessary to load the resources required for the camera service.
[0145] For example, the launched mini program is a health mini program, which includes a "photo taking" control. The terminal device can preload the resources required when the "photo taking" control is triggered. When the terminal device detects that the "photo taking" control is triggered, there is no need to load the required resources.
[0146] The mini-program startup method provided in the present application, if the mini-program can provide camera service, even if the user does not select the camera service, the terminal device can also load the resources required for the camera service. When the terminal device calls the camera based on the user's selection, there is no need to load the resources required for the camera service, which is conducive to improving the efficiency of camera use.
[0147] The method provided in the embodiment of the present application can be applied to the above Figure 1 and Figure 2 The following describes the method provided by the embodiment of the present application in the above-mentioned scenario. Figure 1 and Figure 2The specific implementation method in .
[0148] Figure 7 A schematic flow chart of a method 700 for starting a mini-program provided in an embodiment of the present application is shown. The method 700 may be applicable to the above Figure 1 The scenario shown in FIG. 1 is a schematic diagram of a method 700, but the embodiment of the present application is not limited thereto. The method 700 may be executed by a terminal device, such as a mobile phone. The software structure of the terminal device may be as described above. Figure 5 The method 700 may be specifically performed by a microcontroller of a terminal device. Application, applet module, application service module, system perception module and execution module are implemented.
[0149] like Figure 7 As shown, the method 700 may include the following steps:
[0150] S701: Detect that the user starts the micro Application operation, micro The application starts.
[0151] User-initiated micro The application operation can be a user clicking a micro The operation of the application icon, but the embodiment of the present application is not limited to this. Application startup can be understood as the terminal device running micro The process corresponding to the application.
[0152] It should be noted that micro An application is an application that has the ability to run mini-programs. The application is used as an example to illustrate The application can be replaced with any application that has the ability to run mini-programs.
[0153] S702, Micro The application reads the configuration information in the system perception module, and the configuration information is the second configuration information in the above method 600.
[0154] The system perception module can start automatically after the terminal device is turned on, and the configuration information is preset by the developer before the terminal device leaves the factory. The configuration information can exist in the form of a configuration file. The configuration information may include the identifier of the preset applet and the preset thread. The preset applet is a program that needs to increase the priority of the preset thread (i.e., the first thread), which is preset by the developer before the terminal device leaves the factory. The preset thread is the above-mentioned first thread. The preset thread may include a thread for displaying the interface of the applet and / or a thread for accessing the network. The preset thread is preset by the developer before the terminal device leaves the factory.
[0155] The identifier of the mini program (including the identifier of the preset mini program and the identifier of mini program a) can be represented by the symbol app_id, which is a unique attribute that identifies the mini program, similar to the user's ID number. The preset mini program can be the above-mentioned health mini program, or it can be a mini program for querying QR codes, which is not limited in the embodiments of the present application.
[0156] Exemplarily, the configuration file includes configuration information, which may include the identifier of the preset applet and the preset thread. Among them, the identifier of the preset applet may include the identifier of the health applet "wxfe0e405895cafdf9###0" and the identifier of the applet for querying the QR code "wx82d43fee89cdc7df###1". The preset threads may include a "JSRuntimeLooper" thread, a "Chrome" thread, and a "mars" thread. Among them, the "JSRuntimeLooper" thread and the "Chrome" thread are threads in the applet for displaying the interface of the applet, and the "mars" thread is a thread in the applet for displaying the interface of the applet.
[0157] S703: Detecting the user's operation of starting mini program a, The application obtains the identifier of mini program a and sends the identifier of mini program a to the mini program module. Correspondingly, the mini program module can receive the identifier of mini program a.
[0158] Mini Program a can be a micro The application can support any mini-program, which is not limited in the present application embodiment. Figure 1 In the scenario shown, mini program a may be a health mini program.
[0159] micro The application can obtain the ID of Mini Program a through the stub. The application can also send the configuration information to the mini program module, and then the mini program module sends the configuration information to the application service module. The application can send configuration information to the application service module.
[0160] S704. The mini-program module may send an instruction to start mini-program a to the application service module based on the identifier of mini-program a. Correspondingly, the application service module receives the instruction to start mini-program a.
[0161] The applet module may determine to start applet a based on the identifier of applet a, and instruct the application program service module to start applet a through an instruction to start applet a.
[0162] S705. The application service module determines whether mini-program a is a preset mini-program based on the instruction to start mini-program a.
[0163] The application service module may determine a startup strategy based on whether applet a is a preset applet.
[0164] If applet a is a preset applet, the application service module may determine the startup strategy as an optimization strategy, which includes increasing the first priority of the preset thread to the second priority and / or increasing the first frequency of the CPU running the preset thread to the second frequency. The application service module may send the optimization strategy to the execution module, i.e., execute S506.
[0165] If applet a is not a preset applet, the application service module may determine the startup strategy as the preset strategy, which includes determining the priority of the preset thread as the first priority and / or determining the frequency of the processor running the preset thread as the first frequency, that is, starting the applet using the method of the prior art.
[0166] S706. If mini program a is a preset mini program, the application service module may send the optimization strategy to the execution module. Correspondingly, the execution module receives the optimization strategy and starts mini program a based on the optimization strategy.
[0167] If the optimization strategy includes increasing the first priority of the preset thread to the second priority, the execution module can schedule the preset thread to run on the CPU according to the second priority, thereby reducing the time the preset thread waits for scheduling. If the optimization strategy includes increasing the first frequency of the CPU running the preset thread to the second frequency, the execution module can control the CPU to run the preset thread at the second frequency, thereby shortening the running time of the preset thread. If the optimization strategy includes increasing the first priority of the preset thread to the second priority and / or increasing the first frequency of the CPU running the preset thread to the second frequency, the execution module can schedule the preset thread to run on the CPU according to the second priority, and increase the first frequency of the CPU running the preset thread to the second frequency, thereby reducing the waiting time for scheduling and shortening the running time of the preset thread.
[0168] S707: Upon detecting the user's operation of exiting mini program a, the mini program module may send an instruction to exit mini program a to the application service module. Correspondingly, the application service module receives the instruction to exit mini program a.
[0169] Upon detecting the user's operation of exiting mini program a, the mini program module may determine that mini program a has exited, and instruct the application program service module to exit mini program a through an instruction to exit mini program a.
[0170] S508. The application service module may send an instruction to cancel the optimization strategy to the execution module based on the instruction to exit the mini-program a. Correspondingly, the execution module no longer executes the optimization strategy based on the instruction to cancel the optimization strategy.
[0171] The execution module no longer executes the optimization strategy based on the instruction to cancel the optimization strategy, that is, the execution module adjusts the priority of the preset thread to the original priority (i.e., adjusts the second priority to the first priority) and / or adjusts the frequency of the processor running the preset thread to the original frequency (i.e., adjusts the second frequency to the first frequency).
[0172] The application service module sends an instruction to cancel the optimization strategy to the execution module based on the instruction to exit applet a. This is a possible implementation method. The embodiment of the present application also provides another possible implementation method. The application service module can record the running time of the execution module running the optimization strategy after the application service module sends the optimization strategy to the execution module in the above S706. If the running time exceeds the preset time, an instruction to cancel the optimization strategy can be sent to the execution module. Among them, the preset time can be 10 seconds or 12 seconds, but the embodiment of the present application is not limited to this.
[0173] In the method for starting a mini program provided in the embodiment of the present application, if the mini program a started by the user is a preset mini program, the terminal device can use the optimization strategy to start the mini program a, which can reduce the time for the preset thread to wait for scheduling and / or shorten the running time of the preset thread, which is conducive to shortening the time from detecting the operation of the user clicking the mini program icon to displaying the mini program main interface, which is conducive to improving the startup speed of the mini program. In addition, after the user exits the mini program a or the running time of the optimization strategy exceeds the preset time, the scheme before optimization can be used, and different strategies can be reasonably adopted according to different situations, which is conducive to the stable operation of the device.
[0174] Regarding the above S705, the application service module determines whether mini-program a is a preset mini-program based on the instruction to start mini-program a, and the embodiment of the present application provides a specific implementation method.
[0175] For example, Figure 8 FIG. 8 is a schematic flow chart of a method 800 for identifying a small program. Figure 8 As shown, the method 800 may include:
[0176] S801. The application service module obtains the identifier of mini program a.
[0177] The identifier of Mini Program a can be sent by the Mini Program module or by The application sends the information, which is not limited in this embodiment of the present application.
[0178] S802: The application service module determines whether the configuration information includes the identifier of mini-program a.
[0179] The configuration information includes the identifier of the preset applet, that is, the application service module determines whether the identifier of the preset applet includes the identifier of applet a, or determines whether the identifier of the preset applet has an identifier that matches the identifier of applet a.
[0180] Exemplarily, if the identifier of the preset applet in the configuration information includes the identifier of the health applet "wxfe0e405895cafdf9###0" and the identifier of the applet for querying the QR code "wx82d43fee89cdc7df###1", the application service module can determine whether the identifier of the health applet and the identifier of the applet for querying the QR code include the identifier of applet a. If the identifier of applet a is "wxfe0e405895cafdf9###0", which is the same as the identifier of the health applet, then the identifier of the preset applet includes the identifier of applet a, or it can be understood that the identifier of the preset applet has an identifier that matches the identifier of applet a.
[0181] S803: If the configuration information includes the identifier of applet a, the application program service module obtains a preset thread from the configuration information.
[0182] The configuration information includes a preset thread, and the application program service module can obtain the preset thread from the configuration information.
[0183] S804: The application service module determines the priority of the preset thread as the second priority, and determines the frequency of the processor running the preset thread as the second frequency.
[0184] The second priority determined by the application service module is higher than the original first priority, and the second frequency of the processor running the preset thread is higher than the original first frequency.
[0185] S805: If the configuration information does not include the identifier of applet a, the application program service module determines the priority of the preset thread as the first priority, and determines the frequency of the processor running the preset thread as the first frequency.
[0186] Determining the priority of the preset thread as the first priority and the frequency of the processor running the preset thread as the first frequency can also be called a preset strategy. The preset strategy is a method for starting a small program in the prior art. If the configuration information does not include the identifier of the small program a, the application service module determines to use the method of the prior art to start the small program.
[0187] In the method for starting a mini-program provided in an embodiment of the present application, if the configuration information includes the identifier of the mini-program a started by the user, the terminal device can determine the priority of the preset thread as a second priority level higher than the first priority level, and determine the frequency of the processor running the preset thread as a second frequency higher than the first frequency, which can reduce the waiting time for scheduling and shorten the running time of the preset thread, and is beneficial to improving the startup speed of the mini-program.
[0188] For example, Fig. 9 A schematic flow chart of a method 900 for starting a mini-program provided in an embodiment of the present application is shown. The method 900 may be applicable to the above Figure 2 The method 900 may be executed by a terminal device, such as a mobile phone. The software structure of the terminal device may be as described above. Figure 5 The method 900 can be specifically implemented by the desktop, micro Application, applet module, application service module, system perception module and execution module are implemented.
[0189] like Fig. 9 As shown, the method 900 may include the following steps:
[0190] S901: Detecting the user's operation of launching mini-program a on the desktop, the desktop is directed to mini-program a. The application sends a start command, and the micro The application receives the start instruction.
[0191] An icon of mini program a is displayed on the desktop, and the user can start mini program a by clicking the icon of mini program a.
[0192] S902, Micro Based on the startup instruction, the application starts and reads the configuration information in the system perception module. The configuration information is the second configuration information.
[0193] The system perception module can be automatically started after the terminal device is turned on, and the configuration information is preset by the developer before the terminal device leaves the factory. The configuration information can exist in the form of a configuration file. The configuration information can include the identifier of the preset applet and / or the preset thread.
[0194] S903, Micro The application obtains the identifier of mini program a and sends the identifier of mini program a to the mini program module. Correspondingly, the mini program module can receive the identifier of mini program a.
[0195] S904. The mini-program module may send an instruction to start mini-program a to the application service module based on the identifier of mini-program a. Correspondingly, the application service module receives the instruction to start mini-program a.
[0196] S905. The application service module determines whether mini-program a is a preset mini-program based on the instruction to start mini-program a.
[0197] S906. If mini program a is a preset mini program, the application service module may send the optimization strategy to the execution module. Correspondingly, the execution module receives the optimization strategy and starts mini program a based on the optimization strategy.
[0198] S907: Upon detecting the user's operation of exiting mini program a, the mini program module may send an instruction to exit mini program a to the application service module. Correspondingly, the application service module receives the instruction to exit mini program a.
[0199] S908. The application service module may send an instruction to cancel the optimization strategy to the execution module based on the instruction to exit the mini-program a. Correspondingly, the execution module no longer executes the optimization strategy based on the instruction to cancel the optimization strategy.
[0200] The specific implementation method of S903 to S908 is the same as that of S703 to S708 above, and will not be repeated here.
[0201] The mini-program startup method provided in the embodiment of the present application is that if the mini-program a started by the user is a preset mini-program, the terminal device can use an optimization strategy to start mini-program a, which is beneficial to shortening the time from detecting that the user clicks the mini-program icon to displaying the mini-program main interface, and is beneficial to improving the startup speed of the mini-program.
[0202] Optionally, in the above-mentioned methods 700 and 900, if applet a can provide camera services, the application service module can send a preloading instruction to the camera application, and the camera application can preload resources required for the camera service based on the preloading instruction.
[0203] Optionally, in the above methods 700 and 900, the application service module may also send an optimization instruction to the protocol module, and the protocol module may give priority to guaranteeing the network resources used by mini-program a based on the optimization instruction.
[0204] The size of the serial number of each process in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0205] Combined with the above Figures 1 to 9 , describes in detail the method provided by the embodiment of the present application, and will be combined with Fig.10 and Fig.11 , describe in detail the equipment provided in the embodiments of the present application.
[0206] Fig.10A schematic block diagram of a terminal device 1000 provided in an embodiment of the present application is shown. The terminal device 1000 includes: a detection module 1010 and a processing module 1020. The detection module 1010 is used to: detect the startup operation of the applet; the processing module 1020 is used to: in response to the startup operation, determine the first priority preset for the first thread in the terminal device, the first thread includes a thread for displaying the interface of the applet and / or a thread for accessing the network; if the applet is a program that needs to increase the priority of the first thread, the first thread is run according to the second priority, and the second priority is higher than the first priority.
[0207] It should be understood that the terminal device 1000 here is embodied in the form of a functional module. The term "module" here may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit and / or other suitable components that support the described functions. In an optional example, those skilled in the art may understand that the terminal device 1000 may be specifically a terminal device in the above-mentioned method embodiment, or the functions of the terminal device in the above-mentioned method embodiment may be integrated in the terminal device 1000, and the terminal device 1000 may be used to execute the various processes and / or steps corresponding to the terminal device in the above-mentioned method embodiment, and to avoid repetition, it will not be repeated here.
[0208] The terminal device 1000 has the function of implementing the corresponding steps performed by the terminal device in the above method embodiment; the above functions can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0209] In the embodiments of the present application, Fig.10 The terminal device 1000 may also be a chip or a chip system, for example, a system on chip (SoC).
[0210] Fig.11 1 is a schematic block diagram of another terminal device 1100 provided in an embodiment of the present application. The terminal device 1100 includes: a processor 1110, a transceiver 1120, and a memory 1130. The processor 1110, the transceiver 1120, and the memory 1130 communicate with each other through an internal connection path, the memory 1130 is used to store instructions, and the processor 1110 is used to execute the instructions stored in the memory 1130 to control the transceiver 1120 to send signals and / or receive signals.
[0211] It should be understood that the terminal device 1100 can be specifically a terminal device in the above method embodiment, or the function of the terminal device in the above method embodiment can be integrated in the terminal device 1100, and the terminal device 1100 can be used to execute the various steps and / or processes corresponding to the terminal device in the above method embodiment. Optionally, the memory 1130 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1110. A part of the memory 1130 may also include a non-volatile random access memory. For example, the memory 1130 may also store information about the device type. The processor 1110 can be used to execute the instructions stored in the memory 1130, and when the processor 1110 executes the instructions, the processor 1110 can execute the various steps and / or processes corresponding to the terminal device in the above method embodiment.
[0212] It should be understood that in the embodiment of the present application, the processor 1110 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0213] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor executes the instructions in the memory, and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.
[0214] The present application also provides a computer-readable storage medium, which stores a computer program, and the computer program is used to implement the method corresponding to the terminal device in the above method embodiment.
[0215] The present application also provides a chip system, which is used to support the terminal device in the above method embodiment to implement the functions shown in the embodiment of the present application.
[0216] The present application also provides a computer program product, which includes a computer program (also referred to as code or instruction). When the computer program runs on a computer, the computer can execute the method corresponding to the terminal device shown in the above method embodiment.
[0217] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0218] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0219] In the several embodiments provided in the present application, it should be understood that the disclosed systems, 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 is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, 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 modules, which can be electrical, mechanical or other forms.
[0220] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0221] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0222] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0223] The above is only a specific implementation of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the embodiments of the present application, which should be included in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be based on the protection scope of the claims.
Claims
1. A method for starting a small program, characterized in that: The method is applied in a terminal device, comprising: The startup operation of the applet is detected; In response to the start operation, determining a first priority preset for a first thread in the terminal device based on first configuration information in the terminal device, the first thread including a thread for accessing a network, the first configuration information being used to indicate priorities of a plurality of threads in the terminal device, the plurality of threads including the first thread, the first thread being a preset thread; If the applet is a program that needs to increase the priority of the first thread, the first thread is run according to a second priority, and the second priority is higher than the first priority; The method further comprises: Acquire a first frequency preset for a central processing unit (CPU) in the terminal device; If the applet is a program that requires increasing the priority of the first thread, the CPU is controlled to run the first thread at a second frequency, where the second frequency is higher than the first frequency.
2. The method according to claim 1, characterized in that The terminal device includes second configuration information, where the second configuration information is used to indicate a program for which the priority of the first thread needs to be increased; Wherein, the method further comprises: If the applet is included in the program indicated by the second configuration information, the applet is determined to be a program for which the priority of the first thread needs to be increased.
3. The method according to claim 1, characterized in that The method further comprises: After the mini program starts running for a preset time or the mini program ends running, the first thread is run according to the first priority.
4. The method according to claim 1, characterized in that: The method further comprises: After the mini program starts running for a preset time or the mini program ends running, the CPU is controlled to run the first thread at the first frequency.
5. The method according to claim 1, characterized in that The method further comprises: If the applet can provide the camera service, the resources required for the camera service are preloaded.
6. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the terminal device performs the method according to any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. A computer program product, characterized in that The invention comprises a computer program which, when being executed, causes a computer to execute the method according to any one of claims 1 to 5.
