SlideShare a Scribd company logo
1 of 21
Understanding, Debugging and Fixing

    Power Bugs
           Aditya & Satyam
Apps are to blame the most for bad battery
                    life




           Power Bugs
• Bad coding patterns cause power bugs
• Specific behaviors of the Android Platform
• App inter-dependencies!


• Special Attention must be paid to optimize
  for power!


            Power Bugs
Users Hate Power Bugs
Understanding Common
     Power Bugs
Common Power Bugs

1. Not Sleeping Properly
Common Power Bugs

2. Un-necessary Animations
Common Power Bugs

3. Updating the Screen
Common Power Bugs

4. Handling Display-Off
Common Power Bugs

5. Waking up to notifications
• Registering for un-necessary events
• Waking up the system causes everyone to
  be woken up
• Register for “active” notifications (instead
  of passive ones)
• Handset-specific problems



 More Types Of Power Bugs
Best Practices
(or how to avoid the dreaded battery drain)
Jeff Sharkey at Google IO




Power Consumption is Complex and Inter-dependent
             among components
• prefetch data
  – to avoid switching states frequently, try and read as
    much data as possible
  – trade-off between too much pre-fetch and battery
    drain
  – google recommends pre-fetching data that you will
    initiate in the next 2 to 5 minutes, and in the order of
    1-5 MB size
• batch data
  – do data send/receive in batches rather than on-
    demand

      Best Practices - Network
  – eg: batch analytics information, rather than sending
    them as they are collected
• using inexact timers
  – AlarmManager.setInexactRepeating()
  – use ELAPSED_REALTIME instead of
    ELAPSED_REALTIME_WAKEUP
• detect network connection
  – avoid connection attempts if no network is active
• avoid polling and use GCM when possible
  – avoids multiple connections
  – reduces the number of device state changes

      Best Practices - Network
• color matters!
   – esp on OLED
     screens
   – darker the color,
     lesser the
     consumption
• brightness levels
  have more impact
   – refer to -
     http://stackoverflow.com/qu
     estions/5032588/cant-
     apply-system-screen-
     brightness-
     programmatically-in-
     android
          Best Practices - Screen
• programmatically
  reduce brightness
  if its suits your
  app/activity
• Use “night mode”
  for reading Apps
• Think about your
  color scheme

       Best Practices - Screen
• wakelocks are your
  friend, but your users
  worst nightmare!
• use them only if really
  needed and ensure they
  are removed as soon as
  possible
• Use
  ‘android:keepScreenOn’
  property in your manifest
  instead of doing it
  programmatically
          Best Practices - CPU
• if possible, spread out
  your computationally
  intensive job
• gpu typically consumes
  more power than cpu
  – avoid floating point math
    where possible
• use algorithms that
  consume less CPU cycle
  – O(n log n) vs O(n 2)
    algorithms

          Best Practices - CPU
Demo




Identifying power bugs with
          little eye
Optimized Apps = Better User Experience

       Thank You

   www.littleeye.co

        aditya@littleeye.co
       satyam@littleeye.co

More Related Content

Viewers also liked

CIS516 Week7 Assignment
CIS516 Week7 AssignmentCIS516 Week7 Assignment
CIS516 Week7 Assignmentguest60dc56
 
FUNCEJI Yildalina Tatem Brache derechos humanos
FUNCEJI Yildalina Tatem Brache derechos humanos FUNCEJI Yildalina Tatem Brache derechos humanos
FUNCEJI Yildalina Tatem Brache derechos humanos Cristhian Manuel Jiménez
 
Baila balay
Baila balayBaila balay
Baila balayAlmaML
 
Windows 7 Tüketici Sunumu
Windows 7 Tüketici SunumuWindows 7 Tüketici Sunumu
Windows 7 Tüketici Sunumuwindowsblogu
 
OMI whitepaper On LBS - Nov 2008
OMI whitepaper On LBS -  Nov 2008OMI whitepaper On LBS -  Nov 2008
OMI whitepaper On LBS - Nov 2008Paul Brackel
 
Chuck Close Style Self Portrait1
Chuck Close Style Self Portrait1Chuck Close Style Self Portrait1
Chuck Close Style Self Portrait1chanbliss
 
今時の試験やさんの気持ち
今時の試験やさんの気持ち今時の試験やさんの気持ち
今時の試験やさんの気持ち高見 知英
 
12жилийн төлөвлөлт
12жилийн төлөвлөлт12жилийн төлөвлөлт
12жилийн төлөвлөлтHurelbaatar Bold
 
Maidens Castle - legend from Turkey
Maidens Castle - legend from TurkeyMaidens Castle - legend from Turkey
Maidens Castle - legend from TurkeyJoanna Soltysiak
 
Smart board cuidados
Smart board   cuidadosSmart board   cuidados
Smart board cuidadosDeysi Lucho
 
EEOC FCRA When Working With Temp or Contract Employees
EEOC FCRA When Working With Temp or Contract EmployeesEEOC FCRA When Working With Temp or Contract Employees
EEOC FCRA When Working With Temp or Contract Employeesssallay
 
