blob: 574a1ee2d0cea4540ea61d0da21f8ab6b4978f32 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package android.content.pm;
18
19import android.os.Parcel;
20import android.os.Parcelable;
Adam Lesinski4e862812016-11-21 16:02:24 -080021import android.util.SparseArray;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
23/**
24 * Information you can retrieve about a particular piece of test
25 * instrumentation. This corresponds to information collected
26 * from the AndroidManifest.xml's <instrumentation> tag.
27 */
28public class InstrumentationInfo extends PackageItemInfo implements Parcelable {
29 /**
30 * The name of the application package being instrumented. From the
31 * "package" attribute.
32 */
33 public String targetPackage;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070034
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035 /**
Dianne Hackborn34041732017-01-31 15:27:13 -080036 * Names of the process(es) this instrumentation will run in. If not specified, only
37 * runs in the main process of the targetPackage. Can either be a comma-separated list
38 * of process names or '*' for any process that launches to run targetPackage code.
39 */
Dianne Hackborn1be53542017-04-28 13:36:00 -070040 public String targetProcesses;
Dianne Hackborn34041732017-01-31 15:27:13 -080041
42 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070043 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 */
45 public String sourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070048 * Full path to the publicly available parts of {@link #sourceDir},
49 * including resources and manifest. This may be different from
50 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 */
52 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070053
54 /**
Adam Lesinski4e862812016-11-21 16:02:24 -080055 * The names of all installed split APKs, ordered lexicographically.
56 */
57 public String[] splitNames;
58
59 /**
60 * Full paths to zero or more split APKs, indexed by the same order as {@link #splitNames}.
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070061 */
62 public String[] splitSourceDirs;
63
64 /**
65 * Full path to the publicly available parts of {@link #splitSourceDirs},
66 * including resources and manifest. This may be different from
67 * {@link #splitSourceDirs} if an application is forward locked.
Adam Lesinski4e862812016-11-21 16:02:24 -080068 *
69 * @see #splitSourceDirs
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070070 */
71 public String[] splitPublicSourceDirs;
72
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 /**
Adam Lesinski4e862812016-11-21 16:02:24 -080074 * Maps the dependencies between split APKs. All splits implicitly depend on the base APK.
75 *
76 * Available since platform version O.
77 *
78 * Only populated if the application opts in to isolated split loading via the
79 * {@link android.R.attr.isolatedSplits} attribute in the <manifest> tag of the app's
80 * AndroidManifest.xml.
81 *
82 * The keys and values are all indices into the {@link #splitNames}, {@link #splitSourceDirs},
83 * and {@link #splitPublicSourceDirs} arrays.
Adam Lesinski1665d0f2017-03-10 14:46:57 -080084 * Each key represents a split and its value is an array of splits. The first element of this
85 * array is the parent split, and the rest are configuration splits. These configuration splits
86 * have no dependencies themselves.
Adam Lesinski4e862812016-11-21 16:02:24 -080087 * Cycles do not exist because they are illegal and screened for during installation.
88 *
89 * May be null if no splits are installed, or if no dependencies exist between them.
90 * @hide
91 */
Adam Lesinski1665d0f2017-03-10 14:46:57 -080092 public SparseArray<int[]> splitDependencies;
Adam Lesinski4e862812016-11-21 16:02:24 -080093
94 /**
Jeff Sharkey15447792015-11-05 16:18:51 -080095 * Full path to a directory assigned to the package for its persistent data.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
97 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -070098
Jeff Sharkey15447792015-11-05 16:18:51 -080099 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600100 public String deviceProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -0800101 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600102 public String credentialProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -0800103
Patrick Baumanneb595802018-04-17 09:49:55 -0700104 /** {@hide} */
105 public String primaryCpuAbi;
106
107 /** {@hide} */
108 public String secondaryCpuAbi;
109
Todd Kennedye713efc2016-05-10 13:45:40 -0700110 /** {@hide} Full path to the directory containing primary ABI native libraries. */
Kenny Root85387d72010-08-26 10:13:11 -0700111 public String nativeLibraryDir;
112
Todd Kennedye713efc2016-05-10 13:45:40 -0700113 /** {@hide} Full path to the directory containing secondary ABI native libraries. */
114 public String secondaryNativeLibraryDir;
115
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 /**
117 * Specifies whether or not this instrumentation will handle profiling.
118 */
119 public boolean handleProfiling;
120
121 /** Specifies whether or not to run this instrumentation as a functional test */
122 public boolean functionalTest;
123
124 public InstrumentationInfo() {
125 }
126
127 public InstrumentationInfo(InstrumentationInfo orig) {
128 super(orig);
129 targetPackage = orig.targetPackage;
Dianne Hackborn1be53542017-04-28 13:36:00 -0700130 targetProcesses = orig.targetProcesses;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 sourceDir = orig.sourceDir;
132 publicSourceDir = orig.publicSourceDir;
Adam Lesinski4e862812016-11-21 16:02:24 -0800133 splitNames = orig.splitNames;
Jeff Sharkey15447792015-11-05 16:18:51 -0800134 splitSourceDirs = orig.splitSourceDirs;
135 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Adam Lesinski4e862812016-11-21 16:02:24 -0800136 splitDependencies = orig.splitDependencies;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 dataDir = orig.dataDir;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600138 deviceProtectedDataDir = orig.deviceProtectedDataDir;
139 credentialProtectedDataDir = orig.credentialProtectedDataDir;
Patrick Baumanneb595802018-04-17 09:49:55 -0700140 primaryCpuAbi = orig.primaryCpuAbi;
141 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Root85387d72010-08-26 10:13:11 -0700142 nativeLibraryDir = orig.nativeLibraryDir;
Todd Kennedye713efc2016-05-10 13:45:40 -0700143 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 handleProfiling = orig.handleProfiling;
145 functionalTest = orig.functionalTest;
146 }
147
148 public String toString() {
149 return "InstrumentationInfo{"
150 + Integer.toHexString(System.identityHashCode(this))
151 + " " + packageName + "}";
152 }
153
154 public int describeContents() {
155 return 0;
156 }
157
158 public void writeToParcel(Parcel dest, int parcelableFlags) {
159 super.writeToParcel(dest, parcelableFlags);
160 dest.writeString(targetPackage);
Dianne Hackborn1be53542017-04-28 13:36:00 -0700161 dest.writeString(targetProcesses);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800162 dest.writeString(sourceDir);
163 dest.writeString(publicSourceDir);
Adam Lesinski4e862812016-11-21 16:02:24 -0800164 dest.writeStringArray(splitNames);
Jeff Sharkey15447792015-11-05 16:18:51 -0800165 dest.writeStringArray(splitSourceDirs);
166 dest.writeStringArray(splitPublicSourceDirs);
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800167 dest.writeSparseArray((SparseArray) splitDependencies);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 dest.writeString(dataDir);
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600169 dest.writeString(deviceProtectedDataDir);
170 dest.writeString(credentialProtectedDataDir);
Patrick Baumanneb595802018-04-17 09:49:55 -0700171 dest.writeString(primaryCpuAbi);
172 dest.writeString(secondaryCpuAbi);
Kenny Root85387d72010-08-26 10:13:11 -0700173 dest.writeString(nativeLibraryDir);
Todd Kennedye713efc2016-05-10 13:45:40 -0700174 dest.writeString(secondaryNativeLibraryDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 dest.writeInt((handleProfiling == false) ? 0 : 1);
176 dest.writeInt((functionalTest == false) ? 0 : 1);
177 }
178
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700179 public static final @android.annotation.NonNull Parcelable.Creator<InstrumentationInfo> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 = new Parcelable.Creator<InstrumentationInfo>() {
181 public InstrumentationInfo createFromParcel(Parcel source) {
182 return new InstrumentationInfo(source);
183 }
184 public InstrumentationInfo[] newArray(int size) {
185 return new InstrumentationInfo[size];
186 }
187 };
188
Adam Lesinski4e862812016-11-21 16:02:24 -0800189 @SuppressWarnings("unchecked")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190 private InstrumentationInfo(Parcel source) {
191 super(source);
192 targetPackage = source.readString();
Dianne Hackborn1be53542017-04-28 13:36:00 -0700193 targetProcesses = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 sourceDir = source.readString();
195 publicSourceDir = source.readString();
Adam Lesinski4e862812016-11-21 16:02:24 -0800196 splitNames = source.readStringArray();
Jeff Sharkey15447792015-11-05 16:18:51 -0800197 splitSourceDirs = source.readStringArray();
198 splitPublicSourceDirs = source.readStringArray();
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800199 splitDependencies = source.readSparseArray(null);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 dataDir = source.readString();
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600201 deviceProtectedDataDir = source.readString();
202 credentialProtectedDataDir = source.readString();
Patrick Baumanneb595802018-04-17 09:49:55 -0700203 primaryCpuAbi = source.readString();
204 secondaryCpuAbi = source.readString();
Kenny Root85387d72010-08-26 10:13:11 -0700205 nativeLibraryDir = source.readString();
Todd Kennedye713efc2016-05-10 13:45:40 -0700206 secondaryNativeLibraryDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 handleProfiling = source.readInt() != 0;
208 functionalTest = source.readInt() != 0;
209 }
Jeff Sharkey15447792015-11-05 16:18:51 -0800210
211 /** {@hide} */
212 public void copyTo(ApplicationInfo ai) {
213 ai.packageName = packageName;
214 ai.sourceDir = sourceDir;
215 ai.publicSourceDir = publicSourceDir;
Adam Lesinski4e862812016-11-21 16:02:24 -0800216 ai.splitNames = splitNames;
Jeff Sharkey15447792015-11-05 16:18:51 -0800217 ai.splitSourceDirs = splitSourceDirs;
218 ai.splitPublicSourceDirs = splitPublicSourceDirs;
Adam Lesinski4e862812016-11-21 16:02:24 -0800219 ai.splitDependencies = splitDependencies;
Jeff Sharkey15447792015-11-05 16:18:51 -0800220 ai.dataDir = dataDir;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600221 ai.deviceProtectedDataDir = deviceProtectedDataDir;
222 ai.credentialProtectedDataDir = credentialProtectedDataDir;
Patrick Baumanneb595802018-04-17 09:49:55 -0700223 ai.primaryCpuAbi = primaryCpuAbi;
224 ai.secondaryCpuAbi = secondaryCpuAbi;
Jeff Sharkey15447792015-11-05 16:18:51 -0800225 ai.nativeLibraryDir = nativeLibraryDir;
Todd Kennedye713efc2016-05-10 13:45:40 -0700226 ai.secondaryNativeLibraryDir = secondaryNativeLibraryDir;
Jeff Sharkey15447792015-11-05 16:18:51 -0800227 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228}