Cold start method and device of application program, electronic equipment, storage medium and program product
Patent Information
- Application Number
- CN202510482142.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2026-10-23
AI Technical Summary
然而,相关技术中,应用程序冷启动时首界面中主体内容的加载速度较慢,无法满足用户打开应用程序后迅速看到首界面的主体内容的需求
[0016]本公开实施例提供的应用程序的冷启动方法、装置、电子设备、存储介质和程序产品,可以在应用程序的冷启动过程中,预先通过为首界面创建的临时界面图层显示首界面的主体内容,无需等待第二界面内容加载完成或应用程序冷启动完成,能够提高应用程序冷启动时首界面中主体内容的加载速度,满足用户打开应用程序后迅速看到首界面的主体内容的需求。
Smart Images

Figure CN122963645A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to a method, apparatus, electronic device, storage medium, and program product for cold starting an application. Background Technology
[0002] Improving the loading speed of the main content displayed on the home screen during application cold starts is a key research direction. However, current technologies often result in slow loading speeds for the main content on the home screen during application cold starts, failing to meet users' needs for quickly viewing the main content after opening the application. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, storage medium, and program product for cold starting an application, so as to improve the loading speed of the main content of the first interface when the application is cold started, and meet the user's need to quickly see the main content of the first interface after opening the application.
[0004] In a first aspect, embodiments of this disclosure provide a cold start method for an application, comprising:
[0005] During the cold start process of the application, the first interface content of the preset interface is displayed on the first interface layer of the preset interface, and the second interface content of the preset interface is loaded. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0006] In response to the completion of loading of the second interface content, the second interface content is added to the preset interface for display.
[0007] Secondly, embodiments of this disclosure also provide a cold start device for an application, comprising:
[0008] The first interface content display module is used to display the first interface content of the preset interface on the first interface layer of the preset interface during the cold start process of the application, and to load the second interface content of the preset interface. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0009] The second interface content display module is used to add the second interface content to the preset interface in response to the completion of the second interface content loading.
[0010] Thirdly, embodiments of this disclosure also provide an electronic device, including:
[0011] One or more processors;
[0012] Memory, used to store one or more programs.
[0013] When the one or more programs are executed by the one or more processors, the one or more processors implement the cold start method for the application as described in the embodiments of this disclosure.
[0014] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the cold start method for an application as described in embodiments of this disclosure.
[0015] Fifthly, embodiments of this disclosure also provide a computer program product that, when executed by a computer, enables the computer to implement the cold start method for the application program as described in embodiments of this disclosure.
[0016] The cold start method, apparatus, electronic device, storage medium, and program product for applications provided in this disclosure can display the main content of the first interface in advance through a temporary interface layer created for the first interface during the application's cold start process, without waiting for the second interface content to finish loading or for the application to finish cold start. This can improve the loading speed of the main content of the first interface during application cold start and meet the user's need to quickly see the main content of the first interface after opening the application. Attached Figure Description
[0017] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0018] Figure 1 A flowchart illustrating a cold start method for an application provided in this embodiment of the disclosure;
[0019] Figure 2 A flowchart illustrating another cold start method for an application provided in this embodiment of the disclosure;
[0020] Figure 3 A structural block diagram of a cold start device for an application provided in this disclosure embodiment;
[0021] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0022] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0023] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0024] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.
[0025] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0026] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0027] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0028] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0029] Figure 1 This is a flowchart illustrating a method for cold-starting an application according to an embodiment of the present disclosure. The method can be executed by an application cold-start device, which can be implemented in software and / or hardware and can be configured in an electronic device, typically a computer, mobile phone, or tablet computer. The application cold-start method provided in this disclosure is applicable to application cold-start scenarios, such as displaying the main content of the home screen during an application cold start.
[0030] In the cold start scenario of mobile applications, improving the loading speed of the first screen content and optimizing the user experience is a key research direction. Taking short video applications as an example, users generally expect to see the first video content on the homepage quickly after opening the application.
[0031] However, in existing cold start processes, video content can be loaded and played after the homepage's user interface (UI) framework has finished rendering. Therefore, during a cold start, users see the static UI first, followed by the video content. This noticeable delay directly impacts the user experience and the product's appeal.
[0032] Currently, the cold start process may include the following steps: splash screen, homepage framework loading, and video data rendering. However, since video playback depends on the loading of video data and the rendering of the UI, video playback can only begin after these steps are completed. The playback order lags behind the rendering of UI components, resulting in a perceived startup delay for the user.
[0033] In related technologies, the basic techniques for cold start optimization include two directions: UI rendering optimization and video playback acceleration. UI rendering optimization generally improves the rendering speed of homepage UI components by reducing layout complexity and rendering overhead. For example, it can reduce layout complexity, such as optimizing the layout structure and reducing view levels, thereby shortening the time spent on measurement, layout, and / or drawing; or it can asynchronously render critical content, such as using lazy loading technology to postpone the loading of non-critical content until after the first screen rendering, prioritizing the display of critical content, thus shortening the user's perceived loading time. Video playback acceleration can generally be achieved through video preloading, such as requesting and buffering video resources in advance when loading homepage data, prioritizing the loading of the first frame of the video to ensure that the video content is visible as soon as possible; or it can be achieved by rendering surface views independently, such as utilizing the independent thread rendering feature of Surface Views to separate video rendering tasks from the main thread, enabling parallel processing of video playback and UI rendering, effectively reducing dependence on the main thread, and further improving the experience during the cold start phase.
[0034] These basic optimization paths provide technical support for optimizing the cold start experience. Although existing technical solutions have improved video playback speed to some extent, there is still a problem of playback timing lag, which causes users to have to wait extra and cannot see the video content quickly, affecting the intuitive experience.
[0035] In view of this, the present invention proposes a novel cold start method for applications, which solves the problem of delayed playback of the first video in related technologies by creating a temporary interface layer for the homepage.
[0036] like Figure 1 As shown, the cold start method for an application provided in this embodiment may include:
[0037] S101. During the cold start process of the application, the first interface content of the preset interface is displayed on the first interface layer of the preset interface, and the second interface content of the preset interface is loaded. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0038] The preset interface can be the initial interface displayed after the application's cold start, such as the application's main interface. The first interface layer can be a temporary interface layer created for the preset interface, which can be used to temporarily display the first interface content of the preset interface during the application's cold start process. The presentation format of the first interface layer is not limited. The first interface content is at least a portion of the main content of the preset interface that will be displayed after the cold start, such as the key main content to be displayed on the preset interface. The type of the first interface content is not limited; for example, the first interface content can be media content, such as video content and / or graphic content; it can also be other types of interface content. The second interface content can be understood as other interface content in the preset interface besides the first interface content. The second interface content can include non-main content of the preset interface, and can further include other main content in the preset interface besides the first interface content. For example, the second interface content can include, but is not limited to, at least some interactive controls in the preset interface. The main content of the preset interface can be understood as the content in the interface that can provide main information and services based on user needs, such as the core content of the preset interface.
[0039] Specifically, upon receiving a cold start command from the application, a cold start can be performed on the application. During the application's cold start process, at least a portion of the main content of the preset interface (i.e., the first interface content) can be displayed on the first interface layer of the preset interface, and other interface content (i.e., the second interface content) other than this at least portion of the main content in the preset interface can be loaded.
[0040] The application's cold start command can be a command used to instruct the application to perform a cold start. An application cold start refers to the process of launching an application when no process of the application exists in the background, such as the process of restarting an application after it has been completely closed. The application's cold start command can be generated based on the user's cold start action on the application, such as when the user triggers the application's program ID; it can also be automatically generated when the application's preset cold start conditions are met, or sent by a device other than the electronic device on which the application is installed, and so on.
[0041] The method of displaying the first interface content in the first interface layer is not limited. For example, the content data of the first interface content can be pre-cached. For instance, during each run of the application, such as before each application is closed, the content data of the first interface content to be displayed after the next cold start can be pre-cached. Thus, during the application's cold start process, the content data of the first interface content cached in the previous run and to be displayed after this cold start can be obtained, and the content data of the preset interface can be rendered and displayed in the first interface layer of the preset interface based on this content data.
[0042] Taking the preset interface as the media content display interface as an example, during the cold start process of the application, the media content data of one or more media contents to be displayed on the preset interface that were cached during the previous run can be obtained, and the media content can be displayed on the first interface layer of the preset interface based on this media content data.
[0043] The loading method for the second interface content can be set as needed. For example, a layout file of a preset interface can be obtained, and a UI component fragment of the preset interface can be added based on this layout file, thereby loading the content of the second interface.
[0044] S102. In response to the completion of loading the content of the second interface, the content of the second interface is added to the preset interface.
[0045] In this embodiment, after the second interface content is loaded, the first interface content of the preset interface can be displayed on the first interface layer of the preset interface, and the loaded second interface content can be added to the preset interface, such as displaying the loaded second interface content on the upper layer of the first interface layer, etc. This achieves the effect that the first interface content of the application is displayed before the second interface content of the application, reducing the user's waiting time.
[0046] The cold start method for an application provided in this embodiment displays the first interface content of a preset interface on a first interface layer of a preset interface during the application's cold start process, and loads the second interface content of the preset interface. This preset interface is the first interface after the application's cold start, and the first interface content is the main content of the preset interface. In response to the completion of the loading of the second interface content, this second interface content is added and displayed on the preset interface. This embodiment, utilizing the above technical solution, can pre-display the main content of the first interface through a temporary interface layer created for the first interface during the application's cold start process, without waiting for the second interface content to finish loading or for the application's cold start to complete. This improves the loading speed of the main content of the first interface during application cold start, meeting the user's need to quickly see the main content of the first interface after opening the application.
[0047] In some embodiments, displaying the first interface content of the preset interface on the first interface layer of the preset interface includes: creating a first surface view of the preset interface in response to a call to the main activity creation method of the preset interface; and displaying the first interface content of the preset interface on the first interface layer of the first surface view in response to the completion of the creation of the first surface view.
[0048] The method for creating the main activity of the preset interface is the `onCreate` method of the main activity of the preset interface. The `onCreate` method is the core method of the Activity lifecycle, responsible for initializing the Activity's UI and logic. The first surface view can be a temporary surface view created for the preset interface during the application's cold start process, such as a snapshot surface view. The first surface view supports displaying the first interface content of the preset interface during the application's cold start process. The first interface layer can be the interface layer corresponding to the first surface view.
[0049] For example, when the main activity creation method of the preset interface is detected to be called, a first surface view of the preset interface can be created in response to the call to the main activity creation method of the preset interface, such as creating a snapshot Surface View at the bottom layer of the preset interface as the first surface view of the preset interface; and, in response to the completion of the creation of the first surface view, such as in response to the availability of the surface of the first surface view, the first interface content of the preset interface is displayed in the first interface layer of the first surface view.
[0050] In this embodiment, when the onCreate method of the Main Activity is called, a snapshot Surface View is directly added to the Main Activity to load and display the first interface content, such as playing the first video content. That is to say, the application cold starts by adding a snapshot Surface View for playback, instead of immediately loading components (Fragments) that originally contain complex logic (such as the second interface content). This allows the Surface View's onSurfaceAvailable callback to be triggered earlier, thereby speeding up the video playback startup time and significantly shortening the time it takes for the user to see the first frame of the video.
[0051] Within the relevant technical framework, taking video playback as an example, the video playback process has significant drawbacks. Typically, video playback initiation heavily relies on the complete rendering of the main UI components. This results in users often experiencing a considerable wait time before seeing the first frame of the video during the application's cold start phase. This delay significantly degrades the user experience upon application launch. To address this issue, this embodiment employs an innovative cold start method. During the cold start phase, a lightweight snapshot Surface View is loaded first. This Surface View has the ability to independently render video frames, enabling parallel processing of video playback and main UI component rendering. Therefore, users can see the video frame before the main interface is fully loaded. This approach significantly shortens the user's waiting time during the cold start phase, greatly improving the immediacy and smoothness of the user experience.
[0052] In some embodiments, loading the second interface content of the preset interface includes: in response to the completion of the creation of the first surface view, controlling the focus to be focused on the first surface view, and calling the focus change callback method of the preset interface; in response to the call to the focus change callback method, loading the second interface content of the preset interface.
[0053] For example, after the first surface view is created, the focus can be controlled to be focused on this created first surface view. In this case, because the object focused on by the preset interface has changed, the call to the preset interface's focus change callback method (on Window Focus Changed) will be triggered; and in response to the call to the focus change callback method, the second interface content of the preset interface can be loaded, such as loading the preset interface's component (Fragment). The focus change callback method can be called when the application's focus changes.
[0054] In this embodiment, the loading of complex logic Fragments can be delayed. For example, the original complex logic homepage Fragment (such as the main page of the recommendation stream) can be delayed until the on Window Focus Changed callback. Taking the video content as an example, this delayed loading strategy can avoid the interference of the complex initialization logic of the preset interface Fragment on the timing of video playback, so that the video playback and the main interface loading are logically decoupled.
[0055] In some implementations, the second interface content of the preset interface can be displayed on top of the first interface layer. For example, when a focus change callback method is detected to be called, a second interface layer can be created on top of the first interface layer, and the second interface content of the preset interface can be displayed on this second interface layer. Thus, the user can view the second interface content or perform corresponding interactive operations based on the second interface content while viewing the first interface content displayed in the first interface layer of the preset interface. Optionally, in this case, the application's cold start method may further include: creating the second interface layer of the preset interface in response to the call to the focus change callback method; adding the display of the second interface content to the preset interface includes: displaying the second interface content on the second interface layer, wherein the second interface layer is located on top of the first interface layer. The second interface layer may include, but is not limited to, the layer originally used by the preset interface to display UI components.
[0056] In some implementations, considering that the snapshot Surface View used during the application's cold start phase lacks effective support for common user gestures (such as swiping, zooming, and dragging), the interaction logic between the user and the application during the cold start phase may be inconsistent with the interaction logic after the main interface is fully loaded. This inconsistency can cause confusion and discomfort for users during application operation, severely impacting the user experience. Therefore, interactive gesture processing logic can be configured for the first surface view, such as interactive gesture processing logic based on the second surface view. Registering interactive gesture processing logic for the first surface view ensures that the interactive behavior (such as swiping and zooming) of the first surface view (e.g., the snapshot Surface View) remains highly consistent with that of the second surface view (i.e., the actual Surface View). Regardless of whether the user operates during the cold start phase or after the main interface has fully loaded, the same interactive gestures can trigger the same interaction, reducing the difficulty of user interaction. Optionally, after loading the second interface content of the preset interface, the method further includes configuring interactive gesture processing logic for the first surface view. The interactive gesture processing logic can be understood as the process and handling method for recognizing and processing user gestures (such as clicking, swiping, long-pressing, and zooming) within the application. The interaction gesture processing logic of the default interface of different applications may be the same or different.
[0057] In some implementations, the first interface layer can be located at the bottom layer of the preset interface. In this case, to ensure that the content of the first interface is properly displayed during the display of other interface layers, the opaque layer superimposed on the first interface layer can be processed to ensure that it remains transparent, while maintaining the normal display of the content of the first interface in the first interface layer. Taking the interface background layer of the preset interface as an example, since the interface background layer is generally displayed as opaque by default, to avoid the display of the interface background layer obscuring the content of the first interface in the first interface layer, after the interface background layer of the preset interface is created, this interface background layer can be adjusted from opaque to transparent, and then this background interface layer adjusted to transparent can be added to the corresponding position, such as adding it between the first interface layer and the second interface layer. In this case, optionally, after loading the second interface content of the preset interface, the method further includes: creating a fourth interface layer of the preset interface and adjusting the fourth interface layer to transparent, wherein the fourth interface layer is located above the first interface layer, and the fourth interface layer is used to display the interface background of the preset interface. The fourth interface layer can be the background layer of the preset interface, and the fourth interface layer can be displayed on top of the first interface layer.
[0058] In some implementations, upon receiving a preset trigger operation instructing the release of the first surface view, the fourth interface layer can be restored to its original display style, such as restoring the fourth interface layer from a transparent state to its original opaque state, to further improve the display effect of the preset interface. Optionally, in this case, the application's cold start method may further include: adjusting the fourth interface layer from a transparent state to an opaque state in response to a preset trigger operation acting within the preset interface.
[0059] Figure 2 This is a flowchart illustrating another cold start method for an application provided in this embodiment. The solution in this embodiment can be combined with one or more optional solutions in the above embodiments. Optionally, the first interface content is preset media content to be played on the preset interface, and displaying the first interface content of the preset interface on the first interface layer of the first surface view includes: creating a media content playback instance corresponding to the first surface view; and playing the first interface content of the preset interface on the first interface layer of the first surface view through the media content playback instance.
[0060] Correspondingly, such as Figure 2 As shown, the cold start method for an application provided in this embodiment may include:
[0061] S201. During the cold start process of the application, in response to the call to the main activity creation method of the preset interface, a first surface view of the preset interface is created.
[0062] S202. In response to the completion of the creation of the first surface view, a media content playback instance corresponding to the first surface view is created, and the second interface content of the preset interface is loaded. The preset interface is the first interface after the application is cold-started, and the first interface content is the preset media content to be played on the preset interface.
[0063] The preset media content can be understood as media content that supports playback in the first surface view, such as pre-cached media content. Taking the preset interface supporting switching playback of different media content based on the media content stream as an example, the preset media content can be located in the media content stream of the preset interface, such as before non-preset media content in the media content stream. The number of preset media content can be one or more, such as including but not limited to the first media content to be played in the preset interface, which can be set as needed. A media content playback instance refers to the specific implementation of the playback function. This media content playback instance can be used to play preset media content in the first interface layer.
[0064] Specifically, when the creation of the first surface view is detected to be complete, such as when the surface of the first surface view becomes available, a media content playback instance corresponding to the first surface view can be created to facilitate subsequent media content playback based on this media content playback instance; and the loading of the second interface content of the preset interface can be triggered.
[0065] It should be noted that after creating a media content playback instance corresponding to the first surface view, a flag corresponding to the first surface view can be added to this media content playback instance to indicate that it is a media content playback instance corresponding to the first surface view.
[0066] S203. During the loading process of the second interface content, the first interface content of the preset interface is played on the first interface layer of the first surface view through the media content playback instance. The first interface content is the main content of the preset interface.
[0067] In this embodiment, during the loading process of the second interface content, the first interface content of the preset interface can be played through the created media content playback instance on the first interface layer of the first surface view, such as playing pre-cached preset media content through the created media content playback instance on the first interface layer of the first surface view.
[0068] S204. In response to the completion of loading the content of the second interface, the content of the second interface is added to the preset interface.
[0069] In this embodiment, after the second interface content is loaded, the pre-cached preset media content can be played on the first interface layer of the first surface view, and the loaded second interface content can be added to the display so that the user can interact based on the displayed second interface content.
[0070] In some implementations, after adding the content of the second interface to the preset interface, the method further includes: creating a second surface view of the preset interface outside the display area of the preset interface; and synchronously playing the content of the first interface on a third interface layer of the second surface view based on the media content playback instance.
[0071] The second surface view can be understood as the view of the preset interface that is actually used to play media content. For example, the second surface view can be a surface view of the media content stream of the preset interface. It can be used not only to display the preset media content of the preset interface, but also to display other media content in the media content stream of the preset interface besides the preset media content. The third interface layer can be understood as the interface layer corresponding to the second surface view.
[0072] Specifically, after adding the content of the second interface to the preset interface, such as after obtaining the media content stream data of the preset interface, the second surface view of the preset interface can be rendered, and this second surface view can be moved outside the display area of the preset interface, such as moving it off the screen; and the media content playback instance of the first surface view can be reused, and based on this media content playback instance of the first surface view, the preset media content played in the first interface layer can be played synchronously in the third interface layer of the second surface view.
[0073] In the above embodiments, by reusing the media content playback instance of the first surface view to play media content, it is possible to ensure a high degree of consistency in the media content playback state between the first interface layer and the third interface layer, and to achieve seamless switching between the first surface layer and the second surface layer. This allows users to hardly feel any stuttering or abnormality during the switching process, just like watching a continuous and uninterrupted video stream.
[0074] Specifically, in related technologies, when switching between a snapshot Surface View (i.e., the first surface view) and a real Surface View (i.e., the second surface view), a series of problems affecting the visual experience often occur. For example, frequent black screens, screen flickering, or overlapping content may occur. These problems severely disrupt the visual continuity of video playback, causing users to experience noticeable stuttering and unevenness while watching videos, thus significantly reducing the quality of the user experience. This embodiment constructs a playback state synchronization mechanism by reusing media content playback instances from snapshot Surface Views. This mechanism enables seamless switching between snapshot Surface Views and real Surface Views, ensuring a high degree of continuity in the playback state during the switching process. In this way, black screens, screen flickering, and other undesirable phenomena can be effectively avoided, making the entire switching process smooth and natural, almost imperceptible to the user, thereby providing a higher quality and smoother video viewing experience.
[0075] In some implementations, upon detecting the initiation of playback of the first surface view, the playback callback of the preset interface can be suppressed, such as by adjusting the playback callback method of the preset interface to a pending state. After detecting the initiation of playback of the second surface view, the playback callback of the preset interface can be restored, such as by adjusting the playback callback method of the preset interface from a pending state to an enabled state, so as to notify the application of changes in playback status (such as start, pause, end, etc.) based on the playback callback method of the preset interface. Optionally, after playing the first interface content of the preset interface on the first interface layer of the first surface view through the media content playback instance, the method further includes: adjusting the playback callback method of the preset interface to a pending state; and after synchronously playing the first interface content on the third interface layer of the second surface view, the method further includes: adjusting the playback callback method from a pending state to an enabled state.
[0076] In some implementations, the view resources of the first surface view can be released immediately after the second surface view starts playing, and the interface layer of the second surface view can be used directly for media content playback, so as to quickly release the resources associated with the first surface view.
[0077] In other embodiments, after the second surface view starts playing, the view resources of the first surface view are not immediately released. Instead, upon receiving a preset trigger operation within a preset interface, such as a media content switching operation or an interface switching operation within the preset interface, the view resources of the first surface view are released, and the third interface layer of the second surface view is moved into the display area of the preset interface, such as moving it into the screen. Different media content from the media content stream of the preset interface is then played using this third interface layer. This further enhances the switching effect between the first and third interface views and releases the view resources of the first surface view in a timely manner, avoiding excessive resource consumption that could lead to application performance degradation and ensuring continuous and stable media content playback. Optionally, in this case, the application cold start method may further include: in response to a preset trigger operation within the preset interface, releasing the view resources of the first surface view and moving the third interface layer into the display area, using the third interface layer for media content playback, wherein the preset trigger operation includes at least one of a media content switching operation and an interface switching operation.
[0078] The view resources of the first surface view can be understood as the resources occupied by the first surface view, such as memory resources, central processing unit (CPU) resources, and / or graphics processing unit (GPU) resources. Media content switching operations can be understood as triggering operations to indicate switching the currently displayed media content in the preset interface, such as triggering a media content switching control; or performing a media content switching gesture, such as a vertical swipe in the preset interface. Interface switching operations can be understood as operations to indicate switching the currently displayed interface, such as triggering an interface switching control; or performing an interface switching gesture, such as a horizontal swipe in the preset interface. This can be understood as follows: In response to an interface switching operation, the currently displayed interface is switched from the preset interface to an interface other than the preset interface. If the preset interface is currently playing media content based on the first interface layer, then in response to this interface switching operation, the view resources of the first surface view can be released, and the third interface layer can be moved into the display area of the preset interface. Thus, if the user switches back to the preset interface, the media content in the media content stream of the preset interface can be played directly using this third interface layer.
[0079] When releasing the view resources of the first surface view, for example, the view related to the first surface view can be removed from the preset interface view tree, and the first surface view can be set to the vanished (gone) state. When in the vanished state, it means that the first surface view is completely invisible and does not occupy layout space.
[0080] The cold start method for the application provided in this embodiment creates a media content playback instance corresponding to the first surface view, and plays the preset media content of the preset interface through the first interface layer of the first surface view using this media content playback instance. Thus, the preset media content in the preset interface can be played before the interface components of the preset interface are loaded, and the preset media content can be quickly presented in the early stage of application startup, thereby improving the response speed of application cold start.
[0081] Figure 3 This is a structural block diagram of a cold start device for an application provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and can be configured in an electronic device, typically a computer, mobile phone, or tablet computer. It can perform a cold start on the application by executing a cold start method, such as displaying the main content of the home screen during a cold start. Figure 3 As shown, the cold start device for the application provided in this embodiment may include:
[0082] The first interface content display module 301 is used to display the first interface content of the preset interface on the first interface layer of the preset interface during the cold start process of the application, and to load the second interface content of the preset interface. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0083] The second interface content display module 302 is used to add the second interface content to the preset interface in response to the completion of the second interface content loading.
[0084] The application cold start device provided in this embodiment displays the first interface content of a preset interface on a first interface layer of a preset interface during the application cold start process via a first interface content display module, and loads the second interface content of the preset interface. This preset interface is the first interface after the application cold start, and the first interface content is the main content of the preset interface. In response to the completion of the second interface content loading, the second interface content display module adds and displays this second interface content on the preset interface. This embodiment, utilizing the above technical solution, can pre-display the main content of the first interface through a temporary interface layer created for the first interface during the application cold start process, without waiting for the second interface content to finish loading or for the application cold start to complete. This improves the loading speed of the main content of the first interface during application cold start, meeting the user's need to quickly see the main content of the first interface after opening the application.
[0085] Optionally, the first interface content display module 301 may be specifically used to: in response to the call to the main activity creation method of the preset interface, create a first surface view of the preset interface; in response to the completion of the creation of the first surface view, display the first interface content of the preset interface on the first interface layer of the first surface view.
[0086] Optionally, the first interface content display module 301 may be specifically used to: in response to the completion of the creation of the first surface view, control the focus to be focused on the first surface view, and call the focus change callback method of the preset interface; in response to the call of the focus change callback method, load the second interface content of the preset interface.
[0087] Furthermore, the cold start device for the application may further include: a layer creation module, used to create a second interface layer of the preset interface in response to the call to the focus change callback method; the second interface content display module 302 may be specifically used to: display the second interface content on the second interface layer, wherein the second interface layer is located above the first interface layer.
[0088] Optionally, the first interface content is the preset media content to be played on the preset interface, and the first interface content display module 301 can be specifically used to: create a media content playback instance corresponding to the first surface view; and play the first interface content of the preset interface on the first interface layer of the first surface view through the media content playback instance.
[0089] Furthermore, the cold start device for the application may also include: a view creation module, used to create a second surface view of the preset interface outside the display area of the preset interface after the content of the second interface is added to the preset interface; and a playback module, used to synchronously play the content of the first interface on the third interface layer of the second surface view based on the media content playback instance.
[0090] Furthermore, the cold start device for the application may further include: a callback suspension module, used to adjust the playback callback method of the preset interface to a suspended state after the first interface content of the preset interface is played on the first interface layer of the first surface view through the media content playback instance; and a callback enable module, used to adjust the playback callback method from a suspended state to an enabled state after the first interface content is played synchronously on the third interface layer of the second surface view.
[0091] Furthermore, the cold start device for the application may further include: a view release module, used to release the view resources of the first surface view in response to a preset trigger operation acting within the preset interface, and move the third interface layer to the display area, and use the third interface layer to play media content, wherein the preset trigger operation includes at least one of a media content switching operation and an interface switching operation.
[0092] Furthermore, the cold start device for the application may also include at least one of the following: a logic configuration module, configured to configure interactive gesture processing logic for the first surface view after loading the second interface content of the preset interface; and a first layer state adjustment module, configured to create a fourth interface layer of the preset interface after loading the second interface content of the preset interface, and adjust the fourth interface layer to a transparent state, wherein the fourth interface layer is located above the first interface layer, and the fourth interface layer is used to display the interface background of the preset interface.
[0093] Furthermore, the cold start device for the application may also include: a second layer state adjustment module, used to adjust the fourth interface layer from a transparent state to a non-transparent state in response to a preset trigger operation acting within the preset interface.
[0094] The cold start device for applications provided in this disclosure can execute the cold start method for applications provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the cold start method for applications. Technical details not described in detail in this embodiment can be found in the cold start method for applications provided in any embodiment of this disclosure.
[0095] The following is for reference. Figure 4 This illustration shows a structural diagram of an electronic device (e.g., a terminal device) 400 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0096] like Figure 4 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0097] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0098] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this disclosure.
[0099] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A 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 any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0100] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0101] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0102] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: during the cold start process of the application, display the first interface content of the preset interface on a first interface layer of the preset interface, and load the second interface content of the preset interface, wherein the preset interface is the first interface after the application's cold start, and the first interface content is the main content of the preset interface; and in response to the completion of loading the second interface content, add the display of the second interface content on the preset interface.
[0103] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0104] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0105] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of modules do not, in some cases, constitute a limitation on the unit itself.
[0106] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0107] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on 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), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0108] According to one or more embodiments of this disclosure, Example 1 provides a cold start method for an application, including:
[0109] During the cold start process of the application, the first interface content of the preset interface is displayed on the first interface layer of the preset interface, and the second interface content of the preset interface is loaded. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0110] In response to the completion of loading the content of the second interface, the content of the second interface is added to the preset interface.
[0111] According to one or more embodiments of this disclosure, Example 2, based on the method described in Example 1, includes displaying the first interface content of the preset interface on a first interface layer of the preset interface, comprising:
[0112] In response to a call to the main activity creation method of the preset interface, a first surface view of the preset interface is created;
[0113] In response to the completion of the creation of the first surface view, the first interface content of the preset interface is displayed on the first interface layer of the first surface view.
[0114] According to one or more embodiments of this disclosure, Example 3, based on the method described in Example 2, includes loading the second interface content of the preset interface, comprising:
[0115] In response to the completion of the creation of the first surface view, the focus is controlled to be focused on the first surface view, and the focus change callback method of the preset interface is invoked;
[0116] In response to the call to the focus change callback method, the second interface content of the preset interface is loaded.
[0117] According to one or more embodiments of this disclosure, Example 4 describes the method according to Example 3, the method further comprising:
[0118] In response to the call to the focus change callback method, a second interface layer of the preset interface is created;
[0119] The step of adding the content of the second interface to the preset interface includes:
[0120] The content of the second interface is displayed on the second interface layer, wherein the second interface layer is located above the first interface layer.
[0121] According to one or more embodiments of this disclosure, Example 5 describes the method described in Example 2, wherein the first interface content is preset media content to be played on the preset interface, and the step of displaying the first interface content of the preset interface on the first interface layer of the first surface view includes:
[0122] Create a media content playback instance corresponding to the first surface view;
[0123] The media content playback instance plays the first interface content of the preset interface on the first interface layer of the first surface view.
[0124] According to one or more embodiments of this disclosure, Example 6, based on the method described in Example 5, further includes, after adding the display of the second interface content to the preset interface:
[0125] Create a second surface view of the preset interface outside the display area of the preset interface;
[0126] Based on the media content playback example, the content of the first interface is played synchronously on the third interface layer of the second surface view.
[0127] According to one or more embodiments of this disclosure, Example 7, based on the method of Example 6, further includes, after the first interface content of the preset interface is played on the first interface layer of the first surface view via the media content playback instance:
[0128] Adjust the playback callback method of the preset interface to a suspended state;
[0129] After the content of the first interface is synchronously played on the third interface layer of the second surface view, the following is also included:
[0130] Change the playback callback method from suspended to enabled.
[0131] According to one or more embodiments of this disclosure, Example 8 describes the method according to Example 6, the method further comprising:
[0132] In response to a preset trigger operation acting within the preset interface, the view resources of the first surface view are released, and the third interface layer is moved to the display area. Media content is played using the third interface layer, wherein the preset trigger operation includes at least one of a media content switching operation and an interface switching operation.
[0133] According to one or more embodiments of this disclosure, Example 9, based on any one of Examples 2-8, further includes at least one of the following after loading the second interface content of the preset interface:
[0134] Configure interactive gesture processing logic for the first surface view;
[0135] A fourth interface layer is created for the preset interface, and the fourth interface layer is adjusted to a transparent state. The fourth interface layer is located above the first interface layer and is used to display the interface background of the preset interface.
[0136] According to one or more embodiments of this disclosure, Example 10 describes the method according to Example 9, the method further comprising:
[0137] In response to a preset trigger operation that acts within the preset interface, the fourth interface layer is adjusted from a transparent state to a non-transparent state.
[0138] According to one or more embodiments of this disclosure, Example 11 provides a cold start apparatus for an application, comprising:
[0139] The first interface content display module is used to display the first interface content of the preset interface on the first interface layer of the preset interface during the cold start process of the application, and to load the second interface content of the preset interface. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface.
[0140] The second interface content display module is used to add the second interface content to the preset interface in response to the completion of the second interface content loading.
[0141] According to one or more embodiments of this disclosure, Example 12 provides an electronic device, including:
[0142] One or more processors;
[0143] Memory, used to store one or more programs.
[0144] When the one or more programs are executed by the one or more processors, the one or more processors implement a cold start method for the application as described in any of Examples 1-10.
[0145] According to one or more embodiments of the present disclosure, Example 13 provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements a cold start method for an application as described in any of Examples 1-10.
[0146] According to one or more embodiments of this disclosure, Example 14 provides a computer program product that, when executed by a computer, causes the computer to implement a cold start method for an application as described in any of Examples 1-10.
[0147] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0148] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0149] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A cold start method for an application, characterized in that, include: During the cold start process of the application, the first interface content of the preset interface is displayed on the first interface layer of the preset interface, and the second interface content of the preset interface is loaded. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface. In response to the completion of loading of the second interface content, the second interface content is added to the preset interface for display.
2. The method according to claim 1, characterized in that, The step of displaying the first interface content of the preset interface on the first interface layer of the preset interface includes: In response to a call to the main activity creation method of the preset interface, a first surface view of the preset interface is created; In response to the completion of the creation of the first surface view, the first interface content of the preset interface is displayed in the first interface layer of the first surface view.
3. The method according to claim 2, characterized in that, The second interface content for loading the preset interface includes: In response to the completion of the creation of the first surface view, the focus is controlled to be focused on the first surface view, and the focus change callback method of the preset interface is invoked; In response to the call to the focus change callback method, the second interface content of the preset interface is loaded.
4. The method according to claim 3, characterized in that, The method further includes: In response to the call to the focus change callback method, a second interface layer of the preset interface is created; The step of adding the content of the second interface to the preset interface includes: The content of the second interface is displayed on the second interface layer, wherein the second interface layer is located above the first interface layer.
5. The method according to claim 2, characterized in that, The first interface content is the preset media content to be played on the preset interface. Displaying the first interface content of the preset interface on the first interface layer of the first surface view includes: Create a media content playback instance corresponding to the first surface view; The media content playback instance plays the first interface content of the preset interface on the first interface layer of the first surface view.
6. The method according to claim 5, characterized in that, After adding the content of the second interface to the preset interface, it also includes: Create a second surface view of the preset interface outside the display area of the preset interface; Based on the media content playback example, the content of the first interface is played synchronously on the third interface layer of the second surface view.
7. The method according to claim 6, characterized in that, After the first interface content of the preset interface is played on the first interface layer of the first surface view through the media content playback instance, the method further includes: Adjust the playback callback method of the preset interface to a suspended state; After the content of the first interface is synchronously played on the third interface layer of the second surface view, the following is also included: Change the playback callback method from suspended to enabled.
8. The method according to claim 6, characterized in that, The method further includes: In response to a preset trigger operation acting within the preset interface, the view resources of the first surface view are released, and the third interface layer is moved to the display area. Media content is played using the third interface layer, wherein the preset trigger operation includes at least one of a media content switching operation and an interface switching operation.
9. The method according to any one of claims 2-8, characterized in that, After loading the second interface content of the preset interface, at least one of the following is also included: Configure interactive gesture processing logic for the first surface view; A fourth interface layer is created for the preset interface, and the fourth interface layer is adjusted to a transparent state. The fourth interface layer is located above the first interface layer and is used to display the interface background of the preset interface.
10. The method according to claim 9, characterized in that, The method further includes: In response to a preset trigger operation that acts within the preset interface, the fourth interface layer is adjusted from a transparent state to a non-transparent state.
11. A cold start device for an application, characterized in that, include: The first interface content display module is used to display the first interface content of the preset interface on the first interface layer of the preset interface during the cold start process of the application, and to load the second interface content of the preset interface. The preset interface is the first interface after the application is cold started, and the first interface content is the main content of the preset interface. The second interface content display module is used to add the second interface content to the preset interface in response to the completion of the second interface content loading.
12. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the cold start method of the application according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the cold start method of the application program as described in any one of claims 1-10.
14. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the cold start method of the application program according to any one of claims 1-10.