| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.hardware; |
| 18 |
|
| 19 |
import android.annotation.FloatRange; |
| 20 |
import android.annotation.IntDef; |
| 21 |
import android.os.BatteryManager; |
| 22 |
|
| 23 |
import java.lang.annotation.Retention; |
| 24 |
import java.lang.annotation.RetentionPolicy; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public abstract class BatteryState { |
| 30 |
|
| 31 |
@Retention(RetentionPolicy.SOURCE) |
| 32 |
@IntDef(prefix = { "STATUS_" }, value = { |
| 33 |
STATUS_UNKNOWN, |
| 34 |
STATUS_CHARGING, |
| 35 |
STATUS_DISCHARGING, |
| 36 |
STATUS_NOT_CHARGING, |
| 37 |
STATUS_FULL |
| 38 |
}) |
| 39 |
public @interface BatteryStatus { |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
public static final int STATUS_UNKNOWN = BatteryManager.BATTERY_STATUS_UNKNOWN; |
| 44 |
|
| 45 |
public static final int STATUS_CHARGING = BatteryManager.BATTERY_STATUS_CHARGING; |
| 46 |
|
| 47 |
public static final int STATUS_DISCHARGING = BatteryManager.BATTERY_STATUS_DISCHARGING; |
| 48 |
|
| 49 |
public static final int STATUS_NOT_CHARGING = BatteryManager.BATTERY_STATUS_NOT_CHARGING; |
| 50 |
|
| 51 |
public static final int STATUS_FULL = BatteryManager.BATTERY_STATUS_FULL; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public abstract boolean isPresent(); |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public abstract @BatteryStatus int getStatus(); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
public abstract @FloatRange(from = -1.0f, to = 1.0f) float getCapacity(); |
| 74 |
} |