Application timeout detection method and terminal device

By timing and displaying prompt information during the application startup process, the problem of users not being able to know the application startup timeout is solved, improving the user experience and providing timeout cause analysis, realizing effective management of terminal devices.

CN114201354BActive Publication Date: 2025-10-03HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010982738.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-17
Publication Date
2025-10-03
Estimated Expiration
2040-09-17

AI Technical Summary

Technical Problem

The existing technology cannot detect the timeout of the application during the startup process, resulting in the user being unaware of the situation when the terminal device freezes with a black screen, resulting in a poor user experience.

Method used

During the application startup process, the Activity startup process is timed. If a timeout occurs, a prompt message is displayed and the user is given the option to continue waiting or close the application. A log is generated to analyze the cause of the timeout.

Benefits of technology

By promptly informing users of the application startup status, the user experience is improved, users are helped to deal with terminal device freezes, and a basis for timeout cause analysis is provided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114201354B_ABST
    Figure CN114201354B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide an application timeout detection method and terminal device, which relate to the field of information processing technology and can detect the timeout of the application APP startup process. The specific scheme includes: when the terminal device starts the first activity in the first application APP, the terminal device times the startup process of the first activity; if the timing duration of the startup process of the first activity is greater than a first preset duration before the first activity is successfully started, a first prompt message is displayed; wherein the first prompt message is used to indicate that the first APP is unresponsive, and the first prompt message also includes a first option and a second option, the first option is used to trigger the terminal device to continue waiting for the first APP to respond, and the second option is used to trigger the terminal device to close the first APP.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing technology, and in particular to a method for detecting timeout of an application program and a terminal device. Background Art

[0002] Currently, terminal devices can use open operating systems, such as the Android system. A wide variety of applications (APPs) can be installed on such operating systems (such as quick apps and mini-programs), with the number reaching tens of millions. However, the stability of these APPs varies. Some less stable APPs are prone to processing timeouts during use. In severe cases, black screens and freezes may occur. When a terminal device freezes with a black screen, the terminal device cannot respond to user input. This unresponsive state causes users to be unsure how to handle the black screen freeze issue, resulting in a poor user experience.

[0003] Conventional technology addresses the issue of a black screen and frozen terminal device. The Application Not Responding (ANR) mechanism is a mechanism used by the Android system to address this issue. An ANR occurs if the Android system requires an event to complete within a certain timeframe. If no effective response is received after this timeframe, or if the response takes too long, an ANR is generated. The terminal device then informs the user of the unresponsive event and handles it accordingly.

[0004] However, the ANR mechanism can only detect any event timeout that occurs after the app is launched, such as input event distribution timeout (i.e., no response to input events such as touch and click within a certain period of time) or service timeout (i.e., no processing of a service method within a certain period of time). It cannot detect timeouts during the app launch process. Furthermore, it cannot inform the user of the unresponsive event when the app launch process times out, causing a black screen and a crash. As a result, the user is unclear about the launch status of the first app, resulting in a poor user experience. Summary of the Invention

[0005] The present application provides an application timeout detection method and terminal device, which can detect the timeout of the APP startup process.

[0006] To achieve the above technical objectives, this application adopts the following technical solutions:

[0007] In a first aspect, the present application provides a method for detecting application timeouts, the method comprising: when a terminal device starts a first activity in a first app, timing the startup process of the first activity; if the timing duration of the startup process of the first activity is greater than a first preset duration before the first activity is successfully started, displaying a first prompt message. The first prompt message is used to indicate that the first app is unresponsive, and the first prompt message also includes a first option and a second option, the first option is used to trigger the terminal device to continue waiting for the first app to respond, and the second option is used to trigger the terminal device to close the first app.

[0008] Using the method provided in the present application, when the terminal device starts the first Activity in the first APP, it increases the timing of the startup process of the first Activity, that is, records the duration of the startup process of the first Activity. Then, if before the first Activity is successfully started, the timing duration of the startup process of the first Activity (that is, the duration consumed to start the first Activity) is greater than the first preset duration, it can be said that the startup process of the first Activity has timed out. Among them, if the terminal device cannot normally display the interface of the first Activity and / or provide the function of interacting with the first Activity before the first Activity is successfully started, the user cannot operate the first Activity and can only wait for the first Activity to start successfully. Therefore, if the startup process of the first Activity times out, it means that the user needs to wait for a long time before interacting with the terminal device.

[0009] In this application, the terminal device can display a first prompt message when the startup process of the first activity times out. This first prompt message is used to indicate that the first app is unresponsive. That is, the first prompt message can inform the user of the startup status of the first app. This can avoid the user blindly waiting for a long time due to being unclear about the startup status of the first app, thereby ensuring a good user experience.

[0010] Secondly, the first prompt information also includes a first option and a second option. The first option is used to trigger the terminal device to continue waiting for the first app to respond, and the second option is used to trigger the terminal device to close the first app. In other words, the terminal device provides the user with the option of closing the first app or continuing to wait for the first app, allowing the user to control the startup process of the first activity in the first app according to their personal wishes, thereby improving the user experience.

[0011] In a possible implementation, the method further includes: if the first Activity is successfully started within a first preset time period, or the terminal device receives a lock screen operation, the terminal device stops timing the startup process of the first Activity.

[0012] In this design, after the terminal device increases the timing of the startup process of the first Activity, if the first Activity is successfully started within the first preset duration, indicating that the startup process of the first Activity has not timed out, the timing of the startup process of the first Activity is stopped (i.e., the detection of the startup process timeout of the first Activity is stopped). Alternatively, if the terminal device increases the timing of the startup process of the first Activity and receives a lock screen operation, indicating that the terminal device needs to stop starting the first Activity, the terminal device also stops timing the startup process of the first Activity.

[0013] In another possible implementation, the method further includes: if before the first Activity is successfully started, the timing duration of the startup process of the first Activity is greater than a first preset duration, the terminal device generates a first log; the first log is used to record the startup process of the first Activity; the terminal device sends the first log to the server, and the first log is used to analyze the reason for the startup timeout of the first Activity.

[0014] In this design, before the first Activity is successfully launched, if the timing duration of the first Activity startup process (i.e., the time it takes to start the first Activity) is greater than the first preset duration, the terminal device can confirm that the startup process of the first Activity has timed out. At this time, in addition to displaying the first prompt message, a first log can also be generated and sent to the server. Furthermore, the developer can download the first log from the server and analyze the first log to determine the cause of the first Activity startup timeout.

[0015] In another possible implementation, the method further includes: after the terminal device starts to start the first Activity, when starting to draw the interface of the first Activity, timing the process of the terminal device drawing the interface of the first Activity; if before the interface of the first Activity is completed, the timing duration of the terminal device drawing the interface of the first Activity is greater than the second preset duration, the terminal device displays a first prompt message.

[0016] In this design, the terminal device draws the interface of the first activity at the same time as it starts the first activity. Since the first activity's interface can only be displayed after the drawing of the first activity's interface is complete, if the drawing of the first activity's interface times out, the terminal device will display a black or white screen for a long time. If the terminal displays a black or white screen for a long time, the user will not be able to view the first activity's interface for a long time, resulting in a poor user experience.

[0017] In the present application, when the terminal device starts the first Activity in the first APP, in addition to adding timing for the startup process of the first Activity, it also adds timing for the process of drawing the interface of the first Activity. Furthermore, if the timing duration of the terminal device's process of drawing the interface of the first Activity is greater than the second preset duration before the interface drawing of the first Activity is completed, it can indicate that the interface drawing of the first Activity has timed out. The terminal device can display a first prompt message when the interface drawing of the first Activity times out. The first prompt message is used to indicate that the first APP is unresponsive, that is, the user can be informed of the startup status of the first APP through the first indication message. This can avoid the problem that the user can only see a black screen or a white screen for a long time, resulting in a poor user experience.

