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