Application of anomaly detection methods, electronic devices and readable storage media
By detecting grayscale values and standard deviations when the application starts to identify interface anomalies, and capturing and uploading on-site logs, the problem of difficulty in obtaining detailed logs in existing technologies is solved, thus improving the accuracy and efficiency of anomaly analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2023-12-29
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, when an application displays an anomaly during startup, developers often struggle to obtain detailed on-site logs, leading to low accuracy and efficiency in analyzing and locating the problem.
When the application starts, it detects the grayscale value and standard deviation of the currently displayed interface to determine if the interface is abnormal. If an abnormality occurs, it sends information to the server to capture the on-site logs. After exiting the application, it uploads the relevant logs to the server.
It enables timely detection of interface anomalies and acquisition of detailed on-site logs when the application starts, improving the accuracy and efficiency of analyzing and locating anomalies and reducing false alarms.
Smart Images

Figure CN118502997B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic technology, and in particular to an application anomaly detection method, electronic device, and readable storage medium. Background Technology
[0002] Electronic devices typically have multiple applications (apps) installed. An electronic device can launch one of these applications; however, display anomalies may occur during launch, such as displaying a completely black screen instead of the normal application interface. In such cases, it's usually necessary to capture the electronic device's logs, which developers can then analyze to determine the cause of the problem.
[0003] However, currently, users need to exit the first application and then upload the logs to the server through other logging software so that developers can obtain the logs. Since logs are continuously generated, previously saved logs will be overwritten by later saved logs. In the current method, the logs obtained by developers are the logs after the exception occurs, rather than the logs when the application starts with an exception. This makes it difficult for developers to accurately analyze and locate the cause of the exception. Summary of the Invention
[0004] This application provides an application anomaly detection method, electronic device, and readable storage medium. For scenarios where application startup may result in display anomalies, it can capture detailed logs for accurate analysis and location. The technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide an application anomaly detection method, applied to an electronic device, wherein the electronic device communicates with a server, the method comprising: the electronic device detecting a first operation by a user requesting to launch a first application; in response to the first operation, initiating the lifecycle of the first application, and after the lifecycle of the first application enters the interface display stage, determining whether the current display interface of the first application is abnormal; if the current display interface of the first application is abnormal, sending first information to the server, the first information instructing the server to capture logs related to the interface of the first application; after the server completes the capture, sending the logs related to the interface of the first application to the server; and exiting the first application.
[0006] In this embodiment, after entering the lifecycle interface display stage of the first application and before exiting the first application, the electronic device determines whether the current display interface of the first application is abnormal, enabling timely detection of abnormal application interface display scenarios. Then, in the case of an abnormal current display interface of the first application, the electronic device reports the abnormal situation to the server (i.e., sends the first information). The server promptly captures detailed on-site logs of the current display interface abnormality. After the server completes the capture, the electronic device sends the logs related to the interface of the first application to the server. Thus, developers can obtain detailed on-site logs of the application startup interface display abnormality from the server, and analyze and locate the cause of the abnormality based on the on-site logs, thereby improving accuracy and efficiency.
[0007] In conjunction with the first aspect mentioned above, some implementations of the first aspect determine whether the current display interface of the first application is abnormal after the first application enters the interface display phase of its lifecycle. This includes determining whether the current display interface of the first application is abnormal after a preset time period following the entry of the first application into the interface display phase. This can filter out display problems caused by factors such as network connectivity, enabling more accurate identification of interface display abnormalities caused by applications, systems, etc., and reducing false alarms.
[0008] In conjunction with the first aspect described above, some implementations of the first aspect determine whether the current display interface of the first application is abnormal, including: obtaining the grayscale values of multiple pixels in the current display interface of the first application; and determining whether the current display interface of the first application is abnormal based on the grayscale values of the multiple pixels. Abnormal interfaces include black screens, white screens, etc., and the grayscale values of pixels in abnormal interfaces and normal interfaces differ significantly. This allows for quick and accurate determination of whether the current display interface of the first application is abnormal.
[0009] In conjunction with the first aspect mentioned above, some implementations of the first aspect determine whether the current display interface of the first application is abnormal based on the grayscale values of multiple pixels. This includes: calculating the standard deviation based on the grayscale values of multiple pixels; determining that the current display interface of the first application is abnormal if the standard deviation is greater than or equal to a first threshold; or determining that the current display interface of the first application is normal if the standard deviation is less than the first threshold. A larger standard deviation indicates a more concentrated (singular) color, suggesting the current display interface may be a pure black or pure white screen; a smaller standard deviation indicates a more dispersed color distribution, containing more color types, suggesting the current display interface may be the desktop or another normally displayed interface. This allows for quick and accurate determination of whether the current display interface of the first application is abnormal.
[0010] In conjunction with the first aspect mentioned above, in some implementations of the first aspect, determining that the current display interface of the first application is abnormal when the standard deviation is greater than or equal to a first threshold includes: determining a first ratio of the number of pixels with a grayscale value of 0 to the total number of pixels in the current display interface, and a second ratio of the number of pixels with a grayscale value of 255 to the total number of pixels in the current display interface; determining that the current display interface of the first application is abnormal when the first ratio is greater than or equal to the second threshold, or when the second ratio is greater than or equal to the second threshold; or determining that the current display interface of the first application is normal when both the first ratio and the second ratio are less than the second threshold. Here, a grayscale value of 0 represents a pure black block, and a grayscale value of 255 represents a pure white block. Calculating the ratio of pure black blocks to pure white blocks can filter out scenarios with large standard deviations but where the current display interface is not abnormal, thereby reducing false alarms.
[0011] In conjunction with the first aspect described above, some implementations of the first aspect further include: obtaining the identifier of the first application; and determining a first threshold corresponding to the first application based on the identifier of the first application. Different first thresholds can be set for different applications, which enables dynamic differentiation and more accurate detection of whether the application interface is abnormal.
[0012] In conjunction with the first aspect described above, in some implementations of the first aspect, the first information includes the identifier and exception type of the first application, and corresponding logs and exception types related to the interface of the first application. Different exception types correspond to different log contents captured by the server. After receiving the first information, the server captures logs related to the interface of the first application from the electronic device based on the identifier and exception type of the first application, and stores them in categories. This helps developers quickly identify exception types and locate the required logs.
[0013] In conjunction with the first aspect above, in some implementations of the first aspect, the electronic device includes a first interface, which is used by the server in response to receiving the first information to capture logs related to the interface of the first application.
[0014] In conjunction with the first aspect above, in some implementations of the first aspect, the logs related to the interface of the first application include streaming logs, event logs, kernel logs, snapshot logs, and logs related to the load, performance, heat generation, and network connectivity of the electronic device.
[0015] In a second aspect, embodiments of this application provide an electronic device, including: one or more processors; one or more memories; the memories storing one or more programs, which, when executed by the processors, cause the electronic device to perform the method described in the first aspect or any one of the first aspects.
[0016] Thirdly, embodiments of this application provide an apparatus included in an electronic device, which has the function of implementing the behaviors of the electronic device in the above aspects and possible implementations thereof. The functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a display module or unit, a detection module or unit, a processing module or unit, etc.
[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect or any one of the first aspects.
[0018] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the method described in the first aspect or any one of the first aspects.
[0019] In a sixth aspect, embodiments of this application provide a chip or chip system, which includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the method described in the first aspect or any one of the first aspects.
[0020] The technical effects achieved by the second, third, fourth, fifth, and sixth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0021] Figure 1 This illustration shows an example application scenario provided by an embodiment of this application.
[0022] Figure 2 This illustration shows another application scenario provided by an embodiment of this application;
[0023] Figure 3 An example software structure block diagram provided in an embodiment of this application is shown;
[0024] Figure 4 A flowchart illustrating an example of an anomaly detection method provided in an embodiment of this application is shown.
[0025] Figure 5 This illustration shows yet another scenario provided by an embodiment of this application;
[0026] Figure 6 This illustration shows a flowchart of another example of an anomaly detection method provided in an embodiment of this application;
[0027] Figure 7 A schematic diagram of the structure of an example electronic device provided in an embodiment of this application is shown;
[0028] Figure 8 A schematic diagram of the structure of an example device provided in an embodiment of this application is shown;
[0029] Figure 9 A schematic diagram of the structure of an example chip provided in an embodiment of this application is shown. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings. Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.
[0031] Electronic devices typically have multiple applications installed, such as Figure 1 As shown in (a), the desktop of an electronic device can display icons for multiple applications, such as file management application icons, email application icons, weather application icons, voice recorder application icons, music application icons, settings application icons, address book application icons, phone application icons, messaging application icons, and video application icons, etc.
[0032] Users can interact with the first application icon through touch, such as by clicking or long-pressing. This allows the electronic device to receive the touch input and launch the first application for user access. The first application can be any one of several applications installed on the electronic device; for example, it could be a video application.
[0033] However, upon first application launch, an abnormal situation may occur where the normal application interface is not displayed. For example, in some cases, such as... Figure 1 As shown in (b), after the first application is launched, the application interface displayed on the electronic device may be a completely black screen. For example, in some cases, such as... Figure 1As shown in (c), after the first application is launched, the application interface displayed on the electronic device may be a pure white screen. For example, in some cases, such as... Figure 1 As shown in (d), the application may get stuck on the splash screen (a frame of the startup animation) during startup.
[0034] When an application interface display error occurs upon initial application startup, it's typically necessary to capture the device's logs so developers can analyze the cause of the error. However, currently, this requires the user to exit the initial application and then upload the logs to a server using other logging software. Since logs are continuously generated, there are time and size limitations for storage; older logs are overwritten by newer ones after a certain period. Therefore, the current method only provides developers with logs from after the error occurred, not the logs from the initial startup when the error occurred. Furthermore, the retrieved logs are incomplete, hindering developers' ability to accurately analyze and pinpoint the cause of the error. In short, there is currently a lack of effective monitoring and testing methods for display errors.
[0035] In view of this, embodiments of this application provide an application anomaly detection method, applied to an electronic device. After the electronic device detects a user's request to launch a first application, in response to the first operation, the electronic device enters the first application's launch lifecycle. After the first application's lifecycle enters the interface display stage, it determines whether the current display interface of the first application is abnormal. If the current display interface of the first application is abnormal, the electronic device sends first information to the server, the first information instructing the server to capture logs related to the interface of the first application. After the server completes the capture, the electronic device sends the logs related to the interface of the first application to the server. The electronic device then exits the first application.
[0036] In this embodiment, after entering the lifecycle interface display stage of the first application and before exiting the first application, the electronic device determines whether the current display interface of the first application is abnormal, enabling timely detection of abnormal application interface display scenarios. Then, in the case of an abnormal current display interface of the first application, the electronic device reports the abnormal situation to the server (i.e., sends the first information). The server promptly captures detailed on-site logs of the current display interface abnormality. After the server completes the capture, the electronic device sends the logs related to the interface of the first application to the server. Thus, developers can obtain detailed on-site logs of the application startup interface display abnormality from the server, and analyze and locate the cause of the abnormality based on the on-site logs, thereby improving accuracy and efficiency.
[0037] The application anomaly detection method provided in this application embodiment is applied to electronic devices. For example... Figure 2As shown, the electronic device 100 is communicatively connected to the server 200 (i.e., the cloud side). The server 200 can be a single server, a server cluster, a distributed server, a centralized server, or a cloud server.
[0038] Electronic device 100 may be, but is not limited to, mobile phones, tablets, handheld computers, laptops, in-vehicle devices, ultra-mobile personal computers (UMPCs), netbooks, cellular phones, personal digital assistants (PDAs), augmented reality (AR) / virtual reality (VR) devices, etc., and this application embodiment does not limit it.
[0039] The electronic device 100 includes a first application and a display unit. After the first application starts, it sends an event notification to the display unit to enable the display unit to perform anomaly detection. The display unit can detect whether the first application has a display anomaly. In the case of a display anomaly, it records a point and sends first information to the server 200. The first information is used to report that the first application has a display anomaly. The first information may include the point type and the identifier of the first application, so that the server 200 can capture the corresponding on-site logs. The log content that the server needs to capture differs depending on the anomaly of the electronic device. The anomaly type can be identified by the point type. Different anomalies correspond to different point types. In this embodiment, the electronic device 100 adds a point type specifically to distinguish application display anomalies, helping developers quickly identify the anomaly type. Point recording refers to recording the occurrence of a behavior / state that needs to be collected.
[0040] Server 200 includes a log acquisition unit (hiview) and a data processing unit. The log acquisition unit receives information reported by electronic device 100, and then immediately captures the on-site logs from electronic device 100. Electronic device 100 provides a first interface through which the log acquisition unit can automatically capture the on-site logs. After capture is complete, electronic device 100 uploads the captured on-site logs to server 200.
[0041] It should be understood that logs are a record of the operation of applications and systems, and can contain various system events, fault information, operation records, user behavior information, and activity logs of electronic devices 100. Each message in the log contains a tag indicating which part of the system or application the message came from: a timestamp (when the log occurred), a log level (log priority), and log content (a detailed description of the error, exception, or information, etc.).
[0042] In this embodiment, all application logs can be obtained, or primarily the on-site log content related to the currently malfunctioning application interface can be obtained. Specifically, this may include: applog (current display exception log), eventlog (current display exception log), kernellog (current display exception log), histogram data, module logs, and snapshot logs. The applog records the application's running state and events; the eventlog mainly records system lifecycle calls, application process creation and destruction; the kernellog mainly records driver-related content, recording the system kernel's running state and events, or messages generated by kernel operations loading kernel modules. The histogram data includes the grayscale values of multiple pixels in the interface.
[0043] Module logs include activity information for each module related to the interface, specifically including: Systrace (capturing Systrace can collect process activity information, such as interface layout, user interface rendering, etc.), load information (such as the memory usage of electronic devices), performance data of electronic devices, heat generation of electronic devices, network connectivity of electronic devices, etc.
[0044] Snapshot logs can provide detailed information about the interface, such as interface hierarchy and controls. Specific content may include: janklog, bugreport, eventinfo, dumpsys, properties, sensor, etc.
[0045] Server 200 receives field logs from electronic device 100. The data processing unit can store the field logs and includes a data display module for integrating and displaying the field logs for developers to view; a log parsing module for parsing the logs; an automated analysis conclusion module for performing preliminary analysis of the logs and providing analysis conclusions for developers to refer to; and a log download module for providing a download channel for the field logs.
[0046] The application anomaly detection method provided in this application embodiment will be described below in conjunction with the software system of electronic device 100.
[0047] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100. It should be noted that, in this embodiment, the operator system of the electronic device may include, but is not limited to, [other types of systems]. (Symbian) (Android) (iOS) This application does not limit the scope of operating systems such as Blackberry and HarmonyOS.
[0048] Figure 3 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0049] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided from top to bottom into the application layer, application framework layer, hardware abstraction layer, kernel layer, and hardware layer.
[0050] The application layer can include a series of application packages. For example... Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0051] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0052] like Figure 3 As shown, the application framework layer may include DisplayEngineService, window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0053] The display engine service is used to receive event notifications from the application layer and send the event notifications to the display engine, including triggering the display engine to perform anomaly detection after the application starts and triggering the display engine to disable anomaly detection after the application exits.
[0054] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0055] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0056] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0057] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0058] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0059] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0060] The Hardware Abstraction Layer (HAL) includes at least a Display Engine. The Display Engine acquires histogram data, detects anomalies in the application's displayed interface based on the histogram data, and reports anomalies. In other words, detection, judgment, and reporting are all performed at the Hardware Abstraction Layer.
[0061] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0062] The hardware layer can include displays, graphics processors, etc. Display engine services, display engines, display drivers, and displays all belong to the display unit.
[0063] Figure 4 This is a flowchart illustrating an anomaly detection method provided in an embodiment of this application. The method is applied to an electronic device, which... Figure 3 The interaction between the nodes is shown. Figure 4 The application anomaly detection method shown includes S401 to S415, which are described in detail below.
[0064] S401, in response to the first operation, the electronic device begins to launch the first application.
[0065] When a user wants to use the first application, they can perform a first operation to request the launch of the first application. The first operation can be clicking the application icon or a voice operation, and this application embodiment does not limit this.
[0066] S402, after entering the onResume stage of the lifecycle, sends the first application startup information to the display engine service.
[0067] After an electronic device detects the user's first action, it responds by launching the first application. It should be understood that application launch requires a lifecycle (Activity), sequentially passing through onCreate, onStart, onResume, onPause, onStop, and onDestruction. Specifically, onCreate indicates that the Activity is being created, during which it is initialized and necessary settings are performed; onStart indicates that the Activity is being launched, but it is in the background and not yet in the foreground, so there is no interface to interact with the user; onResume indicates that the Activity is now visible, in the foreground, and can interact with the user; onPause indicates that the Activity is stopping; onStop indicates that the Activity is about to stop; and onDestruction indicates that the Activity is about to be destroyed.
[0068] The first application only displays the interface after entering the onResume lifecycle. Therefore, after entering the onResume lifecycle, the first application sends the first application startup information to the display engine service, and then the display engine obtains the grayscale values of multiple pixels of the currently displayed interface to detect display abnormalities.
[0069] In some implementations, considering that the network connection status and performance of electronic devices can also affect the interface display, this embodiment can send the first application startup information to the display engine service after the lifecycle enters onResume and a preset time period has elapsed. For example, the preset time period can be 5 seconds or 6 seconds; this application does not limit this. If the user exits the first application before entering onResume and the preset time period has elapsed, this method will not be executed. In this way, display problems caused by network connection status, performance, etc., can be filtered out, enabling more accurate identification of interface display anomalies caused by applications, systems, etc., and reducing false alarms.
[0070] S403, after receiving the information from the first application, the display engine service sends an instruction to the display engine to obtain the histogram data of the current display interface.
[0071] The display engine service can start control threads for some display-related features (such as elvss, apl_hdr, etc.) to trigger the lower layer to obtain the histogram data of the current display interface.
[0072] In this embodiment, the presence of an abnormal display is determined by analyzing the grayscale values of multiple pixels on the current display interface. The hardware can return the grayscale values of these multiple pixels to the upper layer in the form of a histogram. Here, the histogram refers to a grayscale histogram, also known as a gray-level histogram. It is a function of the grayscale distribution, a statistical representation of the grayscale distribution in an image, indicating the number of pixels with a certain grayscale level and reflecting the frequency of that grayscale value in the image.
[0073] Of course, the display engine service can also send a command to the display engine to retrieve the grayscale values of multiple pixels on the current display interface. The hardware can directly return the grayscale values of multiple pixels, which the display engine can then analyze. Alternatively, the grayscale values of multiple pixels can be represented in other forms.
[0074] S404: The display engine sends a command to the display driver to obtain the histogram data of the current display interface.
[0075] The display engine enables display-related features through configuration data and notifies the display driver to obtain the histogram data of the current display interface.
[0076] S405, the display driver sends a command to the hardware to obtain the histogram data of the current display interface.
[0077] The display driver can write data into the memory to configure it so that the hardware can function properly.
[0078] S406, the hardware acquires the histogram data of the currently displayed interface.
[0079] Display-related hardware can acquire and count the grayscale values of multiple pixels to obtain histogram data, including the grayscale value of each pixel and the number of times each grayscale value appears.
[0080] S407, the hardware sends the histogram data of the current display interface to the display driver.
[0081] After obtaining the histogram data of the current display interface, the hardware sends the histogram data of the current display interface to the display engine through the display driver.
[0082] S408, the display driver sends the histogram data of the current display interface to the display engine.
[0083] S409, the display engine determines whether the interface currently displayed by the first application is abnormal based on the histogram data of the current display interface.
[0084] After obtaining the histogram data of the currently displayed interface, the display engine determines whether the currently displayed interface of the first application is abnormal. If the current interface of the first application is abnormal, the display engine reports the abnormality to the server, and then the first application can be triggered to exit. If the current interface of the first application is displayed normally, the process is closed, and the user can use the first application normally.
[0085] Specifically, determining whether the currently displayed interface of the first application is abnormal includes: the display engine calculates the standard deviation σ based on the histogram data; when the standard deviation is greater than or equal to a first threshold, the currently displayed interface of the first application is determined to be abnormal; when the standard deviation is less than the first threshold, the currently displayed interface of the first application is determined to be normal.
[0086] Standard deviation, also known as experimental standard deviation, is most commonly used in probability and statistics as a measure of the degree of statistical distribution. In the embodiments of this application, the larger the standard deviation, the more concentrated (single) the colors are, and the current display interface may be a pure black screen or a pure white screen; the smaller the standard deviation, the more dispersed the colors are, and the more types of colors are included, and the current display interface may be the desktop or other normally displayed interface. The standard deviation σ can be calculated by the following formula (1).
[0087]
[0088] Where n is the total number of pixels. It is the average grayscale value of multiple pixels. = The sum of the grayscale values of each pixel / 256. i Let represent the grayscale value of the i-th pixel, where n ≥ i ≥ 1. That is, first calculate the sum of the grayscale values of all pixels, then calculate the average grayscale value. Calculate the difference between each grayscale value and the average value, square each difference, calculate the average of the squared differences to obtain the variance, and take the square root of the average value to obtain the standard deviation.
[0089] In some implementations, different first thresholds can be set for different applications, and the electronic device stores the correspondence between application identifiers and first thresholds. This enables dynamic differentiation and more accurate detection of whether the application interface is abnormal. The above method also includes: determining the first threshold corresponding to the first application based on the identifier of the first application.
[0090] The display engine can look up the corresponding first threshold based on the identifier of the first application after obtaining the histogram data, or it can look up the corresponding first threshold based on the identifier of the first application after calculating the standard deviation σ, or it can look up the corresponding first threshold based on the identifier of the first application after receiving the instruction to obtain histogram data.
[0091] The identifier of the first application can be the name of the Activity or the application identifier (IdentityDocument, id), and this application does not limit this. The specific value of the first threshold is not limited in this application; for example, it could be 21000.
[0092] In some implementations, determining whether the currently displayed interface of the first application is abnormal includes: based on histogram data, determining a first ratio of the number of pixels with a grayscale value of 0 to the total number of pixels in the currently displayed interface, and a second ratio of the number of pixels with a grayscale value of 255 to the total number of pixels in the currently displayed interface; if the first ratio is greater than or equal to a second threshold, or if the second ratio is greater than or equal to a second threshold, determining that the currently displayed interface of the first application is abnormal; if both the first and second ratios are less than the second threshold, determining that the currently displayed interface of the first application is normal. Here, a grayscale value of 0 represents a pure black block, and a first ratio greater than or equal to the second threshold indicates that the currently displayed interface is a black screen; a grayscale value of 255 represents a pure white block, and a second ratio greater than or equal to the second threshold indicates that the currently displayed interface is a white screen. The second threshold can be 95%, 96%, or other values; this application does not limit this.
[0093] In some scenarios, the standard deviation determined by the grayscale values of the interface pixels exceeds a first threshold, but the interface is considered a normally displayed interface rather than an abnormally displayed one. For example, in some reading applications, users can set the page to a solid color background and choose between day mode and dark mode. When the reading application starts, the currently displayed interface might look like this: Figure 5 The interface shown is as follows: Figure 5 As shown in (a) in the image, the screen appears almost pure white in daytime mode (but it is not actually pure white), as... Figure 5 As shown in (b) in the dark mode, the screen is close to pure black (but not actually pure black). The standard deviation calculated in this scenario is relatively large, but the current display interface is not an abnormal display scenario. In this case, this scenario can be filtered out by calculating the ratio of pure black blocks to pure white blocks, thereby reducing false alarms.
[0094] In some implementations, determining whether the interface currently displayed by the first application is abnormal includes: calculating the standard deviation, a first ratio, and a second ratio based on histogram data; determining that the interface currently displayed by the first application is abnormal if the standard deviation is greater than or equal to a first threshold and the first ratio is greater than or equal to a second threshold, or if the standard deviation is greater than or equal to the first threshold and the second ratio is greater than or equal to the second threshold; and determining that the interface currently displayed by the first application is normal if the standard deviation is less than the first threshold, or if the standard deviation is greater than or equal to the first threshold and the first ratio and the second ratio are less than the second threshold.
[0095] S410: In the event of an abnormality in the currently displayed interface of the first application, the display engine sends the first message to the server.
[0096] The first information is used to instruct the server to retrieve logs related to the abnormal display of the interface of the first application. The first information may include the logging type and the identifier of the first application. After receiving the first information, the server retrieves the on-site logs related to the abnormal display of the interface of the first application from the electronic device 100 according to the identifier of the first application and the logging type. After the retrieval is completed, the electronic device 100 uploads the retrieved on-site logs to the server 200.
[0097] Optionally, in some embodiments, after step S410, the above-described application anomaly detection method may further include the following steps S411-S415.
[0098] After S411 reports the abnormal situation to the server, the display engine can send an abnormal notification to the system so that the system can close the first application.
[0099] Alternatively, in S412, the first application sends a message to the display engine service indicating that the first application has exited.
[0100] In some cases, users can exit the primary application voluntarily through touch operations, such as swiping left or up on the screen. In response to user actions, the primary application can enter the exit process. The Activity executes the onPause, onStop, and onDeadly processes. There is no time limit for the user to voluntarily exit the application.
[0101] S413, the display engine service sends a command to the display engine to shut down the control thread.
[0102] S414, the display engine sends a command to the display driver to disable features.
[0103] S415, Display driver configuration memory data, to clear data in the hardware related to this test.
[0104] Figure 6 This is a flowchart illustrating another application anomaly detection method provided in an embodiment of this application. The method... Figure 3 The interaction between the display engine service and the display engine will be further explained. Figure 6 The application anomaly detection method shown includes S601 to S607, and S601 to S607 are described in detail below.
[0105] S601, in response to the user's first operation, the electronic device starts the first application. After the Activity enters onResume in its lifecycle and 5 seconds later, the Activity sends the first application launch information to the HistogramProcessor module in the display engine service. Specifically, the Activity executes the black and white screen detection entry mode in the configuration switch setScene and sends the black and white screen detection entry (DE_SCENE_ACTION_BLACK_WHITE_ENTER) information to the histogramprocessor module.
[0106] S602, the histogram processing module calls the onchange method in real time to monitor interface changes. After receiving the information that a black and white screen has been detected, the histogram processing module searches for the file in the display engine implementation class (DisplayEnginelmlp) under the display engine list under the display engine service list. In the file named handleSceneParam, the configuration item is set: data.param[ALGO_BLACK_SCREEN_DETECTION] = 1. Then the configuration item is passed to the histogram management class HistogramManager in the display engine.
[0107] S603, the histogram management class determines whether the value in the configuration item data.param[ALGO_BLACK_SCREEN_DETECTION] is 1. If the value in the configuration item is 0, the process ends. If the value in the configuration item is 1, it is sent to the implementation class BlackScreenCheckListenerThreadlmpl for the black-and-white screen detection listener thread.
[0108] S604, the histogram management class sends configuration items to the implementation class of the black-and-white screen detection and listening thread.
[0109] In S605, when the value in the configuration item is 1, the black and white screen detection listening thread implementation class determines the state of the sub-switch from the kernel interface implementation class Kernellnterfacelmpl.
[0110] In some implementations, a sub-switch is set in the `engine_histogram_enable.xml` configuration file under `Kernellnterfacelmpl` for developers to debug and configure the functionality. Developers can control the state of this sub-switch. When the sub-switch is on, the black-and-white screen detection listener thread implementation class retrieves histogram data. When the sub-switch is off, even if the value in the configuration item is 1, the black-and-white screen detection listener thread implementation class will not retrieve histogram data.
[0111] It should be noted that step S605 is an optional step.
[0112] The S606 black-and-white screen detection listener thread implementation class triggers hardware to obtain histogram data through the display driver to determine whether the currently displayed interface of the first application is abnormal. If the currently displayed interface of the first application is abnormal, the display engine sends the first information to the server.
[0113] S607, after completing the anomaly detection and reporting, the black and white screen detection listening thread implementation class actively calls the "closeHistogramManager" method of the close histogram management class, setting the value in the configuration item to 0, thereby disabling the display engine's own related performance, i.e., data.param[ALGO_BLACK_SCREEN_DETECTION] = 0.
[0114] Alternatively, after reporting is complete, the black-and-white screen detection listener thread implementation class can send an exception notification to the system, causing the system to close the first application. If the user exits the first application, the Activity calls the `handlePuaseActivity` method, and the Activity executes the black-and-white screen detection exit mode "DE_SCENE_ACTION_BLACK_WHITE_EXIT" in `setScene`, and sends the black-and-white screen detection exit information to the histogram processing module. The histogram processing module sets the value in the configuration item to 0 and passes the configuration item to the black-and-white screen detection listener thread implementation class.
[0115] This application also provides an application anomaly detection method applied to the cloud side, comprising: a server receiving first information from an electronic device, the first information including an identifier of a first application and an anomaly type; capturing logs related to the interface of the first application from the electronic device based on the first information; receiving the logs related to the interface of the first application from the electronic device; and processing the logs related to the interface of the first application. The anomaly type is an application startup interface display anomaly, which can be represented by a dot notation type or other methods, and different anomaly types correspond to different log content captured by the server. Log processing includes parsing, automated analysis, and data display.
[0116] In summary, this application provides an application anomaly detection method. After the application enters its startup lifecycle and executes `onResume5s`, the electronic device triggers the hardware abstraction layer to obtain histogram data of the current interface. The standard deviation and the proportion of black and white blocks are calculated based on the histogram data. Based on the standard deviation, the proportion of black and white blocks, and a preset threshold, it is determined whether the currently displayed interface of the first application is abnormal. If the currently displayed interface of the first application is abnormal, a notification is sent to hiview. hiview captures the on-site logs, and the electronic device packages and uploads the detailed on-site logs (flow logs, histogram data, systrace, snapshot logs, etc.) to the cloud for parsing and processing. The method provided in this application can be automatically completed by the electronic device, and the entire process is completed before the application exits. Therefore, hiview obtains detailed on-site logs when an interface display anomaly occurs during application startup. This allows developers to obtain detailed on-site logs and perform analysis and location based on the logs, improving accuracy and efficiency. This application adds anomaly markers specifically to distinguish this type of interface display anomaly, helping developers quickly identify the anomaly type and facilitating location assistance.
[0117] The above combination Figures 1 to 6 The application anomaly detection method provided in the embodiments of this application has been described. The electronic device and apparatus for executing the above method provided in the embodiments of this application are described below. It should be understood that the apparatus in the embodiments of this application can execute various methods of the foregoing embodiments of this application; that is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.
[0118] For example, Figure 7 This paper illustrates a hardware structure diagram of an electronic device 100 provided in an embodiment of this application.
[0119] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc.
[0120] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0121] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0122] The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.
[0123] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0124] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0125] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0126] The charging management module 140 receives charging input from the charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0127] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.
[0128] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0129] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 150 can provide solutions for wireless communication applied to the electronic device 100, including 2G, 3G, 4G, and 5G technologies. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0130] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0131] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0132] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0133] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini-LED, a micro-LED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0134] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0135] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0136] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0137] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0138] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0139] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0140] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.
[0141] Electronic device 100 can implement audio functions through an audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor. Examples include music playback, recording, voice calls, and video calls. Headphone jack 170D is used to connect wired headphones. Headphone jack 170D can also be a USB interface 130.
[0142] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0143] Button 190 includes the power button, volume buttons, etc.
[0144] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback.
[0145] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0146] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with or separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1.
[0147] like Figure 8 As shown, Figure 8 This is a schematic diagram of the structure of a device 800 provided in an embodiment of this application. The device 800 may be an electronic device as described in this application embodiment, or a chip or chip system within an electronic device. Figure 8 As shown, the device 800 may include a display unit 801, a processing unit 802, and a communication unit 803. The display unit 801 supports the device 800 in performing the aforementioned display steps; the processing unit 802 supports the device 800 in performing the aforementioned processing steps; and the communication unit 803 supports the device 800 in performing the aforementioned steps of communicating with the cloud.
[0148] In one possible implementation, the device 800 further includes a storage unit 804. The storage unit 804 and the processing unit 802 are connected via a line. The storage unit 804 may include one or more memories, which can be devices in one or more devices or circuits used to store programs or data. The storage unit 804 can exist independently and be connected to the processing unit 802 via a communication bus. Alternatively, the storage unit 804 can be integrated with the processing unit 802.
[0149] Storage unit 804 may store computer-executable instructions for methods in an electronic device, so that processing unit 802 executes the methods in the above embodiments. Storage unit 804 may be a register, cache, or random access memory (RAM), or it may be read-only memory (ROM) or other types of static storage devices that can store static information and instructions.
[0150] Figure 9 This is a schematic diagram of a chip structure provided in an embodiment of this application. Figure 9 As shown, chip 900 includes one or more processors 901, communication lines 902 and communication interfaces 903. Optionally, chip 900 also includes memory 904.
[0151] In some implementations, memory 904 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof.
[0152] The methods described in the embodiments of this application can be applied to or implemented by processor 901. Processor 901 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 901 or by instructions in software form. The processor 901 may be a general-purpose processor (e.g., a microprocessor or conventional processor), a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates, transistor logic devices, or discrete hardware components. Processor 901 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0153] The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in mature storage media in the art, such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in memory 904, and processor 901 reads the information in memory 904 and, in conjunction with its hardware, completes the steps of the above method.
[0154] The processor 901, memory 904 and communication interface 903 can communicate with each other via communication line 902.
[0155] In the above embodiments, the instructions stored in the memory for execution by the processor can be implemented in the form of a computer program product. This computer program product can be pre-written into the memory, or it can be downloaded and installed into the memory as software.
[0156] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disks, hard disks, or magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).
[0157] This application provides an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the computer program to perform the method described above.
[0158] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0159] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms. Additionally, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.
[0160] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above. The computer-readable storage medium stores a computer program or instructions. When executed by a processor, the computer program or instructions implement the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0161] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, DVDs, floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0162] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0163] In the foregoing description, specific details such as particular system architectures and techniques have been set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted to avoid unnecessary detail that could obscure the description of this application.
[0164] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0165] It should also be understood that "multiple" as used in this application specification and appended claims refers to two or more. In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, referring to any combination and all possible combinations of one or more of the related listed items, and includes these combinations. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone.
[0166] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0167] Furthermore, to facilitate a clear description of the technical solution of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, nor should they be construed as indicating or implying relative importance, and the terms "first" and "second" do not necessarily imply that they are different.
[0168] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0169] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An application anomaly detection method, characterized in that, Applied to an electronic device that communicates with a server, the method includes: The first operation, requesting the user to launch the first application, was detected. In response to the first operation, the lifecycle of the first application is initiated. After a preset time period following the entry of the first application's lifecycle into the interface display stage, the first application sends a first application startup message to the display engine service of the electronic device. The display engine service can activate a control thread for display-related features and trigger the lower-level display engine to obtain histogram data of the current display interface from the display-related hardware through the display driver. The histogram data includes the grayscale value of each pixel and the number of occurrences of each grayscale value. If the first application exits before the preset time period following the entry of the first application's lifecycle into the interface display stage, the process ends. The standard deviation is calculated based on the grayscale values of multiple pixels in the histogram data of the currently displayed interface. If the standard deviation is greater than or equal to the first threshold, determine the first ratio of the number of pixels with a gray value of 0 in the current display interface of the first application to the total number of pixels in the current display interface, and the second ratio of the number of pixels with a gray value of 255 in the current display interface to the total number of pixels in the current display interface. If the first ratio is greater than or equal to the second threshold, or if the second ratio is greater than or equal to the second threshold, determine whether the current display interface of the first application is abnormal. In the event of an abnormality in the current display interface of the first application, the display engine of the electronic device sends first information to the server. The first information instructs the server to retrieve logs related to the interface of the first application. The first information includes: an exception type indicating that the application startup interface is abnormal and an identifier of the first application. The exception type corresponds to the logs related to the interface of the first application, so that the server can retrieve the on-site logs related to the abnormal display of the interface of the first application in the electronic device according to the exception type and the identifier of the first application. After the server completes the crawling, logs related to the interface of the first application are sent to the server. Exit the first application.
2. The method according to claim 1, characterized in that, The method further includes: If the standard deviation is less than the first threshold, it is determined that the current display interface of the first application is normal.
3. The method according to claim 1, characterized in that, The method further includes: If both the first ratio and the second ratio are less than the second threshold, it is determined that the current display interface of the first application is normal.
4. The method according to claim 2, characterized in that, The method further includes: Obtain the identifier of the first application; The first threshold corresponding to the first application is determined based on the identifier of the first application.
5. The method according to claim 1, characterized in that, The electronic device includes a first interface, which is used by the server in response to receiving the first information to capture logs related to the interface of the first application.
6. The method according to claim 1, characterized in that, Logs related to the interface of the first application include streaming logs, event logs, kernel logs, snapshot logs, and logs related to the load, performance, heat generation, and network connectivity of the electronic device.
7. An electronic device, characterized in that, include: One or more processors; one or more memories; The memory stores one or more programs that, when executed by the processor, cause the electronic device to perform the method of any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 6.