WO2022148231A1 - 应用程序启动控制方法、装置、电子设备和存储介质 - Google Patents

应用程序启动控制方法、装置、电子设备和存储介质 Download PDF

Info

Publication number
WO2022148231A1
WO2022148231A1 PCT/CN2021/139551 CN2021139551W WO2022148231A1 WO 2022148231 A1 WO2022148231 A1 WO 2022148231A1 CN 2021139551 W CN2021139551 W CN 2021139551W WO 2022148231 A1 WO2022148231 A1 WO 2022148231A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
message
startup
target message
message queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2021/139551
Other languages
English (en)
French (fr)
Inventor
徐磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Publication of WO2022148231A1 publication Critical patent/WO2022148231A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the present disclosure relates to the field of information technology, and in particular, to a method, apparatus, electronic device, and storage medium for application startup control.
  • terminals have become an indispensable tool in people's lives.
  • the user may install various application programs (Application, APP) in the terminal.
  • Application Application
  • APP application programs
  • Different APPs can provide users with different service functions.
  • the data required by the APP can be read from the local database, and the data can be parsed and preloaded.
  • the embodiments of the present disclosure provide an application startup control method, apparatus, electronic device and storage medium, which can improve the performance of the application, for example, can improve the startup of the application.
  • Post content showcases efficiency or quality.
  • An embodiment of the present disclosure provides an application startup control method, including:
  • the embodiment of the present disclosure also provides an application program startup control device, including:
  • an acquisition module used for acquiring the message queue corresponding to the application in the application startup phase
  • a determining module configured to determine the process startup scene of the application by traversing the messages in the message queue
  • a preloading or initializing module is configured to preload or initialize the data required by the process starting scene according to the process starting scene of the application program.
  • Embodiments of the present disclosure also provide an electronic device, the electronic device comprising:
  • processors one or more processors
  • a storage device for storing one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the application program startup control method as described above.
  • Embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the above-described application program startup control method.
  • Embodiments of the present disclosure also provide a computer program product, the computer program product comprising a computer program carried on a computer-readable medium, and when the computer program is executed by a processor, enables the processor to implement the above-mentioned application Program startup control method.
  • the application startup control method provided by the embodiments of the present disclosure obtains the message queue corresponding to the application during the application startup phase, and performs the The messages in the message queue are traversed to determine the process startup scene of the application. Further, according to the process startup scenario, the window or page that the application is about to start can be determined, and the data required by the window or page can be preloaded or initialized, so that the data required by other windows or other pages can be temporarily blocked or delayed. And focus on completing the initialization task of the window or page to be started, thereby improving the performance of the application, for example, it can improve the efficiency or quality of the content display after the application is started.
  • FIG. 1 is a flowchart of an application program startup control method in an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of an application scenario in an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of an APP startup stage in an embodiment of the present disclosure
  • FIG. 5 is a flowchart of another application startup control method in an embodiment of the present disclosure.
  • FIG. 6 is a flowchart of another application startup control method in an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an application program startup control device in an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
  • the term “including” and variations thereof are open-ended inclusions, ie, "including but not limited to”.
  • the term “based on” is “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • FIG. 1 is a flowchart of an application startup control method in an embodiment of the present disclosure.
  • This embodiment is applicable to the case where application startup control is performed in a client.
  • the method can be executed by an application startup control device. It can be implemented in software and/or hardware, and the device can be configured in electronic devices, such as terminals, specifically including but not limited to smart phones, PDAs, tablet computers, wearable devices with display screens, desktops, and laptops , all-in-one machine, smart home equipment, etc.
  • this embodiment may be applicable to the case where application startup control is performed in the server, the method may be executed by an application startup control apparatus, and the apparatus may be implemented in software and/or hardware, and the apparatus may be configured in an electronic device , such as the server.
  • the method may specifically include S101-S103:
  • an application may be installed in the terminal 21 .
  • a message queue can be generated.
  • the message queue includes one or more messages to be scheduled.
  • the main thread in the APP can acquire the message queue, and schedule each message in the message queue in sequence.
  • acquiring the message queue corresponding to the application program includes: acquiring the message queue corresponding to the application program through a reflection mechanism.
  • the main thread in the APP can specifically acquire the message queue corresponding to the APP through a reflection mechanism.
  • the reflection mechanism may specifically be a Java (JAVA) reflection mechanism.
  • the JAVA reflection mechanism is that in the running state of the APP, for any class, you can know all the properties and methods of this class, and for any object, you can call any of its methods and properties.
  • This dynamic acquisition of information and dynamic The function of calling the method of an object is called the reflection mechanism of the JAVA language.
  • the main thread of the APP can obtain the message queue of the main thread and the instantiated object corresponding to the message queue through the JAVA reflection mechanism.
  • the main thread of the APP can traverse the messages in the message queue, and in the process of traversing, determine the process startup scene of the APP, for example, whether the process startup scene of the APP is a multi-card aggregate display (Feed) scene , the main page startup scene, the details page startup scene, or the live interface startup scene, etc.
  • the process startup scene of the APP is a multi-card aggregate display (Feed) scene , the main page startup scene, the details page startup scene, or the live interface startup scene, etc.
  • eed multi-card aggregate display
  • the main thread of the APP determines the process startup scene of the APP
  • the data required for the process startup scene can be further preloaded or initialized according to the process startup scene of the APP.
  • the process startup scene of the application is determined by acquiring the message queue corresponding to the application in the application startup phase, and traversing the messages in the message queue. Further, according to the process startup scenario, the window or page that the application is about to start can be determined, and the data required by the window or page can be preloaded or initialized, so that the data required by other windows or other pages can be temporarily blocked or delayed. And focus on completing the initialization task of the window or page to be started, thereby improving the performance of the application, for example, it can improve the efficiency or quality of the content display after the application is started.
  • the generation process of the message queue in the APP startup phase is described below with reference to a specific embodiment, as shown in FIG. 3 , the process involves the desktop, the system (System), the incubator (Zygote) and the application program. Among them, the desktop, system, incubator and application programs can be run by different processes in the terminal 21 respectively.
  • the system may be an operating system in the terminal 21 .
  • An application can include a main thread (MainThread) and a child thread (BinderThread). The process includes the following steps:
  • the desktop sends a request for starting a user interface (User Interface, UI) to the system.
  • UI User Interface
  • the system sends a process start request to the incubator.
  • the incubator sends an initialization request to the main thread of the application.
  • the main thread can actively send a notification message to the system.
  • the main thread can actively send a notification message to a system service (System Server) in the system, such as an interface management service (Activity Manager Service, AMS).
  • System Server system service
  • AMS interface management service
  • the notification message is used to notify the system that the process creation is completed and the process initialization is completed.
  • the notification message may also notify the AMS to send the binding application request message (Bind Application) to the child thread of the application.
  • the system sends a binding application request message to the sub-thread of the application program.
  • the system may send a binding application request message to the child thread of the application program.
  • the application binding request message may be the first message sent by the system to the sub-thread of the application program.
  • the system sends the message in the system to the child thread of the application program.
  • the system can also send messages from the system to child threads of the application.
  • the messages in the system include at least one of a message for starting the UI interface as shown in FIG. 3 , a service message, and a broadcast message.
  • an application includes four components, namely, an Activity component, a Service component, a Receiver component, and a Provider component.
  • the Activity component is used to display the UI interface, such as opening the various interfaces displayed by the APP.
  • the Service component is a component used to satisfy and support background work, such as playing music in the background.
  • the Receiver component is a component used to monitor system behavior changes, such as monitoring the state changes of the mobile phone on and off the screen, network switching, etc.
  • the Provider component is a component used to provide data management within an application or other applications, such as address book management.
  • the application can start at least one of the four components each time it is started.
  • the system may send a message for starting the UI interface to the sub-thread of the application program, and the message for starting the UI interface may include the relevant information of the Activity component, for example, The identity, parameters, etc. of the Activity component.
  • the application program includes starting the Service component during this startup, in S307, the system may send a service class message to the sub-thread of the application program, and the service class message includes the relevant information of the Service component, such as the identifier and parameters of the Service component. Wait.
  • the system may send a broadcast message to the sub-thread of the application program, and the broadcast message includes the relevant information of the Receiver component, for example, the Receiver component IDs, parameters, etc.
  • the child thread of the application can encapsulate the message into a message in the message queue, and send the message to the message queue in sequence, waiting for the main thread to execute in sequence.
  • the system may also send the message of starting the UI interface, the service-type message, and the broadcast-type message to the sub-thread of the application program. Since the application binding request message is the first message sent by the system to the sub-thread of the application program, the sub-thread of the application program can, after receiving the application-binding application request message, Put into the first position of the message queue. Further, the sub-thread of the application program can sequentially put the message of starting the UI interface, the message of the service type, and the message of the broadcast type into the message queue.
  • the first message traversed is the binding application request message.
  • the binding application request message may not be in the first position of the message queue, but at the back of the message queue, in this case, the main thread of the application program performs processing on the message queue.
  • the first message traversed may be another message other than the binding application request message.
  • the application binding request message may notify the application to instantiate the corresponding application.
  • the application identifier may be included in the application binding request message.
  • the main thread of the application program schedules the application binding request message, the main thread can bind the application corresponding to the application identifier with the process after the main thread is initialized in the above steps.
  • the main thread may also perform instantiation processing on the application corresponding to the application identifier. That is, instantiating a process and instantiating an application are two different processes.
  • the binding application request message may further include relevant information of the Provider component, for example, the identifier and parameters of the Provider component.
  • the process startup scene of the application program is determined, including S401-S403 as shown in FIG. 4 :
  • the AMS in the system can also call other components to be created, such as the Activity component, the Service component, and the Receiver component, through the binder (Binder).
  • the messages, service messages, and broadcast messages corresponding to the UI interface are sequentially sent to the sub-threads of the application program.
  • the child thread can put the bound application request message, the message for starting the UI interface, the service message, and the broadcast message into the message queue corresponding to the main thread.
  • the process of the main thread executing the binding application request message and the process of the AMS sending the message for starting the UI interface, the service message, and the broadcast message to the child thread may be concurrent. Therefore, in the process of initializing the application, the main thread can traverse each message in the message queue, and in the process of traversing, determine whether there is a preset type of target message in the message queue.
  • the target message of the preset type may be the message for starting the UI interface as described above, and the preset type may be recorded as starting the UI interface (LAUNCH_ACTIVITY).
  • the target message is further filtered to determine the intent of the target message. (Article Detail Activity) and other specific pages.
  • a process startup scene of the application can be determined according to the intent, for example, a feed scene, a home page startup scene, a detail page startup scene, or a live interface startup scene.
  • the application startup control method by traversing the messages in the message queue corresponding to the application, it is determined whether the message queue includes a target message of a preset type, and the message queue includes the preset type.
  • the type of target message the intent of the target message is determined, and according to the intent of the target message, the process startup scene of the application is determined.
  • the window or page that the application is about to start can be determined, and the data required by the window or page can be preloaded or initialized, so that the data required by other windows or other pages can be temporarily blocked or delayed. And focus on completing the initialization task of the window or page to be started, thereby improving the performance of the application, for example, it can improve the efficiency or quality of the content display after the application is started.
  • FIG. 5 is a flowchart of another application startup control method in an embodiment of the present disclosure.
  • this embodiment further specifically describes the application program startup control method.
  • the method of this embodiment specifically includes S501-S505:
  • the main thread of the application can obtain the message queue through the reflection mechanism.
  • the main thread of the application program determines whether the message queue includes target messages of a preset type.
  • determining whether the message queue includes target messages of a preset type includes: determining whether the message queue includes the preset type according to type information of each message in the message queue Type of target message.
  • the message queue may include type information of each message.
  • the main thread of the application can determine whether the message queue is in the message queue according to the type information of each message in the message queue. Include target messages of preset types.
  • determining whether the message queue includes a target message of a preset type includes: determining whether the message queue includes a target message of a startup user interface type.
  • the target message of the preset type may be a target message of a startup user interface type, for example, a target message of the type LAUNCH_ACTIVITY.
  • determining the intention of the target message includes: determining that the message queue includes the preset type
  • the target message is filtered to obtain the intent of the target message.
  • the main thread can also filter the target message to determine the intent of the target message.
  • filtering the target message to obtain the intent of the target message includes: obtaining a message object of the target message from the target message; parsing the message object , to obtain the intent of the target message.
  • the main thread can obtain the message object (Object) of the target message from the target message, and further parse the message object of the target message, and obtain the intent (Intent) and Intent of the target message from the message object Internal components (Component), class name (ClassName), action (Action) and other key information.
  • the main thread can determine the process startup scene of the application program according to the intent of the target message and some key information inside the intent, for example, determine which UI interface the target message is to start.
  • determining the process startup scenario of the application program according to the intent of the target message includes: when determining that the intent of the target message is to start the home page, determining the process of the application program
  • the startup scene is a multi-card aggregation display scene.
  • preloading or initializing the data required for the process startup scene according to the process startup scene of the application includes: preloading or initializing the data required for the main page according to the multi-card aggregate display scene .
  • the main thread determines that the intent of the target message and some key information inside the intent satisfy the characteristics of the main page (Main Activity) in the multi-card aggregation display (Feed) scenario, it can be determined that the process startup scenario of the application is the Feed Scenes. Further, preload or initialize the data required for the main page in the feed scene.
  • determining the process startup scenario of the application program according to the intent of the target message includes: when determining that the intent of the target message is to start the details page, determining the The process startup scene is the details page startup scene.
  • preloading or initializing the data required for the process startup scene according to the process startup scene of the application includes: preloading or initializing the data required for the details page according to the details page startup scene.
  • the process startup scene of the application can be determined to be the detail page startup scene. Further, preload or initialize the data required for the detail page.
  • determining the process startup scenario of the application program according to the intent of the target message includes: when determining that the intent of the target message is to start the live interface, determining the The process start scene is the start scene of the live broadcast interface.
  • preloading or initializing the data required for the process startup scene according to the process startup scene of the application includes: preloading or initializing the data required for the live broadcast interface according to the live broadcast interface startup scene.
  • the main thread determines that the intent of the target message and some key information inside the intent satisfy the characteristics of the live broadcast interface, it can be determined that the process startup scene of the application is the live broadcast interface startup scene. Further, preload or initialize the data required for the live interface.
  • data required for preloading or initializing the live broadcast interface includes: turning on the player in advance and establishing a live broadcast channel. It can be understood that the data required for preloading or initializing the live broadcast interface is not limited to opening the player in advance and establishing the live broadcast channel, but may also include other data.
  • a target message of a preset type in the message queue is determined, and according to the intention of the target message, the application is determined
  • the program's process startup scene when the intention of the target message is to start the main page, data required for the main page is preloaded or initialized.
  • the intent of the target message is to start the details page, preload or initialize the data required for the details page.
  • the data of the live broadcast interface is preloaded or initialized.
  • the embodiment of the present disclosure preloads or initializes the data of the window or page to be started in the application startup phase, so that the The data of the remaining windows or pages is preloaded or initialized after the application is started, which not only improves the startup efficiency of the application, but also improves the content display efficiency or quality of the application after startup, thereby improving the user experience.
  • the embodiments of the present disclosure can complete the accurate identification of process startup scenarios by reflecting and analysing system resources during the process of application process initialization, for example, background pull, foreground startup, and which one to start. window or page.
  • the preloading or initialization tasks required by a certain scene can be completed preferentially or centrally according to the process startup scene.
  • the background pull may be that another application triggers the start of the application.
  • the foreground startup can be triggered by the user operating the icon of the application and triggering the startup of the application.
  • the identification process of the process startup scene will be described in detail below with reference to a specific embodiment. As shown in FIG. 6 , this process can be specifically executed by the main thread of the application program.
  • the process includes the following steps:
  • Message Queue and ActivityThread.H are system classes respectively.
  • the main thread of the application after the main thread of the application obtains the instantiated object corresponding to the message queue and the instantiated object corresponding to the entity class by reflection through the reflection mechanism, it can further obtain the internal parameters in the instantiated object by reflection, for example, Next message (next), current message (mMessage), etc.
  • the instantiated object of ActivityThread.H can be recorded as mH, and mH can be stored in the main thread or UI thread (Activity Thread) object, and the communication between the system service and the APP process can be processed in the handler (Handler).
  • Handler can be understood as the general name of the system class ActivityThread.H.
  • the messages in the message queue may be traversed, and the traversal process may be to sequentially read all the messages in the message queue from the beginning to the end, and use this to determine whether the currently traversed message is the target message of the preset type.
  • the message queue can also be locked to ensure thread synchronization.
  • S605 Determine whether the type of the current message is an entity class for executing message scheduling, if so, execute S606; if not, execute S613.
  • the main thread after the main thread obtains the message from the message queue, it first determines whether the type of the message is ActivityThread.H. When the type of the message is ActivityThread.H, it is further judged whether the message is a target message of a preset type, for example, whether it is a target message for starting a UI interface, that is, a target message of the type LAUNCH_ACTIVITY.
  • S606 Determine whether the identifier of the current message is the identifier of the active component, if so, execute S607; if not, execute S611.
  • the current message is a target message of the type LAUNCH_ACTIVITY.
  • S608 Determine whether the current message intends to start the target page, if so, execute S609; if not, execute S610.
  • the intention of the current message is to start the target page such as the main page, the details page, and the live broadcast interface.
  • the intention of the current message is to launch a target page such as the main page, the details page, and the live interface, it can be determined that the message intended to launch the target page has been successfully found, so that the process startup scene of the application can be determined.
  • the process startup scene of the application is the feed scene. Further, preload or initialize the data required for the main page in the feed scene.
  • the process startup scene of the application is the details page startup scene. Further, preload or initialize the data required for the detail page.
  • the process start scene of the application is the live broadcast interface start scene. Further, preload or initialize the data required for the live broadcast interface.
  • S612 Determine whether the identifier of the current message is the identifier of the receiver component, if so, execute S610; if not, execute S613.
  • S614 Determine whether the next message is empty, if so, execute S610; if not, execute S606.
  • the target message is further filtered, so as to determine the target message.
  • the intent of the target message and according to the intent, it is determined whether the target message intends to launch a target page such as a home page, a detail page, a live broadcast interface, and the like. If the target message intends to start the target page, it can be determined that the application program is about to start the target page, and further data required by the target page is preloaded or initialized, thereby improving the performance of the application program. Post-launch content display efficiency or quality.
  • FIG. 7 is a schematic structural diagram of an application program startup control apparatus according to an embodiment of the present disclosure.
  • the application program startup control apparatus provided by the embodiment of the present disclosure may be configured in the client, or may be configured in the server, and the application program startup control apparatus 70 specifically includes:
  • an obtaining module 71 configured to obtain a message queue corresponding to the application during the application startup phase
  • a determination module 72 configured to determine the process startup scene of the application by traversing the messages in the message queue;
  • the preloading or initialization module 73 is configured to preload or initialize the data required by the process startup scenario according to the process startup scenario of the application.
  • the determining module 72 is specifically configured to:
  • a process startup scenario of the application is determined.
  • the determining module 72 is specifically configured to:
  • the type information of each message in the message queue it is determined whether the target message of the preset type is included in the message queue.
  • the determining module 72 includes a filtering unit 721, and the filtering unit 721 is configured to filter the target message when it is determined that the target message of the preset type is included in the message queue to obtain the target message. Describe the intent of the target message.
  • the filtering unit 721 is specifically used for:
  • the intent of the target message is obtained.
  • the determining module 72 is specifically configured to:
  • the determining module 72 is specifically configured to: when it is determined that the intention of the target message is to start the home page, determine that the process startup scene of the application is a multi-card aggregate display scene.
  • the preloading or initialization module 73 is specifically configured to: preload or initialize the data required by the main page according to the multi-card aggregate display scenario.
  • the determining module 72 is specifically configured to: when it is determined that the intent of the target message is to launch the details page, determine that the process startup scene of the application is the details page startup scene.
  • the preloading or initialization module 73 is specifically configured to: preload or initialize the data required by the details page according to the start-up scenario of the details page.
  • the determining module 72 is specifically configured to: when it is determined that the intent of the target message is to start the live broadcast interface, determine that the process start scene of the application is the live broadcast interface start scene.
  • the preloading or initialization module 73 is specifically configured to: preload or initialize the data required by the live broadcast interface according to the start scene of the live broadcast interface.
  • the preloading or initialization module 73 is specifically configured to: open the player in advance and establish a live channel.
  • the obtaining module 71 is specifically configured to obtain the message queue corresponding to the application program through a reflection mechanism.
  • the application startup control device provided by the embodiment of the present disclosure can execute the steps performed by the client or the server in the application startup control method provided by the method embodiment of the present disclosure, and the execution steps and beneficial effects are not repeated here.
  • FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure. Referring specifically to FIG. 8 below, it shows a schematic structural diagram of an electronic device 800 suitable for implementing an embodiment of the present disclosure.
  • the electronic device 800 in the embodiment of the present disclosure may include, but is not limited to, such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal ( Mobile terminals such as in-vehicle navigation terminals), wearable electronic devices, etc., and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
  • the electronic device shown in FIG. 8 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 800 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 801 that may be loaded into random access according to a program stored in a read only memory (ROM) 802 or from a storage device 808
  • a program in the memory (RAM) 803 executes various appropriate actions and processes to implement the application startup control method as an embodiment of the present disclosure.
  • RAM 803 various programs and data required for the operation of the electronic device 800 are also stored.
  • the processing device 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804.
  • An input/output (I/O) interface 805 is also connected to bus 804 .
  • I/O interface 805 input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 807 of a computer, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809.
  • Communication means 809 may allow electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 8 shows an electronic device 800 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flowchart, thereby achieving the above The application program startup control method.
  • the computer program may be downloaded and installed from the network via the communication device 809, or from the storage device 808, or from the ROM 802.
  • the processing device 801 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
  • the client and server can use any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) to communicate, and can communicate with digital data in any form or medium Communication (eg, a communication network) interconnects.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device:
  • the electronic device may also perform other steps described in the above embodiments.
  • Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs Systems on Chips
  • CPLDs Complex Programmable Logical Devices
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the present disclosure provides an application startup control method, including:
  • the process startup scene of the application program is determined, including: :
  • a process startup scenario of the application is determined.
  • the determining whether the message queue includes a target message of a preset type includes:
  • the type information of each message in the message queue it is determined whether the target message of the preset type is included in the message queue.
  • the intent of the target message is determined ,include:
  • the target message is filtered to obtain the intent of the target message.
  • the filtering of the target message to obtain the intent of the target message includes:
  • the intent of the target message is obtained.
  • the determining whether the message queue includes a target message of a preset type includes:
  • the determining the process startup scenario of the application according to the intent of the target message includes:
  • the process startup scene of the application is a multi-card aggregation display scene.
  • preloading or initializing the data required for the process startup scenario includes: :
  • data required for the main page is preloaded or initialized.
  • the determining the process startup scenario of the application according to the intent of the target message includes:
  • the process startup scene of the application is determined to be the details page startup scene.
  • preloading or initializing the data required for the process startup scenario includes: :
  • the determining the process startup scenario of the application according to the intent of the target message includes:
  • preloading or initializing the data required for the process startup scenario includes: :
  • Data required for the live broadcast interface is preloaded or initialized according to the start scene of the live broadcast interface.
  • the data required for preloading or initializing the live interface includes:
  • the acquiring the message queue corresponding to the application includes:
  • the message queue corresponding to the application is obtained through the reflection mechanism.
  • an application startup control device including:
  • an acquisition module used for acquiring the message queue corresponding to the application in the application startup phase
  • a determining module configured to determine the process startup scene of the application by traversing the messages in the message queue
  • a preloading or initializing module is configured to preload or initialize the data required by the process starting scene according to the process starting scene of the application program.
  • the determining module is specifically configured to:
  • a process startup scenario of the application is determined.
  • the determining module is specifically configured to:
  • the type information of each message in the message queue it is determined whether the target message of the preset type is included in the message queue.
  • the determination module includes a filtering unit, and the filtering unit is configured to determine that the message queue includes the target message of the preset type , filter the target message to obtain the intent of the target message.
  • the filtering unit is specifically configured to:
  • the intent of the target message is obtained.
  • the determining module is specifically configured to:
  • the determining module is specifically configured to:
  • the process startup scene of the application is a multi-card aggregation display scene.
  • the preloading or initialization module is specifically used for:
  • data required for the main page is preloaded or initialized.
  • the determining module is specifically configured to:
  • the process startup scene of the application is determined to be the details page startup scene.
  • the preloading or initialization module is specifically used for:
  • the determining module is specifically configured to:
  • the preloading or initialization module is specifically used for:
  • Data required for the live broadcast interface is preloaded or initialized according to the start scene of the live broadcast interface.
  • the preloading or initialization module is specifically used for: opening the player in advance and establishing a live channel.
  • the obtaining module is specifically configured to: obtain the message queue corresponding to the application program through a reflection mechanism.
  • the present disclosure provides an electronic device, comprising:
  • processors one or more processors
  • memory for storing one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the application program startup control method as provided in any one of the present disclosure.
  • the present disclosure provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements any of the application programs provided in the present disclosure Start the control method.
  • the present disclosure provides a computer program product comprising a computer program carried on a computer-readable medium, which, when executed by a processor, causes The processor implements any one of the application startup control methods provided in the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本公开实施例公开了一种应用程序启动控制方法、装置、电子设备和存储介质。本公开通过在应用程序启动阶段,获取该应用程序对应的消息队列,并对该消息队列中的消息进行遍历,从而确定出该应用程序的进程启动场景。进一步,根据进程启动场景可以确定出应用程序即将要启动的窗口或页面,并预加载或初始化该窗口或页面所需的数据,从而可以暂时屏蔽或延迟加载其他窗口或其他页面所需的数据,并专注完成即将要启动的窗口或页面的初始化任务,从而提高了应用程序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。

