blob: b85f9259444026a290d73f43049d00f29601e7ff [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.
24 */
25public class NetworkQuotaInfo implements Parcelable {
26 private final long mEstimatedBytes;
27 private final long mSoftLimitBytes;
28 private final long mHardLimitBytes;
29
30 public static final long NO_LIMIT = -1;
31
32 /** {@hide} */
33 public NetworkQuotaInfo(long estimatedBytes, long softLimitBytes, long hardLimitBytes) {
34 mEstimatedBytes = estimatedBytes;
35 mSoftLimitBytes = softLimitBytes;
36 mHardLimitBytes = hardLimitBytes;
37 }
38
39 /** {@hide} */
40 public NetworkQuotaInfo(Parcel in) {
41 mEstimatedBytes = in.readLong();
42 mSoftLimitBytes = in.readLong();
43 mHardLimitBytes = in.readLong();
44 }
45
46 public long getEstimatedBytes() {
47 return mEstimatedBytes;
48 }
49
50 public long getSoftLimitBytes() {
51 return mSoftLimitBytes;
52 }
53
54 public long getHardLimitBytes() {
55 return mHardLimitBytes;
56 }
57
58 /** {@inheritDoc} */
59 public int describeContents() {
60 return 0;
61 }
62
63 /** {@inheritDoc} */
64 public void writeToParcel(Parcel out, int flags) {
65 out.writeLong(mEstimatedBytes);
66 out.writeLong(mSoftLimitBytes);
67 out.writeLong(mHardLimitBytes);
68 }
69
70 public static final Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() {
71 public NetworkQuotaInfo createFromParcel(Parcel in) {
72 return new NetworkQuotaInfo(in);
73 }
74
75 public NetworkQuotaInfo[] newArray(int size) {
76 return new NetworkQuotaInfo[size];
77 }
78 };
79}