• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package android.content.pm;
18 
19 import android.os.Parcel;
20 import 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  */
27 public 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 location of this package.
36      */
37     public String sourceDir;
38 
39     /**
40      * Full path to the location of the publicly available parts of this package (i.e. the resources
41      * and manifest).  For non-forward-locked apps this will be the same as {@link #sourceDir).
42      */
43     public String publicSourceDir;
44     /**
45      * Full path to a directory assigned to the package for its persistent
46      * data.
47      */
48     public String dataDir;
49 
50     /**
51      * Full path to the directory where the native JNI libraries are stored.
52      *
53      * {@hide}
54      */
55     public String nativeLibraryDir;
56 
57     /**
58      * Specifies whether or not this instrumentation will handle profiling.
59      */
60     public boolean handleProfiling;
61 
62     /** Specifies whether or not to run this instrumentation as a functional test */
63     public boolean functionalTest;
64 
InstrumentationInfo()65     public InstrumentationInfo() {
66     }
67 
InstrumentationInfo(InstrumentationInfo orig)68     public InstrumentationInfo(InstrumentationInfo orig) {
69         super(orig);
70         targetPackage = orig.targetPackage;
71         sourceDir = orig.sourceDir;
72         publicSourceDir = orig.publicSourceDir;
73         dataDir = orig.dataDir;
74         nativeLibraryDir = orig.nativeLibraryDir;
75         handleProfiling = orig.handleProfiling;
76         functionalTest = orig.functionalTest;
77     }
78 
toString()79     public String toString() {
80         return "InstrumentationInfo{"
81             + Integer.toHexString(System.identityHashCode(this))
82             + " " + packageName + "}";
83     }
84 
describeContents()85     public int describeContents() {
86         return 0;
87     }
88 
writeToParcel(Parcel dest, int parcelableFlags)89     public void writeToParcel(Parcel dest, int parcelableFlags) {
90         super.writeToParcel(dest, parcelableFlags);
91         dest.writeString(targetPackage);
92         dest.writeString(sourceDir);
93         dest.writeString(publicSourceDir);
94         dest.writeString(dataDir);
95         dest.writeString(nativeLibraryDir);
96         dest.writeInt((handleProfiling == false) ? 0 : 1);
97         dest.writeInt((functionalTest == false) ? 0 : 1);
98     }
99 
100     public static final Parcelable.Creator<InstrumentationInfo> CREATOR
101             = new Parcelable.Creator<InstrumentationInfo>() {
102         public InstrumentationInfo createFromParcel(Parcel source) {
103             return new InstrumentationInfo(source);
104         }
105         public InstrumentationInfo[] newArray(int size) {
106             return new InstrumentationInfo[size];
107         }
108     };
109 
InstrumentationInfo(Parcel source)110     private InstrumentationInfo(Parcel source) {
111         super(source);
112         targetPackage = source.readString();
113         sourceDir = source.readString();
114         publicSourceDir = source.readString();
115         dataDir = source.readString();
116         nativeLibraryDir = source.readString();
117         handleProfiling = source.readInt() != 0;
118         functionalTest = source.readInt() != 0;
119     }
120 }
121