Description

应用程序启动控制方法、装置、电子设备和存储介质
本申请要求于2021年01月07日提交中国专利局、申请号为202110019614.4、申请名称为“应用程序启动控制方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及信息技术领域,尤其涉及一种应用程序启动控制方法、装置、电子设备和存储介质。
背景技术
随着信息技术的不断发展,终端已经成为人们生活中不可或缺的工具。例如,用户可以在终端中安装各种不同的应用程序(Application,APP)。不同的APP可以给用户提供不同的服务功能。
通常情况下,在APP启动阶段,需要进行大量的初始化和预加载工作。例如,可以从本地数据库中读取APP所需的数据,对该数据解析后进行预加载。
但是,有些数据并不适合无条件的预加载或初始化,如果这些加载的数据不能被及时使用,可能会导致数据过期,从而影响APP后续内容的展示效率或质量。
发明内容
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开实施例提供了一种应用程序启动控制方法、装置、电子设备和存储介质,提高应用程序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。
本公开实施例提供了一种应用程序启动控制方法,包括:
在应用程序启动阶段,获取所述应用程序对应的消息队列;
通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
本公开实施例还提供了一种应用程序启动控制装置,包括:
获取模块,用于在应用程序启动阶段,获取所述应用程序对应的消息队列;
确定模块,用于通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
预加载或初始化模块,用于根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
本公开实施例还提供了一种电子设备,所述电子设备包括:
一个或多个处理器;
存储装置,用于存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上所述的应用程序启动控制方法。
本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上所述的应用程序启动控制方法。
本公开实施例还提供了一种计算机程序产品,所述计算机程序产品包括承载在计算机 可读介质上的计算机程序,当所述计算机程序被处理器执行时,使得处理器实现如上所述的应用程序启动控制方法。
本公开实施例提供的技术方案与现有技术相比至少具有如下优点:本公开实施例提供的应用程序启动控制方法,通过在应用程序启动阶段,获取该应用程序对应的消息队列,并对该消息队列中的消息进行遍历,从而确定出该应用程序的进程启动场景。进一步,根据进程启动场景可以确定出应用程序即将要启动的窗口或页面,并预加载或初始化该窗口或页面所需的数据,从而可以暂时屏蔽或延迟加载其他窗口或其他页面所需的数据,并专注完成即将要启动的窗口或页面的初始化任务,从而提高了应用程序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为本公开实施例中的一种应用程序启动控制方法的流程图;
图2为本公开实施例中的一种应用场景的示意图;
图3为本公开实施例中的一种APP启动阶段的示意图;
图4为本公开实施例中的另一种应用程序启动控制方法的流程图;
图5为本公开实施例中的另一种应用程序启动控制方法的流程图;
图6为本公开实施例中的另一种应用程序启动控制方法的流程图;
图7为本公开实施例中的一种应用程序启动控制装置的结构示意图;
图8为本公开实施例中的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单 元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图1为本公开实施例中的一种应用程序启动控制方法的流程图,本实施例可适用于客户端中进行应用程序启动控制的情况,该方法可以由应用程序启动控制装置执行,该装置可以采用软件和/或硬件的方式实现,该装置可配置于电子设备中,例如终端,具体包括但不限于智能手机、掌上电脑、平板电脑、带显示屏的可穿戴设备、台式机、笔记本电脑、一体机、智能家居设备等。或者,本实施例可适用于服务端中进行应用程序启动控制的情况,该方法可以由应用程序启动控制装置执行,该装置可以采用软件和/或硬件的方式实现,该装置可配置于电子设备中,例如服务器。
如图1所示,该方法具体可以包括S101-S103:
S101、在应用程序启动阶段,获取所述应用程序对应的消息队列。
如图2所示,终端21中可以安装有应用程序(Application,APP)。在APP启动阶段,可以生成消息队列。该消息队列中包括待调度的一个或多个消息。进一步,该APP中的主线程可以获取该消息队列,并依次调度该消息队列中的各消息。
在一种可能的实施方式中,获取所述应用程序对应的消息队列,包括:通过反射机制获取所述应用程序对应的消息队列。
例如,该APP中的主线程在获取该APP对应的消息队列的过程中,具体可以通过反射机制获取该APP对应的消息队列。其中,反射机制具体可以是爪哇(JAVA)反射机制。JAVA反射机制是在APP运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法,对于任意一个对象,都能够调用它的任意一个方法和属性,这种动态获取的信息以及动态调用对象的方法的功能称为JAVA语言的反射机制。在本实施例中,APP的主线程可以通过JAVA反射机制获取到该主线程的消息队列,以及该消息队列对应的实例化对象。
S102、通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景。
进一步,APP的主线程可以对该消息队列中的消息进行遍历,并在遍历的过程中,确定该APP的进程启动场景,例如,该APP的进程启动场景是否为多卡片聚合展示(Feed)场景、主页面启动场景、详情页启动场景或直播界面启动场景等。
S103、根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
在APP的主线程确定出该APP的进程启动场景的情况下,进一步可以根据该APP的进程启动场景,预加载或初始化该进程启动场景所需的数据。
本公开实施例提供的应用程序启动控制方法,通过在应用程序启动阶段,获取该应用程序对应的消息队列,并对该消息队列中的消息进行遍历,从而确定出该应用程序的进程启动场景。进一步,根据进程启动场景可以确定出应用程序即将要启动的窗口或页面,并预加载或初始化该窗口或页面所需的数据,从而可以暂时屏蔽或延迟加载其他窗口或其他页面所需的数据,并专注完成即将要启动的窗口或页面的初始化任务,从而提高了应用程 序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。
下面结合一个具体的实施例对如上所述的在APP启动阶段,消息队列的生成过程,如图3所示,该过程涉及到桌面、系统(System)、孵化器(Zygote)和应用程序。其中,桌面、系统、孵化器和应用程序分别可以由终端21中的不同进程来运行。系统可以是终端21中的操作系统。应用程序可以包括主线程(MainThread)和子线程(BinderThread)。该过程包括如下几个步骤:
S301、桌面向系统发送启动用户界面(User Interface,UI)的请求。
S302、系统向孵化器发送进程启动请求。
S303、孵化器启动进程。
S304、孵化器向应用程序的主线程发送初始化请求。
具体的,孵化器向应用程序的主线程发送的初始化请求;而且该初始化请求用于请求该主线程对孵化器启动的进程进行初始化。
S305、应用程序的主线程向系统发送通知消息。
具体的,在应用程序的主线程对该进程初始化完成之后即实例化APP进程之后,该主线程可以主动向系统发送通知消息。具体的,该主线程可以主动向系统中的系统服务(System Server),例如界面管理服务(Activity Manager Service,AMS)发送通知消息。该通知消息用于通知系统:进程创建完成、进程初始化完成。另外,该通知消息还可以通知AMS将绑定应用请求消息(Bind Application)发送给应用程序的子线程。
S306、系统向应用程序的子线程发送绑定应用请求消息。
例如,系统在接收到该通知消息的情况下,可以向应用程序的子线程发送绑定应用请求消息。具体的,该绑定应用请求消息可以是系统向应用程序的子线程发送的第一个消息。
S307、系统将该系统中的消息发送给应用程序的子线程。
例如,系统还可以将该系统中的消息发送给应用程序的子线程。该系统中的消息包括如图3所示的启动UI界面的消息、服务类消息、广播类消息中的至少一种。例如,应用程序中包括四大组件,分别是活动(Activity)组件、服务(Service)组件、接收者(Receiver)组件、提供者(Provider)组件。其中,Activity组件用于展示UI界面,如打开APP显示的各个界面。Service组件是用于满足和支持后台工作的一种组件,如后台播放音乐。Receiver组件是用来监听系统行为变化的一种组件,如监听手机亮灭屏,网络切换等状态变化。Provider组件是用来向应用内部或其他应用提供数据管理的组件,例如通讯录管理等。
具体的,应用程序在每次启动时可以启动该四大组件中的至少一个。若应用程序在本次启动时包括启动Activity组件,则在S307中,系统可以向应用程序的子线程发送启动UI界面的消息,该启动UI界面的消息中可以包括Activity组件的相关信息,例如,Activity组件的标识、参数等。若应用程序在本次启动时包括启动Service组件,则在S307中,系统可以向应用程序的子线程发送服务类消息,该服务类消息包括Service组件的相关信息,例如,Service组件的标识、参数等。同理,若应用程序在本次启动时包括启动Receiver组件,则在S307中,系统可以向应用程序的子线程发送广播类消息,该广播类消息包括Receiver组件的相关信息,例如,Receiver组件的标识、参数等。
S308、应用程序的子线程将消息放入消息队列中。
应用程序的子线程在接收到系统发送的消息之后,可以将消息封装成消息队列中的消息,并将消息顺序发送到消息队列中,等待主线程依次执行。
例如,系统向应用程序的子线程发送绑定应用请求消息之后,系统还可以向应用程序的子线程发送启动UI界面的消息、服务类消息、广播类消息。由于该绑定应用请求消息是系统向应用程序的子线程发送的第一个消息,因此,应用程序的子线程在接收到该绑定应用请求消息的情况下,可以将该绑定应用请求消息放入消息队列的第一个位置。进一步,应用程序的子线程可以将启动UI界面的消息、服务类消息、广播类消息依次放入该消息队列中。
S309、应用程序的主线程对该消息队列中的消息进行循环调度。
可以理解的是,在应用程序的子线程将该绑定应用请求消息放入消息队列第一个位置的情况下,应用程序的主线程对该消息队列进行遍历时,遍历到的第一个消息是该绑定应用请求消息。在其他一些实施例中,该绑定应用请求消息也可能不在该消息队列的第一个位置,而是在该消息队列的后面,在这种情况下,应用程序的主线程对该消息队列进行遍历时,遍历到的第一个消息可能是其他消息而不是该绑定应用请求消息。
具体的,该绑定应用请求消息可以通知应用程序实例化对应的应用。例如,该绑定应用请求消息中可以包括应用标识。在应用程序的主线程调度该绑定应用请求消息的情况下,该主线程可以将该应用标识对应的应用与该主线程在上述步骤中初始化之后的进程进行绑定。另外,该主线程还可以对该应用标识对应的应用进行实例化处理。也就是说,实例化进程和实例化应用是两个不同的过程。此外,该绑定应用请求消息中还可以包括Provider组件的相关信息,例如,Provider组件的标识、参数等。
在上述实施例的基础上,通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述应用程序的进程启动场景,包括如图4所示的S401-S403:
S401、通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包括预设类型的目标消息。
通过如图3所示的APP启动阶段的流程可知,理论上应用程序的主线程从消息队列中调度到的第一个消息是绑定应用请求消息(Bind Application),例如,BIND_APPLICATION=110。另外,在应用程序的主线程执行该绑定应用请求消息的过程中,系统中的AMS还可以通过绑定者(Binder)调用将其他待创建的组件,例如,Activity组件、Service组件、Receiver组件依次分别对应的启动UI界面的消息、服务类消息、广播类消息发送给应用程序的子线程。子线程可以将该绑定应用请求消息、启动UI界面的消息、服务类消息、广播类消息放入主线程对应的消息队列中。也就是说,主线程执行该绑定应用请求消息的过程和AMS向子线程发送启动UI界面的消息、服务类消息、广播类消息的过程可以是并发的。因此,主线程在对应用进行初始化的过程中,可以遍历该消息队列中的各消息,并在遍历的过程中确定该消息队列中是否存在预设类型的目标消息。该预设类型的目标消息可以是如上所述的启动UI界面的消息,该预设类型可以记为启动UI界面(LAUNCH_ACTIVITY)。
S402、在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的 意图。
如果该消息队列中存在LAUNCH_ACTIVITY这种类型的目标消息,则进一步对该目标消息进行过滤,从而确定该目标消息的意图,例如,确定该目标消息具体用于创建主页面(Main Activity)、详情页(Article Detail Activity)等具体页面中的哪一种。
S403、根据所述目标消息的意图,确定所述应用程序的进程启动场景。
在确定出目标消息的意图的情况下,可以根据该意图确定出应用程序的进程启动场景,例如,Feed场景、主页面启动场景、详情页启动场景或直播界面启动场景等。
本公开实施例提供的应用程序启动控制方法,通过对该应用程序对应的消息队列中的消息进行遍历,确定该消息队列中是否包括预设类型的目标消息,在该消息队列中包括该预设类型的目标消息的情况下,确定该目标消息的意图,并根据该目标消息的意图,确定该应用程序的进程启动场景。进一步,根据进程启动场景可以确定出应用程序即将要启动的窗口或页面,并预加载或初始化该窗口或页面所需的数据,从而可以暂时屏蔽或延迟加载其他窗口或其他页面所需的数据,并专注完成即将要启动的窗口或页面的初始化任务,从而提高了应用程序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。
图5为本公开实施例中的另一种应用程序启动控制方法的流程图。本实施例在上述实施例的基础上,进一步对应用程序启动控制方法进行了具体说明。相应的,如图5所示,本实施例的方法具体包括S501-S505:
S501、在应用程序启动阶段,获取所述应用程序对应的消息队列。
例如,在应用程序启动阶段,应用程序的主线程可以通过反射机制获取消息队列。
需要说明的是,S501的相关内容请参见上文S101。
S502、通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包括预设类型的目标消息。
应用程序的主线程对该消息队列中的各消息进行遍历的过程中,确定该消息队列中是否包括预设类型的目标消息。
在一种可能的实施方式中,确定所述消息队列中是否包括预设类型的目标消息,包括:根据所述消息队列中各消息的类型信息,确定所述消息队列中是否包括所述预设类型的目标消息。
具体的,该消息队列可以包括各消息的类型信息,应用程序的主线程对该消息队列中的各消息进行遍历的过程中,可以根据消息队列中各消息的类型信息,确定该消息队列中是否包括预设类型的目标消息。
在一种可能的实施方式中,确定所述消息队列中是否包括预设类型的目标消息,包括:确定所述消息队列中是否包括启动用户界面类型的目标消息。
具体的,预设类型的目标消息可以是启动用户界面类型的目标消息,例如LAUNCH_ACTIVITY这种类型的目标消息。
S503、在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图。
在一种可能的实施方式中,在确定所述消息队列中包括所述预设类型的目标消息时, 确定所述目标消息的意图,包括:在确定所述消息队列中包括所述预设类型的目标消息时,对所述目标消息进行过滤,得到所述目标消息的意图。
例如,在确定消息队列中包括LAUNCH_ACTIVITY这种类型的目标消息时,主线程还可以对该目标消息进行过滤,从而确定该目标消息的意图。
在一种可能的实施方式中,对所述目标消息进行过滤,得到所述目标消息的意图,包括:从所述目标消息中获取所述目标消息的消息对象;通过对所述消息对象进行解析,获取所述目标消息的意图。
例如,主线程可以从该目标消息中获取该目标消息的消息对象(Object),进一步,对该目标消息的消息对象进行解析,从该消息对象中获取该目标消息的意图(Intent)、以及Intent内部的组件(Component)、类名(ClassName)、动作(Action)等关键信息。
S504、根据所述目标消息的意图,确定所述应用程序的进程启动场景。
进一步,主线程可以根据该目标消息的意图、以及该意图内部的一些关键信息,确定该应用程序的进程启动场景,例如,确定该目标消息要启动的UI界面是哪一种界面。
S505、根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
在一种可能的实现方式中,根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:在确定所述目标消息的意图为启动主页面时,确定所述应用程序的进程启动场景为多卡片聚合展示场景。相应的,根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:根据所述多卡片聚合展示场景,预加载或初始化所述主页面所需的数据。
例如,当主线程确定该目标消息的意图、以及该意图内部的一些关键信息满足多卡片聚合展示(Feed)场景中主页面(Main Activity)的特征时,可以确定该应用程序的进程启动场景为Feed场景。进一步,预加载或初始化Feed场景中主页面所需的数据。
在另一种可能的实现方式中,根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:在确定所述目标消息的意图为启动详情页时,确定所述应用程序的进程启动场景为详情页启动场景。相应的,根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:根据所述详情页启动场景,预加载或初始化所述详情页所需的数据。
例如,当主线程确定该目标消息的意图、以及该意图内部的一些关键信息满足图文详情页的特征时,可以确定该应用程序的进程启动场景为详情页启动场景。进一步,预加载或初始化详情页所需的数据。
在又一种可能的实现方式中,根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:在确定所述目标消息的意图为启动直播界面时,确定所述应用程序的进程启动场景为直播界面启动场景。相应的,根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:根据所述直播界面启动场景,预加载或初始化所述直播界面所需的数据。
例如,当主线程确定该目标消息的意图、以及该意图内部的一些关键信息满足直播界面的特征时,可以确定该应用程序的进程启动场景为直播界面启动场景。进一步,预加载 或初始化直播界面所需的数据。
在一种可能的实施方式中,预加载或初始化所述直播界面所需的数据,包括:提前打开播放器并建立直播通道。可以理解的是,预加载或初始化直播界面所需的数据,并不限于提前打开播放器并建立直播通道,还可以包括其他的数据。
本公开实施例提供的应用程序启动控制方法,通过对该应用程序对应的消息队列中的消息进行遍历,确定该消息队列中预设类型的目标消息,并根据该目标消息的意图,确定该应用程序的进程启动场景。进一步,在该目标消息的意图为启动主页面时,预加载或初始化主页面所需的数据。在该目标消息的意图为启动详情页时,预加载或初始化详情页所需的数据。在该目标消息的意图为启动直播界面时,预加载或初始化直播界面的数据。相比于现有技术中的应用程序在启动阶段预加载或初始化所有窗口或页面的数据,本公开实施例通过在应用程序启动阶段先预加载或初始化即将要启动的窗口或页面的数据,使得剩余的窗口或页面的数据在应用程序启动之后再进行预加载或初始化,不仅提高了应用程序的启动效率,而且还可以提高应用程序在启动后的内容展示效率或质量,从而提高了用户体验。
通过上述实施例可知,本公开实施例可以在应用程序进程初始化的过程中,通过对系统资源的反射和解析,完成对进程启动场景的精准识别,例如,后台拉活、前台启动、以及启动哪个窗口或页面。从而进一步根据进程启动场景优先或集中完成某个场景所需的预加载或初始化任务。其中,后台拉活可以是其他应用程序触发了该应用程序的启动。前台启动可以是用户对该应用程序的图标进行操作后触发了该应用程序的启动。下面结合一个具体的实施例对该进程启动场景的识别过程进行详细的介绍。如图6所示,该过程具体可以由应用程序的主线程来执行。该过程包括如下几个步骤:
S601、调用附加基本上下文(attach base context)函数。
S602、反射获取消息队列(Message Queue)和消息队列对应的实例化对象。
S603、反射获取执行消息调度的实体类(ActivityThread.H)和该实体类对应的实例化对象。
具体的,Message Queue和ActivityThread.H分别为系统类。
在一些实施例中,应用程序的主线程通过反射机制反射获取消息队列对应的实例化对象、以及该实体类对应的实例化对象之后,还可以进一步反射获取实例化对象中的内部参数,例如,下一个消息(next)、当前消息(mMessage)等。例如,ActivityThread.H的实例化对象可以记为mH,mH可以保存在主线程或UI线程(Activity Thread)对象中,系统服务与APP进程之间的通信可以在处理器(Handler)中处理完成。其中,Handler可以理解为ActivityThread.H这种系统类的统称。
S604、反射获取消息队列中的消息。
例如,可以对消息队列中的消息进行遍历,遍历的过程可以是将消息队列中的所有消息从头到尾顺序读取,并以此判断当前遍历到的消息是否为预设类型的目标消息。另外,在遍历的过程中,还可以对消息队列进行加锁处理,从而保障线程同步。
S605、判断当前消息的类型是否为执行消息调度的实体类,若是,则执行S606;若否, 则执行S613。
在本实施例中,主线程从消息队列中获取消息后,首先判断该消息的类型是否为ActivityThread.H。在该消息的类型为ActivityThread.H的情况下,进一步判断该消息是否为预设类型的目标消息,例如是否为启动UI界面的目标消息,即LAUNCH_ACTIVITY这种类型的目标消息。
S606、判断当前消息的标识是否为活动组件的标识,若是,则执行S607;若否,则执行S611。
具体的,在当前消息的标识是否为活动组件的标识的情况下,可以确定当前消息为LAUNCH_ACTIVITY这种类型的目标消息。
S607、解析该消息的消息对象,获取意图。
S608、判断当前消息是否意图启动目标页面,若是,则执行S609;若否,则执行S610。
例如,判断当前消息的意图是否为启动主页面、详情页、直播界面等目标页面。
S609、成功找到意图启动目标页面的消息。
在当前消息的意图为启动主页面、详情页、直播界面等目标页面的情况下,可以确定已成功找到意图启动目标页面的消息,从而可以确定出应用程序的进程启动场景。
例如,在当前消息的意图为启动主页面的情况下,可以确定该应用程序的进程启动场景为Feed场景。进一步,预加载或初始化Feed场景中主页面所需的数据。
在当前消息的意图为启动详情页的情况下,可以确定该应用程序的进程启动场景为详情页启动场景。进一步,预加载或初始化详情页所需的数据。
在当前消息的意图为启动直播界面的情况下,可以确定该应用程序的进程启动场景为直播界面启动场景。进一步,预加载或初始化直播界面所需的数据。
S610、未成功找到意图启动目标页面的消息。
S611、判断当前消息的标识是否为服务组件的标识,若是,则执行S610;若否,则执行S612。
S612、判断当前消息的标识是否为接收者组件的标识,若是,则执行S610;若否,则执行S613。
S613、从消息队列中获取下一个消息。
S614、判断下一个消息是否为空,若是,则执行S610;若否,则执行S606。
本公开实施例提供的应用程序启动控制方法,通过查询消息队列中是否存在启动UI界面的目标消息,在确定存在启动UI界面的目标消息的情况下,进一步对该目标消息进行过滤,从而确定出该目标消息的意图,并根据该意图确定该目标消息是否意图启动例如主页面、详情页、直播界面等目标页面。若该目标消息意图启动该目标页面,则可以确定应用程序即将要启动该目标页面,进一步预加载或初始化该目标页面所需的数据,从而提高了应用程序的性能,例如,可以提高应用程序在启动后的内容展示效率或质量。
图7为本公开实施例中的一种应用程序启动控制装置的结构示意图。本公开实施例所提供的应用程序启动控制装置可以配置于客户端中,或者可以配置于服务端中,该应用程序启动控制装置70具体包括:
获取模块71,用于在应用程序启动阶段,获取所述应用程序对应的消息队列;
确定模块72,用于通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
预加载或初始化模块73,用于根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
在一种可能的实施方式中,确定模块72具体用于:
通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包括预设类型的目标消息;
在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图;
根据所述目标消息的意图,确定所述应用程序的进程启动场景。
在一种可能的实施方式中,确定模块72具体用于:
根据所述消息队列中各消息的类型信息,确定所述消息队列中是否包括所述预设类型的目标消息。
在一种可能的实施方式中,确定模块72包括过滤单元721,过滤单元721用于在确定所述消息队列中包括所述预设类型的目标消息时,对所述目标消息进行过滤,得到所述目标消息的意图。
在一种可能的实施方式中,过滤单元721具体用于:
从所述目标消息中获取所述目标消息的消息对象;
通过对所述消息对象进行解析,获取所述目标消息的意图。
在一种可能的实施方式中,确定模块72具体用于:
确定所述消息队列中是否包括启动用户界面类型的目标消息。
在一种可能的实施方式中,确定模块72具体用于:在确定所述目标消息的意图为启动主页面时,确定所述应用程序的进程启动场景为多卡片聚合展示场景。
在一种可能的实施方式中,预加载或初始化模块73具体用于:根据所述多卡片聚合展示场景,预加载或初始化所述主页面所需的数据。
在一种可能的实施方式中,确定模块72具体用于:在确定所述目标消息的意图为启动详情页时,确定所述应用程序的进程启动场景为详情页启动场景。
在一种可能的实施方式中,预加载或初始化模块73具体用于:根据所述详情页启动场景,预加载或初始化所述详情页所需的数据。
在一种可能的实施方式中,确定模块72具体用于:在确定所述目标消息的意图为启动直播界面时,确定所述应用程序的进程启动场景为直播界面启动场景。
在一种可能的实施方式中,预加载或初始化模块73具体用于:根据所述直播界面启动场景,预加载或初始化所述直播界面所需的数据。
在一种可能的实施方式中,预加载或初始化模块73具体用于:提前打开播放器并建立直播通道。
在一种可能的实施方式中,获取模块71具体用于:通过反射机制获取所述应用程序对应的消息队列。
本公开实施例提供的应用程序启动控制装置,可执行本公开方法实施例所提供的应用 程序启动控制方法中客户端或服务端所执行的步骤,具备执行步骤和有益效果此处不再赘述。
图8为本公开实施例中的一种电子设备的结构示意图。下面具体参考图8,其示出了适于用来实现本公开实施例中的电子设备800的结构示意图。本公开实施例中的电子设备800可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)、可穿戴电子设备等等的移动终端以及诸如数字TV、台式计算机、智能家居设备等等的固定终端。图8示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图8所示,电子设备800可以包括处理装置(例如中央处理器、图形处理器等)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储装置808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理以实现如本公开所述的实施例的应用程序启动控制方法。在RAM 803中,还存储有电子设备800操作所需的各种程序和数据。处理装置801、ROM 802以及RAM 803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。
通常,以下装置可以连接至I/O接口805:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置806;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置807;包括例如磁带、硬盘等的存储装置808;以及通信装置809。通信装置809可以允许电子设备800与其他设备进行无线或有线通信以交换数据。虽然图8示出了具有各种装置的电子设备800,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码,从而实现如上所述的应用程序启动控制方法。在这样的实施例中,该计算机程序可以通过通信装置809从网络上被下载和安装,或者从存储装置808被安装,或者从ROM 802被安装。在该计算机程序被处理装置801执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种 形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:
在应用程序启动阶段,获取所述应用程序对应的消息队列;
通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
在一种可能的实施方式中,当上述一个或者多个程序被该电子设备执行时,该电子设备还可以执行上述实施例所述的其他步骤。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,本公开提供了一种应用程序启动控制方法,包括:
在应用程序启动阶段,获取所述应用程序对应的消息队列;
通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述应用程序的进程启动场景,包括:
通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包括预设类型的目标消息;
在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图;
根据所述目标消息的意图,确定所述应用程序的进程启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述确定所述消息队列中是否包括预设类型的目标消息,包括:
根据所述消息队列中各消息的类型信息,确定所述消息队列中是否包括所述预设类型的目标消息。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图,包括:
在确定所述消息队列中包括所述预设类型的目标消息时,对所述目标消息进行过滤,得到所述目标消息的意图。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述对所述目标消息进行过滤,得到所述目标消息的意图,包括:
从所述目标消息中获取所述目标消息的消息对象;
通过对所述消息对象进行解析,获取所述目标消息的意图。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述确定所述消息队列中是否包括预设类型的目标消息,包括:
确定所述消息队列中是否包括启动用户界面类型的目标消息。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
在确定所述目标消息的意图为启动主页面时,确定所述应用程序的进程启动场景为多卡片聚合展示场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
根据所述多卡片聚合展示场景,预加载或初始化所述主页面所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
在确定所述目标消息的意图为启动详情页时,确定所述应用程序的进程启动场景为详情页启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
根据所述详情页启动场景,预加载或初始化所述详情页所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
在确定所述目标消息的意图为启动直播界面时,确定所述应用程序的进程启动场景为直播界面启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
根据所述直播界面启动场景,预加载或初始化所述直播界面所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述预加载或初始化所述直播界面所需的数据,包括:
提前打开播放器并建立直播通道。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制方法中,所述获取所述应用程序对应的消息队列,包括:
通过反射机制获取所述应用程序对应的消息队列。
根据本公开的一个或多个实施例,本公开提供了一种应用程序启动控制装置,包括:
获取模块,用于在应用程序启动阶段,获取所述应用程序对应的消息队列;
确定模块,用于通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
预加载或初始化模块,用于根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包 括预设类型的目标消息;
在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图;
根据所述目标消息的意图,确定所述应用程序的进程启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
根据所述消息队列中各消息的类型信息,确定所述消息队列中是否包括所述预设类型的目标消息。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块包括过滤单元,过滤单元用于在确定所述消息队列中包括所述预设类型的目标消息时,对所述目标消息进行过滤,得到所述目标消息的意图。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,过滤单元具体用于:
从所述目标消息中获取所述目标消息的消息对象;
通过对所述消息对象进行解析,获取所述目标消息的意图。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
确定所述消息队列中是否包括启动用户界面类型的目标消息。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
在确定所述目标消息的意图为启动主页面时,确定所述应用程序的进程启动场景为多卡片聚合展示场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,预加载或初始化模块具体用于:
根据所述多卡片聚合展示场景,预加载或初始化所述主页面所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
在确定所述目标消息的意图为启动详情页时,确定所述应用程序的进程启动场景为详情页启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,预加载或初始化模块具体用于:
根据所述详情页启动场景,预加载或初始化所述详情页所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,确定模块具体用于:
在确定所述目标消息的意图为启动直播界面时,确定所述应用程序的进程启动场景为直播界面启动场景。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,预加载或初始化模块具体用于:
根据所述直播界面启动场景,预加载或初始化所述直播界面所需的数据。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,预加载或初始化模块具体用于:提前打开播放器并建立直播通道。
根据本公开的一个或多个实施例,在本公开提供的应用程序启动控制装置中,获取模块具体用于:通过反射机制获取所述应用程序对应的消息队列。
根据本公开的一个或多个实施例,本公开提供了一种电子设备,包括:
一个或多个处理器;
存储器,用于存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本公开提供的任一所述的应用程序启动控制方法。
根据本公开的一个或多个实施例,本公开提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本公开提供的任一所述的应用程序启动控制方法。
根据本公开的一个或多个实施例,本公开提供了一种计算机程序产品,所述计算机程序产品包括承载在计算机可读介质上的计算机程序,当所述计算机程序被处理器执行时,使得处理器实现如本公开提供的任一所述的应用程序启动控制方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (18)

  1. 一种应用程序启动控制方法,其特征在于,所述方法包括:
    在应用程序启动阶段,获取所述应用程序对应的消息队列;
    通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
    根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
  2. 根据权利要求1所述的方法,其特征在于,所述通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述应用程序的进程启动场景,包括:
    通过对所述应用程序对应的消息队列中的消息进行遍历,确定所述消息队列中是否包括预设类型的目标消息;
    在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图;
    根据所述目标消息的意图,确定所述应用程序的进程启动场景。
  3. 根据权利要求2所述的方法,其特征在于,所述确定所述消息队列中是否包括预设类型的目标消息,包括:
    根据所述消息队列中各消息的类型信息,确定所述消息队列中是否包括所述预设类型的目标消息。
  4. 根据权利要求2所述的方法,其特征在于,所述在确定所述消息队列中包括所述预设类型的目标消息时,确定所述目标消息的意图,包括:
    在确定所述消息队列中包括所述预设类型的目标消息时,对所述目标消息进行过滤,得到所述目标消息的意图。
  5. 根据权利要求4所述的方法,其特征在于,所述对所述目标消息进行过滤,得到所述目标消息的意图,包括:
    从所述目标消息中获取所述目标消息的消息对象;
    通过对所述消息对象进行解析,获取所述目标消息的意图。
  6. 根据权利要求2或3所述的方法,其特征在于,所述确定所述消息队列中是否包括预设类型的目标消息,包括:
    确定所述消息队列中是否包括启动用户界面类型的目标消息。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
    在确定所述目标消息的意图为启动主页面时,确定所述应用程序的进程启动场景为多卡片聚合展示场景。
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
    根据所述多卡片聚合展示场景,预加载或初始化所述主页面所需的数据。
  9. 根据权利要求6所述的方法,其特征在于,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
    在确定所述目标消息的意图为启动详情页时,确定所述应用程序的进程启动场景 为详情页启动场景。
  10. 根据权利要求9所述的方法,其特征在于,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
    根据所述详情页启动场景,预加载或初始化所述详情页所需的数据。
  11. 根据权利要求6所述的方法,其特征在于,所述根据所述目标消息的意图,确定所述应用程序的进程启动场景,包括:
    在确定所述目标消息的意图为启动直播界面时,确定所述应用程序的进程启动场景为直播界面启动场景。
  12. 根据权利要求11所述的方法,其特征在于,所述根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据,包括:
    根据所述直播界面启动场景,预加载或初始化所述直播界面所需的数据。
  13. 根据权利要求12所述的方法,其特征在于,所述预加载或初始化所述直播界面所需的数据,包括:
    提前打开播放器并建立直播通道。
  14. 根据权利要求1所述的方法,其特征在于,所述获取所述应用程序对应的消息队列,包括:
    通过反射机制获取所述应用程序对应的消息队列。
  15. 一种应用程序启动控制装置,其特征在于,包括:
    获取模块,用于在应用程序启动阶段,获取所述应用程序对应的消息队列;
    确定模块,用于通过对所述消息队列中的消息进行遍历,确定所述应用程序的进程启动场景;
    预加载或初始化模块,用于根据所述应用程序的进程启动场景,预加载或初始化所述进程启动场景所需的数据。
  16. 一种电子设备,其特征在于,所述电子设备包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-14中任一项所述的方法。
  17. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-14中任一项所述的方法。
  18. 一种计算机程序产品,其特征在于,所述计算机程序产品包括承载在计算机可读介质上的计算机程序,当所述计算机程序被处理器执行时,使得处理器实现如权利要求1-14中任一项所述的方法。
