blob: d9d17776024355932d82b8b4b01a6904b1b3fc23 [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;
Mathew Inwood1c77a112018-08-14 14:06:26 +010020import android.annotation.UnsupportedAppUsage;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.os.Parcel;
22import android.os.Parcelable;
23
24/**
25 * Overall information about the contents of a package. This corresponds
26 * to all of the information collected from AndroidManifest.xml.
27 */
28public class PackageInfo implements Parcelable {
29 /**
30 * The name of this package. From the <manifest> tag's "name"
31 * attribute.
32 */
33 public String packageName;
34
35 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -070036 * The names of any installed split APKs for this package.
37 */
38 public String[] splitNames;
39
40 /**
Dianne Hackborn3accca02013-09-20 09:32:11 -070041 * @deprecated Use {@link #getLongVersionCode()} instead, which includes both
42 * this and the additional
43 * {@link android.R.styleable#AndroidManifest_versionCodeMajor versionCodeMajor} attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 * The version number of this package, as specified by the <manifest>
45 * tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode}
46 * attribute.
Dianne Hackborn3accca02013-09-20 09:32:11 -070047 * @see #getLongVersionCode()
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048 */
Dianne Hackborn3accca02013-09-20 09:32:11 -070049 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 public int versionCode;
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -080051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 /**
Dianne Hackborn3accca02013-09-20 09:32:11 -070053 * @hide
54 * The major version number of this package, as specified by the <manifest>
55 * tag's {@link android.R.styleable#AndroidManifest_versionCode versionCodeMajor}
56 * attribute.
57 * @see #getLongVersionCode()
58 */
59 public int versionCodeMajor;
60
61 /**
62 * Return {@link android.R.styleable#AndroidManifest_versionCode versionCode} and
63 * {@link android.R.styleable#AndroidManifest_versionCodeMajor versionCodeMajor} combined
64 * together as a single long value. The
65 * {@link android.R.styleable#AndroidManifest_versionCodeMajor versionCodeMajor} is placed in
66 * the upper 32 bits.
67 */
68 public long getLongVersionCode() {
69 return composeLongVersionCode(versionCodeMajor, versionCode);
70 }
71
72 /**
73 * Set the full version code in this PackageInfo, updating {@link #versionCode}
74 * with the lower bits.
75 * @see #getLongVersionCode()
76 */
77 public void setLongVersionCode(long longVersionCode) {
78 versionCodeMajor = (int) (longVersionCode>>32);
79 versionCode = (int) longVersionCode;
80 }
81
82 /**
83 * @hide Internal implementation for composing a minor and major version code in to
84 * a single long version code.
85 */
86 public static long composeLongVersionCode(int major, int minor) {
87 return (((long) major) << 32) | (((long) minor) & 0xffffffffL);
88 }
89
90 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 * The version name of this package, as specified by the &lt;manifest&gt;
92 * tag's {@link android.R.styleable#AndroidManifest_versionName versionName}
93 * attribute.
94 */
95 public String versionName;
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -080096
97 /**
98 * The revision number of the base APK for this package, as specified by the
99 * &lt;manifest&gt; tag's
100 * {@link android.R.styleable#AndroidManifest_revisionCode revisionCode}
101 * attribute.
102 */
103 public int baseRevisionCode;
104
105 /**
106 * The revision number of any split APKs for this package, as specified by
107 * the &lt;manifest&gt; tag's
108 * {@link android.R.styleable#AndroidManifest_revisionCode revisionCode}
109 * attribute. Indexes are a 1:1 mapping against {@link #splitNames}.
110 */
111 public int[] splitRevisionCodes;
112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 /**
114 * The shared user ID name of this package, as specified by the &lt;manifest&gt;
115 * tag's {@link android.R.styleable#AndroidManifest_sharedUserId sharedUserId}
116 * attribute.
117 */
118 public String sharedUserId;
119
120 /**
121 * The shared user ID label of this package, as specified by the &lt;manifest&gt;
122 * tag's {@link android.R.styleable#AndroidManifest_sharedUserLabel sharedUserLabel}
123 * attribute.
124 */
125 public int sharedUserLabel;
126
127 /**
128 * Information collected from the &lt;application&gt; tag, or null if
129 * there was none.
130 */
131 public ApplicationInfo applicationInfo;
132
133 /**
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700134 * The time at which the app was first installed. Units are as
135 * per {@link System#currentTimeMillis()}.
136 */
137 public long firstInstallTime;
138
139 /**
140 * The time at which the app was last updated. Units are as
141 * per {@link System#currentTimeMillis()}.
142 */
143 public long lastUpdateTime;
144
145 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800146 * All kernel group-IDs that have been assigned to this package.
147 * This is only filled in if the flag {@link PackageManager#GET_GIDS} was set.
148 */
149 public int[] gids;
150
151 /**
152 * Array of all {@link android.R.styleable#AndroidManifestActivity
153 * &lt;activity&gt;} tags included under &lt;application&gt;,
154 * or null if there were none. This is only filled in if the flag
155 * {@link PackageManager#GET_ACTIVITIES} was set.
156 */
157 public ActivityInfo[] activities;
158
159 /**
160 * Array of all {@link android.R.styleable#AndroidManifestReceiver
161 * &lt;receiver&gt;} tags included under &lt;application&gt;,
162 * or null if there were none. This is only filled in if the flag
163 * {@link PackageManager#GET_RECEIVERS} was set.
164 */
165 public ActivityInfo[] receivers;
166
167 /**
168 * Array of all {@link android.R.styleable#AndroidManifestService
169 * &lt;service&gt;} tags included under &lt;application&gt;,
170 * or null if there were none. This is only filled in if the flag
171 * {@link PackageManager#GET_SERVICES} was set.
172 */
173 public ServiceInfo[] services;
174
175 /**
176 * Array of all {@link android.R.styleable#AndroidManifestProvider
177 * &lt;provider&gt;} tags included under &lt;application&gt;,
178 * or null if there were none. This is only filled in if the flag
179 * {@link PackageManager#GET_PROVIDERS} was set.
180 */
181 public ProviderInfo[] providers;
182
183 /**
184 * Array of all {@link android.R.styleable#AndroidManifestInstrumentation
185 * &lt;instrumentation&gt;} tags included under &lt;manifest&gt;,
186 * or null if there were none. This is only filled in if the flag
187 * {@link PackageManager#GET_INSTRUMENTATION} was set.
188 */
189 public InstrumentationInfo[] instrumentation;
Svet Ganov67882122016-12-11 16:36:34 -0800190
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800191 /**
192 * Array of all {@link android.R.styleable#AndroidManifestPermission
193 * &lt;permission&gt;} tags included under &lt;manifest&gt;,
194 * or null if there were none. This is only filled in if the flag
195 * {@link PackageManager#GET_PERMISSIONS} was set.
196 */
197 public PermissionInfo[] permissions;
Svet Ganov67882122016-12-11 16:36:34 -0800198
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800199 /**
200 * Array of all {@link android.R.styleable#AndroidManifestUsesPermission
201 * &lt;uses-permission&gt;} tags included under &lt;manifest&gt;,
202 * or null if there were none. This is only filled in if the flag
203 * {@link PackageManager#GET_PERMISSIONS} was set. This list includes
204 * all permissions requested, even those that were not granted or known
205 * by the system at install time.
206 */
207 public String[] requestedPermissions;
Svet Ganov67882122016-12-11 16:36:34 -0800208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800209 /**
Dianne Hackborne639da72012-02-21 15:11:13 -0800210 * Array of flags of all {@link android.R.styleable#AndroidManifestUsesPermission
211 * &lt;uses-permission&gt;} tags included under &lt;manifest&gt;,
212 * or null if there were none. This is only filled in if the flag
213 * {@link PackageManager#GET_PERMISSIONS} was set. Each value matches
214 * the corresponding entry in {@link #requestedPermissions}, and will have
Svetoslavc6d1c342015-02-26 14:44:43 -0800215 * the flag {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate.
Dianne Hackborne639da72012-02-21 15:11:13 -0800216 */
217 public int[] requestedPermissionsFlags;
218
219 /**
220 * Flag for {@link #requestedPermissionsFlags}: the requested permission
221 * is required for the application to run; the user can not optionally
Nick Kralevich32eb5b182013-04-11 10:20:09 -0700222 * disable it. Currently all permissions are required.
Svetoslavc6d1c342015-02-26 14:44:43 -0800223 *
224 * @removed We do not support required permissions.
Dianne Hackborne639da72012-02-21 15:11:13 -0800225 */
226 public static final int REQUESTED_PERMISSION_REQUIRED = 1<<0;
227
228 /**
229 * Flag for {@link #requestedPermissionsFlags}: the requested permission
230 * is currently granted to the application.
231 */
232 public static final int REQUESTED_PERMISSION_GRANTED = 1<<1;
233
234 /**
Svetoslav Ganovcdd685c2017-08-22 14:35:04 -0700235 * Array of all signatures read from the package file. This is only filled
236 * in if the flag {@link PackageManager#GET_SIGNATURES} was set. A package
237 * must be singed with at least one certificate which is at position zero.
238 * The package can be signed with additional certificates which appear as
239 * subsequent entries.
240 *
241 * <strong>Note:</strong> Signature ordering is not guaranteed to be
242 * stable which means that a package signed with certificates A and B is
243 * equivalent to being signed with certificates B and A. This means that
244 * in case multiple signatures are reported you cannot assume the one at
245 * the first position to be the same across updates.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800246 *
247 * <strong>Deprecated</strong> This has been replaced by the
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700248 * {@link PackageInfo#signingInfo} field, which takes into
Daniel Cashman5cdda342018-01-19 07:22:52 -0800249 * account signing certificate rotation. For backwards compatibility in
250 * the event of signing certificate rotation, this will return the oldest
251 * reported signing certificate, so that an application will appear to
252 * callers as though no rotation occurred.
253 *
Dan Cashmane942b912018-04-16 14:41:24 -0700254 * @deprecated use {@code signingInfo} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 */
Daniel Cashman5cdda342018-01-19 07:22:52 -0800256 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 public Signature[] signatures;
Daniel Cashman5cdda342018-01-19 07:22:52 -0800258
259 /**
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700260 * Signing information read from the package file, potentially
Daniel Cashman5cdda342018-01-19 07:22:52 -0800261 * including past signing certificates no longer used after signing
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700262 * certificate rotation. This is only filled in if
Daniel Cashman5cdda342018-01-19 07:22:52 -0800263 * the flag {@link PackageManager#GET_SIGNING_CERTIFICATES} was set.
264 *
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700265 * Use this field instead of the deprecated {@code signatures} field.
266 * See {@link SigningInfo} for more information on its contents.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800267 */
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700268 public SigningInfo signingInfo;
Daniel Cashman5cdda342018-01-19 07:22:52 -0800269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800270 /**
271 * Application specified preferred configuration
272 * {@link android.R.styleable#AndroidManifestUsesConfiguration
273 * &lt;uses-configuration&gt;} tags included under &lt;manifest&gt;,
274 * or null if there were none. This is only filled in if the flag
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700275 * {@link PackageManager#GET_CONFIGURATIONS} was set.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 */
277 public ConfigurationInfo[] configPreferences;
278
Dianne Hackborn49237342009-08-27 20:08:01 -0700279 /**
Jeff Sharkeyda96e132014-07-15 14:54:09 -0700280 * Features that this application has requested.
281 *
282 * @see FeatureInfo#FLAG_REQUIRED
Dianne Hackborn49237342009-08-27 20:08:01 -0700283 */
284 public FeatureInfo[] reqFeatures;
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800285
286 /**
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700287 * Groups of features that this application has requested.
288 * Each group contains a set of features that are required.
289 * A device must match the features listed in {@link #reqFeatures} and one
290 * or more FeatureGroups in order to have satisfied the feature requirement.
291 *
292 * @see FeatureInfo#FLAG_REQUIRED
293 */
294 public FeatureGroupInfo[] featureGroups;
295
296 /**
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800297 * Constant corresponding to <code>auto</code> in
298 * the {@link android.R.attr#installLocation} attribute.
299 * @hide
300 */
Mathew Inwood1c77a112018-08-14 14:06:26 +0100301 @UnsupportedAppUsage
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700302 public static final int INSTALL_LOCATION_UNSPECIFIED = -1;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700303
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700304 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700305 * Constant corresponding to <code>auto</code> in the
306 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu90d8ee62010-03-18 11:38:35 -0700307 */
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800308 public static final int INSTALL_LOCATION_AUTO = 0;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700309
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800310 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700311 * Constant corresponding to <code>internalOnly</code> in the
312 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800313 */
314 public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700315
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800316 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700317 * Constant corresponding to <code>preferExternal</code> in the
318 * {@link android.R.attr#installLocation} attribute.
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800319 */
320 public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700321
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800322 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700323 * The install location requested by the package. From the
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800324 * {@link android.R.attr#installLocation} attribute, one of
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700325 * {@link #INSTALL_LOCATION_AUTO}, {@link #INSTALL_LOCATION_INTERNAL_ONLY},
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800326 * {@link #INSTALL_LOCATION_PREFER_EXTERNAL}
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800327 */
328 public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800329
330 /** @hide */
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700331 public boolean isStub;
332
333 /** @hide */
Mathew Inwood1c77a112018-08-14 14:06:26 +0100334 @UnsupportedAppUsage
Jeff Hao272bf3a2014-10-08 13:34:43 -0700335 public boolean coreApp;
336
337 /** @hide */
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800338 public boolean requiredForAllUsers;
339
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700340 /** @hide */
341 public String restrictedAccountType;
342
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700343 /** @hide */
344 public String requiredAccountType;
345
Mårten Kongstad48d22322014-01-31 14:43:27 +0100346 /**
347 * What package, if any, this package will overlay.
348 *
349 * Package name of target package, or null.
350 * @hide
351 */
Mathew Inwood1c77a112018-08-14 14:06:26 +0100352 @UnsupportedAppUsage
Mårten Kongstad48d22322014-01-31 14:43:27 +0100353 public String overlayTarget;
354
Adrian Roosc84df772018-01-19 21:20:22 +0100355 /**
356 * The overlay category, if any, of this package
357 *
358 * @hide
359 */
360 public String overlayCategory;
361
Jaekyun Seok04342892017-03-02 15:24:19 +0900362 /** @hide */
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900363 public int overlayPriority;
364
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800365 /**
Adam Lesinskie7334972018-01-17 16:13:52 -0800366 * Whether the overlay is static, meaning it cannot be enabled/disabled at runtime.
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800367 */
Adam Lesinskie7334972018-01-17 16:13:52 -0800368 boolean mOverlayIsStatic;
Jaekyun Seok04342892017-03-02 15:24:19 +0900369
Alan Viveretteb6a25732017-11-21 14:49:24 -0500370 /**
371 * The user-visible SDK version (ex. 26) of the framework against which the application claims
372 * to have been compiled, or {@code 0} if not specified.
373 * <p>
374 * This property is the compile-time equivalent of
375 * {@link android.os.Build.VERSION#SDK_INT Build.VERSION.SDK_INT}.
376 *
377 * @hide For platform use only; we don't expect developers to need to read this value.
378 */
379 public int compileSdkVersion;
380
381 /**
382 * The development codename (ex. "O", "REL") of the framework against which the application
383 * claims to have been compiled, or {@code null} if not specified.
384 * <p>
385 * This property is the compile-time equivalent of
386 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.CODENAME}.
387 *
388 * @hide For platform use only; we don't expect developers to need to read this value.
389 */
390 @Nullable
391 public String compileSdkVersionCodename;
392
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 public PackageInfo() {
394 }
395
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800396 /**
397 * Returns true if the package is a valid Runtime Overlay package.
398 * @hide
399 */
400 public boolean isOverlayPackage() {
Adam Lesinskie7334972018-01-17 16:13:52 -0800401 return overlayTarget != null;
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800402 }
403
404 /**
405 * Returns true if the package is a valid static Runtime Overlay package. Static overlays
406 * are not updatable outside of a system update and are safe to load in the system process.
407 * @hide
408 */
409 public boolean isStaticOverlayPackage() {
Adam Lesinskie7334972018-01-17 16:13:52 -0800410 return overlayTarget != null && mOverlayIsStatic;
Adam Lesinskiab56b9d2017-11-14 00:50:18 -0800411 }
412
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800413 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 public String toString() {
415 return "PackageInfo{"
416 + Integer.toHexString(System.identityHashCode(this))
417 + " " + packageName + "}";
418 }
419
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800420 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 public int describeContents() {
422 return 0;
423 }
424
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800425 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800426 public void writeToParcel(Parcel dest, int parcelableFlags) {
427 dest.writeString(packageName);
Jeff Sharkey6c833e02014-07-14 22:44:30 -0700428 dest.writeStringArray(splitNames);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 dest.writeInt(versionCode);
Dianne Hackborn3accca02013-09-20 09:32:11 -0700430 dest.writeInt(versionCodeMajor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 dest.writeString(versionName);
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800432 dest.writeInt(baseRevisionCode);
433 dest.writeIntArray(splitRevisionCodes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 dest.writeString(sharedUserId);
435 dest.writeInt(sharedUserLabel);
436 if (applicationInfo != null) {
437 dest.writeInt(1);
438 applicationInfo.writeToParcel(dest, parcelableFlags);
439 } else {
440 dest.writeInt(0);
441 }
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700442 dest.writeLong(firstInstallTime);
443 dest.writeLong(lastUpdateTime);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 dest.writeIntArray(gids);
Christopher Tateb9116762015-09-09 18:46:31 -0700445 dest.writeTypedArray(activities, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
446 dest.writeTypedArray(receivers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
447 dest.writeTypedArray(services, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
448 dest.writeTypedArray(providers, parcelableFlags | Parcelable.PARCELABLE_ELIDE_DUPLICATES);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 dest.writeTypedArray(instrumentation, parcelableFlags);
450 dest.writeTypedArray(permissions, parcelableFlags);
451 dest.writeStringArray(requestedPermissions);
Dianne Hackborne639da72012-02-21 15:11:13 -0800452 dest.writeIntArray(requestedPermissionsFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 dest.writeTypedArray(signatures, parcelableFlags);
454 dest.writeTypedArray(configPreferences, parcelableFlags);
Dianne Hackborn49237342009-08-27 20:08:01 -0700455 dest.writeTypedArray(reqFeatures, parcelableFlags);
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700456 dest.writeTypedArray(featureGroups, parcelableFlags);
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800457 dest.writeInt(installLocation);
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700458 dest.writeInt(isStub ? 1 : 0);
Jeff Hao272bf3a2014-10-08 13:34:43 -0700459 dest.writeInt(coreApp ? 1 : 0);
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800460 dest.writeInt(requiredForAllUsers ? 1 : 0);
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700461 dest.writeString(restrictedAccountType);
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700462 dest.writeString(requiredAccountType);
Mårten Kongstad48d22322014-01-31 14:43:27 +0100463 dest.writeString(overlayTarget);
Adrian Roosc84df772018-01-19 21:20:22 +0100464 dest.writeString(overlayCategory);
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900465 dest.writeInt(overlayPriority);
Adam Lesinskie7334972018-01-17 16:13:52 -0800466 dest.writeBoolean(mOverlayIsStatic);
Alan Viveretteb6a25732017-11-21 14:49:24 -0500467 dest.writeInt(compileSdkVersion);
468 dest.writeString(compileSdkVersionCodename);
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700469 if (signingInfo != null) {
470 dest.writeInt(1);
471 signingInfo.writeToParcel(dest, parcelableFlags);
Dan Cashman050b7992018-02-06 17:08:58 -0800472 } else {
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700473 dest.writeInt(0);
Dan Cashman050b7992018-02-06 17:08:58 -0800474 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 }
476
477 public static final Parcelable.Creator<PackageInfo> CREATOR
478 = new Parcelable.Creator<PackageInfo>() {
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800479 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800480 public PackageInfo createFromParcel(Parcel source) {
481 return new PackageInfo(source);
482 }
483
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800484 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 public PackageInfo[] newArray(int size) {
486 return new PackageInfo[size];
487 }
488 };
489
Mathew Inwood1c77a112018-08-14 14:06:26 +0100490 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 private PackageInfo(Parcel source) {
492 packageName = source.readString();
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800493 splitNames = source.createStringArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 versionCode = source.readInt();
Dianne Hackborn3accca02013-09-20 09:32:11 -0700495 versionCodeMajor = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 versionName = source.readString();
Jeff Sharkey88d2a3c2014-11-22 16:49:34 -0800497 baseRevisionCode = source.readInt();
498 splitRevisionCodes = source.createIntArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 sharedUserId = source.readString();
500 sharedUserLabel = source.readInt();
501 int hasApp = source.readInt();
502 if (hasApp != 0) {
503 applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
504 }
Dianne Hackborn78d6883692010-10-07 01:12:46 -0700505 firstInstallTime = source.readLong();
506 lastUpdateTime = source.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800507 gids = source.createIntArray();
508 activities = source.createTypedArray(ActivityInfo.CREATOR);
509 receivers = source.createTypedArray(ActivityInfo.CREATOR);
510 services = source.createTypedArray(ServiceInfo.CREATOR);
511 providers = source.createTypedArray(ProviderInfo.CREATOR);
512 instrumentation = source.createTypedArray(InstrumentationInfo.CREATOR);
513 permissions = source.createTypedArray(PermissionInfo.CREATOR);
514 requestedPermissions = source.createStringArray();
Dianne Hackborne639da72012-02-21 15:11:13 -0800515 requestedPermissionsFlags = source.createIntArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 signatures = source.createTypedArray(Signature.CREATOR);
517 configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);
Dianne Hackborn49237342009-08-27 20:08:01 -0700518 reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700519 featureGroups = source.createTypedArray(FeatureGroupInfo.CREATOR);
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800520 installLocation = source.readInt();
Todd Kennedy7c8addf2017-06-27 14:13:55 -0700521 isStub = source.readInt() != 0;
Jeff Hao272bf3a2014-10-08 13:34:43 -0700522 coreApp = source.readInt() != 0;
Amith Yamasanidf2e92a2013-03-01 17:04:38 -0800523 requiredForAllUsers = source.readInt() != 0;
Amith Yamasani0ac1fc92013-03-27 18:56:08 -0700524 restrictedAccountType = source.readString();
Amith Yamasaniccbe3892013-04-12 17:52:42 -0700525 requiredAccountType = source.readString();
Mårten Kongstad48d22322014-01-31 14:43:27 +0100526 overlayTarget = source.readString();
Adrian Roosc84df772018-01-19 21:20:22 +0100527 overlayCategory = source.readString();
Jaekyun Seok42d53f62017-04-10 13:48:58 +0900528 overlayPriority = source.readInt();
Adam Lesinskie7334972018-01-17 16:13:52 -0800529 mOverlayIsStatic = source.readBoolean();
Alan Viveretteb6a25732017-11-21 14:49:24 -0500530 compileSdkVersion = source.readInt();
531 compileSdkVersionCodename = source.readString();
Dan Cashman5c9f527e2018-04-03 16:42:23 -0700532 int hasSigningInfo = source.readInt();
533 if (hasSigningInfo != 0) {
534 signingInfo = SigningInfo.CREATOR.createFromParcel(source);
535 }
Christopher Tateb9116762015-09-09 18:46:31 -0700536
537 // The component lists were flattened with the redundant ApplicationInfo
538 // instances omitted. Distribute the canonical one here as appropriate.
539 if (applicationInfo != null) {
540 propagateApplicationInfo(applicationInfo, activities);
541 propagateApplicationInfo(applicationInfo, receivers);
542 propagateApplicationInfo(applicationInfo, services);
543 propagateApplicationInfo(applicationInfo, providers);
544 }
545 }
546
547 private void propagateApplicationInfo(ApplicationInfo appInfo, ComponentInfo[] components) {
548 if (components != null) {
549 for (ComponentInfo ci : components) {
550 ci.applicationInfo = appInfo;
551 }
552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 }
554}