Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.content.pm; |
| 18 | |
| 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 21 | import android.util.SparseArray; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | |
| 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 | */ |
| 28 | public 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 Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 34 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | /** |
Dianne Hackborn | 3404173 | 2017-01-31 15:27:13 -0800 | [diff] [blame] | 36 | * 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 Hackborn | 1be5354 | 2017-04-28 13:36:00 -0700 | [diff] [blame] | 40 | public String targetProcesses; |
Dianne Hackborn | 3404173 | 2017-01-31 15:27:13 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 43 | * Full path to the base APK for this application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | */ |
| 45 | public String sourceDir; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 46 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 48 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | */ |
| 52 | public String publicSourceDir; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 55 | * 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 Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 61 | */ |
| 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 Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 68 | * |
| 69 | * @see #splitSourceDirs |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 70 | */ |
| 71 | public String[] splitPublicSourceDirs; |
| 72 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 74 | * 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 Lesinski | 1665d0f | 2017-03-10 14:46:57 -0800 | [diff] [blame] | 84 | * 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 Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 87 | * 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 Lesinski | 1665d0f | 2017-03-10 14:46:57 -0800 | [diff] [blame] | 92 | public SparseArray<int[]> splitDependencies; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 93 | |
| 94 | /** |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 95 | * Full path to a directory assigned to the package for its persistent data. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 96 | */ |
| 97 | public String dataDir; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 98 | |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 99 | /** {@hide} */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 100 | public String deviceProtectedDataDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 101 | /** {@hide} */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 102 | public String credentialProtectedDataDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 103 | |
Patrick Baumann | eb59580 | 2018-04-17 09:49:55 -0700 | [diff] [blame] | 104 | /** {@hide} */ |
| 105 | public String primaryCpuAbi; |
| 106 | |
| 107 | /** {@hide} */ |
| 108 | public String secondaryCpuAbi; |
| 109 | |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 110 | /** {@hide} Full path to the directory containing primary ABI native libraries. */ |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 111 | public String nativeLibraryDir; |
| 112 | |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 113 | /** {@hide} Full path to the directory containing secondary ABI native libraries. */ |
| 114 | public String secondaryNativeLibraryDir; |
| 115 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 116 | /** |
| 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 Hackborn | 1be5354 | 2017-04-28 13:36:00 -0700 | [diff] [blame] | 130 | targetProcesses = orig.targetProcesses; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 131 | sourceDir = orig.sourceDir; |
| 132 | publicSourceDir = orig.publicSourceDir; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 133 | splitNames = orig.splitNames; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 134 | splitSourceDirs = orig.splitSourceDirs; |
| 135 | splitPublicSourceDirs = orig.splitPublicSourceDirs; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 136 | splitDependencies = orig.splitDependencies; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | dataDir = orig.dataDir; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 138 | deviceProtectedDataDir = orig.deviceProtectedDataDir; |
| 139 | credentialProtectedDataDir = orig.credentialProtectedDataDir; |
Patrick Baumann | eb59580 | 2018-04-17 09:49:55 -0700 | [diff] [blame] | 140 | primaryCpuAbi = orig.primaryCpuAbi; |
| 141 | secondaryCpuAbi = orig.secondaryCpuAbi; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 142 | nativeLibraryDir = orig.nativeLibraryDir; |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 143 | secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | 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 Hackborn | 1be5354 | 2017-04-28 13:36:00 -0700 | [diff] [blame] | 161 | dest.writeString(targetProcesses); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 162 | dest.writeString(sourceDir); |
| 163 | dest.writeString(publicSourceDir); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 164 | dest.writeStringArray(splitNames); |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 165 | dest.writeStringArray(splitSourceDirs); |
| 166 | dest.writeStringArray(splitPublicSourceDirs); |
Adam Lesinski | 1665d0f | 2017-03-10 14:46:57 -0800 | [diff] [blame] | 167 | dest.writeSparseArray((SparseArray) splitDependencies); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 | dest.writeString(dataDir); |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 169 | dest.writeString(deviceProtectedDataDir); |
| 170 | dest.writeString(credentialProtectedDataDir); |
Patrick Baumann | eb59580 | 2018-04-17 09:49:55 -0700 | [diff] [blame] | 171 | dest.writeString(primaryCpuAbi); |
| 172 | dest.writeString(secondaryCpuAbi); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 173 | dest.writeString(nativeLibraryDir); |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 174 | dest.writeString(secondaryNativeLibraryDir); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 175 | dest.writeInt((handleProfiling == false) ? 0 : 1); |
| 176 | dest.writeInt((functionalTest == false) ? 0 : 1); |
| 177 | } |
| 178 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame^] | 179 | public static final @android.annotation.NonNull Parcelable.Creator<InstrumentationInfo> CREATOR |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | = 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 Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 189 | @SuppressWarnings("unchecked") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 190 | private InstrumentationInfo(Parcel source) { |
| 191 | super(source); |
| 192 | targetPackage = source.readString(); |
Dianne Hackborn | 1be5354 | 2017-04-28 13:36:00 -0700 | [diff] [blame] | 193 | targetProcesses = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | sourceDir = source.readString(); |
| 195 | publicSourceDir = source.readString(); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 196 | splitNames = source.readStringArray(); |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 197 | splitSourceDirs = source.readStringArray(); |
| 198 | splitPublicSourceDirs = source.readStringArray(); |
Adam Lesinski | 1665d0f | 2017-03-10 14:46:57 -0800 | [diff] [blame] | 199 | splitDependencies = source.readSparseArray(null); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | dataDir = source.readString(); |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 201 | deviceProtectedDataDir = source.readString(); |
| 202 | credentialProtectedDataDir = source.readString(); |
Patrick Baumann | eb59580 | 2018-04-17 09:49:55 -0700 | [diff] [blame] | 203 | primaryCpuAbi = source.readString(); |
| 204 | secondaryCpuAbi = source.readString(); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 205 | nativeLibraryDir = source.readString(); |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 206 | secondaryNativeLibraryDir = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 207 | handleProfiling = source.readInt() != 0; |
| 208 | functionalTest = source.readInt() != 0; |
| 209 | } |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 210 | |
| 211 | /** {@hide} */ |
| 212 | public void copyTo(ApplicationInfo ai) { |
| 213 | ai.packageName = packageName; |
| 214 | ai.sourceDir = sourceDir; |
| 215 | ai.publicSourceDir = publicSourceDir; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 216 | ai.splitNames = splitNames; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 217 | ai.splitSourceDirs = splitSourceDirs; |
| 218 | ai.splitPublicSourceDirs = splitPublicSourceDirs; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 219 | ai.splitDependencies = splitDependencies; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 220 | ai.dataDir = dataDir; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 221 | ai.deviceProtectedDataDir = deviceProtectedDataDir; |
| 222 | ai.credentialProtectedDataDir = credentialProtectedDataDir; |
Patrick Baumann | eb59580 | 2018-04-17 09:49:55 -0700 | [diff] [blame] | 223 | ai.primaryCpuAbi = primaryCpuAbi; |
| 224 | ai.secondaryCpuAbi = secondaryCpuAbi; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 225 | ai.nativeLibraryDir = nativeLibraryDir; |
Todd Kennedy | e713efc | 2016-05-10 13:45:40 -0700 | [diff] [blame] | 226 | ai.secondaryNativeLibraryDir = secondaryNativeLibraryDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 227 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 228 | } |