PCT/CN2021/139551 2021-01-07 2021-12-20 应用程序启动控制方法、装置、电子设备和存储介质 Ceased WO2022148231A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110019614.4 2021-01-07
CN202110019614.4A CN112685104A (zh) 2021-01-07 2021-01-07 应用程序启动控制方法、装置、电子设备和存储介质

Publications (1)

Publication Number Publication Date
WO2022148231A1 true WO2022148231A1 (zh) 2022-07-14

Family

ID=75456304

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/139551 Ceased WO2022148231A1 (zh) 2021-01-07 2021-12-20 应用程序启动控制方法、装置、电子设备和存储介质

Country Status (2)

Country Link
CN (1) CN112685104A (zh)
WO (1) WO2022148231A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112685104A (zh) * 2021-01-07 2021-04-20 北京字节跳动网络技术有限公司 应用程序启动控制方法、装置、电子设备和存储介质
CN113867838A (zh) * 2021-09-26 2021-12-31 掌阅科技股份有限公司 应用程序的启动方法、电子设备及计算机存储介质
CN116257197A (zh) * 2021-12-10 2023-06-13 北京字节跳动网络技术有限公司 屏幕显示状态的控制方法、设备及程序产品

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647055A (zh) * 2018-05-10 2018-10-12 Oppo广东移动通信有限公司 应用程序预加载方法、装置、存储介质及终端
CN110162418A (zh) * 2019-05-30 2019-08-23 努比亚技术有限公司 应用冷启动方法、移动终端及计算机可读存储介质
CN110673887A (zh) * 2019-08-15 2020-01-10 华为技术有限公司 应用程序启动方法、装置、终端设备及可读存储介质
CN111240769A (zh) * 2020-01-02 2020-06-05 广州虎牙科技有限公司 页面启动方法、装置、设备及存储介质
CN112685104A (zh) * 2021-01-07 2021-04-20 北京字节跳动网络技术有限公司 应用程序启动控制方法、装置、电子设备和存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108681475B (zh) * 2018-05-21 2021-11-26 Oppo广东移动通信有限公司 应用程序预加载方法、装置、存储介质及移动终端
CN108920211A (zh) * 2018-06-28 2018-11-30 广州视源电子科技股份有限公司 Launcher应用程序的启动方法及装置、电子设备、存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647055A (zh) * 2018-05-10 2018-10-12 Oppo广东移动通信有限公司 应用程序预加载方法、装置、存储介质及终端
CN110162418A (zh) * 2019-05-30 2019-08-23 努比亚技术有限公司 应用冷启动方法、移动终端及计算机可读存储介质
CN110673887A (zh) * 2019-08-15 2020-01-10 华为技术有限公司 应用程序启动方法、装置、终端设备及可读存储介质
CN111240769A (zh) * 2020-01-02 2020-06-05 广州虎牙科技有限公司 页面启动方法、装置、设备及存储介质
CN112685104A (zh) * 2021-01-07 2021-04-20 北京字节跳动网络技术有限公司 应用程序启动控制方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN112685104A (zh) 2021-04-20

