blob: 09a46b8acf4ba211e7b64e2019e8f5524f18dea1 [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
Alan Viveretteb6a25732017-11-21 14:49:24 -050019import android.annotation.Nullable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.os.Parcel;
21import 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 */
27public 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 Sharkey6c833e02014-07-14 22:44:30 -070035 * The names of any installed split APKs for this package.
36 */
37 public String[] splitNames;
38
39 /**
Dianne Hackborn3accca02013-09-20 09:32:11 -070040 * @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 Project9066cfe2009-03-03 19:31:44 -080043 * The version number of this package, as specified by the <manifest>
44 * tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode}
45 * attribute.
Dianne Hackborn3accca02013-09-20 09:32:11 -070046 * @see #getLongVersionCode()
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 */
Dianne Hackborn3accca02013-09-20 09:32:11 -070048 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 public int versionCode;
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -080050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 /**
Dianne Hackborn3accca02013-09-20 09:32:11 -070052 * @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 Project9066cfe2009-03-03 19:31:44 -080090 * The version name of this package, as specified by the &lt;manifest&gt;
91 * tag's {@link android.R.styleable#AndroidManifest_versionName versionName}
92 * attribute.
93 */
94 public String versionName;
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -080095
96 /**
97 * The revision number of the base APK for this package, as specified by the
98 * &lt;manifest&gt; 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 &lt;manifest&gt; 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 Project9066cfe2009-03-03 19:31:44 -0800112 /**
113 * The shared user ID name of this package, as specified by the &lt;manifest&gt;
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 &lt;manifest&gt;
121 * tag's {@link android.R.styleable#AndroidManifest_sharedUserLabel sharedUserLabel}
122 * attribute.
123 */
124 public int sharedUserLabel;
125
126 /**
127 * Information collected from the &lt;application&gt; tag, or null if
128 * there was none.
129 */
130 public ApplicationInfo applicationInfo;
131
132 /**
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700133 * 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 Project9066cfe2009-03-03 19:31:44 -0800145 * 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 * &lt;activity&gt;} tags included under &lt;application&gt;,
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 * &lt;receiver&gt;} tags included under &lt;application&gt;,
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 * &lt;service&gt;} tags included under &lt;application&gt;,
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 * &lt;provider&gt;} tags included under &lt;application&gt;,
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 * &lt;instrumentation&gt;} tags included under &lt;manifest&gt;,
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 Ganov67882122016-12-11 16:36:34 -0800189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190 /**
191 * Array of all {@link android.R.styleable#AndroidManifestPermission
192 * &lt;permission&gt;} tags included under &lt;manifest&gt;,
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 Ganov67882122016-12-11 16:36:34 -0800197
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800198 /**
199 * Array of all {@link android.R.styleable#AndroidManifestUsesPermission
200 * &lt;uses-permission&gt;} tags included under &lt;manifest&gt;,
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 Ganov67882122016-12-11 16:36:34 -0800207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 /**
Dianne Hackborne639da72012-02-21 15:11:13 -0800209 * Array of flags of all {@link android.R.styleable#AndroidManifestUsesPermission
210 * &lt;uses-permission&gt;} tags included under &lt;manifest&gt;,
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
Svetoslavc6d1c342015-02-26 14:44:43 -0800214 * the flag {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate.
Dianne Hackborne639da72012-02-21 15:11:13 -0800215 */
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 Kralevich32eb5b182013-04-11 10:20:09 -0700221 * disable it. Currently all permissions are required.
Svetoslavc6d1c342015-02-26 14:44:43 -0800222 *
223 * @removed We do not support required permissions.
Dianne Hackborne639da72012-02-21 15:11:13 -0800224 */
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 Ganovcdd685c2017-08-22 14:35:04 -0700234 * 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.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800245 *
246 * <strong>Deprecated</strong> This has been replaced by the
247 * {@link PackageInfo#signingCertificateHistory} field, which takes into
248 * account signing certificate rotation. For backwards compatibility in
249 * the event of signing certificate rotation, this will return the oldest
250 * reported signing certificate, so that an application will appear to
251 * callers as though no rotation occurred.
252 *
253 * @deprecated use {@code signingCertificateHistory} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 */
Daniel Cashman5cdda342018-01-19 07:22:52 -0800255 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 public Signature[] signatures;
Daniel Cashman5cdda342018-01-19 07:22:52 -0800257
258 /**
259 * Array of all signatures arrays read from the package file, potentially
260 * including past signing certificates no longer used after signing
261 * certificate rotation. Though signing certificate rotation is only
262 * available for apps with a single signing certificate, this provides an
263 * array of arrays so that packages signed with multiple signing
264 * certificates can still return all signers. This is only filled in if
265 * the flag {@link PackageManager#GET_SIGNING_CERTIFICATES} was set.
266 *
267 * A package must be singed with at least one certificate, which is at
268 * position zero in the array. An application may be signed by multiple
269 * certificates, which would be in the array at position zero in an
270 * indeterminate order. A package may also have a history of certificates
271 * due to signing certificate rotation. In this case, the array will be
272 * populated by a series of single-entry arrays corresponding to a signing
273 * certificate of the package.
274 *
275 * <strong>Note:</strong> Signature ordering is not guaranteed to be
276 * stable which means that a package signed with certificates A and B is
277 * equivalent to being signed with certificates B and A. This means that
278 * in case multiple signatures are reported you cannot assume the one at
279 * the first position will be the same across updates.
280 */
281 public Signature[][] signingCertificateHistory;
282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 /**
284 * Application specified preferred configuration
285 * {@link android.R.styleable#AndroidManifestUsesConfiguration
286 * &lt;uses-configuration&gt;} tags included under &lt;manifest&gt;,
287 * or null if there were none. This is only filled in if the flag
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700288 * {@link PackageManager#GET_CONFIGURATIONS} was set.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 */
290 public ConfigurationInfo[] configPreferences;
291
Dianne Hackborn49237342009-08-27 20:08:01 -0700292 /**
Jeff Sharkeyda96e132014-07-15 14:54:09 -0700293 * Features that this application has requested.
294 *
295 * @see FeatureInfo#FLAG_REQUIRED
Dianne Hackborn49237342009-08-27 20:08:01 -0700296 */
297 public FeatureInfo[] reqFeatures;
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800298
299 /**
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700300 * Groups of features that this application has requested.
301 * Each group contains a set of features that are required.
302 * A device must match the features listed in {@link #reqFeatures} and one
303 * or more FeatureGroups in order to have satisfied the feature requirement.
304 *
305 * @see FeatureInfo#FLAG_REQUIRED
306 */
307 public FeatureGroupInfo[] featureGroups;
308
309 /**
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800310 * Constant corresponding to <code>auto</code> in
311 * the {@link android.R.attr#installLocation} attribute.
312 * @hide
313 */
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700314 public static final int INSTALL_LOCATION_UNSPECIFIED = -1;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700315
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700316 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700317 * Constant corresponding to <code>auto</code> in the
318 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700319 */
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800320 public static final int INSTALL_LOCATION_AUTO = 0;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700321
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800322 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700323 * Constant corresponding to <code>internalOnly</code> in the
324 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800325 */
326 public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700327
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800328 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700329 * Constant corresponding to <code>preferExternal</code> in the
330 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800331 */
332 public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700333
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800334 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700335 * The install location requested by the package. From the
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800336 * {@link android.R.attr#installLocation} attribute, one of
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700337 * {@link #INSTALL_LOCATION_AUTO}, {@link #INSTALL_LOCATION_INTERNAL_ONLY},
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800338 * {@link #INSTALL_LOCATION_PREFER_EXTERNAL}
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800339 */
340 public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800341
342 /** @hide */
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700343 public boolean isStub;
344
345 /** @hide */
Jeff Hao272bf3a2014-10-08 13:34:43 -0700346 public boolean coreApp;
347
348 /** @hide */
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800349 public boolean requiredForAllUsers;
350
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700351 /** @hide */
352 public String restrictedAccountType;
353
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700354 /** @hide */
355 public String requiredAccountType;
356
Mårten Kongstad48d22322014-01-31 14:43:27 +0100357 /**
358 * What package, if any, this package will overlay.
359 *
360 * Package name of target package, or null.
361 * @hide
362 */
363 public String overlayTarget;
364
Jaekyun Seok04342892017-03-02 15:24:19 +0900365 /** @hide */
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900366 public int overlayPriority;
367
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800368 /**
Adam Lesinskie7334972018-01-17 16:13:52 -0800369 * Whether the overlay is static, meaning it cannot be enabled/disabled at runtime.
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800370 */
Adam Lesinskie7334972018-01-17 16:13:52 -0800371 boolean mOverlayIsStatic;
Jaekyun Seok04342892017-03-02 15:24:19 +0900372
Alan Viveretteb6a25732017-11-21 14:49:24 -0500373 /**
374 * The user-visible SDK version (ex. 26) of the framework against which the application claims
375 * to have been compiled, or {@code 0} if not specified.
376 * <p>
377 * This property is the compile-time equivalent of
378 * {@link android.os.Build.VERSION#SDK_INT Build.VERSION.SDK_INT}.
379 *
380 * @hide For platform use only; we don't expect developers to need to read this value.
381 */
382 public int compileSdkVersion;
383
384 /**
385 * The development codename (ex. "O", "REL") of the framework against which the application
386 * claims to have been compiled, or {@code null} if not specified.
387 * <p>
388 * This property is the compile-time equivalent of
389 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.CODENAME}.
390 *
391 * @hide For platform use only; we don't expect developers to need to read this value.
392 */
393 @Nullable
394 public String compileSdkVersionCodename;
395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 public PackageInfo() {
397 }
398
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800399 /**
400 * Returns true if the package is a valid Runtime Overlay package.
401 * @hide
402 */
403 public boolean isOverlayPackage() {
Adam Lesinskie7334972018-01-17 16:13:52 -0800404 return overlayTarget != null;
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800405 }
406
407 /**
408 * Returns true if the package is a valid static Runtime Overlay package. Static overlays
409 * are not updatable outside of a system update and are safe to load in the system process.
410 * @hide
411 */
412 public boolean isStaticOverlayPackage() {
Adam Lesinskie7334972018-01-17 16:13:52 -0800413 return overlayTarget != null && mOverlayIsStatic;
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800414 }
415
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800416 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 public String toString() {
418 return "PackageInfo{"
419 + Integer.toHexString(System.identityHashCode(this))
420 + " " + packageName + "}";
421 }
422
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800423 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 public int describeContents() {
425 return 0;
426 }
427
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800428 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 public void writeToParcel(Parcel dest, int parcelableFlags) {
430 dest.writeString(packageName);
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700431 dest.writeStringArray(splitNames);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 dest.writeInt(versionCode);
Dianne Hackborn3accca02013-09-20 09:32:11 -0700433 dest.writeInt(versionCodeMajor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 dest.writeString(versionName);
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800435 dest.writeInt(baseRevisionCode);
436 dest.writeIntArray(splitRevisionCodes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 dest.writeString(sharedUserId);
438 dest.writeInt(sharedUserLabel);
439 if (applicationInfo != null) {
440 dest.writeInt(1);
441 applicationInfo.writeToParcel(dest, parcelableFlags);
442 } else {
443 dest.writeInt(0);
444 }
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700445 dest.writeLong(firstInstallTime);
446 dest.writeLong(lastUpdateTime);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 dest.writeIntArray(gids);
Christopher Tateb9116762015-09-09 18:46:31 -0700448 dest.writeTypedArray(activities, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
449 dest.writeTypedArray(receivers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
450 dest.writeTypedArray(services, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
451 dest.writeTypedArray(providers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 dest.writeTypedArray(instrumentation, parcelableFlags);
453 dest.writeTypedArray(permissions, parcelableFlags);
454 dest.writeStringArray(requestedPermissions);
Dianne Hackborne639da72012-02-21 15:11:13 -0800455 dest.writeIntArray(requestedPermissionsFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800456 dest.writeTypedArray(signatures, parcelableFlags);
457 dest.writeTypedArray(configPreferences, parcelableFlags);
Dianne Hackborn49237342009-08-27 20:08:01 -0700458 dest.writeTypedArray(reqFeatures, parcelableFlags);
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700459 dest.writeTypedArray(featureGroups, parcelableFlags);
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800460 dest.writeInt(installLocation);
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700461 dest.writeInt(isStub ? 1 : 0);
Jeff Hao272bf3a2014-10-08 13:34:43 -0700462 dest.writeInt(coreApp ? 1 : 0);
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800463 dest.writeInt(requiredForAllUsers ? 1 : 0);
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700464 dest.writeString(restrictedAccountType);
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700465 dest.writeString(requiredAccountType);
Mårten Kongstad48d22322014-01-31 14:43:27 +0100466 dest.writeString(overlayTarget);
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900467 dest.writeInt(overlayPriority);
Adam Lesinskie7334972018-01-17 16:13:52 -0800468 dest.writeBoolean(mOverlayIsStatic);
Alan Viveretteb6a25732017-11-21 14:49:24 -0500469 dest.writeInt(compileSdkVersion);
470 dest.writeString(compileSdkVersionCodename);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 }
472
473 public static final Parcelable.Creator<PackageInfo> CREATOR
474 = new Parcelable.Creator<PackageInfo>() {
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800475 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476 public PackageInfo createFromParcel(Parcel source) {
477 return new PackageInfo(source);
478 }
479
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800480 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 public PackageInfo[] newArray(int size) {
482 return new PackageInfo[size];
483 }
484 };
485
486 private PackageInfo(Parcel source) {
487 packageName = source.readString();
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800488 splitNames = source.createStringArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 versionCode = source.readInt();
Dianne Hackborn3accca02013-09-20 09:32:11 -0700490 versionCodeMajor = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 versionName = source.readString();
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800492 baseRevisionCode = source.readInt();
493 splitRevisionCodes = source.createIntArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 sharedUserId = source.readString();
495 sharedUserLabel = source.readInt();
496 int hasApp = source.readInt();
497 if (hasApp != 0) {
498 applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
499 }
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700500 firstInstallTime = source.readLong();
501 lastUpdateTime = source.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 gids = source.createIntArray();
503 activities = source.createTypedArray(ActivityInfo.CREATOR);
504 receivers = source.createTypedArray(ActivityInfo.CREATOR);
505 services = source.createTypedArray(ServiceInfo.CREATOR);
506 providers = source.createTypedArray(ProviderInfo.CREATOR);
507 instrumentation = source.createTypedArray(InstrumentationInfo.CREATOR);
508 permissions = source.createTypedArray(PermissionInfo.CREATOR);
509 requestedPermissions = source.createStringArray();
Dianne Hackborne639da72012-02-21 15:11:13 -0800510 requestedPermissionsFlags = source.createIntArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 signatures = source.createTypedArray(Signature.CREATOR);
512 configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);
Dianne Hackborn49237342009-08-27 20:08:01 -0700513 reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700514 featureGroups = source.createTypedArray(FeatureGroupInfo.CREATOR);
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800515 installLocation = source.readInt();
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700516 isStub = source.readInt() != 0;
Jeff Hao272bf3a2014-10-08 13:34:43 -0700517 coreApp = source.readInt() != 0;
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800518 requiredForAllUsers = source.readInt() != 0;
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700519 restrictedAccountType = source.readString();
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700520 requiredAccountType = source.readString();
Mårten Kongstad48d22322014-01-31 14:43:27 +0100521 overlayTarget = source.readString();
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900522 overlayPriority = source.readInt();
Adam Lesinskie7334972018-01-17 16:13:52 -0800523 mOverlayIsStatic = source.readBoolean();
Alan Viveretteb6a25732017-11-21 14:49:24 -0500524 compileSdkVersion = source.readInt();
525 compileSdkVersionCodename = source.readString();
Christopher Tateb9116762015-09-09 18:46:31 -0700526
527 // The component lists were flattened with the redundant ApplicationInfo
528 // instances omitted. Distribute the canonical one here as appropriate.
529 if (applicationInfo != null) {
530 propagateApplicationInfo(applicationInfo, activities);
531 propagateApplicationInfo(applicationInfo, receivers);
532 propagateApplicationInfo(applicationInfo, services);
533 propagateApplicationInfo(applicationInfo, providers);
534 }
535 }
536
537 private void propagateApplicationInfo(ApplicationInfo appInfo, ComponentInfo[] components) {
538 if (components != null) {
539 for (ComponentInfo ci : components) {
540 ci.applicationInfo = appInfo;
541 }
542 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 }
544}