WO2022199509A1 - 应用执行绘制操作的方法及电子设备 - Google Patents

应用执行绘制操作的方法及电子设备 Download PDF

Info

Publication number
WO2022199509A1
WO2022199509A1 PCT/CN2022/081926 CN2022081926W WO2022199509A1 WO 2022199509 A1 WO2022199509 A1 WO 2022199509A1 CN 2022081926 W CN2022081926 W CN 2022081926W WO 2022199509 A1 WO2022199509 A1 WO 2022199509A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
electronic device
frequency
drawing operation
vertical synchronization
Prior art date
Application number
PCT/CN2022/081926
Other languages
English (en)
French (fr)
Inventor
谢冰
周帅
唐城开
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP22774170.9A priority Critical patent/EP4280056A1/en
Priority to JP2023558327A priority patent/JP2024515462A/ja
Publication of WO2022199509A1 publication Critical patent/WO2022199509A1/zh
Priority to US18/466,894 priority patent/US20230418696A1/en

Links

Images

Classifications

    • 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/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
    • 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • 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/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • 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]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of electronic technology, and in particular, to a method and an electronic device for performing a drawing operation with an application.
  • the electronic device can actively freeze the application, so that the application does not continuously occupy system resources.
  • frozen applications are often awakened by broadcasts, services, etc.
  • the wake-up background applications like other unfrozen background applications, will still occupy system resources and perform invalid drawing operations, resulting in background applications crowding the system of foreground applications. resources, and lead to increased power consumption of electronic devices.
  • the embodiment of the present application provides a method for an application to perform a drawing operation, by intercepting a synchronous vertical signal or intercepting a callback method in a choreographer, or deleting an animation event task saved by the choreographer, so as to reduce the ineffective execution of background applications.
  • the frequency of the drawing operation further reduces the occupation of system resources by the background application and reduces the power consumption of the electronic device.
  • the present application provides a method for an application to perform a drawing operation.
  • the method includes: an electronic device starts a first application; when the first application is a foreground application, the electronic device performs a drawing operation at a first frequency , the drawing operation is used to draw a view for the first application; when the first application is switched from a foreground application to a background application, the electronic device performs the drawing operation at a second frequency, which is less than the first frequency frequency; wherein, the first frequency is the frequency at which the first application receives the vertical synchronization signal.
  • the drawing frequency of the application program is reduced, and the drawing frequency is lower than the frequency at which the application program receives the vertical synchronization signal, which can reduce the occupation of system resources by the background application. , and can reduce the heat generation and power consumption of electronic equipment.
  • the electronic device instructs the choreographer of the first application to only respond to the K received
  • the N vertical synchronization signals in the vertical synchronization signals respond, so that the electronic device performs the drawing operation at the second frequency
  • the K is a positive integer
  • the N is a positive integer smaller than the K.
  • the electronic device instructs the choreographer of the application to only respond to a part of the received vertical synchronization signal, thereby reducing the frequency of performing drawing operations, thereby reducing the occupation of system resources by the background application, and reducing the electronic device. heat and power consumption.
  • the electronic device instructs the choreographer of the first application to process only the K received
  • the animation event task corresponding to the N vertical synchronization signals in the vertical synchronization signal causes the electronic device to perform the drawing operation at the second frequency
  • the K is a positive integer
  • the N is a positive integer smaller than the K.
  • the electronic device instructs the choreographer of the application program to only process the animation event tasks corresponding to some of the vertical synchronization signals in the received vertical synchronization signals, thereby reducing the frequency of performing drawing operations, thereby reducing the impact of background applications on the system. Resource occupancy, and reduce heat generation and power consumption of electronic devices.
  • the electronic device deletes the K vertical syncs received by the choreographer of the first application.
  • the animation event tasks corresponding to K-N vertical synchronization signals in the signal make the electronic device perform the drawing operation at the second frequency, where K is a positive integer, and N is a positive integer smaller than the K.
  • the electronic device deletes the animation event task saved by the choreographer of the application program, so that the drawing operation performed by the background application is a no-op, thereby reducing the occupation of system resources by the background application and reducing the Heat and power consumption.
  • the ratio of the N to the K corresponds to the ratio of the second frequency to the first frequency.
  • the ratio of the N to the K is equal to the ratio of the second frequency to the first frequency.
  • the electronic device after the first application is switched from a foreground application to a background application, when the application does not receive the vertical synchronization signal at the first frequency, it receives the vertical synchronization signal at the third frequency When the vertical synchronization signal is applied, the electronic device performs the drawing operation at a frequency lower than a fourth frequency, the third frequency is less than the first frequency, and the fourth frequency is less than or equal to the third frequency and greater than 0.
  • the application program is allowed to perform drawing operations at a frequency not exceeding a certain value, which reduces the frequency of performing drawing operations, thereby reducing the occupation of system resources by background applications, and reducing the heat and power of electronic devices. consume.
  • the electronic device determines that the first application program receives the first vertical synchronization signal and the first application program Whether the time difference between the time when the program last performed the drawing operation is less than the inverse of the fourth frequency; if so, the electronic device intercepts the first drawing operation, which is after the first application program responds to the first vertical synchronization signal The drawing operation to be performed; if not, the electronic device performs the first drawing operation.
  • the application program when the application program performs a drawing operation for the purpose of non-refreshing the interface, the application program is allowed to perform the drawing operation at a frequency not exceeding a certain value, which reduces the frequency of performing the drawing operation, thereby reducing the background application
  • the system resources are occupied, and the heat generation and power consumption of electronic devices are reduced. And, a dynamic balance is achieved between the system's closeness and performance.
  • the electronic device determines the second frequency according to a drawn frequency limit policy and the first application.
  • the electronic device can determine the frequency of performing the drawing operation of different applications according to the drawing frequency limit policy, which helps to realize the differential allocation of system resources at the same time, and reduces the heat generation and power consumption of the electronic device.
  • the electronic device determines that the first application is a foreground application or a background application according to the activity management service and/or the cpuset parameter of the process of the first application.
  • the N is equal to zero.
  • the electronic device may instruct the application not to perform a drawing operation, so that the application releases system resources, thereby reducing heat generation and power consumption of the electronic device.
  • the N is equal to K.
  • the animation event task saved by the application program can be deleted, so that all the drawing operations performed by the application program are empty operations, In turn, more system resources are released, thereby reducing heat generation and power consumption of the electronic device.
  • the present application provides a method for an application to perform a drawing operation.
  • the method includes: an electronic device starts a first application program; the electronic device displays an interface of the first application program, and the electronic device performs drawing at a first frequency operation, the drawing operation is used to draw a view for the first application; the electronic device closes the display of the interface of the first application, and the electronic device performs the drawing operation at a second frequency, which is less than the first frequency frequency; wherein, the first frequency is the frequency at which the first application receives the vertical synchronization signal.
  • the electronic device when the application program closes the interface display, it is not necessary to perform a drawing operation to refresh the interface, the electronic device can reduce the frequency of the application performing the drawing operation, can reduce the occupation of system resources by the background application, and can reduce the electronic device. heat and power consumption.
  • the electronic device turns off the display of the interface of the first application, where the first application is a background application.
  • the electronic device when the application program does not display the interface and is a background application, it is not necessary to perform a drawing operation to refresh the interface, the electronic device can reduce the frequency of the application performing the drawing operation, and can reduce the occupation of system resources by the background application , and can reduce the heat generation and power consumption of electronic equipment.
  • the electronic device instructs the choreographer of the first application to respond to only N vertical synchronization signals of the K received vertical synchronization signals, so that the The electronic device performs the drawing operation at the second frequency, the K is a positive integer, and the N is a positive integer smaller than K.
  • the electronic device instructs the choreographer of the first application to only process animation event tasks corresponding to N vertical synchronization signals among the received K vertical synchronization signals, so that the electronic device uses the second
  • the frequency at which the drawing operation is performed the K is a positive integer
  • the N is a positive integer less than K.
  • the electronic device when the electronic device does not display the interface of the first application, the electronic device instructs the choreographer of the first application to only process the received K vertical
  • the animation event task corresponding to the N vertical synchronization signals in the synchronization signal causes the electronic device to perform the drawing operation at the second frequency, where K is a positive integer, and N is a positive integer smaller than K.
  • the electronic device instructs the choreographer of the application program to only process the animation event tasks corresponding to some of the vertical synchronization signals in the received vertical synchronization signals, thereby reducing the frequency of performing drawing operations, thereby reducing the impact of background applications on the system. Resource occupancy, and reduce heat generation and power consumption of electronic devices.
  • the electronic device deletes the animation event task corresponding to K-N vertical synchronization signals among the K vertical synchronization signals received by the choreographer of the first application program,
  • the electronic device is made to perform the drawing operation at the second frequency, the K is a positive integer, and the N is a positive integer smaller than K.
  • the electronic device deletes the animation event task saved by the choreographer of the application program, so that the drawing operation performed by the background application is a no-op, thereby reducing the occupation of system resources by the background application and reducing the Heat and power consumption.
  • the ratio of the N to the K corresponds to the ratio of the second frequency to the first frequency.
  • the ratio of the N to the K is equal to the ratio of the second frequency to the first frequency.
  • the electronic device closes the display of the interface of the first application program, when the application program does not receive the vertical synchronization signal at the first frequency, but uses the third frequency
  • the electronic device performs the drawing operation at a frequency lower than a fourth frequency, the third frequency is less than the first frequency, and the fourth frequency is less than or equal to the third frequency and greater than 0.
  • the application program is allowed to perform drawing operations at a frequency not exceeding a certain value, which reduces the frequency of performing drawing operations, thereby reducing the occupation of system resources by background applications, and reducing the heat and power of electronic devices. consume.
  • the electronic device determines that the first application receives the first vertical synchronization signal and the first application Whether the time difference between the time when the program last performed the drawing operation is less than the inverse of the fourth frequency; if so, the electronic device intercepts the first drawing operation, which is after the first application program responds to the first vertical synchronization signal The drawing operation to be performed; if not, the electronic device performs the first drawing operation.
  • the application program when the application program performs a drawing operation for the purpose of non-refreshing the interface, the application program is allowed to perform the drawing operation at a frequency not exceeding a certain value, which reduces the frequency of performing the drawing operation, thereby reducing the background application
  • the system resources are occupied, and the heat generation and power consumption of electronic devices are reduced.
  • the electronic device determines the second frequency according to a drawn frequency limit policy and the first application.
  • the electronic device can determine the frequency of performing the drawing operation of different applications according to the drawing frequency limit policy, which helps to realize the differential allocation of system resources at the same time, and reduces the heat generation and power consumption of the electronic device.
  • the electronic device determines whether the electronic device displays the interface of the first application or determines whether the electronic device displays the interface of the first application according to the activity management service and/or the cpuset parameter of the process of the first application Whether the first application is a foreground application or a background application.
  • the N is equal to zero.
  • the electronic device may instruct the application not to perform a drawing operation, so that the application releases system resources, thereby reducing heat generation and power consumption of the electronic device.
  • the N equals K.
  • the animation event task saved by the application program can be deleted, so that all the drawing operations performed by the application program are empty operations, In turn, more system resources are released, thereby reducing heat generation and power consumption of the electronic device.
  • an embodiment of the present application provides an electronic device, the electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes,
  • the computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to perform:
  • the drawing operation is used to draw a view for the first application; when the first application is switched from the foreground application to After the background application, the drawing operation is performed at a second frequency, where the second frequency is lower than the first frequency; wherein the first frequency is the frequency at which the first application program receives the vertical synchronization signal.
  • the choreographer of the first application is instructed to only respond to the received K vertical synchronization signals
  • the N vertical synchronization signals in are responsive to cause the electronic device to perform the drawing operation at the second frequency, the K is a positive integer, and the N is a positive integer smaller than K.
  • the choreographer of the first application is instructed to process only the K received vertical synchronization signals
  • the animation event tasks corresponding to the N vertical synchronization signals make the electronic device perform the drawing operation at the second frequency, where N is a positive integer smaller than K.
  • the animation event tasks corresponding to K-N vertical synchronization signals cause the electronic device to perform the drawing operation at the second frequency, where K is a positive integer, and N is a positive integer smaller than K.
  • the ratio of the N to the K corresponds to the ratio of the second frequency to the first frequency.
  • the ratio of the N to the K is equal to the ratio of the second frequency to the first frequency.
  • the electronic device After the first application is switched from a foreground application to a background application, and when the application does not receive the vertical synchronization signal at the first frequency, but uses the first frequency
  • the electronic device After receiving the vertical synchronization signal at three frequencies, the electronic device performs the drawing operation at a frequency lower than a fourth frequency, the third frequency is less than the first frequency, and the fourth frequency is less than or equal to the third frequency and greater than 0.
  • the electronic device determines that the first application program receives the first vertical synchronization signal and the first application program receives the first vertical synchronization signal. Whether the time difference between the time when the program last performed the drawing operation is less than the inverse of the fourth frequency; if so, the electronic device intercepts the first drawing operation, which is after the first application program responds to the first vertical synchronization signal The drawing operation to be performed; if not, the electronic device performs the first drawing operation.
  • the second frequency is determined according to a drawing frequency limit policy and the first application.
  • the first application is determined to be a foreground application or a background application according to the activity management service and/or the cpuset parameter of the process of the first application.
  • the N is equal to 0;
  • the N equals K
  • an embodiment of the present application provides an electronic device, the electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes,
  • the computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to perform:
  • the electronic device displays an interface of the first application, and performs a drawing operation at a first frequency, the drawing operation is used to draw a view for the first application; closes the first application In the display of the interface of the program, the drawing operation is performed at a second frequency, and the second frequency is lower than the first frequency; wherein, the first frequency is the frequency at which the first application program receives the vertical synchronization signal.
  • the display of the interface of the first application is turned off, where the first application is a background application.
  • the electronic device when the electronic device does not display the interface of the first application program, instruct the choreographer of the first application program to only respond to the received K vertical synchronization signals
  • the N vertical synchronization signals in are responsive so that the electronic device performs the drawing operation at the second frequency, the K is a positive integer, and the N is a positive integer smaller than the K.
  • the choreographer of the first application is instructed to process only the K received vertical synchronization signals Among the animation event tasks corresponding to the N vertical synchronization signals, the electronic device executes the drawing operation at the second frequency, the K is a positive integer, and the N is a positive integer smaller than the K.
  • the drawing operation is performed at the second frequency, and the electronic device deletes the editing of the first application.
  • the ratio of the N to the K corresponds to the ratio of the second frequency to the first frequency.
  • the ratio of the N to the K is equal to the ratio of the second frequency to the first frequency.
  • the electronic device after the display of the interface of the first application program is turned off, when the application program does not receive the vertical synchronization signal at the first frequency, but receives the vertical synchronization signal at the third frequency
  • the electronic device performs the drawing operation at a frequency lower than a fourth frequency, the third frequency is less than the first frequency, and the fourth frequency is less than or equal to the third frequency and greater than 0.
  • the electronic device determines that the first application program receives the first vertical synchronization signal and the first application program Whether the time difference between the time when the program last performed the drawing operation is less than the inverse of the fourth frequency; if so, the electronic device intercepts the first drawing operation, which is after the first application program responds to the first vertical synchronization signal The drawing operation to be performed; if not, the electronic device performs the first drawing operation.
  • the second frequency is determined according to a drawing frequency limit policy and the first application.
  • the activity management service and/or the cpuset parameter of the process of the first application it is determined whether the electronic device displays the interface of the first application, or whether the first application is displayed. Whether the application is a foreground application or a background application.
  • the N is equal to 0;
  • the N equals K
  • an embodiment of the present application provides a chip system, the chip system is applied to an electronic device, the chip system includes one or more processors, and the processors are configured to invoke computer instructions to cause the electronic device to execute the first A method as described in the aspect and any possible implementation of the first aspect, or as described in the second aspect and any possible implementation of the second aspect.
  • the application embodiments provide a computer program product containing instructions, when the above computer program product is run on an electronic device, the electronic device is made to perform as described in the first aspect and any possible implementation manner of the first aspect The method, or the method described in the second aspect and any possible implementation manner of the second aspect.
  • an application embodiment provides a computer-readable storage medium, including instructions, when the above-mentioned instructions are executed on an electronic device, the electronic device executes as described in the first aspect and any possible implementation manner of the first aspect The method, or the method described in the second aspect and any possible implementation manner of the second aspect.
  • the electronic device provided in the third aspect and the fourth aspect, the chip system provided in the fifth aspect, the computer program product provided in the sixth aspect, and the computer storage medium provided in the seventh aspect are all used to execute the embodiments of the present application. provided method. Therefore, for the beneficial effects that can be achieved, reference may be made to the beneficial effects in the corresponding method, which will not be repeated here.
  • FIG. 1 is an exemplary schematic diagram of the transition between a foreground application and a background application involved in the present application.
  • FIG. 2 is an exemplary schematic diagram of the life cycle of the activities involved in this application.
  • FIG. 3 is an exemplary schematic diagram of four kinds of event tasks involved in this application.
  • FIG. 4 is an exemplary schematic diagram of the drawing operation performed by the choreographer involved in the present application.
  • FIG. 5 is an exemplary schematic diagram of drawing operations performed by a foreground application and a background application involved in the present application.
  • FIG. 6 is a schematic diagram of an example of a system scheduling method of a background application involved in the present application.
  • FIG. 7 is a schematic diagram of another example of a system scheduling method for a background application involved in the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application.
  • FIG. 9 is another schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a software structure of the electronic device 100 in the embodiment of the present application.
  • FIG. 11 is another schematic block diagram of the software structure of the electronic device 100 in the embodiment of the present application.
  • FIG. 12 is an exemplary schematic diagram of a method for performing a drawing operation by an application provided by the present application.
  • FIG. 13 is an exemplary schematic diagram of the interface for drawing a frequency limit policy provided by the present application.
  • FIG. 14 is an exemplary schematic diagram of a method for intercepting a choreographer from receiving a vertical synchronization signal in an embodiment of the present application.
  • FIG. 15 is an exemplary schematic diagram of a method for intercepting a choreographer to process an animation event task in an embodiment of the present application.
  • FIG. 16 is an exemplary schematic diagram of intercepting a choreographer's drawing operation in an embodiment of the present application.
  • FIG. 17 is an exemplary schematic diagram of an invalid drawing operation scenario of controlling a background application in an embodiment of the present application.
  • FIG. 18 is another exemplary schematic diagram of an invalid drawing operation scenario of controlling a background application in an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • the application can be divided into: foreground application and background application.
  • the foreground application and the background application are descriptions of the running state of the application.
  • the foreground application is an application placed in the foreground and can be directly interacted with
  • the background application is an application placed in the background and cannot be directly interacted with.
  • the application can be determined whether the application is a foreground application or a background application according to whether the application is directly visible. Specifically, when the application is visible, it is a foreground application, and when the application is not visible, it is a background application.
  • the application when the interface of the application is displayed on the screen of the electronic device, the application is a foreground application; when the interface of the application is not displayed on the screen of the electronic device, the application is a background application.
  • the application interface does not include the top status bar and notification bar of the operating system.
  • the application may be determined whether the application is a foreground application or a background application according to whether the application satisfies certain conditions. Specifically, if the application satisfies any one of the following three conditions, the application is a foreground application; otherwise, the application is a background application.
  • the three conditions are: the application has a visible activity (Activity), the application has a foreground service, and other foreground applications are associated with the application.
  • Activity visible activity
  • the application has a foreground service
  • other foreground applications are associated with the application.
  • the electronic device may have various methods to determine whether an application has visible activities at a certain moment, and then determine whether the application is a foreground application or a background application, which is not limited herein.
  • whether the application is a foreground application or a background application can be determined according to the life cycle of the main activity of the application. Specifically, it is determined by judging whether the main activity of the application program executes the onStop method, the onResume method, the topResumedActivityChangedItem method and other methods.
  • the onStop method executes the onStop method
  • the application is considered as a background application
  • the activity of the application executes the onResume method and the topResumedActivityChangedItem method
  • the application is considered as a foreground application.
  • the concepts of terms such as the onStop method, the onResume method, and the topResumedActivityChangedItem method can refer to the text description in (2) Activity in the following term explanation, and will not be repeated here.
  • the application can be determined whether the application is a foreground application or a background application through the cpuset parameter. Specifically, when the cpuset parameter of the process corresponding to the application is background or key-background, the application is a background application; correspondingly, when the cpuset parameter of the process corresponding to the application is not background and key-background, This application is a foreground application.
  • an application in response to user actions, can transition between foreground and background applications.
  • the application when the user can see the interface of the application, the application is considered as a foreground application; when the user does not see the interface of the application, the application is considered as a background application.
  • the following takes the content shown in FIG. 1 as an example to introduce how to determine whether the application is a foreground application or a background application through whether the device displays the interface of the application.
  • FIG. 1 is an exemplary schematic diagram of the transition between a foreground application and a background application involved in the present application.
  • the electronic device displays the interface of the gallery.
  • the gallery is the foreground application, and the music and browser are background applications.
  • the user in response to the user's operation, the user can open the small window of the browser on the basis shown in Fig. 1(C), browse web pages and photos at the same time, and the browser will be displayed on the mobile phone at the same time.
  • the interface of the gallery at this time, the gallery and browser are disabled in the foreground, and the music is a background application.
  • the application when the user opens the video application, the application can be switched to the background after enabling the small window mode.
  • the small windows of the desktop and video applications are displayed on the electronic device.
  • the video application is a foreground application.
  • the user can see the interface of the music displayed by the electronic device, so the music is a foreground application; in the scene shown in FIG. 1(B), the user You can see the interface of the gallery displayed by the electronic device, so the gallery is the foreground application; in the scenario shown in (D) in Figure 1, the user can see the gallery and the browser interface displayed by the electronic device, so the gallery and the browser interface It is a foreground application; in the scenarios shown in (E) and (F) in FIG. 1 , the user can see the interface of the video software displayed by the electronic device, so the video software is a foreground application.
  • Activities are one of the basic components of the Android operating system and can be used to provide users with an interactive interface or view in an application.
  • an application can have multiple activities, the application loads activities through the task stack, and the activities at the top of the task stack are activities that the user can directly interact with.
  • the activity itself has a life cycle. By judging the life cycle of the main activity (Main Activity) of the application, it can be judged that the application is a foreground application or a background application.
  • the main activity is an activity designated by the developer when developing the application, and can be used to host the main interface of the application.
  • FIG. 2 is an exemplary schematic diagram of the life cycle of the activities involved in this application.
  • the developer of the application needs to implement at least seven callback methods (Method) when developing the activities of the application.
  • the callback method can also be called a callback function, which can be called to implement a specific function.
  • the seven callback methods are: onCreate callback method, onStart callback method, onResume callback method, onPaused callback method, onStop callback method, onDestroy callback method, and onRestart callback method. Activities can realize the life cycle of activities by calling the above seven callback methods.
  • the activity when the activity is created for the first time, the activity will call the onCreate callback method to complete the initialization of the activity; when the activity changes from invisible to visible, the activity will call the onStart callback method; when the activity is ready to interact with the user , the activity will call the onResume callback method; when the activity leaves the top of the task stack, the activity will call the onPause callback method to save some key data and release some resources; when the activity becomes completely invisible, the activity will call the onStop callback method; Before the activity destroys itself, the activity will call the onDestroy callback method to release resources; when the activity changes from the stopped state to the running state, the activity will call the onRestart callback method.
  • the application to which the activity belongs is a foreground application or a background application.
  • the application can be considered as a background application; correspondingly, when the main activity of the application executes After the onResume callback method, it can be considered that the application becomes the foreground application.
  • an activity management service (ActivityManagerService, AMS) provided by the operating system can be used to monitor the life cycle of the main activity of the currently running application, and then it can be determined through the activity management service that any application is currently in the foreground
  • the app is also a background app.
  • the developer of the application when developing the application, may add an interface in the life cycle of the main activity to transmit information to the choreographer or other modules and objects of the application. to determine whether the application is a foreground or background application.
  • Choreographer is a class in the operating system that requests a vertical sync signal and performs drawing operations in response to the requested vertical sync signal.
  • a class is a data structure that defines the state and behavior of an object.
  • the vertical synchronization signal is provided by the operating system and is used to coordinate and synchronize the operation of the choreographer and the operation of the SurfaceFlinger.
  • the choreographer When the application is started, the choreographer will be initialized, and the process of initializing the choreographer includes: the activity will generate an instantiated choreographer object according to the choreographer class.
  • the choreographer can go and perform drawing operations.
  • the drawing operation may include: the choreographer handles input event tasks, animation event tasks, layout event tasks, and submit event tasks.
  • the result of the drawing operation can be submitted to other modules of the application, so as to display the refreshed interface or view on the screen of the electronic device.
  • the number of choreographers can be related to the number of threads used by the application.
  • the thread is the smallest resource scheduled by the operating system.
  • the UI thread of an application will generate a choreographer bound to the thread, where the UI thread can also be called the main thread, which is mainly used to carry the computational overhead of interface display, update, and control interaction.
  • the choreographer When the application needs to refresh the interface or view, the choreographer will request a vertical synchronization signal (Vsync) from SurfaceFlinger to find a suitable timing for drawing operations. After the choreographer receives the vertical sync signal sent by SurfaceFlinger, it will start to perform the drawing operation. Among them, the choreographer will use the OnVsync callback method to receive the vertical synchronization signal, and the OnVsync callback method is the callback method provided by the choreographer's internal class FrameDisplayEventReceiver. After the choreographer successfully receives the vertical sync signal using the OnVsync callback method, it will notify the choreographer that the drawing operation can be started.
  • Vsync vertical synchronization signal
  • the frequency at which the choreographer requests the vertical synchronization signal from SurfaceFlinger remains unchanged.
  • SurfaceFlinger is a service provided by the bottom layer of the operating system, which is used to receive requests from choreographers of different applications, and distribute vertical synchronization signals to the applications in response to the request.
  • the generation of the vertical synchronization signal can be generated by software simulation, and can also be generated by the hardware of the electronic device.
  • the vertical sync signal can be generated by a hardware composer (Hardware Composer, HWC). After the HWC generates the vertical synchronization signal, it can send the vertical synchronization signal to SurfaceFlinger through the callback method, so SurfaceFlinger can forward the vertical synchronization signal to the choreographer. After the choreographer receives the vertical sync signal sent by SurfaceFlinger, it will start to perform the drawing operation.
  • the frequency at which the electronic device generates the vertical synchronization signal may be related to the refresh rate of the screen of the electronic device. For example, when the frequency at which the electronic device generates the vertical synchronization signal is 90 Hz, the screen refresh rate of the electronic device may be 90 Hz.
  • the application will store the four event tasks in the four singly linked lists (CallbackQueue) internally configured by the choreographer in chronological order.
  • the choreographer After receiving the vertical synchronization signal, the choreographer will process the four event tasks corresponding to the current time through the doFrame callback method.
  • the four event tasks are CALLBACK_INPUT, CALLBACK_ANIMATION, CALLBACK_TRAVERSAL and CALLBACK_COMMIT.
  • the doFrame callback method includes four doCallBacks callback methods, which are respectively used to process the above four event tasks.
  • CALLBACK_INPUT is the input event task, wherein the input event task is the data that the application encapsulates and distributes the input event to the choreographer.
  • the input event can be the interaction between the user and the application received by the application.
  • the input event can be the user clicking on an interactive control in the application, or the user sliding in the application (slide up and down, swipe left and right, etc.), or the user's voice input, etc., which are not limited here.
  • the application After determining the input event, the application performs preliminary processing on the input event, generates an input event task corresponding to the input event, and delivers the input event task to the choreographer.
  • CALLBACK_ANIMATION is the animation event task
  • the animation event task is the data required for the application to calculate the animation (Animation).
  • the animation may include: View Animation, Frame Animation (Drawable Animation), Property Animation, and the like.
  • CALLBACK_TRAVERSAL is a layout event task, which is used for participating choreographers to calculate the drawing data of the view or interface.
  • the drawing data determined by the calculation will be submitted to other modules of the application to determine the width, height, position, shape, etc. of the content displayed in the view.
  • CALLBACK_COMMIT is the submission event task, which is used to mark that the choreographer has completed the drawing operation corresponding to a certain vertical synchronization signal.
  • FIG. 3 is an exemplary schematic diagram of four kinds of event tasks involved in this application.
  • the main interface of an application program is shown in (A) of FIG. 3 , wherein the main interface includes three rectangular controls, namely, the No. 1 rectangular control 301 , the No. 2 rectangular control 302 , and the No. 3 rectangular control 303 .
  • the rectangle control 301 of No. 1 and the rectangular control 302 of No. 2 can correspond to the click operation of the user, and the rectangular control 303 of No. 3 can display the current number to the user.
  • the rectangle control 301 of No. 1 the number displayed by the rectangle control 303 of No. 3 will increase by 1; when the user clicks the rectangle control 302 of No. 2, the number displayed by the rectangle control 303 of No. 3 will decrease by 1.
  • the rectangle control clicked by the user will present a gradient gray animation to inform the user that the click is successful.
  • the content shown in (B) in FIG. 3 is the interface displayed after the user clicks the rectangle control 302 No. 2 .
  • the rectangle control 302 of No. 2 turns gray and the number displayed by the rectangular control 303 of No. 3 changes from 4 to 3.
  • the click event on the rectangle control 301 of No. 1 or the rectangular control 302 of No. 2 is an input event.
  • the screen of the electronic device acquires the input event, it reports it to the corresponding driver, and distributes it to the corresponding application program.
  • the application obtains the input event, it will package the event into an input event task and distribute it to the choreographer.
  • the gradient gray animation that needs to be rendered is an animation event, which is packaged as an animation event task and distributed to the choreographer.
  • the layout event task is used to determine the position, size, and shape of the rectangle control 302 No. 2 in the view.
  • the submit event task is used to determine the completion of a drawing operation.
  • FIG. 4 is an exemplary schematic diagram of the drawing operation performed by the choreographer involved in the present application.
  • the main activity of the application will execute callback methods such as the onStart callback method and the onResume callback method according to the life cycle of the activity.
  • callback methods such as the onStart callback method and the onResume callback method according to the life cycle of the activity.
  • the application executes the onResume callback method, if it needs to display a visual interface or view, it can use the Activity.makeVisible callback method to draw the interface or view.
  • the choreographer is initialized during the process of drawing the interface or view using the Activity.makeVisible callback method.
  • the choreographer After the choreographer is initialized, when the application needs to refresh the view, it sends a draw request to the choreographer using the scheduleTraversals callback method.
  • the choreographer awakened by the scheduleTraversals callback method will continuously receive and use different singly linked lists to store the corresponding event tasks in chronological order.
  • the choreographer will request the vertical synchronization signal from SurfaceFlinger.
  • the choreographer can perform the drawing operation through the doFrame callback method, that is, through the doFrame callback method to process the input event task, animation event task, layout event task and submit event task.
  • the operating system does not provide a callback method to determine whether the application requesting the vertical synchronization signal really needs to perform a drawing operation. After any application requests the vertical synchronization signal from SurfaceFlinger, the vertical synchronization signal will be distributed.
  • a user uses an electronic device such as a smartphone, multiple applications can be opened. However, limited by the size of the screen of the electronic device, at a certain moment, the user can only display one or a few applications on the screen for interaction (such as split screen), and other applications will be turned into background applications. For any background application, since the background application has not been destroyed and still holds the choreographer, when the background application performs some operations in the background, the choreographer will be triggered to perform a drawing operation.
  • the background application has no view or interface to display to the user, the result of the background application performing the drawing operation is not perceived by the user.
  • the choreographer of the background application is only dispatched to the animation event task, the background application actually only handles the animation event task when performing the drawing operation.
  • FIG. 5 is an exemplary schematic diagram of drawing operations performed by a foreground application and a background application involved in the present application.
  • FIG. 5 there are multiple applications running on the electronic device, including: gallery, music, and browser.
  • Gallery is a foreground application
  • Music and Browser are background applications.
  • the gallery, music, and browser choreographers all receive a vertical sync signal, and in response to the vertical sync signal, the gallery, music, and browser choreographers all perform drawing operations.
  • the computing resources of the drawing operation performed by the choreographer are provided by the UI thread.
  • the first system scheduling method related to background applications mainly allocates system resources to foreground applications and background applications in a differentiated manner by combining the characteristics of the CPU hardware architecture of electronic devices:
  • FIG. 6 is a schematic diagram of an example of a system scheduling method of a background application involved in the present application.
  • the Kirin 9000 includes a large core of the A77 architecture, three medium cores of the A77 architecture, and four small cores of the A55 architecture.
  • the large core is preferentially used to carry the computing resources of the application
  • the medium and small cores are preferentially used to carry the computing resources of the application.
  • the system scheduling method does not prevent background applications from performing invalid drawing operations, which wastes system resources and increases power consumption of electronic devices.
  • the second system scheduling method for background applications mainly freezes background applications in time, so that background applications cannot occupy system resources:
  • FIG. 7 is a schematic diagram of another example of a system scheduling method for a background application involved in the present application.
  • the electronic device may freeze the application.
  • the application needs to request system resources from the electronic device to perform a drawing operation, but the electronic device will not allocate system resources to the frozen application, so the frozen application will not perform an invalid drawing operation.
  • frozen background applications are often awakened by broadcasts, services, etc., and the awakened background applications will still perform invalid drawing operations, occupy system resources, and increase power consumption of electronic devices.
  • the browser application when the browser application is switched to the background, the browser application is frozen.
  • the frozen browser application cannot occupy system resources of the electronic device, and therefore cannot perform drawing operations.
  • the frozen browser application is often awakened by broadcasts and services of the operating system or other applications, and the awakened browser application still performs invalid drawing operations.
  • the frozen background application is often awakened, and the awakened background application can still perform invalid drawing operations, occupying system resources and increasing the power consumption of the electronic device.
  • the present application provides a method and electronic device for performing drawing operations by applications.
  • the application determines the background drawing frequency according to the drawing frequency limit policy, and intercepts the vertical synchronization signal or the choreographer to process the animation event task according to the determined background drawing frequency, which effectively reduces the background application performing invalid drawing operations.
  • the occupation of system resources by background applications is reduced, and the power consumption of the electronic device is reduced.
  • the electronic device in the embodiment of the present application may be a mobile electronic device such as a mobile phone and a tablet computer, and may also be a device such as a smart TV, a personal computer (personal computer, PC), which is not limited herein.
  • a mobile electronic device such as a mobile phone and a tablet computer
  • a device such as a smart TV, a personal computer (personal computer, PC), which is not limited herein.
  • FIG. 8 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may have more or fewer components than those shown in the figures, may combine two or more components, or may have different component configurations.
  • the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the SIM interface can be used to communicate with the SIM card interface 195 to realize the function of transferring data to the SIM card or reading data in the SIM card.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as fifth-generation DDR SDRAM is generally called DDR5 SDRAM), etc.;
  • SRAM static random-access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • fifth-generation DDR SDRAM is generally called DDR5 SDRAM
  • Non-volatile memory may include magnetic disk storage devices, flash memory.
  • Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cell (SLC), multi-level memory cell (multi-level memory cell, SLC) according to the level of storage cell potential.
  • cell, MLC multi-level memory cell
  • TLC triple-level cell
  • QLC quad-level cell
  • UFS universal flash storage
  • eMMC embedded multimedia memory card
  • the random access memory can be directly read and written by the processor 110, can be used to store executable programs (such as machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • the non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
  • the external memory interface 120 can be used to connect an external non-volatile memory, so as to expand the storage capacity of the electronic device 100 .
  • the external non-volatile memory communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video, etc. files in external non-volatile memory.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
  • the processor 110 may call the computer instructions stored in the internal memory 121 to cause the electronic device 100 to execute the method for performing the drawing operation by the application in the embodiment of the present application.
  • FIG. 9 is another schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 includes:
  • An input device 201, an output device 202, a processor 203, and a memory 204 (wherein the number of processors 203 in the electronic device 100 may be one or more, and one processor 203 is taken as an example in FIG. 9).
  • the input device 201, the output device 202, the processor 203, and the memory 204 may be connected by a bus or other means.
  • the processor 203 causes the electronic device 200 to execute the method for performing the drawing operation by the application in the embodiment of the present application by invoking the operation instruction stored in the memory 204 .
  • FIG. 10 is a schematic block diagram of a software structure of the electronic device 100 in this embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, from top to bottom, the application layer, the application framework layer, the runtime and system libraries, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications (also referred to as applications) such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
  • applications also referred to as applications
  • the application layer may also include performance optimization applications.
  • the performance optimization application may provide a visual interface or view, or may not provide a visual interface or view.
  • the performance optimization application can be launched automatically without user's action.
  • There is a drawing frequency limit strategy in the performance optimization application which is used to determine the corresponding relationship between the application and the background drawing frequency.
  • the performance optimization application may access the server through the network to determine the parameters in the drawing frequency limiting strategy, or may read a local configuration file of the operating system to determine the parameters in the drawing frequency limiting strategy.
  • the performance-optimized application is configured with an interface, and other applications can access the performance-optimized application through the interface to determine their own background drawing frequency.
  • the application after the application is started, it will generate a drawing frequency limiting module to read the local configuration file of the system to obtain the drawing frequency limiting policy, and determine its own background drawing frequency according to the drawing frequency limiting policy.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, a Local Profile Assistant (LPA), and the like.
  • a window manager a content provider
  • a view system a phone manager
  • a resource manager a notification manager
  • LPA Local Profile Assistant
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the management of call status including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications from applications running in the background, and can also display notifications on the screen in the form of a dialog interface. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the application framework layer may also include a performance optimization system, and a drawing frequency limit strategy may exist in the performance optimization system.
  • the performance optimization system can be directly accessed through the callback method provided by the operating system to determine the background drawing frequency of the application itself.
  • the runtime includes core libraries and virtual machines.
  • the runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one is the functional functions that the java language needs to call, and the other is the core library.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library Media Libraries
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager is used to manage the display subsystem and provides a fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 3D) layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, sensor drivers, and virtual card drivers.
  • the choreographer involved in the present application may be located in the view system of the application framework layer.
  • the application program calls the choreographer in the view system to generate a choreographer object unique to the application program, and perform drawing operations.
  • choreographers can use the surface manager and 2D graphics engine in the core library to implement drawing operations through callback methods.
  • the server can update the configuration file in the new version of the file to update the drawing frequency limit policy.
  • FIG. 11 is a schematic block diagram of another software structure of the electronic device 100 in this embodiment of the present application.
  • the system is divided into four layers, which are, from top to bottom, an application layer, a framework layer, a system service library, and a kernel layer.
  • the application layer includes system applications and third-party non-system applications.
  • the system application may include a performance optimization application.
  • the performance optimization application may provide a visual interface or view, or may not provide a visual interface or view.
  • the performance optimization application can be launched automatically without user's operation.
  • There is a drawing frequency limit strategy in the performance optimization application which is used to determine the corresponding relationship between the application and the background drawing frequency.
  • the performance optimization application may access the server through the network to determine the parameters in the drawing frequency limiting strategy, or may read a local configuration file of the operating system to determine the parameters in the drawing frequency limiting strategy.
  • the performance-optimized application is configured with an interface, and other applications can access the performance-optimized application through the interface to determine their own background drawing frequency.
  • the application after the application is started, it will generate a drawing frequency limiting module to read the local configuration file of the system to obtain the drawing frequency limiting policy, and determine its own background drawing frequency according to the drawing frequency limiting policy.
  • the framework layer provides multi-language user program frameworks and capability frameworks such as JAVA/C/C++/JS for applications in the application layer, as well as multi-language framework APIs open to the outside world for various software and hardware services.
  • the system service layer includes: system basic capability subsystem set, basic software service subsystem set, enhanced software service subsystem set, and hardware service subsystem set.
  • the system basic capability subsystem set supports the operation, scheduling, and migration of the operating system on multiple devices.
  • the system basic capability subsystem set may include: distributed soft bus, distributed data management, distributed task scheduling, common basic subsystem, etc.
  • the system service layer and the framework layer jointly realize the multi-mode input subsystem, the graphics subsystem and so on.
  • a drawing frequency limit policy may exist in the graphics subsystem.
  • the graphics subsystem can be directly accessed through a callback method provided by the operating system to determine the background drawing frequency of the application itself.
  • the choreographers involved in this application may reside in the graphics subsystem. When the application needs to refresh the interface, the application calls the choreographer in the view system, generates the choreographer object unique to the application, and performs the drawing operation.
  • the set of basic software service subsystems provides common and general software services for the operating system, and may include: an event notification subsystem, a multimedia subsystem, and the like.
  • the enhanced software service subsystem set provides differentiated software services for different devices, and may include: IOT proprietary service subsystem.
  • the hardware service subsystem set provides hardware services for the operating system, and may include: IOT proprietary hardware service subsystem.
  • the kernel layer includes the kernel abstraction layer and the driver subsystem.
  • the kernel abstraction layer includes a variety of kernels, and by shielding the differences between multiple kernels, it provides basic kernel capabilities for the upper layer, such as thread/process management, memory management, file system, network management, etc.
  • the driver subsystem provides software developers with a unified peripheral access capability and a driver development and management framework.
  • the software structure of the electronic device can be divided in other ways according to the operating system.
  • the following describes a method for performing a drawing operation by an application provided by the present application.
  • FIG. 12 is an exemplary schematic diagram of a method for performing a drawing operation by an application provided by the present application.
  • the method for performing a drawing operation by an application provided by the present application may include:
  • S1201 The application determines the background drawing frequency according to the frequency limit policy.
  • the application determines the background drawing frequency according to the frequency limit policy.
  • the application needs to determine when the application itself transitions from a foreground application to a background application.
  • the operating system provides a drawing frequency limit module to determine whether the application is a foreground application or a background application.
  • the drawing frequency limiting module can directly monitor the life cycle of the main activity of the application program through the configuration interface, and then can determine the running state of the application program, that is, whether the application program is a foreground application or a background application.
  • the drawing frequency limiting module may determine the running state of the application through the activity management service, that is, determine whether the application is a foreground application or a background application.
  • Background draw frequency refers to how often the app's choreographer performs draw operations after the app becomes a background app.
  • the drawing frequency limitation policy is pre-configured, and is used to set the background drawing frequency when different applications become background applications.
  • the draw frequency limit policy can be configured in the draw frequency limit module, where the draw frequency limit module can communicate with the application's choreographer through an interface.
  • the drawing frequency limiting module may be preconfigured for the operating system, that is, the drawing frequency limiting module may be configured inside each application program.
  • the drawing frequency limiting module can be configured in the service of the operating system/or in other applications that keep running all the time, and the application can access the drawing frequency limiting module through the interface to determine the application's own background drawing frequency.
  • the background drawing frequency determined by the application program is less than the generation frequency (or screen refresh rate) of the vertical synchronization signal.
  • the application when the developer of the application develops the application, it may be necessary to pass some parameters to the activity or other modules of the application by means of the drawing operation performed by the choreographer. That is, when the application performs a drawing operation for purposes other than interface refresh.
  • the application when the application is a background application, the frequency at which the background application requests the vertical synchronization signal is lower than the generation frequency (or screen refresh rate) of the vertical synchronization signal.
  • the background drawing frequency determined by the application in step S1201 may be less than or equal to the generation frequency (or screen refresh rate) of the vertical synchronization signal.
  • the background drawing frequency determined by the application according to the frequency limit policy may be equal to the vertical The frequency at which the sync signal is generated (or screen refresh rate).
  • the application may determine the background drawing frequency of the application itself when it is started or after it is started.
  • the drawing frequency limiting module provides the application with an interface for modifying its own background drawing frequency, and through this interface, the application can configure its own background drawing frequency.
  • Table 1 is a schematic table for drawing a frequency limiting strategy in this embodiment of the present application.
  • the drawing frequency limit strategy configures the background drawing frequency of music to be 1/6 of the frequency of the vertical sync signal; and when the gallery is transformed into a background application, the drawing frequency limit strategy configures the The background drawing frequency is 0.
  • drawing frequency limit strategy can configure different background drawing frequencies for different applications or different types of applications (social applications, game applications, other applications, etc.) Power consumption.
  • the user can personalize the parameters in the drawing frequency limiting policy in combination with the performance and usage requirements of the electronic device.
  • FIG. 13 is an exemplary schematic diagram of the interface for drawing a frequency limit policy provided by the present application.
  • the user can select an application by long-pressing on the main interface of the electronic device, such as selecting "Huawei App Market”; further, as shown in (B) of Figure 13, the user After long pressing to select an application, the information option can be selected by clicking; further, as shown in (C) in Figure 13, after the user selects the information option, the relevant information of the application can be seen, including the application responsible for scheduling further, as shown in (D) in Figure 13, the user can configure the drawing limit frequency corresponding to the application in the drawing frequency limit policy by configuring the specific parameters in the power saving management option; further, As shown in (E) of FIG. 13 , the user can specifically configure the background drawing frequency when the application is transformed into a background application.
  • the application determines the background drawing frequency of the application according to the parameters in the preconfigured drawing frequency limit policy.
  • S1202 The application performs a drawing operation according to the background drawing frequency.
  • the choreographer of the application intercepts the vertical synchronization signal or intercepts the choreographer's drawing operation according to the background drawing frequency, so that the choreographer performs invalid drawing operations according to the background drawing frequency.
  • FIG. 14 is an exemplary schematic diagram of a method for intercepting a choreographer from receiving a vertical synchronization signal in an embodiment of the present application.
  • the choreographer of the application first determines whether the application to which the choreographer belongs is a foreground application or a background application. If the application is a foreground application, the default drawing operation is performed; if the application is a background application, the vertical synchronization signal is recorded as the K-th vertical synchronization signal after the application is transformed into a background application, and K and the K-th vertical synchronization signal are recorded. The size of a threshold. If K is less than the first threshold, the default drawing operation is skipped, and if K is equal to the first threshold, K is cleared and counted again, and the default drawing operation is performed. Among them, skipping the default drawing operation may mean that the choreographer does not call the doFrame callback method, thereby realizing the interception of the drawing operation.
  • the electronic device may determine the background drawing frequency or the first threshold of the application according to the drawing frequency limiting policy. After the electronic device determines the background drawing frequency of the application according to the drawing frequency limit policy, it can determine the first threshold corresponding to the pair of background drawing frequencies; when the electronic device determines the first threshold of the application according to the drawing frequency limit policy, it can Determine the background drawing frequency corresponding to the first threshold.
  • the application determines the background drawing frequency to be 18Hz according to the drawing frequency limit policy. Then, the electronic device can determine the first threshold corresponding to the background drawing frequency of 18 Hz.
  • the first threshold may be the generation frequency of the vertical synchronization signal (or the screen refresh rate) divided by the background application drawing frequency of the application, that is, the first threshold is 5. Then, when the application becomes a background application, the choreographer of the application only executes a default drawing operation every time it receives 5 vertical synchronization signals.
  • the electronic device may determine that the background drawing frequency corresponding to the first threshold 5 is 18 Hz.
  • the first threshold may be a relatively large integer, such as 2 10 .
  • the interval for the application to perform the drawing operation is 1/90 second, that is, the application will perform the drawing operation after receiving the vertical synchronization signal;
  • the interval for the application to perform drawing operations is 5/90 seconds, that is, the application performs the default drawing operation only after receiving 5 vertical synchronization signals. For example, an app starts at 0th second, and every 1/90th of a second, the app's choreographer requests a vertical sync signal. If at 0 seconds, the application becomes a background application.
  • the drawing operation performed when the application is a background application is an invalid drawing operation.
  • FIG. 15 is an exemplary schematic diagram of a method for intercepting a choreographer to process an animation event task in an embodiment of the present application.
  • the choreographer of the application uses the OnVsync callback method to receive the vertical sync signal and starts to perform the drawing operation.
  • the drawing operation includes processing input event task, animation event task, layout event task and submitting event task. Because the choreographer of the background application does not get the input event task, the layout event task and the processing event task. Therefore, it is possible to intercept the choreographer to process the animation event task, and then intercept the choreographer to perform invalid drawing operations.
  • the application program determines whether the application program to which the choreographer belongs is a background application before starting to perform a drawing operation. If the application to which the choreographer belongs is a foreground application, the default drawing operation can continue to be performed; if the application to which the choreographer belongs is a background application, the processing of the animation event task can be skipped in the doFrame callback method Alternatively, the drawing operation can be ended directly, so that the choreographer does not perform invalid drawing operations.
  • the background drawing frequency when the background drawing frequency is 0, it can be determined at the beginning of the choreographer's doFrame callback method whether the application to which the choreographer belongs is a foreground application or a background application. If the judgment result is a background application, the choreographer can skip executing the doCallbacks callback method that handles the animation event task in the doFrame callback method. In this case, although the choreographer will still call the doCallbacks callback method to process the input event task, layout event task, and submit event task, since the input event task, layout event task, and submit event task are empty, you can skip the The animation event task handled by the choreographer is equivalent to intercepting the choreographer's execution of this invalid drawing operation.
  • the default drawing operation is performed.
  • the background drawing frequency is greater than 0, it is also possible to reduce the frequency of invalid drawing operations performed by the background application as shown in (B) in FIG.
  • the vertical synchronization signal received by the choreographer is the Kth vertical synchronization signal.
  • K is less than the first threshold, the choreographer is allowed to skip the task of processing animation events; when K is equal to the first threshold, the choreographer is allowed to process the task of animation events, and K is cleared and counted again.
  • the minimum time interval T1 can be determined according to the background drawing frequency, and Determine the drawing operations that need to be intercepted according to T1, and determine the drawing operations that can be performed according to T1.
  • the frequency of the application's choreographer's request for a vertical synchronization signal is less than the generation frequency of the vertical synchronization signal (or the screen refresh rate), it can be considered that the application is due to a non-refresh interface.
  • the purpose is to perform drawing operations.
  • the choreographer of the application program receives the first vertical synchronization signal, the default drawing operation is performed; when the application program receives a non-first vertical synchronization signal, the vertical synchronization can be judged.
  • the time interval between the signal and the last vertical sync signal is the time interval between the signal and the last vertical sync signal.
  • the drawing operation corresponding to the vertical synchronization signal is intercepted; if the time interval is greater than the time interval threshold corresponding to the background drawing frequency, the drawing operation corresponding to the vertical synchronization signal is executed.
  • the following takes the content shown in FIG. 16 as an example to specifically introduce how to intercept an invalid drawing operation when an application performs a drawing operation for the purpose of non-refreshing the interface.
  • FIG. 16 is an exemplary schematic diagram of intercepting a choreographer's drawing operation in an embodiment of the present application.
  • the app is drawing for non-refresh interface purposes.
  • the frequency at which the application program requests the vertical synchronization signal is the number of times the application program requests the vertical synchronization signal in a unit time.
  • the application After the application receives the vertical synchronization signal at the 2/90th second, it does not receive the vertical synchronization signal at the 3rd/90th second, it can be determined that the application program requests the drawing operation for the purpose of non-refreshing the interface. .
  • the app's choreographer receives Vsync signal 1, and before the 2/90th second, the app's choreographer does not receive other Vsync signals, so the choreographer can
  • the drawing operation corresponding to the vertical synchronization signal 1 is performed at the 2/90 second; at the 6/90 second, the choreographer of the application receives the vertical synchronization signal 2, because the choreographer of the application received the vertical synchronization signal last time.
  • the synchronization signal 1 is at the 2/90 second, and the time interval is 4/90 second, which is greater than T1, so the choreographer can perform the drawing operation corresponding to the vertical synchronization signal 1 at the 6/90 second.
  • the choreographer of the application receives the vertical sync signal 3, since the last time the app's choreographer received the vertical sync signal 1 at the 6th/90th second, the time interval is 1/90th of a second , less than T1, so the drawing operation of the application will be intercepted.
  • the choreographer is intercepted in/before the OnVsync method to receive the vertical synchronization signal, thereby invalidating the execution of the application after it becomes a background application.
  • the frequency of drawing operations is reduced.
  • the application program by intercepting the choreographer’s request for a vertical synchronization signal from SurfaceFlinger, the application program becomes a background application and performs an invalid drawing operation. frequency is reduced.
  • the choreographer requests the vertical synchronization signal from SurfaceFlinger by intercepting the choreographer, or intercepting the choreographer to receive the vertical synchronization signal before the OnVsync method, the choreographer needs to be decoupled so that only the choreographer is prevented from performing the drawing operation. , without affecting the normal work of other functions of the choreographer.
  • the application program by deleting the data in the singly linked list that stores the animation event task, the application program becomes a background application and executes invalid data. The frequency of drawing operations is reduced.
  • the method for performing a drawing operation by an application in this embodiment of the present application is exemplarily described below by taking the content shown in FIGS. 16 and 17 as examples in conjunction with the method for performing a drawing operation by an application shown in FIG.
  • FIG. 17 is an exemplary schematic diagram of an invalid drawing operation scenario of controlling a background application in an embodiment of the present application.
  • the activity management service can obtain the registration information of the application.
  • Registration information is used to uniquely identify the application.
  • the registration information may be the package name of the application or the process name of the application, which is not limited herein.
  • the application After the user launches the application, the application initializes at least one choreographer and draw frequency limiting module.
  • the drawing frequency limiting module can call back the method in the activity management service through the interface, and then determine the running state of the application, that is, whether the application is a foreground application or a background application. Moreover, the drawing frequency limit module can also obtain the registration information of the application through the activity management service.
  • the registration information is used to uniquely identify the application.
  • the registration information may be the package name of the application, or the registration information may be the process name corresponding to the application, which is not limited herein.
  • the choreographer can perform default drawing operations. Or, before performing the default drawing operation, the choreographer asks the drawing frequency limit module whether to allow this drawing.
  • the drawing frequency limit module will always allow the choreographer to perform the default drawing operation until the background application identification is received.
  • the activity management service determines that the application is transformed into Background application. Active service management informs the drawing rate limit module that the application becomes a background application. After the activity management service determines that the application is a background application, it will send the background application identification to the drawing frequency limit module.
  • the background application identifier may include registration information of the application. After receiving the background application identifier, the drawing frequency limiting module can determine the background drawing frequency according to the drawing frequency limiting policy.
  • the app's choreographer When the app becomes a background app, since the app is not frozen, the app's choreographer sends a request for vertical sync to SurfaceFlinger. And in response to an app's request, SurfaceFlinger sends a vertical sync signal to the app's choreographer.
  • the choreographer of the application After receiving the vertical sync signal, the choreographer of the application will send request drawing information to the drawing frequency limit module before executing the drawing operation.
  • the choreographer receives the drawing permission request from the drawing frequency limit module, the choreographer continues to perform the invalid drawing operation; and when the choreographer does not receive the drawing permission request from the drawing frequency limit module, the choreographer directly End this invalid drawing operation.
  • the drawing frequency limiting module determines whether to allow the choreographer to perform this invalid drawing operation according to the background drawing frequency, and can refer to the content shown in FIG. 12 above, which will not be repeated here.
  • drawing frequency limit module can be located inside the choreographer of the application, or it can be located in the service of the operating system.
  • the activity management service can obtain the package name of the music as com.android.mediacenter and the process name as HWMusic.
  • the activity management server sends the music's package name or/and process name to the drawing frequency limit module.
  • the drawing frequency limit module determines that the background drawing frequency of music is 10Hz according to the current vertical synchronization signal frequency (60Hz) and the registration information of the music.
  • the activity management server sends the background application identification to the drawing frequency limit module.
  • the choreographer requests the drawing frequency limit module for drawing.
  • the drawing frequency limit module allows the choreographer to perform a drawing operation once every time it receives five drawing requests from the choreographer, so that the frequency of the music choreographer performing an invalid drawing operation is reduced to 10hz.
  • the activity management server When the user switches the music from the background to the foreground, the activity management server notifies the drawing frequency limit module that the music is turned into a foreground application. At this point, every time the drawing frequency limit module receives a drawing request from the choreographer, it will run the choreographer to perform drawing operations.
  • FIG. 18 is another exemplary schematic diagram of an invalid drawing operation scenario of controlling a background application in an embodiment of the present application.
  • the choreographer of the application will be initialized, and during the process of initializing the choreographer, the drawing frequency in the choreographer will be initialized Restricted modules.
  • the drawing frequency limiting module determines the background drawing frequency of the application according to the drawing frequency limiting policy.
  • the activity management service transmits the background application identifier to the drawing frequency limit module.
  • the drawing frequency limiting module determines that the application is a background application.
  • the choreographer can use the doFrame method to perform drawing operations after requesting and receiving the vertical sync signal.
  • the drawing frequency limit module can intercept the choreographer's task of processing animation events, so that the choreographer essentially does not perform this invalid drawing operation.
  • the activity management service sends the foreground application ID to the application's choreographer.
  • the drawing frequency limiting module determines that the application to which the choreographer belongs is changed to the foreground application, and then does not intercept the choreographer to process the animation event task, so that the choreographer can perform the default drawing operation.
  • the term “when” may be interpreted to mean “if” or “after” or “in response to determining" or “in response to detecting" depending on the context.
  • the phrases “in determining" or “if detecting (the stated condition or event)” can be interpreted to mean “if determining" or “in response to determining" or “on detecting (the stated condition or event)” or “in response to the detection of (the stated condition or event)”.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored on or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted over a wire from a website site, computer, server or data center (eg coaxial cable, optical fiber, digital subscriber line) or wireless (eg infrared, wireless, microwave, etc.) to another website site, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media integrated.
  • the available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
  • the process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium.
  • the program When the program is executed , which may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)
  • Digital Computer Display Output (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本申请提供应用执行绘制操作的方法及电子设备,其中应用执行绘制操作的方法包括:确定应用程序的后台绘制频率,当该应用程序转变为后台应用时,通过拦截该应用程序的绘制操作,使该应用程序以后台绘制频率执行绘制操作,降低了后台应用执行无效绘制操作的频率。本申请提供的应用执行绘制操作的方法,可以降低后台应用对系统资源的占用,并且可以降低电子设备的耗电。

Description

应用执行绘制操作的方法及电子设备
本申请要求于2021年03月24日提交中国专利局、申请号为202110316341.X、申请名称为“应用执行绘制操作的方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子技术领域,尤其涉及应用执行绘制操作的方法及电子设备。
背景技术
随着智能手机、平板电脑、可穿戴设备等电子设备的普及,用户在使用电子设备如智能手机时,往往不经意间就开启了多个乃至数十个应用程序。而在使用时,智能设备的屏幕只能同时展现少数几个应用程序在屏幕上去供用户进行浏览、交互。用户如果没有及时彻底关闭位于后台的应用程序,在使用一段时间后,会感觉到明显的卡顿、发热以及耗电增加。
这是因为,应用程序从前台应用变为后台应用后,仍然会占用电子设备的系统资源,如内存、CPU计算负载等,并且进行绘制操作。对于后台应用来说,由于后台应用并不为用户提供可视化的界面或视图,进行的绘制操作为无效的绘制操作。但是,该无效的绘制操作仍然会占用电子设备的系统资源,导致电子设备的耗电增加以及挤占前台应用的系统资源。
为了降低后台应用对系统资源的占用,当应用程序变为后台应用时或者一段时间后,电子设备可以主动的冻结该应用,使该应用不会持续的占用系统资源。
但是,被冻结的应用常常会被广播、服务等唤醒,唤醒后的后台应用与其他未被冻结的后台应用一样,仍然会占用系统资源,进行无效的绘制操作,导致后台应用挤占前台应用的系统资源,并且导致电子设备的耗电增加。
发明内容
本申请实施例提供了一种应用执行绘制操作的方法,通过拦截同步垂直信号或者拦截编舞者(Choregrapher)中的回调方法,或者删除编舞者保存的动画事件任务,降低后台应用执行无效的绘制操作的频率,进而减少了后台应用对系统资源的占用,使得电子设备的耗电降低。
第一方面,本申请提供了一种应用执行绘制操作的方法,该方法包括:电子设备启动第一应用程序;当该第一应用程序为前台应用时,该电子设备以第一频率执行绘制操作,该绘制操作用于为该第一应用程序绘制视图;当该第一应用程序从前台应用切换为后台应用后,该电子设备以第二频率执行该绘制操作,该第二频率小于该第一频率;其中,该第一频率为该第一应用程序接收垂直同步信号的频率。
在上述实施例中,电子设备确定应用程序从前台应用转变为后台应用后,降低应用程序的绘制频率,并且绘制频率低于应用程序接收垂直同步信号的频率,能够降低后台应用对系统资源的占用,并且可以降低电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,该电子设备指示该第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
在上述实施例中,电子设备通过指示应用程序的编舞者只响应部分接收到的垂直同步信 号,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,该电子设备指示该第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
在上述实施例中,电子设备通过指示应用程序的编舞者只处理接收到的垂直同步信号中部分垂直同步信号对应的动画事件任务,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,该电子设备删除该第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
在上述实施例中,电子设备通过删除应用程序的编舞者保存的动画事件任务,使得后台应用执行的绘制操作为空操作,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,该N与该K的比值对应于该第二频率与该第一频率的比值。
结合第一方面的一些实施例,在一些实施例中,该N与该K的比值等于该第二频率与该第一频率的比值。
结合第一方面的一些实施例,在一些实施例中,第一应用程序从前台应用切换为后台应用后,当应用程序没有以该第一频率接收垂直同步信号,而是以该第三频率接收垂直同步信号时,该电子设备以低于第四频率的频率执行该绘制操作,该第三频率小于该第一频率,该第四频率小于等于该第三频率并且大于0。
在上述实施例中,允许应用程序以不超过某个值的频率去执行绘制操作,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,当该第一应用程序接收第一垂直同步信号时,该电子设备确定该第一应用程序接收该第一垂直同步信号与该第一应用程序上一次执行绘制操作时间之间的时间差是否小于该第四频率的倒数;若是,该电子设备拦截第一绘制操作,该第一绘制操作为该第一应用程序响应于第一垂直同步信号后执行的绘制操作;若否,该电子设备执行该第一绘制操作。
在上述实施例中,当应用程序出于非刷新界面的目的执行绘制操作时,允许应用程序以不超过某个值的频率去执行绘制操作,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。并且,在系统的封闭性和性能之间取得动态了平衡。
结合第一方面的一些实施例,在一些实施例中,该电子设备根据绘制频率限制策略和该第一应用程序确定该第二频率。
在上述实施例中,电子设备可以根据绘制频率限制策略确定不同应用程序的执行绘制操作的频率,有助于同时实现系统资源的差异化分配,并且降低了电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,该电子设备根据活动管理服务和/或该第 一应用程序的进程的cpuset参数确定该第一应用程序为前台应用或者后台应用。
在上述实施例中,可以根据活动管理服务和/或应用程序的进程的cpuset参数确定应用程序是否从前台应用转变为后台应用,进而可以提高后台应用的识别准确性,更精确的降低后台应用的绘制操作的执行频率,进而降低电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,该N等于0。
在上述实施例中,当应用程序为后台应用时,电子设备可以指示应用程序不执行绘制操作,使得应用程序释放系统资源,进而降低电子设备的发热、电量消耗。
结合第一方面的一些实施例,在一些实施例中,该N等于K。
在上述实施例中,当应用程序为后台应用时,每当应用程序收到垂直同步信号时/后,可以删除该应用程序保存的动画事件任务,使得应用程序执行的绘制操作全部为空操作,进而释放更多的系统资源,进而降低电子设备的发热、电量消耗。
第二方面,本申请提供了一种应用执行绘制操作的方法,该方法包括:电子设备启动第一应用程序;该电子设备显示该第一应用程序的界面,该电子设备以第一频率执行绘制操作,该绘制操作用于为该第一应用程序绘制视图;该电子设备关闭该第一应用程序的界面的显示,该电子设备以第二频率执行该绘制操作,该第二频率小于该第一频率;其中,该第一频率为该第一应用程序接收垂直同步信号的频率。
在上述实施例中,当应用程序关闭界面显示时,没必要通过执行绘制操作去刷新界面,电子设备可以降低应用执行绘制操作的频率,能够降低后台应用对系统资源的占用,并且可以降低电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该电子设备关闭该第一应用程序的界面的显示,该第一应用程序为后台应用。
在上述实施例中,当应用程序不显示界面时,并且为后台应用时,没必要通过执行绘制操作去刷新界面,电子设备可以降低应用执行绘制操作的频率,能够降低后台应用对系统资源的占用,并且可以降低电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该电子设备指示该第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
在上述实施例中,该电子设备指示该第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
结合第二方面的一些实施例,在一些实施例中,该电子设备不显示该第一应用程序的界面时,该电子设备指示该第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
在上述实施例中,电子设备通过指示应用程序的编舞者只处理接收到的垂直同步信号中部分垂直同步信号对应的动画事件任务,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该电子设备删除该第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
在上述实施例中,电子设备通过删除应用程序的编舞者保存的动画事件任务,使得后台应用执行的绘制操作为空操作,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该N与该K的比值对应于该第二频率与该第一频率的比值。
结合第二方面的一些实施例,在一些实施例中,该N与该K的比值等于该第二频率与该第一频率的比值。
结合第二方面的一些实施例,在一些实施例中,该电子设备关闭该第一应用程序的界面的显示后,当应用程序没有以该第一频率接收垂直同步信号,而是以该第三频率接收垂直同步信号时,该电子设备以低于第四频率的频率执行该绘制操作,该第三频率小于该第一频率,该第四频率小于等于该第三频率并且大于0。
在上述实施例中,允许应用程序以不超过某个值的频率去执行绘制操作,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,当该第一应用程序接收第一垂直同步信号时,该电子设备确定该第一应用程序接收该第一垂直同步信号与该第一应用程序上一次执行绘制操作时间之间的时间差是否小于该第四频率的倒数;若是,该电子设备拦截第一绘制操作,该第一绘制操作为该第一应用程序响应于第一垂直同步信号后执行的绘制操作;若否,该电子设备执行该第一绘制操作。
在上述实施例中,当应用程序出于非刷新界面的目的执行绘制操作时,允许应用程序以不超过某个值的频率去执行绘制操作,降低了执行绘制操作的频率,进而降低了后台应用对系统资源的占用,并且降低了电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该电子设备根据绘制频率限制策略和该第一应用程序确定该第二频率。
在上述实施例中,电子设备可以根据绘制频率限制策略确定不同应用程序的执行绘制操作的频率,有助于同时实现系统资源的差异化分配,并且降低了电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该电子设备根据活动管理服务和/或该第一应用程序的进程的cpuset参数确定电子设备是否显示该第一应用程序的界面或者确定该第一应用程序是前台应用还是后台应用。
在上述实施例中,可以根据活动管理服务和/或应用程序的进程的cpuset参数确定应用程序是否从前台应用转变为后台应用,进而可以提高后台应用的识别准确性,更精确的降低后台应用的绘制操作的执行频率,进而降低电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该N等于0。
在上述实施例中,当应用程序为后台应用时,电子设备可以指示应用程序不执行绘制操作,使得应用程序释放系统资源,进而降低电子设备的发热、电量消耗。
结合第二方面的一些实施例,在一些实施例中,该N等于K。
在上述实施例中,当应用程序为后台应用时,每当应用程序收到垂直同步信号时/后,可以删除该应用程序保存的动画事件任务,使得应用程序执行的绘制操作全部为空操作,进而释放更多的系统资源,进而降低电子设备的发热、电量消耗。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器和 存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:
启动第一应用程序;当该第一应用程序为前台应用时,以第一频率执行绘制操作,该绘制操作用于为该第一应用程序绘制视图;当该第一应用程序从前台应用切换为后台应用后,以第二频率执行该绘制操作,该第二频率小于该第一频率;其中,该第一频率为该第一应用程序接收垂直同步信号的频率。
结合第三方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,指示该第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
结合第三方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,指示该第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该N为小于K的正整数。
结合第三方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,删除该第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于K的正整数。
结合第三方面的一些实施例,该N与该K的比值对应于该第二频率与该第一频率的比值。
结合第三方面的一些实施例,该N与该K的比值等于该第二频率与该第一频率的比值。
结合第三方面的一些实施例,在一些实施例中,当该第一应用程序从前台应用切换为后台应用后,并且当应用程序没有以该第一频率接收垂直同步信号,而是以该第三频率接收垂直同步信号时,该电子设备以低于第四频率的频率执行该绘制操作,该第三频率小于该第一频率,该第四频率小于等于该第三频率并且大于0。
结合第三方面的一些实施例,在一些实施例中,当该第一应用程序接收第一垂直同步信号时,该电子设备确定该第一应用程序接收该第一垂直同步信号与该第一应用程序上一次执行绘制操作时间之间的时间差是否小于该第四频率的倒数;若是,该电子设备拦截第一绘制操作,该第一绘制操作为该第一应用程序响应于第一垂直同步信号后执行的绘制操作;若否,该电子设备执行该第一绘制操作。
结合第三方面的一些实施例,在一些实施例中,根据绘制频率限制策略和该第一应用程序确定该第二频率。
结合第三方面的一些实施例,在一些实施例中,根据活动管理服务和/或该第一应用程序的进程的cpuset参数确定该第一应用程序为前台应用或者后台应用。
结合第三方面的一些实施例,在一些实施例中,该N等于0;
结合第三方面的一些实施例,在一些实施例中,该N等于K;
第四方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:
启动第一应用程序;所述电子设备显示所述第一应用程序的界面,以第一频率执行绘制操作,所述绘制操作用于为所述第一应用程序绘制视图;关闭所述第一应用程序的界面的显 示,以第二频率执行所述绘制操作,所述第二频率小于所述第一频率;其中,所述第一频率为所述第一应用程序接收垂直同步信号的频率。
结合第四方面的一些实施例,关闭所述第一应用程序的界面的显示,该第一应用程序为后台应用。
结合第四方面的一些实施例,在一些实施例中,当该电子设备不显示该第一应用程序的界面时,指示该第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
结合第四方面的一些实施例,在一些实施例中,当该电子设备不显示该第一应用程序的界面时,指示该第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
结合第四方面的一些实施例,在一些实施例中,当该电子设备不显示该第一应用程序的界面时,以第二频率执行该绘制操作,该电子设备删除该第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得该电子设备以该第二频率执行该绘制操作,该K为正整数,该N为小于该K的正整数。
结合第四方面的一些实施例,在一些实施例中,该N与该K的比值对应于该第二频率与该第一频率的比值。
结合第四方面的一些实施例,在一些实施例中,该N与该K的比值等于该第二频率与该第一频率的比值。
结合第四方面的一些实施例,在一些实施例中,关闭所述第一应用程序的界面的显示后,当应用程序没有以该第一频率接收垂直同步信号,而是以该第三频率接收垂直同步信号时,该电子设备以低于第四频率的频率执行该绘制操作,该第三频率小于该第一频率,该第四频率小于等于该第三频率并且大于0。
结合第四方面的一些实施例,在一些实施例中,当该第一应用程序接收第一垂直同步信号时,该电子设备确定该第一应用程序接收该第一垂直同步信号与该第一应用程序上一次执行绘制操作时间之间的时间差是否小于该第四频率的倒数;若是,该电子设备拦截第一绘制操作,该第一绘制操作为该第一应用程序响应于第一垂直同步信号后执行的绘制操作;若否,该电子设备执行该第一绘制操作。
结合第四方面的一些实施例,在一些实施例中,根据绘制频率限制策略和该第一应用程序确定该第二频率。
结合第四方面的一些实施例,在一些实施例中,根据活动管理服务和/或该第一应用程序的进程的cpuset参数确定电子设备是否显示该第一应用程序的界面,或者确定该第一应用程序是前台应用还是后台应用。
结合第四方面的一些实施例,在一些实施例中,该N等于0;
结合第四方面的一些实施例,在一些实施例中,该N等于K;
第五方面,本申请实施例提供了一种芯片系统,该芯片系统应用于电子设备,该芯片系统包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行如第一方面以及第一方面中任一可能的实现方式描述的方法,或如第二方面以及第二方面中任一可能的实现方式描述的方法。
第六方面,申请实施例提供一种包含指令的计算机程序产品,当上述计算机程序产品在电子设备上运行时,使得该电子设备执行如第一方面以及第一方面中任一可能的实现方式描述的方法,或如第二方面以及第二方面中任一可能的实现方式描述的方法。
第七方面,申请实施例提供一种计算机可读存储介质,包括指令,当上述指令在电子设备上运行时,得该电子设备执行如第一方面以及第一方面中任一可能的实现方式描述的方法,或如第二方面以及第二方面中任一可能的实现方式描述的方法。
可以理解地,上述第三方面、第四方面提供的电子设备,第五方面提供的芯片系统,第六方面提供的计算机程序产品和第七方面提供的计算机存储介质均用于执行本申请实施例所提供的方法。因此,其所能达到的有益效果可参考对应方法中的有益效果,此处不再赘述。
附图说明
图1为本申请涉及的前台应用与后台应用转换的一个示例性示意图。
图2为本申请涉及的活动的生命周期的一个示例性示意图。
图3为本申请涉及的四种事件任务的一个示例性示意图。
图4为本申请涉及的编舞者执行绘制操作的一个示例性示意图。
图5为本申请涉及的前台应用与后台应用执行绘制操作的一个示例性示意图。
图6为本申请涉及的一种后台应用的系统调度方法的一个示例示意图。
图7为本申请涉及的另一种后台应用的系统调度方法的一个示例示意图。
图8为本申请实施例提供的电子设备100的一个结构示意图。
图9为本申请实施例提供的电子设备100的另一个结构示意图。
图10为本申请实施例中电子设备100的一个软件结构示意框图。
图11为本申请实施例中电子设备100的另一个软件结构示意框图。
图12为本申请提供的应用执行绘制操作的方法的一个示例性示意图。
图13为本申请提供的绘制频率限制策略界面的一个示例性示意图。
图14为本申请实施例中拦截编舞者接收垂直同步信号方法的一个示例性示意图。
图15为本申请实施例中拦截编舞者处理动画事件任务方法的一个示例性示意图。
图16为本申请实施例中拦截编舞者绘制操作的一个示例性示意图。
图17为本申请实施例中管控后台应用的无效的绘制操作场景的一个示例性示意图。
图18为本申请实施例中管控后台应用的无效的绘制操作场景的另一个示例性示意图。
具体实施方式
本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“该”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,本申请中使用的术语“和/或”是指并包含一个或多个所列出项目的任何或所有可能组合。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者 隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
为了便于理解,下面先对本申请实施例涉及的相关术语及相关概念进行介绍。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
(1)前台应用、后台应用
根据应用程序是否可以直接与用户交互,可以将应用程序分为包括:前台应用、后台应用。前台应用和后台应用为对应用程序运行状态的描述,其中,前台应用为用户放置在前台的、可以直接交互的应用程序,后台应用为用户放置在后台的、不可以直接交互的应用程序。
在本申请的实施例中,可以根据应用程序是否直接可见,可以确定该应用是前台应用或后台应用。具体的,当应用程序可见时为前台应用,当应用程序不可见时为后台应用。
例如,当电子设备的屏幕上显示应用的界面时,该应用为前台应用;当电子设备的屏幕上没有显示应用的界面时,该应用为后台应用。其中,应用的界面不包括操作系统的顶部状态栏、通知栏。
可选的,在本申请的一些实施例中,可以根据应用程序是否满足某些条件进而可以确定该应用是前台应用还是后台应用。具体的,若该应用程序满足一下三个条件中的任意一个,该应用程序为前台应用,否则该应用程序为后台应用。其中,三个条件分别为:该应用具有可见的活动(Activity)、该应用具有前台服务、其他前台应用关联到该应用。其中,活动的概念可以参考术语解释(2)活动中的文字描述,此处不再赘述。
电子设备可以有多种方法,去确定一个应用在某一时刻是否具有可见的活动,进而确定该应用是前台应用还是后台应用,在此不作限定。
例如,可以根据该应用程序的主活动的生命周期确定该应用程序是前台应用还是后台应用。具体的,通过判断该应用程序的主活动是否执行onStop方法、onResume方法、topResumedActivityChangedItem方法等多种方法确定。当该应用的活动执行onStop方法后,认为该应用为后台应用,当该应用的活动执行onResume方法、topResumedActivityChangedItem方法后,认为该应用为前台应用。其中onStop方法、onResume方法、topResumedActivityChangedItem方法等术语的概念可以参考下述术语解释中(2)活动中的文字描述,此处不再赘述。
例如,可以通过cpuset参数确定该应用程序为前台应用还是后台应用。具体的,当应用程序所对应的进程的cpuset参数为background或key-background时,该应用程序为后台应用;对应的,当应用程序所对应的进程的cpuset参数不为background和key-background时,该应用程序为前台应用。
值得说明的是,响应于用户的操作,一个应用程序可以在前台应用和后台应用之间进行转换。
值得说明的是,对于用户来说,当用户可以看到应用程序的界面时,认为该应用为前台应用;当用户没有看到应用程序的界面时,认为该应用为后台应用。
下面以图1所示的内容为例,介绍如何通过设备是否显示应用程序的界面确定该应用程序是前台应用还是后台应用。
图1为本申请涉及的前台应用与后台应用转换的一个示例性示意图。
如图1中(A)所示,当前用户打开音乐听歌时,此时,手机上显示的界面为音乐的界 面,音乐为前台应用。结合图1中(B)所示的内容,可以得知,用户可以打开多任务栏,看到当前手机上运行有三个应用程序,即除了音乐外还包括图库、浏览器。在图1中(A)所示的场景中,电子设备没有显示图库和浏览器的界面,图库和浏览器为后台应用。如图1中(C)所示,响应于用户的操作,用户将音乐切换到后台并将图库切换到前台,此时电子设备显示图库的界面,图库为前台应用,音乐和浏览器为后台应用。如图1中(D)所示,响应于用户的操作,用户可以在图1(C)所示的基础上打开浏览器的小窗,同时浏览网页和照片,此时手机上同时显示浏览器和图库的界面,此时图库和浏览器为前台停用,音乐为后台应用。
如图1中(E)所示,当用户打开视频应用时,可以开启小窗模式后,将该应用切换至后台。如图1中(F)所示,此时电子设备上显示的为桌面和视频应用的小窗。此时,该视频类应用为前台应用。
值得说明的是,在本申请实施例中,当一个应用的主界面被用户切换到后台时,但设备仍然显示该应用的小窗界面(主界面或该应用的其他界面),认为该应用为前台应用。
值得说明的是,在本申请一些实施例中,当电子设备关闭应用程序的部分界面的显示时,认为电子设备没有关闭应用程序的界面的显示;相对的,当电子设备关闭应用程序的全部的界面的显示时,认为电子设备关闭应用程序的界面的显示。
对于用户来说,在图1中(A)所示的场景中,用户可以看到电子设备显示的音乐的界面,故音乐为前台应用;在图1中(B)所示的场景中,用户可以看到电子设备显示的图库的界面,故图库为前台应用;在图1中(D)所示的场景中,用户可以看到电子设备显示的图库和浏览器界面,故图库和浏览器界面为前台应用;在图1中(E)和(F)所示的场景中,用户可以看到电子设备显示的视频软件的界面,故视频软件为前台应用。
(2)活动
活动是Android操作系统的基本组件之一,可以用于在应用程序中为用户提供可交互的界面或视图。其中,一个应用程序可以有多个活动,应用通过任务栈装载活动,其中任务栈顶端的活动为用户可以直接交互的活动。
活动本身具有生命周期,通过判断应用程序的主活动(Main Activity)的生命周期可以判断该应用为前台应用或者为后台应用。其中,主活动为开发人员在开发该应用时指定的活动,可以用于承载应用程序的主界面。
图2为本申请涉及的活动的生命周期的一个示例性示意图。
如图2所示,应用程序的开发人员在开发应用程序的活动时,需要实现至少七个回调方法(Method)。其中,回调方法又可以称为回调函数,可以被调用去实现特定的功能。其中,七个回调方法分别为:onCreate回调方法、onStart回调方法、onResume回调方法、onPaused回调方法、onStop回调方法、onDestroy回调方法、onRestart回调方法。活动通过调用上述七个回调方法,可以实现活动的生命周期。
具体的,当活动第一次被创建的时候,活动会调用onCreate回调方法以完成活动的初始化;当活动从不可见变为可见时,活动会调用onStart回调方法;当活动准备好和用户进行交互的时候,活动会调用onResume回调方法;当活动离开任务栈顶时,活动会调用onPause回调方法以保存一些关键数据和释放一些资源;当活动变为完全不可见时,活动会调用onStop回调方法;当活动销毁自己前,活动会调用onDestroy回调方法以释放资源;当活动从停止状态变为运行状态时,活动会调用onRestart回调方法。
结合活动的生命周期,可以确定活动所属的应用程序是前台应用还是后台应用,当该应用的主活动执行onStop回调方法后,可以认为该应用变为后台应用;对应的,当应用的主活动执行onResume回调方法后,可以认为该应用变为前台应用。
值得说明的是,在一些情况下,应用程序恢复前台时,该应用程序的主活动会执行TopResumedActivityChangeItem回调方法,故可以通过判断应用程序的主活动是否已经执行TopResumedActivityChangeItem回调方法确定当前应用是否变为前台应用。
在本申请的实施例中,可以通过操作系统提供的活动管理服务(ActivityManagerService,AMS)去监控当前正在运行的应用程序的主活动的生命周期,进而通过活动管理服务确定任意一个应用程序当前是前台应用还是后台应用。
可选的,在本申请一些实施例中,应用程序的开发者在开发应用程序时,可以在该主活动的生命周期中添加接口,向该应用程序的编舞者或其他模块、对象传递信息以确定该应用程序是前台应用还是后台应用。
(3)编舞者(Choreographer)、绘制操作
编舞者为操作系统中的一个类,用于请求垂直同步信号,并响应于请求得到的垂直同步信号去执行绘制操作。其中,类是一种数据结构,用于定义一个对象的状态和行为。其中,垂直同步信号为操作系统提供的,用于协调并同步编舞者操作和SurfaceFlinger操作的信号。
当应用程序被启动后,会初始化编舞者,其中初始化编舞者的过程包括:活动会依据编舞者类生成一个实例化的编舞者对象。该编舞者可以去执行绘制操作。其中,绘制操作可以包括:编舞者处理输入事件任务、动画事件任务、布局事件任务以及提交事件任务。编舞者执行绘制操作后,可以将绘制操作的结果提交给应用程序的其他模块,进而在电子设备的屏幕上显示刷新后的界面或视图。
下面首先具体的介绍编舞者的产生、以及编舞者执行绘制操作的触发条件:
每个应用程序在被用户启动后,当该应用程序第一次需要展示可视化的界面或视图时,都会生成属于该应用程序的至少一个编舞者。其中,编舞者的数量可以与该应用程序使用的线程的数量有关。其中,线程为操作系统调度的最小资源。例如,应用程序的UI线程会生成一个绑定该线程的编舞者,其中UI线程也可以称为主线程,主要用于承载界面显示、更新和控件交互等功能实现的计算开销。
当应用程序需要刷新界面或者视图时,编舞者会向SurfaceFlinger请求垂直同步信号(Vsync),以寻求合适的时机进行绘制操作。编舞者在接收到SurfaceFlinger发送的垂直同步信号后,就会开始执行绘制操作。其中,编舞者会使用OnVsync回调方法去接收垂直同步信号,该OnVsync回调方法为编舞者内部类FrameDisplayEventReceiver提供的回调方法。编舞者在使用OnVsync回调方法成功接收到垂直同步信号后,会通知编舞者可以开始绘制操作。
其中,应用程序为前台应用/后台应用时,编舞者向SurfaceFlinger请求垂直同步信号的频率不变。
其中,SurfaceFlinger是操作系统底层提供的服务,用于接收不同应用程序的编舞者的请求,并响应于该请求向应用程序分发垂直同步信号。其中,垂直同步信号的产生可以由软件模拟产生,也可以由电子设备的硬件产生。例如,垂直同步信号可以由硬件编写器(Hardware Composer,HWC)产生。HWC产生垂直同步信号后可以通过回调方法将垂直同步信号发送到SurfaceFlinger,故SurfaceFlinger可以向编舞者转发垂直同步信号。编舞者在接收到SurfaceFlinger发送的垂直同步信号后,就会开始执行绘制操作。
其中,电子设备产生垂直同步信号的频率可以与电子设备的屏幕的刷新率有关。例如,当电子设备产生垂直同步信号的频率为90Hz时,电子设备的屏幕刷新率可以为90Hz。
其次,下面介绍绘制操作包括的内容:
具体的,应用程序在生成编舞者后,会将四种事件任务按照时间顺序存储到编舞者内部配置的四个单向链表(CallbackQueue)中。编舞者在收到垂直同步信号后,会通过doFrame回调方法去处理当前时间对应的四种事件任务。其中,四种事件任务分别为CALLBACK_INPUT、CALLBACK_ANIMATION、CALLBACK_TRAVERSAL和CALLBACK_COMMIT。
其中,doFrame回调方法中包括四个doCallBacks回调方法,分别用于处理上述四种事件任务。
其中,CALLBACK_INPUT为输入事件任务,其中,输入事件任务为应用程序将输入事件封装、分发到编舞者的数据。输入事件可以为应用程序收到的用户与该应用程序的交互,例如,输入事件可以是用户点击该应用程序中的某个可交互的控件、或者是用户在应用程序中的滑动(上下滑动、左右滑动等)、或者是用户的语音输入等,在此不做限定。应用程序在确定输入事件后,对该输入事件进行初步处理,并生成该输入事件对应的输入事件任务,并将该输入事件任务传递给编舞者。
其中,CALLBACK_ANIMATION为动画事件任务,动画事件任务为应用程序计算动画(Animation)所需的数据。其中,动画可以包括:视图动画(View Animation)、帧动画(Drawable Animation)、属性动画(Property Animation)等。
其中,CALLBACK_TRAVERSAL为布局事件任务,用于参与编舞者计算视图或界面的绘制数据。其中,计算确定的绘制数据会被提交给应用程序的其他模块去确定视图中显示内容的宽高、位置、形状等。
其中,CALLBACK_COMMIT为提交事件任务,用于标志编舞者完成了某个垂直同步信号所对应的绘制操作。
再次,下面以图3所示的内容为例,具体的介绍上述四种事件任务。
图3为本申请涉及的四种事件任务的一个示例性示意图。
某应用程序的主界面如图3中(A)所示,其中,主界面包括三个矩形控件,分别为1号矩形控件301、2号矩形控件302、3号矩形控件303。其中,1号矩形控件301和2号矩形控件302可以相应用户的点击操作,3号矩形控件303可以向用户展示当前的数字。当用户点击1号矩形控件301时,3号矩形控件303展示的数字会加1;当用户点击2号矩形控件302时,3号矩形控件303展示的数字会减1。并且,响应于用户点击1号矩形控件301或者2号矩形控件302时,被用户点击的矩形控件会呈现一个渐变的灰色动画用于告知用户点击成功。
图3中(B)所示的内容为用户点击2号矩形控件302后所展示的界面。相比于图3中(A)所示的应用程序的界面,2号矩形控件302变为灰色且3号矩形控件303展示的数字由4变成3。
在图3所示的内容中,可以认为对1号矩形控件301或者2号矩形控件302的点击事件为输入事件。电子设备的屏幕获取输入事件后,上报到对应的驱动,并分发给对应的应用程序。应用程序获取到该输入事件后,会将该事件包装成输入事件任务分发到编舞者。类似的, 需要呈现的渐变的灰色动画为动画事件,被包装成动画事件任务分发到编舞者。类似的,布局事件任务用于确定2号矩形控件302在视图中的位置、大小、形状。类似的,提交事件任务用于确定完成一次绘制操作。
最后,下面以图4所示的内容为例,介绍编舞者执行绘制操作的数据流程。
图4为本申请涉及的编舞者执行绘制操作的一个示例性示意图。
如图4所示,应用程序在第一次被启动后,应用程序的主活动会按照活动的生命周期执行onStart回调方法和onResume回调方法等回调方法。其中,应用程序在执行onResume回调方法后,若需要展示可视化的界面或视图,可以使用Activity.makeVisible回调方法绘制界面或视图。其中,在活动使用Activity.makeVisible回调方法绘制界面或视图的过程中,编舞者会被初始化。
编舞者被初始化后,当应用程序需要刷新视图时,会使用scheduleTraversals回调方法向编舞者发送绘制请求。被scheduleTraversals回调方法唤醒的编舞者会不断的按照时间顺序接收并使用不同的单向链表存储对应的事件任务。
并且,编舞者收到绘制请求后,会向SurfaceFlinger请求垂直同步信号。编舞者接收到SurfaceFlinger发送的垂直同步信号后,可以通过doFrame回调方法执行绘制操作,即通过doFrame回调方法处理输入事件任务、动画事件任务、布局事件任务和提交事件任务。
其次,下面介绍本申请涉及的场景。
操作系统没有提供回调方法去判定请求垂直同步信号的应用是否真的需要进行绘制操作,任一应用程序在向SurfaceFlinger请求垂直同步信号后,都会被分发垂直同步信号。用户在使用电子设备如智能手机时,可以开启多个应用程序。但是,受限于电子设备的屏幕的尺寸,在某一时刻,用户只能将一个或少数几个应用展现在屏幕上进行交互(如分屏),而其他应用程序会转变为后台应用。对任意一个后台应用来说,由于该后台应用并没有被销毁,仍然持有编舞者,该后台应用在后台执行某些操作时,会触发编舞者进行绘制操作。
首先,由于后台应用没有可以用来向用户展示的视图或界面,后台应用执行绘制操作的结果并不会被用户感知到。其次,由于后台应用的编舞者只会被分发动画事件任务,后台应用在执行绘制操作时,实际上只处理了动画事件任务。
综合上述两点,可以认为后台应用执行的绘制操作为无效的绘制操作。
值得说明的是,对于任一应用程序来说,当该应用程序为前台应用时,该应用程序的编舞者会被分发输入事件任务、动画事件任务、布局事件任务、提交事件任务;当该应用程序为后台应用时,由于该应用程序没有提供可够交互的界面或视图,故该应用程序不会被分发输入事件任务、布局事件任务、提交事件任务。
值得说明的是,对于用户来说,当电子设备显示应用程序界面时,该应用程序执行绘制操作去刷新界面是有必要的;而当电子设备关闭应用程序界面的显示后至电子设备再次显示该应用程序的界面前,该应用程序执行绘制操作去刷新界面浪费操作系统的资源,增加电子设备的发热、耗电。
图5为本申请涉及的前台应用与后台应用执行绘制操作的一个示例性示意图。
如图5所示,电子设备上运行有多个应用程序,包括:图库、音乐、浏览器。当图库为前台应用时,音乐和浏览器为后台应用。图库、音乐和浏览器的编舞者均接受到垂直同步信号,并且响应于垂直同步信号,图库、音乐和浏览器的编舞者均执行绘制操作。其中,编舞 者执行的绘制操作的计算资源由UI线程提供。
可以理解的是,后台应用执行无效的绘制操作,会挤占前台应用的系统资源,并且会导致电子设备的发热以及耗电增加,进而导致电子设备的卡顿,恶化了用户体验。
再次,下面介绍本申请涉及的两种针对后台应用的系统调度方法。
结合图5所示的内容,应用程序转变为后台应用后,由于该应用程序仍然持有编舞者,故应用的编舞者仍然会接收SurfaceFlinger发送的垂直同步信号,并且执行无效的绘制操作。为了减少后台应用去执行无效的绘制操作,主要有两种针对后台应用的系统调度方法。
其中,第一种有关后台应用的系统调度方法主要通过结合电子设备的CPU硬件架构特点,将系统资源差异化的分配给前台应用和后台应用:
图6为本申请涉及的一种后台应用的系统调度方法的一个示例示意图。
如图6所示,以CPU麒麟9000为例,麒麟9000包括一个A77架构的大核、三个A77架构的中核以及四个A55架构的小核。结合电子设备CPU的硬件架构特点,当应用程序为前台应用,优先使用大核承载该应用的计算资源,而当应用程序为后台应用时,优先使用中核和小核承载该应用的计算资源。
可以理解的是,应用程序在执行绘制操作时,会消耗CPU的计算资源,所以将系统资源差异化的分配给前台应用和后台应用,有助于减少后台应用挤占前台应用的计算资源。但是,当用户开启较多应用时或者用户正在使用的前台应用需要占用大量的系统资源时,即需要CPU的中核、小核提供一些计算资源时,后台应用的无效的绘制操作则会挤占系统的计算资源,导致前台应用出现卡顿,降低了用户体验。其次,由于不同电子设备的硬件特点不同,以CPU为例,一套系统调度方法不能适配不同厂家不同型号的CPU。
可以理解的是,上述针对后台应用的系统调度方法,通过结合电子设备的硬件特定进行差异化的调度去尽可能的保证前台应用的系统资源。
但是该系统调度方法并没有阻止后台应用去执行无效的绘制操作,浪费了系统资源,增加电子设备的耗电。
其中,第二种有关后台应用的系统调度方法主要通过及时冻结后台应用,使得后台应用无法占用系统资源:
图7为本申请涉及的另一种后台应用的系统调度方法的一个示例示意图。
当应用程序从前台应用转变为后台应用时,电子设备可以冻结该应用程序。应用程序需要向电子设备请求系统资源去进行绘制操作,但电子设备不会向被冻结的应用程序分配系统资源,故被冻结的应用程序不会进行无效的绘制操作。但是被冻结的后台应用经常会被广播、服务等唤醒,唤醒后的后台应用仍然会执行无效的绘制操作,占据系统资源,增加电子设备耗电。
如图7所示,当将浏览器应用切换到后台时,浏览器应用会被冻结。冻结后的浏览器应用不能占用电子设备的系统资源,故不能执行绘制操作。但是被冻结的浏览器应用常常会被操作系统或其他应用的广播、服务唤醒,唤醒后的浏览器应用仍然会执行无效的绘制操作。
可以理解的是,通过冻结后台应用虽然可以使后台应用不去执行无效的绘制操作。但
但是被冻结的后台应用常常会被唤醒,唤醒后的后台应用仍然可以执行无效的绘制操作,占用了系统资源,并且增加了电子设备的耗电。
为了使后台应用不去执行无效的绘制操作,进而减少对系统资源的占用,降低电子设备的耗电,本申请提供应用执行绘制操作的方法及电子设备,当应用程序从前台应用变为后台 应用时,该应用程序根据绘制频率限制策略确定后台绘制频率,并根据该确定的后台绘制频率去拦截垂直同步信号或者拦截编舞者处理动画事件任务,有效的降低了后台应用执行无效的绘制操作,进而降低了后台应用对于系统资源的占用,并且降低了电子设备的耗电。
下面介绍本申请提供的电子设备:
本申请实施例中电子设备可以为手机、平板电脑等移动电子设备,也可以为智能电视、个人电脑(personal computer,PC)等设备,此处不作限定。
示例性的,图8为本申请实施例提供的电子设备100的一个结构示意图。
下面以电子设备100为例对实施例进行具体说明。应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber  identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
SIM接口可以被用于与SIM卡接口195通信,实现传送数据到SIM卡或读取SIM卡中数据的功能。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间数据传输。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5SDRAM)等;
非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运 行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。
外部存储器接口120可以用于连接外部的非易失性存储器,实现扩展电子设备100的存储能力。外部的非易失性存储器通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部的非易失性存储器中。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C 测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。
本申请实施例中,该处理器110可以通过调用该内部存储器121中存储的计算机指令,以使得该电子设备100执行本申请实施例中的应用执行绘制操作的方法。
示例性的,图9为本申请实施例提供的电子设备100的另一个结构示意图。
该电子设备100包括:
输入装置201、输出装置202、处理器203和存储器204(其中电子设备100中的处理器203的数量可以一个或多个,图9中以一个处理器203为例)。在本申请的一些实施例中,输入装置201、输出装置202、处理器203和存储器204可通过总线或其它方式连接。
其中,处理器203通过调用存储器204存储的操作指令以使得电子设备200执行本申请实施例中的应用执行绘制操作的方法。
示例性的,图10为本申请实施例中电子设备100的一个软件结构示意框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将系统分为四层,从上至下分别为应用程序层,应用程序框架层,运行时和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图10所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序(也可以称为应用)。
其中,应用程序层还可以包括性能优化应用。该性能优化应用可以提供可视化的界面或视图,也可以不提供可视化的界面或视图。当电子设备被启动后,该性能优化应用可以自动启动,而无需用户的操作。该性能优化应用中存有绘制频率限制策略,用于确定应用程序和后台绘制频率的对应关系。该性能优化应用在启动后可以通过网络访问服务器以确定绘制频率限制策略中的参数,或者可以读取操作系统本地的配置文件以确定绘制频率限制策略中的参数。性能优化应用配置有接口,其他应用可以通过接口访问该性能优化应用以确定本身的后台绘制频率。
或者,应用程序在被启动后,会生成绘制频率限制模块去读取系统本地的配置文件以获取绘制频率限制策略,并根据该绘制频率限制策略确定本身的后台绘制频率。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图10所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器,本地Profile管理助手(Local Profile Assistant,LPA)等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话界面形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
应用程序框架层还可以包括性能优化系统,性能优化系统中可以存有绘制频率限制策略。当应用程序被启动后,可以通过操作系统提供的回调方法直接访问该性能优化系统以确定该应用程序本身的后台绘制频率。
运行时包括核心库和虚拟机。运行时负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),二维图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了二维(2-Dimensional,2D)和三维(3-Dimensional,3D)图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现3D图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动,虚拟卡驱动。
本申请涉及的编舞者可以位于应用程序框架层的视图系统中,当应用程序需要刷新界面时,该应用程序调用视图系统中的编舞者,生成该应用程序独有的编舞者对象,并执行绘制操作。编舞者在执行绘制操作时,可以通过回调方法利用核心库中的表面管理器、二维图形引擎等实现绘制操作。
值得说明的是,随着操作系统版本更新,服务器可以在新版本的文件中更新配置文件以更新绘制频率限制策略。
示例性的,图11为本申请实施例中电子设备100的另一个软件结构示意框图。
在一些实施例中,将系统分为四层,从上至下分别为应用层,框架层,系统服务库,以及内核层。
应用层包括系统应用和第三方非系统应用。
其中,系统应用可以包括性能优化应用。该性能优化应用可以提供可视化的界面或视图,也可以不提供可视化的界面或视图。当电子设备被启动后,该性能优化应用可以自动启动,而无需用户的操作。该性能优化应用中存有绘制频率限制策略,用于确定应用程序和后台绘制频率的对应关系。该性能优化应用在启动后可以通过网络访问服务器以确定绘制频率限制策略中的参数,或者可以读取操作系统本地的配置文件以确定绘制频率限制策略中的参数。性能优化应用配置有接口,其他应用可以通过接口访问该性能优化应用以确定本身的后台绘制频率。
或者,应用程序在被启动后,会生成绘制频率限制模块去读取系统本地的配置文件以获取绘制频率限制策略,并根据该绘制频率限制策略确定本身的后台绘制频率。
框架层为应用层的应用程序提供JAVA/C/C++/JS等多语言的用户程序框架和能力框架,以及各种软硬件服务对外开放的多语言框架API。
系统服务层包括:系统基本能力子系统集、基础软件服务子系统集、增强软件服务子系统集、硬件服务子系统集。
其中,系统基本能力子系统集支持操作系统在多设备上运行、调度、迁移等操作。系统基本能力子系统集可以包括:分布式软总线、分布式数据管理、分布式任务调度、公共基础子系统等。系统服务层和框架层联合实现了多模输入子系统、图形子系统等。图形子系统中可以存有绘制频率限制策略,当应用程序被启动后,可以通过操作系统提供的回调方法直接访问该图形子系统以确定该应用程序本身的后台绘制频率。本申请涉及的编舞者可以位于图形子系统中。当应用程序需要刷新界面时,该应用程序调用视图系统中的编舞者,生成该应用程序独有的编舞者对象,并执行绘制操作。
其中,基础软件服务子系统集为操作系统提供公共的、通用的软件服务,可以包括:事件通知子系统、多媒体子系统等。
其中,增强软件服务子系统集为不同设备提供差异化的软件服务,可以包括:IOT专有业务子系统。
其中,硬件服务子系统集为操作系统提供硬件服务,可以包括:IOT专有硬件服务子系统。
值得说明的是,根据不同设备形态的部署环境,上述系统基本能力子系统集、基础软件服务子系统集、增强软件服务子系统集、硬件服务子系统集可以按照其他功能粒度进行重新划分。
内核层包括内核抽象层和驱动子系统。其中,内核抽象层包括多种内核,并且通过屏蔽多内核差异,对上层提供基础的内核能力,例如,线程/进程管理、内存管理、文件系统、网络管理等。其中,驱动子系统为软件开发者提供统一外设访问能力和驱动开发、管理框架。
值得说明的是,根据操作系统的不同以及未来可能的升级换代,电子设备的软件结构可以根据操作系统进行其他方式的划分。
下面介绍本申请提供的应用执行绘制操作的方法。
图12为本申请提供的应用执行绘制操作的方法的一个示例性示意图。
如图12所示,本申请提供的应用执行绘制操作的方法可以包括:
S1201:应用程序根据频率限制策略确定后台绘制频率。
应用程序从前台应用转变为后台应用时,该应用程序根据频率限制策略确定后台绘制频 率。
具体的,首先,应用程序需要确定应用程序本身何时从前台应用转变为后台应用。操作系统提供一个绘制频率限制模块用于确定应用程序为前台应用或后台应用。该绘制频率限制模块可以通过配置接口去直接监听应用程序的主活动的生命周期,进而可以确定应用程序的运行状态,即确定该应用程序是前台应用还是后台应用。或者,绘制频率限制模块可以通过活动管理服务确定应用程序的运行状态,即确定该应用程序是前台应用还是后台应用。
其次,在确定应用程序从前台应用转变为后台应用时,应用程序可以根据绘制频率限制策略确定该应用程序的后台绘制频率。后台绘制频率是指应用程序变为后台应用后,该应用程序的编舞者执行绘制操作的频率。
本申请实施例中,绘制频率限制策略为预先配置的,用于设置不同应用变为后台应用时的后台绘制频率。
绘制频率限制策略可以配置在绘制频率限制模块中,其中,绘制频率限制模块可以通过接口与应用程序的编舞者进行通信。具体的,绘制频率限制模块可以为操作系统预配置的,即绘制频率限制模块可以配置在每个应用程序的内部。或者,绘制频率限制模块可以配置在操作系统的服务中/或者配置在其他一直保持在运行状态的应用,应用程序可以通过接口访问绘制频率限制模块以确定应用程序自己的后台绘制频率。
其中,应用程序确定的后台绘制频率小于垂直同步信号的产生频率(或屏幕刷新率)。
考虑到应用程序的开发者在开发该应用程序时,有可能需要借助编舞者执行的绘制操作向应用程序的活动或其他模块传递一些参数的情况。即,在应用程序出于非界面刷新的目的执行绘制操作的情况。在该情况下,应用程序为后台应用时,该后台应用请求垂直同步信号的频率小于垂直同步信号的产生频率(或屏幕刷新率)。在该情况下,步骤S1201应用程序确定的后台绘制频率可以小于等于垂直同步信号的产生频率(或屏幕刷新率)。
可选的,在本申请一些实施例中,当应用程序请求垂直同步信号的频率小于垂直同步信号的产生频率(或屏幕刷新率),应用程序根据频率限制策略确定后的后台绘制频率可以等于垂直同步信号的产生频率(或屏幕刷新率)。
可选的,在本申请一些实施中,应用程序可以在被启动时或者被启动后就确定该应用程序本身的后台绘制频率。
可选的,在本申请一些实施中,绘制频率限制模块向应用程序提供修改自身后台绘制频率的接口,通过该接口,应用程序可以配置自身的后台绘制频率。
示例性的,如下表1所示,表1为本申请实施例中绘制频率限制策略的一个示意表。
Figure PCTCN2022081926-appb-000001
表1
如上表1所示,当音乐转变为后台应用时,绘制频率限制策略配置音乐的后台绘制频率为垂直同步信号频率的1/6;而当图库转变为后台应用时,绘制频率限制策略配置图库的后台绘制频率为0。
可以理解的是,绘制频率限制策略可以为不同应用或者不同类型的应用(社交类应用、游戏应用、其他应用等)配置不同的后台绘制频率,有助于合理的分配系统资源,降低电子 设备的耗电。
可选的,如下图13中的内容所示,在本申请的一些实施例中,用户可以结合电子设备的性能和使用需求,个性化的配置绘制频率限制策略中的参数。
图13为本申请提供的绘制频率限制策略界面的一个示例性示意图。
如图13中(A)所示,用户可以在电子设备的主界面通过长按的方式选择一个应用程序,如选择“华为应用市场”;进一步的,如图13中(B)所示,用户长按选择应用程序后,可以通过点击的方式选择信息选项;进一步的,如图13中(C)所示,用户选择信息选项后,可以看到该应用的相关信息,其中包括负责调度应用程序的省电管理选项;进一步的,如图13中(D)所示,用户可以通过配置该省电管理选项中具体参数,配置绘制频率限制策略中该应用程序对应的绘制限制频率;进一步的,如图13中(E)所示,用户可以具体配置该应用程序转变为后台应用时的后台绘制频率。
值得说明的是,如图13中(D)所示,当用户选择智能省电时,该应用程序按照预配置的绘制频率限制策略中的参数确定该应用程序的后台绘制频率。
其中,前台应用、后台应用、编舞者、主活动等术语的概念可以参考上述术语解释中(1)前台应用、后台应用、(2)活动、(3)编舞者(Choreographer)、绘制操作中的文字描述,此处不再赘述。
S1202:应用程序根据后台绘制频率去执行绘制操作。
具体的,应用程序的编舞者在确定后台绘制频率后,根据后台绘制频率去拦截垂直同步信号或者拦截编舞者的绘制操作,使得编舞者按照后台绘制频率去执行无效的绘制操作。
其中,无效的绘制操作等术语的概念可以参考术语解释中编舞者(Choreographer)、绘制操作(3)中的文字描述,此处不在赘述。
下面结合图12所示的内容,以图14以及图15所示的内容为例,分别具体的介绍根据后台绘制频率拦截垂直同步信号以及根据后台绘制频率拦截编舞者执行绘制操作的方法:
图14为本申请实施例中拦截编舞者接收垂直同步信号方法的一个示例性示意图。
如图14中(A)所示,应用程序的编舞者使用OnVsync回调方法接收到垂直同步信号后,首先进行判断该编舞者所属的应用程序是前台应用还是后台应用。若该应用程序为前台应用,则执行默认的绘制操作;若该应用程序为后台应用,则记录该垂直同步信号为应用程序转变为后台应用后的第K个垂直同步信号,并判断K与第一阈值的大小。若K小于第一阈值,则跳过默认的绘制操作,若K等于第一阈值,则将K清零后重新计数,并且执行默认的绘制操作。其中,跳过默认的绘制操作可以是指使编舞者不去调用doFrame回调方法,进而实现拦截绘制操作。
电子设备可以根据绘制频率限制策略确定该应用程序的后台绘制频率或者第一阈值。当电子设备根据绘制频率限制策略确定该应用程序的后台绘制频率后,可以确定该对后台绘制频率对应的第一阈值;当电子设备根据绘制频率限制策略确定该应用程序的第一阈值后,可以确定该第一阈值对应的后台绘制频率。
例如,当电子设备的垂直同步信号的产生频率和屏幕刷新率均为90Hz,并且该应用程序根据绘制频率限制策略确定后台绘制频率为18Hz。则电子设备可以确定该后台绘制频率18Hz所对应的第一阈值。第一阈值可以为垂直同步信号的产生频率(或屏幕刷新率)除以应用程序的后台应用绘制频率,即第一阈值为5。则,当应用程序变为后台应用后,应用程序的编舞者每接收到5个垂直同步信号,才执行一次默认的绘制操作。
又例如,对应的,若该应用程序根据绘制频率限制策略确定该应用程序的第一阈值为5,则电子设备可以确定该第一阈值5所对应的后台绘制频率为18Hz。
值得说明的是,若后台绘制频率为0,则第一阈值可以为一个较大的整数,例如2 10。或者可以改变图14中(A)所示的内容,在应用程序收到垂直同步信号后,将K清零,使得应用程序不去执行默认的绘制操作;或者,在应用程序收到垂直同步信号后,不去对垂直同步信号进行计数,使得K一直等于0,进而使得应用程序不去执行默认的绘制操作。
具体的,如图14中(B)所示,若该应用程序为前台应用时,应用程序执行绘制操作的间隔为1/90秒,即应用程序接收到垂直同步信号后都会执行绘制操作;若该应用程序为后台应用时,应用程序执行绘制操作的间隔为5/90秒,即应用程序接收到5个垂直同步信号后才会执行默认的绘制操作。例如,应用程序从第0秒开始,每隔1/90秒,该应用程序的编舞者请求垂直同步信号。若在第0秒时,该应用程序变为后台应用。在第0秒、在第1/90秒、第2/90秒、第3/90秒、第4/90秒时,由于K小于5,所以应用程序的编舞者的绘制操作被拦截,在第5/90秒,应用程序编舞者收到垂直同步信号,此时K=5,故应用程序的绘制操作没有被拦截,执行一次默认的绘制操作。其中,应用程序为后台应用时执行的绘制操作为无效的绘制操作。
值得说明的是,编舞者执行绘制操作每次的耗时可以不相同,也可以相同,本申请不对此进行限定。
图15为本申请实施例中拦截编舞者处理动画事件任务方法的一个示例性示意图。
如图15所示,应用程序的编舞者使用OnVsync回调方法接收到垂直同步信号后,开始执行绘制操作。其中,绘制操作包括处理输入事件任务、动画事件任务、布局事件任务以及提交事件任务。由于后台应用的编舞者并不会获取到输入事件任务、布局事件任务以及处理事件任务。故可以通过拦截编舞者处理动画事件任务,进而拦截编舞者执行无效的绘制操作。
具体的,应用程序在接收到垂直同步信号后,开始执行绘制操作前,判断该编舞者所属的应用程序是否是后台应用。若该编舞者所属的应用程序为前台应用,则可以继续执行默认的绘制操作;若该编舞者所属的应用程序为后台应用,则可以在doFrame回调方法中跳过对动画事件任务的处理或者可以直接结束绘制操作,使得该编舞者不去执行无效的绘制操作。
例如,当后台绘制频率为0时,可以在编舞者的doFrame回调方法的开始去判断该编舞者所属的应用程序是前台应用还是后台应用。若判断结果为后台应用,则可以让编舞者跳过执行doFrame回调方法中处理动画事件任务的doCallbacks回调方法。在该情况下,虽然编舞者仍然会调用doCallbacks回调方法去处理输入事件任务、布局事件任务、提交事件任务,但由于输入事件任务、布局事件任务、提交事件任务为空,所以可以通过跳过编舞者处理的动画事件任务去等价的实现拦截编舞者执行本次无效的绘制操作。
若判断结果为前台应用,则执行默认的绘制操作。
值得说明的是,当后台绘制频率大于0时,也可以通过拦编舞者处理动画事件任务同样能实现图14中(B)所示的降低后台应用执行无效绘制操作的频率。例如,在调用doCallbacks回调方法去处理动画事件任务前,判断编舞者收到的垂直同步信号为第K个垂直同步信号。当K小于第一阈值时,使编舞者跳过处理动画事件任务;当K等于第一阈值时,允许编舞者处理动画事件任务,并将K清零后重新计数。
可以理解的是,通过拦截编舞者接收垂直同步信号或者拦截编舞者处理动画事件任务,可以降低后台应用执行无效绘制操作的频率。
当步骤S1201中确定的后台绘制频率等于垂直同步信号的产生频率(或屏幕刷新率)时, 即应用程序不以界面刷新目的执行绘制操作,此时可以根据后台绘制频率确定最小时间间隔T1,并根据T1去确定需要被拦截的绘制操作,以及根据T1确定可以被执行的绘制操作。
具体的,当应用程序转变为后台应用后,若应用程序的编舞者请求垂直同步信号的频率小于垂直同步信号的产生频率(或屏幕刷新率),可以认为该应用为出于非刷新界面的目的进行绘制操作的。在该情况下,当应用程序的编舞者接收到第一个垂直同步信号时,执行默认的绘制的操作;当应用程序接收到的非第一个垂直同步信号时,可以去判断该垂直同步信号与上一个垂直同步信号之间的时间间隔。若时间间隔小于后台绘制频率对应的时间间隔阈值,则拦截该垂直同步信号对应的绘制操作;若时间间隔大于后台绘制频率对应的时间间隔阈值,则执行该垂直同步信号对应的绘制操作。
下面以图16所示的内容为例,具体的介绍,当应用程序出于非刷新界面目的进行绘制操作时,是如何拦截无效的绘制操作的。
图16为本申请实施例中拦截编舞者绘制操作的一个示例性示意图。
当应用程序的后台绘制频率为30Hz时,其参数T1为3/90秒。如图16中(A)所示,应用程序的编舞者每隔1/90秒请求并接收到SurfaceFlinger发送的垂直同步信号。故在图16中(A)所示的情况中,该应用程序是出于刷新界面目的进行绘制操作。应用程序在第2/90秒执行了一次无效的绘制操作的情况下,下一次执行无效绘制操作的时间为第5/90秒。
与图16中(A)所示的内容不同,如图16中(B)所示,当应用程序的编舞者在第2/90秒请求并接收到垂直同步信号1,在第6/90秒请求并接收到垂直同步信号2,在第7/90秒请求并接收到垂直同步信号3。
可以有多种方式确定应用程序是否是出于非刷新界面的目的请求进行绘制操作的。
在图16中(B)所示的内容中,例如,在第0秒至第8/90秒内,由于应用程序向SurfaceFlinger请求垂直同步信号的频率为4/15Hz低于垂直同步信号的产生频率90Hz(或屏幕刷新率),该应用程序是出于非刷新界面目的进行绘制操作。其中,应用程序请求垂直同步信号的频率为单位时间内应用程序请求垂直同步信号的次数。
又例如,应用程序在第2/90秒时接收到垂直同步信号后,在第3/90秒没有接收到垂直同步信号,可以确定该应用程序是出于非刷新界面的目的请求进行绘制操作的。
在第2/90秒时,应用程序的编舞者接收到垂直同步信号1,并在第2/90秒前,该应用程序的编舞者没有接收到其他垂直同步信号,故编舞者可以在第2/90秒执行该垂直同步信号1对应的绘制操作;在第6/90秒时,应用程序的编舞者接收到垂直同步信号2,由于该应用程序的编舞者上一次接收垂直同步信号1在第2/90秒,时间间隔为4/90秒,大于T1,故编舞者可以在第6/90秒执行该垂直同步信号1对应的绘制操作。在第7/90秒时,应用程序的编舞者接收到垂直同步信号3,由于该应用程序的编舞者上一次接收垂直同步信号1在第6/90秒,时间间隔为1/90秒,小于T1,故该应用程序的绘制操作会被拦截。
可选的,在本申请一些实施例中,可以参考图13以及图14所示的内容,在OnVsync方法中/前拦截编舞者接收垂直同步信号,进而使得应用程序变为后台应用后执行无效的绘制操作的频率降低。
可选的,在本申请一些实施例中,可以参考图13以及图14所示的内容,通过拦截编舞者向SurfaceFlinger请求垂直同步信号,进而使得应用程序变为后台应用后执行无效的绘制操作的频率降低。
值得说明的是,若通过拦截编舞者向SurfaceFlinger请求垂直同步信号,或者在OnVsync方法前拦截编舞者接收垂直同步信号,需要对编舞者进行解耦以使得仅仅阻止编舞者执行绘制操作,而不会影响到编舞者的其他功能的正常工作。
可选的,在本申请一些实施例中,可以参考图13以及图14所示的内容,通过删除存储动画事件任务的单向链表中的数据,进而使得应用程序变为后台应用后执行无效的绘制操作的频率降低。
下面结合图12所示的应用执行绘制操作的方法,以图16以及图17所示的内容为例,对本申请实施例中的应用执行绘制操作的方法进行示例性描述。
图17为本申请实施例中管控后台应用的无效的绘制操作场景的一个示例性示意图。
如图17所示,用户启动应用程序时,活动管理服务可以获取到应用程序的注册信息。注册信息用于唯一标识该应用程序。例如,注册信息可以是该应用程序的包名,或者是该应用程序的进程名,在此不作限定。
用户启动应用程序后,该应用程序会初始化至少一个编舞者和绘制频率限制模块。
用户启动应用程序后,应用程序初始化编舞者和绘制频率限制模块。其中,绘制频率限制模块可以通过接口回调活动管理服务中的方法,进而确定该应用程序的运行状态,即该应用程序是前台应用还是后台应用。并且,绘制频率限制模块还可以通过活动管理服务获取该应用程序的注册信息。其中,注册信息用于唯一标识该应用程序。例如,注册信息可以是应用程序的包名,或者注册信息可以是应用程序对应的进程名,在此不做限定。
当该应用程序为前台应用时,编舞者可以执行默认的绘制操作。或者编舞者在执行默认的绘制操作前,向绘制频率限制模块请求是否允许进行本次绘制,绘制频率限制模块在没有收到后台应用标识前,会一直允许编舞者进行默认的绘制操作。
当该应用程序转变为后台应用时,活动管理服务监听到该应用程序的主活动执行了onStop方法或/和该应用程序的进程的cpuset参数为background或key-background时,确定该应用程序转变为后台应用。活动服务管理会告知绘制频率限制模块该应用程序转变为后台应用。在活动管理服务确定该应用程序为后台应用后,会将后台应用标识发送给绘制频率限制模块。其中后台应用标识中可以包括应用程序的注册信息。绘制频率限制模块收到后台应用标识后,可以根据绘制频率限制策略确定后台绘制频率。
当该应用程序变为后台应用后,由于该应用程序没有被冻结,该应用程序的编舞者会向SurfaceFlinger发送请求垂直同步信号。并且响应于应用程序的请求,SurfaceFlinger会向该应用程序的编舞者发送垂直同步信号。
应用程序的编舞者在接收到垂直同步信号后,执行绘制操作前,会向绘制频率限制模块发送请求绘制信息。当编舞者收到绘制频率限制模块的允许绘制请求时,编舞者继续执行本次无效的绘制操作;而当编舞者没有收到绘制频率限制模块的允许绘制请求时,编舞者直接结束本次无效的绘制操作。其中,绘制频率限制模块根据后台绘制频率确定是否允许编舞者进行本次无效的绘制操作可以参考上文图12中所示的内容,此处不再赘述。
值得说明的是,绘制频率限制模块可以位于应用的编舞者内部,也可以位于操作系统的服务中。
结合图12中的内容以及上文中表1所示的绘制频率限制策略,以音乐这一应用程序为例,具体的介绍图17所示的场景。
当用户启动音乐时,活动管理服务可以获取音乐的包名为com.android.mediacenter,进程名为HWMusic。活动管理服务器将音乐的包名或/和进程名发送给绘制频率限制模块。绘制频率限制模块根据当前垂直同步信号频率(60Hz)和音乐的注册信息,确定音乐的后台绘制频率为10Hz。
当用户将音乐切换至后台时,活动管理服务器将后台应用标识发送到绘制频率限制模块。此时当音乐的编舞者接收到垂直同步信号后,该编舞者向绘制频率限制模块请求绘制。绘制频率限制模块每接收到编舞者的5次绘制请求,允许编舞者执行绘制操作一次,使得音乐的编舞者的执行无效的绘制操作的频率降低为10hz。
当用户将音乐从后台切换至前台时,活动管理服务器通知绘制频率限制模块:该音乐转变为前台应用。此时,绘制频率限制模块每次接收到编舞者的绘制请求,都会运行编舞者进行绘制操作。
图18为本申请实施例中管控后台应用的无效的绘制操作场景的另一个示例性示意图。
如图18所示,与图17所示内容类似的,用户启动应用程序后,会初始化该应用程序的编舞者,并在初始化编舞者的过程中,初始化该编舞者中的绘制频率限制模块。在初始化绘制频率限制模块后,绘制频率限制模块根据绘制频率限制策略,确定该应用程序的后台绘制频率。
当该应用程序为前台应用时,应用程序的编舞者执行默认的绘制操作。
当该应用程序转变为后台应用时,活动管理服务将后台应用标识传给绘制频率限制模块。绘制频率限制模块收到后台应用标识后,确定该应用程序为后台应用。
当该应用程序转变为后台应用后,编舞者请求、并接收到垂直同步信号后,可以使用doFrame方法执行绘制操作。绘制频率限制模块可以拦截编舞者处理动画事件任务,使得编舞者实质上没有执行本次无效的绘制操作。
当应用程序从后台应用转变为前台应用后,活动管理服务向该应用程序的编舞者发送前台应用标识。绘制频率限制模块在接收到前台应用标识后,确定该编舞者所属的应用程序转变为前台应用,进而不会拦截编舞者处理动画事件任务,使得编舞者可以执行默认的绘制操作。
上述实施例中所用,根据上下文,术语“当…时”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (25)

  1. 一种应用执行绘制操作的方法,其特征在于,包括:
    电子设备启动第一应用程序;
    当所述第一应用程序为前台应用时,所述电子设备以第一频率执行绘制操作,所述绘制操作用于为所述第一应用程序绘制视图;
    当所述第一应用程序从前台应用切换为后台应用后,所述电子设备以第二频率执行所述绘制操作,所述第二频率小于所述第一频率;
    其中,所述第一频率为所述第一应用程序接收垂直同步信号的频率。
  2. 根据权利要求1所述的方法,其特征在于,当所述第一应用程序从前台应用切换为后台应用后,所述电子设备以第二频率执行所述绘制操作,具体包括:
    当所述第一应用程序从前台应用切换为后台应用后,所述电子设备指示所述第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  3. 根据权利要求1所述的方法,其特征在于,当所述第一应用程序从前台应用切换为后台应用后,所述电子设备以第二频率执行所述绘制操作,具体包括:
    当所述第一应用程序从前台应用切换为后台应用后,所述电子设备指示所述第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述N为小于所述K的正整数。
  4. 根据权利要求1所述的方法,其特征在于,当所述第一应用程序从前台应用切换为后台应用后,所述电子设备以第二频率执行所述绘制操作,具体包括:
    当所述第一应用程序从前台应用切换为后台应用后,所述电子设备删除所述第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  5. 根据权利要求2至4中任一项所述的方法,其特征在于,所述N与所述K的比值对应于所述第二频率与所述第一频率的比值。
  6. 根据权利要求1至5中任一项所述的方法,其特征在于,电子设备启动第一应用程序后,还包括:
    所述电子设备根据绘制频率限制策略和所述第一应用程序确定所述第二频率。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述电子设备启动第一应用程序后,所述方法还包括:
    所述电子设备根据活动管理服务和/或所述第一应用程序的进程的cpuset参数确定所述第一应用程序为前台应用或者后台应用。
  8. 一种应用执行绘制操作的方法,其特征在于,包括:
    电子设备启动第一应用程序;
    所述电子设备显示所述第一应用程序的界面,所述电子设备以第一频率执行绘制操作,所述绘制操作用于为所述第一应用程序绘制视图;
    所述电子设备关闭所述第一应用程序的界面的显示,所述电子设备以第二频率执行所述绘制操作,所述第二频率小于所述第一频率;
    其中,所述第一频率为所述第一应用程序接收垂直同步信号的频率。
  9. 根据权利要求8所述的方法,其特征在于,所述电子设备以第二频率执行所述绘制操作,具体包括:
    所述电子设备指示所述第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于K的正整数。
  10. 根据权利要求8所述的方法,其特征在于,所述电子设备以第二频率执行所述绘制操作,具体包括:
    所述电子设备指示所述第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于K的正整数。
  11. 根据权利要求8所述的方法,其特征在于,所述电子设备以第二频率执行所述绘制操作,具体包括:
    所述电子设备删除所述第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于K的正整数。
  12. 根据权利要求9至11中任一项所述的方法,其特征在于,所述N与所述K的比值对应于所述第二频率与所述第一频率的比值。
  13. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;
    所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
    启动第一应用程序;当所述第一应用程序为前台应用时,以第一频率执行绘制操作,所述绘制操作用于为所述第一应用程序绘制视图;当所述第一应用程序从前台应用切换为后台应用后,以第二频率执行所述绘制操作,所述第二频率小于所述第一频率;其中,所述第一频率为所述第一应用程序接收垂直同步信号的频率。
  14. 根据权利要求13所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    当所述第一应用程序从前台应用切换为后台应用后,指示所述第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得所述电子设备以所述第 二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  15. 根据权利要求13所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    当所述第一应用程序从前台应用切换为后台应用后,指示所述第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  16. 根据权利要求13所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    当所述第一应用程序从前台应用切换为后台应用后,删除所述第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  17. 根据权利要求13至16中任一项所述的电子设备,其特征在于,所述N与所述K的比值对应于所述第二频率与所述第一频率的比值。
  18. 根据权利要求13至17中任一项所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:
    根据绘制频率限制策略和所述第一应用程序确定所述第二频率。
  19. 根据权利要求13至18中任一项所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:
    根据活动管理服务和/或所述第一应用程序的进程的cpuset参数确定所述第一应用程序为前台应用或者后台应用。
  20. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;
    所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
    启动第一应用程序;所述电子设备显示所述第一应用程序的界面,以第一频率执行绘制操作,所述绘制操作用于为所述第一应用程序绘制视图;关闭所述第一应用程序的界面的显示,以第二频率执行所述绘制操作,所述第二频率小于所述第一频率;其中,所述第一频率为所述第一应用程序接收垂直同步信号的频率。
  21. 根据权利要求20所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    指示所述第一应用程序的编舞者只对接收到的K个垂直同步信号中的N个垂直同步信号作出响应,使得所述电子设备以所述第二频率执行所述绘制操作,所述N为小于所述K的正整数。
  22. 根据权利要求20所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    指示所述第一应用程序的编舞者只处理接收到的K个垂直同步信号中N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  23. 根据权利要求20所述的电子设备,其特征在于,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:
    删除所述第一应用程序的编舞者接收到的K个垂直同步信号中的K-N个垂直同步信号所对应的动画事件任务,使得所述电子设备以所述第二频率执行所述绘制操作,所述K为正整数,所述N为小于所述K的正整数。
  24. 根据权利要求21至23中任一项所述的电子设备,其特征在于,所述N与所述K的比值对应于所述第二频率与所述第一频率的比值。
  25. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求1至12中任一项所述的方法。