[0018] In another possible implementation, the method further includes: if the timing duration of the terminal device drawing the interface of the first Activity is greater than a second preset duration before the interface of the first Activity is drawn, the terminal device generates a second log, and the second log is used to draw the interface process of the first Activity; the terminal device sends the second log to the server, and the second log is used to analyze the reason for the terminal device's timeout in drawing the interface of the first Activity.

[0019] In this design, if the terminal device takes longer than a second preset duration to draw the first Activity's interface before the first Activity's interface is finished drawing, it can be confirmed that the first Activity's interface drawing process has timed out. In this case, in addition to displaying the first prompt message, a second log can also be generated and sent to the server. Developers can then download the second log from the server and analyze it to determine the cause of the first Activity's startup timeout.

[0020] In another possible implementation, the method further includes: if the interface of the first Activity is drawn within a second preset time period, or the terminal device receives a lock screen operation, the terminal device stops timing the process of drawing the interface of the first Activity.

[0021] In this design, after the terminal device increases the timing for drawing the interface of the first Activity, if the interface of the first Activity is drawn within the first preset duration, indicating that the interface drawing process of the first Activity has not timed out, the timing for drawing the interface of the first Activity is stopped (i.e., the detection of the timeout of the interface drawing process of the first Activity is stopped). Alternatively, if the terminal device increases the timing for drawing the interface of the first Activity and receives a lock screen operation, indicating that the terminal device needs to stop drawing the interface of the first Activity, the terminal device also stops timing the process of drawing the interface of the first Activity.

[0022] In another possible implementation, when the terminal device starts a first activity in a first application program (APP), timing the startup process of the first activity includes: when the terminal device switches the display interface of the terminal device from a second activity to the first activity, timing the startup process of the first activity when the second activity begins to be paused. The second activity is an activity of the first APP or an activity of the second APP, and the first APP and the second APP are different.

[0023] In this design, when switching the terminal device's display interface from the second activity to the first activity, the second activity must be paused before the first activity is started. Because both the pause and start times of the second activity can cause the first activity's startup process to time out, the first activity's startup process is timed from the moment the second activity is paused. This allows for more accurate detection of startup timeouts.

[0024] In another possible implementation, the above-mentioned terminal device times the startup process of the first Activity when starting the first Activity in the first application APP, including: when the terminal device is in a lock screen state, receiving an unlock operation, wherein the terminal device displays the interface of the first Activity after being unlocked in response to the unlock operation; when the terminal device starts to unlock in response to the unlock operation, the startup process of the first Activity is timed.

[0025] In this design, since the terminal device displays the first activity's interface after unlocking in response to the unlock operation, this indicates that the terminal device is running the first activity in the background while in the locked screen state. Therefore, the terminal device directly restarts the first activity in response to the unlock operation. Therefore, the startup process of the first activity is timed when the unlock operation begins, allowing for more accurate detection of whether the startup process of the first activity has timed out.

[0026] In a second aspect, the present application provides a terminal device comprising: a control module and a display module; wherein the control module is configured to time the startup process of a first activity in a first application program (APP) when the first activity is started; and the display module is configured to display a first prompt message if the timed duration of the startup process of the first activity is greater than a first preset duration before the first activity is successfully started. The first prompt message is configured to indicate that the first APP is unresponsive, and the first prompt message further comprises a first option and a second option, wherein the first option is configured to trigger the terminal device to continue waiting for the first APP to respond, and the second option is configured to trigger the terminal device to close the first APP.

[0027] In a possible implementation, the control module is further configured to stop timing the startup process of the first Activity if the first Activity is successfully started within a first preset time period, or the terminal device receives a lock screen operation.

[0028] In another possible implementation, the terminal device also includes a sending module; the control module is further used to generate a first log if the timing duration of the startup process of the first Activity is greater than a first preset duration before the first Activity is successfully started, and the first log is used to record the startup process of the first Activity; the sending module is used to send the first log to the server, and the first log is used to analyze the reason for the startup timeout of the first Activity.

[0029] In another possible implementation, the control module is further used to time the process of drawing the interface of the first Activity when the interface of the first Activity is started after the first Activity is started; the display module is further used to display the first prompt information if the timing duration of the process of drawing the interface of the first Activity is greater than the second preset duration before the interface of the first Activity is completed.

[0030] In another possible implementation, the terminal device also includes a sending module; the control module is further used to generate a second log if the timing duration of the process of drawing the interface of the first Activity is greater than a second preset duration before the interface of the first Activity is drawn. The second log is used to draw the interface process of the first Activity; the sending module is used to send the second log to the server, and the second log is used to analyze the reason for the terminal device's timeout in drawing the interface of the first Activity.

[0031] In another possible implementation, the control module is further configured to stop timing the process of drawing the interface of the first Activity if the interface of the first Activity is drawn within a second preset time period or a lock screen operation is received.

[0032] In another possible implementation, the control module is specifically configured to, when the display interface of the terminal device is switched from the second activity to the first activity, time the startup process of the first activity when the second activity begins to be paused;

[0033] The second activity is an activity of the first APP or an activity of the second APP, and the first APP is different from the second APP.

[0034] In another possible implementation, the control module is specifically configured to: receive an unlock operation when in a locked screen state; and time the startup process of the first activity when unlocking is initiated in response to the unlock operation. The terminal device displays the interface of the first activity after being unlocked in response to the unlock operation.

[0035] In a third aspect, the present application also provides a terminal device comprising: a processor and a memory; wherein the memory is used to store computer program code, and the computer program code includes computer instructions; the processor is used to run the computer instructions so that the terminal device executes the method for obtaining system time as in the first aspect and any possible implementation method thereof.

[0036] In a fourth aspect, the present application also provides a computer-readable storage medium having computer instructions stored thereon. When the computer instructions are executed on a terminal device, the terminal device executes a method for obtaining system time as described in the first aspect and any possible implementation method thereof.

[0037] In a fifth aspect, the present application also provides a computer program product comprising one or more instructions, which can be run on a terminal device so that the terminal device executes a method for obtaining system time as described in the first aspect and any possible implementation method thereof.

[0038] The technical effects brought about by the second aspect of this application and any possible design method thereof, as well as the third, fourth and fifth aspects can be referred to the technical effects brought about by the different design methods in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 Schematic diagram of an implementation environment involved in a method for detecting timeout of an application program provided in an embodiment of the present application;

[0040] Figure 2 This is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;

[0041] Figure 3 This is a schematic diagram of the system architecture of a terminal device provided in an embodiment of the present application. Figure 1 ;

[0042] Figure 4 This is a process of a timeout detection method for an application provided in an embodiment of the present application Figure 1 ;

[0043] Figure 5 This is a process of a timeout detection method for an application provided in an embodiment of the present application Figure 2 ;

[0044] Figure 6 This is a schematic diagram of the system architecture of a terminal device provided in an embodiment of the present application. Figure 2 ;

[0045] Figure 7 This is a process of a timeout detection method for an application provided in an embodiment of the present application Figure 3 ;

[0046] Figure 8 This is a schematic diagram of the system architecture of a terminal device provided in an embodiment of the present application. Figure 3 ;

[0047] Figure 9 This is a schematic diagram of an interface for launching an APP when unlocking provided by an embodiment of the present application;

[0048] Figure 10 This is a schematic diagram of an interface for starting an APP when switching interfaces provided by an embodiment of the present application;

