WO2019128553A1 - Application processing method, electronic device, and computer-readable storage medium - Google Patents

Application processing method, electronic device, and computer-readable storage medium Download PDF

Info

Publication number
WO2019128553A1
WO2019128553A1 PCT/CN2018/116607 CN2018116607W WO2019128553A1 WO 2019128553 A1 WO2019128553 A1 WO 2019128553A1 CN 2018116607 W CN2018116607 W CN 2018116607W WO 2019128553 A1 WO2019128553 A1 WO 2019128553A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
resource
level
obtaining
processed
Prior art date
Application number
PCT/CN2018/116607
Other languages
French (fr)
Chinese (zh)
Inventor
陈岩
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019128553A1 publication Critical patent/WO2019128553A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Definitions

  • the present application relates to the field of computer technologies, and in particular, to an application processing method, an electronic device, and a computer readable storage medium.
  • Smart devices can implement different application operations through applications, such as purchasing products through a shopping application, viewing videos through a video application, and the like.
  • the application can be frozen, and the frozen application can no longer continue to run without taking up processor resources in the smart device. However, since the application still exists in the smart device, it also occupies resources such as memory and hardware in the smart device.
  • an application processing method an electronic device, and a computer readable storage medium are provided.
  • An application processing method including:
  • the to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  • An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following operations:
  • the to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  • a computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor to:
  • the to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  • the application processing method, the electronic device, and the computer readable storage medium acquire the lost frame number of the image frame when detecting that a continuous image frame output by the electronic device is lost.
  • the rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application.
  • the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resource occupied by the background application is recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application.
  • FIG. 1 is a schematic diagram of an application environment of an application processing method in an embodiment.
  • FIG. 2 is a schematic diagram showing the internal structure of an electronic device in an embodiment.
  • 3 is a flow chart of an application processing method in one embodiment.
  • FIG. 4 is a flow chart of an application processing method in another embodiment.
  • FIG. 5 is a schematic diagram of a resource restriction state of an application in an embodiment.
  • FIG. 6 is a partial structural diagram of an electronic device in an embodiment.
  • FIG. 7 is a schematic structural diagram of an application processing apparatus in an embodiment.
  • FIG. 8 is a schematic structural diagram of an application processing apparatus in another embodiment.
  • FIG. 9 is a block diagram showing a partial structure of a mobile phone related to an electronic device according to an embodiment of the present application.
  • first may be referred to as a second client
  • second client may be referred to as a first client, without departing from the scope of the present application.
  • Both the first client and the second client are clients, but they are not the same client.
  • FIG. 1 is a schematic diagram of an application environment of an application processing method in an embodiment.
  • the application environment includes a client 102 and a server 104.
  • An application can be installed on the client 102, and the application can output a contact image frame when the foreground of the client 102 is running.
  • the client 102 acquires the number of lost frames of the image frame when outputting consecutive image frames; acquires the stuck level of the foreground application according to the number of lost frames; acquires the to-be-processed application from the background application according to the foreground application, and according to the The level obtains the resource restriction policy; the resource to be processed is restricted by the resource according to the resource restriction policy.
  • the server 104 can be used to push an application processing algorithm to the client 102, and the client 102 processes the application according to the application processing algorithm.
  • the client 102 is an electronic device that is mainly used for inputting user information and outputting processing results at the outermost periphery of the computer network, and may be, for example, a personal computer, a mobile terminal, a personal digital assistant, a wearable electronic device, or the like.
  • the server 104 is a device for providing a computing service in response to a service request, and may be, for example, one or more computers. It can be understood that, in other embodiments provided by the present application, the application environment of the application processing method may only include the client 102.
  • the electronic device includes a processor, memory, and display screen connected by a system bus.
  • the processor is used to provide computing and control capabilities to support the operation of the entire electronic device.
  • the memory is used to store data, programs, and/or instruction codes, etc., and the memory stores at least one computer program, which can be executed by the processor to implement an application processing method suitable for an electronic device provided in the embodiments of the present application.
  • the memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random storage memory (Random-Access-Memory, RAM).
  • the memory includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the computer program can be executed by a processor for implementing an application processing method provided by various embodiments of the present application.
  • the internal memory provides a cached operating environment for operating systems and computer programs in non-volatile storage media.
  • the display screen can be a touch screen, such as a capacitive screen or an electronic screen, for displaying interface information of an application corresponding to the foreground process, and can also be used for detecting a touch operation acting on the display screen, and generating corresponding instructions, such as performing front and back Application switching instructions, etc.
  • FIG. 2 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 on the electronic device to which the solution of the present application is applied.
  • the specific electronic device may be It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the electronic device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external electronic device, for example, for communicating with a server.
  • FIG. 3 is a flow chart of an application processing method in one embodiment.
  • the application processing method in this embodiment is described by using the terminal or server running in FIG. 1 as an example.
  • the application processing method includes operations 302 through 308. among them:
  • Operation 302 when the electronic device outputs a continuous image frame, acquires the number of lost frames of the image frame.
  • An application refers to a software written for an application purpose in an electronic device, and the electronic device can implement a service demanded by the user through an application. For example, users can play games through a game-like application, watch videos through a video-like application, and play music through a music-like application.
  • Applications can be divided into foreground applications and background applications based on the state of the run.
  • the foreground application refers to an application running in the foreground of the electronic device, and the foreground application can be displayed and interacted with the user in the foreground.
  • a background application refers to an application that runs in the background of an electronic device. The background application generally cannot display and interact with the user in the foreground.
  • the process is a running activity of the program in the computer on a certain data set, and is a basic unit for the system to perform resource allocation and scheduling.
  • a process can correspond to one or more threads.
  • a thread is a single sequential control process in a program, and is a relatively independent, schedulable execution unit within a process.
  • the process may include a foreground process and a background process, and the foreground process is a process running in the foreground of the electronic device, and the background process is a process running in the background of the electronic device.
  • the electronic device can control the switching between the foreground process and the background process, and the foreground process can switch to the background operation, and the background process can also switch to the foreground operation.
  • the process can be managed by the process pool, and the process identifier corresponding to one or more processes can be stored in the process pool.
  • the process ID is used to uniquely identify a process.
  • the process pool may include a foreground process pool and a background process pool.
  • the foreground process pool includes a process identifier corresponding to the foreground process
  • the background process pool includes a process identifier corresponding to the background process.
  • the process ID of process A is “0123”.
  • the process ID “0123” of process A can be removed from the background process pool and added to the foreground process. In the pool.
  • the files of the foreground application are displayed on the output device of the electronic device, and the user can interact with the electronic device through the input device and the output device.
  • an electronic device can display an image in an output device while playing video or entering a game interface.
  • a continuous sequence of image frames is often played in the output device, and the images in the sequence of image frames form a continuous animation.
  • a continuous animation interface is formed, wherein each image in the sequence of image frames can be referred to as an image frame.
  • the foreground application displays a sequence of consecutive image frames in the output device, it plays timing and plays each image frame in the order of the sequence of image frames.
  • the number of lost frames is the number of image frames lost by the electronic device when outputting consecutive image frames. For example, if the number of consecutive image frames to be played is 10 frames, and only 7 frames are actually played, the number of lost frames of the image frame is 3 frames.
  • Operation 304 obtaining a Karton level of the foreground application according to the number of lost frames.
  • the occupancy rate of the outputted continuous frame image is generally lost due to the high occupancy rate of resources such as the network of the electronic device and the CPU (Central Processing Unit).
  • a continuous image frame of the playback is lost, it can be determined that the operation of the foreground application in the electronic device has caused a jam.
  • the Carton level is the severity of the front-end application jam. The more frames that are lost in the image frame, the more the foreground application is stuck and the higher the card level. Corresponding relationship between the number of lost frames and the Karton level is established in advance, and then the corresponding card level is obtained according to the obtained number of lost frames.
  • the Carton level can be divided into a heavy card, a normal card, and a light carton. Assuming that the continuous image frame includes a total of 20 frames, the correspondence between the number of lost frames and the Karton level can be established. When the number of lost frames is [0, 5], [5, 15], [15, 20], it corresponds to three levels of light, such as light, common, and heavy.
  • Operation 306 obtaining a to-be-processed application from the background application according to the foreground application, and obtaining a resource restriction policy according to the Karton level.
  • a pending application is an application that requires resource throttling. It can be understood that the application running in the electronic device can be divided into a foreground application and a background application. When the current application generates a jam, the resources of the electronic device are relatively tight. The resources occupied by the background application can be controlled to use more resources in the electronic device for the running of the foreground application.
  • the obtaining the to-be-processed application may include: obtaining a foreground application priority of the foreground application; and acquiring a background application whose application priority is lower than the foreground application priority, as the to-be-processed application. Application priority is used to indicate the importance of the application.
  • the application priority of the system application can be defined to be higher than the application priority of the third-party application, or the application priority can be defined according to the type of the application, and the application priority of the instant messaging application is higher than that of the game application.
  • the user or the system can customize the application priority, which is not specifically limited in this embodiment.
  • the resource restriction policy refers to a policy for processing resource restriction processing on an application, pre-establishes a correspondence between a card level and a resource restriction policy, and then acquires a corresponding resource restriction policy according to the card level. For example, when the Karton level is severely stuck, the application to be processed is frozen; when the Karton level is lightly stuck, the resources occupied by the application to be processed are recycled.
  • Operation 308 the resource to be processed is subjected to resource limitation processing according to the resource restriction policy.
  • a resource is a software or hardware resource that an electronic device must use to process an application event, such as an CPU, memory, hardware, network resources, and IO (Input-Output) of an electronic device.
  • Resource limit processing refers to the process of restricting the resources occupied by the application.
  • the resource limit processing can be, but is not limited to, controlling the application to enter a frozen state or a resource restricted state, and the application in the frozen state is not closed, but is not temporarily running. When the application is frozen, the application does not consume processor resources, but still occupies resources such as memory and hardware of the electronic device.
  • the resource limit state refers to the state in which the resources of the electronic device used by the application at runtime are restricted. For example, the CPU usage of the control application at runtime cannot exceed 5%.
  • the resource limiting process is performed on the to-be-processed application according to the resource restriction policy, which can limit the consumption of the electronic device resources by the background pending application.
  • the application processing method acquires the number of lost frames of the image frame when it is detected that the continuous image frame outputted by the electronic device is lost.
  • the rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application.
  • the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy.
  • FIG. 4 is a flow chart of an application processing method in another embodiment.
  • the application processing method in this embodiment is described by using the terminal or server running in FIG. 1 as an example.
  • the application processing method includes operations 402 through 416. among them:
  • Operation 402 when the electronic device outputs a continuous image frame, acquires the number of lost frames of the image frame.
  • the number of consecutive lost frames of the image frame may be acquired, and then the stuck level of the foreground application is obtained based on the number of consecutive lost frames.
  • the number of consecutive lost frames refers to the number of consecutive lost image frames when the foreground application outputs the display during actual operation.
  • the continuous image frames output by the foreground application in the electronic device are arranged according to a certain regularity.
  • the so-called continuous loss is the uninterrupted loss, that is, the number of consecutive loss of image frames.
  • the continuous image frames played in the electronic device are marked by the image frame identifier and arranged in a certain order. The electronic device obtains the image frame identifier corresponding to the actually output image frame, and can know which image frames are lost when outputting. .
  • the continuous image frame played by the electronic device includes 10 image frames, and the image frame identifiers corresponding to the first image frame to the last image frame are “01”, “02”, . . . “10”, respectively.
  • the electronic device output can be judged.
  • the lost image frames are "04", "05", “06”, and since "04", "05”, and "06" are consecutive image frames, the number of consecutive lost frames of the acquired image frames It is 3 frames.
  • the electronic device can acquire the number of consecutive consecutive lost frames and obtain the maximum consecutive lost frames according to the maximum consecutive lost frames. Get the Carton level. For example, the electronic device outputs consecutive image frames whose image frame identifiers are “01”, “02”, . . . “10”, and the actual output image frame sequence is “01” ⁇ “02” ⁇ “03” ⁇ “07” ⁇ “10”, it can be judged that when the electronic device outputs continuous image frames, the lost image frames are “04”, “05”, “06”, “08”, “09”.
  • “04”, “05” and “06” are consecutive image frames
  • “08” and “09” are consecutive image frames
  • the consecutive lost frames corresponding to “04”, “05” and “06” are In 3 frames
  • the number of consecutive lost frames corresponding to "08” and “09” is 2 frames
  • the maximum number of consecutive lost frames acquired is 3 frames.
  • the electronic device can continuously update the maximum number of consecutive lost frames during playback.
  • the continuous image frame outputted by the electronic device may be further divided into a preset number of image frame sequences, and then the lost frame of the image frame in each image frame sequence is counted when the electronic device outputs the continuous image frame.
  • Number and obtain the maximum number of lost frames from the number of lost frames obtained; obtain the Receive level of the foreground application according to the maximum number of lost frames. For example, it is necessary to output consecutive image frames whose image frame identifiers are “01”, “02”, . . . “18”, and divide the continuous image frame into “01”, “02”, . . .
  • each electronic image frame sequence is counted when the electronic device outputs continuous image frames.
  • the number of lost frames of the corresponding image frame, and the maximum number of lost frames is obtained from the number of lost frames obtained. It can be understood that when the electronic device outputs a continuous image frame, each complete output of one image frame sequence generates a corresponding number of lost frames. Therefore, during the process of outputting consecutive image frames, the maximum number of lost frames is continuously updated.
  • Operation 404 determining a target frame number interval in which the number of lost frames falls, and obtaining a carton level of the foreground application according to the target frame number interval.
  • the number of lost frames is divided into two or more frame number intervals in advance, and then the correspondence relationship between each frame number interval and the Karton level is established.
  • the target frame number range in which the number of lost frames falls is obtained, and then the corresponding card level is obtained according to the target frame number interval.
  • the divided frame number interval can be set according to the total number of consecutive image frames.
  • the frame number interval may be set according to the percentage of the total number of consecutive image frames, for example, the number of lost frames is divided into 4 frame number intervals, which may be 0 to 25%, 25% to 50%, 50% according to the total number. 75% and 75% to 100% calculate the frame number interval.
  • Operation 406 Obtain a dependent application that is dependent on the foreground application from the background application, and obtain a background application other than the dependent application as the to-be-processed application.
  • relying on data that indicates that one application needs to utilize one or more applications can successfully implement the relationship to the execution of that one application.
  • the application A depends on the application B, or the application B is dependent on the application A, that is, the application A needs to utilize the data of the application B to implement the execution of the application A.
  • the application A is an application that depends on application B
  • application B is an application that is dependent on application A.
  • the dependent application refers to a background application that is relied upon by the foreground application.
  • obtaining the dependent application corresponding to the foreground application comprises: obtaining a background application having a communication relationship with the foreground application as a dependent application.
  • the communication relationship between applications is established by defining a communication mechanism.
  • the communication mechanism includes Socket, Binder, shared memory and so on.
  • Binder communication is an efficient IPC (Inter-Process Communication) mechanism implemented in the Android system. It is a client-server (client-server) communication structure.
  • the client and the server define a corresponding proxy interface.
  • the proxy interface method packages the client parameters into a Parcel object, and then the proxy interface sends the Parcel object to the Binder in the kernel layer. drive.
  • the server can read the request data in the Binder driver, then parse and process the Parcel object, and return the processing result.
  • Socket communication allows communication between two network applications to enable data exchange between applications on the network.
  • local inter-application communication can uniquely identify an application through PID (Process Identity), but there is no way to communicate between network applications.
  • IP Internet Protocol
  • the "protocol + port” can uniquely identify the application in the host, so in the Socket communication, it is usually passed. IP address + protocol + port” form to uniquely identify an application.
  • Shared memory allows two unrelated applications to access the same logical memory. Shared memory is a very efficient way to share and transfer data between two running applications. Memory shared between different applications. Usually arranged as the same piece of physical memory.
  • obtaining the dependent application corresponding to the foreground application includes at least one of the following methods: acquiring a background application having a socket communication relationship with the foreground application as a dependent application; acquiring a binder communication relationship with the foreground application.
  • Operation 408 when the Karton level is greater than the level threshold, acquiring the first resource restriction policy.
  • the resource restriction policy is obtained according to the Karton level of the foreground application, and the resource restriction processing is performed on the application to be processed according to the resource restriction policy.
  • the resource restriction policy may be divided into a first resource restriction policy and a second resource restriction policy.
  • the first resource restriction policy refers to a policy for controlling a pending application to enter a frozen state according to a Carton level
  • the second resource restriction policy refers to a The level controls the policy that the pending application enters the resource limit state.
  • Operation 410 Acquire a second resource restriction policy when the Carton level is less than or equal to the level threshold.
  • the acquired pending application may be frozen.
  • the pending application after freezing cannot continue to run and does not consume CPU resources.
  • the Karton level is less than or equal to the level threshold, it indicates that the running of the foreground application is lighter, and the running state of the to-be-processed application can be maintained, and the pending application is restricted during the running process of the to-be-processed application. Occupied resources.
  • the to-be-processed application is subjected to resource limitation processing according to the first resource restriction policy; or the to-be-processed application is subjected to resource limitation processing according to the second resource restriction policy.
  • the resource limiting processing of the to-be-processed application according to the first resource restriction policy includes: controlling the to-be-processed application to enter a frozen state.
  • the pending application that enters the frozen state can no longer continue to run, which can reduce the resource consumption of the electronic device by the pending application.
  • the frozen pending application can also be woken up, and the user or system can set the conditions for the wakeup.
  • the Android system there are various ways to implement application freezing and wake-up.
  • the pm (package manager) command In the pm command, the application can be set to a frozen state by the freeze command pm disable[–user USER_ID]PACKAGE_OR_COMPONENT, and then passed.
  • the defrosting command pm enable[–user USER_ID]PACKAGE_OR_COMPONENT wakes up the application in the frozen state, and obtains the list of applications in the frozen state by freezing the list query command pm list packages–d to view the frozen application.
  • the application processing method is described by taking the Android operating system as an example in the present application, but the application processing method of the present application is not limited to being implemented in the Android system, and can also be applied to the IOS (IPhone Operating System), In operating systems such as Symbian, Windows, and MAC OS (Macintosh Operating System).
  • IOS IPhone Operating System
  • MAC OS Macintosh Operating System
  • the resource limiting process to be processed by the application according to the second resource restriction policy includes: obtaining a corresponding resource restriction level according to the Carton level, and controlling the to-be-processed application to enter a resource restriction level corresponding resource limitation state, where
  • the resource-restricted state application has a resource occupancy rate for the electronic device at runtime that is less than the occupancy threshold.
  • the to-be-processed application is in the resource-restricted state, the resource usage rate of the electronic device to be processed cannot exceed the occupancy threshold. This can control the resource usage of the electronic device by the application to be processed, and reduce the occupation of resources by the background. Improve the efficiency of the front desk.
  • controlling the CPU usage of the pending application at runtime should not exceed 5% to reduce the excessive consumption of the CPU by the application to be processed and reduce the user's dependence on the mobile phone.
  • cgroups control groups
  • the CPU usage such as CPU, memory, and IO of the application to be processed, that is, the acquired application to be processed enters the resource limitation state.
  • the resource restriction level is used to indicate the degree of resource limitation to the application, and the correspondence between the carton level and the resource restriction level is established in advance.
  • the corresponding resource restriction level is obtained according to the Karton level.
  • the Carton level can be divided into four levels: Level 1, Level 2, Level 3, Level 4, etc., and the degree of Carton increases from Level 1 to Level 4.
  • the level threshold may be level 3.
  • the corresponding resource restriction level is obtained according to the level of the card.
  • the resource limit level can be divided into three levels: the light resource limit level, the common resource limit level, and the deep resource limit level.
  • the corresponding card level is level 1, level 2, level 3, and the corresponding resource limit level is occupied.
  • the rate threshold is different. It can be understood that the occupancy thresholds corresponding to different resources can also be set to be different. For example, the CPU usage threshold can be 5%, and the memory usage threshold can be 10%.
  • Operation 414 when it is detected that the foreground application switches to the background, starts timing.
  • the electronic device can monitor the foreground application.
  • the electronic device starts the timer and then starts counting through the timer.
  • the timer established by the electronic device can be associated with the foreground application, and when the current application switches to the background, the start timer starts counting.
  • the correspondence between the foreground application identifier of the foreground application and the timing identifier of the timer is established in advance, and the timer is searched for and started by the timer identifier corresponding to the foreground application identifier.
  • the system can predefine a timer.
  • the foreground application identifier searches for the corresponding timer, and clears the timer by timer.setBase(SystemClock.elapsedRealtime()). Zero, then start the timer through the timer.start() function and start timing.
  • the pending application is controlled to return to the normal operating state.
  • the pending application When the timing duration exceeds the duration threshold, the pending application is restored to normal operation. Specifically, when the to-be-processed application is in the resource-restricted state, the resource limitation of the electronic device to be processed by the application is released. The pending application wakes up from a frozen state when the pending application is frozen. After returning to normal operation, the pending application's use of electronic device resources is no longer restricted. In addition, when a switching instruction to switch the application to be processed from the background to the foreground is detected, the pending application is controlled to return to the normal operating state. This ensures that the pending application can process the instructions of the electronic device in time and improve the operating efficiency of the electronic device.
  • FIG. 5 is a schematic diagram of a resource restriction state of an application in an embodiment.
  • the resources of the electronic device include a CPU, a memory, an IO, a network resource, and the like, and the state of the application may be classified into a normal running state, a resource limiting state, and a frozen state.
  • the resource restriction state may be further divided into a light resource restriction state, a normal resource restriction state, and a deep resource restriction state.
  • the corresponding available resource 502 and the unavailable resource 504 are different. From the light resource limit state, the normal resource limit state to the deep resource limit state, the available resource 502 is decremented. In normal operation, the application's available resource 502 is 100%.
  • the application processing method acquires the number of lost frames of the image frame when it is detected that the continuous image frame outputted by the electronic device is lost.
  • the rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application.
  • the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy.
  • FIGS. 3 and 4 are sequentially displayed as indicated by the arrows, these operations are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these operations is not strictly limited, and the operations may be performed in other sequences. Moreover, at least some of the operations in FIGS. 3 and 4 may include multiple sub-operations or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, or The order of execution of the stages is also not necessarily sequential, but may be performed alternately or alternately with at least a portion of the sub-operations or stages of other operations or other operations.
  • the architecture system of the electronic device includes a JAVA space layer 61, a local frame layer 62, and a Kernel space layer 63.
  • the JAVA spatial layer 61 can include a policy application 610 through which the electronic device can initiate a freeze and thaw strategy for each application, thereby implementing freezing and thawing operations for each application in the electronic device.
  • the policy application 610 determines the background power consumption application and initiates a freeze operation on the background power consumption application.
  • the local framework layer 62 includes a resource priority and restriction management module 620 and a platform freeze management module 622.
  • the electronic device can maintain the priority of the application and the corresponding resource group in real time through the resource priority and restriction management module 620, and adjust the priority and the resource group of the application according to the requirements of the upper layer, thereby achieving optimized performance and saving power consumption. effect.
  • the electronic device can allocate the tasks that can be frozen in the background to the frozen layer corresponding to the preset level by the platform freeze management module 622.
  • the frozen layer can include: the CPU limits the sleep mode, and the CPU Freeze sleep mode, process deep freeze mode.
  • the kernel space layer 63 includes a UID management module 630, a Cgroup module 632, a timeout freeze exit module 634, a Binder management module 636, and a process memory recovery module 638.
  • the UID management module 630 can manage resources of the third-party application or freeze based on the User Identifier (UID) of the application. Compared with the Process Identifier (PID) for process management and control, it is easier to uniformly manage the resources of a user's application through UID.
  • the Cgroup module 632 is used to provide a complete set of Central Processing Unit (CPU), CPUSET, memory, input/output (I/O), and Net related resource restriction mechanisms.
  • the timeout freeze exit module 634 is configured to resolve an exception generated by the freeze timeout scenario.
  • the Binder management module 636 is used to implement the priority control of the background binder communication.
  • the process memory recovery module 638 is configured to implement a deep freeze mode of the process.
  • the file area of the process can be released, thereby saving the memory module and speeding up the application at the next startup. speed.
  • FIG. 7 is a schematic structural diagram of an application processing apparatus in an embodiment.
  • the application processing apparatus 700 includes a frame number acquisition module 702, a level acquisition module 704, a policy acquisition module 706, and an application processing module 708. among them:
  • the frame number obtaining module 702 is configured to acquire the number of lost frames of the image frame when the electronic device outputs the continuous image frame.
  • the level obtaining module 704 is configured to obtain a carton level of the foreground application according to the number of lost frames.
  • the policy obtaining module 706 is configured to obtain a to-be-processed application from the background application according to the foreground application, and obtain a resource restriction policy according to the card-level.
  • the application processing module 708 is configured to perform resource limiting processing on the to-be-processed application according to the resource restriction policy.
  • the application processing device acquires the number of lost frames of the image frame when it detects that a continuous image frame output by the electronic device is lost.
  • the rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application.
  • the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy.
  • FIG. 8 is a schematic structural diagram of an application processing apparatus in another embodiment.
  • the application processing apparatus 800 includes a frame number acquisition module 802, a level acquisition module 804, a policy acquisition module 806, an application processing module 808, and an application recovery module 810. among them:
  • the frame number obtaining module 802 is configured to acquire the number of lost frames of the image frame when the electronic device outputs the continuous image frame.
  • the level obtaining module 804 is configured to obtain a card level of the foreground application according to the number of lost frames.
  • the policy obtaining module 806 is configured to obtain a to-be-processed application from the background application according to the foreground application, and obtain a resource restriction policy according to the card-level.
  • the application processing module 808 is configured to perform resource limiting processing on the to-be-processed application according to the resource restriction policy.
  • the application recovery module 810 is configured to start timing when detecting that the foreground application switches to the background; and when the timing duration exceeds the duration threshold, control the to-be-processed application to return to a normal running state.
  • the application processing device acquires the number of lost frames of the image frame when it detects that a continuous image frame output by the electronic device is lost.
  • the rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application.
  • the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy.
  • the level obtaining module 804 is further configured to determine a target frame number interval in which the number of lost frames falls, and obtain a carding level of the foreground application according to the target frame number interval.
  • the policy obtaining module 806 is further configured to: obtain a dependent application that is dependent on the foreground application from a background application, and obtain a background application other than the dependent application as a to-be-processed application. .
  • the policy obtaining module 806 is further configured to obtain a background application that has a communication relationship with the foreground application as a dependent application.
  • the policy obtaining module 806 is further configured to: when the cardinal level is greater than a level threshold, acquire a first resource limiting policy; when the cardinal level is less than or equal to a level threshold, acquire a second resource limiting policy. .
  • the application processing module 808 is further configured to perform resource limiting processing on the to-be-processed application according to the first resource restriction policy; or perform the to-be-processed application according to the second resource restriction policy. Resource limit processing.
  • the application processing module 808 is further configured to control the to-be-processed application to enter a frozen state.
  • the application processing module 808 is further configured to obtain a corresponding resource restriction level according to the card level, and control the to-be-processed application to enter the resource restriction level corresponding resource limitation state, where the resource is in the resource
  • the resource-occupying rate of the restricted-state application to the electronic device at runtime is less than the occupancy threshold.
  • each module in the above application processing device is for illustrative purposes only. In other embodiments, the application processing device may be divided into different modules as needed to complete all or part of the functions of the application processing device.
  • each module in the application processing apparatus may be in the form of a computer program.
  • the computer program can run on a terminal or server.
  • the program modules of the computer program can be stored on the memory of the terminal or server.
  • the operation of the method described in the embodiments of the present application is implemented when the computer program is executed by the processor.
  • the embodiment of the present application also provides a computer readable storage medium.
  • One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to execute the applications provided by the above embodiments Approach.
  • a computer program product comprising instructions which, when run on a computer, cause the computer to perform the application processing method provided by the above embodiments.
  • An embodiment of the present application also provides an electronic device. As shown in FIG. 9 , for the convenience of description, only the parts related to the embodiments of the present application are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present application.
  • the electronic device can be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an on-board computer, a wearable device, and the like, and the electronic device is used as a mobile phone. :
  • FIG. 9 is a block diagram showing a partial structure of a mobile phone related to an electronic device according to an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, and a processor 980.
  • RF radio frequency
  • the structure of the handset shown in FIG. 9 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
  • the RF circuit 910 can be used for receiving and transmitting signals during the transmission and reception of information or during a call.
  • the downlink information of the base station can be received and processed by the processor 980.
  • the uplink data can also be sent to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuitry 910 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General
  • the memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920.
  • the memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.);
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone.
  • memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 900.
  • the input unit 930 may include a touch panel 931 and other input devices 932.
  • the touch panel 931 also referred to as a touch screen, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 931 or near the touch panel 931. Operation) and drive the corresponding connection device according to a preset program.
  • the touch panel 931 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 980 is provided and can receive commands from the processor 980 and execute them.
  • the touch panel 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 930 may also include other input devices 932.
  • other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
  • the display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 940 can include a display panel 941.
  • the display panel 941 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 931 can cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, the touch panel 931 transmits to the processor 980 to determine the type of the touch event, and then the processor 980 is The type of touch event provides a corresponding visual output on display panel 941.
  • touch panel 931 and the display panel 941 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 9, in some embodiments, the touch panel 931 and the display panel 941 may be integrated. Realize the input and output functions of the phone.
  • the handset 900 can also include at least one type of sensor 950, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 and/or when the mobile phone moves to the ear. Or backlight.
  • the motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • Audio circuitry 960, speaker 961, and microphone 962 can provide an audio interface between the user and the handset.
  • the audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961, and convert it into a sound signal output by the speaker 961.
  • the microphone 962 converts the collected sound signal into an electrical signal, and the audio circuit 960 After receiving, it is converted into audio data, and after being processed by the audio data output processor 980, it can be sent to another mobile phone via the RF circuit 910, or the audio data can be output to the memory 920 for subsequent processing.
  • WiFi is a short-range wireless transmission technology
  • the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access.
  • FIG. 9 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone 900 and can be omitted as needed.
  • the processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing The phone's various functions and processing data, so that the overall monitoring of the phone.
  • processor 980 can include one or more processing units.
  • the processor 980 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, and the like; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 980.
  • the mobile phone 900 also includes a power source 990 (such as a battery) that supplies power to various components.
  • a power source 990 such as a battery
  • the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the handset 900 can also include a camera, a Bluetooth module, and the like.
  • the processor 980 included in the electronic device implements the operation of the application processing method provided by the foregoing embodiment when executing the computer program stored in the memory.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM), which acts as an external cache.
  • RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM dual data rate SDRAM
  • ESDRAM enhanced SDRAM
  • synchronization Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

