WO2019051944A1 - 一种进程保护方法、装置、设备以及计算机可读存储介质 - Google Patents

一种进程保护方法、装置、设备以及计算机可读存储介质 Download PDF

Info

Publication number
WO2019051944A1
WO2019051944A1 PCT/CN2017/108238 CN2017108238W WO2019051944A1 WO 2019051944 A1 WO2019051944 A1 WO 2019051944A1 CN 2017108238 W CN2017108238 W CN 2017108238W WO 2019051944 A1 WO2019051944 A1 WO 2019051944A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
application process
service
accessibility
fork
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2017/108238
Other languages
English (en)
French (fr)
Inventor
杨文�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019051944A1 publication Critical patent/WO2019051944A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3604Analysis of software for verifying properties of programs
    • G06F11/3612Analysis of software for verifying properties of programs by runtime analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44552Conflict resolution, i.e. enabling coexistence of conflicting executables

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a process protection method, apparatus, device, and computer readable storage medium.
  • the system will report an error, for example, the application is not responding (Application Not Responding, ANR), and viewing the debug log at this time does not provide specific information that causes the ANR problem, causing developers to not accurately identify the cause of the ANR problem.
  • ANR Application Not Responding
  • the embodiment of the present application provides a process protection method, apparatus, device, and computer readable storage medium, which can improve the efficiency of protecting an application and improve a user experience.
  • the embodiment of the present application provides a process protection method, where the method includes:
  • the service process is controlled to protect the application process and continue the operation of the application process by using the protection program.
  • the embodiment of the present application provides a process protection device, where the device includes:
  • a generating unit configured to generate a service process corresponding to the application process if an application process is detected to be running
  • a first control unit configured to control the service process to start a protection program for the application process
  • a second control unit configured to: when detecting a stop event for stopping the application process, control the service process to protect the application process by using the protection program and to continue running the application process.
  • the embodiment of the present application further provides a process protection device, including:
  • a memory for storing programs that implement process protection
  • processor for running a program implemented in the memory to implement process protection to perform the following operations:
  • the service process is controlled to protect the application process and continue the operation of the application process by using the protection program.
  • an embodiment of the present application further provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors Execute to implement the following steps:
  • the service process is controlled to protect the application process and continue the operation of the application process by using the protection program.
  • the embodiment of the present application generates a service process corresponding to the application process by detecting that an application process is running, establishing a connection relationship between the service process and the application process, and controlling the service process to start a protection program of the application process; if a stop event for stopping the application process is detected, controlling the service process to protect the application process and continue to run the application process by using the protection program, thereby improving protection The efficiency of the application that the user wants to run, improving the user experience.
  • FIG. 1 is a schematic flowchart of a process protection method according to an embodiment of the present application
  • FIG. 2 is another schematic flowchart of a process protection method according to an embodiment of the present application.
  • FIG. 3 is another schematic flowchart of a process protection method according to an embodiment of the present application.
  • FIG. 4 is another schematic flowchart of a process protection method according to an embodiment of the present application.
  • FIG. 5 is another schematic flowchart of a process protection method according to an embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a process protection apparatus according to an embodiment of the present application.
  • FIG. 7 is another schematic block diagram of a process protection apparatus according to an embodiment of the present disclosure.
  • FIG. 8 is another schematic block diagram of a process protection apparatus according to an embodiment of the present application.
  • FIG. 9 is another schematic block diagram of a process protection apparatus according to an embodiment of the present application.
  • FIG. 10 is another schematic block diagram of a process protection apparatus according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a process protection device according to an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a process protection method according to an embodiment of the present application.
  • the method can be run on terminals such as smart phones (such as Android phones, IOS phones, etc.), tablets, laptops, and smart devices.
  • the process protection method described in the embodiment of the present application can improve the efficiency of protecting an application that the user desires to run, and improve the user experience.
  • FIG. 1 is a schematic flowchart of a process protection method provided by an embodiment of the present application. The method includes steps S101 to S104.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein The time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • FIG. 2 is a schematic flowchart of a process protection method according to an embodiment of the present application.
  • the method can be run on terminals such as smart phones (such as Android phones, IOS phones, etc.), tablets, laptops, and smart devices.
  • the process protection method described in the embodiment of the present application can improve the efficiency of protecting an application that the user desires to run, and improve the user experience.
  • FIG. 2 is a schematic flowchart of a process protection method according to an embodiment of the present application. The method includes steps S201 to S208.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the child process that is forked by the service process is used as the fork process, and the upper process of the fork process is called a parent process, and the fork process and the parent process are specific to each other.
  • a timer is added for the obtained fork process, and the timer may be a repeating timer or a one-time timer, and the specific timing may be
  • the type of the device can be selected according to the needs of the user, and is not limited herein.
  • the fork process by setting the timer time interval, two interval times of the fork process are determined. If 10 seconds is set, the fork process can only be run once in 10 seconds.
  • the running of the fork process is used to display the running information of the application process corresponding thereto, and the operation process of the application process is displayed according to the time interval.
  • the setting of the timer can be changed to Manually set, after the fork process runs once, you must respond to certain operations before you can run again.
  • the effect of dynamically displaying the current application process information can be achieved.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein The time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • FIG. 3 is a schematic flowchart of a process protection method according to an embodiment of the present application.
  • the method can be run on terminals such as smart phones (such as Android phones, IOS phones, etc.), tablets, laptops, and smart devices.
  • the process protection method described in the embodiment of the present application can improve the efficiency of protecting an application that the user desires to run, and improve the user experience.
  • FIG. 3 is a schematic flowchart of a process protection method according to an embodiment of the present application. The method includes steps S301 to S308.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the child process that is forked by the service process is used as the fork process, and the upper process of the fork process is called a parent process, and the fork process and the parent process are specific to each other.
  • the accessible class set can be the AccessibilityService class.
  • the preset method item in the accessibility service class may be an onAccessibilityEvent (AccessibilityEvent). Event) method.
  • step S305 includes steps S401 to S402.
  • the preset method item is called back by the system.
  • the accessibility service provides feedback for the application, and at this time, the system calls the preset method item and transmits Associated accessibility events, accessibility services can translate and use this event to provide feedback to users. It should be noted that during the life cycle of the accessibility service, the preset method items are called multiple times.
  • the currently running application process information can be dynamically displayed by using a method in the callback accessibility service class.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein The time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the embodiment of the present application can achieve the effect of dynamically displaying the current application information and improve the user experience by setting an accessibility service class and calling a method item preset in the accessibility service class.
  • FIG. 5 is a schematic flowchart of a process protection method according to an embodiment of the present application.
  • the method can be run on terminals such as smart phones (such as Android phones, IOS phones, etc.), tablets, laptops, and smart devices.
  • the process protection method described in the embodiment of the present application can improve the efficiency of protecting an application that the user wants to run, improve the user experience, and can help the developer to accurately locate and locate the cause of the ANR problem.
  • FIG. 5 is a schematic flowchart of a process protection method according to an embodiment of the present application. The method includes steps S501 to S509.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the general real-time monitoring function is more suitable for a separately opened thread, because the burden of the main thread can be greatly reduced.
  • Create a monitoring thread optionally, by creating a new dialog project on the platform of the terminal, such as Test, and The monitoring thread is created in the BOOL C Test Dlg::OnInitDialog() function.
  • the Looper (the thread having the message loop) in the monitoring thread uses the Handler (the processing of the asynchronous message) to continuously send a message to the UI thread in the application process, and dispatches a task to be processed by the system.
  • the user can record the timestamp of the dispatched task, and the task will modify the timestamp recorded when the task is dispatched.
  • the thread sleeps for a fixed time (usually 5s) and waits for the thread to re-open.
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein The time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the monitoring thread indicates or dispatches a task to the application process according to the monitoring thread, records the task indication or the timestamp of the dispatch, and monitors whether the timestamp changes. Until the timestamp does not change, it is determined that the application process is in the ANR state, thereby helping the developer to accurately find and locate the cause of the ANR problem.
  • the embodiment of the present application further provides a process protection device, where the device 100 includes: a generating unit 101, an establishing unit 102, a first control unit 103, and a second control unit 104.
  • the generating unit 101 is configured to generate a service process corresponding to the application process if an application process is detected to be running.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the establishing unit 102 is configured to establish a connection relationship between the service process and the application process.
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the first control unit 103 is configured to control the service process to start a protection program for the application process.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein
  • the time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the second control unit 104 is configured to, if the stop event for stopping the application process is detected, control the service process to protect the application process by using the protection program and continue to run the application process.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the embodiment of the present application further provides a process protection device, where the terminal 200 includes: a generating unit 201, an establishing unit 202, a first acquiring unit 203, a creating unit 204, and a first The setting unit 205, the third control unit 206, the first control unit 207, and the second control unit 208.
  • the generating unit 201 is configured to generate a service process corresponding to the application process if it is detected that an application process is running.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the establishing unit 202 is configured to establish a connection relationship between the service process and the application process.
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the first obtaining unit 203 is configured to acquire a fork process corresponding to the service process.
  • the child process that is forked by the service process is used as the fork process
  • the upper process of the fork process is called a parent process
  • the fork process and the parent process are specific to each other.
  • the feature, that is, when the parent process is killed, the associated fork process can still survive and is not affected by the parent process.
  • the creating unit 204 is configured to create a timer in the fork process.
  • a timer is added for the obtained fork process, and the timer may be a repeating timer or a one-time timer, and the specific timing may be
  • the type of the device can be selected according to the needs of the user, and is not limited herein.
  • the first setting unit 205 is configured to set a time interval of the timer. In the embodiment of the present application, by setting the timer time interval, two interval times of the fork process are determined. If 10 seconds is set, the fork process can only be run once in 10 seconds.
  • the third control unit 206 is configured to control, according to the time interval, an operation of the application process to display the running information.
  • the running of the fork process is used to display the running information of the application process corresponding thereto, and the operation process of the application process is displayed according to the time interval.
  • the setting of the timer can be changed to Manually set, after the fork process runs once, you must respond to certain operations before you can run again.
  • the effect of dynamically displaying the current application process information can be achieved.
  • the first control unit 207 is configured to control the service process to start a protection program for the application process.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein
  • the time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the second control unit 208 is configured to, if the stop event for stopping the application process is detected, control the service process to protect the application process by using the protection program and continue to run the application process.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the embodiment of the present application further provides a process protection device, where the device 300 includes: a generating unit 301, an establishing unit 302, a second obtaining unit 303, and a second setting unit 304.
  • the generating unit 301 is configured to generate a service process corresponding to the application process if it is detected that an application process is running.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the establishing unit 302 is configured to establish a connection relationship between the service process and the application process.
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the second obtaining unit 303 is configured to acquire a fork process corresponding to the service process.
  • the child process that is forked by the service process is used as the fork process
  • the upper process of the fork process is called a parent process
  • the fork process and the parent process are specific to each other.
  • the feature, that is, when the parent process is killed, the associated fork process can still survive and is not affected by the parent process.
  • the second setting unit 304 is configured to set an accessibility service class in the split fork process.
  • an accessibility service class in the fork process by setting an accessibility service class in the fork process and recalling the method in the accessibility service class, the effect of dynamically displaying the currently running application process information can be achieved.
  • the accessible class set can be the AccessibilityService class.
  • the calling unit 305 is configured to invoke a method item preset in the accessibility service class.
  • the preset method item in the accessibility service class may be an onAccessibilityEvent (AccessibilityEvent). Event) method.
  • the third obtaining unit 306 is configured to acquire running information of the application process according to the preset method item.
  • the currently running application process information can be dynamically displayed by using a method in the callback accessibility service class.
  • the first control unit 307 is configured to control the service process to start a protection program for the application process.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein
  • the time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the second control unit 308 is configured to, if the stop event for stopping the application process is detected, control the service process to protect the application process by using the protection program and continue to run the application process.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the calling unit 305 includes:
  • the calling subunit 3051 is configured to invoke the preset method item if an accessibility event filtering parameter event that meets the accessibility service setting is detected.
  • the preset method item is called back by the system.
  • the feedback unit 3052 is configured to deliver the associated accessibility event and provide feedback to the user.
  • the accessibility service provides feedback for the application, and at this time, the system calls the preset method item and transmits Associated accessibility events, accessibility services can translate and use this event to provide feedback to users. It should be noted that during the life cycle of the accessibility service, the preset method items are called multiple times.
  • the embodiment of the present application further provides a process protection device, where the device 400 includes: a generating unit 401, a creating unit 402, an executing unit 403, a recording unit 404, and a monitoring unit 405.
  • the generating unit 401 is configured to generate a service process corresponding to the application process if an application process is detected to be running.
  • the application refers to a program that the user can see and feel, such as WeChat, word, photoshop, etc.
  • the application process refers to the existence of a general user may not feel it, and exists as an execution entity of the application, For example, some services, windows kernel and other computer programs, they run silently in the background.
  • an "application” must find an "application process” corresponding to it, but an "application process” does not necessarily have an "application” corresponding to it, and some application processes may be background running processes, users cannot see I can't feel it.
  • the application process keeps running, the application corresponding to the application process can be used. If the application process is killed, the application is stopped, and the application corresponding to the application process is closed. . If it is detected that an application process is running, generating a service process corresponding to the application process, optionally, a vulnerability of the terminal system may be used to generate a service process, and the generated service process is not notified in the terminal system. Appears in the column, the service process runs as if a background service process is running.
  • the generated method is as follows: (1) If the current application (Application Programming Interface, API) The number of programming interfaces is less than 18, and the Notification() function is directly passed in the foreground Service; (2) If the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then started again. The Service does the stop processing.
  • API Application Programming Interface
  • the creating unit 402 is configured to create a monitoring thread.
  • the general real-time monitoring function is more suitable for a separately opened thread, because the burden of the main thread can be greatly reduced.
  • Create a monitoring thread optionally, by creating a new dialog project on the platform of the terminal, such as Test, and The monitoring thread is created in the BOOL C Test Dlg::OnInitDialog() function.
  • the executing unit 403 is configured to indicate or distribute a task to the application process according to the monitoring thread.
  • the Looper the thread having the message loop
  • the Handler the processing of the asynchronous message
  • the recording unit 404 is configured to record the task indication or the timestamp of the dispatch.
  • the user can record the timestamp of the dispatched task, and the task will modify the timestamp recorded when the task is dispatched.
  • the thread sleeps for a fixed time (usually 5s) and waits for the thread to re-open.
  • the monitoring unit 405 is configured to monitor whether the time stamp changes. In the embodiment of the present application, after the thread is re-opened, it is detected whether the previously dispatched task is executed by determining whether the recorded time has changed. If the task is not executed, the thread is blocked, and the application is successfully monitored. Application Not Responding, ANR).
  • the determining unit 406 is configured to determine that the application process is in an ANR state if it is detected that the timestamp has not changed.
  • the establishing unit 407 is configured to establish a connection relationship between the service process and the application process.
  • the terminal needs to establish a connection between the service process and the application process, and by monitoring the state of the connection, determining whether the application corresponding to the service process needs to be protected. .
  • the terminal creates a socket for the service process, and the connection between the monitoring service process and the application process is a connection between the socket of the monitoring service process and the socket of the application process.
  • the terminal can establish a connection between the service process of the application and the application process, and realize data transmission through the connection, and judge the application by monitoring whether the connection is interrupted. State, the process of determining the state of the application is convenient and fast, the system delay is small, and the system resource consumption is small.
  • the first control unit 408 is configured to control the service process to start a protection program for the application process.
  • a protection program for the application process is started, optionally, if the current application (Application) Programming Interface, API)
  • the number of programming interfaces is less than 18.
  • the Notification() function is directly passed in the foreground Service, the time interval for periodically waking up the application is set, and the hanged application process is restarted by sending a wake-up broadcast, wherein
  • the time interval can be 5 minutes, 10 minutes, or other time.
  • the specific time interval is not limited here; if the number of API programming interfaces is greater than or equal to 18, both foreground services with the same id are started, and then the service is started later.
  • the second control unit 409 is configured to, if the stop event for stopping the application process is detected, control the service process to protect the application process by using the protection program and continue to run the application process.
  • the service process is controlled to protect the application process by using the protection program, and the application process continues to run.
  • the connection between the application process and the service process is It will be interrupted, the service process will receive the application process interrupt notification message, and once the service process receives the interrupt notification message, it determines that the application may have been interrupted, and will restart some or all of the functions of the application process; If the application process is to be interrupted, use thehack method to keep the application process being killed, and by increasing the priority of the protected application process, the application process will be protected when it is to be killed. The application process takes precedence over other processes without being killed to achieve keepalives.
  • the monitoring thread indicates or dispatches a task to the application process according to the monitoring thread, records the task indication or the timestamp of the dispatch, and monitors whether the timestamp changes. Until the timestamp does not change, it is determined that the application process is in the ANR state, thereby helping the developer to accurately find and locate the cause of the ANR problem.
  • the above generating unit 101, the establishing unit 102, the first control unit 103, the second control unit 104, and the like may be embedded in hardware or in a device independent of data processing, or may be stored in software in software.
  • the memory of the processing device is such that the processor invokes the operations corresponding to the above respective units.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • the above process protection device can be implemented in the form of a computer program that can be run on a computer device as shown in FIG.
  • FIG. 11 is a schematic structural diagram of a process protection device according to the present application.
  • the device may be a terminal or a server, wherein the terminal may be a communication-enabled electronic device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
  • the server can be a standalone server or a server cluster consisting of multiple servers.
  • the computer device 500 includes a processor 502, a non-volatile storage medium 503, an internal memory 504, and a network interface 505 connected by a system bus 501.
  • the non-volatile storage medium 503 of the computer device 500 can store an operating system 5031 and a computer program 5032 that, when executed, can cause the processor 502 to perform a process protection method.
  • the processor 502 of the computer device 500 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, which when executed by the processor, causes the processor 502 to perform a process protection method.
  • the network interface 505 of the computer device 500 is used to perform network communications, such as sending assigned tasks and the like. It will be understood by those skilled in the art that the structure shown in FIG.
  • 11 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the processor 502 performs the following operations:
  • the service process is controlled to protect the application process and continue the operation of the application process by using the protection program.
  • the processor 502 also performs the following operations:
  • the operation of the application process to display the running information is controlled according to the time interval.
  • the processor 502 also performs the following operations:
  • the method items preset in the invoked service class include:
  • the preset method item is invoked if an accessibility event filtering parameter event meeting the accessibility setting is detected;
  • the processor 502 also performs the following operations:
  • the application provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the following steps:
  • the service process is controlled to protect the application process and continue the operation of the application process by using the protection program.
  • the computer readable storage medium is executed by the processor such that the one or more processors further perform the following steps:
  • the operation of the application process to display the running information is controlled according to the time interval.
  • the computer readable storage medium is executed by the processor such that the one or more processors further perform the following steps:
  • the one or more processors further perform the following steps: the method items preset in the invoked service class include:
  • the preset method item is invoked if an accessibility event filtering parameter event meeting the accessibility setting is detected;
  • the computer readable storage medium is executed by the processor such that the one or more processors further perform the following steps:
  • the foregoing storage medium of the present application may be a non-volatile storage medium such as a magnetic disk, an optical disk, or a read-only memory (Read-Only).
  • Memory, ROM, and other media that can store program code may be a non-volatile storage medium such as a magnetic disk, an optical disk, or a read-only memory (Read-Only).
  • the units in all embodiments of the present application may be through a general-purpose integrated circuit, such as a CPU (Central Processing) Unit, central processing unit, or through ASIC (Application Specific Integrated circuit)
  • the steps in the process protection method of the embodiment of the present application may be sequentially adjusted, merged, and deleted according to actual needs.
  • the units in the process protection device of the embodiment of the present application may be combined, divided, and deleted according to actual needs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Stored Programmes (AREA)