[0049] Figure 11 This is a schematic diagram of an interface for launching an APP in a multi-window scenario provided by an embodiment of the present application;

[0050] Figure 12 This is a structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] In the embodiments of the present application, the terms "first" and "second" are used to distinguish different objects or to distinguish different processing of the same object, rather than to describe a specific order of objects. For example, the first activity and the second activity are different activities.

[0052] At present, there are a large number of APPs that can be installed on terminal devices, and there are many APPs with poor stability. When terminal devices run APPs with poor stability, processing timeouts are prone to occur, especially after the terminal device's operating system is upgraded or the APP version is upgraded, the frequency of processing timeouts is higher. Furthermore, in severe cases of timeouts, the system may freeze. When a terminal device freezes, the terminal device cannot respond to user input operations, including triggering the start key (i.e., the Home key) or the back key (i.e., the Back key); and the terminal device's interface will also be stuck, which may appear completely black or completely white. Faced with such an unresponsive and abnormal interface state, users do not know how to deal with it and can only wait blindly, resulting in a poor user experience.

[0053] To address the issue of device crashes caused by timeouts when running apps, conventional technology has proposed an Application Not Responding (ANR) mechanism. The ANR mechanism refers to the Android system's requirement that any event be processed within a certain timeframe. If no effective response is received after this timeframe, or if the response takes too long, an ANR will occur. The device will then notify the user of the unresponsive event and handle the situation accordingly.

[0054] However, the ANR mechanism can only detect timeouts of some events received after starting any Activity in an APP, such as input event distribution timeout (i.e., no response to input events such as touch and click within a certain period of time), service timeout (i.e., service method is not processed within a certain period of time), broadcast timeout (i.e., broadcast message is not processed within a certain period of time), content provider (Content Provider) content publishing timeout, etc. It cannot detect the timeout of the startup process of any Activity in the APP. Furthermore, when the startup process of any Activity times out and causes the terminal device to crash, the user is not clear about the startup status of the first Activity, and cannot handle the crash problem. He can only wait blindly, and the user experience is poor.

[0055] This embodiment of the present application provides an application timeout detection method that can detect the timeout of any activity startup process in an app. Furthermore, when the activity startup process times out, the user can be notified of the activity startup status and provided with a solution to the activity startup timeout. This ensures a good user experience.

[0056] The Activity involved in the embodiments of this application refers to the presentation layer of the app in the Android system. Each user interface (UI) of the app is displayed through the Activity class. Each Activity uses fragments and views to layout and display information, and respond to user operations.

[0057] Specifically, the Activities created in the Android system are presented in the form of a stack. The state of each Activity is determined by its position in the Activity stack, which is a collection of currently running Activities. When a new Activity is started, it becomes an Activity class and moves to the top of the stack. The terminal device starts an Activity through the cooperation of the Activity Manager Service (AMS) and the application process. AMS uniformly schedules the start of Activities for all processes in the Android system, and the start process of each Activity is completed by the process to which it belongs. The AMS in the terminal device can notify the application process to start a certain Activity through specific functions (such as the realStartActivityLocked function). There are some callback methods in the Android system to start or close an Activity. The callback methods include: onCreate(): called when the Activity is first created to initialize the Activity; onStart(): called when the Activity is visible to the user; onResume(): called when the APP starts to interact with the user; onPause(): called when the Activity is about to be paused and the previous Activity is about to be resumed; onStop(): called when the Activity is not visible; onDestory(): called before the Activity is destroyed by the Android system; onRestart(): called when the Activity is restarted after being stopped.

[0058] As Activities are created and destroyed, they move in and out of the Activity stack. Each Activity has four states: (1) Active, which means that the Activity is at the top of the Activity stack and is visible to the user and can interact with the user (i.e., the Activity has focus); (2) Paused, which means that the Activity is visible but cannot interact with the user, i.e., it does not have focus; (3) Stopped, which means that the Activity is not visible, but when memory is needed elsewhere, it will become the first choice to be terminated; (4) Inactive, after the Activity is terminated, it is inactive before it is started and has been removed from the Activity stack.

[0059] Among them, the complete life cycle of an Activity is from creation to destruction, and the completed life cycle of an Activity includes one or more activity life cycles and visible life cycles. Among them, the calling process of an Activity in the complete life cycle of an Activity includes: oncreate, onstart, onresume, onpause, onstop and ondestroy in sequence. The calling process of an Activity in the visible life cycle includes: onstart, onresume, onpause and onstop in sequence; in the visible life cycle, the Activity is visible, but does not have focus and cannot interact with the user. The calling process of an Activity in the activity life cycle includes: onreume and onpause in sequence; in the activity life cycle, the Activity runs in the foreground and can interact with the user.

[0060] Please refer to Figure 1 , which shows a schematic diagram of the implementation environment involved in a timeout detection method for an application provided in an embodiment of the present application. Figure 1 As shown, the implementation environment may include a cloud platform 100 and a terminal device 200. Among them, the terminal device 200 is installed with one or more APPs. The cloud platform 100 is an electronic computing platform built on the "cloud" that can provide various types of services (such as data management, logical operations). The cloud platform 100 can be established based on one or more servers or electronic computing devices. The server can also be connected to at least one database to call relevant data or program instructions to provide hardware support for one or more services in the "cloud". The cloud platform 100 can communicate with the terminal device 200 or other devices through a wired network or a wireless network, and receive or send data / instructions, for example, receive the operation log of any APP from the terminal device 200.

[0061] When the terminal device 200 runs any installed app, it detects whether the startup process of any activity in the app has timed out. If a startup timeout is detected for any activity, the terminal device 200 can capture a log recording the activity startup process and send the log to the cloud platform 100. Developers can retrieve and view the log from the cloud platform 100 to analyze the cause of the activity startup timeout.

[0062] For example, the terminal device in the embodiment of the present application can be any electronic device installed with an APP, such as a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, vehicle-mounted device, ultra-mobile personal computer (UMPC), netbook, and personal digital assistant (PDA), augmented reality device, virtual reality device, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the terminal device. As an example, Figure 1 As shown, the implementation environment of the embodiment of the present application includes a terminal device 200, which is shown as a mobile phone.

[0063] It should be noted that the application timeout detection method provided in the embodiment of the present application can be applied to the above-mentioned terminal device 200. The execution subject of the application timeout detection method provided in the embodiment of the present application can also be an application timeout detection device, and the application timeout detection device can be the terminal device 200. The application timeout detection device can also be an APP installed with a timeout detection function that can provide an application; or, the application timeout detection device can also be a central processing unit (CPU) in the terminal device 200; or, a control module in the terminal device 200 for executing the application timeout detection method.

[0064] It should be noted that Figure 1 The number of terminal devices and cloud platforms in the embodiment is merely illustrative. Any number of terminal devices and cloud platforms may be used according to actual needs.

[0065] The following continues to take the example of the terminal device 200 being a mobile phone to introduce the hardware structure of the terminal device. Figure 2As shown, the terminal device 200 may include: a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293 (which may include cameras 1-N), a display screen 294 (such as a touch screen), and a subscriber identification module (SIM) card interface 295 (which may include SIM card interfaces 1-N), etc.

[0066] Among them, the above-mentioned sensor module 280 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.

[0067] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the terminal device 200. In other embodiments, the terminal device 200 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0068] The processor 210 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0069] The controller can be the nerve center and command center of the terminal device 200. The controller can generate operation control signals according to instruction operation codes and timing signals to complete the control of instruction fetching and execution.

