Event processing method and apparatus, electronic device, and storage medium

By obtaining and binding view component instances from non-native browser kernels and calling custom processing logic, the problem of releasing non-native browser kernel resources is solved, thereby improving the stability and performance of the host application and avoiding resource waste.

CN122285342APending Publication Date: 2026-06-26GUANGZHOU BOGUAN TELECOMM TECH LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU BOGUAN TELECOMM TECH LTD
Filing Date
2026-03-17
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

The processing processes of non-native browser kernels and the system resources they occupy cannot be released and reclaimed in a timely and effective manner, affecting the overall stability and responsiveness of the host application and causing a waste of system resources.

Method used

By responding to predetermined events, the system bypasses access restrictions of non-native browser kernels, obtains view component instances, binds custom processing logic to them, and calls the custom processing logic to process the preset events of the processing process, thereby achieving the bypass of access restrictions of non-native browser kernels.

Benefits of technology

Ensure the overall stability and responsiveness of the host application, avoid wasting system resources, and improve the robustness of the application and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122285342A_ABST
    Figure CN122285342A_ABST
Patent Text Reader

Abstract

This application discloses an event handling method, apparatus, electronic device, and storage medium, belonging to the field of computer technology. Responding to a predetermined event, it bypasses access restrictions of a non-native browser kernel according to a preset method to obtain a view component instance created based on the non-native browser kernel; it binds custom processing logic to the view component instance; responding to a triggered event, it calls the view component instance, triggering the non-native browser kernel to call a processing process for processing; when a preset event is detected in the processing process, it calls the custom processing logic bound to the view component instance for processing. This enables the acquisition of preset events when using a non-native browser kernel, thereby allowing the use of custom processing logic for processing, thus ensuring the overall stability and responsiveness of the host application and avoiding waste of system resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and specifically to an event processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In application development, WebView components are commonly used to embed and display web page content. To achieve better compatibility and performance, many applications choose to integrate non-native browser engines (e.g., via software development kits). However, these non-native browser engines typically encapsulate their internal implementation, making it difficult for the host application to perceive and intervene in their processing. This results in the processing process and the system resources it occupies not being released and reclaimed in a timely and effective manner. This not only affects the continuity of the user's current operation but may also impact the overall stability and responsiveness of the host application due to resource residue or abnormal state accumulation, leading to a waste of system resources. For example, if the web page rendering process of the engine crashes, the crashed rendering process and its occupied system resources cannot be released and reclaimed in a timely and effective manner, further affecting the overall stability and responsiveness of the host application and causing a waste of system resources. Summary of the Invention

[0003] This disclosure provides an event handling method, apparatus, electronic device, and storage medium that can obtain data within a non-native browser kernel when using a non-native browser kernel, thereby ensuring the overall stability and responsiveness of the host application and avoiding waste of system resources.

[0004] In a first aspect, embodiments of this disclosure provide an event handling method, the method comprising: In response to a predetermined event, the access restrictions of non-native browser kernels are bypassed in a preset manner to obtain view component instances created based on the non-native browser kernel; Bind the custom processing logic to the view component instance; In response to the triggering event, the view component instance is invoked, triggering the non-native browser kernel to call the processing process for processing; If a preset event is detected in the processing process, the custom processing logic bound to the view component instance is invoked for processing.

[0005] Secondly, embodiments of this disclosure provide an event processing apparatus, the apparatus comprising: The breakthrough module is used to respond to a predetermined event and break through the access restrictions of the non-native browser kernel in a preset manner in order to obtain the view component instance created based on the non-native browser kernel. The binding module is used to bind custom processing logic to the view component instance; The calling module is used to respond to the triggering event, call the view component instance, and trigger the non-native browser kernel to call the processing process for processing; The processing module is used to call the custom processing logic bound to the view component instance to perform processing when a preset event is detected in the processing process.

[0006] Thirdly, embodiments of this disclosure also provide an electronic device, including a memory storing a plurality of instructions; a processor loading instructions from the memory to execute the steps of any event handling method provided in embodiments of this disclosure.

[0007] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps of any of the event handling methods provided in embodiments of this disclosure.

[0008] Fifthly, embodiments of this disclosure also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the event handling methods provided in embodiments of this disclosure.

[0009] In the scheme of this embodiment, in response to a predetermined event, access restrictions of the non-native browser kernel are bypassed according to a preset method to obtain a view component instance created based on the non-native browser kernel; custom processing logic is bound to the view component instance; in response to a triggering event, the view component instance is invoked, triggering the non-native browser kernel to call the processing process for processing; when a preset event is detected in the processing process, the custom processing logic bound to the view component instance is invoked for processing, thereby bypassing the access restrictions of the non-native browser kernel, so as to bind the view component instance and the custom processing logic, thereby enabling the custom processing logic to be invoked for processing when the processing process triggered by the non-native browser kernel generates a preset event, thus ensuring the overall stability and response performance of the host application and avoiding the waste of system resources.

[0010] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1This is a flowchart illustrating an exemplary embodiment of the event handling method provided in this disclosure; Figure 2 This is another flowchart illustrating the event handling method provided by an exemplary embodiment of this disclosure; Figure 3 This is another flowchart illustrating the event handling method provided by an exemplary embodiment of this disclosure; Figure 4 This is a schematic diagram of an event processing apparatus provided in an exemplary embodiment of this disclosure; Figure 5 This is a schematic diagram of an electronic device provided by an exemplary embodiment of this disclosure. Detailed Implementation