Tipos de riesgos informáticos
Tipos de riesgos informáticosTipos de riesgos informáticos
Tipos de riesgos informáticosPedro Cobarrubias
 
веб семинар
веб семинарвеб семинар
веб семинарmarylev
 

Viewers also liked (20)

Kenya a snapshot
Kenya a snapshotKenya a snapshot
Kenya a snapshot
 
Eula es es
Eula es esEula es es
Eula es es
 
CIS516 Week7 Assignment
CIS516 Week7 AssignmentCIS516 Week7 Assignment
CIS516 Week7 Assignment
 
FUNCEJI Yildalina Tatem Brache derechos humanos
FUNCEJI Yildalina Tatem Brache derechos humanos FUNCEJI Yildalina Tatem Brache derechos humanos
FUNCEJI Yildalina Tatem Brache derechos humanos
 
Baila balay
Baila balayBaila balay
Baila balay
 
Windows 7 Tüketici Sunumu
Windows 7 Tüketici SunumuWindows 7 Tüketici Sunumu
Windows 7 Tüketici Sunumu
 
OMI whitepaper On LBS - Nov 2008
OMI whitepaper On LBS -  Nov 2008OMI whitepaper On LBS -  Nov 2008
OMI whitepaper On LBS - Nov 2008
 
Observación inventario
Observación inventarioObservación inventario
Observación inventario
 
Chuck Close Style Self Portrait1
Chuck Close Style Self Portrait1Chuck Close Style Self Portrait1
Chuck Close Style Self Portrait1
 
今時の試験やさんの気持ち
今時の試験やさんの気持ち今時の試験やさんの気持ち
今時の試験やさんの気持ち
 
Plancha Union De Jovenes Diplomaticos
Plancha Union De Jovenes DiplomaticosPlancha Union De Jovenes Diplomaticos
Plancha Union De Jovenes Diplomaticos
 
12жилийн төлөвлөлт
12жилийн төлөвлөлт12жилийн төлөвлөлт
12жилийн төлөвлөлт
 
Maidens Castle - legend from Turkey
Maidens Castle - legend from TurkeyMaidens Castle - legend from Turkey
Maidens Castle - legend from Turkey
 
Smart board cuidados
Smart board   cuidadosSmart board   cuidados
Smart board cuidados
 
EEOC FCRA When Working With Temp or Contract Employees
EEOC FCRA When Working With Temp or Contract EmployeesEEOC FCRA When Working With Temp or Contract Employees
EEOC FCRA When Working With Temp or Contract Employees
 
Literary Terms
Literary TermsLiterary Terms
Literary Terms
 
Backsafety
BacksafetyBacksafety
Backsafety
 
Tipos de riesgos informáticos
Tipos de riesgos informáticosTipos de riesgos informáticos
Tipos de riesgos informáticos
 
веб семинар
веб семинарвеб семинар
веб семинар
 
Leidraad Juridische Auteurs2007
Leidraad Juridische Auteurs2007Leidraad Juridische Auteurs2007
Leidraad Juridische Auteurs2007
 

Similar to Power bugs

Energy efficiency of android
Energy efficiency of androidEnergy efficiency of android
Energy efficiency of androidlittleeye
 
How to Lower Android Power Consumption Without Affecting Performance
How to Lower Android Power Consumption Without Affecting PerformanceHow to Lower Android Power Consumption Without Affecting Performance
How to Lower Android Power Consumption Without Affecting Performancerickschwar
 
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...rickschwar
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices Amgad Muhammad
 
Ciprian balea automated performance-testing
Ciprian balea   automated performance-testingCiprian balea   automated performance-testing
Ciprian balea automated performance-testingRomania Testing
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsCommonsWare
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUGslandelle
 
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...IndicThreads
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012Ashish Bhasin
 
Android Mobile Application Testing: Specific Functional, Performance, Device ...
Android Mobile Application Testing: Specific Functional, Performance, Device ...Android Mobile Application Testing: Specific Functional, Performance, Device ...
Android Mobile Application Testing: Specific Functional, Performance, Device ...SoftServe
 
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...NITHIN S.S
 
Java performance - not so scary after all
Java performance - not so scary after allJava performance - not so scary after all
Java performance - not so scary after allHolly Cummins
 
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...GoIT
 
Distributed systems - A Primer
Distributed systems - A PrimerDistributed systems - A Primer
Distributed systems - A PrimerMD Sayem Ahmed
 
Performance optimization for Android
Performance optimization for AndroidPerformance optimization for Android
Performance optimization for AndroidArslan Anwar
 
Understanding DataOps and Its Impact on Application Quality
Understanding DataOps and Its Impact on Application QualityUnderstanding DataOps and Its Impact on Application Quality
Understanding DataOps and Its Impact on Application QualityDevOps.com
 
Android Battery optimization Android Apps
Android Battery optimization Android AppsAndroid Battery optimization Android Apps
Android Battery optimization Android AppsSingsys Pte Ltd
 
Oracle ADF Architecture TV - Development - Performance & Tuning
Oracle ADF Architecture TV - Development - Performance & TuningOracle ADF Architecture TV - Development - Performance & Tuning
Oracle ADF Architecture TV - Development - Performance & TuningChris Muir
 

