Tools for Battery Optimization

1. Get Barrery History By System File

//if Your platform is 4.1-4.3, using under commandadb shell dumpsys batteryinfo //others adb shell dumpsys batterystats > packageName > batterystats.txt adb shell dumpsys  batterystats > batterystats.txtCopy the code

2. Battery Historian

For Battery Historian, see Google-Battery Historian

Default address: localhost:9999

/ / reset 'historyAdb shell Dumpsys batteryStats --reset // Enable Weaklock ADB shell Dumpsys batteryStats --enable full-wake-history Adb bugreprot > desktop/bugreport.txt //Andthen, You should enable The Batttery Historian by under commands
cd $GOPATH/src/github.com/google/battery-historian
go run setup.go
go run cmd/battery-historian/battery-historian.go 

//At last, upload this bugreport.txt to Battery Historian
Copy the code

3. GPU Rendering【 display GPU Rendering 】

View–>DisplayList–> OpenGl ES

Green: 16ms. On Android, if the frame rate is 60fps, the page will not stall. However, when drawing, if you lose frames, the frame rate is less than 60fps, you will get stuck. Blue: To draw a View on the screen, it is necessary to convert the specification in View#onDraw method to the DisplayList format that can be recognized by the GPU and cache it. Blue represents the length of the View. Purple: represents the time it takes to transfer the DisplayList to the drawing thread red: represents the time it takes for the system to draw the DisplayList on the screen using OpenGL ES. Orange: All the commands sent by the GPU are from the CPU. After the CPU sends the command to the GPU, the CPU queues the command in the GPU queue. If the queue is full, the CPU blocks the command until there is a queue and puts the command in the queue. The orange color represents the CPU wait time, which means the longer the yellow color, the more things the GPU can do. If yellow is too long, the GPU is doing too many things.

4. Tencent GT

About the GT

Some Principles of Battery Optimization

  1. Cellular uses more power than WIFI
  2. Try to do something time-consuming while charging
  3. In a cellular mobile network, it is best to execute network requests in batches and avoid frequent network requests as far as possible
  4. JosScheduler, which uses JobScheduler to cache non-urgent tasks, select the right time and network, and execute them together. The use of the JobScheduler
  5. WakeLock, do not register WakeLock while the App is running in the foreground, because it does not make sense to register at this time, but will be counted as application power consumption. Use partial wake lock instead of full wake lock. WakeLock usage
  6. Optimize the AlarmManager notification method. AlarmManager usage
  7. Pay attention to the use of GPS, sensors
  8. The stupidest way to read data for a messaging App is to read only the top thumbnail message, as this may cause RadioC to stay up and run, resulting in high power consumption. The right thing to do is to read one set of consultations and the details of the consultation and preread the next set.Power optimization series video,Refer to the article