[0013] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Furthermore, in the description of the embodiments of this disclosure, the terms "first," "second," etc., are only used for distinguishing descriptions and should not be construed as indicating or implying relative importance. Therefore, features defined with "first" or "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this disclosure, "multiple" means two or more, unless otherwise explicitly specified.

[0014] This disclosure provides an event processing method, apparatus, electronic device, and computer-readable storage medium. Specifically, this embodiment will be described from the perspective of an event processing apparatus, which can be integrated into an electronic device, meaning that the event processing method of this disclosure can be executed by an electronic device. Optionally, the electronic device may include a terminal device or a server. The terminal device may be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, game console, or personal computer (PC), etc.

[0015] Optionally, the server can be a standalone server, or a server network or server cluster, including but not limited to computers, network hosts, single network servers, multiple network server sets, or cloud servers composed of multiple servers. Cloud servers consist of a large number of computers or network servers based on cloud computing.

[0016] The following detailed description is provided in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.

[0017] Please refer to Figure 1 This event handling method is applied to the terminal device, which includes the target application. The specific process can be described in steps 101 to 104 as follows: Step 101: In response to a predetermined event, bypass the access restrictions of non-native browser kernels in a preset manner to obtain view component instances created based on non-native browser kernels.

[0018] Among them, the scheduled event refers to the message that triggers the binding of the view component instance and the custom processing logic. Its specific content can be set according to the actual situation. For example, the scheduled event can be the initialization event of a non-native browser kernel or the creation completion message of the view component instance created based on the non-native browser kernel. When the scheduled event is the initialization event of a non-native browser kernel, the access restrictions of the non-native browser kernel can be bypassed during the initialization process of the non-native browser kernel to obtain the view component instance created based on the non-native browser kernel.

[0019] Alternatively, non-native browser engines can create view component instances during the initialization phase, or they can create view component instances in response to triggering events.

[0020] A non-native browser kernel refers to a non-native browser kernel associated with the target application. It is the browser kernel used by the target application to load and display web pages, and is not built into the terminal device. Its type can be set according to the actual situation; for example, a non-native browser kernel can be the X5 SDK or the UC Browser kernel. This embodiment does not limit this. Optionally, a non-native browser kernel can be a wrapper layer for the operating system's built-in web view components, or it can be a browser with web view components developed by a third-party vendor. When the non-native browser kernel is a wrapper layer for the operating system's built-in web view components, the view component instance created based on the non-native browser kernel can be a native instance of the operating system's android.webkit.WebView.

[0021] Optionally, the form in which a non-native browser kernel exists can be set according to the actual situation. For example, a non-native browser kernel can be integrated into the target application in the form of a software development kit (SDK), or it can exist in the terminal device as a standalone application, or it can exist in the server as a service. This embodiment does not limit this.

[0022] Access restrictions refer to the mechanisms by which non-native browser kernels restrict access to their internal data. These restrictions can be set based on the form in which the non-native browser kernel exists. For example, when a non-native browser kernel exists as an SDK, access restrictions can be imposed on the SDK's wrapper layer. When a non-native browser kernel exists as an independent application, access restrictions can be imposed on inter-process boundaries. When a non-native browser kernel exists as a service on a server, access restrictions can be imposed on container isolation mechanisms and permissions, etc.

[0023] The default method can be any method allowed by the non-native browser kernel. That is, the default method can be any method specified by the non-native browser kernel that can be used to obtain its instance. For example, when the non-native browser kernel exists as an SDK, the default method can be to obtain the private properties or private interfaces of the view component instance created based on the non-native browser kernel by using reflection mechanism or view recursive traversal algorithm (view recursive traversal algorithm such as depth-first search (DFS)) according to the method specified by the non-native browser kernel. When the non-native browser kernel exists as an independent application, the default method can be middleware or extension. This embodiment does not limit this.

[0024] It is understood that the view component instances obtained by bypassing access restrictions through the default method in this application are used within a compliant and reasonable scope, such as to implement custom processing logic, such as custom crash handling logic, and are not used for non-compliant and unreasonable operations such as damaging non-native browser kernels or operating systems.

[0025] Optionally, obtaining a WebView instance created based on a non-native browser kernel can be understood as obtaining the control handle of that instance. The control handle differs depending on the form of the non-native browser kernel. For example, when the non-native browser kernel exists as an SDK, the control handle can be a private property or interface of the view component instance; when the non-native browser kernel exists as a standalone application, the control handle can be the IPC port number of the non-native browser kernel.

[0026] In some embodiments, a non-native browser kernel is integrated into the target application as a software development kit, and in response to a predetermined event, bypasses the access restrictions of the non-native browser kernel in a preset manner, including: In response to a predetermined event, the encapsulation layer of the software development kit in the target application is penetrated using a reflection mechanism or a view recursive traversal algorithm.

[0027] Reflection mechanisms can leverage the reflection features of languages ​​like Java to dynamically obtain and manipulate private classes, methods, or fields within the SDK at runtime, thereby achieving precise and efficient penetration of the encapsulation layer. Meanwhile, recursive view traversal algorithms (such as depth-first search) offer a more general solution. They systematically traverse the application's view hierarchy to locate the target component instance. This approach does not depend on specific class names or encapsulation details within the third-party SDK, thus providing better compatibility and robustness across different SDK versions or vendors.

