The Story Behind Power Management

  1. Gary C.
    OxygenOS Operations Staff Member Nov 29, 2018

    Gary C. , Nov 29, 2018 :
    power management.png

    Power consumption is a popular topic here on the forums, with users avidly comparing the battery life of their device. We found that some report their battery capacity as low as 2000mAh, or as high as 6000mAh. How big do our users need it to be? That's a problem we all thought about.Is it a compromise necessary to give our users a better battery experience? We don’t think so. We chose a tougher but ultimately better way.

    The real pain point is not battery capacity - users just want their device battery to run longer. Excellent power management is the solution to this problem.

    From the outset, the team has set a strict goal - to reduce standby power consumption to half of the previous record. When asked how they customized the target, one of our developers said: "We measured the consumption limit of a cellphone in a sleep state, and then set the target a little higher above the limit.” We have made some changes before, but this time we aimed for a change at the core.

    Upon finding that their devices consume power quickly, some users blame the system. "In fact, the system consumes a small amount of power. There is a data record of this.” Daniel, the head of the development team, said. “The third-party apps may be responsible for quick power consumption. For example, some apps call GPS. When the user closes the app, it still occupies sensor resources, which leads to faster power consumption. However, the user is unable to perceive it.”

    To give users a better power-saving experience, we worked out a new background control solution:
    • The first step was to detect apps that are highly power-consuming and active in the background. That takes much time and energy, and usually, an app may be able to call a new sensor after updating. Monitoring the activities of apps is a long battle.
    • After finding power-hungry apps, we needed to study user habits. First, users’ phone habits vary. Some use Facebook often, while others prefer Instagram.
    • Phones classify apps into three categories: Frequently Used, Sometimes Used, and Rarely Used. Phones then allocate background power based on these app categories.
    • Using thresholds, the phone regularly detects how much power background programs use. Once the threshold is breached, measures are taken to limit background activities.
    • There are many factors that lead to power consumption. When trying to control the loss, we had to focus on every detail. The whole team asked themselves every day: "Why there was power loss? How much has been lost? Can it be less? If we can make it less, how much exactly?” The target was to save as much as possible without compromising the user experience.
    • To that end, we listed those frequently used apps and improved them one by one. “It was a painful process. Even if you have optimized 99% of the apps, the remaining 1% would render the overall power consumption data ugly,” said Jay, an engineer on the team.
    Determining when to let devices sleep was the biggest challenge. Most users sleep nearly one-third of each day, during which time their phones are in standby mode. The difference lies in the rest period, but there are certain rules; for example, some users go to bed and get up early, others don’t. So, we use intelligent algorithms to learn user habits and analyze rest periods. In these periods, the phone enters deep sleep mode based on specific application conditions.

    To ensure that this optimization will truly improve the user experience, the development team conducted many rounds of tests. Sleep mode is used only at night, so the development team started off at 9:30 every night. They tested dozens of cellphones by running in turn those frequently used apps and tried to best reproduce the way they're used by users. It was generally late at night when these operations were completed. "It was common to work overtime until early morning. After all, imitating sleep standby can be done only at night,” said Tom, another engineer on the team.

    When the project was finally completed, we did a total of 94 rounds of testing. The pass rate nearly reached 100%, and sometimes the standby power consumption overnight could be reduced to less than 3%.

    Our cellphones used to drop 7%-10% power in standby overnight. Now, we’ve cut this to less than 5%. And we’ve boosted power control performance by 28%. Behind this figure is the hard work and strong belief of every member of the team. It was our step-by-step efforts that have led us to where we are now.

    To make our product better, we’ve done a lot of changes, but it’s far from enough. There are still many improvements we’re striving for. OnePlus fans give us the courage to meet this challenge. We want you to know that we’re on the right track.

    Never Settle.

  2. Gary C.
    OxygenOS Operations Staff Member Nov 30, 2018

    Stickied Post
    Gary C. , Nov 30, 2018 :
    Power control performance involves limiting background activity and sleep standby optimization. The phone will analyze the standby time according to the user's usage habits. The longer the user spends, the more accurate the results will be. The phone should learn user habits.

  3. Dresa91
    Android Q Nov 29, 2018

    Dresa91 , Nov 29, 2018 :
    Wow @Gary C., thanks for this detailed report.
    It is great how you care about the mechanism behind power management :)
    Thanks to the team for the hard work :)

  4. Cheetosdust
    Starting Point Expert Nov 29, 2018

    Cheetosdust , Nov 29, 2018 :
    Thank you for the lengthy explanation, @Gary C. :)

    But it does help. I can tell you this: I went from the OnePlus 6 to the OnePlus 6T and I believe the battery performance is actually my favorite new "feature".

    Sure, the power management is being improved, but that's not exclusive to the newest model. I love how the battery lasts on my 6T and that's related to the 3700mAh capacity.

    The team can continue to improve the standby time, but don't forget that doing so can actually kill the apps, a problem I experienced on several of my devices - not getting notifications, etc (yes, even changing the settings).

    It's great we can have great battery life, just don't be so caught up on it that you actually damage how we experience OxygenOS. ;)

  5. GopalB.
    Nougat Nov 29, 2018

  6. Dresa91
    Android Q Nov 29, 2018

    Dresa91 , Nov 29, 2018 :
    Pixel 3 2.915 mAh :D

  7. GopalB.
    Nougat Nov 29, 2018

    GopalB. , Nov 29, 2018 :
    Good... But don't you think that all this resulted in aggressive app closing and apps getting reloaded even if you keep them minimized for just 5-10 mins???

  8. malidan
    Marshmallow Nov 29, 2018

    malidan , Nov 29, 2018 :
    5% I've seen a recent test and the 6T is still losing 10% in an 8hr overnight simulation.
    What is power control performance? I'm sure many will be thinking what are you going on about, but won't ask.:D

  9. BeingIncog
    Marshmallow Nov 29, 2018

    amitmoond, otto2, xnutzii and 5 others like this.
  10. YRJ
    Lollipop Nov 29, 2018

    YRJ , Nov 29, 2018 :
    great thread! maybe we can eradicate many battery related threads [e]1f602[/e]
    nice read @Gary C.

  11. Cheetosdust
    Starting Point Expert Nov 29, 2018

    Cheetosdust , Nov 29, 2018 :
    That's true, the Pixel 3 (and the iPhone, for example) don't really need "killer specs" to perform well ;)

    You know, software happens :p

  12. Dresa91
    Android Q Nov 29, 2018

    Dresa91 , Nov 29, 2018 :
    right :D
    Let's see how the Pixel 3 will perform and handle my usage :D

    xnutzii, Shivang Joshi, YRJ and 2 others like this.
  13. Cheetosdust
    Starting Point Expert Nov 29, 2018

    Cheetosdust , Nov 29, 2018 :
    Maybe you can send some tips to the OxygenOS team after? :rolleyes::p

  14. Dresa91
    Android Q Nov 29, 2018

    Dresa91 , Nov 29, 2018 :
    haha :D

    otto2, xnutzii, Shivang Joshi and 2 others like this.
  15. airiartev
    Jelly Bean Nov 29, 2018

    airiartev , Nov 29, 2018 :
    In what OOS version are you refeering to?

    Linxx and YRJ like this.
  16. Dresa91
    Android Q Nov 29, 2018

    Dresa91 , Nov 29, 2018 :
    always the next one :p

    Linxx, Shivang Joshi and YRJ like this.
  17. _DEDSEC_
    Jelly Bean Nov 29, 2018

    deviantartjr and YRJ like this.
  18. meatandy
    Oreo Nov 29, 2018

    meatandy , Nov 29, 2018 :
    Go to know , Keep up the good work .

    Cheetosdust, YRJ and Dresa91 like this.
  19. ButterFlYnez
    Jelly Bean Nov 29, 2018

    ButterFlYnez , Nov 29, 2018 :
    I'm happy to read about if from another point of view. Personally I let my battery drain at night and use fast charge in the mornings. The reason? I track my sleep with my phone. So the "aggressive" standby at night isn't useful for me. However I like that it isn't forced but rather a choice. I am free to choose not to have the power management on at night. Same with how I use my phone during the day as a pedometer, the normal standby control limits this, but I can easily toggle this off if I so choose.

    Conclusion I like what oneplus is striving to do, even if I personally don't have much of a use for it. As long as it's a choice and I'm not forced to settle for what a company thinks is best for me I'm a happy fangirl:blush:

  20. obol2
    Honeycomb Nov 29, 2018

  21. DARTH 007
    KitKat Nov 29, 2018

    DARTH 007 , Nov 29, 2018 :
    good point.
    is it bcos of this that apps are reloading.
    so where is the balance??.
    I think if an app is not used in the past 30 to 45 mins , it should be closed automatically.

    JCHazard likes this.