Abnormality processing method, terminal equipment and storage medium
By monitoring application exceptions in the terminal device, determining the exception type and adjusting the operating environment, the problem of abnormal application operation is solved and the stability and reliability of the device are improved.
Patent Information
- Application Number
- CN202310266772.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-17
- Publication Date
- 2024-09-20
AI Technical Summary
There is a high probability that applications in terminal devices will run abnormally, resulting in reduced operational stability and making it difficult for manufacturers to optimize a large number of applications.
By monitoring application running exceptions, the preset exception type is determined based on the exception information, and local resource configuration and application configuration are adjusted according to the type to eliminate the exception and avoid future exceptions.
It improves the operational stability of terminal equipment, reduces the probability of application exceptions, and enhances equipment reliability.
Smart Images

Figure CN118672844A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information processing technology, and in particular, relates to an exception handling method, a terminal device, and a storage medium. Background Art
[0002] With the rapid development of electronic technology, the types and number of applications supported by terminal devices are growing rapidly. By installing applications with different functions, people's life convenience and the timeliness of information acquisition can be effectively improved.
[0003] At present, while the number of applications is growing rapidly, the phenomenon of abnormal application operation due to incompatibility between terminal devices and applications or defects in applications is also increasing rapidly. It is difficult for terminal device manufacturers to optimize a large number of applications, resulting in a gradual increase in the probability of abnormal application operation, which reduces the operational stability of terminal devices. Therefore, how to reduce the probability of abnormal application operation has become a problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, an embodiment of the present application provides an exception handling method, a terminal device and a storage medium to solve the problem of a high probability of exceptions occurring during the operation of existing applications.
[0005] A first aspect of an embodiment of the present application provides an exception handling method, including:
[0006] When an application operation exception is detected, the preset exception type triggered by the corresponding application is determined based on the exception information;
[0007] The operating environment of the corresponding application is adjusted according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
[0008] A first aspect of an embodiment of the present application provides an exception handling method, by determining a preset exception type triggered by a corresponding application based on exception information when an application operation exception is monitored; and adjusting the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration, so that the application can instantly judge the preset exception type when an operation exception occurs, and determine a corresponding adjustment strategy according to the preset exception type to adjust the local resource configuration and / or application configuration to eliminate the exception that occurs when the application is running, and avoid the application from having an exception again in subsequent operations, thereby improving the operating stability of the terminal device.
[0009] The second aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the exception handling method provided in the first aspect of the embodiment of the present application when executing the computer program.
[0010] A third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the exception handling method provided in the first aspect of the embodiment of the present application are implemented.
[0011] It can be understood that the beneficial effects of the second and third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0014] Figure 2 This is a schematic diagram of an architecture of an operating system running on a terminal device provided in an embodiment of the present application;
[0015] Figure 3 This is a first flow chart of the exception handling method provided in the embodiment of the present application;
[0016] Figure 4 is an interaction sequence diagram when a terminal device performs an exception handling method provided in an embodiment of the present application;
[0017] Figure 5 This is a second flow chart of the exception handling method provided in the embodiment of the present application;
[0018] Figure 6 This is a third flow chart of the exception handling method provided in the embodiment of the present application;
[0019] Figure 7 This is a fourth flow chart of the exception handling method provided in the embodiment of the present application;
[0020] Figure 8 This is a flowchart of a task push method provided in an embodiment of the present application;
[0021] Fig. 9 It is a structural schematic diagram of an exception handling system provided in an embodiment of the present application;
[0022] Fig.10 It is a structural schematic diagram of an exception handling device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0024] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0025] It should also be understood that the term “and / or” used in the specification and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0026] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0027] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0028] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0029] In applications, while the number of applications is growing rapidly, the phenomenon of abnormal application operation due to incompatibility between terminal devices and applications or defects in applications is also increasing rapidly. It is difficult for terminal device manufacturers to optimize all of the large number of applications, resulting in a gradual increase in the probability of abnormal application operation, which reduces the operational stability of terminal devices. Therefore, how to reduce the probability of abnormal application operation has become a problem that needs to be solved urgently.
[0030] In response to the above technical problems, an embodiment of the present application provides an exception handling method, which determines the preset exception type triggered by the corresponding application based on the exception information when monitoring the application operation exception; adjusts the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration, so that the application can instantly judge the preset exception type when the operation exception occurs, and determine the corresponding adjustment strategy according to the preset exception type to adjust the local resource configuration and / or application configuration to eliminate the exception that occurs when the application is running, and avoid the application from having exceptions again in subsequent operations, thereby improving the operating stability of the terminal device.
[0031] The exception handling method provided in the embodiment of the present application can be applied to a terminal device. The terminal device can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific type of the terminal device.
[0032] Figure 1The schematic diagram of the structure of the terminal device 1 is shown as an example. The terminal device 1 includes a processor 10, a memory 20, an audio module 30, a camera module 40, a sensor module 50, an input module 60, a display module 70, a wireless communication module 80, and a power module 90. The audio module 30 may include a speaker 31 and a microphone 32, the camera module 40 may include a short-focus camera 41, a long-focus camera 42, and a flash 43, the sensor module 50 may include an infrared sensor 51, an acceleration sensor 52, a position sensor 53, a fingerprint sensor 54, and an iris sensor 55, the input module 60 may include a touch panel 61 and an external input unit 62, and the wireless communication module 80 may include wireless communication units such as Bluetooth, optical wireless communication (Optical Wireless), mobile communication (Mobile Communications), wireless local area network (Wireless Local Area Network, WLAN), near field communication (Near Field Communication, NFC) and ZigBee protocol (ZigBee).
[0033] In applications, the processor 10 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0034] In application, the memory 20 may be an internal storage unit of the terminal device in some embodiments, such as a hard disk or memory of the terminal device. The memory 20 may also be an external storage device of the terminal device in other embodiments, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device. Further, the memory 20 may also include both an internal storage unit of the terminal device and an external storage device. The memory 20 is used to store computer programs 21 such as an operating system, an application program, and a boot loader (BootLoader). The memory 20 may also be used to temporarily store data that has been output or is to be output.
[0035] In application, the display module 70 can be a flat screen, a curved screen or a flexible screen, specifically a folding screen. The folding screen may include at least one flexible screen, or the folding screen may include at least one flexible screen and at least one flat screen or curved screen. The embodiment of the present application does not impose any restrictions on the specific type of the display module 70.
[0036] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 1. In other embodiments of the present application, the terminal device 1 may include more or fewer components than those illustrated, or may combine certain components, or different components, such as a graphics processor, etc. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0037] like Figure 2 As shown, the architecture diagram of the operating system running on the terminal device 1 provided in the embodiment of the present application, the layered architecture can divide the operating system into multiple layers, and the layers communicate with each other through software interfaces. In some embodiments, the operating system can be divided from top to bottom into an application layer 100, a framework layer 200, a system runtime layer 300, a hardware abstraction layer 400, and a Linux kernel layer 500.
[0038] It should be noted that the type of the operating system may be an Android system, an operating system customized based on the Android system, or other different types of operating systems. The embodiments of the present application do not impose any limitation on the specific type of the operating system.
[0039] In the application, the five layers of the operating system are introduced as follows:
[0040] The application layer 100 may include built-in applications 120 built into the system and upper layer applications 110 provided by third-party application providers. The application programs of the application layer 100 may interact directly with users to implement different functions provided by the application programs. For example, the application layer 100 may specifically include built-in applications such as email, phone, calendar, camera, contacts, and Bluetooth, and upper layer applications such as map positioning, food delivery, and video playback.
[0041] The framework layer (ApplicationFramwork) 200 may include an application programming interface (API) and a programming framework. The application programming interface may be used to provide an interface for operating system developers to develop applications, and may also be used to call corresponding basic services for applications in the application layer when implementing different functions. For example, the framework layer may include different types of application programming interfaces such as window managers, content providers, phone managers, positioning managers, and view systems.
[0042] The window manager is used to manage window programs. Specifically, it can be used to obtain the window size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0043] Content providers are used to store and retrieve data and make the data accessible to applications. The data may include videos, images, audio, call logs, contacts, browsing history, and bookmarks.
[0044] The phone manager is used to provide communication functions of the terminal device 1, such as management of call status, including answering and hanging up calls, etc.;
[0045] The positioning manager is used to obtain the location information of the terminal device 1, which may include different types of location information such as satellite location information (obtained through the global positioning system), network location information (obtained through a network positioning service), and fused location information (obtained through a fused positioning service);
[0046] The view system is used to provide visual controls, such as controls for displaying text and controls for displaying pictures, and is also used to build applications for displaying the application layer 100. The view system can run multiple visual controls at the same time, so that the terminal device can display multiple views at the same time, for example, a view that displays text and a view that displays pictures at the same time.
[0047] The system runtime layer (Native) 300 may include a C / C++ library 310 and an Android runtime library 320, wherein the C / C++ library 310 may include a drawing function library, a font engine, a rendering engine, a multimedia library, and a database engine, etc. The drawing function library may be OpenGL For Embedded Systems 3D (a 3D open graphics library running on embedded systems); the font engine is used to provide different fonts, and may be FreeType (a portable font engine); the rendering engine is used to render two-dimensional graphics or three-dimensional graphics, and may be Skia Graphics Library (an engine for rendering two-dimensional graphics); the multimedia library (Media Framework) is used to support the playback, recording, and playback of audio and video in different formats; the database engine is used to provide storage functions for different types of databases, so that different types of data can be stored in different types of databases according to actual needs, or different types of data can be stored in a unified database.
[0048] The Android runtime 320 may include core libraries (Core Libraries) and an Android runtime environment (Android Runtime, ART), wherein after the Android 5.0 system, the Dalvik virtual machine is replaced by ART. The core library provides most of the functions of the Java language core library, so that developers can use the Java language to write Android applications. Compared with the Java Virtual Machine (Java Virtual Machine, JVM), the Dalvik virtual machine is specially customized for mobile devices, allowing multiple virtual machine instances to run simultaneously in limited memory, and each Dalvik application is executed as an independent Linux process. Independent processes can prevent all programs from being closed when the virtual machine crashes. The mechanism of ART, which replaces the Dalvik virtual machine, is different from Dalvik. Under Dalvik, every time an application runs, the bytecode needs to be converted into machine code by a just-in-time compiler, which slows down the running efficiency of the application. In the ART environment, when the application is installed for the first time, the bytecode will be pre-compiled into machine code, making it a truly local application.
[0049] The Hardware Abstraction Layer (HAL) 400 is an interface layer between the operating system kernel and the hardware circuit. Its purpose is to abstract the hardware. In order to protect the intellectual property rights of hardware manufacturers, it hides the hardware interface details of a specific platform, thereby providing a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, so that the testing of software and hardware can be carried out in parallel.
[0050] The Linux kernel layer 500 can be used to provide system services of the operating system, including security services, memory management, process management, network protocol stack, driver model and other services of the operating system.
[0051] Understandably, Figure 2 The architecture diagram of an operating system is only shown by way of example. The operating system architecture can also be four-layer or six-layer, wherein the architecture of a four-layer operating system may include: an application layer, a framework layer, a system runtime layer and a Linux kernel layer; the architecture of a six-layer operating system may include: an application layer, a framework layer, a system runtime layer, a hardware abstraction layer, a Linux kernel layer and a hardware device layer. The embodiment of the method of the present application does not impose any limitation on the number of architecture layers and the specific architecture of the operating system.
[0052] like Figure 3 As shown, the exception handling method provided in the embodiment of the present application is applied to a terminal device, and includes the following steps S301 and S302:
[0053] Step S301: When an application operation exception is detected, a preset exception type triggered by the corresponding application is determined based on the exception information.
[0054] In an application, when any application is running, the AMS service (Activity Manager Service, which can run at the framework layer or the system runtime layer and is used to manage the life cycle of all activities in the terminal device) of the terminal device can monitor the application for exceptions. The exceptions monitored by the AMS service may include Native Crash (exception triggered by programs that can run directly on the operating system. In the Android system, the above programs are usually compiled in C or C++) and Java Crash (exception triggered by the Java code of the application).
[0055] In the application, when the AMS service monitors the application running abnormally, the exception information of the corresponding application can be obtained. Specifically, the exception information can be obtained through the Application Startup Manager, and the exception information is sent to the exception handling service through the System Service (running in the framework layer 200), and the preset exception type triggered by the corresponding application is determined by the exception handling service according to the exception information. Among them, the exception information may include at least one abnormal data of the application. When any data of the application exceeds the preset threshold, the AMS service can capture the corresponding data and determine it as abnormal data; the exception handling service can be an application running in the application layer, and can also run in the system runtime layer.
[0056] Step S302: adjusting the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
[0057] In the application, after the exception handling service determines the preset exception type, the operating environment of the corresponding application can also be adjusted according to the preset exception type. Specifically, the adjustment type of the operating environment can be first determined according to the preset exception type, and then the specific target adjustment data can be determined according to the exception information. Among them, the adjustment type of the operating environment may include local resource configuration and / or application configuration. The local resource configuration may include adjustment data such as memory configuration, video memory configuration, and cache configuration; the application configuration may include adjustment data such as application version and network configuration. The embodiment of the present application does not impose any restrictions on the specific type of adjustment data.
[0058] In the application, when an abnormality in the application operation is monitored, the preset abnormality type triggered by the corresponding application is determined based on the abnormality information; the operating environment of the corresponding application is adjusted according to the preset abnormality type; wherein the preset abnormality type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration, so that the application can instantly judge the preset abnormality type when an abnormality occurs in the operation, and determine the corresponding adjustment strategy according to the preset abnormality type to adjust the local resource configuration and / or application configuration, so as to eliminate the abnormality that occurs when the application is running, and avoid the abnormality of the application in subsequent operation, thereby improving the operating stability of the terminal device.
[0059] Figure 4 An example interaction sequence diagram is shown when a terminal device executes an exception handling method, wherein, in one embodiment, an activity management service, an application startup management service, and a system service can run simultaneously at the framework layer, and an exception handling service can run at the application layer.
[0060] like Figure 5 As shown, in one embodiment, based on Figure 3 The corresponding embodiment includes the following steps S501 to S504:
[0061] Step S501: When an application operation exception is detected, determine whether the corresponding application has a memory overflow based on the exception information.
[0062] In the application, the exception handling service can determine whether the corresponding application has memory overflow based on the exception information. Specifically, the exception information may include the memory usage value / memory usage ratio of the application. If the memory usage value / memory usage ratio is greater than or equal to the preset memory usage value / preset memory usage ratio, it is determined that the corresponding application has memory overflow; if the memory usage value / memory usage ratio is less than the preset memory usage value / preset memory usage ratio, it is determined that the corresponding application does not have memory overflow.
[0063] Among them, each application can be set with a corresponding preset memory usage value / memory usage ratio, the preset memory usage value can be 3g, 4g or 5g, and the preset memory usage ratio can be 50%, 60% or 70%. The embodiment of the present application does not impose any restrictions on the specific values of the preset memory usage value / preset memory usage ratio.
[0064] Step S502: If it is determined that the corresponding application has a memory overflow, determine that the preset exception type is a local memory overflow;
[0065] Step S503: If it is determined that the number of times that the corresponding application has memory overflow reaches a preset number, determine that the preset exception type is application memory overflow.
[0066] In the application, when it is determined that the number of times the corresponding application has memory overflow is within a preset number, the preset exception type can be determined as local memory overflow; conversely, when it is determined that the number of times the corresponding application has memory overflow reaches a preset number, the preset exception type is determined as application memory overflow.
[0067] Step S504: adjusting the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
[0068] In the application, the exception handling method provided in step S504 can refer to the relevant description in the above step S302, which will not be repeated here. It should be noted that the specific adjustment method for the abnormal phenomenon of memory overflow can refer to the above Figure 7 The relevant descriptions in the corresponding embodiments are not repeated here.
[0069] In the application, the terminal device can monitor whether the application has a memory overflow, and when it is determined that the application has a memory overflow, the root cause of the memory overflow in the application can be detected based on the number of occurrences of the memory overflow. Specifically, if the number of occurrences does not reach the preset number, the preset exception type is determined to be a local memory overflow, and the relative adjustment type of the operating environment is adjusted until the number of occurrences reaches the preset number, indicating that the memory overflow phenomenon still exists after multiple operating environment adjustments, then the preset exception type is determined to be an application memory overflow, and the adjustment type of the operating environment is changed to flexibly respond to the abnormal phenomenon of memory overflow, thereby improving the flexibility of eliminating abnormalities and the operating stability of the terminal device.
[0070] like Figure 6 As shown, in one embodiment, based on Figure 3 The corresponding embodiment includes the following steps S601 to S605:
[0071] Step S601: When an abnormal operation of an application is detected, determine whether the corresponding application has abnormal permissions based on the abnormal information.
[0072] In the application, the exception handling service can also determine whether the corresponding application has abnormal permissions based on the exception information. The abnormal permissions can be permissions that are missing when the corresponding application is running, or permissions that are blocked when the corresponding application is running.
[0073] Step S602: if it is determined that the corresponding application has abnormal permissions, obtain permission declaration information of the corresponding application;
[0074] Step S603: If the permission declaration information of the corresponding application includes abnormal permissions, determine that the preset abnormal type is a local permission abnormality;
[0075] Step S604: If the permission declaration of the corresponding application does not include abnormal permissions, determine that the preset abnormality type is an application permission abnormality.
[0076] In the application, after determining that the corresponding application has abnormal permissions, the exception handling service can read the permission declaration information of the corresponding application (assuming that the terminal device runs the Android system, the permission declaration information can be obtained by reading the manifest file of the corresponding application). The permission declaration information is used to represent the permissions required for the corresponding application to run.
[0077] In the application, the exception handling service of the terminal device can determine whether the permission declaration information includes exception permissions. If so, it means that the corresponding application has declared to the local that it needs to call exception permissions, but the local has not provided exception permissions to the corresponding application, or the local has intercepted the corresponding application when calling the exception permissions, so the preset exception type is determined to be a local permission exception; if not, it means that the corresponding application has not declared to the local that it needs to call exception permissions, and the permission declaration information should include but does not include exception permissions, so the preset exception type is determined to be an application permission exception.
[0078] Step S605: adjusting the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
[0079] In the application, the exception handling method provided in step S605 can refer to the relevant description in the above step S302, which will not be repeated here. It should be noted that the specific adjustment method for the abnormal phenomenon of abnormal permissions can refer to the above Figure 7 The relevant descriptions in the corresponding embodiments are not repeated here.
[0080] In the application, the exception handling service of the terminal device can monitor whether the application has abnormal permissions, and when it is determined that abnormal permissions exist, it can determine whether the preset exception type belongs to local permission exception or application permission exception based on whether the permission declaration information includes abnormal permissions, thereby selecting the corresponding adjustment type of the operating environment according to the specific abnormal situation, so as to flexibly respond to the abnormal phenomenon of abnormal permissions, improve the flexibility of eliminating exceptions and the operating stability of the terminal device.
[0081] like Figure 7 As shown, in one embodiment, based on Figure 4 and Figure 5 The corresponding embodiment includes the following steps S701 to S709:
[0082] Step S701: when an abnormality in the application operation is detected, determine whether the corresponding application has a memory overflow based on the abnormality information;
[0083] Step S702: If it is determined that the corresponding application has a memory overflow, determine that the preset exception type is a local memory overflow;
[0084] Step S703: if it is determined that the number of memory overflows in the corresponding application reaches a preset number, the preset exception type is determined to be application memory overflow;
[0085] Step S704: if it is determined that the corresponding application does not have memory overflow, determine whether the corresponding application has abnormal permissions based on the abnormal information;
[0086] Step S705: if it is determined that the corresponding application has abnormal permissions, obtain permission declaration information of the corresponding application;
[0087] Step S706: If the permission declaration information of the corresponding application includes abnormal permissions, determine that the preset abnormal type is a local permission abnormality;
[0088] Step S707: If the permission declaration of the corresponding application does not include abnormal permissions, determine that the preset exception type is an application permission exception.
[0089] In the application, the exception handling method provided by steps S701 to S707 can refer to the relevant descriptions in the above steps S501 to S503 and steps S601 to S604, which will not be repeated here. The difference is that in step S704, when it is determined that the corresponding application does not have memory overflow, it is further determined whether the corresponding application has abnormal permissions based on the abnormal information.
[0090] Step S708: If the preset exception type is a local exception, adjust the local resource configuration of the corresponding application according to the exception information.
[0091] In the application, local exceptions may include local application exceptions and local permission exceptions. After determining that the preset exception type belongs to a local exception, the local resource configuration of the corresponding application may be adjusted according to the exception information. The specific adjustment method is described below.
[0092] In one embodiment, step S708 includes:
[0093] If the preset exception type is local memory overflow, the memory allocation of the corresponding application is increased according to the exception information;
[0094] If the preset exception type is a local permission exception, adjust the permission configuration of the corresponding application according to the exception information.
[0095] In the application, if the preset exception type is local memory overflow, the memory usage value / memory usage ratio of the corresponding application can be determined according to the exception information, and the corresponding preset memory allocation value / preset memory allocation ratio can be determined according to the preset interval to which the memory usage value / memory usage ratio belongs.
[0096] For example, if the memory usage value is 4.5 GB, the preset interval is 4 GB to 5 GB, and the corresponding preset memory allocation value is 5 GB, the terminal device will reserve 5 GB of memory for the operation of the corresponding application;
[0097] Assuming that the memory usage value is 5.1g, the preset interval is 5g to 6g, and the corresponding preset memory allocation value is 6g, the terminal device will reserve 6g of memory for the operation of the corresponding application;
[0098] Assuming that the memory usage ratio is 55%, the preset interval is 50% to 60%, and the corresponding preset memory allocation ratio is 60%, the terminal device will reserve 60% of the memory for the operation of the corresponding application.
[0099] It should be noted that the specific values of the preset interval and the corresponding preset memory allocation value / preset memory allocation ratio can be set according to actual needs, and the embodiment of the present application does not impose any limitation on the above specific values.
[0100] In an application, if the preset exception type is a local permission exception, the exception handling service can grant the exception permission to the corresponding application; or generate corresponding virtual permissions based on the exception permissions and grant them to the corresponding application; virtual permissions are used to replace exception permissions, and virtual permissions do not contain privacy information.
[0101] Step S709: If the preset exception type belongs to an application exception, the application configuration of the corresponding application is adjusted according to the exception information.
[0102] In the application, application exceptions may include application memory overflow and application permission exceptions, etc. The exception handling service can determine the adjustment type of the application configuration according to the specific preset exception type. For example, when the preset exception type is application memory overflow, the application version of the relative application can be adjusted. Since when the preset exception type is local memory overflow, the memory overflow exception has been eliminated by adjusting the memory allocation at least once, if the exception cannot be eliminated, it means that the application itself caused the memory overflow, then the preset exception type is determined to be application memory overflow, and the memory overflow can be eliminated by rolling back or updating the application version;
[0103] When the preset exception type is an application permission exception, the application version and / or permission declaration information of the corresponding application can be adjusted. Specifically, when the application itself causes a permission exception, the permission exception can be eliminated by rolling back or updating the application version to obtain the permission declaration information of the corresponding application version, or the permission declaration information under the current application version can be directly adjusted to eliminate the permission exception.
[0104] It should be noted that the application configuration may include the application version, permission declaration information and / or network configuration (for example, adjusting the Internet Protocol of the application to IPv4 or IPv6), etc. The embodiments of the present application do not impose any restrictions on the specific type of application configuration.
[0105] In the application, by selecting the corresponding adjustment method according to the specific preset abnormality type, the flexibility of eliminating abnormalities and the operating stability of the terminal equipment can be further improved.
[0106] like Figure 8 As shown, a task push method provided in an embodiment of the present application is applied to a server. The target task may be an adjustment method of the operating environment corresponding to different preset exception types in the above embodiment. The method for pushing the target task to the terminal device is described below. The task push method includes the following steps S801 to S803:
[0107] Step S801: Determine the target device based on the screening condition.
[0108] In the application, the screening conditions may include the device model, processor model, graphics processor model and / or memory model of the terminal device. The identity information of all terminal devices (which may be MAC code, serial number or firmware number, etc.) can be stored in the server or local database. The server can determine the target device based on the set screening conditions, thereby improving the screening capabilities of the target device and the accurate adaptation of different adjustment methods.
[0109] Step S802: Acquire and compress the identity information of all target devices to obtain a target device set.
[0110] In the application, after the target devices are screened, the identity information of all target devices can be obtained and compressed to obtain a target device set, thereby reducing the processing load and increasing the processing speed when pushing target tasks to all target devices. The compression method can be Bitmap (a fast retrieval and compression technology), etc. The embodiment of the present application does not impose any restrictions on the compression method of the identity information.
[0111] Step S803: Send the target task to the target device set.
[0112] In the application, after obtaining the target device set, the target task can be obtained, and the target task can be set by the server administrator, thereby improving the flexibility of the adjustment method and the convenience of updating.
[0113] In the application, target tasks can be sent to the target device set based on the preset push load. Specifically, all target devices in the target device set can be sorted. The sorting data can be the most recent online time, the proportion of time when the application is abnormal, etc., and the target tasks can be sent to all target devices in batches according to the preset push load. The preset push load can be 1,000 target devices, 10,000 target devices, or 50,000 target devices, etc. The specific value of the preset push load can be determined according to the processing capacity of the server, and the target sending tasks can be performed through asynchronous multi-threading to improve the sending efficiency of the target tasks.
[0114] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0115] like Fig. 9 As shown, an exception handling system 4 provided in an embodiment of the present application includes a terminal device 1 and a server 2, wherein the terminal device 1 is connected to the server 2, and the server 2 is connected to the database 3.
[0116] In the application, the terminal device 1 is used to execute the steps in the above-mentioned exception handling method embodiment applied to the terminal device 1, and the server 2 is used to execute the steps in the above-mentioned task pushing method embodiment applied to the server 2.
[0117] like Fig.10 As shown, the embodiment of the present application also provides an exception handling device 5, which is used to execute the steps in the above-mentioned exception handling method embodiment applied to the terminal device. The exception handling device can be a virtual appliance in the terminal device, which is run by the processor of the terminal device, or it can be the terminal device itself.
[0118] like Fig.10 As shown, the exception handling device 5 provided in the embodiment of the present application includes:
[0119] The monitoring module 510 is used to determine the preset exception type triggered by the corresponding application based on the exception information when the application operation is monitored abnormally;
[0120] The adjustment module 520 is used to adjust the operating environment of the corresponding application according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
[0121] In application, each module in the exception handling device 5 may be a software program module, or may be implemented by different logic circuits integrated in a processor, or may be implemented by multiple distributed processors.
[0122] It should be noted that the information interaction, execution process and other contents between the above modules are based on the same concept as the embodiment of the method of the present application. Their specific functions and technical effects can be found in the above-mentioned exception handling method embodiment part, and will not be repeated here.
[0123] Those skilled in the art 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 for illustration. In actual applications, the above-mentioned function allocation can be completed by 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. The functional modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules in the above-mentioned system can refer to the corresponding process in the above-mentioned exception handling method embodiment, which will not be repeated here.
[0124] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned exception handling method embodiment can be implemented.
[0125] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may at least include: any entity or device that can carry the computer program code to the camera terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0126] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0127] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software 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 be beyond the scope of this application.
[0128] In the embodiments provided in the present application, it should be understood that the disclosed terminal device and method can be implemented in other ways. For example, the terminal device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, 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 an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0129] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An exception handling method, characterized in that: include: When an application operation exception is detected, the preset exception type triggered by the corresponding application is determined based on the exception information; The operating environment of the corresponding application is adjusted according to the preset exception type; wherein the preset exception type is associated with the adjustment type of the operating environment, and the operating environment includes local resource configuration and / or application configuration.
2. The exception handling method according to claim 1, characterized in that: When an application operation exception is detected, determining a preset exception type triggered by the corresponding application based on the exception information includes: When an application is detected to be running abnormally, determine whether the corresponding application has memory overflow based on the abnormal information; If it is determined that the corresponding application has a memory overflow, the preset exception type is determined to be a local memory overflow.
3. The exception handling method according to claim 2, characterized in that: The method further comprises: If it is determined that the number of times that the corresponding application has a memory overflow reaches a preset number, the preset exception type is determined to be an application memory overflow.
4. The exception handling method according to claim 1, characterized in that: When an application operation exception is detected, determining a preset exception type triggered by the corresponding application based on the exception information includes: When an abnormal application operation is detected, determine whether the corresponding application has abnormal permissions based on the abnormal information; If it is determined that the corresponding application has abnormal permissions, obtain the permission declaration information of the corresponding application; If the permission declaration information of the corresponding application includes abnormal permissions, determining that the preset exception type is a local permission exception; If the permission declaration of the corresponding application does not include abnormal permissions, it is determined that the preset exception type is an application permission exception.
5. The exception handling method according to any one of claims 1 to 4, characterized in that: Adjusting the operating environment of the corresponding application according to the preset exception type includes: If the preset exception type belongs to a local exception, adjusting the local resource configuration of the corresponding application according to the exception information; If the preset exception type belongs to an application exception, the application configuration of the corresponding application is adjusted according to the exception information.
6. The exception handling method according to claim 5, characterized in that: If the preset exception type belongs to a local exception, adjusting the local resource configuration of the corresponding application according to the exception information includes: If the preset exception type is local memory overflow, increasing the memory allocation of the corresponding application according to the exception information; If the preset exception type is a local permission exception, the permission configuration of the corresponding application is adjusted according to the exception information.
7. The exception handling method according to claim 6, characterized in that: If the preset exception type is a local permission exception, adjusting the permission configuration of the corresponding application according to the exception information includes: If the preset exception type is a local permission exception, granting the exception permission to the corresponding application; If the preset exception type is a local permission exception, a corresponding virtual permission is generated according to the abnormal permission and granted to the corresponding application; The virtual permission is used to replace the abnormal permission, and the virtual permission does not contain privacy information.
8. The exception handling method according to claim 5, characterized in that: The application configuration includes application version, permission declaration information and / or network configuration.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the exception handling method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the exception handling method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Application running method and device, storage medium and electronic equipment
CN119179597A
