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