[0028] In this embodiment, the non-native browser kernel is integrated into the target application in the form of a software development kit (SDK). In response to a predetermined event, it penetrates the encapsulation layer of the SSDK in the target application using a reflection mechanism or a view recursive traversal algorithm. This allows it to obtain view component instances by penetrating the SDK's encapsulation layer, so that it can subsequently establish underlying detection and processing logic independent of the non-native browser kernel.

[0029] Step 102: Bind the custom processing logic to the view component instance.

[0030] Custom processing logic refers to the code set by the developers of the target application according to actual needs. It instructs how to handle predefined events occurring in the processing process of the view component instance. For example, custom processing logic might refer to custom crash handling logic, with a crash event as the predefined event and the rendering process or GPU process as the processing process. It instructs how to handle a crash in the rendering process of the view component instance. Another example is custom memory handling logic, with a memory alert event as the predefined event. It instructs how to handle high memory usage in the GPU process of the view component instance. Optionally, when a non-native browser kernel exists as an SDK, custom processing logic can be mounted via the `setWebViewClient` interface, thereby binding the custom processing logic to the view component instance. Optionally, when a non-native browser kernel exists as a service on a server, the server can be triggered to bind the custom processing logic to the view component instance.

[0031] Step 103: In response to the triggering event, call the view component instance to trigger the non-native browser kernel to call the processing process for rendering.

[0032] In this context, a triggering event refers to a message used to trigger a target page. The target page can be an embedded page within the target application or an external webpage. When it's an embedded page, the triggering event can be generated in response to a triggering action on a control within the target application. When it's an external webpage, the triggering event can be generated in response to a triggering action on a link within the target page. When a non-native browser engine is integrated into the target application as an SDK, the rendering process is part of the target application's process. For example, when the rendering process is the rendering process itself, it can be called the instance rendering process of the target application (WebView rendering process).

[0033] Specifically, in response to a triggered event, a view component instance can obtain the URL of the target page and pass it to a non-native browser engine. The non-native browser engine then passes the URL to the processing process. The processing process obtains the relevant code of the target page and performs processing based on the relevant code. For example, the view component instance passes the URL to the rendering engine in the non-native browser engine, the rendering engine passes the URL to the rendering process, the rendering process obtains the relevant code of the target page, and renders the target page based on the relevant code to display the target page.

[0034] Step 104: If a preset event is detected in the processing process, the custom processing logic bound to the view component instance is invoked for processing.

[0035] The preset events can be set according to actual conditions. For example, the preset events can be memory alarm events or crash events; this embodiment does not limit this. The processing process can have the preset event occur after the target page is displayed or before the target page is displayed; this embodiment does not limit this either. For example, the processing process is a rendering process, which can crash after the target page is displayed or before the target page is displayed. Since the custom processing logic is bound to the view component instance, the custom processing logic can be called to handle the situation when the preset event occurs in the processing process of the view component instance.

[0036] Optionally, when the processing process is a rendering process, the default event is the rendering process crash event. The reasons for the rendering process crash can include at least one of the following: GPU driver exception, JavaScript infinite loop, insufficient resources (OOM), and abnormal webpage content. Among them, GPU driver exception refers to rendering failure caused by GPU compatibility issues between different devices; JavaScript infinite loop refers to the process freezing due to abnormal execution of JS code in the target page; memory exhaustion (OOM) refers to excessive memory resources consumed by a complex target page; and abnormal webpage content refers to malicious code or incorrectly formatted webpage content.

[0037] In related technologies, the operating system's built-in web view component provides the `onRenderProcessGone` callback method. Developers can override this callback method of `WebViewClient` to detect crashes in the rendering process of the view component and implement custom crash handling logic. When using third-party WebView kernels such as the X5 SDK, because the SDK does not expose the `RenderProcessGoneDetail` class, it is impossible to directly override the `onRenderProcessGone` method to detect crashes in the WebView's rendering process, thus making it impossible to implement custom crash handling logic.

[0038] In this example, when the custom processing logic is a custom crash handling logic, the access restrictions of the non-native browser kernel are bypassed in a preset way to obtain the view component instance created based on the non-native browser kernel; the custom crash handling logic is bound to the view component instance; in response to the triggering event, the view component instance is called, triggering the non-native browser kernel to call the rendering process for rendering; if the rendering process crashes, the custom crash handling logic bound to the view component instance is called for processing, thus establishing a low-level crash detection and handling logic independent of the non-native browser kernel, and it does not depend on a specific version of the non-native browser kernel, thus having universality.

[0039] Optionally, when a non-native browser kernel exists in the target application as an SDK, the process of the target application may include multiple view component instances. Multiple view component instances can share a rendering process, or a view component instance can use a rendering process. This ensures that when the rendering process of a view component instance crashes, it does not affect other view component instances, thus preventing the entire target application from becoming unavailable.

[0040] It should be noted that the "custom crash handling logic" described in this disclosure demonstrates a high degree of flexibility, and its customization is not limited to the page-level or crash-count-based strategies in the embodiments. For example, developers can also define crash handling logic based on real-time system resource status (such as automatically adopting a lighter recovery strategy when system memory is severely insufficient), page content importance (such as adopting a priority protection strategy for payment-related web pages), or user historical behavior preferences, etc., according to actual needs. By binding the custom crash handling logic to view component instances, crash governance capabilities that can flexibly adapt to different business scenarios and technical constraints are provided to the target application.