PCT/CN2022/081926 2021-03-24 2022-03-21 应用执行绘制操作的方法及电子设备 WO2022199509A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP22774170.9A EP4280056A1 (en) 2021-03-24 2022-03-21 Method for application performing drawing operation, and electronic device
JP2023558327A JP2024515462A (ja) 2021-03-24 2022-03-21 アプリケーションによる描画操作を実行する方法及び電子装置
US18/466,894 US20230418696A1 (en) 2021-03-24 2023-09-14 Method for performing drawing operation by application and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110316341.X 2021-03-24
CN202110316341.XA CN113553130B (zh) 2021-03-24 2021-03-24 应用执行绘制操作的方法及电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/466,894 Continuation US20230418696A1 (en) 2021-03-24 2023-09-14 Method for performing drawing operation by application and electronic device

Publications (1)

Publication Number Publication Date
WO2022199509A1 true WO2022199509A1 (zh) 2022-09-29

Family

ID=78101713

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/081926 WO2022199509A1 (zh) 2021-03-24 2022-03-21 应用执行绘制操作的方法及电子设备

Country Status (5)

Country Link
US (1) US20230418696A1 (zh)
EP (1) EP4280056A1 (zh)
JP (1) JP2024515462A (zh)
CN (2) CN116560771A (zh)
WO (1) WO2022199509A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116560771A (zh) * 2021-03-24 2023-08-08 华为技术有限公司 一种应用执行绘制操作的方法及电子设备
CN116048907A (zh) * 2022-06-24 2023-05-02 荣耀终端有限公司 后台绘制的检测方法、电子设备及计算机可读存储介质
CN116055611B (zh) * 2022-06-24 2023-11-03 荣耀终端有限公司 绘制操作的执行方法、电子设备及可读介质
CN117724863A (zh) * 2022-08-30 2024-03-19 荣耀终端有限公司 一种目标信号处理方法和电子设备
CN117991940A (zh) * 2022-11-04 2024-05-07 荣耀终端有限公司 一种图像绘制方法及电子设备
CN117112154A (zh) * 2023-04-21 2023-11-24 荣耀终端有限公司 线程调度方法及相关装置
CN116594543B (zh) * 2023-07-18 2024-03-26 荣耀终端有限公司 显示方法、设备及可读存储介质

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110096077A1 (en) * 2009-10-27 2011-04-28 Microsoft Corporation Controlling animation frame rate of applications
CN106027942A (zh) * 2016-05-20 2016-10-12 广东欧珀移动通信有限公司 一种帧率控制方法及装置
CN106327540A (zh) * 2015-07-03 2017-01-11 高德软件有限公司 基于OpenGL View的控制方法、装置及终端
CN106933587A (zh) * 2017-03-10 2017-07-07 广东欧珀移动通信有限公司 一种图层绘制控制方法、装置及移动终端
CN108628562A (zh) * 2017-03-23 2018-10-09 中科创达软件股份有限公司 一种屏幕刷新方法及系统
CN108646906A (zh) * 2018-03-27 2018-10-12 广东欧珀移动通信有限公司 帧率调整方法、装置、存储介质及智能终端
CN110928396A (zh) * 2019-11-18 2020-03-27 Oppo(重庆)智能科技有限公司 屏幕刷新方法及相关设备
CN111787602A (zh) * 2020-07-01 2020-10-16 深圳传音控股股份有限公司 终端省电方法、终端及可读存储介质
CN113553130A (zh) * 2021-03-24 2021-10-26 华为技术有限公司 应用执行绘制操作的方法及电子设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5036737B2 (ja) * 2009-01-23 2012-09-26 三菱電機株式会社 操作端末、操作端末の画面表示方法
CN108733193B (zh) * 2018-03-27 2020-06-30 Oppo广东移动通信有限公司 智能调整帧率的方法、装置、存储介质及智能终端

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110096077A1 (en) * 2009-10-27 2011-04-28 Microsoft Corporation Controlling animation frame rate of applications
CN106327540A (zh) * 2015-07-03 2017-01-11 高德软件有限公司 基于OpenGL View的控制方法、装置及终端
CN106027942A (zh) * 2016-05-20 2016-10-12 广东欧珀移动通信有限公司 一种帧率控制方法及装置
CN106933587A (zh) * 2017-03-10 2017-07-07 广东欧珀移动通信有限公司 一种图层绘制控制方法、装置及移动终端
CN108628562A (zh) * 2017-03-23 2018-10-09 中科创达软件股份有限公司 一种屏幕刷新方法及系统
CN108646906A (zh) * 2018-03-27 2018-10-12 广东欧珀移动通信有限公司 帧率调整方法、装置、存储介质及智能终端
CN110928396A (zh) * 2019-11-18 2020-03-27 Oppo(重庆)智能科技有限公司 屏幕刷新方法及相关设备
CN111787602A (zh) * 2020-07-01 2020-10-16 深圳传音控股股份有限公司 终端省电方法、终端及可读存储介质
CN113553130A (zh) * 2021-03-24 2021-10-26 华为技术有限公司 应用执行绘制操作的方法及电子设备