[0070] Processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 210 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 210. If processor 210 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 210 latency, and thus improves system efficiency.

[0071] In some embodiments, the processor 210 may include one or more interfaces. It should be understood that the interface connection relationship between the modules illustrated in this embodiment is merely illustrative and does not constitute a structural limitation on the terminal device 200. In other embodiments, the terminal device 200 may also adopt a different interface connection method from the above embodiments, or a combination of multiple interface connection methods.

[0072] The charging management module 240 is configured to receive charging input from a charger (wired charger and / or wireless charger) to charge the battery 242. The charger can be either a wireless charger or a wired charger. While charging the battery 242, the charging management module 240 can also provide power to the terminal device through the power management module 241.

[0073] The power management module 241 is used to connect the battery 242, the charging management module 240, and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240 and provides power to the processor 210, the internal memory 221, the external memory, the display 294, the camera 293, and the wireless communication module 260. In some embodiments, the power management module 241 may also be provided in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 may also be provided in the same device.

[0074] The wireless communication function of the terminal device 200 can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. In some embodiments, antenna 1 of the terminal device 200 is coupled with mobile communication module 250, and antenna 2 is coupled with wireless communication module 260, so that the terminal device 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global navigation satellite system (GNSS), wireless local area network (WLAN) (such as Wi-Fi network) technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite-based augmentation system (SBAS), etc. For example, the terminal device 200 may obtain the real-time location information of the terminal device 200 through positioning technologies such as GPS, BDS or SBAS.

[0075] The mobile communication module 250 can provide wireless communication solutions including 2G / 3G / 4G / 5G etc. applied to the terminal device 200. For example, the terminal device 200 can send an email to a server through the mobile communication module 250.

[0076] The wireless communication module 260 can provide wireless communication solutions for the terminal device 200, including WLAN (such as Wi-Fi network), Bluetooth (BT), GNSS, Near Field Communication (NFC), Infrared (IR), and Frequency Modulation (FM). For example, the terminal device 200 can obtain real-time location information of the terminal device 200 through GNSS positioning technology.

[0077] The terminal device 200 implements a display function through a GPU, a display screen 294, and an application processor. The terminal device 200 can implement a shooting function through an ISP, a camera 293, a video codec, a GPU, a display screen 294, and an application processor. The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 200. The internal memory 221 can be used to store computer executable program code, which includes instructions. The processor 210 executes various functional applications and data processing of the terminal device 200 by running the instructions stored in the internal memory 221. The terminal device 200 can implement an audio function through an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, and an application processor.

[0078] It should be noted that the methods in the following embodiments can all be implemented in the terminal device 200 having the above-mentioned hardware structure.

[0079] Please refer to Figure 3 , which is a schematic diagram of the system architecture of a terminal device provided in an embodiment of the present application. The operating system adopted by the terminal device 200 may be the Android system, and the system architecture of the Android system includes an application framework layer (Application Framework) 310, an application layer (Applications) 320, and a system runtime layer (Native) 330. Among them, Application Framework 310 mainly provides various application programming interfaces (Application Programming Interface, API) that may be used when building an APP. Application Framework 310 includes: Activity Management Service AMS and Activity Task Management Service (Activity Task Manager Service, ATMS); AMS is a system service process that manages the running status of Activity and other components in the Android system; ATMS is a system service process that manages the Activity stack. Applications 320 includes all APPs installed on the terminal device. Native 330 is mainly used to provide major feature support for the Android system through some c / c++ libraries. For example, the lightweight database SQLite provides database support, etc.

[0080] The Applications 320 of the terminal device 200 may include a first APP, a second APP, and the like. Taking the start (resume) of the first Activity in the first APP as an example, the terminal device 200 may start the first Activity when it is unlocked, or start the first Activity when the display interface is switched from the second Activity to the first Activity. The second Activity is the Activity of the first APP or the Activity of the second APP. The first APP and the second APP are different APPs installed in the terminal device 200. If the second Activity is the Activity of the first APP, switching the display interface from the second Activity to the first Activity means switching the interface of the first APP. If the second Activity is the Activity of the second APP, switching the display interface from the second Activity to the first Activity means switching from the second APP to the first APP.

[0081] Then, when the Application Framework 310 of the terminal device 200 starts to start the first Activity, it can perform a timeout detection on the startup process of the first Activity. After starting to start the first Activity, the Applications 320 of the terminal device 200 can perform a timeout detection on the interface drawing process of the first Activity. Then, the terminal device 200 can inform the user when the startup process of the first Activity times out or the interface drawing process of the first Activity times out, so as to avoid the user being unclear about the current status when the terminal device 200 crashes, resulting in a poor user experience. Secondly, the Native 330 of the terminal device 200 can generate a log when the startup process of the first Activity times out or the interface drawing process of the first Activity times out. The log is used to record the startup process of the first APP or the interface drawing process of the first Activity. The log is used to analyze the reasons for the timeout of the terminal device 200 starting the first Activity or the timeout of drawing the interface of the first Activity.

[0082] Please refer to Figure 4 , is a flow chart of a method for detecting timeout of an application program provided in an embodiment of the present application. Figure 4 As shown, the timeout detection method of the application program may include S401-S402.

[0083] S401. When a terminal device starts a first activity in a first application program APP, the terminal device times the startup process of the first activity.

[0084] In response to the start operation of the first activity in the first app, the terminal device starts to start the first activity and, at the same time as starting to start the first activity, starts to time the startup process of the first activity. The terminal device also determines whether the timed duration of the startup process of the first activity is greater than a first preset duration. If the timed duration of the startup process of the first activity is greater than the first preset duration, it indicates that the startup process of the first activity has timed out.

[0085] The first preset duration can be set according to the maximum duration that the user can wait, or according to the average of the startup durations of multiple Activities, etc. For example, the first preset duration can be equal to 3 seconds or 5 seconds.

[0086] For example, when the terminal device is displaying the interface of a second activity and detects a user switching from the second activity to the first activity, it determines that a launch operation of the first activity has been detected. Alternatively, when the terminal device is in a locked state and the first activity is running in the background and detects a user unlocking the terminal device, it determines that a launch operation of the first activity has been detected. The second activity is different from the first activity.

[0087] In the embodiment of the present application, when the terminal device switches the display interface of the terminal device from the second Activity to the first Activity, the startup process of the first Activity is timed when the second Activity begins to be paused.

[0088] The terminal device displays the interface of the second activity of the second app, that is, the second activity is in a visible and interactive state. If the terminal device detects that the user switches the second activity of the second app to the first app, it starts to pause the second activity and starts timing the startup process of the first activity of the first app. At this time, the first activity is the first activity started by the first app (that is, the main activity MainActivity).

[0089] Alternatively, the terminal device displays the interface of the second activity of the first app. If it detects that the user switches the second activity of the first app to the first activity, the terminal device starts to pause the second activity and starts timing the startup process of the first activity. At this time, the first activity is any activity of the first app.

[0090] It should be noted that when switching the terminal device's display interface from the second activity to the first activity, you need to pause the second activity first and then resume the first activity. Because the timeout for pausing the second activity and the timeout for resuming the first activity will both cause the first activity's startup process to time out, the first activity's startup process is timed from the time the second activity is paused.

[0091] For example, when the terminal device detects that the user switches the second Activity to the first Activity, the AMS in the ApplicationFramework310 of the terminal device calls the resumeTopActivityInnerLocked function; then calls the startPausingLocked function through the resumeTopActivityInnerLocked function; and then pauses the second Activity through the startPausingLocked function. The terminal device can start timing the startup process of the first Activity when it determines to call the startPausingLocked function (i.e., start pausing the second Activity). Among them, the resumeTopActivityInnerLocked function is used to control the startup (resume) of the Activity.