[0041] In some embodiments, custom processing logic bound to a view component instance is invoked for processing, including: selecting a corresponding processing strategy based on the page attributes of the target page to be displayed based on the triggering event.

[0042] The page attributes of the target page refer to a set of configurable parameters that describe the characteristics of the target page in terms of structure, style, behavior and metadata. For example, the attribute information of the target page may include at least one of the following: the type of the target page (payment type or login type, etc.), the level of the target page, the encoding format of the target page, etc. This embodiment does not limit this.

[0043] In this embodiment, based on the page attributes of the target page that is triggered by the event, a corresponding processing strategy is selected for processing, so as to provide different processing strategies for the preset event and improve the flexibility of processing the preset event.

[0044] In some embodiments, page attributes include the target page's hierarchy within the target application, and the processing process includes a rendering process. Here, hierarchy refers to the levels defined based on the target page's affiliation and / or function. Its specific content can be set according to actual circumstances. For example, hierarchy may include at least one of independent hosting pages, first-level embedded pages, and deep detail pages. Independent hosting pages refer to pages that are used and destroyed immediately, such as activity pages or external link landing pages. First-level embedded pages refer to the core pages of the target application, such as the target application's homepage tab or news list page. Deep detail pages refer to pages at the second level or higher accessed from first-level embedded pages, such as second-level article details or product pages, etc. This embodiment does not limit the scope. Different levels correspond to different crash handling strategies.

[0045] In related technologies, when the rendering process crashes, it typically only retryes, leading to a logical infinite loop. Alternatively, the target application's process may include multiple view component instances created based on a non-native browser engine. These multiple view component instances share the rendering process. In this case, if the rendering process crashes due to a view component instance, all view component instances will become unavailable, thus rendering the target application unusable.

[0046] In this embodiment, when a rendering process crash is detected, the corresponding crash handling strategy is selected based on the hierarchy of the target page displayed by the triggering event within the target application. This not only avoids the problem of logical dead loops caused by using a single retry strategy when the rendering process crashes, thus improving the flexibility of crash handling, but also achieves fault isolation. This prevents the crash of a certain view component instance from causing the main interface of the entire target application to become unusable, thereby improving the overall robustness of the target application. While ensuring the stability of the target application, it minimizes interference with users as much as possible.

[0047] In some embodiments, page attributes include the hierarchy of the target page within the target application, and the processing process includes a rendering process. Based on the page attributes of the target page that are triggered by a triggering event, a corresponding processing strategy is selected for processing, including: If the target page displayed when the event is triggered is a standalone page of the target application, a retry operation will be performed. And / or, if the target page is a first-level embedded page of the target application, destroy the view component instance and create a new view component instance based on a snapshot of the target page, invoke the new view component instance, and trigger the rendering engine in the non-native browser kernel to invoke the rendering process for rendering. And / or, if the target page is a deep detail page of the target application, go back to the previous screen.

[0048] Specifically, retrying stops when the number of retries equals or exceeds a preset number. Optionally, during the display of the target page, a snapshot of the target page can be recorded in real time. The snapshot may include user operation information on the target page, such as user markings and scroll positions on the target page; this embodiment does not limit this. After a crash, a new view component instance is created based on the snapshot using a non-native browser kernel, and rendering is triggered by calling the new view component instance, ensuring that the target page seen by the user is consistent with the target page before the crash.

[0049] Specifically, the various crash handling strategies in this embodiment can be shown in the following table:

[0050] In this embodiment, if the target page displayed when the triggering event is a standalone page of the target application, a retry operation is performed to prioritize the recovery of the standalone page. If the retry fails, the user is allowed to exit the page, thus avoiding user obstruction. And / or, if the target page is a first-level embedded page of the target application, the view component instance is destroyed and a new view component instance is created based on a snapshot of the target page. The new view component instance is invoked, triggering the rendering engine in the non-native browser kernel to call the rendering process for rendering, achieving silent background reconstruction and maintaining the stability of the target application. And / or, if the target page is a deep detail page of the target application, the user is redirected to the previous screen to avoid secondary crashes caused by lost context parameters, achieving fault isolation. This allows for differentiated fault tolerance strategies to be used, further preventing the target application from becoming unavailable.

[0051] In some embodiments, custom processing logic bound to a view component instance is invoked for processing, including: Invoke the custom processing logic bound to the view component instance, and store the current data of the target page for the preset event that is triggered and displayed; Based on the records of the target page, determine the event type of the target page, and the records include the current data; The appropriate processing strategy is selected based on the event type.

[0052] In this context, "current data" refers to the relevant data generated by the target page during a preset event. "Record" refers to a collection of data generated by the target page during a preset event, which may include data corresponding to one or more preset events. For example, "current data" refers to the current crash data, which is the relevant data generated by the target page in the current crash event. "Record" refers to a crash record, which is a collection of data used to record crash events of the target page, and may include crash data corresponding to one or more crash events. Crash data is the basic unit constituting a crash record, used to describe a specific crash event. Optionally, crash data may include the target page's URL, the timestamp of the crash, the target application's version number, and the UA (User Agent, a string identifying the client software type and version), etc. Furthermore, to more accurately diagnose the cause and type of crash, crash data may further include error codes or semaphores when the rendering process exits, snapshots of system memory and CPU usage immediately before the crash, JavaScript error messages from the webpage that triggered the crash (if any), and specific context information captured by custom crash handling logic. By recording this multi-dimensional crash data, the resulting crash record can provide data support for accurately determining the crash type, analyzing the root cause, and optimizing application performance. Alternatively, the crash data can be stored after hash mapping, or the URL in the crash data can be stored after hash mapping (Key = Hash(CurrentURL)).