Abstract

一种进程保护方法、装置、设备以及计算机可读存储介质,其中,所述方法包括:若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程(S101);建立所述服务进程与所述应用进程之间的连接关系(S102);控制所述服务进程启动针对所述应用进程的保护程序(S103);若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行(S104)。所述方法可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。

Description

一种进程保护方法、装置、设备以及计算机可读存储介质
本申请要求于2017年9月14日提交中国专利局、申请号为CN 201710827274.1 、申请名称为“一种进程保护方法、装置、设备以及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种进程保护方法、装置、设备以及计算机可读存储介质。
背景技术
随着科技技术的飞速发展,很多智能电子产品(如智能手机、平板电脑等)可以安装各种应用软件,但是所安装的应用软件的运行需要依赖智能电子产品自身安装的系统,该系统为操作系统(如安卓操作系统、windows操作系统、ios操作系统等),由于内存资源紧张或者系统本身的运行机制,会将后台运行的应用程序的进程杀死,从而导致用户所希望运行的应用程序无法继续正常运行的问题。基于上述问题,目前所采用的处理方法比较费电,并且解决问题的效率不高、影响体验,例如,通过双进程监测的方法,或者fork子进程的方法等等。另外,在应用程序运行过程中,当主线程阻塞5s未响应或者广播接收器10s未执行完时,系统就会报错,例如出现应用程序无响应(Application Not Responding,ANR),而且此时查看调试日志并不能获得导致出现ANR问题的具体信息,导致开发人员不能准确找出导致ANR问题的原因。
发明内容
本申请实施例提供一种进程保护方法、装置、设备以及计算机可读存储介质,可以提高保护应用程序的效率,改善用户的使用体验。
一方面,本申请实施例提供了一种进程保护方法,该方法包括:
若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立所述服务进程与所述应用进程之间的连接关系;
控制所述服务进程启动针对所述应用进程的保护程序;
若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
另一方面,本申请实施例提供了一种进程保护装置,该装置包括:
生成单元,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立单元,用于建立所述服务进程与所述应用进程之间的连接关系;
第一控制单元,用于控制所述服务进程启动针对所述应用进程的保护程序;
第二控制单元,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
又一方面,本申请实施例还提供了一种进程保护设备,包括:
存储器,用于存储实现进程保护的程序;以及
处理器,用于运行所述存储器中存储的实现进程保护的程序,以执行以下操作:
若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立所述服务进程与所述应用进程之间的连接关系;
控制所述服务进程启动针对所述应用进程的保护程序;
若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
再一方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序可被一个或者一个以上的处理器执行,以实现以下步骤:
若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立所述服务进程与所述应用进程之间的连接关系;
控制所述服务进程启动针对所述应用进程的保护程序;
若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
本申请实施例通过若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;建立所述服务进程与所述应用进程之间的连接关系;控制所述服务进程启动针对所述应用进程的保护程序;若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,从而可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种进程保护方法的示意流程图;
图2是本申请实施例提供的一种进程保护方法的另一示意流程图;
图3是本申请实施例提供的一种进程保护方法的另一示意流程图;
图4是本申请实施例提供的一种进程保护方法的另一示意流程图;
图5是本申请实施例提供的一种进程保护方法的另一示意流程图;
图6是本申请实施例提供的一种进程保护装置的示意性框图;
图7是本申请实施例提供的一种进程保护装置的另一示意性框图;
图8是本申请实施例提供的一种进程保护装置的另一示意性框图;
图9是本申请实施例提供的一种进程保护装置的另一示意性框图;
图10是本申请实施例提供的一种进程保护装置的另一示意性框图;
图11是本申请实施例提供的一种进程保护设备结构组成示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳
动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和 “包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使
用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
请参阅图1,图1是本申请实施例提供的一种进程保护方法的示意流程图。该方法可以运行在智能手机(如Android手机、IOS手机等)、平板电脑、笔记本电脑以及智能设备等终端中。本申请实施例所述的进程保护方法可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。图1是本申请实施例提供的一种进程保护方法的示意流程图。该方法包括步骤S101~S104。
S101,若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。
在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
S102,建立所述服务进程与所述应用进程之间的连接关系。
在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
S103,控制所述服务进程启动针对所述应用进程的保护程序。
在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
S104,若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
由以上可见,通过若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程;建立所述服务进程与所述应用进程之间的连接关系;控制所述服务进程启动针对所述应用进程的保护程序;若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,从而可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。
请参阅图2,图2是本申请实施例提供的一种进程保护方法的示意流程图。该方法可以运行在智能手机(如Android手机、IOS手机等)、平板电脑、笔记本电脑以及智能设备等终端中。本申请实施例所述的进程保护方法可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。图2是本申请实施例提供的一种进程保护方法的示意流程图。该方法包括步骤S201~S208。
S201,若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。
在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
S202,建立所述服务进程与所述应用进程之间的连接关系。
在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
S203,获取与所述服务进程相对应的分叉子进程。
在本申请实施例中,将所述服务进程fork出来的子进程作为所述分叉子进程,将分叉子进程的上一级进程称为父进程,在分叉子进程与父进程之间具体某种特性,即当父进程被杀掉后,与其相关的分叉子进程仍然可以存活,并且不受父进程的影响。
S204,在所述分叉子进程中创建定时器。
在本申请实施例中,在获得所述分叉子进程后,针对所获得的分叉子进程添加一个定时器,所述定时器可以是反复性定时器,也可以是一次性定时器,具体的定时器类型可以根据用户的需要自行选择,在此不作限定。
S205,设置所述定时器的时间间隔。
在本申请实施例中,通过设置定时器时间间隔,决定分叉子进程所运行的两个间隔时间,如设置10秒,则10秒内分叉子进程只可运行一次。
S206,根据所述时间间隔控制所述应用进程显示运行信息的操作。
在本申请实施例中,分叉子进程的运行用于显示与其对应的应用进程的运行信息,根据所述时间间隔控制所述应用进程显示运行信息的操作,例如,可以将定时器的设置改为手动设置,分叉子进程运行一次之后必须响应某些操作才可再次运行。通过设置定时器以控制应用进程显示运行信息的操作,可以达到动态显示当前应用进程信息的效果。
S207,控制所述服务进程启动针对所述应用进程的保护程序。
在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
S208,若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
由以上可见,本申请实施例通过创建定时器,设置所述定时器的时间间隔,根据所述时间间隔控制所述应用进程显示运行信息的操作,可以达到动态显示当前应用程序信息的效果,改善用户的使用体验。
请参阅图3,图3是本申请实施例提供的一种进程保护方法的示意流程图。该方法可以运行在智能手机(如Android手机、IOS手机等)、平板电脑、笔记本电脑以及智能设备等终端中。本申请实施例所述的进程保护方法可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验。图3是本申请实施例提供的一种进程保护方法的示意流程图。该方法包括步骤S301~S308。
S301,若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。
在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
S302,建立所述服务进程与所述应用进程之间的连接关系。
在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
S303,获取与所述服务进程相对应的分叉子进程。
在本申请实施例中,将所述服务进程fork出来的子进程作为所述分叉子进程,将分叉子进程的上一级进程称为父进程,在分叉子进程与父进程之间具体某种特性,即当父进程被杀掉后,与其相关的分叉子进程仍然可以存活,并且不受父进程的影响。
S304,在所述分叉子进程中设置无障碍服务类。
在本申请实施例中,通过在分叉子进程设置无障碍服务类,并回调无障碍服务类中的方法,可以达到动态显示当前运行的应用进程信息的效果。可选的,所设置的无障碍类可以是AccessibilityService类。
S305,调用所述无障碍服务类中预设的方法项。
在本申请实施例中,在的无障碍服务类中的预设的方法项可以是onAccessibilityEvent(AccessibilityEvent event)方法。
进一步地,如图4所示,步骤S305包括步骤S401~S402。
S401,若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项。
在本申请实施例中,当系统检测到一个符合无障碍服务设定的无障碍事件过滤参数的事件时,预设的方法项被系统回调。
S402,传递关联的无障碍事件并向用户反馈。
在本申请实施例中,例如,当用户在应用程序中点击一个按钮或聚焦一个用户界面控件时,无障碍服务会为此应用程序提供反馈,此时,系统调用所预设的方法项,传递相关联的无障碍事件,无障碍服务就可以翻译和使用该事件为用户提供反馈。需要说明的是,在无障碍服务的生命周期中,所预设的方法项会被调用多次。
S306,根据所述预设的方法项获取所述应用进程的运行信息。
在本申请实施例中,通过回调无障碍服务类中的方法,可以动态显示当前运行的应用进程信息。
S307,控制所述服务进程启动针对所述应用进程的保护程序。
在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
S308,若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
由以上可见,本申请实施例通过设置无障碍服务类,并调用所述无障碍服务类中预设的方法项,可以达到动态显示当前应用程序信息的效果,改善用户的使用体验。
请参阅图5,图5是本申请实施例提供的一种进程保护方法的示意流程图。该方法可以运行在智能手机(如Android手机、IOS手机等)、平板电脑、笔记本电脑以及智能设备等终端中。本申请实施例所述的进程保护方法可以提高保护用户所希望运行的应用程序的效率,改善用户的使用体验,并且可以帮助开发人员准确查找、定位出现ANR问题的原因。图5是本申请实施例提供的一种进程保护方法的示意流程图。该方法包括步骤S501~S509。
S501,若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。
在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
S502,创建监测线程。
在本申请实施例中,一般实时监控功能放在一个单独开辟的线程比较合适,因为这样可以大大减轻主线程的负担。创建监测线程,可选的,通过在终端的平台上新建一个对话框工程,如Test,并在 BOOL C Test Dlg::OnInitDialog() 函数里创建所述监测线程。
S503,根据所述监测线程向所述应用进程指示或者派发任务。
在本申请实施例中,在所述监测线程内的Looper(有消息循环的线程)使用Handler(异步消息的处理)不断发消息往应用进程中的UI线程,并派发一个任务由系统去处理。
S504,记录所述任务指示或者派发的时间戳。
在本申请实施例中,用户可以记录下所派发任务的时间戳,而这个任务会修改派发任务时记录下的时间戳。派发完任务后,线程睡眠固定时间(一般为5s),并等待线程重新开启。
S505,监测所述时间戳是否发生变化。
在本申请实施例中,待线程重新开启后,通过判断记录的时间是否有改变来检测之前派发的任务是否执行了,如果任务未被执行,证明线程阻塞了,成功监测到应用程序无响应(Application Not Responding,ANR)。
S506,若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
S507,建立所述服务进程与所述应用进程之间的连接关系。
在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
S508,控制所述服务进程启动针对所述应用进程的保护程序。
在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
S509,若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
由以上可见,本申请实施例通过创建监测线程,根据所述监测线程向所述应用进程指示或者派发任务,记录所述任务指示或者派发的时间戳,监测所述时间戳是否发生变化,若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态,从而可以帮助开发人员准确查找、定位出现ANR问题的原因。
请参阅图6,对应上述一种进程保护方法,本申请实施例还提出一种进程保护装置,该装置100包括:生成单元101、建立单元102、第一控制单元103、第二控制单元104。
其中,所述生成单元101,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
建立单元102,用于建立所述服务进程与所述应用进程之间的连接关系。在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
第一控制单元103,用于控制所述服务进程启动针对所述应用进程的保护程序。在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
第二控制单元104,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
请参阅图7,对应上述一种进程保护方法,本申请实施例还提出一种进程保护装置,该终端200包括:生成单元201、建立单元202、第一获取单元203、创建单元204、第一设置单元205、第三控制单元206、第一控制单元207、第二控制单元208。
其中,所述生成单元201,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
建立单元202,用于建立所述服务进程与所述应用进程之间的连接关系。在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
第一获取单元203,用于获取与所述服务进程相对应的分叉子进程。在本申请实施例中,将所述服务进程fork出来的子进程作为所述分叉子进程,将分叉子进程的上一级进程称为父进程,在分叉子进程与父进程之间具体某种特性,即当父进程被杀掉后,与其相关的分叉子进程仍然可以存活,并且不受父进程的影响。
创建单元204,用于在所述分叉子进程中创建定时器。在本申请实施例中,在获得所述分叉子进程后,针对所获得的分叉子进程添加一个定时器,所述定时器可以是反复性定时器,也可以是一次性定时器,具体的定时器类型可以根据用户的需要自行选择,在此不作限定。
第一设置单元205,用于设置所述定时器的时间间隔。在本申请实施例中,通过设置定时器时间间隔,决定分叉子进程所运行的两个间隔时间,如设置10秒,则10秒内分叉子进程只可运行一次。
第三控制单元206,用于根据所述时间间隔控制所述应用进程显示运行信息的操作。在本申请实施例中,分叉子进程的运行用于显示与其对应的应用进程的运行信息,根据所述时间间隔控制所述应用进程显示运行信息的操作,例如,可以将定时器的设置改为手动设置,分叉子进程运行一次之后必须响应某些操作才可再次运行。通过设置定时器以控制应用进程显示运行信息的操作,可以达到动态显示当前应用进程信息的效果。
第一控制单元207,用于控制所述服务进程启动针对所述应用进程的保护程序。在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
第二控制单元208,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
请参阅图8,对应上述一种进程保护方法,本申请实施例还提出一种进程保护装置,该装置300包括:生成单元301、建立单元302、第二获取单元303、第二设置单元304、调用单元305、第三获取单元306、第一控制单元307、第二控制单元308。
其中,所述生成单元301,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
建立单元302,用于建立所述服务进程与所述应用进程之间的连接关系。在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
第二获取单元303,用于获取与所述服务进程相对应的分叉子进程。在本申请实施例中,将所述服务进程fork出来的子进程作为所述分叉子进程,将分叉子进程的上一级进程称为父进程,在分叉子进程与父进程之间具体某种特性,即当父进程被杀掉后,与其相关的分叉子进程仍然可以存活,并且不受父进程的影响。
第二设置单元304,用于在所述分叉子进程中设置无障碍服务类。在本申请实施例中,通过在分叉子进程设置无障碍服务类,并回调无障碍服务类中的方法,可以达到动态显示当前运行的应用进程信息的效果。可选的,所设置的无障碍类可以是AccessibilityService类。
调用单元305,用于调用所述无障碍服务类中预设的方法项。在本申请实施例中,在的无障碍服务类中的预设的方法项可以是onAccessibilityEvent(AccessibilityEvent event)方法。
第三获取单元306,用于根据所述预设的方法项获取所述应用进程的运行信息。在本申请实施例中,通过回调无障碍服务类中的方法,可以动态显示当前运行的应用进程信息。
第一控制单元307,用于控制所述服务进程启动针对所述应用进程的保护程序。在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
第二控制单元308,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
如图9所示,所述调用单元305,包括:
调用子单元3051,用于若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项。在本申请实施例中,当系统检测到一个符合无障碍服务设定的无障碍事件过滤参数的事件时,预设的方法项被系统回调。
反馈单元3052,用于传递关联的无障碍事件并向用户反馈。在本申请实施例中,例如,当用户在应用程序中点击一个按钮或聚焦一个用户界面控件时,无障碍服务会为此应用程序提供反馈,此时,系统调用所预设的方法项,传递相关联的无障碍事件,无障碍服务就可以翻译和使用该事件为用户提供反馈。需要说明的是,在无障碍服务的生命周期中,所预设的方法项会被调用多次。
请参阅图10,对应上述一种进程保护方法,本申请实施例还提出一种进程保护装置,该装置400包括:生成单元401、创建单元402、执行单元403、记录单元404、监测单元405、判定单元406、建立单元407、第一控制单元408、第二控制单元409。
其中,所述生成单元401,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程。在本申请实施例中,在终端开启时,用户可以选择相对应的应用程序的开启,在开启应用程序时,与应用程序对应的应用进程便开始运行。其中,应用程序是指用户可以看得见并感觉得到的程序,例如微信、word、photoshop等,应用进程指的是一般用户可能感觉不到它的存在,并作为应用程序的执行实体而存在,例如一些服务、windows内核等计算机程序,他们在后台中默默的运行着。具体的,一个“应用程序”一定可以找到一个“应用进程”与其对应,但一个“应用进程”不一定会有一个“应用程序”与其对应,有些应用进程可能是后台的运行进程,用户无法看到,也无法感觉到。
需要说明的是,若应用进程保持运行,则与该应用进程相对应的应用程序可以被使用,若应用进程被杀掉,即被停止运行,则与该应用进程相对应的应用程序将被关闭。若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程,可选的,可以利用终端系统的漏洞来生成一个服务进程,所生成的服务进程不会在终端系统的通知栏处出现,服务进程的运行就如同运行着一个后台service进程一样,生成的方法如下:(1)若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数;(2)若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理。
创建单元402,用于创建监测线程。在本申请实施例中,一般实时监控功能放在一个单独开辟的线程比较合适,因为这样可以大大减轻主线程的负担。创建监测线程,可选的,通过在终端的平台上新建一个对话框工程,如Test,并在 BOOL C Test Dlg::OnInitDialog() 函数里创建所述监测线程。
执行单元403,用于根据所述监测线程向所述应用进程指示或者派发任务。在本申请实施例中,在所述监测线程内的Looper(有消息循环的线程)使用Handler(异步消息的处理)不断发消息往应用进程中的UI线程,并派发一个任务由系统去处理。
记录单元404,用于记录所述任务指示或者派发的时间戳。在本申请实施例中,用户可以记录下所派发任务的时间戳,而这个任务会修改派发任务时记录下的时间戳。派发完任务后,线程睡眠固定时间(一般为5s),并等待线程重新开启。
监测单元405,用于监测所述时间戳是否发生变化。在本申请实施例中,待线程重新开启后,通过判断记录的时间是否有改变来检测之前派发的任务是否执行了,如果任务未被执行,证明线程阻塞了,成功监测到应用程序无响应(Application Not Responding,ANR)。
判定单元406,用于若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
建立单元407,用于建立所述服务进程与所述应用进程之间的连接关系。在本申请实施例中,当为应用程序创建服务进程之后,终端需要建立服务进程和应用进程之间的连接,通过监控该连接的状态,确定是否需要对与服务进程相对应的应用程序进行保护。其中,终端为服务进程创建了套接口,监测服务进程和应用进程之间的连接即为监测服务进程的套接口和应用进程的套接口之间的连接。通过建立服务进程和应用进程之间的连接关系,终端可以建立应用程序的服务进程和应用进程之间的连接,并且通过该连接来实现数据传输,并通过监听该连接是否中断来判断应用程序的状态,对应用程序的状态确定过程方便快捷,系统时延小,系统资源消耗小。
第一控制单元408,用于控制所述服务进程启动针对所述应用进程的保护程序。在本申请实施例中,启动针对所述应用进程的保护程序,可选的,若当前应用程序(Application Programming Interface,API)编程接口数量小于18,在前台Service中直接传入Notification()函数,设置定时唤醒应用程序的时间间隔,并通过发送唤醒广播来促使已挂掉的应用进程重新启动,其中,该时间间隔可以是5分钟、10分钟,或者其他时间,具体的时间间隔在此不作限定;若API编程接口数量大于或者等于18,同时启动两个id相同的前台Service,然后再将后启动的Service做stop处理,并通过使用Hack手段对正在被杀掉的应用进程作保活,即通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
第二控制单元409,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。在本申请实施例中,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行,可选的,若应用进程中断时,应用进程和服务进程之间的连接便会中断,服务进程会接收到应用进程中断通知消息,服务进程一旦接收到中断通知消息,即确定应用程序可能已被中断,将重新启动应用程序的应用进程中的部分或者全部功能;可选的,若应用进程将被中断时,通过使用Hack手段对正在被杀掉的应用进程作保活,通过提高被保护的应用进程的优先级,在应用进程将要面临被杀掉时,利用被保护的应用进程的优先级高于其他进程而不被杀掉以达到保活的目的。
由以上可见,本申请实施例通过创建监测线程,根据所述监测线程向所述应用进程指示或者派发任务,记录所述任务指示或者派发的时间戳,监测所述时间戳是否发生变化,若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态,从而可以帮助开发人员准确查找、定位出现ANR问题的原因。
在硬件实现上,以上生成单元101、建立单元102、第一控制单元103、第二控制单元104等可以以硬件形式内嵌于或独立于数据处理的装置中,也可以以软件形式存储于数据处理装置的存储器中,以便处理器调用执行以上各个单元对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
上述进程保护装置可以实现为一种计算机程序的形式,计算机程序可以在如图11所示的计算机设备上运行。
图11为本申请一种进程保护设备的结构组成示意图。该设备可以是终端,也可以是服务器,其中,终端可以是智能手机、平板电脑、笔记本电脑、台式电脑、个人数字助理和穿戴式设备等具有通信功能的电子设备。服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。参照图11,该计算机设备500包括通过系统总线501连接的处理器502、非易失性存储介质503、内存储器504和网络接口505。其中,该计算机设备500的非易失性存储介质503可存储操作系统5031和计算机程序5032,该计算机程序5032被执行时,可使得处理器502执行一种进程保护方法。该计算机设备500的处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序被处理器执行时,可使得处理器502执行一种进程保护方法。计算机设备500的网络接口505用于进行网络通信,如发送分配的任务等。本领域技术人员可以理解,图11中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
其中,所述处理器502执行如下操作:
若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立所述服务进程与所述应用进程之间的连接关系;
控制所述服务进程启动针对所述应用进程的保护程序;
若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
在一些实施例中,所述处理器502还执行如下操作:
获取与所述服务进程相对应的分叉子进程;
在所述分叉子进程中创建定时器;
设置所述定时器的时间间隔;
根据所述时间间隔控制所述应用进程显示运行信息的操作。
在一些实施例中,所述处理器502还执行如下操作:
获取与所述服务进程相对应的分叉子进程;
在所述分叉子进程中设置无障碍服务类;
调用所述无障碍服务类中预设的方法项;
根据所述预设的方法项获取所述应用进程的运行信息。
在一些实施例中,所述调用的无障碍服务类中预设的方法项,包括:
若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
传递关联的无障碍事件并向用户反馈。
在一些实施例中,所述处理器502还执行如下操作:
创建监测线程;
根据所述监测线程向所述应用进程指示或者派发任务;
记录所述任务指示或者派发的时间戳;
监测所述时间戳是否发生变化;
若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
本申请提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序可被一个或者一个以上的处理器执行,以实现以下步骤:
若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程;
建立所述服务进程与所述应用进程之间的连接关系;
控制所述服务进程启动针对所述应用进程的保护程序;
若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
计算机可读存储介质被所述处理器执行时,使得一个或多个处理器还执行以下步骤:
获取与所述服务进程相对应的分叉子进程;
在所述分叉子进程中创建定时器;
设置所述定时器的时间间隔;
根据所述时间间隔控制所述应用进程显示运行信息的操作。
计算机可读存储介质被所述处理器执行时,使得一个或多个处理器还执行以下步骤:
获取与所述服务进程相对应的分叉子进程;
在所述分叉子进程中设置无障碍服务类;
调用所述无障碍服务类中预设的方法项;
根据所述预设的方法项获取所述应用进程的运行信息。
计算机可读存储介质被所述处理器执行时,使得一个或多个处理器还执行以下步骤:所述调用的无障碍服务类中预设的方法项,包括:
若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
传递关联的无障碍事件并向用户反馈。
计算机可读存储介质被所述处理器执行时,使得一个或多个处理器还执行以下步骤:
创建监测线程;
根据所述监测线程向所述应用进程指示或者派发任务;
记录所述任务指示或者派发的时间戳;
监测所述时间戳是否发生变化;
若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
本申请前述的存储介质可以是非易失性存储介质,例如:磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等各种可以存储程序代码的介质。
本申请所有实施例中的单元可以通过通用集成电路,例如CPU(Central Processing Unit,中央处理器),或通过ASIC (Application Specific Integrated
Circuit,专用集成电路)来实现。
本申请实施例进程保护方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本申请实施例进程保护装置中的单元可以根据实际需要进行合并、划分和删减。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种进程保护方法,其特征在于,所述方法包括:
    若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
    建立所述服务进程与所述应用进程之间的连接关系;
    控制所述服务进程启动针对所述应用进程的保护程序;
    若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
  2. 如权利要求1所述的方法,其特征在于,在所述建立所述服务进程与所述应用进程之间的连接关系之后,所述方法还包括:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中创建定时器;
    设置所述定时器的时间间隔;
    根据所述时间间隔控制所述应用进程显示运行信息的操作。
  3. 如权利要求1所述的方法,其特征在于,在所述建立所述服务进程与所述应用进程之间的连接关系之后,所述方法还包括:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中设置无障碍服务类;
    调用所述无障碍服务类中预设的方法项;
    根据所述预设的方法项获取所述应用进程的运行信息。
  4. 如权利要求3所述的方法,其特征在于,所述调用的无障碍服务类中预设的方法项,包括:
    若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
    传递关联的无障碍事件并向用户反馈。
  5. 如权利要求1所述的方法,其特征在于,在所述若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程之后,所述方法包括:
    创建监测线程;
    根据所述监测线程向所述应用进程指示或者派发任务;
    记录所述任务指示或者派发的时间戳;
    监测所述时间戳是否发生变化;
    若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
  6. 一种进程保护装置,其特征在于,所述装置包括:
    生成单元,用于若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
    建立单元,用于建立所述服务进程与所述应用进程之间的连接关系;
    第一控制单元,用于控制所述服务进程启动针对所述应用进程的保护程序;
    第二控制单元,用于若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
  7. 如权利要求6所述的装置,其特征在于,所述装置还包括:
    第一获取单元,用于获取与所述服务进程相对应的分叉子进程;
    创建单元,用于在所述分叉子进程中创建定时器;
    第一设置单元,用于设置所述定时器的时间间隔;
    第三控制单元,用于根据所述时间间隔控制所述应用进程显示运行信息的操作。
  8. 如权利要求6所述的装置,其特征在于,所述装置还包括:
    第二获取单元,用于获取与所述服务进程相对应的分叉子进程;
    第二设置单元,用于在所述分叉子进程中设置无障碍服务类;
    调用单元,用于调用所述无障碍服务类中预设的方法项;
    第三获取单元,用于根据所述预设的方法项获取所述应用进程的运行信息。
  9. 如权利要求8所述的装置,其特征在于,所述调用单元,包括:
    调用子单元,用于若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
    反馈单元,用于传递关联的无障碍事件并向用户反馈。
  10. 如权利要求1所述装置,其特征在于,所述装置还包括:
    创建单元,用于创建监测线程;
    执行单元,用于根据所述监测线程向所述应用进程指示或者派发任务;
    记录单元,用于记录所述任务指示或者派发的时间戳;
    监测单元,用于监测所述时间戳是否发生变化;
    判定单元,用于若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
  11. 一种进程保护设备,其特征在于,包括:
    存储器,用于存储实现进程保护的程序;以及
    处理器,用于运行所述存储器中存储的进程保护的程序,以执行以下操作:
    若检测到一应用进程正在运行,生成与所述应用进程相对应的服务进程;
    建立所述服务进程与所述应用进程之间的连接关系;
    控制所述服务进程启动针对所述应用进程的保护程序;
    若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
  12. 如权利要求11所述的设备,其特征在于,所述处理器还执行以下操作:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中创建定时器;
    设置所述定时器的时间间隔;
    根据所述时间间隔控制所述应用进程显示运行信息的操作。
  13. 如权利要求11所述的设备,其特征在于,所述处理器还执行以下操作:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中设置无障碍服务类;
    调用所述无障碍服务类中预设的方法项;
    根据所述预设的方法项获取所述应用进程的运行信息。
  14. 如权利要求13所述的设备,其特征在于,所述调用的无障碍服务类中预设的方法项,包括:
    若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
    传递关联的无障碍事件并向用户反馈。
  15. 如权利要求11所述的设备,其特征在于,所述处理器还执行以下操作:
    创建监测线程;
    根据所述监测线程向所述应用进程指示或者派发任务;
    记录所述任务指示或者派发的时间戳;
    监测所述时间戳是否发生变化;
    若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序可被一个或者一个以上的处理器执行,以实现以下步骤:
    若检测到某一应用进程正在运行,生成与所述应用进程相对应的服务进程;
    建立所述服务进程与所述应用进程之间的连接关系;
    控制所述服务进程启动针对所述应用进程的保护程序;
    若检测到用于停止所述应用进程的停止事件时,控制所述服务进程利用所述保护程序保护所述应用进程并使所述应用进程继续运行。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中创建定时器;
    设置所述定时器的时间间隔;
    根据所述时间间隔控制所述应用进程显示运行信息的操作。
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:
    获取与所述服务进程相对应的分叉子进程;
    在所述分叉子进程中设置无障碍服务类;
    调用所述无障碍服务类中预设的方法项;
    根据所述预设的方法项获取所述应用进程的运行信息。
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述调用的无障碍服务类中预设的方法项,包括:
    若检测到符合无障碍服务设定的无障碍事件过滤参数事件时,调用所述预设方法项;
    传递关联的无障碍事件并向用户反馈。
  20. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:
    创建监测线程;
    根据所述监测线程向所述应用进程指示或者派发任务;
    记录所述任务指示或者派发的时间戳;
    监测所述时间戳是否发生变化;
    若检测到所述时间戳未发生变化,判定所述应用进程处于ANR状态。
