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 16 package android.os; 17 18 import android.os.Parcel; 19 import android.os.Parcelable; 20 21 /** 22 * Battery properties that may be queried using 23 * BatteryManager.getProperty()} 24 */ 25 26 /** 27 * @hide 28 */ 29 public class BatteryProperty implements Parcelable { 30 private long mValueLong; 31 private String mValueString; 32 33 /** 34 * @hide 35 */ BatteryProperty()36 public BatteryProperty() { 37 mValueLong = Long.MIN_VALUE; 38 mValueString = null; 39 } 40 41 /** 42 * @hide 43 */ getLong()44 public long getLong() { 45 return mValueLong; 46 } 47 48 /** 49 * @hide 50 */ getString()51 public String getString() { 52 return mValueString; 53 } 54 55 /** 56 * @hide 57 */ setLong(long val)58 public void setLong(long val) { 59 mValueLong = val; 60 } 61 62 /** 63 * @hide 64 */ setString(String val)65 public void setString(String val) { 66 mValueString = val; 67 } 68 BatteryProperty(Parcel p)69 private BatteryProperty(Parcel p) { 70 readFromParcel(p); 71 } 72 readFromParcel(Parcel p)73 public void readFromParcel(Parcel p) { 74 mValueLong = p.readLong(); 75 mValueString = p.readString8(); 76 } 77 writeToParcel(Parcel p, int flags)78 public void writeToParcel(Parcel p, int flags) { 79 p.writeLong(mValueLong); 80 p.writeString8(mValueString); 81 } 82 83 public static final @android.annotation.NonNull Parcelable.Creator<BatteryProperty> CREATOR 84 = new Parcelable.Creator<BatteryProperty>() { 85 public BatteryProperty createFromParcel(Parcel p) { 86 return new BatteryProperty(p); 87 } 88 89 public BatteryProperty[] newArray(int size) { 90 return new BatteryProperty[size]; 91 } 92 }; 93 describeContents()94 public int describeContents() { 95 return 0; 96 } 97 } 98