[0053] The event type of the target page indicates the cause of the preset event or the category to which the cause of the preset event belongs. For example, if the event type of the target page is "crash type", the crash type indicates the cause of the crash or the category to which the cause of the crash belongs. The crash cause may be a GPU driver error, a JavaScript infinite loop, an out-of-memory (OOM) error, or a page content error. Another example is the crash type being "occasional crash" or "persistent crash". When the crash cause is a JavaScript infinite loop, the crash type is "persistent crash". When the crash cause is an out-of-memory (OOM) error or a transient GPU error, the crash type is "occasional crash".

[0054] Optionally, storing the current data of the target page displayed in response to the preset event can be done by: using a synchronous commit method to store the current data in a cross-process shared storage area, such as SharedPreferences or MMKV, which is not limited in this embodiment. By using a synchronous commit method to store the current data, rather than asynchronously, the data type can be determined based on the record after successful data storage, ensuring that the record remains accurate even if the target application's process subsequently becomes unstable or is reclaimed by the system.

[0055] Optionally, when the terminal device detects a preset event generated by the processing process through the operating system, the operating system can pass the preset event to the custom processing logic, which then triggers the corresponding processing strategy. Optionally, after receiving the preset event, the custom processing logic can return a specified value to the operating system to intercept the default processing logic.

[0056] In this embodiment, custom processing logic bound to the view component instance is invoked to store the current data of the target page for the preset event that triggers the event display. Based on the record of the target page, the event type of the target page is determined. The record includes the current data. Based on the event type, the corresponding processing strategy is selected for processing. This realizes that different processing strategies are adopted based on different event types, avoiding invalid retries that consume computer resources and improving user experience.

[0057] In some embodiments, the event type is indicated by statistical information, and a corresponding processing strategy is selected based on the event type, including: Based on the statistical information of the target page, select the corresponding processing strategy for processing.

[0058] Among them, statistical information refers to the results obtained by statistically analyzing the data in the records of the target page. For example, it can be the statistical results of the page loading time, the number of records, snapshots, etc. This embodiment does not limit it.

[0059] In some embodiments, the preset event includes a crash event, the current data includes current crash data, the processing process includes a rendering process, and the statistics include the number of crashes within a preset duration. Based on the statistics of the target page, a corresponding processing strategy is selected for processing, including... If the number of crashes is equal to or greater than a preset threshold, the crash will be handled based on the target crash handling strategy. And / or, if the number of crashes is less than a preset threshold, destroy the view component instance and create a new view component instance, and call the new view component instance to trigger the rendering engine in the non-native browser kernel to call the rendering process for rendering.

[0060] The number of crashes within the preset duration can be understood as the number of times data is recorded. The preset duration can be set according to the real-time requirements of the target application for crash response, for example, it can be set to 3 minutes, 4 minutes, or 5 minutes. The preset threshold can be set based on the statistical analysis results of historical crash data. For example, if statistics show that the same webpage crashes 3 or more times in a short period of time, it usually means that there is a persistent failure, then the preset threshold can be set to 2 or 3 times; it can also be dynamically adjusted according to the performance of the client device. For low-memory devices, it can be set to 1 time, but this embodiment does not limit it. The crash type is indicated by the number of crashes within the preset duration. For example, when the number of crashes within the preset duration is equal to or greater than the preset threshold, it indicates that the crash type is a persistent crash; when the number of crashes within the preset duration is less than the preset threshold, it indicates that the crash type is an occasional crash.

[0061] Optionally, the number of crashes within a preset time period can be obtained through a sliding time window algorithm, specifically including: maintaining a queue of crash records sorted by timestamp; setting the sliding window size to a preset time period (e.g., 5 minutes); whenever a new crash record is added or statistics are performed, removing records in the queue whose timestamps are earlier than (the current time window size); and counting the number of records remaining in the queue, which is the number of crashes within the current window.

[0062] The target crash handling strategy refers to the handling strategy set for persistent crashes, which can be configured according to the actual situation. When the number of crashes within a preset time is equal to or greater than a preset threshold, the crash type is considered persistent. When the number of crashes within a preset time is less than the preset threshold, the crash type is considered intermittent, indicating that the crash may be caused by insufficient resources or GPU anomalies. Therefore, recovery can be achieved by destroying the view component instance and creating a new view component instance, and then calling the new view component instance to trigger the rendering engine in the non-native browser kernel to call the rendering process to perform rendering. This achieves silent self-healing with minimal user perception, maintaining the continuity of the experience as much as possible.

[0063] In this embodiment, the preset event includes a crash event, the current data includes current crash data, the processing process includes the rendering process, and the statistical information includes the number of crashes within a preset time period. If the number of crashes is equal to or greater than a preset threshold, processing is performed based on the target crash handling strategy; and / or, if the number of crashes is less than the preset threshold, the view component instance is destroyed and a new view component instance is created, and the new view component instance is called to trigger the rendering engine in the non-native browser kernel to call the rendering process for rendering. This allows the target page to be displayed or restored quickly in the event of an occasional crash, achieving silent self-healing with minimal user perception and maintaining the continuity of the experience as much as possible.

