blob: 1725ed7b015e2096c4e0f6dd53b90c755f53fe9d [file] [log] [blame]
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * Information about quota status on a specific network.
Jeff Sharkey44a3e0d2011-10-06 10:50:09 -070024 *
25 * @hide
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070026 */
27public class NetworkQuotaInfo implements Parcelable {
28 private final long mEstimatedBytes;
29 private final long mSoftLimitBytes;
30 private final long mHardLimitBytes;
31
32 public static final long NO_LIMIT = -1;
33
34 /** {@hide} */
35 public NetworkQuotaInfo(long estimatedBytes, long softLimitBytes, long hardLimitBytes) {
36 mEstimatedBytes = estimatedBytes;
37 mSoftLimitBytes = softLimitBytes;
38 mHardLimitBytes = hardLimitBytes;
39 }
40
41 /** {@hide} */
42 public NetworkQuotaInfo(Parcel in) {
43 mEstimatedBytes = in.readLong();
44 mSoftLimitBytes = in.readLong();
45 mHardLimitBytes = in.readLong();
46 }
47
48 public long getEstimatedBytes() {
49 return mEstimatedBytes;
50 }
51
52 public long getSoftLimitBytes() {
53 return mSoftLimitBytes;
54 }
55
56 public long getHardLimitBytes() {
57 return mHardLimitBytes;
58 }
59
Jeff Sharkeybfdd6802012-04-09 10:49:19 -070060 @Override
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070061 public int describeContents() {
62 return 0;
63 }
64
Jeff Sharkeybfdd6802012-04-09 10:49:19 -070065 @Override
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070066 public void writeToParcel(Parcel out, int flags) {
67 out.writeLong(mEstimatedBytes);
68 out.writeLong(mSoftLimitBytes);
69 out.writeLong(mHardLimitBytes);
70 }
71
72 public static final Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() {
Jeff Sharkeybfdd6802012-04-09 10:49:19 -070073 @Override
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070074 public NetworkQuotaInfo createFromParcel(Parcel in) {
75 return new NetworkQuotaInfo(in);
76 }
77
Jeff Sharkeybfdd6802012-04-09 10:49:19 -070078 @Override
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070079 public NetworkQuotaInfo[] newArray(int size) {
80 return new NetworkQuotaInfo[size];
81 }
82 };
83}