Abstract

An application processing method, comprises: obtaining the number of dropped frames of the image frame when an electronic device outputs successive image frames (302); obtaining the stuttering level of a foreground application according to the number of dropped frames (304); obtaining, according to the foreground application, an application to be processed from a background application, and obtaining a resource limitation policy according to the stuttering level (306); and performing, according to the resource limitation policy, resource limitation on the application to be processed (308).

Description

应用程序处理方法、电子设备、计算机可读存储介质Application processing method, electronic device, computer readable storage medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年12月29日提交中国专利局、申请号为201711480554.6、发明名称为“应用程序处理方法和装置、电子设备、计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on Dec. 29, 2017, the Chinese Patent Application No. 201711480554.6, entitled "Application Processing Method and Apparatus, Electronic Apparatus, Computer Readable Storage Medium", all of which are The content is incorporated herein by reference.
技术领域Technical field
本申请涉及计算机技术领域,特别是涉及一种应用程序处理方法、电子设备、计算机可读存储介质。The present application relates to the field of computer technologies, and in particular, to an application processing method, an electronic device, and a computer readable storage medium.
背景技术Background technique
智能设备可以通过应用程序实现不同的应用操作,比如可以通过购物类应用程序购买商品、通过视频类应用程序查看视频等。应用程序可以被冻结,冻结后的应用程序无法再继续运行,不会占用智能设备中处理器资源。但是由于应用程序还是存在与智能设备中的,因此还会占用智能设备中的内存、硬件等资源。Smart devices can implement different application operations through applications, such as purchasing products through a shopping application, viewing videos through a video application, and the like. The application can be frozen, and the frozen application can no longer continue to run without taking up processor resources in the smart device. However, since the application still exists in the smart device, it also occupies resources such as memory and hardware in the smart device.
发明内容Summary of the invention
根据本申请的各种实施例,提供一种应用程序处理方法、电子设备、计算机可读存储介质。According to various embodiments of the present application, an application processing method, an electronic device, and a computer readable storage medium are provided.
一种应用程序处理方法,包括:An application processing method, including:
在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如下操作:An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following operations:
在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如下操作:A computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor to:
在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
上述应用程序处理方法、电子设备、计算机可读存储介质,当检测到电子设备输出的连续图像帧产生丢失时,获取图像帧的丢失帧数。根据丢失帧数判断前台应用程序的卡顿等级,并根据前台应用程序获取待处理应用程序。然后根据卡顿等级获取资源限制策略,根据获取的资源限制策略对待处理应用程序进行资源限制处理。这样可以在电子设备检测到卡顿的时候,通过资源限制处理回收后台应用程序占用的资源,以保证前台应用程序的 高效运行,提高应用程序的运行效率。The application processing method, the electronic device, and the computer readable storage medium acquire the lost frame number of the image frame when detecting that a continuous image frame output by the electronic device is lost. The rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application. Then, the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resource occupied by the background application is recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art.
图1为一个实施例中应用程序处理方法的应用环境示意图。FIG. 1 is a schematic diagram of an application environment of an application processing method in an embodiment.
图2为一个实施例中电子设备的内部结构示意图。2 is a schematic diagram showing the internal structure of an electronic device in an embodiment.
图3为一个实施例中应用程序处理方法的流程图。3 is a flow chart of an application processing method in one embodiment.
图4为另一个实施例中应用程序处理方法的流程图。4 is a flow chart of an application processing method in another embodiment.
图5为一个实施例中应用程序的资源限制状态的示意图。FIG. 5 is a schematic diagram of a resource restriction state of an application in an embodiment.
图6为一个实施例中电子设备的部分架构图。FIG. 6 is a partial structural diagram of an electronic device in an embodiment.
图7为一个实施例中应用程序处理装置的结构示意图。FIG. 7 is a schematic structural diagram of an application processing apparatus in an embodiment.
图8为另一个实施例中应用程序处理装置的结构示意图。FIG. 8 is a schematic structural diagram of an application processing apparatus in another embodiment.
图9为与本申请实施例提供的电子设备相关的手机的部分结构的框图。FIG. 9 is a block diagram showing a partial structure of a mobile phone related to an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。It will be understood that the terms "first", "second" and the like, as used herein, may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of the present application. Both the first client and the second client are clients, but they are not the same client.
图1为一个实施例中应用程序处理方法的应用环境示意图。如图1所示,该应用环境包括客户端102和服务器104。客户端102上可以安装应用程序,应用程序在客户端102的前台运行时可以输出联系图像帧。客户端102在输出连续图像帧时,获取图像帧的丢失帧数;根据丢失帧数获取前台应用程序的卡顿等级;根据前台应用程序从后台应用程序中获取待处理应用程序,并根据卡顿等级获取资源限制策略;根据资源限制策略将待处理应用程序进行资源限制处理。服务器104可以用于向客户端102推送应用程序处理算法,客户端102根据该应用程序处理算法对应用程序进行处理。其中,客户端102为处于计算机网络最外围,主要用于输入用户信息以及输出处理结果的电子设备,例如可以是个人电脑、移动终端、个人数字助理、可穿戴电子设备等。服务器104是用于响应服务请求,同时提供计算服务的设备,例如可以是一台或者多台计算机。可以理解的是,本申请提供的其他实施例中,应用程序处理方法的应用环境可以只包含客户端102。FIG. 1 is a schematic diagram of an application environment of an application processing method in an embodiment. As shown in FIG. 1, the application environment includes a client 102 and a server 104. An application can be installed on the client 102, and the application can output a contact image frame when the foreground of the client 102 is running. The client 102 acquires the number of lost frames of the image frame when outputting consecutive image frames; acquires the stuck level of the foreground application according to the number of lost frames; acquires the to-be-processed application from the background application according to the foreground application, and according to the The level obtains the resource restriction policy; the resource to be processed is restricted by the resource according to the resource restriction policy. The server 104 can be used to push an application processing algorithm to the client 102, and the client 102 processes the application according to the application processing algorithm. The client 102 is an electronic device that is mainly used for inputting user information and outputting processing results at the outermost periphery of the computer network, and may be, for example, a personal computer, a mobile terminal, a personal digital assistant, a wearable electronic device, or the like. The server 104 is a device for providing a computing service in response to a service request, and may be, for example, one or more computers. It can be understood that, in other embodiments provided by the present application, the application environment of the application processing method may only include the client 102.
如图2所示,提供了一种电子设备的内部结构示意图。该电子设备包括通过系统总线连接的处理器、存储器和显示屏。其中,该处理器用于提供计算和控制能力,支撑整个电子设备的运行。存储器用于存储数据、程序、和/或指令代码等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于电子设备的应用程序处理方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统和计算机程序。该计算机程序可被处理器所执行,以用于实现本申请各个实施例所 提供的一种应用程序处理方法。内存储器为非易失性存储介质中的操作系统和计算机程序提供高速缓存的运行环境。显示屏可以是触摸屏,比如为电容屏或电子屏,用于显示前台进程对应的应用的界面信息,还可以被用于检测作用于该显示屏的触摸操作,生成相应的指令,比如进行前后台应用的切换指令等。As shown in FIG. 2, a schematic diagram of an internal structure of an electronic device is provided. The electronic device includes a processor, memory, and display screen connected by a system bus. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory is used to store data, programs, and/or instruction codes, etc., and the memory stores at least one computer program, which can be executed by the processor to implement an application processing method suitable for an electronic device provided in the embodiments of the present application. . The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random storage memory (Random-Access-Memory, RAM). For example, in one embodiment, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by a processor for implementing an application processing method provided by various embodiments of the present application. The internal memory provides a cached operating environment for operating systems and computer programs in non-volatile storage media. The display screen can be a touch screen, such as a capacitive screen or an electronic screen, for displaying interface information of an application corresponding to the foreground process, and can also be used for detecting a touch operation acting on the display screen, and generating corresponding instructions, such as performing front and back Application switching instructions, etc.
本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。如该电子设备还包括通过系统总线连接的网络接口,网络接口可以是以太网卡或无线网卡等,用于与外部的电子设备进行通信,比如可用于同服务器进行通信。A person skilled in the art can understand that the structure shown in FIG. 2 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 on the electronic device to which the solution of the present application is applied. The specific electronic device may be It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements. For example, the electronic device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external electronic device, for example, for communicating with a server.
图3为一个实施例中应用程序处理方法的流程图。本实施例中的应用程序处理方法,以运行于图1中的终端或服务器上为例进行描述。如图3所示,该应用程序处理方法包括操作302至操作308。其中:3 is a flow chart of an application processing method in one embodiment. The application processing method in this embodiment is described by using the terminal or server running in FIG. 1 as an example. As shown in FIG. 3, the application processing method includes operations 302 through 308. among them:
操作302,在电子设备输出连续图像帧时,获取图像帧的丢失帧数。 Operation 302, when the electronic device outputs a continuous image frame, acquires the number of lost frames of the image frame.
应用程序(Application,APP)是指电子设备中针对某种应用目的所撰写的软体,电子设备可以通过应用程序实现对用户的需求服务。例如,用户可以通过游戏类应用程序玩游戏,也可以通过视频类应用程序看视频,还可以通过音乐类应用程序播放音乐等。应用程序可以根据运行的状态分为前台应用程序和后台应用程序。前台应用程序是指在电子设备的前台运行的应用程序,前台应用程序可以在与在前台显示并与用户实现交互。后台应用程序是指在电子设备的后台运行的应用程序,后台应用程序一般不能在前台显示并与用户实现交互过程。An application (Application) refers to a software written for an application purpose in an electronic device, and the electronic device can implement a service demanded by the user through an application. For example, users can play games through a game-like application, watch videos through a video-like application, and play music through a music-like application. Applications can be divided into foreground applications and background applications based on the state of the run. The foreground application refers to an application running in the foreground of the electronic device, and the foreground application can be displayed and interacted with the user in the foreground. A background application refers to an application that runs in the background of an electronic device. The background application generally cannot display and interact with the user in the foreground.
一般地,应用程序的应用操作是由一个或多个进程(process)来共同完成,进程是是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位。同时,一个进程可以对应一个或多个线程,线程是程序中一个单一的顺序控制流程,是进程内一个相对独立的、可调度的执行单元。进程可包括前台进程和后台进程,前台进程即为在电子设备前台运行的进程,后台进程即为在电子设备后台运行的进程。电子设备可以控制前台进程和后台进程的切换,前台进程可切换到后台运行,后台进程也可以切换到前台运行。具体地,可以通过进程池来实现对进程的管理,进程池中可以存放一个或多个进程对应的进程标识。进程标识用于唯一标示一个进程。进程池可以包括前台进程池和后台进程池,前台进程池中包括前台进程对应的进程标识,后台进程池中包括后台进程对应的进程标识。当检测到前台进程和后台进程的运行状态发生改变时,进程池会相应地添加或删除产生变化的进程标识。例如,进程A的进程标识为“0123”,当检测到进程A由后台进程变成前台进程时,可将该进程A的进程标识“0123”从后台进程池中移除,并添加到前台进程池中。Generally, the application operation of the application is completed by one or more processes. The process is a running activity of the program in the computer on a certain data set, and is a basic unit for the system to perform resource allocation and scheduling. At the same time, a process can correspond to one or more threads. A thread is a single sequential control process in a program, and is a relatively independent, schedulable execution unit within a process. The process may include a foreground process and a background process, and the foreground process is a process running in the foreground of the electronic device, and the background process is a process running in the background of the electronic device. The electronic device can control the switching between the foreground process and the background process, and the foreground process can switch to the background operation, and the background process can also switch to the foreground operation. Specifically, the process can be managed by the process pool, and the process identifier corresponding to one or more processes can be stored in the process pool. The process ID is used to uniquely identify a process. The process pool may include a foreground process pool and a background process pool. The foreground process pool includes a process identifier corresponding to the foreground process, and the background process pool includes a process identifier corresponding to the background process. When it is detected that the running status of the foreground process and the background process changes, the process pool will add or delete the process ID that changes accordingly. For example, the process ID of process A is “0123”. When it is detected that process A changes from the background process to the foreground process, the process ID “0123” of process A can be removed from the background process pool and added to the foreground process. In the pool.
前台应用程序在运行时,前台应用程序的文件会在电子设备的输出装置上进行显示,用户可以通过输入装置和输出装置与电子设备实现交互。例如,电子设备在进行视频播放或者进入游戏界面时,可以在输出装置中显示图像。为了体现播放的连续性,输出装置中往往会播放一个连续的图像帧序列,图像帧序列中的图像形成一个连续的动画。按一定的时间间隔将该图像帧序列进行播放,就会形成一个连续的动画界面,其中图像帧序列中的每一张图像可以称为一图像帧。前台应用程序在输出装置中显示连续的图像帧序列的时候,都是定时并按图像帧序列的顺序去播放每一个图像帧的。因此,在正常情况下,一定时间内会播放固定数量的图像帧,如果在某段时间内播放的图像帧的数量少于预定数量,则说明此时为非正常播放。丢失帧数即为电子设备在输出连续图像帧时所丢失的图像帧的数量。例如,待播放的连续图像帧数量为10帧,实际只播放了7帧,则图像帧的丢失帧数就为3帧。When the foreground application is running, the files of the foreground application are displayed on the output device of the electronic device, and the user can interact with the electronic device through the input device and the output device. For example, an electronic device can display an image in an output device while playing video or entering a game interface. In order to reflect the continuity of playback, a continuous sequence of image frames is often played in the output device, and the images in the sequence of image frames form a continuous animation. By playing the sequence of image frames at regular intervals, a continuous animation interface is formed, wherein each image in the sequence of image frames can be referred to as an image frame. When the foreground application displays a sequence of consecutive image frames in the output device, it plays timing and plays each image frame in the order of the sequence of image frames. Therefore, under normal circumstances, a fixed number of image frames will be played for a certain period of time. If the number of image frames played during a certain period of time is less than the predetermined number, it means that the playback is abnormal. The number of lost frames is the number of image frames lost by the electronic device when outputting consecutive image frames. For example, if the number of consecutive image frames to be played is 10 frames, and only 7 frames are actually played, the number of lost frames of the image frame is 3 frames.
操作304,根据丢失帧数获取前台应用程序的卡顿等级。 Operation 304, obtaining a Karton level of the foreground application according to the number of lost frames.
前台应用程序在通过电子设备输出连续图像帧的时候,一般会由于电子设备的网络、CPU(Central Processing Unit,中央处理器)等资源的占用率过高,而导致输出的连续帧图像产生丢失。当播放的连续图像帧产生了丢失时,可以判定该前台应用程序在电子设备中的运行产生了卡顿。卡顿等级即为表示前台应用程序卡顿的严重程度,图像帧的丢失帧数越多,说明前台应用程序越卡顿,卡顿等级越高。预先建立丢失帧数与卡顿等级的对应关系,然后根据获取的丢失帧数获取对应的卡顿等级。例如,卡顿等级可以分为重度卡顿、普通卡顿和轻度卡顿,假设连续图像帧总共包括20帧图像,则可以建立丢失帧数与卡顿等级的对应关系。丢失帧数的取值为[0,5]、[5,15]、[15,20]时,分别对应轻度卡顿、普通卡顿和重度卡顿等三个卡顿等级。When the foreground application outputs a continuous image frame through an electronic device, the occupancy rate of the outputted continuous frame image is generally lost due to the high occupancy rate of resources such as the network of the electronic device and the CPU (Central Processing Unit). When a continuous image frame of the playback is lost, it can be determined that the operation of the foreground application in the electronic device has caused a jam. The Carton level is the severity of the front-end application jam. The more frames that are lost in the image frame, the more the foreground application is stuck and the higher the card level. Corresponding relationship between the number of lost frames and the Karton level is established in advance, and then the corresponding card level is obtained according to the obtained number of lost frames. For example, the Carton level can be divided into a heavy card, a normal card, and a light carton. Assuming that the continuous image frame includes a total of 20 frames, the correspondence between the number of lost frames and the Karton level can be established. When the number of lost frames is [0, 5], [5, 15], [15, 20], it corresponds to three levels of light, such as light, common, and heavy.
操作306,根据前台应用程序从后台应用程序中获取待处理应用程序,并根据卡顿等级获取资源限制策略。 Operation 306, obtaining a to-be-processed application from the background application according to the foreground application, and obtaining a resource restriction policy according to the Karton level.
待处理应用程序是指需要进行资源限制处理的应用程序。可以理解的是,电子设备中运行的应用程序可以分为前台应用程序和后台应用程序,当前台应用程序产生卡顿的时候,说明电子设备的资源比较紧张。则可以对后台应用程序所占用的资源进行控制,以将电子设备中更多的资源用于前台应用程序的运行。获取待处理应用程序具体可以包括:获取前台应用程序的前台应用优先级;获取应用优先级低于该前台应用优先级的后台应用程序,作为待处理应用程序。应用优先级用于表示应用程序的重要程度。例如,可以定义系统应用程序的应用优先级高于第三方应用程序的应用优先级,或者根据应用程序的类型来定义应用优先级,即时通讯类应用程序的应用优先级高于游戏类应用程序。用户或系统可以自定义应用优先级,在本实施例中不进行具体限定。A pending application is an application that requires resource throttling. It can be understood that the application running in the electronic device can be divided into a foreground application and a background application. When the current application generates a jam, the resources of the electronic device are relatively tight. The resources occupied by the background application can be controlled to use more resources in the electronic device for the running of the foreground application. The obtaining the to-be-processed application may include: obtaining a foreground application priority of the foreground application; and acquiring a background application whose application priority is lower than the foreground application priority, as the to-be-processed application. Application priority is used to indicate the importance of the application. For example, the application priority of the system application can be defined to be higher than the application priority of the third-party application, or the application priority can be defined according to the type of the application, and the application priority of the instant messaging application is higher than that of the game application. The user or the system can customize the application priority, which is not specifically limited in this embodiment.
资源限制策略是指用于对待处理应用程序进行资源限制处理的策略,预先建立卡顿等级和资源限制策略的对应关系,然后根据卡顿等级获取对应的资源限制策略。例如,卡顿等级为重度卡顿时,将待处理应用程序进行冻结;卡顿等级为轻度卡顿时,对待处理应用程序所占用的资源进行回收。The resource restriction policy refers to a policy for processing resource restriction processing on an application, pre-establishes a correspondence between a card level and a resource restriction policy, and then acquires a corresponding resource restriction policy according to the card level. For example, when the Karton level is severely stuck, the application to be processed is frozen; when the Karton level is lightly stuck, the resources occupied by the application to be processed are recycled.
操作308,根据资源限制策略将待处理应用程序进行资源限制处理。 Operation 308, the resource to be processed is subjected to resource limitation processing according to the resource restriction policy.
资源是指电子设备在处理应用事件时所必须用到的软件或硬件资源,比如电子设备的CPU、内存(Memory)、硬件、网络资源、IO(Input-Output,输入输出)等。资源限制处理是指对应用程序占用的资源进行限制的处理。资源限制处理可以但不限于是控制应用程序进入冻结状态或资源限制状态,处于冻结状态的应用程序没有被关闭,只是暂时不运行。当应用程序处于冻结状态时,应用程序不占用处理器资源,但是仍然占用电子设备的内存和硬件等资源。资源限制状态是指对应用程序在运行时使用的电子设备的资源进行限制的状态,例如控制应用程序在运行时使用的CPU占用率不能超过5%。根据资源限制策略将待处理应用程序进行资源限制处理,可以限制后台待处理应用程序对电子设备资源的消耗。A resource is a software or hardware resource that an electronic device must use to process an application event, such as an CPU, memory, hardware, network resources, and IO (Input-Output) of an electronic device. Resource limit processing refers to the process of restricting the resources occupied by the application. The resource limit processing can be, but is not limited to, controlling the application to enter a frozen state or a resource restricted state, and the application in the frozen state is not closed, but is not temporarily running. When the application is frozen, the application does not consume processor resources, but still occupies resources such as memory and hardware of the electronic device. The resource limit state refers to the state in which the resources of the electronic device used by the application at runtime are restricted. For example, the CPU usage of the control application at runtime cannot exceed 5%. The resource limiting process is performed on the to-be-processed application according to the resource restriction policy, which can limit the consumption of the electronic device resources by the background pending application.
上述实施例应用程序处理方法,当检测到电子设备输出的连续图像帧产生丢失时,获取图像帧的丢失帧数。根据丢失帧数判断前台应用程序的卡顿等级,并根据前台应用程序获取待处理应用程序。然后根据卡顿等级获取资源限制策略,根据获取的资源限制策略对待处理应用程序进行资源限制处理。这样可以在电子设备检测到卡顿的时候,通过资源限制处理回收后台应用程序占用的资源,以保证前台应用程序的高效运行,提高应用程序的运行效率。In the above embodiment, the application processing method acquires the number of lost frames of the image frame when it is detected that the continuous image frame outputted by the electronic device is lost. The rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application. Then, the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resources occupied by the background application are recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application.
图4为另一个实施例中应用程序处理方法的流程图。本实施例中的应用程序处理方法,以运行于图1中的终端或服务器上为例进行描述。如图4所示,该应用程序处理方法包括操作402至操作416。其中:4 is a flow chart of an application processing method in another embodiment. The application processing method in this embodiment is described by using the terminal or server running in FIG. 1 as an example. As shown in FIG. 4, the application processing method includes operations 402 through 416. among them:
操作402,在电子设备输出连续图像帧时,获取图像帧的丢失帧数。 Operation 402, when the electronic device outputs a continuous image frame, acquires the number of lost frames of the image frame.
在一个实施例中,可以获取图像帧的连续丢失帧数,然后根据连续丢失帧数获取前台应用程序的卡顿等级。连续丢失帧数是指在实际运行过程中,前台应用程序在输出显示时的连续丢失的图像帧的数量。前台应用程序在电子设备中输出的连续图像帧是按照一定的规律排列好的,所谓的连续丢失,就是不间断的丢失,也即图像帧连续丢失的数量。电子设备中播放的连续图像帧是通过图像帧标识进行标记并按照一定的顺序进行排列的,电子设备获取实际输出的图像帧对应的图像帧标识,就可以知道哪些图像帧在输出时产生了丢失。例如,电子设备播放的连续图像帧包括10个图像帧,从第一个图像帧到最后一个图像帧对应的图像帧标识分别为“01”、“02”....“10”。假设电子设备输出连续图像帧时,实际输出的图像帧序列为“01”→“02”→“03”→“07”→“08”→“09”→“10”,则可以判断电子设备输出连续图像帧时,丢失的图像帧为“04”、“05”、“06”,由于“04”、“05”、“06”为连续的图像帧,因此获取的图像帧的连续丢失帧数就为3帧。In one embodiment, the number of consecutive lost frames of the image frame may be acquired, and then the stuck level of the foreground application is obtained based on the number of consecutive lost frames. The number of consecutive lost frames refers to the number of consecutive lost image frames when the foreground application outputs the display during actual operation. The continuous image frames output by the foreground application in the electronic device are arranged according to a certain regularity. The so-called continuous loss is the uninterrupted loss, that is, the number of consecutive loss of image frames. The continuous image frames played in the electronic device are marked by the image frame identifier and arranged in a certain order. The electronic device obtains the image frame identifier corresponding to the actually output image frame, and can know which image frames are lost when outputting. . For example, the continuous image frame played by the electronic device includes 10 image frames, and the image frame identifiers corresponding to the first image frame to the last image frame are “01”, “02”, . . . “10”, respectively. Assuming that the electronic device outputs a continuous image frame, the actual output image frame sequence is "01" → "02" → "03" → "07" → "08" → "09" → "10", then the electronic device output can be judged. In the case of consecutive image frames, the lost image frames are "04", "05", "06", and since "04", "05", and "06" are consecutive image frames, the number of consecutive lost frames of the acquired image frames It is 3 frames.
可以理解的是,由于电子设备在输出连续图像帧的过程中,会断断续续地丢失图像帧,那么电子设备可以获取每一个连续丢失帧数,并获取最大连续丢失帧数,根据最大连续丢失帧数获取卡顿等级。例如,电子设备输出图像帧标识为“01”、“02”....“10”的连续图像帧,实际输出的图像帧序列为“01”→“02”→“03”→“07”→“10”,则可以判断电子设备输出连续图像帧时,丢失的图像帧为“04”、“05”、“06”、“08”、“09”。其中,“04”、“05”、“06”为连续的图像帧,“08”、“09”为连续的图像帧,“04”、“05”、“06”对应的连续丢失帧数为3帧,“08”、“09”对应的连续丢失帧数为2帧,因此获取的最大连续丢失帧数就为3帧。电子设备在播放过程中可以将最大连续丢失帧数不断地进行更新。It can be understood that, since the electronic device intermittently loses the image frame during the process of outputting the continuous image frame, the electronic device can acquire the number of consecutive consecutive lost frames and obtain the maximum consecutive lost frames according to the maximum consecutive lost frames. Get the Carton level. For example, the electronic device outputs consecutive image frames whose image frame identifiers are “01”, “02”, . . . “10”, and the actual output image frame sequence is “01”→“02”→“03”→“07” → “10”, it can be judged that when the electronic device outputs continuous image frames, the lost image frames are “04”, “05”, “06”, “08”, “09”. Among them, “04”, “05” and “06” are consecutive image frames, “08” and “09” are consecutive image frames, and the consecutive lost frames corresponding to “04”, “05” and “06” are In 3 frames, the number of consecutive lost frames corresponding to "08" and "09" is 2 frames, so the maximum number of consecutive lost frames acquired is 3 frames. The electronic device can continuously update the maximum number of consecutive lost frames during playback.
在一个实施例中,还可以将电子设备输出的连续图像帧划分为预设个数的图像帧序列,然后在电子设备输出连续图像帧时,统计每个图像帧序列中的图像帧的丢失帧数,并从获取的丢失帧数中获取最大丢失帧数;根据最大丢失帧数获取前台应用程序的卡顿等级。例如,需要输出图像帧标识为“01”、“02”....“18”的连续图像帧,将该连续图像帧划分为“01”、“02”....“06”,“07”、“08”....“12”和“13”、“14”....“18”三个图像帧序列,在电子设备输出连续图像帧时,分别统计每一个图像帧序列对应的图像帧的丢失帧数,并从获取的丢失帧数中获取最大丢失帧数。可以理解的是,在电子设备输出连续图像帧时,每完整输出一个图像帧序列,就会产生一个对应的丢失帧数。因此,在输出连续图像帧的过程中,最大丢失帧数是不断进行更新的。In an embodiment, the continuous image frame outputted by the electronic device may be further divided into a preset number of image frame sequences, and then the lost frame of the image frame in each image frame sequence is counted when the electronic device outputs the continuous image frame. Number, and obtain the maximum number of lost frames from the number of lost frames obtained; obtain the Karten level of the foreground application according to the maximum number of lost frames. For example, it is necessary to output consecutive image frames whose image frame identifiers are “01”, “02”, . . . “18”, and divide the continuous image frame into “01”, “02”, . . . “06”, “ 07", "08"...."12" and "13", "14".."18" three image frame sequences, each electronic image frame sequence is counted when the electronic device outputs continuous image frames. The number of lost frames of the corresponding image frame, and the maximum number of lost frames is obtained from the number of lost frames obtained. It can be understood that when the electronic device outputs a continuous image frame, each complete output of one image frame sequence generates a corresponding number of lost frames. Therefore, during the process of outputting consecutive image frames, the maximum number of lost frames is continuously updated.
操作404,确定丢失帧数所落入的目标帧数区间,并根据目标帧数区间获取前台应用程序的卡顿等级。 Operation 404, determining a target frame number interval in which the number of lost frames falls, and obtaining a carton level of the foreground application according to the target frame number interval.
预先将丢失帧数划分为两个或两个以上的帧数区间,然后建立每个帧数区间与卡顿等级的对应关系。在获取到丢失帧数的时候,获取丢失帧数所落入的目标帧数区间,然后根据目标帧数区间获取对应的卡顿等级。可以理解的是,划分的帧数区间可以根据连续图像帧的总数量进行设置。例如,可以根据连续图像帧的总数量的百分比设置帧数区间,比如将丢失帧数划分为4个帧数区间,可根据总数量的百分比0~25%、25%~50%、50%~75%和75%~100%计算帧数区间。The number of lost frames is divided into two or more frame number intervals in advance, and then the correspondence relationship between each frame number interval and the Karton level is established. When the number of lost frames is obtained, the target frame number range in which the number of lost frames falls is obtained, and then the corresponding card level is obtained according to the target frame number interval. It can be understood that the divided frame number interval can be set according to the total number of consecutive image frames. For example, the frame number interval may be set according to the percentage of the total number of consecutive image frames, for example, the number of lost frames is divided into 4 frame number intervals, which may be 0 to 25%, 25% to 50%, 50% according to the total number. 75% and 75% to 100% calculate the frame number interval.
操作406,从后台应用程序中获取被前台应用程序依赖的依赖应用程序,并获取除依赖应用程序之外的后台应用程序作为待处理应用程序。Operation 406: Obtain a dependent application that is dependent on the foreground application from the background application, and obtain a background application other than the dependent application as the to-be-processed application.
在一个实施例中,依赖表示一个应用程序需要利用于另一个或多个应用程序的数据才能顺利实现对该一个应用程序的执行的关系。存在依赖关系的两个应用程序,分别为被依赖的应用程序和依赖的应用程序。举例来说,应用程序A依赖于应用程序B,或应用程序B被应用程序A依赖,即表示应用程序A需要利用应用程序B的数据才能实现对该应用程序A的执行,此时,应用程序A即为依赖于应用程序B的应用程序,应用程序B即为被应用程序A依赖的应用程序。具体地,在本申请实施例中,依赖应用程序就是指被前台应 用程序依赖的后台应用程序。In one embodiment, relying on data that indicates that one application needs to utilize one or more applications can successfully implement the relationship to the execution of that one application. There are two applications with dependencies, namely the dependent application and the dependent application. For example, the application A depends on the application B, or the application B is dependent on the application A, that is, the application A needs to utilize the data of the application B to implement the execution of the application A. At this time, the application A is an application that depends on application B, and application B is an application that is dependent on application A. Specifically, in the embodiment of the present application, the dependent application refers to a background application that is relied upon by the foreground application.
应用程序之间的依赖关系并非一直不变的,而是实时变化的。电子设备可将应用程序之间的依赖关系进行记录。具体地,两个应用程序之间的相互依赖是建立在它们需要互相通信的基础之上的。因此,获取前台应用程序对应的依赖应用程序包括:获取与所述前台应用程序之间存在通信关系的后台应用程序,作为依赖应用程序。The dependencies between applications are not constant, but change in real time. Electronic devices can record dependencies between applications. Specifically, the interdependencies between two applications are based on the fact that they need to communicate with each other. Therefore, obtaining the dependent application corresponding to the foreground application comprises: obtaining a background application having a communication relationship with the foreground application as a dependent application.
在操作系统中,是通过定义通信机制来建立应用程序之间的通信关系的。其中,通信机制包括Socket、Binder、共享内存等。Binder通信是Android系统中实现的一种高效的IPC(Inter-Process Communication,应用程序间通信)机制,是一种client-server(客户端-服务器)的通信结构。客户端与服务器会定义一个对应的代理接口,客户端调用代理接口中的方法时,代理接口的方法会将客户端的参数打包成一个Parcel对象,然后代理接口将Parcel对象发送给内核层中的Binder驱动。服务器可以读取Binder驱动中的请求数据,然后将Parcel对象进行解析并处理,并将处理结果返回。Socket通信可以对两个网络应用程序进行通信连接,从而实现网络上的应用程序的数据交换。具体地,本地应用程序间通信可以通过PID(Process Identity,应用程序标识)来唯一标识一个应用程序,但是在网络应用程序间通信是没有办法实现的。而在网络通信中IP(Internet Protocol,网络之间互连的协议)地址可以唯一标识网络中的主机,“协议+端口”可以唯一标识主机中的应用程序,因此在Socket通信中通常是通过“IP地址+协议+端口”的形式来唯一标识一个应用程序的。共享内存就是允许两个不相关的应用程序访问同一个逻辑内存,共享内存是在两个正在运行的应用程序之间共享和传递数据的一种非常有效的方式,不同应用程序之间共享的内存通常安排为同一段物理内存。In the operating system, the communication relationship between applications is established by defining a communication mechanism. Among them, the communication mechanism includes Socket, Binder, shared memory and so on. Binder communication is an efficient IPC (Inter-Process Communication) mechanism implemented in the Android system. It is a client-server (client-server) communication structure. The client and the server define a corresponding proxy interface. When the client invokes the method in the proxy interface, the proxy interface method packages the client parameters into a Parcel object, and then the proxy interface sends the Parcel object to the Binder in the kernel layer. drive. The server can read the request data in the Binder driver, then parse and process the Parcel object, and return the processing result. Socket communication allows communication between two network applications to enable data exchange between applications on the network. Specifically, local inter-application communication can uniquely identify an application through PID (Process Identity), but there is no way to communicate between network applications. In the network communication, the IP (Internet Protocol) protocol can uniquely identify the host in the network. The "protocol + port" can uniquely identify the application in the host, so in the Socket communication, it is usually passed. IP address + protocol + port" form to uniquely identify an application. Shared memory allows two unrelated applications to access the same logical memory. Shared memory is a very efficient way to share and transfer data between two running applications. Memory shared between different applications. Usually arranged as the same piece of physical memory.
可选地,获取前台应用程序对应的依赖应用程序包括以下方式中至少一种:获取与前台应用程序具有socket通信关系的后台应用程序,作为依赖应用程序;获取与前台应用程序具有binder通信关系的后台应用程序,作为依赖应用程序;获取与前台应用程序之间进行内存共享的后台应用程序,作为依赖应用程序。Optionally, obtaining the dependent application corresponding to the foreground application includes at least one of the following methods: acquiring a background application having a socket communication relationship with the foreground application as a dependent application; acquiring a binder communication relationship with the foreground application. A background application, as a dependent application; a background application that shares memory with the foreground application as a dependent application.
操作408,当卡顿等级大于等级阈值时,获取第一资源限制策略。 Operation 408, when the Karton level is greater than the level threshold, acquiring the first resource restriction policy.
根据前台应用程序的卡顿等级获取资源限制策略,并根据资源限制策略对待处理应用程序进行资源限制处理。资源限制策略可分为第一资源限制策略和第二资源限制策略,第一资源限制策略是指根据卡顿等级控制待处理应用程序进入冻结状态的策略,第二资源限制策略是指根据卡顿等级控制待处理应用程序进入资源限制状态的策略。The resource restriction policy is obtained according to the Karton level of the foreground application, and the resource restriction processing is performed on the application to be processed according to the resource restriction policy. The resource restriction policy may be divided into a first resource restriction policy and a second resource restriction policy. The first resource restriction policy refers to a policy for controlling a pending application to enter a frozen state according to a Carton level, and the second resource restriction policy refers to a The level controls the policy that the pending application enters the resource limit state.
操作410,当卡顿等级小于或等于等级阈值时,获取第二资源限制策略。Operation 410: Acquire a second resource restriction policy when the Carton level is less than or equal to the level threshold.
在一个实施例中,当卡顿等级大于等级阈值时,说明前台应用程序的运行卡顿比较严重,则可以将获取的待处理应用程序进行冻结。冻结之后的待处理应用程序无法在继续运行,也不占用CPU资源。当卡顿等级小于或等于等级阈值时,说明前台应用程序的运行卡顿程度较轻,则可以保持待处理应用程序的运行状态,在待处理应用程序的运行过程中,限制待处理应用程序所占用的资源。In one embodiment, when the Karton level is greater than the level threshold, indicating that the running application of the foreground application is relatively serious, the acquired pending application may be frozen. The pending application after freezing cannot continue to run and does not consume CPU resources. When the Karton level is less than or equal to the level threshold, it indicates that the running of the foreground application is lighter, and the running state of the to-be-processed application can be maintained, and the pending application is restricted during the running process of the to-be-processed application. Occupied resources.
操作412,根据第一资源限制策略将待处理应用程序进行资源限制处理;或根据第二资源限制策略将待处理应用程序进行资源限制处理。In operation 412, the to-be-processed application is subjected to resource limitation processing according to the first resource restriction policy; or the to-be-processed application is subjected to resource limitation processing according to the second resource restriction policy.
在本申请提供的实施例中,根据第一资源限制策略将待处理应用程序进行资源限制处理包括:控制待处理应用程序进入冻结状态。进入冻结状态的待处理应用程序,无法再继续运行,这样可以减少待处理应用程序对电子设备的资源占用。冻结后的待处理应用程序还可以被唤醒,用户或系统可以对唤醒的条件进行设置。In the embodiment provided by the present application, the resource limiting processing of the to-be-processed application according to the first resource restriction policy includes: controlling the to-be-processed application to enter a frozen state. The pending application that enters the frozen state can no longer continue to run, which can reduce the resource consumption of the electronic device by the pending application. The frozen pending application can also be woken up, and the user or system can set the conditions for the wakeup.
以Android系统中,实现应用程序的冻结和唤醒的方法有多种。以其中一种为例,可以通过pm(package manager,包管理)命令来实现,在pm命令中,可以通过冻结命令pm disable[–user USER_ID]PACKAGE_OR_COMPONENT将应用程序设置为冻结状态,然后还可以通过解冻命令pm enable[–user USER_ID]PACKAGE_OR_COMPONENT将处于冻 结状态的应用程序进行唤醒,通过冻结列表查询命令pm list packages–d获取处于冻结状态的应用程序列表,以查看处于冻结状态的应用程序。可以理解的是,本申请中以Android操作系统为例对应用程序处理方法进行说明,但是本申请的应用程序处理方法并不仅限于在Android系统中实现,还可以应用在IOS(IPhone Operating System)、塞班、Windows、MAC OS(Macintosh Operating System)等操作系统中。In the Android system, there are various ways to implement application freezing and wake-up. For example, one can be implemented by the pm (package manager) command. In the pm command, the application can be set to a frozen state by the freeze command pm disable[–user USER_ID]PACKAGE_OR_COMPONENT, and then passed. The defrosting command pm enable[–user USER_ID]PACKAGE_OR_COMPONENT wakes up the application in the frozen state, and obtains the list of applications in the frozen state by freezing the list query command pm list packages–d to view the frozen application. It can be understood that the application processing method is described by taking the Android operating system as an example in the present application, but the application processing method of the present application is not limited to being implemented in the Android system, and can also be applied to the IOS (IPhone Operating System), In operating systems such as Symbian, Windows, and MAC OS (Macintosh Operating System).
在一个实施例中,根据第二资源限制策略对待处理应用程序进行资源限制处理包括:根据卡顿等级获取对应的资源限制级别,控制待处理应用程序进入资源限制级别对应资源限制状态,其中,处于资源限制状态的应用程序在运行时对电子设备的资源占用率小于占用率阈值。当待处理应用程序处于资源限制状态时,待处理应用程序对电子设备的资源占用率就不能超过占用率阈值,这样可以控制待处理应用程序对电子设备的资源占用,降低后台对资源的占用,提高前台的运行效率。例如,控制待处理应用程序在运行时的CPU占用率不能超过5%,以减少待处理应用程序对CPU的过度消耗,降低用户对手机的依赖。在手机系统中可以通过cgroups(control groups,控制组)来控制待处理应用程序的CPU、内存、IO等资源占用率,即控制所获取的待处理应用程序进入资源限制状态。In an embodiment, the resource limiting process to be processed by the application according to the second resource restriction policy includes: obtaining a corresponding resource restriction level according to the Carton level, and controlling the to-be-processed application to enter a resource restriction level corresponding resource limitation state, where The resource-restricted state application has a resource occupancy rate for the electronic device at runtime that is less than the occupancy threshold. When the to-be-processed application is in the resource-restricted state, the resource usage rate of the electronic device to be processed cannot exceed the occupancy threshold. This can control the resource usage of the electronic device by the application to be processed, and reduce the occupation of resources by the background. Improve the efficiency of the front desk. For example, controlling the CPU usage of the pending application at runtime should not exceed 5% to reduce the excessive consumption of the CPU by the application to be processed and reduce the user's dependence on the mobile phone. In the mobile phone system, cgroups (control groups) can be used to control the CPU usage, such as CPU, memory, and IO of the application to be processed, that is, the acquired application to be processed enters the resource limitation state.
资源限制级别用于表示对应用程序的资源限制程度,预先建立卡顿等级与资源限制级别的对应关系。当卡顿等级小于或等于等级阈值时,根据卡顿等级获取对应的资源限制级别。例如,卡顿等级可以分为1级、2级、3级、4级等四个等级,从1级到4级卡顿程度递增。等级阈值可以为3级,当卡顿等级小于或等于3级的时候,根据卡顿等级获取对应的资源限制级别。资源限制级别可分为轻度资源限制级别、普通资源限制级别和深度资源限制级别等三个等级,对应的卡顿等级分别为1级、2级、3级,不同的资源限制级别对应的占用率阈值不同。可以理解的是,还可以将不同资源对应的占用率阈值设置为不同。比如,CPU占用率阈值可以为5%,内存占用率阈值可以为10%。The resource restriction level is used to indicate the degree of resource limitation to the application, and the correspondence between the carton level and the resource restriction level is established in advance. When the Karton level is less than or equal to the level threshold, the corresponding resource restriction level is obtained according to the Karton level. For example, the Carton level can be divided into four levels: Level 1, Level 2, Level 3, Level 4, etc., and the degree of Carton increases from Level 1 to Level 4. The level threshold may be level 3. When the level of the card is less than or equal to level 3, the corresponding resource restriction level is obtained according to the level of the card. The resource limit level can be divided into three levels: the light resource limit level, the common resource limit level, and the deep resource limit level. The corresponding card level is level 1, level 2, level 3, and the corresponding resource limit level is occupied. The rate threshold is different. It can be understood that the occupancy thresholds corresponding to different resources can also be set to be different. For example, the CPU usage threshold can be 5%, and the memory usage threshold can be 10%.
操作414,当检测到前台应用程序切换到后台时,开始计时。 Operation 414, when it is detected that the foreground application switches to the background, starts timing.
在对待处理应用程序进行资源限制处理之后,电子设备可以对前台应用程序进行监控。当前台应用程序切换到后台时,电子设备启动计时器,然后通过计时器开始计时。电子设备建立的计时器可以与前台应用程序建立对应关系,当前台应用程序切换到后台时,启动计时器开始计时。具体地,预先建立前台应用程序的前台应用标识与计时器的计时标识的对应关系,通过前台应用标识对应的计时标识查找并启动计时器开始计时。以Android系统为例,系统可以预先定义一个计时器,当检测到前台应用程序切换到后台时,前台应用标识查找对应的计时器,并通过timer.setBase(SystemClock.elapsedRealtime())将计时器清零,然后通过timer.start()函数启动计时器,开始计时。After the resource restriction processing is performed on the application to be processed, the electronic device can monitor the foreground application. When the current application switches to the background, the electronic device starts the timer and then starts counting through the timer. The timer established by the electronic device can be associated with the foreground application, and when the current application switches to the background, the start timer starts counting. Specifically, the correspondence between the foreground application identifier of the foreground application and the timing identifier of the timer is established in advance, and the timer is searched for and started by the timer identifier corresponding to the foreground application identifier. Taking the Android system as an example, the system can predefine a timer. When it detects that the foreground application switches to the background, the foreground application identifier searches for the corresponding timer, and clears the timer by timer.setBase(SystemClock.elapsedRealtime()). Zero, then start the timer through the timer.start() function and start timing.
操作416,当计时时长超过时长阈值时,控制待处理应用程序恢复到正常运行状态。At operation 416, when the timing duration exceeds the duration threshold, the pending application is controlled to return to the normal operating state.
当计时时长超过时长阈值时,将待处理应用程序恢复到正常运行状态。具体地,当待处理应用程序处于资源限制状态时,解除电子设备对待处理应用程序的资源限制。当待处理应用程序处于冻结状态时,将待处理应用程序从冻结状态中唤醒。恢复到正常运行状态后,待处理应用程序对电子设备资源的使用不再受到限制。另外,当检测到将待处理应用程序从后台切换到前台的切换指令时,则控制待处理应用程序恢复到正常运行状态。这样可以保证待处理应用程序能够及时处理电子设备的指令,提高电子设备的运行效率。When the timing duration exceeds the duration threshold, the pending application is restored to normal operation. Specifically, when the to-be-processed application is in the resource-restricted state, the resource limitation of the electronic device to be processed by the application is released. The pending application wakes up from a frozen state when the pending application is frozen. After returning to normal operation, the pending application's use of electronic device resources is no longer restricted. In addition, when a switching instruction to switch the application to be processed from the background to the foreground is detected, the pending application is controlled to return to the normal operating state. This ensures that the pending application can process the instructions of the electronic device in time and improve the operating efficiency of the electronic device.
图5为一个实施例中应用程序的资源限制状态的示意图。如图5所示,电子设备的资源包括CPU、内存、IO、网络资源等,应用程序的状态可以分为正常运行状态、资源限制状态和冻结状态。其中,资源限制状态又可以分为轻度资源限制状态、普通资源限制状态和深度资源限制状态。在不同资源限制状态下,对应的可用资源502和不可用资源504不相同。从轻度资源限制状态、普通资源限制状态到深度资源限制状态,可用资源502递减。在正常运行状态下,应用程序的可用资源502为100%。FIG. 5 is a schematic diagram of a resource restriction state of an application in an embodiment. As shown in FIG. 5, the resources of the electronic device include a CPU, a memory, an IO, a network resource, and the like, and the state of the application may be classified into a normal running state, a resource limiting state, and a frozen state. The resource restriction state may be further divided into a light resource restriction state, a normal resource restriction state, and a deep resource restriction state. In different resource limitation states, the corresponding available resource 502 and the unavailable resource 504 are different. From the light resource limit state, the normal resource limit state to the deep resource limit state, the available resource 502 is decremented. In normal operation, the application's available resource 502 is 100%.
上述实施例应用程序处理方法,当检测到电子设备输出的连续图像帧产生丢失时, 获取图像帧的丢失帧数。根据丢失帧数判断前台应用程序的卡顿等级,并根据前台应用程序获取待处理应用程序。然后根据卡顿等级获取资源限制策略,根据获取的资源限制策略对待处理应用程序进行资源限制处理。这样可以在电子设备检测到卡顿的时候,通过资源限制处理回收后台应用程序占用的资源,以保证前台应用程序的高效运行,提高应用程序的运行效率。当前台应用程序切换到后台的时长超过时长阈值,则恢复待处理应用程序的正常运行状态,这样可以保证电子设备中的应用程序正常运行。In the above embodiment, the application processing method acquires the number of lost frames of the image frame when it is detected that the continuous image frame outputted by the electronic device is lost. The rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application. Then, the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resources occupied by the background application are recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application. When the current application switch to the background exceeds the duration threshold, the normal operation status of the pending application is restored, so that the application in the electronic device can be guaranteed to operate normally.
应该理解的是,虽然图3和图4的流程图中的各个操作按照箭头的指示依次显示,但是这些操作并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些操作的执行并没有严格的顺序限制,这些操作可以以其它的顺序执行。而且,图3和图4中的至少一部分操作可以包括多个子操作或者多个阶段,这些子操作或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子操作或者阶段的执行顺序也不必然是依次进行,而是可以与其它操作或者其它操作的子操作或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the operations in the flowcharts of FIGS. 3 and 4 are sequentially displayed as indicated by the arrows, these operations are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these operations is not strictly limited, and the operations may be performed in other sequences. Moreover, at least some of the operations in FIGS. 3 and 4 may include multiple sub-operations or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, or The order of execution of the stages is also not necessarily sequential, but may be performed alternately or alternately with at least a portion of the sub-operations or stages of other operations or other operations.
在一个实施例中,如图6所示,提供了一种电子设备的部分架构图。其中,该电子设备的架构系统中包括JAVA空间层61、本地框架层62以及内核(Kernel)空间层63。JAVA空间层61上可包含策略应用程序610,电子设备可通过该策略应用程序610来发起对各个应用程序的冻结和解冻策略,从而实现对电子设备中的各个应用程序实现冻结和解冻的操作。例如,通过策略应用程序610来判断后台耗电的应用程序,并发起对该后台耗电的应用程序做冻结操作。本地框架层62中包含资源优先级和限制管理模块620及平台冻结管理模块622。电子设备可通过资源优先级和限制管理模块620来实时维护应用程序的优先级和对应的资源组,根据上层的需求来调整应用程序的优先级和资源组,从而达到优化性能,节省功耗的作用。电子设备可通过平台冻结管理模块622将后台可以冻结的任务按照进入冻结时间的长短,分配到对应预设的不同层次的冻结层,可选地,该冻结层可包括:CPU限制睡眠模式、CPU冻结睡眠模式、进程深度冻结模式。内核空间层63中包括UID管理模块630、Cgroup模块632、超时冻结退出模块634、Binder管控模块636、进程内存回收模块638。其中,UID管理模块630可以基于应用程序的用户身份标识(User Identifier,UID)来管理第三方应用程序的资源或进行冻结。相比较于基于进程身份标识(Process Identifier,PID)来进行进程管控,通过UID更便于统一管理一个用户的应用的资源。Cgroup模块632用于提供一套完善的中央处理器(Central Processing Unit,CPU)、CPUSET、内存(memory)、输入/输出(input/output,I/O)和Net相关的资源限制机制。超时冻结退出模块634用于解决出现冻结超时场景产生的异常。Binder管控模块636用于实现后台binder通信的优先级的控制。进程内存回收模块638用于实现进程的深度冻结模式,当第三方应用程序长期处于冻结状态的时候,可以释放进程的文件区,从而达到节省内存的模块,也加快该应用程序在下次启动时的速度。通过上述的架构,可实现本申请各个实施例中的应用程序处理方法。In one embodiment, as shown in FIG. 6, a partial architectural diagram of an electronic device is provided. The architecture system of the electronic device includes a JAVA space layer 61, a local frame layer 62, and a Kernel space layer 63. The JAVA spatial layer 61 can include a policy application 610 through which the electronic device can initiate a freeze and thaw strategy for each application, thereby implementing freezing and thawing operations for each application in the electronic device. For example, the policy application 610 determines the background power consumption application and initiates a freeze operation on the background power consumption application. The local framework layer 62 includes a resource priority and restriction management module 620 and a platform freeze management module 622. The electronic device can maintain the priority of the application and the corresponding resource group in real time through the resource priority and restriction management module 620, and adjust the priority and the resource group of the application according to the requirements of the upper layer, thereby achieving optimized performance and saving power consumption. effect. The electronic device can allocate the tasks that can be frozen in the background to the frozen layer corresponding to the preset level by the platform freeze management module 622. Optionally, the frozen layer can include: the CPU limits the sleep mode, and the CPU Freeze sleep mode, process deep freeze mode. The kernel space layer 63 includes a UID management module 630, a Cgroup module 632, a timeout freeze exit module 634, a Binder management module 636, and a process memory recovery module 638. The UID management module 630 can manage resources of the third-party application or freeze based on the User Identifier (UID) of the application. Compared with the Process Identifier (PID) for process management and control, it is easier to uniformly manage the resources of a user's application through UID. The Cgroup module 632 is used to provide a complete set of Central Processing Unit (CPU), CPUSET, memory, input/output (I/O), and Net related resource restriction mechanisms. The timeout freeze exit module 634 is configured to resolve an exception generated by the freeze timeout scenario. The Binder management module 636 is used to implement the priority control of the background binder communication. The process memory recovery module 638 is configured to implement a deep freeze mode of the process. When the third-party application is in a frozen state for a long time, the file area of the process can be released, thereby saving the memory module and speeding up the application at the next startup. speed. Through the above architecture, the application processing method in various embodiments of the present application can be implemented.
图7为一个实施例中应用程序处理装置的结构示意图。如图7所示,该应用程序处理装置700包括帧数获取模块702、等级获取模块704、策略获取模块706和应用处理模块708。其中:FIG. 7 is a schematic structural diagram of an application processing apparatus in an embodiment. As shown in FIG. 7, the application processing apparatus 700 includes a frame number acquisition module 702, a level acquisition module 704, a policy acquisition module 706, and an application processing module 708. among them:
帧数获取模块702,用于在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数。The frame number obtaining module 702 is configured to acquire the number of lost frames of the image frame when the electronic device outputs the continuous image frame.
等级获取模块704,用于根据所述丢失帧数获取前台应用程序的卡顿等级。The level obtaining module 704 is configured to obtain a carton level of the foreground application according to the number of lost frames.
策略获取模块706,用于根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略。The policy obtaining module 706 is configured to obtain a to-be-processed application from the background application according to the foreground application, and obtain a resource restriction policy according to the card-level.
应用处理模块708,用于根据所述资源限制策略将所述待处理应用程序进行资源限制 处理。The application processing module 708 is configured to perform resource limiting processing on the to-be-processed application according to the resource restriction policy.
上述实施例应用程序处理装置,当检测到电子设备输出的连续图像帧产生丢失时,获取图像帧的丢失帧数。根据丢失帧数判断前台应用程序的卡顿等级,并根据前台应用程序获取待处理应用程序。然后根据卡顿等级获取资源限制策略,根据获取的资源限制策略对待处理应用程序进行资源限制处理。这样可以在电子设备检测到卡顿的时候,通过资源限制处理回收后台应用程序占用的资源,以保证前台应用程序的高效运行,提高应用程序的运行效率。In the above embodiment, the application processing device acquires the number of lost frames of the image frame when it detects that a continuous image frame output by the electronic device is lost. The rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application. Then, the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resources occupied by the background application are recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application.
图8为另一个实施例中应用程序处理装置的结构示意图。如图8所示,该应用程序处理装置800包括帧数获取模块802、等级获取模块804、策略获取模块806、应用处理模块808和应用恢复模块810。其中:FIG. 8 is a schematic structural diagram of an application processing apparatus in another embodiment. As shown in FIG. 8, the application processing apparatus 800 includes a frame number acquisition module 802, a level acquisition module 804, a policy acquisition module 806, an application processing module 808, and an application recovery module 810. among them:
帧数获取模块802,用于在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数。The frame number obtaining module 802 is configured to acquire the number of lost frames of the image frame when the electronic device outputs the continuous image frame.
等级获取模块804,用于根据所述丢失帧数获取前台应用程序的卡顿等级。The level obtaining module 804 is configured to obtain a card level of the foreground application according to the number of lost frames.
策略获取模块806,用于根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略。The policy obtaining module 806 is configured to obtain a to-be-processed application from the background application according to the foreground application, and obtain a resource restriction policy according to the card-level.
应用处理模块808,用于根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The application processing module 808 is configured to perform resource limiting processing on the to-be-processed application according to the resource restriction policy.
应用恢复模块810,用于当检测到所述前台应用程序切换到后台时,开始计时;当计时时长超过时长阈值时,控制所述待处理应用程序恢复到正常运行状态。The application recovery module 810 is configured to start timing when detecting that the foreground application switches to the background; and when the timing duration exceeds the duration threshold, control the to-be-processed application to return to a normal running state.
上述实施例应用程序处理装置,当检测到电子设备输出的连续图像帧产生丢失时,获取图像帧的丢失帧数。根据丢失帧数判断前台应用程序的卡顿等级,并根据前台应用程序获取待处理应用程序。然后根据卡顿等级获取资源限制策略,根据获取的资源限制策略对待处理应用程序进行资源限制处理。这样可以在电子设备检测到卡顿的时候,通过资源限制处理回收后台应用程序占用的资源,以保证前台应用程序的高效运行,提高应用程序的运行效率。当前台应用程序切换到后台的时长超过时长阈值,则恢复待处理应用程序的正常运行状态,这样可以保证电子设备中的应用程序正常运行。In the above embodiment, the application processing device acquires the number of lost frames of the image frame when it detects that a continuous image frame output by the electronic device is lost. The rating of the foreground application is determined according to the number of lost frames, and the pending application is obtained according to the foreground application. Then, the resource restriction policy is obtained according to the Carton level, and the resource restriction processing is performed on the application to be processed according to the obtained resource restriction policy. In this way, when the electronic device detects the stuck, the resources occupied by the background application are recovered by the resource limitation processing, so as to ensure the efficient operation of the foreground application and improve the operating efficiency of the application. When the current application switch to the background exceeds the duration threshold, the normal operation status of the pending application is restored, so that the application in the electronic device can be guaranteed to operate normally.
在一个实施例中,等级获取模块804还用于确定所述丢失帧数所落入的目标帧数区间,并根据所述目标帧数区间获取前台应用程序的卡顿等级。In an embodiment, the level obtaining module 804 is further configured to determine a target frame number interval in which the number of lost frames falls, and obtain a carding level of the foreground application according to the target frame number interval.
在一个实施例中,策略获取模块806还用于从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序,并获取除所述依赖应用程序之外的后台应用程序作为待处理应用程序。In an embodiment, the policy obtaining module 806 is further configured to: obtain a dependent application that is dependent on the foreground application from a background application, and obtain a background application other than the dependent application as a to-be-processed application. .
在一个实施例中,策略获取模块806还用于获取与所述前台应用程序之间存在通信关系的后台应用程序,作为依赖应用程序。In one embodiment, the policy obtaining module 806 is further configured to obtain a background application that has a communication relationship with the foreground application as a dependent application.
在一个实施例中,策略获取模块806还用于当所述卡顿等级大于等级阈值时,获取第一资源限制策略;当所述卡顿等级小于或等于等级阈值时,获取第二资源限制策略。In an embodiment, the policy obtaining module 806 is further configured to: when the cardinal level is greater than a level threshold, acquire a first resource limiting policy; when the cardinal level is less than or equal to a level threshold, acquire a second resource limiting policy. .
在一个实施例中,应用处理模块808还用于根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理;或根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理。In an embodiment, the application processing module 808 is further configured to perform resource limiting processing on the to-be-processed application according to the first resource restriction policy; or perform the to-be-processed application according to the second resource restriction policy. Resource limit processing.
在一个实施例中,应用处理模块808还用于控制所述待处理应用程序进入冻结状态。In an embodiment, the application processing module 808 is further configured to control the to-be-processed application to enter a frozen state.
在一个实施例中,应用处理模块808还用于根据所述卡顿等级获取对应的资源限制级别,控制所述待处理应用程序进入所述资源限制级别对应资源限制状态,其中,处于所述资源限制状态的应用程序在运行时对电子设备的资源占用率小于占用率阈值。In an embodiment, the application processing module 808 is further configured to obtain a corresponding resource restriction level according to the card level, and control the to-be-processed application to enter the resource restriction level corresponding resource limitation state, where the resource is in the resource The resource-occupying rate of the restricted-state application to the electronic device at runtime is less than the occupancy threshold.
上述应用程序处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将应用程序处理装置按照需要划分为不同的模块,以完成上述应用程序处理装置的全部或部分功能。The division of each module in the above application processing device is for illustrative purposes only. In other embodiments, the application processing device may be divided into different modules as needed to complete all or part of the functions of the application processing device.
本申请实施例中提供的应用程序处理装置中的各个模块的实现可为计算机程序的形式。该计算机程序可在终端或服务器上运行。该计算机程序构成的程序模块可存储在终端或服务器的存储器上。该计算机程序被处理器执行时,实现本申请实施例中所描述方法的操作。The implementation of each module in the application processing apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program can run on a terminal or server. The program modules of the computer program can be stored on the memory of the terminal or server. The operation of the method described in the embodiments of the present application is implemented when the computer program is executed by the processor.
本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行上述实施例提供的应用程序处理方法。The embodiment of the present application also provides a computer readable storage medium. One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to execute the applications provided by the above embodiments Approach.
一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例提供的应用程序处理方法。A computer program product comprising instructions which, when run on a computer, cause the computer to perform the application processing method provided by the above embodiments.
本申请实施例还提供了一种电子设备。如图9所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该电子设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以电子设备为手机为例:An embodiment of the present application also provides an electronic device. As shown in FIG. 9 , for the convenience of description, only the parts related to the embodiments of the present application are shown. If the specific technical details are not disclosed, please refer to the method part of the embodiment of the present application. The electronic device can be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), an on-board computer, a wearable device, and the like, and the electronic device is used as a mobile phone. :
图9为与本申请实施例提供的电子设备相关的手机的部分结构的框图。参考图9,手机包括:射频(Radio Frequency,RF)电路910、存储器920、输入单元930、显示单元940、传感器950、音频电路960、无线保真(wireless fidelity,WiFi)模块970、处理器980、以及电源990等部件。本领域技术人员可以理解,图9所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 9 is a block diagram showing a partial structure of a mobile phone related to an electronic device according to an embodiment of the present application. Referring to FIG. 9, the mobile phone includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, and a processor 980. And power supply 990 and other components. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 9 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
其中,RF电路910可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器980处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路910还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 910 can be used for receiving and transmitting signals during the transmission and reception of information or during a call. The downlink information of the base station can be received and processed by the processor 980. The uplink data can also be sent to the base station. Generally, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 910 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
存储器920可用于存储软件程序以及模块,处理器980通过运行存储在存储器920的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器920可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.); The data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. Moreover, memory 920 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元930可用于接收输入的数字或字符信息,以及产生与手机900的用户设置以及功能控制有关的键信号输入。具体地,输入单元930可包括触控面板931以及其他输入设备932。触控面板931,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板931上或在触控面板931附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板931可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装 置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器980,并能接收处理器980发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板931。除了触控面板931,输入单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 930 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 900. Specifically, the input unit 930 may include a touch panel 931 and other input devices 932. The touch panel 931, also referred to as a touch screen, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 931 or near the touch panel 931. Operation) and drive the corresponding connection device according to a preset program. In one embodiment, the touch panel 931 can include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 980 is provided and can receive commands from the processor 980 and execute them. In addition, the touch panel 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 931, the input unit 930 may also include other input devices 932. Specifically, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
显示单元940可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元940可包括显示面板941。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板941。在一个实施例中,触控面板931可覆盖显示面板941,当触控面板931检测到在其上或附近的触摸操作后,传送给处理器980以确定触摸事件的类型,随后处理器980根据触摸事件的类型在显示面板941上提供相应的视觉输出。虽然在图9中,触控面板931与显示面板941是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板931与显示面板941集成而实现手机的输入和输出功能。The display unit 940 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 940 can include a display panel 941. In one embodiment, the display panel 941 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In one embodiment, the touch panel 931 can cover the display panel 941. When the touch panel 931 detects a touch operation on or near it, the touch panel 931 transmits to the processor 980 to determine the type of the touch event, and then the processor 980 is The type of touch event provides a corresponding visual output on display panel 941. Although the touch panel 931 and the display panel 941 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 9, in some embodiments, the touch panel 931 and the display panel 941 may be integrated. Realize the input and output functions of the phone.
手机900还可包括至少一种传感器950,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板941的亮度,接近传感器可在手机移动到耳边时,关闭显示面板941和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The handset 900 can also include at least one type of sensor 950, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 and/or when the mobile phone moves to the ear. Or backlight. The motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
音频电路960、扬声器961和传声器962可提供用户与手机之间的音频接口。音频电路960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号输出;另一方面,传声器962将收集的声音信号转换为电信号,由音频电路960接收后转换为音频数据,再将音频数据输出处理器980处理后,经RF电路910可以发送给另一手机,或者将音频数据输出至存储器920以便后续处理。 Audio circuitry 960, speaker 961, and microphone 962 can provide an audio interface between the user and the handset. The audio circuit 960 can transmit the converted electrical data of the received audio data to the speaker 961, and convert it into a sound signal output by the speaker 961. On the other hand, the microphone 962 converts the collected sound signal into an electrical signal, and the audio circuit 960 After receiving, it is converted into audio data, and after being processed by the audio data output processor 980, it can be sent to another mobile phone via the RF circuit 910, or the audio data can be output to the memory 920 for subsequent processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块970可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图9示出了WiFi模块970,但是可以理解的是,其并不属于手机900的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology, and the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970, which provides users with wireless broadband Internet access. Although FIG. 9 shows the WiFi module 970, it can be understood that it does not belong to the essential configuration of the mobile phone 900 and can be omitted as needed.
处理器980是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器980可包括一个或多个处理单元。在一个实施例中,处理器980可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器980中。The processor 980 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 920, and invoking data stored in the memory 920, executing The phone's various functions and processing data, so that the overall monitoring of the phone. In one embodiment, processor 980 can include one or more processing units. In one embodiment, the processor 980 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, and the like; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 980.
手机900还包括给各个部件供电的电源990(比如电池),优选的,电源可以通过电源管理系统与处理器980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 900 also includes a power source 990 (such as a battery) that supplies power to various components. Preferably, the power source can be logically coupled to the processor 980 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
在一个实施例中,手机900还可以包括摄像头、蓝牙模块等。In one embodiment, the handset 900 can also include a camera, a Bluetooth module, and the like.
在本申请实施例中,该电子设备所包括的处理器980执行存储在存储器上的计算机程序时实现上述实施例提供的应用程序处理方法的操作。In the embodiment of the present application, the processor 980 included in the electronic device implements the operation of the application processing method provided by the foregoing embodiment when executing the computer program stored in the memory.
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database or other medium used herein may include non-volatile and/or volatile memory. Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), which acts as an external cache. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization. Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the claims. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (21)

  1. 一种应用程序处理方法,包括:An application processing method, including:
    在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
    根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
    根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
    根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述丢失帧数获取前台应用程序的卡顿等级包括:The method according to claim 1, wherein the obtaining the rating of the foreground application according to the number of lost frames comprises:
    确定所述丢失帧数所落入的目标帧数区间,并根据所述目标帧数区间获取前台应用程序的卡顿等级。Determining a target frame number interval in which the number of lost frames falls, and obtaining a carton level of the foreground application according to the target frame number interval.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述前台应用程序从后台应用程序中获取待处理应用程序包括:The method according to claim 1, wherein the obtaining the to-be-processed application from the background application according to the foreground application comprises:
    从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序,并获取除所述依赖应用程序之外的后台应用程序作为待处理应用程序。A dependent application that is dependent on the foreground application is obtained from a background application, and a background application other than the dependent application is obtained as a pending application.
  4. 根据权利要求3所述的方法,其特征在于,所述从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序包括:The method according to claim 3, wherein the obtaining, from the background application, the dependent application that is dependent on the foreground application comprises:
    获取与所述前台应用程序之间存在通信关系的后台应用程序,作为依赖应用程序。Obtaining a background application that has a communication relationship with the foreground application as a dependent application.
  5. 根据权利要求1所述的方法,其特征在于,所述根据所述卡顿等级获取资源限制策略包括:The method according to claim 1, wherein the obtaining a resource restriction policy according to the Karden level comprises:
    当所述卡顿等级大于等级阈值时,获取第一资源限制策略;Obtaining a first resource restriction policy when the carton level is greater than a level threshold;
    当所述卡顿等级小于或等于等级阈值时,获取第二资源限制策略;Obtaining a second resource restriction policy when the carton level is less than or equal to a level threshold;
    所述根据所述资源限制策略将所述待处理应用程序进行资源限制处理包括:The performing resource limitation processing on the to-be-processed application according to the resource restriction policy includes:
    根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理;或Performing resource limitation processing on the to-be-processed application according to the first resource restriction policy; or
    根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the second resource restriction policy.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理包括:The method according to claim 5, wherein the performing resource restriction processing on the to-be-processed application according to the first resource restriction policy comprises:
    控制所述待处理应用程序进入冻结状态;Controlling the to-be-processed application to enter a frozen state;
    所述根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理包括:The performing resource limitation processing on the to-be-processed application according to the second resource restriction policy includes:
    根据所述卡顿等级获取对应的资源限制级别,控制所述待处理应用程序进入所述资源限制级别对应资源限制状态,其中,处于所述资源限制状态的应用程序在运行时对电子设备的资源占用率小于占用率阈值。Obtaining a corresponding resource restriction level according to the cardon level, and controlling the to-be-processed application to enter the resource restriction level corresponding resource restriction state, where the application in the resource limitation state is a resource to the electronic device at runtime The occupancy rate is less than the occupancy threshold.
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 6, wherein the method further comprises:
    当检测到所述前台应用程序切换到后台时,开始计时;及Start timing when it is detected that the foreground application switches to the background; and
    当计时时长超过时长阈值时,控制所述待处理应用程序恢复到正常运行状态。When the timing duration exceeds the duration threshold, the to-be-processed application is controlled to return to the normal running state.
  8. 一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如下操作:An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following operations:
    在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
    根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
    根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
    根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  9. 根据权利要求8所述的电子设备,其特征在于,所述处理器执行所述根据所述丢失帧数获取前台应用程序的卡顿等级时,还执行如下操作:The electronic device according to claim 8, wherein the processor further performs the following operations when the processor performs the obtaining of a stuck level of the foreground application according to the lost frame number:
    确定所述丢失帧数所落入的目标帧数区间,并根据所述目标帧数区间获取前台应用程序的卡顿等级。Determining a target frame number interval in which the number of lost frames falls, and obtaining a carton level of the foreground application according to the target frame number interval.
  10. 根据权利要求8所述的电子设备,其特征在于,所述处理器执行所述根据所述前台应用程序从后台应用程序中获取待处理应用程序时,还执行如下操作:The electronic device according to claim 8, wherein when the processor executes the acquiring the to-be-processed application from the background application according to the foreground application, the processor further performs the following operations:
    从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序,并获取除所述依赖应用程序之外的后台应用程序作为待处理应用程序。A dependent application that is dependent on the foreground application is obtained from a background application, and a background application other than the dependent application is obtained as a pending application.
  11. 根据权利要求10所述的电子设备,其特征在于,所述处理器执行所述从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序时,还执行如下操作:The electronic device according to claim 10, wherein when the processor executes the dependent application that is accessed by the foreground application from the background application, the processor further performs the following operations:
    获取与所述前台应用程序之间存在通信关系的后台应用程序,作为依赖应用程序。Obtaining a background application that has a communication relationship with the foreground application as a dependent application.
  12. 根据权利要求8所述的电子设备,其特征在于,所述处理器执行所述根据所述卡顿等级获取资源限制策略时,还执行如下操作:The electronic device according to claim 8, wherein when the processor executes the resource restriction policy according to the card level, the following operations are further performed:
    当所述卡顿等级大于等级阈值时,获取第一资源限制策略;Obtaining a first resource restriction policy when the carton level is greater than a level threshold;
    当所述卡顿等级小于或等于等级阈值时,获取第二资源限制策略;Obtaining a second resource restriction policy when the carton level is less than or equal to a level threshold;
    所述处理器执行所述根据所述资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:When the processor performs the resource limitation processing on the to-be-processed application according to the resource restriction policy, the processor further performs the following operations:
    根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理;或Performing resource limitation processing on the to-be-processed application according to the first resource restriction policy; or
    根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the second resource restriction policy.
  13. 根据权利要求12所述的电子设备,其特征在于,所述处理器执行所述根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:The electronic device according to claim 12, wherein when the processor performs the resource limiting processing on the to-be-processed application according to the first resource restriction policy, the processor further performs the following operations:
    控制所述待处理应用程序进入冻结状态;Controlling the to-be-processed application to enter a frozen state;
    所述处理器执行所述根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:When the processor performs the resource limitation processing on the to-be-processed application according to the second resource restriction policy, the processor further performs the following operations:
    根据所述卡顿等级获取对应的资源限制级别,控制所述待处理应用程序进入所述资源限制级别对应资源限制状态,其中,处于所述资源限制状态的应用程序在运行时对电子设备的资源占用率小于占用率阈值。Obtaining a corresponding resource restriction level according to the cardon level, and controlling the to-be-processed application to enter the resource restriction level corresponding resource restriction state, where the application in the resource limitation state is a resource to the electronic device at runtime The occupancy rate is less than the occupancy threshold.
  14. 根据权利要求8至13中任一项所述的电子设备,其特征在于,所述处理器还执行如下操作:The electronic device according to any one of claims 8 to 13, wherein the processor further performs the following operations:
    当检测到所述前台应用程序切换到后台时,开始计时;及Start timing when it is detected that the foreground application switches to the background; and
    当计时时长超过时长阈值时,控制所述待处理应用程序恢复到正常运行状态。When the timing duration exceeds the duration threshold, the to-be-processed application is controlled to return to the normal running state.
  15. 一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如下操作:A computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor to:
    在电子设备输出连续图像帧时,获取所述图像帧的丢失帧数;Obtaining a lost frame number of the image frame when the electronic device outputs a continuous image frame;
    根据所述丢失帧数获取前台应用程序的卡顿等级;Obtaining a Karton level of the foreground application according to the number of lost frames;
    根据所述前台应用程序从后台应用程序中获取待处理应用程序,并根据所述卡顿等级获取资源限制策略;及Obtaining a to-be-processed application from a background application according to the foreground application, and acquiring a resource restriction policy according to the card level; and
    根据所述资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the resource restriction policy.
  16. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行所述根据所述丢失帧数获取前台应用程序的卡顿等级时,还执行如下操作:The computer readable storage medium according to claim 15, wherein the computer program is further executed by the processor when the processor performs the obtaining of a stuck level of the foreground application according to the number of lost frames:
    确定所述丢失帧数所落入的目标帧数区间,并根据所述目标帧数区间获取前台应用程序的卡顿等级。Determining a target frame number interval in which the number of lost frames falls, and obtaining a carton level of the foreground application according to the target frame number interval.
  17. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行所述根据所述前台应用程序从后台应用程序中获取待处理应用程序时,还执行如下操作:The computer readable storage medium according to claim 15, wherein the computer program is further executed by the processor when the processor is configured to obtain a to-be-processed application from the background application according to the foreground application:
    从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序,并获取除所述依赖 应用程序之外的后台应用程序作为待处理应用程序。A dependent application that is dependent on the foreground application is obtained from the background application, and a background application other than the dependent application is obtained as a pending application.
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行所述从后台应用程序中获取被所述前台应用程序依赖的依赖应用程序时,还执行如下操作:The computer readable storage medium according to claim 17, wherein the computer program is further executed by the processor when the processor executes the dependent application that is accessed by the foreground application from the background application :
    获取与所述前台应用程序之间存在通信关系的后台应用程序,作为依赖应用程序。Obtaining a background application that has a communication relationship with the foreground application as a dependent application.
  19. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行所述根据所述卡顿等级获取资源限制策略时,还执行如下操作:The computer readable storage medium according to claim 15, wherein when the computer program is executed by the processor to obtain a resource restriction policy according to the Karten level, the computer program further performs the following operations:
    当所述卡顿等级大于等级阈值时,获取第一资源限制策略;Obtaining a first resource restriction policy when the carton level is greater than a level threshold;
    当所述卡顿等级小于或等于等级阈值时,获取第二资源限制策略;Obtaining a second resource restriction policy when the carton level is less than or equal to a level threshold;
    所述计算机程序被处理器执行所述根据所述资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:When the computer program is executed by the processor to perform resource limitation processing on the to-be-processed application according to the resource restriction policy, the computer program further performs the following operations:
    根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理;或Performing resource limitation processing on the to-be-processed application according to the first resource restriction policy; or
    根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理。The to-be-processed application is subjected to resource limitation processing according to the second resource restriction policy.
  20. 根据权利要求19所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行所述根据所述第一资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:The computer readable storage medium according to claim 19, wherein said computer program is further executed when said processor performs said resource limiting processing on said to-be-processed application according to said first resource restriction policy Do the following:
    控制所述待处理应用程序进入冻结状态;Controlling the to-be-processed application to enter a frozen state;
    所述计算机程序被处理器执行所述根据所述第二资源限制策略将所述待处理应用程序进行资源限制处理时,还执行如下操作:When the computer program is executed by the processor to perform resource limitation processing on the to-be-processed application according to the second resource restriction policy, the computer program further performs the following operations:
    根据所述卡顿等级获取对应的资源限制级别,控制所述待处理应用程序进入所述资源限制级别对应资源限制状态,其中,处于所述资源限制状态的应用程序在运行时对电子设备的资源占用率小于占用率阈值。Obtaining a corresponding resource restriction level according to the cardon level, and controlling the to-be-processed application to enter the resource restriction level corresponding resource restriction state, where the application in the resource limitation state is a resource to the electronic device at runtime The occupancy rate is less than the occupancy threshold.
  21. 根据权利要求15至20中任一项所述的计算机可读存储介质,其特征在于,所述计算机程序还被处理器执行如下操作:The computer readable storage medium according to any one of claims 15 to 20, wherein the computer program is further executed by the processor as follows:
    当检测到所述前台应用程序切换到后台时,开始计时;及Start timing when it is detected that the foreground application switches to the background; and
    当计时时长超过时长阈值时,控制所述待处理应用程序恢复到正常运行状态。When the timing duration exceeds the duration threshold, the to-be-processed application is controlled to return to the normal running state.
