Power consumption monitoring method, power consumption monitoring device and storage medium
By using a monitoring program submodule in the local framework layer, which is independent of the source program submodule, and utilizing the Binder communication mechanism to obtain the battery attributes and overall voltage information of the terminal device, the problem of additional power consumption introduced in the power consumption monitoring of the terminal device is solved, and the test accuracy is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2022-04-11
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, power consumption monitoring methods for terminal devices introduce additional power consumption through application-layer monitoring, affecting test accuracy.
The monitoring program submodule in the local framework layer is independent of the source program submodule. It uses the Binder communication mechanism to obtain battery attribute information and overall voltage information from the application framework layer to determine the power consumption of the terminal device.
It achieves non-intrusive power consumption monitoring, reduces additional power consumption during the monitoring process, and improves the accuracy of power consumption testing for terminal devices.
Smart Images

Figure CN114780334B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of terminal technology, and more particularly to a power consumption monitoring method, a power consumption monitoring device, and a storage medium. Background Technology
[0002] During the testing of terminal devices, power consumption data monitoring is an indispensable part; however, power consumption monitoring can easily introduce additional power consumption.
[0003] In related technologies, monitoring applications are developed, which use the broadcast mechanism of the application framework layer within the terminal device to broadcast data from the underlying layer of the terminal device. However, such monitoring applications themselves introduce a large amount of power consumption into the terminal device, resulting in low accuracy of power consumption testing. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a power consumption monitoring method, a power consumption monitoring device, and a storage medium.
[0005] According to a first aspect of the present disclosure, a power consumption monitoring method is provided, applied to a terminal device, the terminal device comprising: an application framework layer, a local framework layer, and a kernel layer; the method comprising:
[0006] The first process corresponding to the monitoring program submodule of the local framework layer is used to obtain the battery attribute information of the terminal device from the application framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operations of the source program submodule and the compilation operations of the monitoring program submodule are independent of each other;
[0007] Using the first process, obtain the current overall voltage information of the terminal device;
[0008] Based on the overall device voltage information and the battery attribute information, the current overall device power consumption information of the terminal device is determined.
[0009] Optionally, the first process corresponding to the monitoring program submodule of the local framework layer obtains the battery attribute information of the terminal device from the application framework layer, including:
[0010] The battery attribute information of the terminal device is obtained from the application framework layer through communication between the first process and the second process of the application framework layer.
[0011] Optionally, obtaining the battery attribute information of the terminal device from the application framework layer through communication between the first process and the second process of the application framework layer includes:
[0012] The first process calls the second process through a preset communication interface, and returns the battery attribute information of the terminal device to the first process via the preset communication interface; wherein, the preset communication interface is the Binder communication interface pre-configured by the second process.
[0013] Optionally, the battery attribute information includes: power information;
[0014] The step of using the first process to obtain the current overall voltage information of the terminal device includes:
[0015] When a change in the power information is detected, the first process is used to obtain the current overall voltage information of the terminal device.
[0016] Optionally, obtaining the current overall voltage information of the terminal device using the first process includes:
[0017] The system captures instructions through the first process to obtain the current overall voltage information of the terminal device.
[0018] Optionally, the battery attribute information includes: overall current information;
[0019] The step of determining the current power consumption information of the terminal device based on the overall device voltage information and the battery attribute information includes:
[0020] Based on the overall voltage information and the overall current information, the instantaneous power consumption information of the terminal device is determined.
[0021] Optionally, before obtaining the battery attribute information of the terminal device from the application framework layer, the method further includes:
[0022] The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
[0023] According to a second aspect of the present disclosure, a power consumption monitoring device is provided, the terminal device comprising: an application framework layer, a local framework layer, and a kernel layer; the device comprising:
[0024] The first acquisition module is used to acquire battery attribute information of the terminal device from the application framework layer using the first process corresponding to the monitoring program submodule of the local framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operation of the source program submodule and the compilation operation of the monitoring program submodule are independent of each other.
[0025] The second acquisition module is used to acquire the current overall voltage information of the terminal device using the first process;
[0026] The determination module is used to determine the current power consumption information of the terminal device based on the overall device voltage information and the battery attribute information.
[0027] Optionally, the first acquisition module is configured to:
[0028] The battery attribute information of the terminal device is obtained from the application framework layer through communication between the first process and the second process of the application framework layer.
[0029] Optionally, the first acquisition module is configured to:
[0030] The first process calls the second process through a preset communication interface, and returns the battery attribute information of the terminal device to the first process via the preset communication interface; wherein, the preset communication interface is the Binder communication interface pre-configured by the second process.
[0031] Optionally, the battery attribute information includes: power information;
[0032] The second acquisition module is used to acquire the current overall voltage information of the terminal device by utilizing the first process when a change in the power information is detected.
[0033] Optionally, the second acquisition module is used for:
[0034] The system captures instructions through the first process to obtain the current overall voltage information of the terminal device.
[0035] Optionally, the battery attribute information includes: overall current information;
[0036] The determining module is used to determine the current instantaneous power consumption information of the terminal device based on the overall voltage information and the overall current information.
[0037] Optionally, the device further includes: a reporting module, used for:
[0038] The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
[0039] According to a third aspect of the present disclosure, a power consumption monitoring device is provided, comprising:
[0040] processor;
[0041] Memory used to store executable instructions;
[0042] The processor is configured to, when executing executable instructions stored in the memory, implement the steps of the power consumption monitoring method described in the first aspect of this disclosure.
[0043] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of a power consumption monitoring device, the power consumption monitoring device is enabled to perform the steps of the power consumption monitoring method as described in the first aspect of the present disclosure.
[0044] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0045] This embodiment of the disclosure obtains battery attribute information and current overall voltage information of the terminal device from the application framework layer by utilizing the first process of a monitoring program submodule that is independent of the source program submodule in the local framework layer. This allows for the acquisition of the terminal device's underlying data without modifying the local code files within the terminal device's source program submodule, thereby determining the terminal device's power consumption and achieving non-intrusive power consumption monitoring of the terminal device. Furthermore, it eliminates the need for the application layer's monitoring application to listen to the terminal device's underlying power consumption data, reducing power consumption introduced by the monitoring application during the power consumption monitoring process and improving the accuracy of the terminal device's power consumption test.
[0046] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0047] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0048] Figure 1 This is a schematic diagram of a multi-level battery power reporting system based on the Android operating system, provided by related technologies.
[0049] Figure 2 This is a flowchart illustrating a power consumption detection method according to an exemplary embodiment. Figure 1 .
[0050] Figure 3 This is a flowchart illustrating a power consumption monitoring method according to an exemplary embodiment. Figure 2 .
[0051] Figure 4 This is a schematic diagram of the structure of a power consumption monitoring device according to an exemplary embodiment.
[0052] Figure 5 This is a block diagram illustrating a terminal device according to an exemplary embodiment. Detailed Implementation
[0053] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0054] Power consumption is a crucial indicator in terminal device testing. Related technologies utilize the Android operating system's power reporting process to monitor the power consumption data of terminal devices. For example... Figure 1 As shown, Figure 1 This is a schematic diagram of a multi-level battery power reporting system based on the Android operating system, provided by related technologies.
[0055] The kernel layer, which is part of the battery driver of the terminal device, is responsible for interacting with the hardware. When the battery power information changes, it generates corresponding battery events (uevent) and reports them.
[0056] The battery information daemon (healthd) within the native framework layer runs a system service for battery properties, which is responsible for listening to uevents reported by the kernel layer and monitoring the battery level in real time.
[0057] The BatteryService in the application framework listens for battery information change messages in the BatteryProperties service and forwards these messages to the application layer (APP) via system broadcast.
[0058] The application layer listens for system broadcasts and updates the system user interface accordingly.
[0059] However, since this power consumption data monitoring method listens at the application layer, and the monitoring application runs in the background of the terminal device, the monitoring application itself introduces a lot of power consumption, resulting in low accuracy of the power consumption test results of the terminal device.
[0060] This disclosure provides a power consumption monitoring method. Figure 2 This is a flowchart illustrating a power consumption detection method according to an exemplary embodiment. Figure 1 ,like Figure 2 As shown; the method includes:
[0061] Step S101: Using the first process corresponding to the monitoring program submodule of the local framework layer, obtain the battery attribute information of the terminal device from the application framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operation of the source program submodule and the compilation operation of the monitoring program submodule are independent of each other.
[0062] Step S102: Using the first process, obtain the current overall voltage information of the terminal device;
[0063] Step S103: Based on the overall voltage information and the battery attribute information, determine the current overall power consumption information of the terminal device.
[0064] The power consumption monitoring method shown in this disclosure can be applied to a terminal device, which includes an application framework layer, a local framework layer, and a kernel layer. The terminal device can be a smartphone, tablet computer, or wearable electronic device, etc.
[0065] In step S101, the local framework layer includes a source program submodule and a monitoring program submodule. The source program submodule is used to store local code files in the terminal device; the monitoring program submodule is used to store power consumption monitoring code files, and the power consumption monitoring code files stored in the monitoring program submodule are not compiled simultaneously with the local code files stored in the source program submodule.
[0066] It is understood that the compilation and execution processes of the power consumption monitoring code files stored in the monitoring program submodule and the compilation and execution processes of the local code files stored in the source program submodule are independent of each other.
[0067] The power consumption monitoring code file in the monitoring program submodule of the local framework layer is compiled to generate an executable file, and the executable file is run to generate the first process. The first process interacts with the application framework layer to obtain the battery attribute information of the terminal device.
[0068] It should be noted that the Android operating system can be divided into four layers: the application layer, the application framework layer, the native framework layer, and the kernel layer (kernel space).
[0069] The application layer consists of all applications running on the terminal device, including pre-installed system applications and third-party applications installed by the user.
[0070] The application framework layer provides support to the application layer, enabling the correct identification and execution of application layer code. The application framework layer is implemented based on code (such as Java code) running in the virtual machine host environment of the terminal device. Structurally, it consists of applications and application frameworks, including any methods formed from Java code. Communication between application components in the application layer is achieved through centralized scheduling and message passing provided by the application framework layer, rather than direct communication between application components.
[0071] The local framework layer is implemented by native code in the terminal device, including kernel and library files implemented by C / C++ code, which are used to provide native services and native implementation methods corresponding to the link libraries. The native services and native implementation methods provided by the local framework layer can be used by different components. On the one hand, the local framework layer can communicate with the code information of the upper layer (i.e., the application framework layer), and on the other hand, it can interact with the hardware of the lower layer (kernel layer) to ensure the normal operation of the terminal device.
[0072] The Android operating system is implemented based on the kernel layer. The core system services of the Android operating system, such as security, memory management, process management, network protocols, and driver models, all rely on the kernel layer for implementation.
[0073] It is understood that the embodiments of this disclosure obtain the battery attribute information of the terminal device from the application framework layer by utilizing the first process of the monitoring program submodule, which is independent of the source program submodule in the local framework layer. This allows the acquisition of the underlying data of the terminal device without modifying the local code files in the source program submodule of the terminal device, thereby determining the power consumption of the terminal device and reducing the introduction of additional power consumption during the power consumption monitoring process.
[0074] In this embodiment of the disclosure, the battery attribute information may include: battery power, battery capacity, average battery temperature, charge / discharge state, and current remaining power. It is understood that the battery attribute information within the terminal device can, to some extent, reflect the power consumption of the terminal device. For example, if the remaining power in the terminal device's battery is consumed quickly, it indicates that the terminal device's current power consumption is high.
[0075] In step S102, the overall voltage information may include: the power supply voltage of the battery inside the terminal device that supplies power to the terminal device; and the power consumption of the terminal device is related to the power supply voltage value of the battery inside the terminal device.
[0076] It is understandable that the remaining power of the battery in the terminal device may vary, and the supply voltage of the battery to power the terminal device may also vary. Therefore, when determining the power consumption of the terminal device, it is necessary to obtain the current supply voltage of the battery in the terminal device through the first process so that the current power consumption of the terminal device can be analyzed based on the current supply voltage of the battery.
[0077] In step S103, after obtaining the current overall voltage information and battery attribute information of the terminal device, the first process can determine the current overall power consumption information of the terminal device based on the overall voltage information and battery attribute information.
[0078] This embodiment of the disclosure obtains the battery attribute information of the terminal device and the current overall voltage information of the terminal device from the application framework layer by utilizing the first process of the monitoring program submodule, which is independent of the source program submodule in the local framework layer. This allows the acquisition of the terminal device's underlying data without modifying the local code files within the terminal device's source program submodule, thereby determining the terminal device's power consumption. It eliminates the need for the application layer's monitoring application to listen to the terminal device's underlying power consumption data, reducing power consumption introduced by the monitoring application during power consumption monitoring and improving the accuracy of terminal device power consumption testing.
[0079] Optionally, the first process corresponding to the monitoring program submodule of the local framework layer obtains the battery attribute information of the terminal device from the application framework layer, including:
[0080] The battery attribute information of the terminal device is obtained from the application framework layer through communication between the first process and the second process of the application framework layer.
[0081] In this embodiment of the disclosure, the second process may be the BatteryService process of the application framework layer; the BatteryService process provides an interface for obtaining battery attribute information.
[0082] It should be noted that BatteryService is an important service for battery management. This service inherits from the system service (SystemService) in the application framework layer; BatteryService is started when SystemService starts the core services.
[0083] Understandably, the Android operating system's kernel layer creates and starts the Init process; the Init process then creates and starts the Zygote subprocess; the Zygote subprocess loads the initialization configuration file, creates and starts the SystemService process, and the SystemService process creates and starts the BatteryService process, thus completing the Android operating system's startup process.
[0084] In this embodiment of the disclosure, the first process corresponding to the monitoring program submodule of the local framework layer and the second process of the application framework layer complete the transmission of battery attribute information of the terminal device through inter-process communication.
[0085] Optionally, obtaining the battery attribute information of the terminal device from the application framework layer through communication between the first process and the second process of the application framework layer includes:
[0086] The first process calls the second process through a preset communication interface, and returns the battery attribute information of the terminal device to the first process via the preset communication interface; wherein, the preset communication interface is the Binder communication interface pre-configured by the second process.
[0087] In this embodiment of the disclosure, based on the preset communication interface, the first process corresponding to the monitoring program submodule of the local framework layer communicates with the second process of the application framework layer via Binder, and transmits the battery attribute information of the terminal device obtained by the second process to the first process via the preset communication interface.
[0088] It's important to note that the Binder communication mechanism is a form of inter-process communication in the Android operating system, and one of its most important features. The four main components of the Android operating system are: Activity, Service, Broadcast, and ContentProvider. These four components run between different processes, and the Binder communication mechanism acts as a bridge for communication between them.
[0089] Each Android operating system process can only run within its own virtual address space. The virtual address space consists of two independent spaces: user space and kernel space. User space cannot be shared between client and server processes, but kernel space can be shared between them. Every communication between the client and server processes is achieved through the Binder driver located in kernel space.
[0090] The communication process based on the Binder communication mechanism mainly includes the following three steps:
[0091] Service registration: The service process must first register the service with the ServiceManager. In this process, the Service is the client and the ServiceManager is the server.
[0092] To obtain a service, the Client process first retrieves the corresponding Service from the ServiceManager before using it. In this process, the Client acts as the client-side application, and the ServiceManager acts as the server-side application.
[0093] When using a service, the client establishes a communication path with the service process based on the service information it receives, and then can directly interact with the service. In this process, the client is the client-side application, and the service is the server-side application.
[0094] Therefore, the preset communication interface is the interface that the second process pre-registers and configures in the ServiceManager; the first process can obtain the preset communication interface of the second process from the ServiceManager, and establish a communication path with the second process based on the preset communication interface, and interact with the second process.
[0095] Here, the preset communication interface can be the BinderService communication interface of BatteryProperties. It is understood that during the initialization process of the Android operating system, the BatteryService process in the application framework layer registers a BatteryProperties service and manages it in the ServiceManager; the BatteryProperties service is used to listen for battery events reported in the kernel layer and monitor the battery attribute information in real time. After the BinderService communication interface of BatteryProperties is invoked, the battery attribute information listened to by the BatteryProperties service will be transmitted via the BinderService communication interface.
[0096] Optionally, the battery attribute information includes: power information;
[0097] The step of using the first process to obtain the current overall voltage information of the terminal device includes:
[0098] When a change in the power information is detected, the first process is used to obtain the current overall voltage information of the terminal device.
[0099] In this embodiment of the disclosure, the overall voltage of the terminal device is basically in a relatively stable state during the use of the terminal device. However, there is a mapping relationship between the overall voltage of the terminal device and the power of the battery inside the terminal device. It can be understood that when the power of the battery inside the terminal device changes, the overall voltage of the terminal device will also change.
[0100] This embodiment of the disclosure obtains the battery power information of the terminal device through communication between the first process corresponding to the monitoring program submodule of the local framework layer and the second process of the application framework layer; and monitors the power information. When the power information changes, the first process is used to obtain the current overall voltage information of the terminal device.
[0101] It should be noted that in order to achieve real-time monitoring of the power consumption of the terminal device, the first process needs to continuously acquire the overall voltage information of the terminal device, which can easily lead to the CPU's efficiency cores being fully loaded and power consumption being too high. Considering that there is a mapping relationship between the overall voltage of the terminal device and the battery level in the terminal device, when a change in the battery level in the terminal device is detected, the first process is used to acquire the current overall voltage information of the terminal device. This not only enables real-time monitoring of changes in the power consumption of the terminal device, but also reduces the power consumption of the terminal device and improves the user experience.
[0102] Optionally, obtaining the current overall voltage information of the terminal device using the first process includes:
[0103] The system captures instructions through the first process to obtain the current overall voltage information of the terminal device.
[0104] In this embodiment of the disclosure, the system capture command may be the dumpsys battery command.
[0105] It should be noted that dumpsys is a debugging tool that runs on Android devices and can be used to view system service information. You can use the dumpsys command followed by query parameters to view the specific service information of the Android device corresponding to those parameters.
[0106] The first process executes the dumpsys battery command to obtain the current overall voltage information of the terminal device.
[0107] Optionally, the battery attribute information includes: overall current information;
[0108] The step of determining the current power consumption information of the terminal device based on the overall device voltage information and the battery attribute information includes:
[0109] Based on the overall voltage information and the overall current information, the instantaneous power consumption information of the terminal device is determined.
[0110] In this embodiment of the disclosure, the overall current information may include: the power supply current of the battery inside the terminal device that supplies power to the terminal device.
[0111] By acquiring the power supply current (i.e., overall current information) and power supply voltage (i.e., overall voltage information) of the battery supplying power to the terminal device, the instantaneous power consumption value of the terminal device can be determined based on the product of the power supply current and the power supply voltage.
[0112] It should be noted that the battery inside a terminal device needs to power multiple components (such as the camera, CPU, and display screen). The number and types of components the battery needs to power may vary at different times, and the power consumption generated by different components also differs. When testing the power consumption of a terminal device, the instantaneous power consumption can be statistically analyzed. Based on multiple instantaneous power consumption readings during the test, the power consumption of the terminal device can be determined, thereby improving the accuracy of the power consumption test.
[0113] Optionally, before obtaining the battery attribute information of the terminal device from the application framework layer, the method further includes:
[0114] The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
[0115] In this embodiment of the disclosure, an executable file is generated by compiling the local code file in the source program submodule of the local framework layer, and the executable file is run to generate the third process. The third process listens to the battery attribute information detected by the kernel layer and reports the battery attribute information to the application framework layer.
[0116] Here, the third process can be the battery information daemon (healthd).
[0117] It should be noted that healthyd is an intermediary model that listens for battery events from the kernel layer and passes battery data to the application architecture layer's BatteryService. This allows the BatteryService to calculate information such as battery level display, remaining battery power, and battery level based on the transmitted battery data.
[0118] This disclosure provides a power consumption monitoring method. Figure 3 This is a flowchart illustrating a power consumption monitoring method according to an exemplary embodiment. Figure 2 ,like Figure 3 As shown, the method includes:
[0119] Step S201: Using the first process corresponding to the monitoring program submodule of the local framework layer, the second process of the application framework layer is called through a preset communication interface, and the battery power information and overall current information of the terminal device are returned to the first process through the preset communication interface; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operation of the source program submodule and the compilation operation of the monitoring program submodule are independent of each other;
[0120] In this example, a monitoring program submodule is added to the local framework layer. This monitoring program submodule stores a power consumption monitoring code file. By running the power consumption monitoring code file, a first process is generated. The first process communicates with a second process in the application framework layer to obtain the power information and overall current information stored in the application framework layer. Thus, the underlying battery data of the terminal device can be obtained without modifying the source code of the local framework layer of the terminal device.
[0121] The second process can be the BatteryService process in the application framework layer; the BatteryService process provides an interface for obtaining battery attribute information. The preset communication interface can be the BinderService communication interface of BatteryProperties pre-registered in ServiceManager by the BatteryService process.
[0122] In some embodiments, the method further includes:
[0123] The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
[0124] In this example, the third process is the healthy process, which uses the local framework layer to listen for battery events in the kernel layer and pass battery data to the BatteryService in the application framework layer.
[0125] Step S202: When a change in the power information is detected, the system capture instruction is executed using the first process to obtain the current overall voltage information of the terminal device;
[0126] In this example, the system capture command can be the dumpsys battery command.
[0127] It should be noted that calculating the power consumption information of a terminal device also requires collecting the device's overall voltage data, which can be obtained using the `dumpsys battery` command in the Android operating system. However, continuously calling this command can easily lead to full load on the CPU's efficiency cores, resulting in excessive power consumption. Considering that the overall voltage data of a terminal device is generally relatively stable during use, and that there is a mapping relationship between the overall voltage data and the current battery level of the terminal device.
[0128] Therefore, this example monitors the battery information of the terminal device and executes the dumpsysbattery command to obtain the overall voltage data of the terminal device when the battery information changes.
[0129] Step S203: Based on the overall voltage information and the overall current information, determine the current overall power consumption information of the terminal device.
[0130] In this example, after obtaining the overall voltage and current values of the terminal device, the instantaneous power consumption of the terminal device can be determined by multiplying the overall voltage and current values.
[0131] This disclosure also provides a power consumption monitoring device. Figure 4 This is a schematic diagram illustrating the structure of a power consumption monitoring device according to an exemplary embodiment. For example... Figure 4 As shown, the device 100 is applied to a terminal device, which includes: an application framework layer, a local framework layer, and a kernel layer; the device 100 includes:
[0132] The first acquisition module 101 is used to acquire battery attribute information of the terminal device from the application framework layer using the first process corresponding to the monitoring program submodule of the local framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operation of the source program submodule and the compilation operation of the monitoring program submodule are independent of each other.
[0133] The second acquisition module 102 is used to acquire the current overall voltage information of the terminal device using the first process;
[0134] The determination module 103 is used to determine the current power consumption information of the terminal device based on the overall voltage information and the battery attribute information.
[0135] Optionally, the first acquisition module 101 is configured to:
[0136] The battery attribute information of the terminal device is obtained from the application framework layer through communication between the first process and the second process of the application framework layer.
[0137] Optionally, the first acquisition module 101 is configured to:
[0138] The first process calls the second process through a preset communication interface, and returns the battery attribute information of the terminal device to the first process via the preset communication interface; wherein, the preset communication interface is the Binder communication interface pre-configured by the second process.
[0139] Optionally, the battery attribute information includes: power information;
[0140] The second acquisition module 102 is used to acquire the current overall voltage information of the terminal device by utilizing the first process when a change in the power information is detected.
[0141] Optionally, the second acquisition module 102 is used for:
[0142] The system captures instructions through the first process to obtain the current overall voltage information of the terminal device.
[0143] Optionally, the battery attribute information includes: overall current information;
[0144] The determining module 103 is used to determine the current instantaneous power consumption information of the terminal device based on the overall voltage information and the overall current information.
[0145] Optionally, the device further includes: a reporting module 104, used for:
[0146] The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
[0147] Figure 5 This is a block diagram illustrating a terminal device according to an exemplary embodiment. For example, the terminal device 800 may be a mobile phone, a mobile computer, etc.
[0148] Reference Figure 5 The terminal device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0149] Processing component 802 typically controls the overall operation of terminal device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0150] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on terminal device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0151] Power supply component 806 provides power to various components of terminal device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to terminal device 800.
[0152] Multimedia component 808 includes a screen that provides an output interface between the terminal device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0153] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when terminal device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0154] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0155] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of terminal device 800. For example, sensor assembly 814 can detect the on / off state of device 800, the relative positioning of components such as the display and keypad of terminal device 800, changes in position of terminal device 800 or a component of terminal device 800, the presence or absence of user contact with terminal device 800, orientation or acceleration / deceleration of terminal device 800, and temperature changes of terminal device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0156] Communication component 816 is configured to facilitate wired or wireless communication between terminal device 800 and other devices. Terminal device 800 can access wireless networks based on communication standards, such as Wi-Fi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0157] In an exemplary embodiment, the terminal device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0158] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of a terminal device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0159] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0160] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A power consumption monitoring method, characterized in that, The method is applied to a terminal device, which includes an application framework layer, a local framework layer, and a kernel layer; the method includes: The first process corresponding to the monitoring program submodule of the local framework layer is used to obtain the battery attribute information of the terminal device from the application framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operations of the source program submodule and the monitoring program submodule are independent of each other; the battery attribute information includes: power information; Using the first process, obtain the current overall voltage information of the terminal device; Based on the overall voltage information and the battery attribute information, the current overall power consumption information of the terminal device is determined; The step of using the first process to obtain the current overall voltage information of the terminal device includes: When a change in the power information is detected, the first process is used to obtain the current overall voltage information of the terminal device.
2. The method of claim 1, wherein, The first process corresponding to the monitoring program submodule of the local framework layer obtains the battery attribute information of the terminal device from the application framework layer, including: The battery attribute information of the terminal device is obtained from the application framework layer through communication between the first process and the second process of the application framework layer.
3. The method of claim 2, wherein, The step of obtaining the battery attribute information of the terminal device from the application framework layer through communication between the first process and the second process of the application framework layer includes: The first process calls the second process through a preset communication interface, and returns the battery attribute information of the terminal device to the first process via the preset communication interface; wherein, the preset communication interface is the Binder communication interface pre-configured by the second process.
4. The method of claim 1, wherein, The step of using the first process to obtain the current overall voltage information of the terminal device includes: The system captures instructions through the first process to obtain the current overall voltage information of the terminal device.
5. The method of claim 1, wherein, The battery attribute information includes: overall current information; The step of determining the current power consumption information of the terminal device based on the overall device voltage information and the battery attribute information includes: Based on the overall voltage information and the overall current information, the instantaneous power consumption information of the terminal device is determined.
6. The method of claim 1, wherein, Before obtaining the battery attribute information of the terminal device from the application framework layer, the method further includes: The third process corresponding to the source program submodule reports the battery attribute information of the terminal device detected by the kernel layer to the application framework layer.
7. A power consumption monitoring apparatus characterized by comprising: Applied to a terminal device, the terminal device comprising: an application framework layer, a local framework layer, and a kernel layer; the device comprising: The first acquisition module is used to acquire battery attribute information of the terminal device from the application framework layer using the first process corresponding to the monitoring program submodule of the local framework layer; wherein, the local framework layer includes a source program submodule and a monitoring program submodule, and the compilation operations of the source program submodule and the compilation operations of the monitoring program submodule are independent of each other; the battery attribute information includes: power information; The second acquisition module is used to acquire the current overall voltage information of the terminal device using the first process; the acquisition of the current overall voltage information of the terminal device using the first process includes: when a change in the power information is detected, acquiring the current overall voltage information of the terminal device using the first process. The determination module is used to determine the current power consumption information of the terminal device based on the overall device voltage information and the battery attribute information.
8. A power consumption monitoring device, characterized in that, include: processor; Memory used to store executable instructions; The processor is configured to implement the power consumption monitoring method according to any one of claims 1 to 6 when executing executable instructions stored in the memory.
9. A non-transitory computer-readable storage medium, wherein when instructions in the storage medium are executed by a processor of a power consumption monitoring device, the power consumption monitoring device is enabled to perform the power consumption monitoring method of any one of claims 1 to 6.