1package android.content.pm;
2
3import android.os.Parcel;
4import android.os.Parcelable;
5import android.text.TextUtils;
6
7import java.text.Collator;
8import java.util.Comparator;
9
10/**
11 * Information you can retrieve about a particular piece of test
12 * instrumentation.  This corresponds to information collected
13 * from the AndroidManifest.xml's <instrumentation> tag.
14 */
15public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
16    /**
17     * The name of the application package being instrumented.  From the
18     * "package" attribute.
19     */
20    public String targetPackage;
21
22    /**
23     * Full path to the location of this package.
24     */
25    public String sourceDir;
26
27    /**
28     * Full path to the location of the publicly available parts of this package (i.e. the resources
29     * and manifest).  For non-forward-locked apps this will be the same as {@link #sourceDir).
30     */
31    public String publicSourceDir;
32    /**
33     * Full path to a directory assigned to the package for its persistent
34     * data.
35     */
36    public String dataDir;
37
38    /**
39     * Specifies whether or not this instrumentation will handle profiling.
40     */
41    public boolean handleProfiling;
42
43    /** Specifies whether or not to run this instrumentation as a functional test */
44    public boolean functionalTest;
45
46    public InstrumentationInfo() {
47    }
48
49    public InstrumentationInfo(InstrumentationInfo orig) {
50        super(orig);
51        targetPackage = orig.targetPackage;
52        sourceDir = orig.sourceDir;
53        publicSourceDir = orig.publicSourceDir;
54        dataDir = orig.dataDir;
55        handleProfiling = orig.handleProfiling;
56        functionalTest = orig.functionalTest;
57    }
58
59    public String toString() {
60        return "InstrumentationInfo{"
61            + Integer.toHexString(System.identityHashCode(this))
62            + " " + packageName + "}";
63    }
64
65    public int describeContents() {
66        return 0;
67    }
68
69    public void writeToParcel(Parcel dest, int parcelableFlags) {
70        super.writeToParcel(dest, parcelableFlags);
71        dest.writeString(targetPackage);
72        dest.writeString(sourceDir);
73        dest.writeString(publicSourceDir);
74        dest.writeString(dataDir);
75        dest.writeInt((handleProfiling == false) ? 0 : 1);
76        dest.writeInt((functionalTest == false) ? 0 : 1);
77    }
78
79    public static final Parcelable.Creator<InstrumentationInfo> CREATOR
80            = new Parcelable.Creator<InstrumentationInfo>() {
81        public InstrumentationInfo createFromParcel(Parcel source) {
82            return new InstrumentationInfo(source);
83        }
84        public InstrumentationInfo[] newArray(int size) {
85            return new InstrumentationInfo[size];
86        }
87    };
88
89    private InstrumentationInfo(Parcel source) {
90        super(source);
91        targetPackage = source.readString();
92        sourceDir = source.readString();
93        publicSourceDir = source.readString();
94        dataDir = source.readString();
95        handleProfiling = source.readInt() != 0;
96        functionalTest = source.readInt() != 0;
97    }
98}
99