Home | History | Annotate | Download | only in pm
      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 import android.text.TextUtils;
     22 
     23 import java.text.Collator;
     24 import 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  */
     31 public 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      * Full path to the directory where the native JNI libraries are stored.
     56      *
     57      * {@hide}
     58      */
     59     public String nativeLibraryDir;
     60 
     61     /**
     62      * Specifies whether or not this instrumentation will handle profiling.
     63      */
     64     public boolean handleProfiling;
     65 
     66     /** Specifies whether or not to run this instrumentation as a functional test */
     67     public boolean functionalTest;
     68 
     69     public InstrumentationInfo() {
     70     }
     71 
     72     public InstrumentationInfo(InstrumentationInfo orig) {
     73         super(orig);
     74         targetPackage = orig.targetPackage;
     75         sourceDir = orig.sourceDir;
     76         publicSourceDir = orig.publicSourceDir;
     77         dataDir = orig.dataDir;
     78         nativeLibraryDir = orig.nativeLibraryDir;
     79         handleProfiling = orig.handleProfiling;
     80         functionalTest = orig.functionalTest;
     81     }
     82 
     83     public String toString() {
     84         return "InstrumentationInfo{"
     85             + Integer.toHexString(System.identityHashCode(this))
     86             + " " + packageName + "}";
     87     }
     88 
     89     public int describeContents() {
     90         return 0;
     91     }
     92 
     93     public void writeToParcel(Parcel dest, int parcelableFlags) {
     94         super.writeToParcel(dest, parcelableFlags);
     95         dest.writeString(targetPackage);
     96         dest.writeString(sourceDir);
     97         dest.writeString(publicSourceDir);
     98         dest.writeString(dataDir);
     99         dest.writeString(nativeLibraryDir);
    100         dest.writeInt((handleProfiling == false) ? 0 : 1);
    101         dest.writeInt((functionalTest == false) ? 0 : 1);
    102     }
    103 
    104     public static final Parcelable.Creator<InstrumentationInfo> CREATOR
    105             = new Parcelable.Creator<InstrumentationInfo>() {
    106         public InstrumentationInfo createFromParcel(Parcel source) {
    107             return new InstrumentationInfo(source);
    108         }
    109         public InstrumentationInfo[] newArray(int size) {
    110             return new InstrumentationInfo[size];
    111         }
    112     };
    113 
    114     private InstrumentationInfo(Parcel source) {
    115         super(source);
    116         targetPackage = source.readString();
    117         sourceDir = source.readString();
    118         publicSourceDir = source.readString();
    119         dataDir = source.readString();
    120         nativeLibraryDir = source.readString();
    121         handleProfiling = source.readInt() != 0;
    122         functionalTest = source.readInt() != 0;
    123     }
    124 }
    125