Home | History | Annotate | Download | only in os
      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 
     32     /**
     33      * @hide
     34      */
     35     public BatteryProperty() {
     36         mValueLong = Long.MIN_VALUE;
     37     }
     38 
     39     /**
     40      * @hide
     41      */
     42     public long getLong() {
     43         return mValueLong;
     44     }
     45 
     46     /*
     47      * Parcel read/write code must be kept in sync with
     48      * frameworks/native/services/batteryservice/BatteryProperty.cpp
     49      */
     50 
     51     private BatteryProperty(Parcel p) {
     52         readFromParcel(p);
     53     }
     54 
     55     public void readFromParcel(Parcel p) {
     56         mValueLong = p.readLong();
     57     }
     58 
     59     public void writeToParcel(Parcel p, int flags) {
     60         p.writeLong(mValueLong);
     61     }
     62 
     63     public static final Parcelable.Creator<BatteryProperty> CREATOR
     64         = new Parcelable.Creator<BatteryProperty>() {
     65         public BatteryProperty createFromParcel(Parcel p) {
     66             return new BatteryProperty(p);
     67         }
     68 
     69         public BatteryProperty[] newArray(int size) {
     70             return new BatteryProperty[size];
     71         }
     72     };
     73 
     74     public int describeContents() {
     75         return 0;
     76     }
     77 }
     78