[0064] In some embodiments, processing is based on a target crash handling strategy, including: Display the onboarding interface on the target application; In response to a confirmation action on the onboarding screen, the browser on the electronic device containing the target application is invoked to display the target page; Alternatively, it can be handled based on a target crash handling strategy, including: Based on the page attributes of the target page, select the corresponding crash handling strategy for processing.

[0065] In particular, responding to a cancellation action on the onboarding screen allows users to exit and close the target page. For example... Figure 2 As shown, in response to a user accessing the target page, a view component instance created based on a non-native browser kernel is invoked, triggering the rendering engine in the non-native browser kernel to call the rendering process for rendering. Custom crash handling logic (NativeCrashMonitorWebViewClient) detects whether the rendering process has crashed. If the rendering process has not crashed, the crash count of the target page is reset (the crash count is used to count the number of crashes). If the rendering process has crashed, the default crash handling logic is intercepted, and the current crash data is stored in the crash record. The number of crashes is retrieved from the crash record by sliding a window over time. If the number of crashes is less than a preset threshold, the view component instance is destroyed and a new view component instance is created. The new view component instance is invoked, triggering the rendering engine in the non-native browser kernel to call the rendering process for rendering. If the number of crashes is equal to or greater than the preset threshold, a guide screen is displayed. In response to the confirmation operation on the guide screen, the browser is invoked to display the target page. In response to the cancellation operation on the guide screen, the target page can be exited or closed.

[0066] The page attributes of a target page refer to a set of configurable parameters that describe the structure, style, behavior, and metadata of the target page. For example, the attribute information of a target page may include at least one of the following: the type of the target page (payment type or login type, etc.), the hierarchy of the target page, and the encoding format of the target page. This implementation does not limit these attributes.

[0067] The hierarchy refers to the levels divided according to the belonging and / or function of the target page. The specific content can be set according to the actual situation. For example, the hierarchy can include at least one of independent hosting pages, first-level embedded pages, and deep detail pages. Independent hosting pages are such as activity pages or external link landing pages. First-level embedded pages refer to the homepage tab or information list page of the target application. Deep detail pages refer to second-level article details or product pages, etc. This embodiment does not limit this.

[0068] In this embodiment, a guide interface is displayed on the target application. In response to a confirmation operation on the guide interface, a browser on the electronic device is invoked to display the target page. Alternatively, based on the target page's hierarchy within the target application, a corresponding crash handling strategy is selected to implement a fallback circuit breaker, thereby blocking the retry loop. Furthermore, in the event of frequent crashes, alternative solutions such as the system browser are provided to ensure users can continue to access the target page, reducing user churn. When the target application's process includes multiple view component instances, selecting a corresponding crash handling strategy based on the target page's page attributes can also prevent the crash of a single view component instance from rendering the entire target application's main interface unusable, improving the overall robustness of the target application, ensuring its stability, and minimizing user interference.

[0069] In some embodiments, destroying a view component instance and creating a new view component instance includes: Destroy the view component instance and create a new view component instance after the target duration.

[0070] The target duration can be set to a short time interval to allow the operating system or browser kernel to release resources that may be occupied due to a crash; for example, it can be set to 1 second, 2 seconds, or 3 seconds. Since crashes less than a preset threshold indicate that the crash type is intermittent, the view component instance is destroyed and a new view component instance is created after waiting for the target duration. This further ensures that the new view component instance can trigger successful rendering, thereby achieving a low level of user awareness.

[0071] As can be seen from the above, in the solution of this embodiment, in response to a predetermined event, the access restrictions of the non-native browser kernel are bypassed according to a preset method to obtain a view component instance created based on the non-native browser kernel; custom processing logic is bound to the view component instance; in response to a triggering event, the view component instance is called, triggering the non-native browser kernel to call the processing process for processing; when a preset event is detected in the processing process, the custom processing logic bound to the view component instance is called for processing, thereby bypassing the access restrictions of the non-native browser kernel, so as to bind the view component instance and the custom processing logic, thereby enabling the custom processing logic to be called for processing when the processing process triggered by the non-native browser kernel generates a preset event, thereby ensuring the overall stability and response performance of the host application and avoiding the waste of system resources.

[0072] The following is based on Figure 3 The page crash handling method for the application provided in this application will be further described. In this embodiment, the SDK is used as a non-native browser kernel for the description, and the custom crash handling logic is used as an example of the custom handling logic for the description.

[0073] Step 301: In response to the launch of the target application, the terminal device initializes the non-native browser kernel within the target application to create view component instances.

[0074] Step 302: During the initialization process, the terminal device uses reflection to penetrate the encapsulation layer of the non-native browser kernel in order to obtain the view component instance.

[0075] Step 303: The terminal device binds the custom crash handling logic to the view component instance.

[0076] Step 304: In response to the trigger event on the target page of the target application, the terminal device calls the view component instance, triggering the rendering engine in the non-native browser kernel to call the instance rendering process of the target application for rendering.

[0077] Step 305: When the terminal device detects a rendering process crash, it calls the custom crash handling logic bound to the view component instance and stores the current crash data of the target page.

[0078] Step 306: The terminal device determines the number of crashes of the target page based on the crash records of the target page. The crash records include the current crash data.