Also Published As

Publication number Publication date
CN113553130A (zh) 2021-10-26
JP2024515462A (ja) 2024-04-10
EP4280056A1 (en) 2023-11-22
CN116560771A (zh) 2023-08-08
CN113553130B (zh) 2023-04-28
US20230418696A1 (en) 2023-12-28

Similar Documents

Publication Publication Date Title
WO2021027747A1 (zh) 一种界面显示方法及设备
WO2022199509A1 (zh) 应用执行绘制操作的方法及电子设备
WO2020108356A1 (zh) 一种应用显示方法及电子设备
US11573829B2 (en) Task processing method and apparatus, terminal, and computer readable storage medium
WO2021213164A1 (zh) 应用界面交互方法、电子设备和计算机可读存储介质
CN114443277A (zh) 内存管理方法、装置、电子设备以及计算机可读存储介质
WO2021036770A1 (zh) 一种分屏处理方法及终端设备
WO2021052415A1 (zh) 资源调度方法及电子设备
WO2021223539A1 (zh) 射频资源分配方法及装置
WO2021135838A1 (zh) 一种页面绘制方法及相关装置
WO2022078105A1 (zh) 内存管理方法、电子设备以及计算机可读存储介质
WO2022127632A1 (zh) 一种资源管控方法及设备
WO2022095744A1 (zh) Vr显示控制方法、电子设备及计算机可读存储介质
WO2022161110A1 (zh) 应用显示方法、装置、芯片系统、介质及程序产品
WO2022206681A1 (zh) 一种窗口的显示方法以及相关装置
WO2022052897A1 (zh) 调整内存配置参数的方法和装置
WO2021190524A1 (zh) 截屏处理的方法、图形用户接口及终端
WO2023066165A1 (zh) 动画效果显示方法及电子设备
WO2022135195A1 (zh) 显示虚拟现实界面的方法、装置、设备和可读存储介质
WO2022188511A1 (zh) 语音助手唤醒方法及装置
WO2022033355A1 (zh) 一种邮件处理方法及电子设备
CN112783418B (zh) 一种存储应用程序数据的方法及移动终端
WO2022262291A1 (zh) 应用的图像数据调用方法、系统、电子设备及存储介质
WO2023001208A1 (zh) 多文件同步方法及电子设备
WO2022143891A1 (zh) 焦点同步方法及电子设备

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

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022774170

Country of ref document: EP

Effective date: 20230816

WWE Wipo information: entry into national phase

Ref document number: 2023558327

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE