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; |
| 21 | |
| 22 | /** |
| 23 | * Overall information about the contents of a package. This corresponds |
| 24 | * to all of the information collected from AndroidManifest.xml. |
| 25 | */ |
| 26 | public class PackageInfo implements Parcelable { |
| 27 | /** |
| 28 | * The name of this package. From the <manifest> tag's "name" |
| 29 | * attribute. |
| 30 | */ |
| 31 | public String packageName; |
| 32 | |
| 33 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 34 | * The names of any installed split APKs for this package. |
| 35 | */ |
| 36 | public String[] splitNames; |
| 37 | |
| 38 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | * The version number of this package, as specified by the <manifest> |
| 40 | * tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode} |
| 41 | * attribute. |
| 42 | */ |
| 43 | public int versionCode; |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 44 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | /** |
| 46 | * The version name of this package, as specified by the <manifest> |
| 47 | * tag's {@link android.R.styleable#AndroidManifest_versionName versionName} |
| 48 | * attribute. |
| 49 | */ |
| 50 | public String versionName; |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * The revision number of the base APK for this package, as specified by the |
| 54 | * <manifest> tag's |
| 55 | * {@link android.R.styleable#AndroidManifest_revisionCode revisionCode} |
| 56 | * attribute. |
| 57 | */ |
| 58 | public int baseRevisionCode; |
| 59 | |
| 60 | /** |
| 61 | * The revision number of any split APKs for this package, as specified by |
| 62 | * the <manifest> tag's |
| 63 | * {@link android.R.styleable#AndroidManifest_revisionCode revisionCode} |
| 64 | * attribute. Indexes are a 1:1 mapping against {@link #splitNames}. |
| 65 | */ |
| 66 | public int[] splitRevisionCodes; |
| 67 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | /** |
| 69 | * The shared user ID name of this package, as specified by the <manifest> |
| 70 | * tag's {@link android.R.styleable#AndroidManifest_sharedUserId sharedUserId} |
| 71 | * attribute. |
| 72 | */ |
| 73 | public String sharedUserId; |
| 74 | |
| 75 | /** |
| 76 | * The shared user ID label of this package, as specified by the <manifest> |
| 77 | * tag's {@link android.R.styleable#AndroidManifest_sharedUserLabel sharedUserLabel} |
| 78 | * attribute. |
| 79 | */ |
| 80 | public int sharedUserLabel; |
| 81 | |
| 82 | /** |
| 83 | * Information collected from the <application> tag, or null if |
| 84 | * there was none. |
| 85 | */ |
| 86 | public ApplicationInfo applicationInfo; |
| 87 | |
| 88 | /** |
Dianne Hackborn | 78d688369 | 2010-10-07 01:12:46 -0700 | [diff] [blame] | 89 | * The time at which the app was first installed. Units are as |
| 90 | * per {@link System#currentTimeMillis()}. |
| 91 | */ |
| 92 | public long firstInstallTime; |
| 93 | |
| 94 | /** |
| 95 | * The time at which the app was last updated. Units are as |
| 96 | * per {@link System#currentTimeMillis()}. |
| 97 | */ |
| 98 | public long lastUpdateTime; |
| 99 | |
| 100 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | * All kernel group-IDs that have been assigned to this package. |
| 102 | * This is only filled in if the flag {@link PackageManager#GET_GIDS} was set. |
| 103 | */ |
| 104 | public int[] gids; |
| 105 | |
| 106 | /** |
| 107 | * Array of all {@link android.R.styleable#AndroidManifestActivity |
| 108 | * <activity>} tags included under <application>, |
| 109 | * or null if there were none. This is only filled in if the flag |
| 110 | * {@link PackageManager#GET_ACTIVITIES} was set. |
| 111 | */ |
| 112 | public ActivityInfo[] activities; |
| 113 | |
| 114 | /** |
| 115 | * Array of all {@link android.R.styleable#AndroidManifestReceiver |
| 116 | * <receiver>} tags included under <application>, |
| 117 | * or null if there were none. This is only filled in if the flag |
| 118 | * {@link PackageManager#GET_RECEIVERS} was set. |
| 119 | */ |
| 120 | public ActivityInfo[] receivers; |
| 121 | |
| 122 | /** |
| 123 | * Array of all {@link android.R.styleable#AndroidManifestService |
| 124 | * <service>} tags included under <application>, |
| 125 | * or null if there were none. This is only filled in if the flag |
| 126 | * {@link PackageManager#GET_SERVICES} was set. |
| 127 | */ |
| 128 | public ServiceInfo[] services; |
| 129 | |
| 130 | /** |
| 131 | * Array of all {@link android.R.styleable#AndroidManifestProvider |
| 132 | * <provider>} tags included under <application>, |
| 133 | * or null if there were none. This is only filled in if the flag |
| 134 | * {@link PackageManager#GET_PROVIDERS} was set. |
| 135 | */ |
| 136 | public ProviderInfo[] providers; |
| 137 | |
| 138 | /** |
| 139 | * Array of all {@link android.R.styleable#AndroidManifestInstrumentation |
| 140 | * <instrumentation>} tags included under <manifest>, |
| 141 | * or null if there were none. This is only filled in if the flag |
| 142 | * {@link PackageManager#GET_INSTRUMENTATION} was set. |
| 143 | */ |
| 144 | public InstrumentationInfo[] instrumentation; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 145 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 146 | /** |
| 147 | * Array of all {@link android.R.styleable#AndroidManifestPermission |
| 148 | * <permission>} tags included under <manifest>, |
| 149 | * or null if there were none. This is only filled in if the flag |
| 150 | * {@link PackageManager#GET_PERMISSIONS} was set. |
| 151 | */ |
| 152 | public PermissionInfo[] permissions; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 153 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 154 | /** |
| 155 | * Array of all {@link android.R.styleable#AndroidManifestUsesPermission |
| 156 | * <uses-permission>} tags included under <manifest>, |
| 157 | * or null if there were none. This is only filled in if the flag |
| 158 | * {@link PackageManager#GET_PERMISSIONS} was set. This list includes |
| 159 | * all permissions requested, even those that were not granted or known |
| 160 | * by the system at install time. |
| 161 | */ |
| 162 | public String[] requestedPermissions; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 163 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | /** |
Dianne Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame] | 165 | * Array of flags of all {@link android.R.styleable#AndroidManifestUsesPermission |
| 166 | * <uses-permission>} tags included under <manifest>, |
| 167 | * or null if there were none. This is only filled in if the flag |
| 168 | * {@link PackageManager#GET_PERMISSIONS} was set. Each value matches |
| 169 | * the corresponding entry in {@link #requestedPermissions}, and will have |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 170 | * the flag {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate. |
Dianne Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame] | 171 | */ |
| 172 | public int[] requestedPermissionsFlags; |
| 173 | |
| 174 | /** |
| 175 | * Flag for {@link #requestedPermissionsFlags}: the requested permission |
| 176 | * is required for the application to run; the user can not optionally |
Nick Kralevich | 32eb5b18 | 2013-04-11 10:20:09 -0700 | [diff] [blame] | 177 | * disable it. Currently all permissions are required. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 178 | * |
| 179 | * @removed We do not support required permissions. |
Dianne Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame] | 180 | */ |
| 181 | public static final int REQUESTED_PERMISSION_REQUIRED = 1<<0; |
| 182 | |
| 183 | /** |
| 184 | * Flag for {@link #requestedPermissionsFlags}: the requested permission |
| 185 | * is currently granted to the application. |
| 186 | */ |
| 187 | public static final int REQUESTED_PERMISSION_GRANTED = 1<<1; |
| 188 | |
| 189 | /** |
Svetoslav Ganov | cdd685c | 2017-08-22 14:35:04 -0700 | [diff] [blame] | 190 | * Array of all signatures read from the package file. This is only filled |
| 191 | * in if the flag {@link PackageManager#GET_SIGNATURES} was set. A package |
| 192 | * must be singed with at least one certificate which is at position zero. |
| 193 | * The package can be signed with additional certificates which appear as |
| 194 | * subsequent entries. |
| 195 | * |
| 196 | * <strong>Note:</strong> Signature ordering is not guaranteed to be |
| 197 | * stable which means that a package signed with certificates A and B is |
| 198 | * equivalent to being signed with certificates B and A. This means that |
| 199 | * in case multiple signatures are reported you cannot assume the one at |
| 200 | * the first position to be the same across updates. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 201 | */ |
| 202 | public Signature[] signatures; |
| 203 | |
| 204 | /** |
| 205 | * Application specified preferred configuration |
| 206 | * {@link android.R.styleable#AndroidManifestUsesConfiguration |
| 207 | * <uses-configuration>} tags included under <manifest>, |
| 208 | * or null if there were none. This is only filled in if the flag |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 209 | * {@link PackageManager#GET_CONFIGURATIONS} was set. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 210 | */ |
| 211 | public ConfigurationInfo[] configPreferences; |
| 212 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 213 | /** |
Jeff Sharkey | da96e13 | 2014-07-15 14:54:09 -0700 | [diff] [blame] | 214 | * Features that this application has requested. |
| 215 | * |
| 216 | * @see FeatureInfo#FLAG_REQUIRED |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 217 | */ |
| 218 | public FeatureInfo[] reqFeatures; |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 219 | |
| 220 | /** |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 221 | * Groups of features that this application has requested. |
| 222 | * Each group contains a set of features that are required. |
| 223 | * A device must match the features listed in {@link #reqFeatures} and one |
| 224 | * or more FeatureGroups in order to have satisfied the feature requirement. |
| 225 | * |
| 226 | * @see FeatureInfo#FLAG_REQUIRED |
| 227 | */ |
| 228 | public FeatureGroupInfo[] featureGroups; |
| 229 | |
| 230 | /** |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 231 | * Constant corresponding to <code>auto</code> in |
| 232 | * the {@link android.R.attr#installLocation} attribute. |
| 233 | * @hide |
| 234 | */ |
Suchi Amalapurapu | 90d8ee6 | 2010-03-18 11:38:35 -0700 | [diff] [blame] | 235 | public static final int INSTALL_LOCATION_UNSPECIFIED = -1; |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 236 | |
Suchi Amalapurapu | 90d8ee6 | 2010-03-18 11:38:35 -0700 | [diff] [blame] | 237 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 238 | * Constant corresponding to <code>auto</code> in the |
| 239 | * {@link android.R.attr#installLocation} attribute. |
Suchi Amalapurapu | 90d8ee6 | 2010-03-18 11:38:35 -0700 | [diff] [blame] | 240 | */ |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 241 | public static final int INSTALL_LOCATION_AUTO = 0; |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 242 | |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 243 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 244 | * Constant corresponding to <code>internalOnly</code> in the |
| 245 | * {@link android.R.attr#installLocation} attribute. |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 246 | */ |
| 247 | public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1; |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 248 | |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 249 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 250 | * Constant corresponding to <code>preferExternal</code> in the |
| 251 | * {@link android.R.attr#installLocation} attribute. |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 252 | */ |
| 253 | public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 254 | |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 255 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 256 | * The install location requested by the package. From the |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 257 | * {@link android.R.attr#installLocation} attribute, one of |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 258 | * {@link #INSTALL_LOCATION_AUTO}, {@link #INSTALL_LOCATION_INTERNAL_ONLY}, |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 259 | * {@link #INSTALL_LOCATION_PREFER_EXTERNAL} |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 260 | */ |
| 261 | public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY; |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 262 | |
| 263 | /** @hide */ |
Todd Kennedy | 7c8addf | 2017-06-27 14:13:55 -0700 | [diff] [blame] | 264 | public boolean isStub; |
| 265 | |
| 266 | /** @hide */ |
Jeff Hao | 272bf3a | 2014-10-08 13:34:43 -0700 | [diff] [blame] | 267 | public boolean coreApp; |
| 268 | |
| 269 | /** @hide */ |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 270 | public boolean requiredForAllUsers; |
| 271 | |
Amith Yamasani | 0ac1fc9 | 2013-03-27 18:56:08 -0700 | [diff] [blame] | 272 | /** @hide */ |
| 273 | public String restrictedAccountType; |
| 274 | |
Amith Yamasani | ccbe389 | 2013-04-12 17:52:42 -0700 | [diff] [blame] | 275 | /** @hide */ |
| 276 | public String requiredAccountType; |
| 277 | |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 278 | /** |
| 279 | * What package, if any, this package will overlay. |
| 280 | * |
| 281 | * Package name of target package, or null. |
| 282 | * @hide |
| 283 | */ |
| 284 | public String overlayTarget; |
| 285 | |
Jaekyun Seok | 0434289 | 2017-03-02 15:24:19 +0900 | [diff] [blame] | 286 | /** @hide */ |
Jaekyun Seok | 42d53f6 | 2017-04-10 13:48:58 +0900 | [diff] [blame] | 287 | public int overlayPriority; |
| 288 | |
| 289 | /** @hide */ |
Jaekyun Seok | 0434289 | 2017-03-02 15:24:19 +0900 | [diff] [blame] | 290 | public boolean isStaticOverlay; |
| 291 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 292 | public PackageInfo() { |
| 293 | } |
| 294 | |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 295 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 296 | public String toString() { |
| 297 | return "PackageInfo{" |
| 298 | + Integer.toHexString(System.identityHashCode(this)) |
| 299 | + " " + packageName + "}"; |
| 300 | } |
| 301 | |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 302 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 303 | public int describeContents() { |
| 304 | return 0; |
| 305 | } |
| 306 | |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 307 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 309 | dest.writeString(packageName); |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 310 | dest.writeStringArray(splitNames); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 311 | dest.writeInt(versionCode); |
| 312 | dest.writeString(versionName); |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 313 | dest.writeInt(baseRevisionCode); |
| 314 | dest.writeIntArray(splitRevisionCodes); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 315 | dest.writeString(sharedUserId); |
| 316 | dest.writeInt(sharedUserLabel); |
| 317 | if (applicationInfo != null) { |
| 318 | dest.writeInt(1); |
| 319 | applicationInfo.writeToParcel(dest, parcelableFlags); |
| 320 | } else { |
| 321 | dest.writeInt(0); |
| 322 | } |
Dianne Hackborn | 78d688369 | 2010-10-07 01:12:46 -0700 | [diff] [blame] | 323 | dest.writeLong(firstInstallTime); |
| 324 | dest.writeLong(lastUpdateTime); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 325 | dest.writeIntArray(gids); |
Christopher Tate | b911676 | 2015-09-09 18:46:31 -0700 | [diff] [blame] | 326 | dest.writeTypedArray(activities, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES); |
| 327 | dest.writeTypedArray(receivers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES); |
| 328 | dest.writeTypedArray(services, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES); |
| 329 | dest.writeTypedArray(providers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 330 | dest.writeTypedArray(instrumentation, parcelableFlags); |
| 331 | dest.writeTypedArray(permissions, parcelableFlags); |
| 332 | dest.writeStringArray(requestedPermissions); |
Dianne Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame] | 333 | dest.writeIntArray(requestedPermissionsFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 334 | dest.writeTypedArray(signatures, parcelableFlags); |
| 335 | dest.writeTypedArray(configPreferences, parcelableFlags); |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 336 | dest.writeTypedArray(reqFeatures, parcelableFlags); |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 337 | dest.writeTypedArray(featureGroups, parcelableFlags); |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 338 | dest.writeInt(installLocation); |
Todd Kennedy | 7c8addf | 2017-06-27 14:13:55 -0700 | [diff] [blame] | 339 | dest.writeInt(isStub ? 1 : 0); |
Jeff Hao | 272bf3a | 2014-10-08 13:34:43 -0700 | [diff] [blame] | 340 | dest.writeInt(coreApp ? 1 : 0); |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 341 | dest.writeInt(requiredForAllUsers ? 1 : 0); |
Amith Yamasani | 0ac1fc9 | 2013-03-27 18:56:08 -0700 | [diff] [blame] | 342 | dest.writeString(restrictedAccountType); |
Amith Yamasani | ccbe389 | 2013-04-12 17:52:42 -0700 | [diff] [blame] | 343 | dest.writeString(requiredAccountType); |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 344 | dest.writeString(overlayTarget); |
Jaekyun Seok | 0434289 | 2017-03-02 15:24:19 +0900 | [diff] [blame] | 345 | dest.writeInt(isStaticOverlay ? 1 : 0); |
Jaekyun Seok | 42d53f6 | 2017-04-10 13:48:58 +0900 | [diff] [blame] | 346 | dest.writeInt(overlayPriority); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | public static final Parcelable.Creator<PackageInfo> CREATOR |
| 350 | = new Parcelable.Creator<PackageInfo>() { |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 351 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 352 | public PackageInfo createFromParcel(Parcel source) { |
| 353 | return new PackageInfo(source); |
| 354 | } |
| 355 | |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 356 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 357 | public PackageInfo[] newArray(int size) { |
| 358 | return new PackageInfo[size]; |
| 359 | } |
| 360 | }; |
| 361 | |
| 362 | private PackageInfo(Parcel source) { |
| 363 | packageName = source.readString(); |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 364 | splitNames = source.createStringArray(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 365 | versionCode = source.readInt(); |
| 366 | versionName = source.readString(); |
Jeff Sharkey | 88d2a3c | 2014-11-22 16:49:34 -0800 | [diff] [blame] | 367 | baseRevisionCode = source.readInt(); |
| 368 | splitRevisionCodes = source.createIntArray(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 369 | sharedUserId = source.readString(); |
| 370 | sharedUserLabel = source.readInt(); |
| 371 | int hasApp = source.readInt(); |
| 372 | if (hasApp != 0) { |
| 373 | applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source); |
| 374 | } |
Dianne Hackborn | 78d688369 | 2010-10-07 01:12:46 -0700 | [diff] [blame] | 375 | firstInstallTime = source.readLong(); |
| 376 | lastUpdateTime = source.readLong(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 377 | gids = source.createIntArray(); |
| 378 | activities = source.createTypedArray(ActivityInfo.CREATOR); |
| 379 | receivers = source.createTypedArray(ActivityInfo.CREATOR); |
| 380 | services = source.createTypedArray(ServiceInfo.CREATOR); |
| 381 | providers = source.createTypedArray(ProviderInfo.CREATOR); |
| 382 | instrumentation = source.createTypedArray(InstrumentationInfo.CREATOR); |
| 383 | permissions = source.createTypedArray(PermissionInfo.CREATOR); |
| 384 | requestedPermissions = source.createStringArray(); |
Dianne Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame] | 385 | requestedPermissionsFlags = source.createIntArray(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 386 | signatures = source.createTypedArray(Signature.CREATOR); |
| 387 | configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR); |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 388 | reqFeatures = source.createTypedArray(FeatureInfo.CREATOR); |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 389 | featureGroups = source.createTypedArray(FeatureGroupInfo.CREATOR); |
Suchi Amalapurapu | 117818e | 2010-02-09 03:45:40 -0800 | [diff] [blame] | 390 | installLocation = source.readInt(); |
Todd Kennedy | 7c8addf | 2017-06-27 14:13:55 -0700 | [diff] [blame] | 391 | isStub = source.readInt() != 0; |
Jeff Hao | 272bf3a | 2014-10-08 13:34:43 -0700 | [diff] [blame] | 392 | coreApp = source.readInt() != 0; |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 393 | requiredForAllUsers = source.readInt() != 0; |
Amith Yamasani | 0ac1fc9 | 2013-03-27 18:56:08 -0700 | [diff] [blame] | 394 | restrictedAccountType = source.readString(); |
Amith Yamasani | ccbe389 | 2013-04-12 17:52:42 -0700 | [diff] [blame] | 395 | requiredAccountType = source.readString(); |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 396 | overlayTarget = source.readString(); |
Jaekyun Seok | 0434289 | 2017-03-02 15:24:19 +0900 | [diff] [blame] | 397 | isStaticOverlay = source.readInt() != 0; |
Jaekyun Seok | 42d53f6 | 2017-04-10 13:48:58 +0900 | [diff] [blame] | 398 | overlayPriority = source.readInt(); |
Christopher Tate | b911676 | 2015-09-09 18:46:31 -0700 | [diff] [blame] | 399 | |
| 400 | // The component lists were flattened with the redundant ApplicationInfo |
| 401 | // instances omitted. Distribute the canonical one here as appropriate. |
| 402 | if (applicationInfo != null) { |
| 403 | propagateApplicationInfo(applicationInfo, activities); |
| 404 | propagateApplicationInfo(applicationInfo, receivers); |
| 405 | propagateApplicationInfo(applicationInfo, services); |
| 406 | propagateApplicationInfo(applicationInfo, providers); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | private void propagateApplicationInfo(ApplicationInfo appInfo, ComponentInfo[] components) { |
| 411 | if (components != null) { |
| 412 | for (ComponentInfo ci : components) { |
| 413 | ci.applicationInfo = appInfo; |
| 414 | } |
| 415 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 416 | } |
| 417 | } |