PCT/CN2018/116607 2017-12-29 2018-11-21 Application processing method, electronic device, and computer-readable storage medium WO2019128553A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711480554.6A CN109992363B (en) 2017-12-29 2017-12-29 Application program processing method and device, electronic equipment and computer readable storage medium
CN201711480554.6 2017-12-29

Publications (1)

Publication Number Publication Date
WO2019128553A1 true WO2019128553A1 (en) 2019-07-04

Family

ID=67063016

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116607 WO2019128553A1 (en) 2017-12-29 2018-11-21 Application processing method, electronic device, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN109992363B (en)
WO (1) WO2019128553A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111966493B (en) * 2020-08-07 2023-07-21 Oppo广东移动通信有限公司 Process processing method, electronic equipment and storage medium
CN116089096B (en) * 2023-04-09 2023-09-01 荣耀终端有限公司 Load resource scheduling method and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375912A (en) * 2014-11-28 2015-02-25 广东欧珀移动通信有限公司 Method and device for measuring blockage of mobile terminal
CN104461546A (en) * 2014-12-15 2015-03-25 北京奇虎科技有限公司 Application based computing device optimizing method and device
CN105094869A (en) * 2014-05-14 2015-11-25 腾讯科技(深圳)有限公司 Target program determination method and apparatus
CN106445783A (en) * 2016-09-27 2017-02-22 北京金山安全软件有限公司 Method and device for detecting jamming of electronic equipment and electronic equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024768B (en) * 2011-09-23 2017-05-17 中兴通讯股份有限公司 End-to-end videophone service quality evaluation method and system
CN104050035B (en) * 2014-05-14 2018-05-25 小米科技有限责任公司 The processing method and processing device of application program
CN104572287B (en) * 2015-01-30 2018-12-25 西安酷派软件科技有限公司 The method, apparatus and terminal of application state are kept when a kind of system switches
CN106326137B (en) * 2015-07-02 2020-09-22 腾讯科技(深圳)有限公司 Memory optimization method and device and user equipment
CN105893153A (en) * 2016-03-31 2016-08-24 北京百纳威尔无线通信设备有限公司 Memory cleaning method and device for mobile terminal
CN107341818A (en) * 2016-04-29 2017-11-10 北京博酷科技有限公司 Image analysis algorithm for the test of touch-screen response performance
CN106547640A (en) * 2016-11-23 2017-03-29 深圳市金立通信设备有限公司 A kind of method and terminal of backstage cleaning
CN106792165A (en) * 2016-12-02 2017-05-31 武汉斗鱼网络科技有限公司 A kind of resource dynamic regulation method and device
CN107045443A (en) * 2017-04-14 2017-08-15 北京安云世纪科技有限公司 background process control method, device and intelligent terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094869A (en) * 2014-05-14 2015-11-25 腾讯科技(深圳)有限公司 Target program determination method and apparatus
CN104375912A (en) * 2014-11-28 2015-02-25 广东欧珀移动通信有限公司 Method and device for measuring blockage of mobile terminal
CN104461546A (en) * 2014-12-15 2015-03-25 北京奇虎科技有限公司 Application based computing device optimizing method and device
CN106445783A (en) * 2016-09-27 2017-02-22 北京金山安全软件有限公司 Method and device for detecting jamming of electronic equipment and electronic equipment

