• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (C) 2008 The Android Open Source Project
3   *
4   * Licensed under the Apache License, Version 2.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *      http://www.apache.org/licenses/LICENSE-2.0
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package android.os;
18  
19  /**
20   * The BatteryManager class contains strings and constants used for values
21   * in the {@link android.content.Intent#ACTION_BATTERY_CHANGED} Intent.
22   */
23  public class BatteryManager {
24      /**
25       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
26       * integer containing the current status constant.
27       */
28      public static final String EXTRA_STATUS = "status";
29  
30      /**
31       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
32       * integer containing the current health constant.
33       */
34      public static final String EXTRA_HEALTH = "health";
35  
36      /**
37       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
38       * boolean indicating whether a battery is present.
39       */
40      public static final String EXTRA_PRESENT = "present";
41  
42      /**
43       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
44       * integer field containing the current battery level, from 0 to
45       * {@link #EXTRA_SCALE}.
46       */
47      public static final String EXTRA_LEVEL = "level";
48  
49      /**
50       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
51       * integer containing the maximum battery level.
52       */
53      public static final String EXTRA_SCALE = "scale";
54  
55      /**
56       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
57       * integer containing the resource ID of a small status bar icon
58       * indicating the current battery state.
59       */
60      public static final String EXTRA_ICON_SMALL = "icon-small";
61  
62      /**
63       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
64       * integer indicating whether the device is plugged in to a power
65       * source; 0 means it is on battery, other constants are different
66       * types of power sources.
67       */
68      public static final String EXTRA_PLUGGED = "plugged";
69  
70      /**
71       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
72       * integer containing the current battery voltage level.
73       */
74      public static final String EXTRA_VOLTAGE = "voltage";
75  
76      /**
77       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
78       * integer containing the current battery temperature.
79       */
80      public static final String EXTRA_TEMPERATURE = "temperature";
81  
82      /**
83       * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
84       * String describing the technology of the current battery.
85       */
86      public static final String EXTRA_TECHNOLOGY = "technology";
87  
88      // values for "status" field in the ACTION_BATTERY_CHANGED Intent
89      public static final int BATTERY_STATUS_UNKNOWN = 1;
90      public static final int BATTERY_STATUS_CHARGING = 2;
91      public static final int BATTERY_STATUS_DISCHARGING = 3;
92      public static final int BATTERY_STATUS_NOT_CHARGING = 4;
93      public static final int BATTERY_STATUS_FULL = 5;
94  
95      // values for "health" field in the ACTION_BATTERY_CHANGED Intent
96      public static final int BATTERY_HEALTH_UNKNOWN = 1;
97      public static final int BATTERY_HEALTH_GOOD = 2;
98      public static final int BATTERY_HEALTH_OVERHEAT = 3;
99      public static final int BATTERY_HEALTH_DEAD = 4;
100      public static final int BATTERY_HEALTH_OVER_VOLTAGE = 5;
101      public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6;
102  
103      // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent.
104      // These must be powers of 2.
105      /** Power source is an AC charger. */
106      public static final int BATTERY_PLUGGED_AC = 1;
107      /** Power source is a USB port. */
108      public static final int BATTERY_PLUGGED_USB = 2;
109  }
110