[0079] Step 307: If the number of crashes on the terminal device is equal to or greater than the preset threshold, and the target page is an independent hosting page of the target application, a retry operation is performed; if the target page is a first-level embedded page of the target application, the view component instance is destroyed and a new view component instance is created based on the snapshot of the target page, the new view component instance is called, and the rendering engine in the non-native browser kernel is triggered to call the rendering process for rendering; if the target page is a deep detail page of the target application, the user is returned to the previous screen.

[0080] Step 308: If the number of crashes on the terminal device is less than a preset threshold, the view component instance is destroyed and a new view component instance is created. The new view component instance is then invoked, triggering the rendering engine in the non-native browser kernel to call the rendering process for rendering.

[0081] For the explanation of terms, specific implementation methods, and corresponding beneficial effects of this embodiment, please refer to the above method embodiment. This embodiment will not be repeated here.

[0082] This embodiment also provides an event processing device applied to an electronic device, the electronic device including a target application, and the event processing device being, for example, as shown in the example... Figure 4 As shown, the event handling device may include: The bypass module 401 is used to bypass access restrictions of non-native browser kernels in response to a predetermined event, in order to obtain view component instances created based on non-native browser kernels.

[0083] Binding module 402 is used to bind custom processing logic to view component instances.

[0084] Module 403 is invoked in response to a trigger event, which invokes a view component instance and triggers a non-native browser kernel to call a processing process for handling.

[0085] The processing module 404 is used to call the custom processing logic bound to the view component instance to perform processing when a preset event is detected in the processing process.

[0086] In some embodiments, the processing module 404 is specifically used to perform: Based on the page attributes of the target page that is triggered by the event, select the corresponding processing strategy for processing.

[0087] In some embodiments, the default event is a crash event, and the custom processing logic includes custom crash processing logic.

[0088] In some embodiments, page attributes include the hierarchy of the target page within the target application, the processing process includes a rendering process, and processing module 404 is specifically used to execute: If the target page displayed when the event is triggered is a standalone page of the target application, a retry operation will be performed. And / or, if the target page is a first-level embedded page of the target application, destroy the view component instance and create a new view component instance based on a snapshot of the target page, invoke the new view component instance, and trigger the rendering engine in the non-native browser kernel to invoke the rendering process for rendering. And / or, if the target page is a deep detail page of the target application, go back to the previous screen.

[0089] In some embodiments, the processing module 404 is specifically used to perform: Invoke the custom processing logic bound to the view component instance, and store the current data of the target page for the preset event that is triggered and displayed; Based on the records of the target page, determine the event type of the target page, and the records include the current data; The appropriate processing strategy is selected based on the event type.

[0090] In some embodiments, the event type is indicated by statistical information, and the processing module 404 is specifically used to perform: Based on the statistical information of the target page, select the corresponding processing strategy for processing.

[0091] In some embodiments, the preset event includes a crash event, the current data includes current crash data, the processing process includes a rendering process, and the statistics are indicated by the number of crashes within a preset duration. The processing module 404 is specifically used to execute: If the number of crashes is equal to or greater than a preset threshold, the crash will be handled based on the target crash handling strategy. And / or, if the number of crashes is less than a preset threshold, destroy the view component instance and create a new view component instance, and call the new view component instance to trigger the rendering engine in the non-native browser kernel to call the rendering process for rendering.

[0092] In some embodiments, the processing module 404 is specifically used to perform: Display the onboarding interface on the target application; In response to a confirmation action on the onboarding screen, the browser on the electronic device containing the target application is invoked to display the target page; In some embodiments, the processing module 404 is specifically used to perform: Based on the page attributes of the target page, select the corresponding crash handling strategy for processing.

[0093] In some embodiments, the processing module 404 is specifically used to perform: Destroy the view component instance and create a new view component instance after the target duration.

[0094] In some embodiments, a non-native browser kernel is integrated into the target application in the form of a software development kit, and the breakthrough module 401 is specifically used to execute: In response to a predetermined event, the encapsulation layer of the software development kit in the target application is penetrated using a reflection mechanism or a view recursive traversal algorithm.

[0095] In practice, each of the above modules can be implemented as an independent entity or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation methods and corresponding beneficial effects of each of the above modules, please refer to the previous method embodiments, which will not be repeated here.

[0096] Accordingly, this disclosure also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.

[0097] like Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. The electronic device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0098] The processor 501 is the control center of the electronic device 500. It connects various parts of the electronic device 500 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 502, and by calling data stored in the memory 502, it executes various functions and processes data of the electronic device 500, thereby providing overall monitoring of the electronic device 500. The processor 501 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic diagrams disclosed in the embodiments of this disclosure.

[0099] In this embodiment of the disclosure, the processor 501 in the electronic device 500 loads the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 runs the application programs stored in the memory 502 to realize various functions, such as: In response to a predetermined event, it bypasses access restrictions of non-native browser kernels in a preset manner to obtain view component instances created based on non-native browser kernels; Bind custom processing logic to view component instances; In response to the triggered event, the view component instance is invoked, triggering the non-native browser kernel to call the processing process for handling; If a preset event is detected during the processing, the custom processing logic bound to the view component instance is invoked for processing.

[0100] The specific implementation of each of the above operations and their corresponding beneficial effects can be found in the previous embodiments, and will not be repeated here.

[0101] Optionally, such as Figure 5As shown, the electronic device 500 also includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0102] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.

[0103] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.

[0104] Audio circuitry 505 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and then processed by processor 501 before being transmitted via radio frequency circuitry 504 to, for example, another electronic device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.

