The application claims priority of chinese patent application filed in 2019 on 18 th month, 1 and 201910047190.5, entitled "an electronic device and a charging method thereof", and chinese patent application filed in 2019 on 26 th month, 4 and 26 th month, 201910346383.0, entitled "terminal and processing method", the entire contents of which are incorporated herein by reference.
Disclosure of Invention
The exemplary embodiment of the invention provides a terminal and a processing method, which can improve the user experience of using the terminal.
According to an aspect of the exemplary embodiments, there is provided a terminal including:
an input unit configured to receive a touch operation from a user;
a display unit configured to display a user interface; and
a processor coupled with the input unit and the display unit; the terminal also comprises a host and a main battery, the terminal is connected with an auxiliary battery,
the processor is configured to:
determining that a target application program is started;
if the main battery is determined to supply power to the host, calculating the power consumption of the target application program on the main battery;
if the secondary battery is determined to supply power to the host, calculating the power consumption of the target application program on the secondary battery;
and displaying the power consumption of the target application program on the main battery and the auxiliary battery respectively on a user interface.
In some exemplary embodiments, the calculating the power consumption of the target application on the main battery specifically includes:
determining a hardware module called by the target application program during running;
and calculating the power consumption of the target application program on the main battery according to the called time length of the hardware module and the power consumption of the hardware module in unit time.
In some exemplary embodiments, the calculating the power consumption of the target application on the secondary battery specifically includes:
determining a hardware module called by the target application program during running;
and calculating the power consumption of the target application program on the secondary battery according to the called time length of the hardware module and the power consumption of the hardware module per unit time.
In some exemplary embodiments, the target application invokes at least two hardware modules during runtime.
In some exemplary embodiments, the hardware module is a CPU, a camera module, a bluetooth module, a WIFI module, or an audio module.
In some exemplary embodiments, the target application is a system application.
In some exemplary embodiments, the target application is a third party application.
In some exemplary embodiments, the terminal is connected to the secondary battery through a rear pin contact interface.
According to another aspect of the exemplary embodiments, there is provided a processing method including: at a terminal having one or more processors, a memory, an input unit, a display unit, a main battery, and a host:
determining that a target application program is started;
if the main battery is determined to supply power to the host, calculating the power consumption of the target application program on the main battery;
if the secondary battery connected with the terminal is determined to supply power to the host, calculating the power consumption of the target application program on the secondary battery;
and displaying the power consumption of the target application program on the main battery and the auxiliary battery respectively on a user interface.
According to a further aspect of the exemplary embodiments, there is provided a computer storage medium having stored therein computer program instructions which, when run on a computer, cause the computer to perform a processing method as described above.
On the basis of the common knowledge in the field, the above preferred conditions can be combined randomly to obtain the preferred embodiments of the invention.
The positive progress effects of the invention are as follows: in the invention, the target application program is determined to be started; if the main battery is determined to supply power to the host, calculating the power consumption of the target application program on the main battery; if the secondary battery is determined to supply power to the host, calculating the power consumption of the target application program on the secondary battery; and the power consumption of the target application program on the main battery and the auxiliary battery respectively is displayed on a user interface, so that a user can visually see the power consumption of the target application program on the main battery and the auxiliary battery, and the experience of the user in operating the terminal is improved.
Detailed Description
To make the objects, technical solutions and advantages of the exemplary embodiments of the present application clearer, the technical solutions in the exemplary embodiments of the present application will be clearly and completely described below with reference to the drawings in the exemplary embodiments of the present application, and it is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments.
All other embodiments, which can be derived by a person skilled in the art from the exemplary embodiments shown in the present application without inventive effort, shall fall within the scope of protection of the present application. Moreover, while the disclosure herein has been presented in terms of exemplary one or more examples, it is to be understood that each aspect of the disclosure can be utilized independently and separately from other aspects of the disclosure to provide a complete disclosure.
It should be understood that the terms "first," "second," "third," and the like in the description and in the claims of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used are interchangeable under appropriate circumstances and can be implemented in sequences other than those illustrated or otherwise described herein with respect to the embodiments of the application, for example.
Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or device that comprises a list of elements is not necessarily limited to those elements explicitly listed, but may include other elements not expressly listed or inherent to such product or device.
The term "unit" as used herein refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the functionality associated with that element.
A block diagram of a hardware configuration of theterminal 100 according to an exemplary embodiment is exemplarily shown in fig. 1. As shown in fig. 1, theterminal 100 includes: a Radio Frequency (RF)circuit 110, amemory 120, aninput unit 130, adisplay unit 140, asensor 150, anaudio circuit 160, a Wireless Fidelity (Wi-Fi)module 170, aprocessor 180, abluetooth module 181, and apower supply 190.
TheRF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and may receive downlink data of a base station and then send the downlink data to theprocessor 180 for processing; the uplink data may be transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like.
Thememory 120 may be used to store software programs and data. Theprocessor 180 performs various functions of the terminal 100 and data processing by executing software programs or data stored in thememory 120. Thememory 120 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Thememory 120 stores an operating system that enables the terminal 100 to operate. Thememory 120 may store an operating system and various application programs, and may also store codes for performing the methods described in the embodiments of the present application.
Theinput unit 130, such as a touch screen, may be used to receive input numeric or character information, generate signal inputs related to user settings and function control of the terminal 100. Specifically, theinput unit 130 may include atouch screen 131 disposed on a front surface of the terminal 100 and may collect a touch operation by a user thereon or nearby. Theinput unit 130 in this application may receive a touch operation of a user, such as clicking a button, dragging a scroll box, and the like.
Thedisplay unit 140 may be used to display information input by the user or information provided to the user and a Graphical User Interface (GUI) of various menus of the terminal 100. Thedisplay unit 140 may include adisplay screen 141 disposed on the front surface of the terminal 100. Thedisplay screen 141 may be configured in the form of a liquid crystal display, a light emitting diode, or the like. Thedisplay unit 140 may be used to display various graphical user interfaces described herein. Thetouch screen 131 may cover thedisplay screen 141, or thetouch screen 131 and thedisplay screen 141 may be integrated to implement input and output functions of the terminal 100, and after the integration, the touch screen may be referred to as a touch display screen for short. In the present application, thedisplay unit 140 may display the application programs and the corresponding operation steps.
The terminal 100 may also include at least onesensor 150, such as anacceleration sensor 155, a light sensor, a motion sensor. The terminal 100 may also be configured with other sensors such as a gyroscope, barometer, hygrometer, thermometer, infrared sensor, and the like.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user andterminal 100. Theaudio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161. The terminal 100 may also be provided with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, converts the electrical signal into audio data after being received by theaudio circuit 160, and outputs the audio data to theRF circuit 110 to be transmitted to, for example, another terminal or outputs the audio data to thememory 120 for further processing. In this application, the microphone 162 may capture the voice of the user.
Wi-Fi belongs to a short-distance wireless transmission technology, and the terminal 100 can help a user to send and receive e-mails, browse webpages, access streaming media, and the like through the Wi-Fi module 170, and provides wireless broadband internet access for the user.
Theprocessor 180 is a control center of the terminal 100, connects various parts of the entire terminal using various interfaces and lines, and performs various functions of the terminal 100 and processes data by running or executing software programs stored in thememory 120 and calling data stored in thememory 120. In some embodiments,processor 180 may include one or more processing units; theprocessor 180 may also integrate an application processor, which mainly handles operating systems, user interfaces, applications, etc., and a baseband processor, which mainly handles wireless communications. It will be appreciated that the baseband processor described above may not be integrated into theprocessor 180. In the present application, theprocessor 180 may run an operating system, an application program, a user interface display, and a touch response, and the processing method described in the embodiments of the present application. In addition, theprocessor 180 is coupled with theinput unit 130 and thedisplay unit 140.
And thebluetooth module 181 is configured to perform information interaction with other bluetooth devices having a bluetooth module through a bluetooth protocol. For example, the terminal 100 may establish a bluetooth connection with a wearable electronic device (e.g., a smart watch) having a bluetooth module via thebluetooth module 181, so as to perform data interaction.
The terminal 100 also includes a power supply 190 (e.g., a battery) to power the various components. The power supply may be logically connected to theprocessor 180 through a power management system to manage charging, discharging, power consumption, etc. through the power management system. The terminal 100 may also be configured with power buttons for powering the terminal on and off, and locking the screen.
Fig. 2 is a schematic diagram for illustrating a user interface on a terminal (e.g.,terminal 100 of fig. 1). In some implementations, a user can open a corresponding application by touching an application icon on the user interface, or can open a corresponding folder by touching a folder icon on the user interface.
Fig. 3 (a) and 3 (b) are schematic structural views for illustrating the rear surface and the front surface of the terminal, respectively. Fig. 4 (a) and 4 (b) are schematic structural views for illustrating the front side of the back splint battery and the back side of the back splint battery, respectively. Fig. 5 (a) and 5 (b) are schematic structural views for illustrating the front and rear surfaces of the terminal to which the back-clip battery has been mounted, respectively.
With reference to fig. 3-5, in some implementations, a firstpin contact interface 300 is disposed on the back surface of the terminal, a secondpin contact interface 400 is disposed on the back-clip battery, and after the back-clip battery is mounted on the terminal, the firstpin contact interface 300 and the secondpin contact interface 400 are electrically connected, so that the electric quantity of the back-clip battery can be transmitted to the terminal.
In particular, table 1 below provides an interface definition for second thimble contact interface 400:
TABLE 1
| Pin number | Pin name | Description of thefunction |
| 1 | VBUS | The back splint battery outputs power to the terminal. 5V specification. |
| 2 | HDQ | A one-wire electricity meter communication interface. |
| 3 | DET | The terminal detects the loading and unloading of the back splint battery, and the back splint battery circuit is grounded through a resistor. |
| 4 | USB_D+ | A USB data signal. |
| 5 | GND | The power ground and the signal ground are common. |
| 6 | GND | The power ground and the signal ground are common. |
| 7 | USB_D- | A USB data signal. |
| 8 | EN | The terminal enables the back-clip battery output VBUS. |
| 9 | USB_ID | OTG function |
| 10 | VBUS | The back splint battery outputs power to the terminal. 5V specification. |
It should be noted that the terminal itself has a battery, and when the back-clip battery is not installed, the battery is used to supply power to the host of the terminal, and is collectively referred to as "main battery" in the following description, and correspondingly, the back-clip battery is collectively referred to as "sub battery" in the following description.
In an alternative embodiment, the terminal is connected to a secondpin contact interface 400 on the back of the sub-battery via a firstpin contact interface 300 on the back. In a specific implementation, whether to connect the secondary battery may be determined according to the level of the DET pin.
In one example, if a rising edge transition in the level of the DET pin is detected, an interrupt event is triggered to determine that the secondary battery is connected. In another example, if a falling edge transition in the level of the DET pin is detected, an interrupt event is triggered to determine that the secondary battery is connected.
In one example, if the DET pin is detected to be high, the charger insertion is determined. In another example, if the DET pin is detected to be low, it is determined that the secondary battery is connected.
In an alternative embodiment, the terminal is connected with the secondary battery in a wireless mode, namely, a thimble contact interface is not required to be arranged on the terminal and the secondary battery. Specifically, the terminal may be connected with the sub-battery by wireless means such as electromagnetic induction, magnetic resonance, radio waves, and the like.
In an alternative embodiment, the mode of supplying power to the terminal by the secondary battery includes the following two modes:
mode one, charging mode: the auxiliary battery directly provides electric quantity for the host computer in the terminal and simultaneously charges the main battery in the terminal. In the first mode, as long as the electric quantity of the main battery is not full, the auxiliary battery can charge the main battery while supplying power to the main machine.
In a specific implementation, a path for charging the main battery by the auxiliary battery is controlled to be opened, so that the auxiliary battery can charge the main battery while supplying power to the main machine.
Mode two, direct power supply mode: the auxiliary battery directly provides electric quantity for the host in the terminal and does not charge the main battery in the terminal. In the second mode, the auxiliary battery only supplies power to the main battery and does not charge the main battery no matter how much the main battery is charged. In the second mode, the auxiliary battery only supplies power to the host and does not charge the main battery, so that no electric quantity loss exists, the auxiliary battery can supply power to the host for a longer time, and the endurance time of the terminal is prolonged.
In a specific implementation, a path for charging the main battery by the auxiliary battery is controlled to be closed, so that the auxiliary battery only supplies power to the main battery and does not charge the main battery.
In another optional embodiment, the mode in which the secondary battery supplies power to the terminal further includes:
mode three, intelligent mode: automatically selecting a power supply mode according to the electric quantity of the main battery; specifically, when the electric quantity of the main battery is lower than a first preset threshold value, the mode is automatically switched to a charging mode.
It should be noted that the first preset threshold may be set according to the requirement of the user.
In one example, the first preset threshold is set to 15%. When the electric quantity of the main battery is detected to be lower than 15%, the charging mode is switched to, namely the main battery is charged while the auxiliary battery is used for supplying power to the main machine.
In the above example, the electric quantity of the main battery gradually increases while the sub-battery is charging the main battery. In an optional embodiment, if the electric quantity of the main battery gradually increases from below the first preset threshold to a second preset threshold, the charging mode is switched to the direct power supply mode, that is, a path for charging the main battery by the auxiliary battery is controlled to be closed, so that the auxiliary battery stops charging the main battery.
It should be noted that the second preset threshold may be set according to the requirement of the user.
In one example, the second preset threshold is set to 80%. For example, when the charge of the main battery gradually increases from 5% to 80%, the sub-battery stops charging the main battery.
In another optional embodiment, if the output voltage of the secondary battery is less than a preset voltage, a path for supplying power to the host from the primary battery is controlled to be opened, so that the primary battery supplies power to the host.
In the present embodiment, the electric energy of the sub-battery gradually decreases while the sub-battery supplies power to the main battery or charges the main battery. When the electric quantity of the auxiliary battery is reduced to a certain degree, the output voltage is reduced; when the output voltage of the auxiliary battery is reduced to a preset voltage, the auxiliary battery does not have the capability of supplying power to the main machine. At this time, a path for controlling the main battery to supply power to the host is opened, and the main battery is used for supplying power to the host.
Fig. 6 is a schematic diagram for illustrating thedisplay unit 140 displaying a dual battery management interface. The user may select the charging mode or the smart mode through an interface as shown in fig. 6. In this embodiment, the first preset threshold is 15%. In this embodiment, only the display interface including the mode one (charging mode) and the mode three (smart mode) is provided.
In an embodiment where the intelligent mode is optional, when the charge level of the main battery rises to a second preset threshold, the mode one is automatically switched to the mode two, that is, the charging mode is automatically switched to the direct power supply mode.
Fig. 7 is a flowchart for illustrating a processing method provided by an embodiment of the present invention. Specifically, the processing method provided by the embodiment of the present invention includes: at a terminal having one or more processors, memory, an input unit, and a display unit:
step 901 determines that a secondary battery is inserted.
Step 902, in response to receiving a user input, determines a power mode in which the terminal is currently located.
If the mode is the smart mode,step 903 is executed, and if the mode is the charging mode,step 907 is executed.
Step 903, determining whether the electric quantity of the main battery is lower than a first preset threshold, if so, executingstep 904, and if not, continuing to determine the electric quantity of the main battery.
And 904, controlling a path of the auxiliary battery to charge the main battery to be opened so that the auxiliary battery can charge the main battery while supplying power to the main battery.
Step 905, determining whether the electric quantity of the main battery is increased to a second preset threshold, if so, executingstep 906, and if not, continuing to determine the electric quantity of the main battery.
And step 906, controlling the path of the auxiliary battery for charging the main battery to be disconnected, so that the auxiliary battery only supplies power to the main battery and does not charge the main battery.
Step 907, controlling a path for charging the main battery by the auxiliary battery to be opened so that the auxiliary battery can charge the main battery while supplying power to the main machine.
In a specific implementation, the operating system of the terminal is an Android system. The kernel layer can detect events such as whether the auxiliary battery is inserted, the electric quantity of the main battery and the auxiliary battery, whether the charger is inserted and the like through the interruption or the level of the I/O port.
In some implementations, the kernel layer registers the main battery and the sub-battery as separate devices under the sys/class/power-supply directory of the system, and names them, for example, the main battery is named as battery and the sub-battery is named as motion-battery.
When the information such as the electric quantity level and the charging and discharging state status (including the charging state charging, the discharging state discharging, and the non-charging state charging) of the main battery changes, the kernel layer writes the changed value into the battery directory.
When the information of the electric quantity motion _ level, the charge-discharge state motion _ status (including the charge state charging, the discharge state discharging, the uncharged state not charging), the insertion state motion _ present, etc. of the sub-battery changes, the kernel layer writes the changed value into the motion-basic directory.
And monitoring and reading the battery catalog and the motion-battery catalog through the health module, and reporting to the battery service. And if the BatteryService service receives the state change of the main battery and/or the auxiliary battery, sending a battery _ changed broadcast to the upper application program. The upper application program can analyze the information of the electric quantity, the charge and discharge state of the main battery, the electric quantity, the charge and discharge state, the insertion state and the like of the auxiliary battery from the received battery _ changed broadcast.
Fig. 8 is a flowchart for illustrating a processing method according to another embodiment of the present invention. Specifically, the processing method provided by the embodiment of the present invention includes: at a terminal having one or more processors, memory, an input unit, and a display unit:
step 1401, determining the target application program to start.
In an alternative embodiment, the target application is a system application.
In an alternative embodiment, the target application is a third-party application.
And 1402, if it is determined that the main battery supplies power to the host, calculating the power consumption of the main battery of the target application program.
In an optional embodiment, during the period that the main battery supplies power to the host, determining a hardware module called by the target application program during the running period; and calculating the power consumption of the target application program on the main battery according to the called time length of the hardware module and the power consumption of the hardware module in unit time.
And step 1403, if the secondary battery is determined to supply power to the host, calculating the power consumption of the target application program on the secondary battery.
In an alternative embodiment, during the period that the secondary battery supplies power to the host, determining a hardware module called by the target application program during the running process; and calculating the power consumption of the target application program on the secondary battery according to the called time length of the hardware module and the power consumption of the hardware module per unit time.
In an alternative embodiment, the target application invokes at least two hardware modules during runtime. Wherein, the hardware module is not limited to the following: CPU, camera module, bluetooth module, WIFI module, audio module.
In some implementations, the state changes of the hardware modules in the terminal are all transmitted from the unified battery usage information interface module. When the main battery supplies power to the host, recording power consumption of each hardware module and power consumption conditions caused by using the hardware modules by each application program into a main battery use information recording module; when the sub battery supplies power to the host, the power consumption of each hardware module and the power consumption of each application program caused by using the hardware modules are recorded in the sub battery use information recording module.
In the specific implementation, the Power consumption per unit time of each hardware module is obtained from Power _ Profile, and the duration of the hardware module called by the application program is obtained from batterystats impl.
For example, during T1-T2, the main battery supplies power to the host of the terminal, and the user calls the camera module and the bluetooth module during the use of the application a, so that the power consumption Q1 of the application a on the main battery = the time period of the CPU called by the application a + the time period of the camera called by the application a + the time period of the bluetooth called by the application a + the bluetooth power consumption per unit time. In this embodiment, the power consumption Q1 of the application a on the main battery is the sum of the power consumption of the application a on three hardware modules, namely the CPU, the camera module and the bluetooth module.
And in the period from T2 to T3, the auxiliary battery supplies power to the host computer of the terminal, the power consumption of the application program A on the main battery is stopped to be recorded, and the power consumption of the application program A on the auxiliary battery is started to be recorded. And during the period from T3 to T4, the main battery supplies power to the host of the terminal, and the power consumption of the application A on the main battery is continuously recorded, namely, the power consumption is accumulated and recorded on the basis of the power consumption Q1 recorded during the period from T1 to T2.
Step 1404, displaying the power consumption of the target application on the main battery and the auxiliary battery respectively on the user interface.
Fig. 9 is a schematic view of a user interface for showing thedisplay unit 140 displaying power consumption of an application on a sub-battery. Fig. 10 is a schematic view of a user interface for showing thedisplay unit 140 displaying power consumption of an application on the main battery.
The user can visually see the power consumption of the application on the primary and secondary batteries through the interfaces shown in fig. 9 and 10, specifically: the power consumption of the 'love art' application program on the auxiliary battery and the main battery is 22% and 5%, respectively, the power consumption of the 'game center' application program on the auxiliary battery and the main battery is 3% and 1%, respectively, the power consumption of the 'hundredth' application program on the auxiliary battery and the main battery is 2% and 1%, respectively, and the power consumption of the 'Haixin mall' application program on the auxiliary battery and the main battery is 2% and 1%, respectively.
An embodiment of the present invention further provides a computer storage medium, where computer program instructions are stored in the computer storage medium, and when the instructions are run on a computer, the instructions cause the computer to execute the processing method provided in the foregoing embodiment.
Since the terminal and the computer storage medium in the embodiment of the present invention may be applied to the processing method, reference may also be made to the method embodiment for obtaining technical effects, and details of the embodiment of the present invention are not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that these are by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.