[0092] In an embodiment of the present application, when the terminal device is in a locked screen state, an unlock operation is received. Then, when the terminal device begins to unlock in response to the unlock operation, the startup process of the first activity is timed. Wherein, after the terminal device is unlocked in response to the unlock operation, the interface of the first activity is displayed.

[0093] Among them, the terminal device displays the interface of the first Activity after being unlocked in response to the unlock operation, indicating that the terminal device runs the first Activity in the background in the lock screen state, and the terminal device restarts the first Activity in response to the unlock operation.

[0094] For example, when the terminal device responds to the unlock operation, the ATMS in the ApplicationFramework310 of the terminal device calls the ATMS.keyguardGoingAway function, which is used to execute the unlock process for the terminal device. Since the terminal device directly restarts the first activity in response to the unlock operation, the terminal device can start timing the startup process of the first activity when it determines that the keyguardGoingAway function is called (i.e., when the device is unlocked).

[0095] S402: If, before the first Activity is successfully started, the timing duration of the startup process of the first Activity is greater than the first preset duration, the terminal device displays a first prompt message.

[0096] The terminal device may display the first prompt information in a pop-up window.

[0097] The first prompt information is used to indicate that the first APP has no response. The first prompt information includes a first option and a second option. The first option is used to trigger the terminal device to continue waiting for the first APP to respond, and the second option is used to trigger the terminal device to close the first APP.

[0098] For example, when the AMS in the Application Framework 310 of the terminal device successfully resumes the first activity, the ATMS in the Application Framework 310 of the terminal device calls the activityResumed function. The activityResumed function is used to perform related operations after the first activity is successfully started. Therefore, the terminal device can determine that the first activity has been successfully started when the activityResumed function is called.

[0099] In an embodiment of the present application, when the terminal device starts the first Activity in the first application APP, it can also record the identifier of the first APP (such as the name of the first APP). The first prompt information may include the identifier of the first APP. If the timing duration of the startup process of the first Activity is greater than the first preset duration before the first Activity is successfully started, the terminal device can first determine whether the first APP is running in the foreground based on the identifier of the first APP. When the first APP is running in the foreground, the first prompt information is displayed. In this way, the problem of inconsistency between the first prompt information displayed by the terminal device and the displayed APP can be avoided.

[0100] In an embodiment of the present application, if the timer duration of the first Activity startup process exceeds a first preset timer before the first Activity is successfully launched, the terminal device generates a first log. The first log is used to record the first Activity startup process. The terminal device then sends the first log to a server or cloud platform, which is used to analyze the cause of the first Activity startup timeout.

[0101] Before the first Activity is successfully launched, if the timer duration of the first Activity startup process exceeds the first preset timer, in addition to displaying the first prompt message, the terminal device may also generate a first log and send the first log to a server or cloud platform (such as the aforementioned cloud platform 100). Furthermore, the developer may download the first log from the server or cloud platform and analyze the first log to identify the cause of the first Activity startup timeout, providing a basis for optimizing the first APP or the operating system of the terminal device.

[0102] The first log may be used to record relevant information during the startup of the first Activity, such as CPU status statistics, process method call stack information, and the like.

[0103] For example, if the timing duration of the startup process of the first Activity is greater than the first preset duration before the first Activity is successfully started, Native 330 of the terminal device obtains the first log and sends the first log to the cloud platform.

[0104] In the embodiment of this application, Figure 5 As shown, after S401, the timeout detection method for an application program may further include S403.

[0105] S403: If the first Activity is successfully started within the first preset time, or the terminal device receives a lock screen operation, the terminal device stops timing the startup process of the first Activity.

[0106] Exemplarily, if the timing duration of the startup process of the first Activity is less than or equal to the first preset duration, it is determined to call the activityResumed function, and it is determined that the first Activity is successfully started within the first preset duration.

[0107] It is understandable that when the terminal device starts the first Activity in the first APP, it also increases the timing of the startup process of the first Activity, that is, records the duration of the startup process of the first Activity. Then, if before the first Activity is successfully started, the timing duration of the startup process of the first Activity (that is, the duration consumed to start the first Activity) is greater than the first preset duration, it can indicate that the startup process of the first Activity has timed out. Among them, if the terminal device cannot normally display the interface of the first Activity and / or provide the function of interacting with the first Activity before the first Activity is successfully started, the user cannot operate the first Activity and can only wait for the first Activity to start successfully. Therefore, if the startup process of the first Activity times out, it means that the user needs to wait for a long time before interacting with the terminal device.

[0108] In an embodiment of the present application, the terminal device may display a first prompt message when the startup process of the first activity times out. This first prompt message indicates that the first app is unresponsive. Specifically, the first prompt message informs the user of the startup status of the first app. This prevents the user from waiting blindly for a long time due to being unclear about the startup status of the first app, thereby ensuring a better user experience.

[0109] Secondly, the first prompt information also includes a first option and a second option. The first option is used to trigger the terminal device to continue waiting for the first app to respond, and the second option is used to trigger the terminal device to close the first app. In other words, the terminal device provides the user with the option of closing the first app or continuing to wait for the first app, allowing the user to control the startup process of the first activity in the first app according to their personal wishes, thereby improving the user experience.

[0110] For example, please refer to Figure 6Schematic diagram of the system architecture of the terminal device, a first timeout detection module 311 can be added to the Application Framework 310 of the terminal device 200. The Application Framework 310 of the terminal device can generate a first delay trigger message when pausing the second Activity when switching the interface of the first APP or switching from the second APP to the first APP; or, generate a first delay trigger message when unlocking. Then, the Application Framework 310 of the terminal device 200 transmits the first delay trigger message to the first timeout detection module 311. Among them, the first delay trigger message is used to indicate that the startup duration of the first Activity is greater than the first preset duration, which triggers the generation of the first prompt information and the first timeout message. The first timeout message is used to indicate that the startup process of the first Activity has timed out.

[0111] Then, the terminal device 200 receives and responds to the first delay trigger message through the first timeout detection module 311, begins timing the startup process of the first Activity, and determines whether the timing duration of the startup process of the first Activity is greater than the first preset duration (i.e., determines that it has timed out). If the timing duration of the startup process of the first Activity is greater than the first preset duration before the first Activity is successfully started (resume), the first timeout detection module 311 generates a first prompt message and a first timeout message; then, the terminal device can display the first prompt message through a pop-up window, and also transmit the first timeout message to Native 330 of the terminal device 200 through the first timeout detection module 311; Native 330 of the terminal device 200 receives and responds to the first timeout message, generates a first log, and sends the first log to the cloud platform 100. If the first Activity is successfully started (resume) within the first preset duration, or the Application Framework 310 of the terminal device 200 receives a lock screen operation, the first delay trigger message is canceled.

[0112] Among them, the Application Framework 310 of the terminal device 200 can generate a first delayed trigger message when it determines to call the startPausingLocked function (i.e., start pausing the second Activity) or to call the keyguardGoingAway function (i.e., lock the screen). The Application Framework 310 of the terminal device can cancel the first delayed trigger message when it determines to call the activityResumed function within the first preset time (i.e., the first Activity is successfully started within the first preset time).

