CN110427092A - Battery switching method, device, terminal and computer readable storage medium - Google Patents

Battery switching method, device, terminal and computer readable storage medium Download PDF

Info

Publication number
CN110427092A
CN110427092A CN201910715269.0A CN201910715269A CN110427092A CN 110427092 A CN110427092 A CN 110427092A CN 201910715269 A CN201910715269 A CN 201910715269A CN 110427092 A CN110427092 A CN 110427092A
Authority
CN
China
Prior art keywords
terminal
battery
application
power supply
remaining capacity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910715269.0A
Other languages
Chinese (zh)
Other versions
CN110427092B (en
Inventor
张海平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN201910715269.0A priority Critical patent/CN110427092B/en
Publication of CN110427092A publication Critical patent/CN110427092A/en
Application granted granted Critical
Publication of CN110427092B publication Critical patent/CN110427092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/28Supervision thereof, e.g. detecting power-supply failure by out of limits supervision

Abstract

The application belongs to field of computer technology more particularly to a kind of battery switching method, device, terminal and computer readable storage medium, wherein the battery switching method include: the detection terminal front stage operation application whether be preset kind application;If the application of the terminal front stage operation is the application of preset kind, whether the remaining capacity for detecting the battery that the terminal is in power supply state is less than or equal to the first power threshold;If the remaining capacity of the battery in power supply state is less than or equal to the first power threshold, the battery of power supply state is not in as terminal power supply using the terminal, the application run in terminal is avoided and the problem of Caton occurs.

Description

Battery switching method, device, terminal and computer readable storage medium
Technical field
The application belongs to field of computer technology more particularly to a kind of battery switching method, device, terminal and computer can Read storage medium.
Background technique
Currently, installed in terminal using more and more, user spends the time at the terminal also increasingly longer, for example, In When playing game using terminal or see video, dozens of minutes or even several hours are usually spent.
However, when long-time plays game or sees video using terminal, it is possible to the problem of will appear Caton, seriously Affect user experience.
Summary of the invention
The embodiment of the present application provides a kind of battery switching method, device, terminal and computer readable storage medium, can be with one There is Caton in the application for determining to avoid the problem that running in terminal in degree.
The embodiment of the present application first aspect provides a kind of battery switching method, is applied to terminal, comprising:
Detect the terminal front stage operation application whether be preset kind application;
If the application of the terminal front stage operation is the application of preset kind, detects the terminal and be in power supply state Whether the remaining capacity of battery is less than or equal to the first power threshold;
If the remaining capacity of the battery in power supply state is less than or equal to the first power threshold, the end is utilized End is not in the battery of power supply state as terminal power supply.
In the embodiment of the present application, by being preset kind in the application for detecting terminal front stage operation in application, real-time Whether the remaining capacity for the battery that detection terminal is in power supply state is less than or equal to the first power threshold, and in power supply shape When the remaining capacity of the battery of state is less than or equal to the first power threshold, switching terminal is used for the battery of power supply in time, that is, benefit It is terminal power supply with the battery that terminal is not in power supply state, realizes the remaining capacity in the battery of power supply state and be less than or wait Carry out battery switching in the first time of the first power threshold, avoid the application run in terminal because battery capacity is too low and There is the problem of Caton.
The embodiment of the present application second aspect provides a kind of battery shifter, is configured at terminal, the battery shifter Include:
First detection unit, for detect the terminal front stage operation application whether be preset kind application;
Second detection unit, if for the terminal front stage operation application be preset kind application, detection described in Whether the remaining capacity that terminal is in the battery of power supply state is less than or equal to the first power threshold;
Switch unit, if the remaining capacity for the battery in power supply state is less than or equal to the first electricity threshold Value is not in the battery of power supply state using the terminal then as terminal power supply.
The embodiment of the present application third aspect provides a kind of terminal, including memory, processor and storage are in memory And the computer program that can be run on a processor, when processor executes computer program the step of the realization above method.
The embodiment of the present application fourth aspect provides a kind of computer readable storage medium, computer-readable recording medium storage The step of having computer program, the above method is realized when computer program is executed by processor.
5th aspect, the embodiment of the present application provides a kind of computer program product, when computer program product is in terminal When being run in equipment, so that terminal device executes method described in above-mentioned first aspect.
It is understood that the beneficial effect of above-mentioned second aspect to the 5th aspect may refer in above-mentioned first aspect Associated description, details are not described herein.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to needed in the embodiment attached Figure is briefly described, it should be understood that the following drawings illustrates only some embodiments of the application, therefore is not construed as pair The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this A little attached drawings obtain other relevant attached drawings.
Fig. 1 is a kind of first implementation flow schematic diagram of battery switching method provided by the embodiments of the present application;
Fig. 2 is a kind of specific implementation flow schematic diagram of battery switching method step 103 provided by the embodiments of the present application;
Fig. 3 is a kind of the second implementation process schematic diagram of battery switching method provided by the embodiments of the present application;
Fig. 4 is a kind of specific implementation flow schematic diagram of battery switching method step 302 provided by the embodiments of the present application;
Fig. 5 is the structural schematic diagram of battery shifter provided by the embodiments of the present application;
Fig. 6 is the structural schematic diagram of terminal provided by the embodiments of the present application.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, and It is not used in restriction the application.Meanwhile in the description of the present application, term " first ", " second " etc. are only used for distinguishing description, without It can be interpreted as indication or suggestion relative importance.
It should be appreciated that ought use in this specification and in the appended claims, term " includes " instruction is described special Sign, entirety, step, operation, the presence of element and/or component, but be not precluded one or more of the other feature, entirety, step, Operation, the presence or addition of element, component and/or its set.
It is also understood that mesh of the term used in this present specification merely for the sake of description specific embodiment And be not intended to limit the application.As present specification and it is used in the attached claims, unless on Other situations are hereafter clearly indicated, otherwise " one " of singular, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is Refer to any combination and all possible combinations of one or more of associated item listed, and including these combinations.
When terminal is in energy-saving mode, and the remaining capacity of end cell is less than or equal to the first power threshold, it is Extend the operation duration of terminal, it will usually reduce the performance of terminal handler, this will be so that expend in terminal compared with multiprocessor There is Caton in the process of running in the application of resource.
For example, when user plays game or see video using terminal for a long time, if the remaining capacity of end cell is less than or waits It in the first power threshold, and continues to be terminal power supply using the same battery, it is likely that can be because of terminal handler Performance is lowered and interface or video clip is caused the problem of Caton occur.
Based on this, the embodiment of the present application provides a kind of battery switching method, device, terminal and computer-readable storage medium Matter can avoid the problem that Caton occurs in the application run in terminal to a certain extent.In order to illustrate the technical solution of the application, The following is a description of specific embodiments.
A kind of implementation process schematic diagram of battery switching method provided by the embodiments of the present application as shown in figure 1, this method Applied to terminal, can be executed by the battery shifter configured in terminal, suitable for the application run in terminal need to be avoided to go out The situation of existing Caton.
It should be noted that in the embodiment of the present application, above-mentioned terminal can be mobile phone, tablet computer, wearable device Equal intelligent terminals, also, the terminal is at least provided with two batteries, to realize that terminal can switch supplying cell at any time.
For example, above-mentioned terminal can be set, there are two graphene battery perhaps two lithium batteries or a graphene electricity Perhaps perhaps more than two lithium batteries or multiple graphenes are electric for more than two graphene batteries for pond and a lithium battery The combination of pond and multiple lithium batteries or the battery of above-mentioned terminal are the combination of the battery of other materials.The application is in terminal The combining form of battery is not limited.
Specifically, above-mentioned battery switching method may include step 101 to step 103.
Step 101, detect terminal front stage operation application whether be preset kind application.
Step 102, it if the application of terminal front stage operation is the application of preset kind, detects terminal and is in power supply state Whether the remaining capacity of battery is less than or equal to the first power threshold.
Step 103, if the remaining capacity of the battery in power supply state is less than or equal to the first power threshold, using eventually End is not in the battery of power supply state as terminal power supply.
In the embodiment of the present application, the application fewer for some consuming processor resources, when the performance of processor drops Generally be not in Caton when low, therefore, whether be less than or wait in the remaining capacity for the battery that detection terminal is in power supply state Before the first power threshold, can first detect terminal front stage operation application whether be preset kind application, and in terminal The application of front stage operation is preset kind in application, whether the remaining capacity for the battery that just detection terminal is in power supply state is small In or equal to the first power threshold, otherwise, whether the remaining capacity for not detecting the battery that terminal is in power supply state is less than or waits In the first power threshold, the powers duration of battery is extended, reduces the number of battery switching, and can be transported on terminal foreground Whether capable application is preset kind in application, can small by detecting the remaining capacity for the battery that terminal is in power supply state In or equal to the first power threshold, the switching of battery is carried out in time, avoids the application run in terminal and the feelings of Caton occurs Condition.
The application of above-mentioned preset kind may include application and the user that the processor resource expended is greater than preset threshold When the energy-saving mode of configurating terminal, the application of addition.That is, when the electricity of battery is lower than the first power threshold, it may appear that Caton Application.
For example, the application of the preset kind may include game class application, social category application and audio and video playing application.
Wherein, energy-saving mode can refer to when the electricity of end cell is less than or equal to the first power threshold, need to lead to The mode for reducing the performance of processor is crossed, ensures the mode of terminal operating duration.
Wherein, above-mentioned first power threshold can be set according to the habit of user's using terminal, or according to terminal Location is set, for example, the location of terminal is the place that outdoor or user reaches for the first time, then above-mentioned the One power threshold can be set relatively high, for example, the 30% of battery total electricity value can be set in above-mentioned first power threshold;Again For example, the location of terminal is the place that user often stays, then above-mentioned first power threshold can be set relatively low, example Such as, the 10% of battery total electricity value can be set in above-mentioned first power threshold, to guarantee that end cell can be used more Rationally.
In the embodiment of the present application, by being preset kind in the application for detecting terminal front stage operation in application, real-time Whether the remaining capacity for the battery that detection terminal is in power supply state is less than or equal to the first power threshold, and in power supply shape When the remaining capacity of the battery of state is less than or equal to the first power threshold, battery of the switching terminal for power supply, is avoided in time There is the problem of Caton because battery capacity is too low in the application run in terminal.
In general, terminal will not generally be led when terminal is in the electricity of the battery of power supply state lower than the first power threshold Dynamic carry out battery switching, but when the electricity of the battery in power supply state exhausts, being possible to being in terminal The battery of power supply state is switched to other batteries, this is when terminal is in general mode, that is, the electricity of the battery in power supply state When amount is less than the first power threshold, the mode of the performance of processor will not be reduced in order to ensure terminal operating duration, then still may be used To guarantee that the application run in terminal is not in Caton, therefore, can not have in advance carry out the battery in power supply state Switching, so whether the application of above-mentioned detection terminal front stage operation is preset kind in some embodiments of the application Using, may include: detection terminal whether be in energy-saving mode;If terminal is in energy-saving mode, terminal front stage operation is detected Application whether be preset kind application.
That is, just detecting the battery that terminal is in power supply state only when detecting that terminal is in energy-saving mode Remaining capacity whether be less than or equal to the first power threshold, and be less than or wait in the remaining capacity of the battery in power supply state In the first power threshold, the battery of power supply state is not in as terminal power supply using terminal.
In some embodiments of the application, when the remaining capacity of the battery in power supply state is less than or equal to the first electricity When measuring threshold value, in order to which the battery that utility terminal is not in power supply state can preferably be powered for terminal, such as Fig. 2 institute Show, may include: step 201 to step 203 before the battery for being not in power supply state using terminal is terminal power supply.
Step 201, whether the remaining capacity for the battery that detection is not in power supply state is less than or equal to the first power threshold.
Step 202, it if the remaining capacity for being not in the battery of power supply state is less than or equal to the first power threshold, detects Whether terminal is in charged state.
When being not in the remaining capacity of battery of power supply state greater than the first power threshold, expression is not in power supply state Battery have more remaining capacity, therefore, in power supply state battery remaining capacity be less than or equal to first electricity When measuring threshold value, directly using terminal the battery of power supply state can be not in as terminal power supply;And works as and be not in power supply state When the remaining capacity of battery is less than or equal to the first power threshold, the remaining capacity and the place that are not in the battery of power supply state are indicated It is not much different in the remaining capacity of the battery of power supply state, not can guarantee the application run in terminal is not in Caton, because This, needs to detect whether terminal is in charged state.
Step 203, if terminal is in charged state, terminal is not powered in the battery of charging using terminal, and It is greater than the second power threshold in the remaining capacity for the battery that terminal is charging or does not face in the electricity arrival of the battery of charging When dividing value, the battery to charge is switched to the battery being powered to terminal, and the battery switching not in charging is positive In the battery to charge.
In the embodiment of the present application, by when detecting that terminal is in charged state, using terminal not in the battery of charging Terminal is powered, the battery in terminal is avoided and the case where discharging in charging occurs, improve the safety that terminal uses Property, and extend the service life of end cell.
In addition, in the embodiment of the present application, by not before the battery of charging is powered terminal, being examined using terminal Whether the remaining capacity for surveying the battery for being not in power supply state is less than or equal to the first power threshold, and is being not in power supply state Battery remaining capacity be less than or equal to the first power threshold when, detection terminal whether be in charged state so that in terminal When in charged state, terminal can be powered in the battery of charging first with terminal, and charging in terminal The remaining capacity of battery is greater than the second power threshold or not when the electricity of the battery of charging reaches critical value, will charge Battery be switched to the battery being powered to terminal, and the battery to charge will not be switched in the battery of charging, There is the duration of Caton to reduce the application run in terminal, ensure that the fluency of the application run in terminal.
Wherein, above-mentioned second power threshold is greater than above-mentioned first power threshold.The residue electricity for the battery that terminal is charging Amount is greater than the second power threshold and refers to that the remaining capacity of the battery to charge can satisfy the power supply of terminal certain time length, and When being powered using the battery for terminal, it is ensured that the application run in terminal Caton will not occur because of low battery.
In addition, not being possible to will appear electricity in the battery of charging since the battery to charge is during charging The case where exhausting is closed on, therefore, is being charged in order to avoid not when the battery of charging exhausts, can not normally be switched to utilize Battery power to it, not when the electricity of the battery of charging reaches critical value, even if the above-mentioned battery to charge is surplus Remaining electricity is not up to the second power threshold, the battery to charge can also be switched to the battery being powered to terminal.
It,, can be with if terminal is not in charged state after above-mentioned steps 202 in some embodiments of the application Charge prompting information is exported, to remind user to charge in time.
In some embodiments of the application, when the charging rate of the battery in terminal is there are when the difference of speed, In The battery that in above-mentioned steps 203, terminal is not powered in the battery of charging using terminal, and is being charged in terminal it is surplus Remaining electricity is greater than the second power threshold or not when the electricity of the battery of charging reaches critical value, the battery to charge is cut It is changed to the battery being powered to terminal, and will be switched in the battery of charging before the battery that is charging, may be used also To include: to set the not battery in charging for the slow battery of terminal charge, by the battery of terminal charge fast speed It is set as the battery to charge.
That is, first charging to the faster battery of charging rate, and using the slower battery of charging rate to end End power supply, so that creating a further reduction the application run in terminal the duration of Caton occurs.
For example, terminal be provided with the faster graphene battery of one piece of charging rate and one piece of charging rate it is slower lithium electricity Pond then can be in charged state in terminal, and the remaining capacity of graphene battery and lithium battery is respectively less than the first electricity threshold It when value, is powered using the slower lithium battery of charging rate, and sets the faster graphene battery of charging rate to The battery of charging.In this way, it is preferentially charged using the faster battery of charging rate, improves the charging effect of terminal Rate has ensured the operation duration of terminal.
In some embodiments of the application, in above-mentioned steps 202, whether detection terminal is in after charged state, If can also include: that terminal is not in charged state, charge prompting information be exported.
For example, the charge prompting information can be shown in the taskbar of terminal;Alternatively, passing through pop-up charge prompting frame Mode exports above-mentioned charge prompting information.
Optionally, in above-mentioned steps 201, whether the remaining capacity for detecting the battery for being not in power supply state is less than or waits After the first power threshold, if can also include: to be not in the remaining capacity of the battery of power supply state less than or equal to first Power threshold then closes the application of terminal running background, alternatively, being terminal running background using the battery that terminal is charging Using being powered.
For example, running background video playing is applied and music application when user uses game application, it is current to examine It measures terminal and is in the battery of power supply state and be less than or equal to the first power threshold 10%, then detect that terminal is not in power supply The battery of state is less than or equal to the first power threshold 10%, then applies video playing and close with music application, thus Extend the operation duration of terminal.Alternatively, being video playing application and sound by using the battery that terminal is not in power supply state It is happy to play application power supply, so that alleviating the application run in terminal to a certain extent there is the case where Caton.
In some embodiments of the present application, as shown in figure 3, above-mentioned battery switching method can also include: step 301 to Step 303.
Step 301, application starting when, detect starting application whether be preset kind application.
Step 302, if the application started is the application of preset kind, the target fortune of the application started is obtained The remaining powers duration of row duration and end cell.
It is somebody's turn to do specifically, the object run duration of the above-mentioned application started refers to that user opens in application, the application can The duration of energy continuous service.The remaining powers duration of above-mentioned end cell refers to the remaining capacity summation pair of all batteries of terminal The total surplus powers duration answered.
For example, when user uses video playing application plays film, the playing duration of film;User opens game class and answers Used time, the duration, etc. of one innings of game.
Specifically, the object run duration for the application that above-mentioned acquisition is starting and the remaining powers duration of end cell can The object run duration of the application started is obtained from server to include:, or obtains opening of pre-setting It is dynamic using corresponding object run duration, alternatively, obtaining the target of application from application after application runs a period of time Operation duration.
For example, the residual time length of the film in broadcast state is directly obtained by video playing application, in broadcasting shape The object run duration information for the application that the residual time length of the film of state is as starting;Alternatively, being answered in user using game Used time, the information (such as: game name, game mode) of available game, and the information of game is sent to server, it obtains The game average duration for the game application for taking server to generate by big data analysis, the game average duration are target fortune Row duration.
Step 303, if object run duration is greater than remaining powers duration, charge prompting information is exported.
In the embodiment of the present application, if object run duration is greater than remaining powers duration, then it represents that all batteries of terminal Remaining capacity is unable to satisfy the power consumption of the application started.Therefore, it needs to export charge prompting information at this time, reminds user Charging in time because the electricity of end cell exhausts, and can not continue to run during running to avoid application.So that terminal User can be prompted to charge neatly according to the application being currently running.
In some embodiments of the application, as shown in figure 3, after above-mentioned steps 302, if the application started Object run duration is less than or equal to the remaining powers duration of end cell, then can execute step 304 and step 305.
Step 304, whether the remaining capacity for the battery that detection terminal is in power supply state is less than or equal to the first electricity threshold Value;
Step 305, if the remaining capacity of the battery in power supply state is less than or equal to the first power threshold, using eventually End is not in the battery of power supply state as terminal power supply.
It should be noted that the specific implementation of above-mentioned steps 304 and step 305 may refer to above-mentioned steps 102 to The specific implementation process of step 103, details are not described herein again.
Specifically, as shown in figure 4, the remaining powers duration for obtaining end cell may include: step in above-mentioned steps 302 Rapid 401 to step 402.
Step 401, the remaining capacity of computing resource and end cell that the currently running application of terminal occupies is obtained.
Step 402, the remaining capacity meter of the computing resource and end cell that are occupied according to the currently running application of terminal Calculate the remaining powers duration of end cell.
In the embodiment of the present application, the remaining capacity of end cell refers to the summation of the remaining capacity of terminal all batteries.
Need to illustrate when, obtaining the computing resource that the currently running application of terminal occupies may include: terminal foreground fortune Capable application and running background application occupy computing resource summation, alternatively, only front stage operation application occupy Computing resource.
For example, above-mentioned acquisition is whole when the application that the battery to be charged using terminal is terminal running background is powered The computing resource for holding currently running application to occupy may include: application and the terminal running background for obtaining terminal front stage operation Using the summation of the computing resource of occupancy.
Wherein, obtaining the computing resource that the currently running application of terminal occupies may include: to obtain CPU number, CPU Utilization rate and calculation times per second are multiplied by CPU utilization rate by CPU number, then divided by calculation times per second, calculate Calculate the number of one second CPU of consumption every time out.When obtaining the computing resource that the currently running application of terminal occupies, acquisition is worked as The utilization rate of preceding CPU and calculative number are multiplied by by calculative number and calculate for consuming one second CPU every time Number, then divided by the utilization rate of current CPU, obtain the CPU number that the currently running application of terminal occupies, i.e. acquisition terminal is currently transported The computing resource that capable application occupies.
For example, current CPU number is 3, cpu busy percentage 70%, handling capacity 100 then calculates consumption one second every time The number of clock CPU is (3*70%)/100, amounts to 0.021, if the utilization rate of current CPU is 50%, calculative number is 1000, then the CPU number that application occupies is (0.021*1000)/50%, amounts to and occupies 42 CPU.
After the remaining capacity y for obtaining computing resource x and end cell that the currently running application of terminal occupies, i.e., Remaining powers duration h can be calculated by the operation relation h=b* (y/x) pre-set, wherein b is remaining powers duration Conversion coefficient.
To sum up, the battery switching method of the application, whether the application by detection terminal front stage operation is preset kind Using;If the application of terminal front stage operation is the application of preset kind, the residue that terminal is in the battery of power supply state is detected Whether electricity is less than or equal to the first power threshold;If the remaining capacity of the battery in power supply state is less than or equal to the first electricity Threshold value is measured, then is the scheme of terminal power supply using the battery that terminal is not in power supply state, it is ensured that user is using preset kind In application, can export charge prompting information alert user charging, alternatively, carry out battery switching, ensure the operation of mobile phone Duration, and avoid the problem that Caton occurs in the application run in terminal.
Fig. 5 shows a kind of structural schematic diagram of battery shifter 500 provided by the embodiments of the present application, battery switching Device 500 is configured at terminal, which can be set at least two batteries.The battery shifter 500 may include first Detection unit 501, second detection unit 502 and switch unit 503.
First detection unit 501, for detect terminal front stage operation application whether be preset kind application;
Second detection unit 502 detects at terminal if the application for terminal front stage operation is the application of preset kind Whether it is less than or equal to the first power threshold in the remaining capacity of the battery of power supply state;
Switch unit 503, if the remaining capacity for the battery in power supply state is less than or equal to the first power threshold, The battery of power supply state is not in using terminal then as terminal power supply.
In some embodiments of the application, above-mentioned second detection unit 502 is also used to be not in confession using terminal Before the battery of electricity condition is terminal power supply, whether the remaining capacity for detecting the battery for being not in power supply state is less than or equal to the One power threshold;If the remaining capacity for being not in the battery of power supply state is less than or equal to the first power threshold, terminal is detected Whether charged state is in;Switch unit 503, if being also used to terminal is in charged state, using terminal not in the electricity of charging Pond is powered terminal, and the remaining capacity of the battery to charge in terminal is greater than the second power threshold or is not charging Battery electricity reach critical value when, the battery to charge is switched to the battery being powered to terminal, and will not exist The battery of charging is switched to the battery to charge.
In some embodiments of the application, above-mentioned second detection unit 502 is also used to be not in power supply shape in detection Whether the remaining capacity of the battery of state is less than or equal to after the first power threshold, if being not in the residue of the battery of power supply state Electricity is less than or equal to the first power threshold, then the application of terminal running background is closed, alternatively, the electricity to charge using terminal Pond is that the application of terminal running background is powered.
In some embodiments of the application, above-mentioned second detection unit 502 is also used to do not charging using terminal Battery terminal is powered, and is being charged in terminal the remaining capacity of battery be greater than the second power threshold or do not exist When the electricity of the battery of charging reaches critical value, the battery to charge is switched to the battery being powered to terminal, and will It is not switched in the battery of charging before the battery to charge, the slow battery of terminal charge is set as not existing The battery of charging sets the battery of terminal charge fast speed on the battery to charge.
In some embodiments of the application, above-mentioned first detection unit 501 is also used to the detection in application starting Starting application whether be preset kind application;If the application started is the application of preset kind, obtain just In the object run duration of the application of starting and the remaining powers duration of end cell;If object run duration is greater than remaining power supply Duration then exports charge prompting information.
In some embodiments of the application, above-mentioned first detection unit 501 is also used to obtain terminal currently running Using the computing resource of occupancy and the remaining capacity of end cell;The computing resource occupied according to the currently running application of terminal And the remaining powers duration of the remaining capacity computing terminal battery of end cell.
In some embodiments of the application, above-mentioned first detection unit 501 is also used in detection terminal front stage operation Application whether be preset kind application before, detection terminal whether be in energy-saving mode;If terminal is in energy-saving mode, Detection terminal front stage operation application whether be preset kind application.
It should be noted that for convenience and simplicity of description, the specific works of the battery shifter 500 of foregoing description Process, can be with reference to the corresponding process of method described in above-mentioned Fig. 1 to Fig. 4, and details are not described herein.
As shown in fig. 6, the application provides a kind of terminal for realizing above-mentioned battery switching method, which be can wrap Include: processor 61, memory 62, one or more input equipments 63 (one is only shown in Fig. 6) and one or more outputs are set Standby 64 (one is only shown in Fig. 6).Processor 61, memory 62, input equipment 63 and output equipment 64 are connected by bus 65.
It should be appreciated that in the embodiment of the present application, alleged processor 61 can be central processing unit (Central Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components etc..General processor can be microprocessor or this at Reason device is also possible to any conventional processor etc..
Input equipment 63 may include that dummy keyboard, Trackpad, fingerprint adopt sensor (for acquiring the finger print information of user With the directional information of fingerprint), microphone etc., output equipment 64 may include display, loudspeaker etc..
Memory 62 may include read-only memory and random access memory, and provide instruction sum number to processor 61 According to.Part or all of memory 62 can also include nonvolatile RAM.For example, memory 62 can be with The information of storage device type.
Above-mentioned memory 62 is stored with computer program, and above-mentioned computer program can be run on above-mentioned processor 61, example Such as, above-mentioned computer program is the program of battery switching method.Above-mentioned processor 61 is realized when executing above-mentioned computer program State the step in battery switching method embodiment, such as step 101 shown in FIG. 1 is to step 103.Alternatively, above-mentioned processor 61 The function of each unit in above-mentioned apparatus embodiment, such as unit 501 to 503 shown in Fig. 5 are realized when executing above-mentioned computer program Function.
Above-mentioned computer program can be divided into one or more module/units, and said one or multiple modules/mono- Member is stored in above-mentioned memory 62, and is executed by above-mentioned processor 61, to complete the application.Said one or multiple moulds Block/unit can be the series of computation machine program instruction section that can complete specific function, the instruction segment by describe it is above-mentioned based on Implementation procedure of the calculation machine program in the terminal of above-mentioned carry out battery switching.For example, above-mentioned computer program can be divided into First detection unit, second detection unit and switch unit, each unit concrete function are as follows:
First detection unit, for detect terminal front stage operation application whether be preset kind application;
Second detection unit detects terminal and is in if the application for terminal front stage operation is the application of preset kind Whether the remaining capacity of the battery of power supply state is less than or equal to the first power threshold;
Switch unit, if the remaining capacity for the battery in power supply state is less than or equal to the first power threshold, The battery of power supply state is not in using terminal as terminal power supply.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different Functional unit, module are completed, i.e., the internal structure of above-mentioned apparatus is divided into different functional unit or module, more than completing The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed Scope of the present application.
In embodiment provided herein, it should be understood that disclosed device/terminal and method can pass through Other modes are realized.For example, device/terminal embodiment described above is only schematical, for example, above-mentioned module or The division of unit, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units Or component can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, institute Display or the mutual coupling or direct-coupling or communication connection discussed can be through some interfaces, device or unit INDIRECT COUPLING or communication connection can be electrical property, mechanical or other forms.
Above-mentioned unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If above-mentioned integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or In use, can store in a computer readable storage medium.Based on this understanding, the application realizes above-mentioned implementation All or part of the process in example method, can also instruct relevant hardware to complete, above-mentioned meter by computer program Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on The step of stating each embodiment of the method.Wherein, above-mentioned computer program includes computer program code, above-mentioned computer program generation Code can be source code form, object identification code form, executable file or certain intermediate forms etc..Above-mentioned computer-readable medium It may include: any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic that can carry above-mentioned computer program code Dish, CD, computer storage, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that above-mentioned meter The content that calculation machine readable medium includes can carry out increase and decrease appropriate according to the requirement made laws in jurisdiction with patent practice, It such as does not include electric carrier signal and telecommunications according to legislation and patent practice, computer-readable medium in certain jurisdictions Signal.
Above above-described embodiment is only to illustrate the technical solution of the application, rather than its limitations;Although referring to aforementioned reality Example is applied the application is described in detail, those skilled in the art should understand that: it still can be to aforementioned each Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified Or replacement, the spirit and scope of each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution should all Comprising within the scope of protection of this application.

Claims (10)

1. a kind of battery switching method is applied to terminal characterized by comprising
Detect the terminal front stage operation application whether be preset kind application;
If the application of the terminal front stage operation is the application of preset kind, the battery that the terminal is in power supply state is detected Remaining capacity whether be less than or equal to the first power threshold;
If the remaining capacity of the battery in power supply state is less than or equal to the first power threshold, not using the terminal Battery in power supply state is terminal power supply.
2. battery switching method as described in claim 1, which is characterized in that described to be not in power supply state using the terminal Battery be the terminal power supply before, comprising:
Whether the remaining capacity that the battery of power supply state is not in described in detection is less than or equal to first power threshold;
If the remaining capacity of the battery for being not in power supply state be less than or equal to first power threshold, detection described in Whether terminal is in charged state;
If the terminal is in charged state, terminal is not powered in the battery of charging using the terminal, and in institute The remaining capacity for stating the battery that terminal is charging is greater than the second power threshold or described does not arrive in the electricity of the battery of charging When up to critical value, the battery to charge is switched to the battery being powered to the terminal, and do not filling described The battery of electricity is switched to the battery to charge.
3. battery switching method as claimed in claim 2, which is characterized in that be not in power supply state described in the detection Whether the remaining capacity of battery is less than or equal to after first power threshold, further includes:
If the remaining capacity of the battery for being not in power supply state be less than or equal to first power threshold, close described in The application of terminal running background, alternatively, the battery to be charged using the terminal be the terminal running background application into Row power supply.
4. battery switching method as claimed in claim 2, which is characterized in that it is described using the terminal not in the electricity of charging Pond is powered terminal, and the remaining capacity of the battery to charge in the terminal is greater than the second power threshold or described Not when the electricity of the battery of charging reaches critical value, the battery to charge is switched to, the terminal is powered Battery, and will be before the battery that be not switched to and charging in the battery of charging, comprising:
The not battery in charging is set by the slow battery of the terminal charge, by the terminal charge fast speed Battery is set as the battery to charge.
5. battery switching method as described in claim 1, which is characterized in that the application of the detection terminal front stage operation Whether be preset kind application, comprising:
In application starting, the detection application started whether be preset kind application;
If the application started is the application of preset kind, when obtaining the object run of the application started Long and the end cell remaining powers duration;
If the object run duration is greater than the remaining powers duration, charge prompting information is exported.
6. battery switching method as claimed in claim 5, which is characterized in that the remaining power supply for obtaining the end cell Duration, comprising:
Obtain the remaining capacity of computing resource and the end cell that the currently running application of the terminal occupies;
The remaining capacity of the computing resource and the end cell that are occupied according to the currently running application of the terminal calculates institute State the remaining powers duration of end cell.
7. battery switching method as described in claim 1, which is characterized in that detect answering for the terminal front stage operation described With whether be preset kind application before, comprising:
Detect whether the terminal is in energy-saving mode;
The application of the detection terminal front stage operation whether be preset kind application, comprising:
If the terminal is in energy-saving mode, detect the terminal front stage operation application whether be preset kind application.
8. a kind of battery shifter, is configured at terminal, which is characterized in that the battery shifter includes:
First detection unit, for detect the terminal front stage operation application whether be preset kind application;
Second detection unit detects the terminal if the application for the terminal front stage operation is the application of preset kind Whether the remaining capacity of the battery in power supply state is less than or equal to the first power threshold;
Switch unit, if the remaining capacity for the battery in power supply state is less than or equal to the first power threshold, The battery of power supply state is not in using the terminal as terminal power supply.
9. a kind of terminal, including memory, processor and storage can be run in the memory and on the processor Computer program, which is characterized in that the processor is realized when executing the computer program as claim 1 to 7 is any The step of one the method.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists In realization is such as the step of claim 1 to 7 any one the method when the computer program is executed by processor.
CN201910715269.0A 2019-08-02 2019-08-02 Battery switching method, device, terminal and computer readable storage medium Active CN110427092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910715269.0A CN110427092B (en) 2019-08-02 2019-08-02 Battery switching method, device, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910715269.0A CN110427092B (en) 2019-08-02 2019-08-02 Battery switching method, device, terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110427092A true CN110427092A (en) 2019-11-08
CN110427092B CN110427092B (en) 2021-01-26

Family

ID=68412524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910715269.0A Active CN110427092B (en) 2019-08-02 2019-08-02 Battery switching method, device, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110427092B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113954691A (en) * 2021-09-15 2022-01-21 阿里巴巴达摩院(杭州)科技有限公司 Battery control method, device, computer equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103369124A (en) * 2012-04-10 2013-10-23 腾讯科技(深圳)有限公司 Battery management method and device
US9239907B1 (en) * 2010-07-06 2016-01-19 Symantec Corporation Techniques for identifying misleading applications
CN106125882A (en) * 2016-06-15 2016-11-16 深圳市万普拉斯科技有限公司 The management method of a kind of application program and electronic equipment
CN107291213A (en) * 2017-07-28 2017-10-24 广东欧珀移动通信有限公司 Mode selecting method, device, terminal and computer-readable recording medium
CN109100566A (en) * 2018-06-07 2018-12-28 缤刻普锐(北京)科技有限责任公司 A kind of electric quantity reminding method and device, smartwatch and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9239907B1 (en) * 2010-07-06 2016-01-19 Symantec Corporation Techniques for identifying misleading applications
CN103369124A (en) * 2012-04-10 2013-10-23 腾讯科技(深圳)有限公司 Battery management method and device
CN106125882A (en) * 2016-06-15 2016-11-16 深圳市万普拉斯科技有限公司 The management method of a kind of application program and electronic equipment
CN107291213A (en) * 2017-07-28 2017-10-24 广东欧珀移动通信有限公司 Mode selecting method, device, terminal and computer-readable recording medium
CN109100566A (en) * 2018-06-07 2018-12-28 缤刻普锐(北京)科技有限责任公司 A kind of electric quantity reminding method and device, smartwatch and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113954691A (en) * 2021-09-15 2022-01-21 阿里巴巴达摩院(杭州)科技有限公司 Battery control method, device, computer equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN110427092B (en) 2021-01-26

Similar Documents

Publication Publication Date Title
CN104106053B (en) Use the dynamic CPU GPU load balance of power
CN106293914B (en) A kind of method and terminal of task schedule
CN103927708A (en) Performance Allocation Method And Apparatus
US20160357616A1 (en) Application management method and application management apparatus
CN107483751A (en) Terminal device and its power energy allocation method, computer-readable recording medium
TW201209581A (en) Electronic device having operation mode dynamic adjusting mechanism and method of the same
US20120246447A1 (en) Region-Weighted Accounting of Multi-Threaded Processor Core According to Dispatch State
CN102597911B (en) AC adaptor minimization through active platform power consumption management
CN107193598A (en) One kind application startup method, mobile terminal and computer-readable recording medium
CN109888420A (en) A kind of charging method, device and the terminal device of lithium ion battery packet
CN106406494B (en) A kind of method and terminal of processor scheduling
CN107835311A (en) application management method, device, storage medium and electronic equipment
CN110365084B (en) Charging control method, device, terminal and storage medium
CN109818396A (en) A kind of charging method, device and the terminal device of lithium ion battery packet
CN110427092A (en) Battery switching method, device, terminal and computer readable storage medium
CN202759507U (en) A smart phone
CN110336355B (en) Charging method, charging device and terminal equipment
CN110489177B (en) Application control method and device, storage medium and terminal equipment
CN107612162A (en) A kind of wireless charging method, terminal and computer-readable recording medium
CN113439263A (en) Application cleaning method and device, storage medium and electronic equipment
CN110493857B (en) Battery using method, device, terminal and storage medium
CN114844176A (en) Battery charging and discharging power control method and device and electronic equipment
CN109542351A (en) A kind of power consumption control method and solid state hard disk of solid state hard disk
CN110676521B (en) Battery management method, device, storage medium and electronic equipment
CN109992084A (en) A kind of method, apparatus and robot of the protection of robot low battery

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant