52ky 发表于 2022-5-11 12:19:44

获取程序耗电排行-Android开发进阶

获取程序耗电排行-Android开发进阶&经验分享
设置中获取手机电池电量排名的原理主要是通过读取电池记录文件来实现的。主要使用稳定存储类android.os.BatteryStats和特殊包com.android.ntemnal。
隐藏类很容易解决,主要是内部包。这个包不仅在android.ijar中不可用,而且如果你找到这个包,放到android.ar中,你会发现它是没有用的。原因是 ADT 对这个包施加了限制。不允许使用。
一种解决方案是修改 ADT 以消除此限制。
另外一种是不要把internal放到android.jar中,作为包导入到项目中,这样就不会被限制了。

(Get program power consumption ranking - Advanced Android Development & experience sharing
The principle of obtaining the battery power ranking of mobile phone in setting is mainly realized by reading the battery record file. It mainly uses the stable storage class Android os. Batterystats and special packages com android. ntemnal。
Hidden classes are easy to solve, mainly internal packages. This package is not only on Android Not available in ijar, and if you find this package, put it on Android In AR, you will find it useless. The reason is that ADT imposes restrictions on this package. Not allowed.
One solution is to modify the ADT to eliminate this limitation.
The other is not to put internal into Android Jar, which is imported into the project as a package, so that it will not be restricted.)




页: [1]
查看完整版本: 获取程序耗电排行-Android开发进阶