[0113] It should be noted that, since the terminal device 200 starts (resume) the first Activity after pausing the second Activity. Therefore, the startup process of the first Activity when switching the interface of the first APP or switching from the second APP to the first APP includes three links: pausing the second Activity, starting (resume) the first Activity, and AMS calling a function during the process of starting (resume) the first Activity. Since the timeout of any one of these three links will cause the startup process of the first Activity to time out; therefore, the terminal device 200 detects whether the startup process of the first Activity has timed out, and timeout detection can be performed on all three links. That is to say, in an embodiment of the present application, the terminal device 200 starts the first Activity when switching the interface of the first APP or switching from the second APP to the first APP, and the startup process of the first Activity includes pausing the second Activity.

[0114] In an embodiment of the present application, the Application Framework of the terminal device starts (resumes) the first Activity and also controls Applications to draw the interface of the first Activity. Only when the interface drawing of the first Activity is completed can the complete interface of the first Activity be displayed. Therefore, if the interface drawing of the first Activity times out, the terminal device will have a black screen or a white screen for a long time. If the terminal has a black screen or a white screen for a long time, the user will not be able to view the interface of the first Activity for a long time, resulting in a poor user experience. To address this problem, when the terminal device starts the first Activity in the first application APP, in addition to performing a timeout detection on the startup process of the first Activity, it also performs a timeout detection on the interface drawing process of the first Activity. Specifically, if Figure 7 As shown, the timeout detection method for an application program may further include S701-S703.

[0115] S701: After the terminal device starts to start the first Activity, when starting to draw the interface of the first Activity, the process of the terminal device drawing the interface of the first Activity is timed.

[0116] After the terminal device starts the first activity, it begins drawing the interface of the first activity and starts timing the interface drawing process of the first activity. The terminal device also determines whether the interface drawing process of the first activity exceeds a second preset time. If the timing duration of the interface drawing process of the first activity exceeds the second preset time, it indicates that the interface drawing process of the first activity has timed out.

[0117] The second preset duration can be set based on the maximum amount of time a user can wait, or the average of the interface drawing times of multiple activities. For example, the second preset duration can be 2 seconds, 3 seconds, or 5 seconds. The second preset duration can be different from or the same as the first preset duration.

[0118] For example, when a terminal device resumes a first activity, the AMS in Application Framework 310 of the terminal device calls the Activity.onResume function in Applications 320. The Activity.onResume function is used to control execution and user interaction-related tasks, including drawing the first activity's interface. Therefore, the terminal device can begin timing the process of drawing the first activity's interface when it determines that the Activity.onResume function has been called.

[0119] S702: If the time duration of the terminal device drawing the interface of the first Activity is greater than the second preset time duration before the interface of the first Activity is drawn, the terminal device displays a first prompt message.

[0120] For example, Applications 320 of the terminal device calls the ViewRootImpl.performDraw function, which is used to draw the interface of the first Activity. Therefore, the terminal device can determine that the drawing of the interface of the first Activity is completed when the ViewRootImpl.performDraw function is called.

[0121] It should be noted that the first prompt information in S702 is the same as the first prompt information in S602 above, and will not be described in detail in this embodiment of the present application.

[0122] In an embodiment of the present application, if the timing duration of the terminal device drawing the interface of the first Activity is greater than the second preset duration before the interface of the first Activity is drawn, the terminal device generates a second log, and the second log is used to draw the interface process of the first Activity; the terminal device sends the second log to the server or cloud platform, and the second log is used to analyze the reason for the terminal device's timeout in drawing the interface of the first Activity.

[0123] Before the first activity's interface is finished drawing, if the timer duration of the first activity's interface drawing process exceeds a second preset timer, the terminal device may also generate a second log and send the second log to a server or cloud platform (such as the aforementioned cloud platform 100). Developers can then download the second log from the server or cloud platform and analyze it to determine the cause of the first activity's interface drawing timeout.

[0124] The second log can be used to record relevant information during the first Activity's interface drawing process, such as CPU status statistics, process method call stack information, etc. The second log is different from the first log.

[0125] S703: If the interface of the first Activity is drawn within the second preset time, or the terminal device receives a lock screen operation, the terminal device stops timing the process of drawing the interface of the first Activity.

[0126] Exemplarily, if the timing duration of the interface drawing process of the first Activity is less than or equal to the second preset duration, it is determined to call the ViewRootImpl.performDraw function, and it is determined that the interface of the second Activity is drawn within the second preset duration.

[0127] In the embodiment of the present application, a thread can be set in the terminal device, which has the function of monitoring the interface drawing process of the first activity and detecting the timeout of the interface drawing of the first activity. In other words, when the terminal device starts the first activity, it starts the thread to execute S701-S703 through the thread.

[0128] It is understandable that when the terminal device starts the first Activity in the first APP, in addition to increasing the timing of the startup process of the first Activity, it also increases the timing of the process of drawing the interface of the first Activity. If the timing duration of the terminal device's process of drawing the interface of the first Activity is greater than the second preset duration before the interface drawing of the first Activity is completed, it may indicate that the interface drawing of the first Activity has timed out. The terminal device can display a first prompt message when the interface drawing of the first Activity times out. The first prompt message is used to indicate that the first APP is unresponsive, that is, the user can be informed of the startup status of the first APP through the first indication message. This can avoid the problem that the user can only see a black screen or a white screen for a long time, resulting in a poor user experience.

[0129] For example, please refer to Figure 8 Schematic diagram of the system architecture of the terminal device, a second timeout detection module 321 can be added to the Applications 320 of the terminal device 200. The Application Framework 310 of the terminal device can first pause (pause) the second Activity and then start (resume) the first Activity when switching the interface of the first APP or switching from the second APP to the first APP; or, directly start (resume) the first Activity when unlocking. While starting (resume) the first Activity, the Application Framework 310 of the terminal device also controls Applications 320 to draw (draw) the interface of the first Activity. When determining to start drawing (draw) the interface of the first Activity, the Applications 320 of the terminal device can generate a second delay trigger message and transmit the second delay trigger message to the second timeout detection module 321. Among them, the second delay trigger message is used to indicate that the interface drawing time of the first Activity is greater than the second preset time, which triggers the generation of the first prompt information and the second timeout message. The second timeout message is used to indicate that the interface drawing process of the first Activity has timed out.

[0130] Then, the terminal device 200 receives and responds to the second delay trigger message through the second timeout detection module 321, starts timing the interface drawing process of the first activity, and determines whether the timing duration of the interface drawing process of the first activity is greater than the second preset duration (i.e., determines that it has timed out). If the timing duration of the interface drawing process of the first activity is greater than the second preset duration before the first activity interface is drawn, the second timeout detection module 321 generates the above-mentioned first prompt information and generates a second timeout message; then, the terminal device 200 can display the first prompt information through a pop-up window, and also transmit the second timeout message to the Native 330 of the terminal device 200 through the second timeout detection module 321; the Native 330 of the terminal device 200 receives and responds to the second timeout message, generates a second log, and sends the second log to the cloud platform 100. If the interface drawing of the first activity is completed within the second preset duration, or the Application Framework 310 of the terminal device 200 receives a lock screen operation, the second delay trigger message is canceled.

[0131] Among them, Applications320 of terminal device 200 can generate a second delayed trigger message when determining to call the Activity.onResume function (i.e., start drawing the interface of the first Activity). Applications320 of terminal device 200 can cancel the second delayed trigger message when determining to call the ViewRootImpl.performDraw function within the second preset time (i.e., the first Activity completes interface drawing within the second preset time).

[0132] It should be noted that the above thread can be set in the second timeout detection module 321.

