1/*
2 * Copyright (C) 2007 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
22/**
23 * Information you can retrieve about a particular piece of test
24 * instrumentation.  This corresponds to information collected
25 * from the AndroidManifest.xml's <instrumentation> tag.
26 */
27public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
28    /**
29     * The name of the application package being instrumented.  From the
30     * "package" attribute.
31     */
32    public String targetPackage;
33
34    /**
35     * Full path to the base APK for this application.
36     */
37    public String sourceDir;
38
39    /**
40     * Full path to the publicly available parts of {@link #sourceDir},
41     * including resources and manifest. This may be different from
42     * {@link #sourceDir} if an application is forward locked.
43     */
44    public String publicSourceDir;
45
46    /**
47     * Full paths to zero or more split APKs that, when combined with the base
48     * APK defined in {@link #sourceDir}, form a complete application.
49     */
50    public String[] splitSourceDirs;
51
52    /**
53     * Full path to the publicly available parts of {@link #splitSourceDirs},
54     * including resources and manifest. This may be different from
55     * {@link #splitSourceDirs} if an application is forward locked.
56     */
57    public String[] splitPublicSourceDirs;
58
59    /**
60     * Full path to a directory assigned to the package for its persistent
61     * data.
62     */
63    public String dataDir;
64
65    /**
66     * Full path to the directory where the native JNI libraries are stored.
67     *
68     * {@hide}
69     */
70    public String nativeLibraryDir;
71
72    /**
73     * Specifies whether or not this instrumentation will handle profiling.
74     */
75    public boolean handleProfiling;
76
77    /** Specifies whether or not to run this instrumentation as a functional test */
78    public boolean functionalTest;
79
80    public InstrumentationInfo() {
81    }
82
83    public InstrumentationInfo(InstrumentationInfo orig) {
84        super(orig);
85        targetPackage = orig.targetPackage;
86        sourceDir = orig.sourceDir;
87        publicSourceDir = orig.publicSourceDir;
88        dataDir = orig.dataDir;
89        nativeLibraryDir = orig.nativeLibraryDir;
90        handleProfiling = orig.handleProfiling;
91        functionalTest = orig.functionalTest;
92    }
93
94    public String toString() {
95        return "InstrumentationInfo{"
96            + Integer.toHexString(System.identityHashCode(this))
97            + " " + packageName + "}";
98    }
99
100    public int describeContents() {
101        return 0;
102    }
103
104    public void writeToParcel(Parcel dest, int parcelableFlags) {
105        super.writeToParcel(dest, parcelableFlags);
106        dest.writeString(targetPackage);
107        dest.writeString(sourceDir);
108        dest.writeString(publicSourceDir);
109        dest.writeString(dataDir);
110        dest.writeString(nativeLibraryDir);
111        dest.writeInt((handleProfiling == false) ? 0 : 1);
112        dest.writeInt((functionalTest == false) ? 0 : 1);
113    }
114
115    public static final Parcelable.Creator<InstrumentationInfo> CREATOR
116            = new Parcelable.Creator<InstrumentationInfo>() {
117        public InstrumentationInfo createFromParcel(Parcel source) {
118            return new InstrumentationInfo(source);
119        }
120        public InstrumentationInfo[] newArray(int size) {
121            return new InstrumentationInfo[size];
122        }
123    };
124
125    private InstrumentationInfo(Parcel source) {
126        super(source);
127        targetPackage = source.readString();
128        sourceDir = source.readString();
129        publicSourceDir = source.readString();
130        dataDir = source.readString();
131        nativeLibraryDir = source.readString();
132        handleProfiling = source.readInt() != 0;
133        functionalTest = source.readInt() != 0;
134    }
135}
136