Also Published As

Publication number Publication date
CN109992363A (en) 2019-07-09
CN109992363B (en) 2021-03-26

Similar Documents

Publication Publication Date Title
WO2019128546A1 (en) Application program processing method, electronic device, and computer readable storage medium
EP2733995B1 (en) Control method and device for awaking intelligent terminal
WO2020024732A1 (en) Process processing method, electronic device, and computer-readable storage medium
WO2019128540A1 (en) Resource management method, mobile terminal and computer readable storage medium
WO2020093208A1 (en) Application processing method and apparatus, computer device, and computer readable storage medium
CN110018901B (en) Memory recovery method and device, computer equipment and computer readable storage medium
CN110032321B (en) Application processing method and device, electronic equipment and computer readable storage medium
KR102222337B1 (en) Apparatus and method for synchronizing among applications
CN107577508B (en) Application processing method and device, readable storage medium and mobile terminal
CN110032267B (en) Information processing method and device, mobile terminal and computer readable storage medium
CN110032266B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
WO2019128537A1 (en) Application freezing method, and computer device and computer-readable storage medium
CN108334345B (en) Application processing method and device, readable storage medium and mobile terminal
WO2019128573A1 (en) Information processing method, apparatus, computer device and computer-readable storage medium
WO2019128588A1 (en) Process processing method and apparatus, electronic device, computer readable storage medium
WO2019128574A1 (en) Information processing method and device, computer device and computer readable storage medium
CN109992380B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN110018905B (en) Information processing method, information processing apparatus, computer device, and computer-readable storage medium
WO2019128586A1 (en) Application processing method, electronic device, and computer readable storage medium
WO2017206901A1 (en) Process control method and related device
WO2019128553A1 (en) Application processing method, electronic device, and computer-readable storage medium
WO2019128569A1 (en) Method and apparatus for freezing application, and storage medium and terminal
CN109992323B (en) Process processing method and device, electronic equipment and computer readable storage medium
WO2019072179A1 (en) Application running control method and apparatus
CN109992369B (en) Application program processing method and device, electronic equipment and computer readable storage medium

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: 18896458

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18896458

Country of ref document: EP

Kind code of ref document: A1