[0105] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0106] Power supply 507 is used to supply power to various components of electronic device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0107] although Figure 5 As not shown in the diagram, the electronic device 500 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0108] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0109] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0110] Therefore, embodiments of this disclosure provide a computer-readable storage medium storing a plurality of computer programs, which can be loaded by a processor to execute any of the event handling methods provided in embodiments of this disclosure. The computer program can execute the steps of the following event handling method: In response to a predetermined event, it bypasses access restrictions of non-native browser kernels in a preset manner to obtain view component instances created based on non-native browser kernels; Bind custom processing logic to view component instances; In response to the triggered event, the view component instance is invoked, triggering the non-native browser kernel to call the processing process for handling; If a preset event is detected during the processing, the custom processing logic bound to the view component instance is invoked for processing.

[0111] The specific implementation of each of the above operations and their corresponding beneficial effects can be found in the previous embodiments, and will not be repeated here.

[0112] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0113] Since the computer program stored in the computer-readable storage medium can execute any of the event handling methods provided in the embodiments of this disclosure, the beneficial effects that any of the event handling methods provided in the embodiments of this disclosure can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0114] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.

[0115] In the above embodiments of the event processing apparatus, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the event processing apparatus, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the event processing method in the above embodiments, and will not be repeated here.

[0116] The foregoing has provided a detailed description of an event processing method, apparatus, electronic device, computer-readable storage medium, and computer program product provided by the embodiments of this disclosure. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An event handling method, characterized in that, The method includes: In response to a predetermined event, the access restrictions of non-native browser kernels are bypassed in a preset manner to obtain view component instances created based on the non-native browser kernel; Bind the custom processing logic to the view component instance; In response to the triggering event, the view component instance is invoked, triggering the non-native browser kernel to call the processing process for processing; If a preset event is detected in the processing process, the custom processing logic bound to the view component instance is invoked for processing.

2. The method according to claim 1, characterized in that, The call is processed by the custom processing logic bound to the view component instance, including: Based on the page attributes of the target page that is triggered by the event, the corresponding processing strategy is selected for processing.

3. The method according to claim 2, characterized in that, The preset event is a crash event, and the custom processing logic includes custom crash processing logic.

4. The method according to claim 3, characterized in that, The page attributes include the target page's hierarchy within the target application, the processing process includes a rendering process, and the selection of a corresponding processing strategy based on the page attributes of the target page triggered by the triggering event includes: If the target page displayed after the triggering event is an independent hosting page of the target application, a retry operation is performed; And / or, if the target page is a first-level embedded page of the target application, destroy the view component instance and create a new view component instance based on a snapshot of the target page, call the new view component instance, and trigger the rendering engine in the non-native browser kernel to call the rendering process for rendering; And / or, if the target page is a deep details page of the target application, return to the previous screen.

5. The method according to claim 1, characterized in that, The call is processed by the custom processing logic bound to the view component instance, including: Invoke the custom processing logic bound to the view component instance, and store the current data of the target page displayed by the triggering event in response to the preset event; Based on the records of the target page, determine the event type of the target page, wherein the records include the current data; The corresponding processing strategy is selected based on the event type.

6. The method according to claim 5, characterized in that, The event type is indicated by statistical information, and the step of selecting a corresponding processing strategy based on the event type includes: Based on the statistical information of the target page, the corresponding processing strategy is selected for processing.

7. The method according to claim 6, characterized in that, The preset events include crash events, the current data includes current crash data, the processing process includes rendering processes, the statistics include the number of crashes within a preset time period, and the step of selecting a corresponding processing strategy based on the statistics of the target page includes... If the number of crashes is equal to or greater than a preset threshold, the crash will be handled based on the target crash handling strategy. And / or, if the number of crashes is less than a preset threshold, destroy the view component instance and create a new view component instance, and call the new view component instance to trigger the rendering engine in the non-native browser kernel to call the rendering process for rendering.

8. The method according to claim 7, characterized in that, The processing based on the target crash handling strategy includes: Display the onboarding interface on the target application; In response to the confirmation operation of the onboarding interface, the browser on the electronic device where the target application is located is invoked to display the target page.

9. The method according to claim 7, characterized in that, The processing based on the target crash handling strategy includes: Based on the page attributes of the target page, the corresponding processing strategy is selected for processing.

10. The method according to claim 7, characterized in that, Destroying the view component instance and creating a new view component instance includes: After the target duration, destroy the view component instance and create a new view component instance.

11. The method according to any one of claims 1-10, characterized in that, The non-native browser kernel is integrated into the target application in the form of a software development kit. The step of bypassing the access restrictions of the non-native browser kernel in response to a predetermined event and according to a preset method includes: In response to a predetermined event, the encapsulation layer of the software development kit in the target application is penetrated using a reflection mechanism or a view recursive traversal algorithm.

12. An event processing device, characterized in that, The device includes: The breakthrough module is used to respond to a predetermined event and break through the access restrictions of the non-native browser kernel in a preset manner in order to obtain the view component instance created based on the non-native browser kernel. The binding module is used to bind custom processing logic to the view component instance; The calling module is used to respond to the triggering event, call the view component instance, and trigger the non-native browser kernel to call the processing process for processing; The processing module is used to call the custom processing logic bound to the view component instance to perform processing when a preset event is detected in the processing process.

13. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps of the event handling method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the event handling method as described in any one of claims 1 to 11.