[0133] For example, the process of detecting timeout of the terminal device is described by taking the terminal device as a mobile phone and starting the first activity when unlocking. When the terminal device receives the user's lock screen operation while running the first activity, the terminal device enters the lock screen state and runs the first activity in the background in the lock screen state. Then, if the user presses the power button, the lock screen interface is displayed, such as Figure 9The lock screen shown in (a) also displays the time "11:30" and the date "September 10, Thursday". After receiving the user's unlock operation, the terminal device jumps to the display interface, directly starts the first activity, and times the startup process of the first activity. The terminal device can also time the interface drawing process of the first activity. Before the interface drawing of the first activity is completed, the display interface of the terminal device is as follows: Figure 9 As shown in (b) in the figure. Figure 9 As can be seen from (b) in the figure, the display interface of the terminal device displays the contents of the status bar 901, and the rest of the display interface is black (e.g. Figure 9 If the time duration of the startup process of the first Activity before the first Activity is successfully started is longer than the first preset time duration, or the time duration of the interface drawing process of the first Activity before the interface drawing of the first Activity is completed is longer than the second preset time duration, the terminal device displays the first prompt message 902, such as Figure 9 As shown in (c) in the figure. Figure 9 As can be seen from (c), the first prompt information 902 includes: "The first APP is not responding, do you want to close it?", a first option named "Wait" and a second option named "Close the application".

[0134] When unlocking, the terminal device directly starts the first Activity without pausing the second Activity. Figure 9 For details of the first option and the second option displayed in (c), please refer to the specific description of the first option and the second option in S402.

[0135] For example, the terminal device is a mobile phone, and the first activity is started when the display interface switches from the second activity to the first activity. The process of detecting timeout of the terminal device is described. Figure 10 As shown in (a) in . Figure 10 As can be seen from (a) in the figure, the desktop includes the icon 1001 of the first APP. If the startup operation of the first APP is received, the terminal device first pauses (pauses) the second Activity corresponding to the desktop, and then resumes (resumes) the main activity MainActivity (i.e., the first Activity) in the first APP. Among them, the terminal device times the startup process of the first Activity while pausing (pausing) the second Activity corresponding to the desktop. Before the first Activity is successfully started, the display interface of the terminal device is as follows: Figure 10 As shown in (b) in the figure. Figure 10 As can be seen from (b) in the figure, the display interface of the terminal device is white except for the content of the status bar 1002, which is a white screen. If the timing duration of the startup process of the first Activity before the first Activity is successfully started is greater than the first preset duration, the terminal device will display the first prompt message 1003, such as Figure 10 As shown in (c) in the figure. Figure 10 As can be seen from (c), the first prompt information 1003 includes: "The first APP is not responding, do you want to close it?", a first option named "Wait" and a second option named "Close the application".

[0136] in, Figure 10 For details of the first option and the second option displayed in (c), please refer to the specific description of the first option and the second option in S402.

[0137] In an embodiment of the present application, a terminal device can start a first Activity in a multi-screen collaboration scenario or a multi-window scenario. Multi-screen collaboration refers to executing the tasks of two devices on one device, that is, running its own APP and the APP of another device on one device at the same time. Multi-window refers to running multiple APPs simultaneously on one device. It can be seen that the terminal device can start activities in multiple APPs at the same time in a multi-screen collaboration scenario or a multi-window scenario. Among them, the Activity in each APP can be used as the first Activity in the first APP. In order to ensure accurate detection of whether the startup of the Activity of each APP in multiple APPs has timed out, the first delayed trigger message or the second delayed trigger message generated by the terminal device may also include the identifier of the first Activity. Furthermore, the first prompt information generated by the terminal device may include the identifier of the first Activity, and the generated first timeout message or the second timeout message may also include the identifier of the first Activity. The terminal device generates a first log of the first Activity based on the identifier of the first Activity in the first timeout message; or, generates a second log of the first Activity based on the identifier of the first Activity in the second timeout message.

[0138] For example, the process of detecting timeout of the terminal device is described by taking the terminal device as a mobile phone and starting the first Activity in a multi-window scenario as an example. Figure 11 As shown in (a), the terminal device supports multiple windows, and the terminal device runs a third APP in one window. Figure 11As can be seen from (a) in the figure, the terminal device displays the interface 1101 of the third APP in the window corresponding to the third APP; and displays the interface 1102 of the desktop outside the window corresponding to the third APP, and the desktop interface 1102 includes the icon 1103 of the first APP. When the terminal device runs the third APP in a multi-window scenario, it receives a startup operation for the first APP, and the terminal device directly starts (resumes) the main activity MainActivity (i.e., the first Activity) in the first APP. Among them, the terminal device times the startup process of the first Activity at the same time as starting to start the first Activity. Before the first Activity is successfully started, the display interface of the terminal device is as follows: Figure 11 As shown in (b) in the figure. Figure 11 As can be seen from (b) in the figure, the window 1104 corresponding to the first APP in the terminal device is displayed in white, which is a white screen. If the timing duration of the startup process of the first Activity before the first Activity is successfully started is greater than the first preset duration, the window 1104 corresponding to the first APP in the terminal device displays the first prompt message 1105, such as Figure 11 As shown in (c) in the figure. Figure 11 As can be seen in (c), the first prompt message 1105 includes: "The first APP is unresponsive, do you want to close it?", a first option named "Wait", and a second option named "Close the application". Among them, the terminal device has a third APP installed, and the third APP is an APP different from the first APP.

[0139] It is understandable that the above method can be implemented by the timeout detection device of the application. In order to realize the above functions, the timeout detection device of the application includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0140] The embodiment of the present application can divide the functional modules of the above-mentioned terminal device etc. according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0141] In the case of dividing each functional module into corresponding functional modules, Figure 12 A possible structural diagram of the terminal device involved in the above embodiment is shown, and the terminal device 200 includes: a control module 1201 and a display module 1202. Among them, the control module 1201 is used to time the startup process of the first Activity when starting the first Activity in the first application APP; the display module 1202 is used to display a first prompt message if the timing duration of the startup process of the first Activity is greater than a first preset duration before the first Activity is successfully started. The first prompt message is used to indicate that the first APP is unresponsive. The first prompt message also includes a first option and a second option. The first option is used to trigger the terminal device 200 to continue waiting for the first APP to respond, and the second option is used to trigger the terminal device 200 to close the first APP.

[0142] In a possible implementation, the control module 1201 is further configured to stop timing the startup process of the first Activity if the first Activity is successfully started within a first preset time period, or the terminal device 200 receives a lock screen operation.

[0143] In another possible implementation, the terminal device 200 further includes a sending module 1203. The control module 1201 is further configured to generate a first log if the timed duration of the first Activity startup process is greater than a first preset duration before the first Activity is successfully launched. The first log is used to record the first Activity startup process. The sending module 1203 is configured to send the first log to a server. The first log is used to analyze the cause of the first Activity startup timeout.

[0144] In another possible implementation, the control module 1201 is further used to time the process of drawing the interface of the first Activity when the interface of the first Activity is started after the first Activity is started; the display module 1202 is further used to display a first prompt message if the timing duration of the process of drawing the interface of the first Activity is greater than a second preset duration before the interface of the first Activity is completed.

[0145] In another possible implementation, the control module 1201 is further used to generate a second log for drawing the interface of the first Activity if the timing duration of the process of drawing the interface of the first Activity is greater than a second preset duration before the interface of the first Activity is drawn. The second log is used to draw the interface of the first Activity; the sending module 1203 is used to send the second log to the server, and the second log is used to analyze the reason for the timeout in drawing the interface of the first Activity.

[0146] In another possible implementation, the control module 1201 is further configured to stop timing the process of drawing the interface of the first Activity if the interface of the first Activity is drawn within a second preset time period or a lock screen operation is received.

