Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.net; |
| 18 | |
| 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
| 21 | |
| 22 | /** |
| 23 | * Information about quota status on a specific network. |
Jeff Sharkey | 44a3e0d | 2011-10-06 10:50:09 -0700 | [diff] [blame] | 24 | * |
| 25 | * @hide |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 26 | */ |
| 27 | public 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 Sharkey | bfdd680 | 2012-04-09 10:49:19 -0700 | [diff] [blame] | 60 | @Override |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 61 | public int describeContents() { |
| 62 | return 0; |
| 63 | } |
| 64 | |
Jeff Sharkey | bfdd680 | 2012-04-09 10:49:19 -0700 | [diff] [blame] | 65 | @Override |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 66 | 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 Sharkey | bfdd680 | 2012-04-09 10:49:19 -0700 | [diff] [blame] | 73 | @Override |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 74 | public NetworkQuotaInfo createFromParcel(Parcel in) { |
| 75 | return new NetworkQuotaInfo(in); |
| 76 | } |
| 77 | |
Jeff Sharkey | bfdd680 | 2012-04-09 10:49:19 -0700 | [diff] [blame] | 78 | @Override |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 79 | public NetworkQuotaInfo[] newArray(int size) { |
| 80 | return new NetworkQuotaInfo[size]; |
| 81 | } |
| 82 | }; |
| 83 | } |