Similar Documents

Publication Publication Date Title
WO2022237744A1 (zh) 视频的展示方法、装置、设备及介质
WO2022148231A1 (zh) 应用程序启动控制方法、装置、电子设备和存储介质
WO2022247693A1 (zh) 任务迁移的系统及方法
US11758087B2 (en) Multimedia conference data processing method and apparatus, and electronic device
WO2015176352A1 (zh) 一种基于安卓系统的应用间信息交互方法及装置
US20260030810A1 (en) Image processing method and apparatus, device, and storage medium
EP4668769A1 (en) Media content sending method and apparatus, device, and storage medium
WO2023124767A1 (zh) 一种基于文档共享的提示方法、装置、设备及介质
WO2023030224A1 (zh) 一种信息展示方法、装置、电子设备和存储介质
WO2025108440A1 (zh) 直播交互方法、装置、设备、介质及程序产品
CN112784199A (zh) 事件流程处理方法、设备、存储介质及程序产品
US20230379279A1 (en) Interaction method and apparatus, and electronic device
CN117492615A (zh) 信息展示方法、装置、电子设备和存储介质
CN113518183B (zh) 摄像头调用方法、装置和电子设备
CN114691273A (zh) 用户界面返回方法、装置、电子设备和存储介质
CN114489891A (zh) 云应用程序的控制方法、系统、装置、可读介质和设备
US20240104671A1 (en) Method and apparatus for group management, electronic device, and storage medium
WO2023231851A1 (zh) 信息处理方法、装置和电子设备
CN113163154B (zh) 信息处理方法、装置和电子设备
CN117631899A (zh) 信息展示方法、装置、设备及存储介质
CN112799822B (zh) 一种程序启动方法、装置、设备及介质
WO2022228405A1 (zh) 信息交互方法、装置和电子设备
CN112822328A (zh) 数据展示方法、装置和电子设备
CN114363449A (zh) 业务状态的切换方法、装置、电子设备和存储介质
CN111367590A (zh) 中断事件处理方法及其装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21917271

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 201023)

122 Ep: pct application non-entry in european phase

Ref document number: 21917271

Country of ref document: EP

Kind code of ref document: A1