PCT/CN2017/108238 2017-09-14 2017-10-30 一种进程保护方法、装置、设备以及计算机可读存储介质 Ceased WO2019051944A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710827274.1 2017-09-14
CN201710827274.1A CN107678782B (zh) 2017-09-14 2017-09-14 一种进程保护方法、装置、设备以及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019051944A1 true WO2019051944A1 (zh) 2019-03-21

Family

ID=61136593

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/108238 Ceased WO2019051944A1 (zh) 2017-09-14 2017-10-30 一种进程保护方法、装置、设备以及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN107678782B (zh)
WO (1) WO2019051944A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321203B (zh) * 2018-03-29 2021-07-30 武汉斗鱼网络科技有限公司 后台进程假死处理方法及客户端
CN108874522A (zh) * 2018-06-19 2018-11-23 北京五八信息技术有限公司 消息推送设置方法、装置、计算机设备及可读存储介质
CN109582530B (zh) * 2018-09-30 2024-05-14 中国平安人寿保险股份有限公司 系统控制方法、装置、计算机及计算机可读存储介质
CN111930481B (zh) * 2020-07-16 2024-06-18 重庆帮企科技集团有限公司 一种基于安卓系统的进程优先级提高方法和装置
CN114154148B (zh) * 2020-09-07 2025-08-08 武汉安天信息技术有限责任公司 一种应用程序行为检测方法及设备
CN112966266A (zh) * 2021-03-02 2021-06-15 北京金山云网络技术有限公司 一种病毒检测系统
CN112860408A (zh) * 2021-03-03 2021-05-28 苏州沁游网络科技有限公司 一种云真机中的进程保活方法、装置、系统及存储介质
CN115061802A (zh) * 2022-06-30 2022-09-16 兰州乐智教育科技有限责任公司 进程防清理方法、装置、电子设备及存储介质
CN117707814A (zh) * 2023-08-04 2024-03-15 荣耀终端有限公司 耗时的检测方法、存储介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193825A (zh) * 2011-04-26 2011-09-21 北京思创银联科技股份有限公司 进程保护方法
CN104598313A (zh) * 2015-02-04 2015-05-06 广州市久邦数码科技有限公司 一种应用进程被停止后自动重启的实现方法及其系统
CN104809400A (zh) * 2015-04-28 2015-07-29 联动优势科技有限公司 一种进程保护的方法及装置
CN105303103A (zh) * 2015-10-14 2016-02-03 北京奇虎科技有限公司 保护移动终端中的服务进程的方法和移动终端
CN105589757A (zh) * 2014-10-23 2016-05-18 上海天脉聚源文化传媒有限公司 一种服务器架构下的保护工作进程的方法和服务器

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1175351C (zh) * 2001-12-04 2004-11-10 上海复旦光华信息科技股份有限公司 Solaris进程自动保护系统
CN104503912B (zh) * 2014-12-24 2017-07-11 中科创达软件股份有限公司 一种服务响应过程的监测方法及装置
CN105260241B (zh) * 2015-10-23 2019-04-16 南京理工大学 集群系统中进程相互协作的方法
CN105827438B (zh) * 2016-03-11 2019-03-15 广东亿迅科技有限公司 一种自动设置apn的方法
CN106685752B (zh) * 2016-06-28 2019-01-04 腾讯科技(深圳)有限公司 一种信息处理方法及终端
CN106951335B (zh) * 2017-02-28 2020-08-04 维沃移动通信有限公司 一种进程守护方法和移动终端

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193825A (zh) * 2011-04-26 2011-09-21 北京思创银联科技股份有限公司 进程保护方法
CN105589757A (zh) * 2014-10-23 2016-05-18 上海天脉聚源文化传媒有限公司 一种服务器架构下的保护工作进程的方法和服务器
CN104598313A (zh) * 2015-02-04 2015-05-06 广州市久邦数码科技有限公司 一种应用进程被停止后自动重启的实现方法及其系统
CN104809400A (zh) * 2015-04-28 2015-07-29 联动优势科技有限公司 一种进程保护的方法及装置
CN105303103A (zh) * 2015-10-14 2016-02-03 北京奇虎科技有限公司 保护移动终端中的服务进程的方法和移动终端

