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