blob: b40988a938bc85141bfdbf316133fef7d530cb82 [file] [log] [blame]
Todd Poynord7b34772013-08-14 20:42:44 -07001/* 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/**
Todd Poynore35872d2013-12-10 11:57:21 -080022 * Battery properties that may be queried using
Todd Poynore35872d2013-12-10 11:57:21 -080023 * BatteryManager.getProperty()}
Todd Poynord7b34772013-08-14 20:42:44 -070024 */
Todd Poynor5fde3ff2014-06-05 14:49:28 -070025
26/**
27 * @hide
28 */
Todd Poynord7b34772013-08-14 20:42:44 -070029public class BatteryProperty implements Parcelable {
Todd Poynor540f4d62014-05-08 15:12:50 -070030 private long mValueLong;
Todd Poynore35872d2013-12-10 11:57:21 -080031
32 /**
33 * @hide
34 */
Todd Poynord7b34772013-08-14 20:42:44 -070035 public BatteryProperty() {
Todd Poynor540f4d62014-05-08 15:12:50 -070036 mValueLong = Long.MIN_VALUE;
Todd Poynore35872d2013-12-10 11:57:21 -080037 }
38
39 /**
Todd Poynor5fde3ff2014-06-05 14:49:28 -070040 * @hide
Todd Poynor540f4d62014-05-08 15:12:50 -070041 */
42 public long getLong() {
43 return mValueLong;
44 }
Todd Poynor5fde3ff2014-06-05 14:49:28 -070045
Yifan Hong1fd86f4c2017-10-09 16:50:33 -070046 /**
47 * @hide
48 */
49 public void setLong(long val) {
50 mValueLong = val;
51 }
52
Todd Poynord7b34772013-08-14 20:42:44 -070053 /*
54 * Parcel read/write code must be kept in sync with
55 * frameworks/native/services/batteryservice/BatteryProperty.cpp
56 */
57
58 private BatteryProperty(Parcel p) {
59 readFromParcel(p);
60 }
61
62 public void readFromParcel(Parcel p) {
Todd Poynor540f4d62014-05-08 15:12:50 -070063 mValueLong = p.readLong();
Todd Poynord7b34772013-08-14 20:42:44 -070064 }
65
66 public void writeToParcel(Parcel p, int flags) {
Todd Poynor540f4d62014-05-08 15:12:50 -070067 p.writeLong(mValueLong);
Todd Poynord7b34772013-08-14 20:42:44 -070068 }
69
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -070070 public static final @android.annotation.NonNull Parcelable.Creator<BatteryProperty> CREATOR
Todd Poynord7b34772013-08-14 20:42:44 -070071 = 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
81 public int describeContents() {
82 return 0;
83 }
84}