BatteryProperty.java revision be7d9e399e9b73d326df172c6f85e2a0fa3455a2
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 public static final int BATTERY_PROP_CURRENT_AVG = 3; 32 33 public int valueInt; 34 35 public BatteryProperty() { 36 valueInt = Integer.MIN_VALUE; 37 } 38 39 /* 40 * Parcel read/write code must be kept in sync with 41 * frameworks/native/services/batteryservice/BatteryProperty.cpp 42 */ 43 44 private BatteryProperty(Parcel p) { 45 readFromParcel(p); 46 } 47 48 public void readFromParcel(Parcel p) { 49 valueInt = p.readInt(); 50 } 51 52 public void writeToParcel(Parcel p, int flags) { 53 p.writeInt(valueInt); 54 } 55 56 public static final Parcelable.Creator<BatteryProperty> CREATOR 57 = new Parcelable.Creator<BatteryProperty>() { 58 public BatteryProperty createFromParcel(Parcel p) { 59 return new BatteryProperty(p); 60 } 61 62 public BatteryProperty[] newArray(int size) { 63 return new BatteryProperty[size]; 64 } 65 }; 66 67 public int describeContents() { 68 return 0; 69 } 70} 71