Also Published As

Publication number Publication date
CN107678782A (zh) 2018-02-09
CN107678782B (zh) 2020-03-17

Similar Documents

Publication Publication Date Title
WO2019051944A1 (zh) 一种进程保护方法、装置、设备以及计算机可读存储介质
WO2019019340A1 (zh) 应用程序页面打开方法、装置、终端及可读存储介质
WO2019056752A1 (zh) 家电设备的配网方法、装置、系统及计算机可读存储介质
WO2019037319A1 (zh) 电量预警方法、服务器、移动终端及存储介质
WO2017119611A1 (en) Ear wearable type wireless device and system supporting the same
WO2017105092A1 (en) Electronic device including shield structure
WO2018166107A1 (zh) 基于Hybrid的兼容方法、适配件、运行装置、系统以及计算机可读存储介质
WO2019051908A1 (zh) 终端控制方法、装置及计算机可读存储介质
WO2019080249A1 (zh) 告警处理方法、装置、计算机设备及存储介质
WO2019051890A1 (zh) 终端控制方法、装置及计算机可读存储介质
WO2019019378A1 (zh) 业务处理方法、装置、适配器及计算机可读存储介质
WO2018086293A1 (zh) 数据泄露接口检测方法、装置、设备及存储介质
WO2019019374A1 (zh) 智能语音设备控制家电的方法、装置及系统
WO2017026826A1 (en) Electronic device including antenna device
WO2018086294A1 (zh) 应用软件安全漏洞检测方法、系统、设备及存储介质
WO2019056462A1 (zh) 名单分配方法、装置、设备以及计算机可读存储介质
WO2019051895A1 (zh) 终端控制方法、装置及存储介质
WO2020027578A1 (en) Home appliance and online system that performs pairing of the same
WO2016107224A1 (zh) 界面焦点移动控制方法及装置
WO2018107650A1 (zh) 一种修正调整灰阶曲线的方法及显示装置
WO2014148813A1 (ko) 신호 송신 장치, 신호 송신 방법 및 신호 송수신 시스템
WO2015089856A1 (zh) 一种触控界面的实现方法及装置
WO2015108283A1 (ko) 클라우드 스트리밍 서비스를 위한 어플리케이션 에러 검출 방법, 이를 위한 장치 및 시스템
WO2015158133A1 (zh) 语音控制指令纠错方法和系统
WO2015124073A1 (en) Process monitoring method, apparatus, and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17924792

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17924792

Country of ref document: EP

Kind code of ref document: A1