BatteryProperty.java revision d7b34771cbb89c056e7c0f8976db431cad1ace8c
1/* Copyright 2013, The Android Open Source Project
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14*/
15
16package android.os;
17
18import android.os.Parcel;
19import android.os.Parcelable;
20
21/**
22 * {@hide}
23 */
24public class BatteryProperty implements Parcelable {
25    /*
26     * Battery property identifiers.  These must match the values in
27     * frameworks/native/include/batteryservice/BatteryService.h
28     */
29    public static final int BATTERY_PROP_CHARGE_COUNTER = 1;
30    public static final int BATTERY_PROP_CURRENT_NOW = 2;
31
32    public int valueInt;
33
34    public BatteryProperty() {
35        valueInt = Integer.MIN_VALUE;
36    }
37
38    /*
39     * Parcel read/write code must be kept in sync with
40     * frameworks/native/services/batteryservice/BatteryProperty.cpp
41     */
42
43    private BatteryProperty(Parcel p) {
44        readFromParcel(p);
45    }
46
47    public void readFromParcel(Parcel p) {
48        valueInt = p.readInt();
49    }
50
51    public void writeToParcel(Parcel p, int flags) {
52        p.writeInt(valueInt);
53    }
54
55    public static final Parcelable.Creator<BatteryProperty> CREATOR
56        = new Parcelable.Creator<BatteryProperty>() {
57        public BatteryProperty createFromParcel(Parcel p) {
58            return new BatteryProperty(p);
59        }
60
61        public BatteryProperty[] newArray(int size) {
62            return new BatteryProperty[size];
63        }
64    };
65
66    public int describeContents() {
67        return 0;
68    }
69}
70