Similar to Power bugs (20)

Energy efficiency of android
Energy efficiency of androidEnergy efficiency of android
Energy efficiency of android
 
How to Lower Android Power Consumption Without Affecting Performance
How to Lower Android Power Consumption Without Affecting PerformanceHow to Lower Android Power Consumption Without Affecting Performance
How to Lower Android Power Consumption Without Affecting Performance
 
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...
Samsung Developer's Conference - Maximize App Performance while Minimizing Ba...
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices
 
Ciprian balea automated performance-testing
Ciprian balea   automated performance-testingCiprian balea   automated performance-testing
Ciprian balea automated performance-testing
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable Apps
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
 
Beyond Traditional Mobile Testing
Beyond Traditional Mobile TestingBeyond Traditional Mobile Testing
Beyond Traditional Mobile Testing
 
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...
Performance in Android: Tips and Techniques [IndicThreads Mobile Application ...
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012
 
Android Mobile Application Testing: Specific Functional, Performance, Device ...
Android Mobile Application Testing: Specific Functional, Performance, Device ...Android Mobile Application Testing: Specific Functional, Performance, Device ...
Android Mobile Application Testing: Specific Functional, Performance, Device ...
 
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
 
Java performance - not so scary after all
Java performance - not so scary after allJava performance - not so scary after all
Java performance - not so scary after all
 
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...
Mobile Saturday. Тема 2. Особенности тестирования приложения на Android: Spec...
 
Distributed systems - A Primer
Distributed systems - A PrimerDistributed systems - A Primer
Distributed systems - A Primer
 
Optimizing Java
Optimizing JavaOptimizing Java
Optimizing Java
 
Performance optimization for Android
Performance optimization for AndroidPerformance optimization for Android
Performance optimization for Android
 
Understanding DataOps and Its Impact on Application Quality
Understanding DataOps and Its Impact on Application QualityUnderstanding DataOps and Its Impact on Application Quality
Understanding DataOps and Its Impact on Application Quality
 
Android Battery optimization Android Apps
Android Battery optimization Android AppsAndroid Battery optimization Android Apps
Android Battery optimization Android Apps
 
Oracle ADF Architecture TV - Development - Performance & Tuning
Oracle ADF Architecture TV - Development - Performance & TuningOracle ADF Architecture TV - Development - Performance & Tuning
Oracle ADF Architecture TV - Development - Performance & Tuning
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Power bugs

  • 1. Understanding, Debugging and Fixing Power Bugs Aditya & Satyam
  • 2. Apps are to blame the most for bad battery life Power Bugs
  • 3. • Bad coding patterns cause power bugs • Specific behaviors of the Android Platform • App inter-dependencies! • Special Attention must be paid to optimize for power! Power Bugs
  • 5. Understanding Common Power Bugs
  • 6. Common Power Bugs 1. Not Sleeping Properly
  • 7. Common Power Bugs 2. Un-necessary Animations
  • 8. Common Power Bugs 3. Updating the Screen
  • 9. Common Power Bugs 4. Handling Display-Off
  • 10. Common Power Bugs 5. Waking up to notifications
  • 11. • Registering for un-necessary events • Waking up the system causes everyone to be woken up • Register for “active” notifications (instead of passive ones) • Handset-specific problems More Types Of Power Bugs
  • 12. Best Practices (or how to avoid the dreaded battery drain)
  • 13. Jeff Sharkey at Google IO Power Consumption is Complex and Inter-dependent among components
  • 14. • prefetch data – to avoid switching states frequently, try and read as much data as possible – trade-off between too much pre-fetch and battery drain – google recommends pre-fetching data that you will initiate in the next 2 to 5 minutes, and in the order of 1-5 MB size • batch data – do data send/receive in batches rather than on- demand Best Practices - Network – eg: batch analytics information, rather than sending them as they are collected
  • 15. • using inexact timers – AlarmManager.setInexactRepeating() – use ELAPSED_REALTIME instead of ELAPSED_REALTIME_WAKEUP • detect network connection – avoid connection attempts if no network is active • avoid polling and use GCM when possible – avoids multiple connections – reduces the number of device state changes Best Practices - Network
  • 16. • color matters! – esp on OLED screens – darker the color, lesser the consumption • brightness levels have more impact – refer to - http://stackoverflow.com/qu estions/5032588/cant- apply-system-screen- brightness- programmatically-in- android Best Practices - Screen
  • 17. • programmatically reduce brightness if its suits your app/activity • Use “night mode” for reading Apps • Think about your color scheme Best Practices - Screen
  • 18. • wakelocks are your friend, but your users worst nightmare! • use them only if really needed and ensure they are removed as soon as possible • Use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically Best Practices - CPU
  • 19. • if possible, spread out your computationally intensive job • gpu typically consumes more power than cpu – avoid floating point math where possible • use algorithms that consume less CPU cycle – O(n log n) vs O(n 2) algorithms Best Practices - CPU
  • 20. Demo Identifying power bugs with little eye
  • 21. Optimized Apps = Better User Experience Thank You www.littleeye.co aditya@littleeye.co satyam@littleeye.co