[0147] In another possible implementation, the control module 1201 is specifically configured to, when switching the display interface of the terminal device 200 from the second activity to the first activity, time the startup process of the first activity when the second activity begins to be paused. The second activity is an activity of the first app or an activity of the second app, and the first app and the second app are different.

[0148] In another possible implementation, the control module 1201 is specifically configured to: when in a locked screen state, receive an unlock operation; and, when unlocking is initiated in response to the unlock operation, time the startup process of the first activity. The terminal device 200 displays the interface of the first activity after being unlocked in response to the unlock operation.

[0149] Another embodiment of the present application provides a terminal device (such as Figure 1 、 Figure 2 、 Figure 3 、 Figure 6 、 Figure 8 、 Figure 12 The mobile terminal 200 shown in FIG. 1 may include one or more processors, a memory, a wireless communication module, and a mobile communication module. The memory, wireless communication module, and mobile communication module are coupled to the processor. The memory is used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the mobile terminal can perform the functions or steps performed by mobile terminal 200 in the above-described method embodiments.

[0150] Another embodiment of the present application provides a computer-readable storage medium, wherein computer instructions are stored on the computer-readable storage medium. When the computer instructions are transmitted to a terminal device (such as Figure 1 、 Figure 2 、 Figure 3 、 Figure 6 、 Figure 8 、 Figure 12 When the computer-readable storage medium is executed on the mobile terminal 200 shown in FIG. 1 , the terminal device executes the functions or steps executed by the mobile terminal 200 in the above method embodiment. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, or an optical data storage device.

[0151] Another embodiment of the present application provides a computer program product, including one or more instructions, which can be executed on a terminal device (such as Figure 1 、 Figure 2 、 Figure 3 、 Figure 6 、 Figure 8 、 Figure 12 The mobile terminal 200 shown in the figure) is executed so that the terminal device executes each function or step executed by the mobile terminal 200 in the above method embodiment.

[0152] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0153] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0155] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0157] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for detecting timeout of an application, characterized in that: The method comprises: When the terminal device starts the first activity in the first application APP, the terminal device times the startup process of the first activity; If the timing duration of the startup process of the first Activity is greater than the first preset duration before the first Activity is successfully started, display a first prompt message; The first prompt information is used to indicate that the first APP is unresponsive, and the first prompt information further includes a first option and a second option, the first option is used to trigger the terminal device to continue waiting for the first APP to respond, and the second option is used to trigger the terminal device to close the first APP; After the terminal device starts to start the first Activity, when starting to draw the interface of the first Activity, timing the process of the terminal device drawing the interface of the first Activity; If the timing duration of the terminal device drawing the interface of the first Activity is greater than the second preset duration before the interface of the first Activity is drawn, the terminal device displays the first prompt information.

2. The method according to claim 1, characterized in that The method further comprises: If the first Activity is successfully started within the first preset time, or the terminal device receives a lock screen operation, the terminal device stops timing the startup process of the first Activity.

3. The method according to claim 1 or 2, characterized in that The method further comprises: If, before the first Activity is successfully started, the timing duration of the startup process of the first Activity is greater than the first preset duration, the terminal device generates a first log, where the first log is used to record the startup process of the first Activity; The terminal device sends the first log to the server, where the first log is used to analyze a reason why the first Activity startup timed out.

4. The method according to claim 1, wherein The method further comprises: If, before the first Activity's interface is drawn, the timer duration for the terminal device to draw the first Activity's interface is greater than a second preset timer duration, the terminal device generates a second log, where the second log is used to record the process of drawing the first Activity's interface; The terminal device sends the second log to the server, where the second log is used to analyze a reason why the terminal device times out when drawing the interface of the first Activity.

5. The method according to claim 1 or 4, characterized in that The method further comprises: If the interface of the first Activity is drawn within the second preset time, or the terminal device receives a lock screen operation, the terminal device stops timing the process of drawing the interface of the first Activity.

6. The method according to any one of claims 1, 2 and 4, characterized in that: When the terminal device starts a first activity in a first application APP, timing the startup process of the first activity includes: When the terminal device switches the display interface of the terminal device from the second Activity to the first Activity, when starting to pause the second Activity, timing the startup process of the first Activity; The second activity is an activity of the first APP or an activity of the second APP, and the first APP is different from the second APP.

7. The method according to any one of claims 1, 2 and 4, characterized in that: When the terminal device starts a first activity in a first application APP, timing the startup process of the first activity includes: When the terminal device is in a locked screen state, receiving an unlock operation, wherein the terminal device displays the interface of the first Activity after being unlocked in response to the unlock operation; When the terminal device starts to unlock in response to the unlock operation, the startup process of the first Activity is timed.

8. A terminal device, characterized in that: The terminal device includes: a control module and a display module; The control module is configured to time the startup process of the first Activity in the first application APP when the first Activity is started; The display module is configured to display a first prompt message if a timing duration of the startup process of the first Activity is greater than a first preset duration before the first Activity is successfully started; The first prompt information is used to indicate that the first APP is unresponsive, and the first prompt information further includes a first option and a second option, the first option is used to trigger the terminal device to continue waiting for the first APP to respond, and the second option is used to trigger the terminal device to close the first APP; The control module is further configured to time a process of drawing the interface of the first Activity when the interface of the first Activity begins to be drawn after the first Activity is started; The display module is further configured to display the first prompt information if a timing duration of a process of drawing the interface of the first Activity is greater than a second preset duration before the interface of the first Activity is drawn.

9. The terminal device according to claim 8, characterized in that The control module is further configured to stop timing the startup process of the first Activity if the first Activity is successfully started within the first preset time period, or if the terminal device receives a lock screen operation.

10. The terminal device according to claim 8 or 9, characterized in that: The terminal device further includes a sending module; The control module is further configured to generate a first log for recording the startup process of the first Activity if the timing duration of the startup process of the first Activity is greater than the first preset duration before the first Activity is successfully started; The sending module is used to send the first log to the server, where the first log is used to analyze the reason why the first Activity startup timed out.

11. The terminal device according to claim 8, characterized in that The terminal device further includes a sending module; The control module is further configured to generate a second log for the process of drawing the interface of the first Activity if the time duration of drawing the interface of the first Activity is greater than a second preset time duration before the interface of the first Activity is drawn. The second log is used to record the process of drawing the interface of the first Activity; The sending module is used to send the second log to the server, where the second log is used to analyze the reason why the terminal device times out when drawing the interface of the first Activity.

12. The terminal device according to claim 8 or 11, characterized in that: The control module is further configured to stop timing the process of drawing the interface of the first Activity if the interface of the first Activity is drawn within the second preset time or a lock screen operation is received.

13. The terminal device according to any one of claims 8, 9 and 11, characterized in that: The control module is specifically configured to, when the display interface of the terminal device is switched from the second activity to the first activity, time the startup process of the first activity when the second activity begins to be paused; The second activity is an activity of the first APP or an activity of the second APP, and the first APP is different from the second APP.

14. The terminal device according to any one of claims 8, 9 and 11, characterized in that: The control module is specifically used to: When in a locked screen state, receiving an unlock operation; wherein, the terminal device displays the interface of the first Activity after unlocking in response to the unlock operation; When unlocking is started in response to the unlocking operation, a startup process of the first Activity is timed.

15. A terminal device, characterized in that: The terminal device comprises: a processor and a memory; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; the processor is used to execute the computer instructions, so that the terminal device executes the method according to any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a terminal device, the terminal device is enabled to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Application program non-response blocking detection method, terminal and storage medium

    CN110188016A

  • Start interface jamming processing method and device, apparatus and storage medium

    CN110308951A