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 17package android.net; 18 19import android.os.Parcel; 20import android.os.Parcelable; 21 22/** 23 * Information about quota status on a specific network. 24 * 25 * @hide 26 */ 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 60 /** {@inheritDoc} */ 61 public int describeContents() { 62 return 0; 63 } 64 65 /** {@inheritDoc} */ 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>() { 73 public NetworkQuotaInfo createFromParcel(Parcel in) { 74 return new NetworkQuotaInfo(in); 75 } 76 77 public NetworkQuotaInfo[] newArray(int size) { 78 return new NetworkQuotaInfo[size]; 79 } 80 }; 81} 82