1/*
2 * Copyright (C) 2008 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.content.pm;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22import java.util.Arrays;
23
24/**
25 * implementation of PackageStats associated with a
26 * application package.
27 */
28public class PackageStats implements Parcelable {
29    public String packageName;
30    public long codeSize;
31    public long dataSize;
32    public long cacheSize;
33
34    public static final Parcelable.Creator<PackageStats> CREATOR
35    = new Parcelable.Creator<PackageStats>() {
36        public PackageStats createFromParcel(Parcel in) {
37            return new PackageStats(in);
38        }
39
40        public PackageStats[] newArray(int size) {
41            return new PackageStats[size];
42        }
43    };
44
45    public String toString() {
46        return "PackageStats{"
47        + Integer.toHexString(System.identityHashCode(this))
48        + " " + packageName + "}";
49    }
50
51    public PackageStats(String pkgName) {
52        packageName = pkgName;
53    }
54
55    public PackageStats(Parcel source) {
56        packageName = source.readString();
57        codeSize = source.readLong();
58        dataSize = source.readLong();
59        cacheSize = source.readLong();
60    }
61
62    public PackageStats(PackageStats pStats) {
63        packageName = pStats.packageName;
64        codeSize = pStats.codeSize;
65        dataSize = pStats.dataSize;
66        cacheSize = pStats.cacheSize;
67    }
68
69    public int describeContents() {
70        return 0;
71    }
72
73    public void writeToParcel(Parcel dest, int parcelableFlags){
74        dest.writeString(packageName);
75        dest.writeLong(codeSize);
76        dest.writeLong(dataSize);
77        dest.writeLong(cacheSize);
78    }
79}
80