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 data. 61 */ 62 public String dataDir; 63 64 /** {@hide} */ 65 public String deviceProtectedDataDir; 66 /** {@hide} */ 67 public String credentialProtectedDataDir; 68 69 /** {@hide} Full path to the directory containing primary ABI native libraries. */ 70 public String nativeLibraryDir; 71 72 /** {@hide} Full path to the directory containing secondary ABI native libraries. */ 73 public String secondaryNativeLibraryDir; 74 75 /** 76 * Specifies whether or not this instrumentation will handle profiling. 77 */ 78 public boolean handleProfiling; 79 80 /** Specifies whether or not to run this instrumentation as a functional test */ 81 public boolean functionalTest; 82 83 public InstrumentationInfo() { 84 } 85 86 public InstrumentationInfo(InstrumentationInfo orig) { 87 super(orig); 88 targetPackage = orig.targetPackage; 89 sourceDir = orig.sourceDir; 90 publicSourceDir = orig.publicSourceDir; 91 splitSourceDirs = orig.splitSourceDirs; 92 splitPublicSourceDirs = orig.splitPublicSourceDirs; 93 dataDir = orig.dataDir; 94 deviceProtectedDataDir = orig.deviceProtectedDataDir; 95 credentialProtectedDataDir = orig.credentialProtectedDataDir; 96 nativeLibraryDir = orig.nativeLibraryDir; 97 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir; 98 handleProfiling = orig.handleProfiling; 99 functionalTest = orig.functionalTest; 100 } 101 102 public String toString() { 103 return "InstrumentationInfo{" 104 + Integer.toHexString(System.identityHashCode(this)) 105 + " " + packageName + "}"; 106 } 107 108 public int describeContents() { 109 return 0; 110 } 111 112 public void writeToParcel(Parcel dest, int parcelableFlags) { 113 super.writeToParcel(dest, parcelableFlags); 114 dest.writeString(targetPackage); 115 dest.writeString(sourceDir); 116 dest.writeString(publicSourceDir); 117 dest.writeStringArray(splitSourceDirs); 118 dest.writeStringArray(splitPublicSourceDirs); 119 dest.writeString(dataDir); 120 dest.writeString(deviceProtectedDataDir); 121 dest.writeString(credentialProtectedDataDir); 122 dest.writeString(nativeLibraryDir); 123 dest.writeString(secondaryNativeLibraryDir); 124 dest.writeInt((handleProfiling == false) ? 0 : 1); 125 dest.writeInt((functionalTest == false) ? 0 : 1); 126 } 127 128 public static final Parcelable.Creator<InstrumentationInfo> CREATOR 129 = new Parcelable.Creator<InstrumentationInfo>() { 130 public InstrumentationInfo createFromParcel(Parcel source) { 131 return new InstrumentationInfo(source); 132 } 133 public InstrumentationInfo[] newArray(int size) { 134 return new InstrumentationInfo[size]; 135 } 136 }; 137 138 private InstrumentationInfo(Parcel source) { 139 super(source); 140 targetPackage = source.readString(); 141 sourceDir = source.readString(); 142 publicSourceDir = source.readString(); 143 splitSourceDirs = source.readStringArray(); 144 splitPublicSourceDirs = source.readStringArray(); 145 dataDir = source.readString(); 146 deviceProtectedDataDir = source.readString(); 147 credentialProtectedDataDir = source.readString(); 148 nativeLibraryDir = source.readString(); 149 secondaryNativeLibraryDir = source.readString(); 150 handleProfiling = source.readInt() != 0; 151 functionalTest = source.readInt() != 0; 152 } 153 154 /** {@hide} */ 155 public void copyTo(ApplicationInfo ai) { 156 ai.packageName = packageName; 157 ai.sourceDir = sourceDir; 158 ai.publicSourceDir = publicSourceDir; 159 ai.splitSourceDirs = splitSourceDirs; 160 ai.splitPublicSourceDirs = splitPublicSourceDirs; 161 ai.dataDir = dataDir; 162 ai.deviceProtectedDataDir = deviceProtectedDataDir; 163 ai.credentialProtectedDataDir = credentialProtectedDataDir; 164 ai.nativeLibraryDir = nativeLibraryDir; 165 ai.secondaryNativeLibraryDir = secondaryNativeLibraryDir; 166 } 167} 168