Joe Onorato | 713fec8 | 2016-03-04 10:34:02 -0800 | [diff] [blame] | 1 | <html> |
| 2 | <body> |
| 3 | |
| 4 | The android.os.health package contains a set of classes to provide data |
| 5 | to track the system resources of applications. |
| 6 | <p> |
| 7 | Applications running in the background are responsible for a significant amount |
| 8 | of battery usage on a typical android device. There are several things that |
| 9 | applications can do in order to reduce their impact. For example, by using |
| 10 | {@link android.app.job.JobScheduler JobScheduler}, an application does not need |
| 11 | to independently monitor whether the network is available, whether the device is |
| 12 | plugged in, etc. In addition to being simpler to use, the application's |
| 13 | services are only started when the required conditions have been met. But even |
| 14 | when using the appropriate helper APIs, applications still can reduce their |
| 15 | footprint. This package provides more insight into what is going on behind the |
| 16 | scenes when an application is running. |
| 17 | <p> |
| 18 | Application data is tracked by which user id (uid) is using particular |
| 19 | resources. A snapshot of an application's measurements can be taken with the |
| 20 | {@link android.os.health.SystemHealthManager#takeMyUidSnapshot() SystemHealth.takeMyUidSnapshot()} |
| 21 | method. The {@link android.os.health.HealthStats} object returned contains the |
| 22 | statistics. |
| 23 | <p> |
| 24 | <b>HealthStats</b><br> |
| 25 | In order to be returned efficiently, the {@link android.os.health.HealthStats} |
| 26 | class uses a set of int keys to identify the data returned. The |
| 27 | {@link android.os.health.UidHealthStats}, {@link android.os.health.PidHealthStats}, |
| 28 | {@link android.os.health.PackageHealthStats} , {@link android.os.health.ProcessHealthStats}, |
| 29 | and {@link android.os.health.ServiceHealthStats} classes provide those constants. |
| 30 | Each {@link android.os.health.HealthStats} object will be associated with |
| 31 | exactly one of those classes. The object returned from |
| 32 | {@link android.os.health.SystemHealthManager#takeMyUidSnapshot() SystemHealth.takeMyUidSnapshot()} |
| 33 | will be using the {@link android.os.health.UidHealthStats} keys, as it contains all |
| 34 | of the data available for that uid. |
| 35 | |
| 36 | |
| 37 | </body> |
| 38 | </html> |
| 39 | |