blob: 706cbbf560c5dafc838d6d16ea4930b4ae46e2d4 [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
Jeff Sharkey9bc89af2017-01-11 11:25:50 -070019import static android.os.Build.VERSION_CODES.DONUT;
20
21import android.annotation.IntDef;
Alan Viveretteb6a25732017-11-21 14:49:24 -050022import android.annotation.Nullable;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060023import android.annotation.SystemApi;
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -070024import android.annotation.TestApi;
Mathew Inwood5c0d3542018-08-14 13:54:31 +010025import android.annotation.UnsupportedAppUsage;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060026import android.content.Context;
Jeff Brown07330792010-03-30 19:57:08 -070027import android.content.pm.PackageManager.NameNotFoundException;
28import android.content.res.Resources;
29import android.graphics.drawable.Drawable;
Mathew Inwood31755f92018-12-20 13:53:36 +000030import android.os.Build;
Jeff Sharkey15447792015-11-05 16:18:51 -080031import android.os.Environment;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.os.Parcel;
33import android.os.Parcelable;
Jeff Sharkey15447792015-11-05 16:18:51 -080034import android.os.UserHandle;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -060035import android.os.storage.StorageManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.util.Printer;
Adam Lesinski1665d0f2017-03-10 14:46:57 -080037import android.util.SparseArray;
Yi Jin148d7f42017-11-28 14:23:56 -080038import android.util.proto.ProtoOutputStream;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070040import com.android.internal.util.ArrayUtils;
Mathew Inwood4693a752018-02-20 16:04:25 +000041import com.android.server.SystemConfig;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070042
Jeff Sharkey9bc89af2017-01-11 11:25:50 -070043import java.lang.annotation.Retention;
44import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import java.text.Collator;
Torne (Richard Coles)1aaae102019-03-01 15:02:29 -050046import java.util.ArrayList;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070047import java.util.Arrays;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import java.util.Comparator;
Nicolas Geoffray8d144eb2018-11-15 12:59:52 +000049import java.util.List;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070050import java.util.Objects;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -060051import java.util.UUID;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
53/**
54 * Information you can retrieve about a particular application. This
55 * corresponds to information collected from the AndroidManifest.xml's
56 * <application> tag.
57 */
58public class ApplicationInfo extends PackageItemInfo implements Parcelable {
59
60 /**
61 * Default task affinity of all activities in this application. See
62 * {@link ActivityInfo#taskAffinity} for more information. This comes
63 * from the "taskAffinity" attribute.
64 */
65 public String taskAffinity;
66
67 /**
68 * Optional name of a permission required to be able to access this
69 * application's components. From the "permission" attribute.
70 */
71 public String permission;
72
73 /**
74 * The name of the process this application should run in. From the
75 * "process" attribute or, if not set, the same as
76 * <var>packageName</var>.
77 */
78 public String processName;
79
80 /**
81 * Class implementing the Application object. From the "class"
82 * attribute.
83 */
84 public String className;
85
86 /**
87 * A style resource identifier (in the package's resources) of the
88 * description of an application. From the "description" attribute
89 * or, if not set, 0.
90 */
91 public int descriptionRes;
92
93 /**
94 * A style resource identifier (in the package's resources) of the
95 * default visual theme of the application. From the "theme" attribute
96 * or, if not set, 0.
97 */
98 public int theme;
99
100 /**
101 * Class implementing the Application's manage space
102 * functionality. From the "manageSpaceActivity"
103 * attribute. This is an optional attribute and will be null if
Christopher Tate181fafa2009-05-14 11:12:14 -0700104 * applications don't specify it in their manifest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 */
106 public String manageSpaceActivityName;
107
108 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700109 * Class implementing the Application's backup functionality. From
110 * the "backupAgent" attribute. This is an optional attribute and
111 * will be null if the application does not specify it in its manifest.
112 *
113 * <p>If android:allowBackup is set to false, this attribute is ignored.
Christopher Tate181fafa2009-05-14 11:12:14 -0700114 */
115 public String backupAgentName;
Christopher Tate4a627c72011-04-01 14:43:32 -0700116
117 /**
Matthew Williams303650c2015-04-17 18:22:51 -0700118 * An optional attribute that indicates the app supports automatic backup of app data.
119 * <p>0 is the default and means the app's entire data folder + managed external storage will
120 * be backed up;
121 * Any negative value indicates the app does not support full-data backup, though it may still
122 * want to participate via the traditional key/value backup API;
123 * A positive number specifies an xml resource in which the application has defined its backup
124 * include/exclude criteria.
125 * <p>If android:allowBackup is set to false, this attribute is ignored.
126 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600127 * @see android.content.Context#getNoBackupFilesDir()
128 * @see #FLAG_ALLOW_BACKUP
Christopher Tate98fa6562015-05-14 13:20:10 -0700129 *
130 * @hide
Matthew Williams303650c2015-04-17 18:22:51 -0700131 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100132 @UnsupportedAppUsage
Matthew Williams303650c2015-04-17 18:22:51 -0700133 public int fullBackupContent = 0;
134
135 /**
Adam Powell269248d2011-08-02 10:26:54 -0700136 * The default extra UI options for activities in this application.
137 * Set from the {@link android.R.attr#uiOptions} attribute in the
138 * activity's manifest.
139 */
140 public int uiOptions = 0;
141
142 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 * Value for {@link #flags}: if set, this application is installed in the
144 * device's system image.
145 */
146 public static final int FLAG_SYSTEM = 1<<0;
147
148 /**
149 * Value for {@link #flags}: set to true if this application would like to
150 * allow debugging of its
151 * code, even when installed on a non-development system. Comes
152 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
153 * android:debuggable} of the &lt;application&gt; tag.
154 */
155 public static final int FLAG_DEBUGGABLE = 1<<1;
156
157 /**
158 * Value for {@link #flags}: set to true if this application has code
159 * associated with it. Comes
160 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
161 * android:hasCode} of the &lt;application&gt; tag.
162 */
163 public static final int FLAG_HAS_CODE = 1<<2;
164
165 /**
166 * Value for {@link #flags}: set to true if this application is persistent.
167 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
168 * android:persistent} of the &lt;application&gt; tag.
169 */
170 public static final int FLAG_PERSISTENT = 1<<3;
171
172 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700173 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
175 * device is running in factory test mode.
176 */
177 public static final int FLAG_FACTORY_TEST = 1<<4;
178
179 /**
180 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
181 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
182 * android:allowTaskReparenting} of the &lt;application&gt; tag.
183 */
184 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
185
186 /**
187 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
188 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
189 * android:allowClearUserData} of the &lt;application&gt; tag.
190 */
191 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
192
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800193 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700194 * Value for {@link #flags}: this is set if this application has been
Kweku Adams8de29ca2016-01-22 12:30:26 -0800195 * installed as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196 */
197 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700198
199 /**
Svet Ganov354cd3c2015-12-17 11:35:04 -0800200 * Value for {@link #flags}: this is set if the application has specified
Dianne Hackborn7f205432009-07-28 00:13:47 -0700201 * {@link android.R.styleable#AndroidManifestApplication_testOnly
202 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700203 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700204 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700205
206 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700207 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700208 * reduced in size for smaller screens. Corresponds to
209 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
210 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700211 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700212 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
213
214 /**
215 * Value for {@link #flags}: true when the application's window can be
216 * displayed on normal screens. Corresponds to
217 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
218 * android:normalScreens}.
219 */
220 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
221
222 /**
223 * Value for {@link #flags}: true when the application's window can be
224 * increased in size for larger screens. Corresponds to
225 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700226 * android:largeScreens}.
Dianne Hackborn723738c2009-06-25 19:48:04 -0700227 */
228 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700229
230 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700231 * Value for {@link #flags}: true when the application knows how to adjust
232 * its UI for different screen sizes. Corresponds to
233 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
234 * android:resizeable}.
235 */
236 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
237
238 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700239 * Value for {@link #flags}: true when the application knows how to
kopriva219f7dc2018-10-09 13:42:28 -0700240 * accommodate different screen densities. Corresponds to
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700241 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
242 * android:anyDensity}.
243 */
244 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
245
246 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800247 * Value for {@link #flags}: set to true if this application would like to
248 * request the VM to operate under the safe mode. Comes from
Ben Chengef3f5dd2010-03-29 15:47:26 -0700249 * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode
250 * android:vmSafeMode} of the &lt;application&gt; tag.
Ben Cheng23085b72010-02-08 16:06:32 -0800251 */
252 public static final int FLAG_VM_SAFE_MODE = 1<<14;
253
254 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800255 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
256 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700257 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800258 * <p>Comes from the
259 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
260 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700261 */
Ben Cheng23085b72010-02-08 16:06:32 -0800262 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700263
264 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800265 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
266 * in memory following a full-system restore operation; <code>true</code> otherwise.
267 * Ordinarily, during a full system restore operation each application is shut down
268 * following execution of its agent's onRestore() method. Setting this attribute to
269 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700270 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800271 * <p>If
272 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
273 * is set to <code>false</code> or no
274 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700275 * is specified, this flag will be ignored.
276 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800277 * <p>Comes from the
278 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
279 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700280 */
Ben Cheng23085b72010-02-08 16:06:32 -0800281 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700282
283 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800284 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
285 * agent claims to be able to handle restore data even "from the future,"
286 * i.e. from versions of the application with a versionCode greater than
287 * the one currently installed on the device. <i>Use with caution!</i> By default
288 * this attribute is <code>false</code> and the Backup Manager will ensure that data
289 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700290 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800291 * <p>If
292 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
293 * is set to <code>false</code> or no
294 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700295 * is specified, this flag will be ignored.
296 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800297 * <p>Comes from the
298 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
299 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700300 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800301 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700302
Christopher Tate181fafa2009-05-14 11:12:14 -0700303 /**
Dianne Hackborn3202d382010-04-26 17:51:34 -0700304 * Value for {@link #flags}: Set to true if the application is
305 * currently installed on external/removable/unprotected storage. Such
306 * applications may not be available if their storage is not currently
307 * mounted. When the storage it is on is not available, it will look like
308 * the application has been uninstalled (its .apk is no longer available)
309 * but its persistent data is not removed.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800310 */
Dianne Hackborn94c567e2010-04-26 18:13:10 -0700311 public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800312
313 /**
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700314 * Value for {@link #flags}: true when the application's window can be
315 * increased in size for extra large screens. Corresponds to
316 * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700317 * android:xlargeScreens}.
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700318 */
319 public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
320
321 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800322 * Value for {@link #flags}: true when the application has requested a
323 * large heap for its processes. Corresponds to
324 * {@link android.R.styleable#AndroidManifestApplication_largeHeap
325 * android:largeHeap}.
Jason parksa3cdaa52011-01-13 14:15:43 -0600326 */
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800327 public static final int FLAG_LARGE_HEAP = 1<<20;
Jason parksa3cdaa52011-01-13 14:15:43 -0600328
329 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800330 * Value for {@link #flags}: true if this application's package is in
331 * the stopped state.
332 */
333 public static final int FLAG_STOPPED = 1<<21;
334
335 /**
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700336 * Value for {@link #flags}: true when the application is willing to support
337 * RTL (right to left). All activities will inherit this value.
338 *
339 * Set from the {@link android.R.attr#supportsRtl} attribute in the
340 * activity's manifest.
341 *
342 * Default value is false (no support for RTL).
343 */
344 public static final int FLAG_SUPPORTS_RTL = 1<<22;
345
346 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700347 * Value for {@link #flags}: true if the application is currently
348 * installed for the calling user.
349 */
350 public static final int FLAG_INSTALLED = 1<<23;
351
352 /**
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700353 * Value for {@link #flags}: true if the application only has its
354 * data installed; the application package itself does not currently
355 * exist on the device.
356 */
357 public static final int FLAG_IS_DATA_ONLY = 1<<24;
358
359 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700360 * Value for {@link #flags}: true if the application was declared to be a
361 * game, or false if it is a non-game application.
362 *
363 * @deprecated use {@link #CATEGORY_GAME} instead.
Jose Lima12d0b4c2014-03-14 16:55:12 -0700364 */
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700365 @Deprecated
Jose Lima12d0b4c2014-03-14 16:55:12 -0700366 public static final int FLAG_IS_GAME = 1<<25;
367
368 /**
Christopher Tated1de2562014-06-17 17:12:35 -0700369 * Value for {@link #flags}: {@code true} if the application asks that only
370 * full-data streaming backups of its data be performed even though it defines
371 * a {@link android.app.backup.BackupAgent BackupAgent}, which normally
372 * indicates that the app will manage its backed-up data via incremental
373 * key/value updates.
374 */
375 public static final int FLAG_FULL_BACKUP_ONLY = 1<<26;
376
377 /**
Alex Klyubin01a959d2015-03-18 10:05:45 -0700378 * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic
379 * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
380 * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
381 * cleartext network traffic, in which case platform components (e.g., HTTP stacks,
Alex Klyubinfbf45992015-04-21 13:44:29 -0700382 * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext
383 * traffic. Third-party libraries are encouraged to honor this flag as well.
384 *
Nate Fischer6a2a5412017-10-23 18:02:41 -0700385 * <p>NOTE: {@code WebView} honors this flag for applications targeting API level 26 and up.
Alex Klyubinfbf45992015-04-21 13:44:29 -0700386 *
Chad Brubaker2df5ba72016-04-11 13:31:24 -0700387 * <p>This flag is ignored on Android N and above if an Android Network Security Config is
388 * present.
389 *
Alex Klyubinfbf45992015-04-21 13:44:29 -0700390 * <p>This flag comes from
391 * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic
392 * android:usesCleartextTraffic} of the &lt;application&gt; tag.
Alex Klyubin01a959d2015-03-18 10:05:45 -0700393 */
394 public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
395
396 /**
Dmitriy Ivanovff193d62014-09-30 15:10:48 -0700397 * When set installer extracts native libs from .apk files.
398 */
399 public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
400
401 /**
Alan Viveretted70b9e72015-05-27 14:29:20 -0700402 * Value for {@link #flags}: {@code true} when the application's rendering
403 * should be hardware accelerated.
404 */
405 public static final int FLAG_HARDWARE_ACCELERATED = 1<<29;
406
407 /**
Andrei Stingaceanu1e283912015-11-26 15:26:28 +0000408 * Value for {@link #flags}: true if this application's package is in
409 * the suspended state.
410 */
411 public static final int FLAG_SUSPENDED = 1<<30;
412
413 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100414 * Value for {@link #flags}: true if code from this application will need to be
415 * loaded into other applications' processes. On devices that support multiple
416 * instruction sets, this implies the code might be loaded into a process that's
417 * using any of the devices supported instruction sets.
418 *
419 * <p> The system might treat such applications specially, for eg., by
420 * extracting the application's native libraries for all supported instruction
421 * sets or by compiling the application's dex code for all supported instruction
422 * sets.
423 */
424 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700425
426 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 * Flags associated with the application. Any combination of
428 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
429 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
430 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700431 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700432 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
433 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700434 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
435 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700436 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800437 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
438 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
439 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
440 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
441 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
Alex Klyubin7cb000f2015-03-26 11:00:04 -0700442 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC},
443 * {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 */
445 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800448 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
449 * most purposes is considered as not installed.
450 * {@hide}
451 */
452 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
453
454 /**
455 * Value for {@link #privateFlags}: set to <code>true</code> if the application
456 * has reported that it is heavy-weight, and thus can not participate in
457 * the normal application lifecycle.
458 *
459 * <p>Comes from the
460 * android.R.styleable#AndroidManifestApplication_cantSaveState
461 * attribute of the &lt;application&gt; tag.
462 *
463 * {@hide}
464 */
465 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
466
467 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800468 * Value for {@link #privateFlags}: set to {@code true} if the application
469 * is permitted to hold privileged permissions.
470 *
471 * {@hide}
472 */
Jeff Sharkeyc6091162018-06-29 17:15:40 -0600473 @TestApi
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800474 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
475
476 /**
Svet Ganov2acf0632015-11-24 19:10:59 -0800477 * Value for {@link #privateFlags}: {@code true} if the application has any IntentFiler
478 * with some data URI using HTTP or HTTPS with an associated VIEW action.
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700479 *
480 * {@hide}
481 */
482 public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
483
484 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600485 * When set, the default data storage directory for this app is pointed at
486 * the device-protected location.
Jeff Sharkey15447792015-11-05 16:18:51 -0800487 *
488 * @hide
489 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600490 public static final int PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = 1 << 5;
Jeff Sharkey15447792015-11-05 16:18:51 -0800491
492 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600493 * When set, assume that all components under the given app are direct boot
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -0800494 * aware, unless otherwise specified.
495 *
496 * @hide
497 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600498 public static final int PRIVATE_FLAG_DIRECT_BOOT_AWARE = 1 << 6;
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -0800499
500 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -0800501 * Value for {@link #privateFlags}: {@code true} if the application is installed
502 * as instant app.
503 *
504 * @hide
Chad Brubaker4389c232016-11-04 14:50:50 -0700505 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800506 public static final int PRIVATE_FLAG_INSTANT = 1 << 7;
Chad Brubaker4389c232016-11-04 14:50:50 -0700507
508 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600509 * When set, at least one component inside this application is direct boot
510 * aware.
Jeff Sharkey8924e872015-11-30 12:52:10 -0700511 *
512 * @hide
513 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600514 public static final int PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE = 1 << 8;
Jeff Sharkey8924e872015-11-30 12:52:10 -0700515
Fyodor Kupolovf99104d2015-12-14 11:31:29 -0800516
517 /**
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -0800518 * When set, signals that the application is required for the system user and should not be
519 * uninstalled.
520 *
521 * @hide
522 */
Chad Brubaker4389c232016-11-04 14:50:50 -0700523 public static final int PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER = 1 << 9;
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -0800524
525 /**
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700526 * When set, the application explicitly requested that its activities be resizeable by default.
Wale Ogunwale6afdf912016-01-30 13:01:33 -0800527 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
528 *
529 * @hide
530 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700531 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE = 1 << 10;
532
533 /**
534 * When set, the application explicitly requested that its activities *not* be resizeable by
535 * default.
536 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
537 *
538 * @hide
539 */
540 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE = 1 << 11;
Wale Ogunwale72a73e32016-10-13 12:16:39 -0700541
542 /**
543 * The application isn't requesting explicitly requesting for its activities to be resizeable or
544 * non-resizeable by default. So, we are making it activities resizeable by default based on the
545 * target SDK version of the app.
546 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
547 *
548 * NOTE: This only affects apps with target SDK >= N where the resizeableActivity attribute was
549 * introduced. It shouldn't be confused with {@link ActivityInfo#RESIZE_MODE_FORCE_RESIZEABLE}
550 * where certain pre-N apps are forced to the resizeable.
551 *
552 * @hide
553 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700554 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION =
555 1 << 12;
Wale Ogunwale6afdf912016-01-30 13:01:33 -0800556
557 /**
Christopher Tate43fbc5f2016-02-17 18:00:48 -0800558 * Value for {@link #privateFlags}: {@code true} means the OS should go ahead and
559 * run full-data backup operations for the app even when it is in a
560 * foreground-equivalent run state. Defaults to {@code false} if unspecified.
561 * @hide
562 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700563 public static final int PRIVATE_FLAG_BACKUP_IN_FOREGROUND = 1 << 13;
Christopher Tate43fbc5f2016-02-17 18:00:48 -0800564
565 /**
Svet Ganov67882122016-12-11 16:36:34 -0800566 * Value for {@link #privateFlags}: {@code true} means this application
567 * contains a static shared library. Defaults to {@code false} if unspecified.
568 * @hide
569 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700570 public static final int PRIVATE_FLAG_STATIC_SHARED_LIBRARY = 1 << 14;
Svet Ganov67882122016-12-11 16:36:34 -0800571
572 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700573 * Value for {@link #privateFlags}: When set, the application will only have its splits loaded
Adam Lesinski4e862812016-11-21 16:02:24 -0800574 * if they are required to load a component. Splits can be loaded on demand using the
575 * {@link Context#createContextForSplit(String)} API.
576 * @hide
577 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700578 public static final int PRIVATE_FLAG_ISOLATED_SPLIT_LOADING = 1 << 15;
Adam Lesinski4e862812016-11-21 16:02:24 -0800579
580 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700581 * Value for {@link #privateFlags}: When set, the application was installed as
582 * a virtual preload.
583 * @hide
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800584 */
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700585 public static final int PRIVATE_FLAG_VIRTUAL_PRELOAD = 1 << 16;
586
Svet Ganov087dce22017-09-07 15:42:16 -0700587 /**
Mathew Inwood9d895432018-04-04 16:08:21 +0100588 * Value for {@link #privateFlags}: whether this app is pre-installed on the
Svet Ganov087dce22017-09-07 15:42:16 -0700589 * OEM partition of the system image.
590 * @hide
591 */
592 public static final int PRIVATE_FLAG_OEM = 1 << 17;
593
Jiyong Park002fdbd2017-02-13 20:50:31 +0900594 /**
Mathew Inwood9d895432018-04-04 16:08:21 +0100595 * Value for {@link #privateFlags}: whether this app is pre-installed on the
Jiyong Park002fdbd2017-02-13 20:50:31 +0900596 * vendor partition of the system image.
597 * @hide
598 */
599 public static final int PRIVATE_FLAG_VENDOR = 1 << 18;
600
Jaekyun Seok1713d9e2018-01-12 21:47:26 +0900601 /**
Mathew Inwood9d895432018-04-04 16:08:21 +0100602 * Value for {@link #privateFlags}: whether this app is pre-installed on the
Jaekyun Seok1713d9e2018-01-12 21:47:26 +0900603 * product partition of the system image.
604 * @hide
605 */
606 public static final int PRIVATE_FLAG_PRODUCT = 1 << 19;
607
Mathew Inwood9d895432018-04-04 16:08:21 +0100608 /**
David Brazdila5b4df22018-09-06 09:49:14 +0100609 * Value for {@link #privateFlags}: whether this app is signed with the
610 * platform key.
611 * @hide
612 */
613 public static final int PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY = 1 << 20;
614
615 /**
Dario Freni2bef1762018-06-01 14:02:08 +0100616 * Value for {@link #privateFlags}: whether this app is pre-installed on the
617 * google partition of the system image.
618 * @hide
619 */
620 public static final int PRIVATE_FLAG_PRODUCT_SERVICES = 1 << 21;
621
622 /**
David Brazdila5b4df22018-09-06 09:49:14 +0100623 * Indicates whether this package requires access to non-SDK APIs.
624 * Only system apps and tests are allowed to use this property.
Mathew Inwood9d895432018-04-04 16:08:21 +0100625 * @hide
626 */
David Brazdila5b4df22018-09-06 09:49:14 +0100627 public static final int PRIVATE_FLAG_USES_NON_SDK_API = 1 << 22;
Mathew Inwood9d895432018-04-04 16:08:21 +0100628
Chris Craikce030282018-10-16 14:33:11 -0700629 /**
630 * Indicates whether this application can be profiled by the shell user,
631 * even when running on a device that is running in user mode.
632 * @hide
633 */
634 public static final int PRIVATE_FLAG_PROFILEABLE_BY_SHELL = 1 << 23;
635
Philip P. Moltmannae4a4b92018-12-12 11:28:57 -0800636 /**
637 * Indicates whether this package requires access to non-SDK APIs.
638 * Only system apps and tests are allowed to use this property.
639 * @hide
640 */
641 public static final int PRIVATE_FLAG_HAS_FRAGILE_USER_DATA = 1 << 24;
642
Victor Hsiehe7b5a8d2018-11-16 10:27:06 -0800643 /**
Victor Hsiehfa9df0b2019-01-29 12:48:36 -0800644 * Indicates whether this application wants to use the embedded dex in the APK, rather than
645 * extracted or locally compiled variants. This keeps the dex code protected by the APK
646 * signature. Such apps will always run in JIT mode (same when they are first installed), and
647 * the system will never generate ahead-of-time compiled code for them. Depending on the app's
648 * workload, there may be some run time performance change, noteably the cold start time.
Victor Hsiehe7b5a8d2018-11-16 10:27:06 -0800649 *
650 * @hide
651 */
Victor Hsiehfa9df0b2019-01-29 12:48:36 -0800652 public static final int PRIVATE_FLAG_USE_EMBEDDED_DEX = 1 << 25;
Victor Hsiehe7b5a8d2018-11-16 10:27:06 -0800653
Ruslan Tkhakokhov75674852019-01-22 13:35:00 +0000654 /**
655 * Value for {@link #privateFlags}: indicates whether this application's data will be cleared
656 * on a failed restore.
657 *
658 * <p>Comes from the
659 * android.R.styleable#AndroidManifestApplication_allowClearUserDataOnFailedRestore attribute
660 * of the &lt;application&gt; tag.
661 *
662 * @hide
663 */
664 public static final int PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE = 1 << 26;
665
Kevin Rocardf91d50b2019-02-21 14:32:46 -0800666 /**
667 * Value for {@link #privateFlags}: true if the application allows its audio playback
668 * to be captured by other apps.
669 *
670 * @hide
671 */
672 public static final int PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE = 1 << 27;
673
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700674 /** @hide */
675 @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
Svet Ganov087dce22017-09-07 15:42:16 -0700676 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
677 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION,
678 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE,
679 PRIVATE_FLAG_BACKUP_IN_FOREGROUND,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700680 PRIVATE_FLAG_CANT_SAVE_STATE,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700681 PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE,
682 PRIVATE_FLAG_DIRECT_BOOT_AWARE,
Svet Ganov087dce22017-09-07 15:42:16 -0700683 PRIVATE_FLAG_HAS_DOMAIN_URLS,
684 PRIVATE_FLAG_HIDDEN,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700685 PRIVATE_FLAG_INSTANT,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700686 PRIVATE_FLAG_ISOLATED_SPLIT_LOADING,
Svet Ganov087dce22017-09-07 15:42:16 -0700687 PRIVATE_FLAG_OEM,
688 PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE,
Victor Hsiehfa9df0b2019-01-29 12:48:36 -0800689 PRIVATE_FLAG_USE_EMBEDDED_DEX,
Svet Ganov087dce22017-09-07 15:42:16 -0700690 PRIVATE_FLAG_PRIVILEGED,
Jaekyun Seok1713d9e2018-01-12 21:47:26 +0900691 PRIVATE_FLAG_PRODUCT,
Dario Freni2bef1762018-06-01 14:02:08 +0100692 PRIVATE_FLAG_PRODUCT_SERVICES,
Chris Craikce030282018-10-16 14:33:11 -0700693 PRIVATE_FLAG_PROFILEABLE_BY_SHELL,
Svet Ganov087dce22017-09-07 15:42:16 -0700694 PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
Mathew Inwood9d895432018-04-04 16:08:21 +0100695 PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
Svet Ganov087dce22017-09-07 15:42:16 -0700696 PRIVATE_FLAG_STATIC_SHARED_LIBRARY,
Jiyong Park002fdbd2017-02-13 20:50:31 +0900697 PRIVATE_FLAG_VENDOR,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700698 PRIVATE_FLAG_VIRTUAL_PRELOAD,
Philip P. Moltmannae4a4b92018-12-12 11:28:57 -0800699 PRIVATE_FLAG_HAS_FRAGILE_USER_DATA,
Kevin Rocardf91d50b2019-02-21 14:32:46 -0800700 PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE,
701 PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700702 })
703 @Retention(RetentionPolicy.SOURCE)
704 public @interface ApplicationInfoPrivateFlags {}
705
706 /**
707 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
708 * @hide
709 */
Jeff Sharkeyc6091162018-06-29 17:15:40 -0600710 @TestApi
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700711 public @ApplicationInfoPrivateFlags int privateFlags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800712
713 /**
Clara Bayarri4b5a4d22017-01-27 20:15:45 +0000714 * @hide
715 */
716 public static final String METADATA_PRELOADED_FONTS = "preloaded_fonts";
717
718 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700719 * The required smallest screen width the application can run on. If 0,
720 * nothing has been specified. Comes from
721 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
722 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
723 */
724 public int requiresSmallestWidthDp = 0;
725
726 /**
727 * The maximum smallest screen width the application is designed for. If 0,
728 * nothing has been specified. Comes from
729 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
730 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
731 */
732 public int compatibleWidthLimitDp = 0;
733
734 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700735 * The maximum smallest screen width the application will work on. If 0,
736 * nothing has been specified. Comes from
737 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
738 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
739 */
740 public int largestWidthLimitDp = 0;
741
Jeff Sharkey61128602017-01-26 17:07:35 -0700742 /**
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700743 * Value indicating the maximum aspect ratio the application supports.
744 * <p>
745 * 0 means unset.
746 * @See {@link android.R.attr#maxAspectRatio}.
747 * @hide
748 */
749 public float maxAspectRatio;
750
Adrian Roos917791e2018-11-28 16:30:44 +0100751 /**
752 * Value indicating the minimum aspect ratio the application supports.
753 * <p>
754 * 0 means unset.
755 * @see {@link android.R.attr#minAspectRatio}.
756 * @hide
757 */
758 public float minAspectRatio;
759
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600760 /** @removed */
761 @Deprecated
762 public String volumeUuid;
763
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700764 /**
Jeff Sharkey61128602017-01-26 17:07:35 -0700765 * UUID of the storage volume on which this application is being hosted. For
766 * apps hosted on the default internal storage at
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600767 * {@link Environment#getDataDirectory()}, the UUID value is
768 * {@link StorageManager#UUID_DEFAULT}.
Jeff Sharkey61128602017-01-26 17:07:35 -0700769 */
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600770 public UUID storageUuid;
Jeff Sharkey61128602017-01-26 17:07:35 -0700771
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700772 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100773 @UnsupportedAppUsage
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700774 public String scanSourceDir;
775 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100776 @UnsupportedAppUsage
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700777 public String scanPublicSourceDir;
778
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700779 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700780 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800781 */
782 public String sourceDir;
783
784 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700785 * Full path to the publicly available parts of {@link #sourceDir},
786 * including resources and manifest. This may be different from
787 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 */
789 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700790
791 /**
Adam Lesinski4e862812016-11-21 16:02:24 -0800792 * The names of all installed split APKs, ordered lexicographically.
793 */
794 public String[] splitNames;
795
796 /**
797 * Full paths to zero or more split APKs, indexed by the same order as {@link #splitNames}.
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700798 */
799 public String[] splitSourceDirs;
800
801 /**
802 * Full path to the publicly available parts of {@link #splitSourceDirs},
803 * including resources and manifest. This may be different from
804 * {@link #splitSourceDirs} if an application is forward locked.
Adam Lesinski4e862812016-11-21 16:02:24 -0800805 *
806 * @see #splitSourceDirs
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700807 */
808 public String[] splitPublicSourceDirs;
809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 /**
Adam Lesinski4e862812016-11-21 16:02:24 -0800811 * Maps the dependencies between split APKs. All splits implicitly depend on the base APK.
812 *
813 * Available since platform version O.
814 *
815 * Only populated if the application opts in to isolated split loading via the
816 * {@link android.R.attr.isolatedSplits} attribute in the &lt;manifest&gt; tag of the app's
817 * AndroidManifest.xml.
818 *
819 * The keys and values are all indices into the {@link #splitNames}, {@link #splitSourceDirs},
820 * and {@link #splitPublicSourceDirs} arrays.
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800821 * Each key represents a split and its value is an array of splits. The first element of this
822 * array is the parent split, and the rest are configuration splits. These configuration splits
823 * have no dependencies themselves.
Adam Lesinski4e862812016-11-21 16:02:24 -0800824 * Cycles do not exist because they are illegal and screened for during installation.
825 *
826 * May be null if no splits are installed, or if no dependencies exist between them.
Calin Juravleda098152017-09-01 17:30:01 -0700827 *
828 * NOTE: Any change to the way split dependencies are stored must update the logic that
829 * creates the class loader context for dexopt (DexoptUtils#getClassLoaderContexts).
830 *
Adam Lesinski4e862812016-11-21 16:02:24 -0800831 * @hide
832 */
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800833 public SparseArray<int[]> splitDependencies;
Adam Lesinski4e862812016-11-21 16:02:24 -0800834
835 /**
836 * Full paths to the locations of extra resource packages (runtime overlays)
837 * this application uses. This field is only used if there are extra resource
838 * packages, otherwise it is null.
839 *
Kenny Rootace5a3f2010-02-05 12:59:28 -0800840 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800841 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100842 @UnsupportedAppUsage
Kenny Rootd1ab0162010-01-21 17:27:14 -0800843 public String[] resourceDirs;
844
845 /**
Jeff Vander Stoepcab36392018-03-06 15:52:22 -0800846 * String retrieved from the seinfo tag found in selinux policy. This value can be set through
847 * the mac_permissions.xml policy construct. This value is used for setting an SELinux security
848 * context on the process as well as its data directory.
Robert Craig0f40dc92013-03-25 06:33:03 -0400849 *
850 * {@hide}
851 */
Jeff Vander Stoepcab36392018-03-06 15:52:22 -0800852 public String seInfo;
Todd Kennedybe0b8892017-02-15 14:13:52 -0800853
854 /**
855 * The seinfo tag generated per-user. This value may change based upon the
856 * user's configuration. For example, when an instant app is installed for
857 * a user. It is an error if this field is ever {@code null} when trying to
858 * start a new process.
859 * <p>NOTE: We need to separate this out because we modify per-user values
860 * multiple times. This needs to be refactored since we're performing more
861 * work than necessary and these values should only be set once. When that
862 * happens, we can merge the per-user value with the seInfo state above.
863 *
864 * {@hide}
865 */
866 public String seInfoUser;
Robert Craig0f40dc92013-03-25 06:33:03 -0400867
868 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 * Paths to all shared libraries this application is linked against. This
870 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
871 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
872 * the structure.
873 */
874 public String[] sharedLibraryFiles;
Nicolas Geoffray8d144eb2018-11-15 12:59:52 +0000875
876 /**
877 * List of all shared libraries this application is linked against. This
878 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
879 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
880 * the structure.
881 *
882 * {@hide}
883 */
884 public List<SharedLibraryInfo> sharedLibraryInfos;
885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 /**
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700887 * Full path to the default directory assigned to the package for its
888 * persistent data.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 */
890 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700891
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700892 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600893 * Full path to the device-protected directory assigned to the package for
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700894 * its persistent data.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600895 *
896 * @see Context#createDeviceProtectedStorageContext()
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700897 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600898 public String deviceProtectedDataDir;
899
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700900 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600901 * Full path to the credential-protected directory assigned to the package
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700902 * for its persistent data.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600903 *
904 * @hide
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700905 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600906 @SystemApi
907 public String credentialProtectedDataDir;
908
Kenny Root85387d72010-08-26 10:13:11 -0700909 /**
910 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700911 */
912 public String nativeLibraryDir;
913
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800914 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100915 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
916 * are stored, if present.
917 *
918 * The main reason this exists is for bundled multi-arch apps, where
919 * it's not trivial to calculate the location of libs for the secondary abi
920 * given the location of the primary.
921 *
922 * TODO: Change the layout of bundled installs so that we can use
923 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
924 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
925 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
926 *
927 * @hide
928 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100929 @UnsupportedAppUsage
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100930 public String secondaryNativeLibraryDir;
931
932 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700933 * The root path where unpacked native libraries are stored.
934 * <p>
935 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
936 * placed in ISA-specific subdirectories under this path, otherwise the
937 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100938 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700939 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100940 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100941 @UnsupportedAppUsage
Jeff Sharkey84f12942014-07-10 17:48:11 -0700942 public String nativeLibraryRootDir;
943
944 /**
945 * Flag indicating that ISA must be appended to
946 * {@link #nativeLibraryRootDir} to be useful.
947 *
948 * @hide
949 */
950 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100951
952 /**
953 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100954 * of the native JNI libraries the application bundles. Will be {@code null}
955 * if this application does not require any particular ABI.
956 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100957 * If non-null, the application will always be launched with this ABI.
958 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100959 * {@hide}
960 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100961 @UnsupportedAppUsage
Narayan Kamathff110bd2014-07-04 18:30:45 +0100962 public String primaryCpuAbi;
963
964 /**
965 * The secondary ABI for this application. Might be non-null for multi-arch
966 * installs. The application itself never uses this ABI, but other applications that
967 * use its code might.
968 *
969 * {@hide}
970 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100971 @UnsupportedAppUsage
Narayan Kamathff110bd2014-07-04 18:30:45 +0100972 public String secondaryCpuAbi;
973
974 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 * The kernel user-ID that has been assigned to this application;
976 * currently this is not a unique ID (multiple applications can have
977 * the same uid).
978 */
979 public int uid;
980
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700981 /**
Todd Kennedy89d60182016-03-11 11:18:32 -0800982 * The minimum SDK version this application can run on. It will not run
983 * on earlier versions.
984 */
Todd Kennedy6e2e7f52016-05-02 14:56:45 -0700985 public int minSdkVersion;
Todd Kennedy89d60182016-03-11 11:18:32 -0800986
987 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700988 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700989 * versions, but it knows how to work with any new behavior added at this
990 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
991 * if this is a development build and the app is targeting that. You should
992 * compare that this number is >= the SDK version number at which your
993 * behavior was introduced.
994 */
995 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800996
997 /**
998 * The app's declared version code.
999 * @hide
1000 */
Patrick Baumannc2def582018-04-04 12:14:15 -07001001 public long longVersionCode;
1002
1003 /**
1004 * An integer representation of the app's declared version code. This is being left in place as
1005 * some apps were using reflection to access it before the move to long in
1006 * {@link android.os.Build.VERSION_CODES#P}
1007 * @deprecated Use {@link #longVersionCode} instead.
1008 * @hide
1009 */
1010 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001011 @UnsupportedAppUsage
Patrick Baumannc2def582018-04-04 12:14:15 -07001012 public int versionCode;
Dianne Hackborn8472e612014-01-23 17:57:20 -08001013
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001014 /**
Alan Viveretteb6a25732017-11-21 14:49:24 -05001015 * The user-visible SDK version (ex. 26) of the framework against which the application claims
1016 * to have been compiled, or {@code 0} if not specified.
1017 * <p>
1018 * This property is the compile-time equivalent of
1019 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.SDK_INT}.
1020 *
1021 * @hide For platform use only; we don't expect developers to need to read this value.
1022 */
1023 public int compileSdkVersion;
1024
1025 /**
1026 * The development codename (ex. "O", "REL") of the framework against which the application
1027 * claims to have been compiled, or {@code null} if not specified.
1028 * <p>
1029 * This property is the compile-time equivalent of
1030 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.CODENAME}.
1031 *
1032 * @hide For platform use only; we don't expect developers to need to read this value.
1033 */
1034 @Nullable
1035 public String compileSdkVersionCodename;
1036
1037 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 * When false, indicates that all components within this application are
1039 * considered disabled, regardless of their individually set enabled status.
1040 */
1041 public boolean enabled = true;
1042
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001043 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001044 * For convenient access to the current enabled setting of this app.
1045 * @hide
1046 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001047 @UnsupportedAppUsage
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001048 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
1049
1050 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001051 * For convenient access to package's install location.
1052 * @hide
1053 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001054 @UnsupportedAppUsage
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001055 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -07001056
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001057 /**
1058 * Resource file providing the application's Network Security Config.
1059 * @hide
1060 */
1061 public int networkSecurityConfigRes;
1062
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001063 /**
Todd Kennedy11e45072017-01-25 13:24:21 -08001064 * Version of the sandbox the application wants to run in.
1065 * @hide
1066 */
Patrick Baumann159cd022018-01-11 13:25:05 -08001067 @SystemApi
Todd Kennedy11e45072017-01-25 13:24:21 -08001068 public int targetSandboxVersion;
1069
1070 /**
Jason Monka80bfb52017-11-16 17:15:37 -05001071 * The factory of this package, as specified by the &lt;manifest&gt;
1072 * tag's {@link android.R.styleable#AndroidManifestApplication_appComponentFactory}
1073 * attribute.
1074 */
1075 public String appComponentFactory;
1076
1077 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001078 * The category of this app. Categories are used to cluster multiple apps
1079 * together into meaningful groups, such as when summarizing battery,
1080 * network, or disk usage. Apps should only define this value when they fit
1081 * well into one of the specific categories.
1082 * <p>
1083 * Set from the {@link android.R.attr#appCategory} attribute in the
1084 * manifest. If the manifest doesn't define a category, this value may have
1085 * been provided by the installer via
1086 * {@link PackageManager#setApplicationCategoryHint(String, int)}.
1087 */
1088 public @Category int category = CATEGORY_UNDEFINED;
1089
1090 /** {@hide} */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001091 @IntDef(prefix = { "CATEGORY_" }, value = {
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001092 CATEGORY_UNDEFINED,
1093 CATEGORY_GAME,
1094 CATEGORY_AUDIO,
1095 CATEGORY_VIDEO,
1096 CATEGORY_IMAGE,
1097 CATEGORY_SOCIAL,
1098 CATEGORY_NEWS,
1099 CATEGORY_MAPS,
1100 CATEGORY_PRODUCTIVITY
1101 })
1102 @Retention(RetentionPolicy.SOURCE)
1103 public @interface Category {
1104 }
1105
1106 /**
1107 * Value when category is undefined.
1108 *
1109 * @see #category
1110 */
1111 public static final int CATEGORY_UNDEFINED = -1;
1112
1113 /**
1114 * Category for apps which are primarily games.
1115 *
1116 * @see #category
1117 */
1118 public static final int CATEGORY_GAME = 0;
1119
1120 /**
1121 * Category for apps which primarily work with audio or music, such as music
1122 * players.
1123 *
1124 * @see #category
1125 */
1126 public static final int CATEGORY_AUDIO = 1;
1127
1128 /**
1129 * Category for apps which primarily work with video or movies, such as
1130 * streaming video apps.
1131 *
1132 * @see #category
1133 */
1134 public static final int CATEGORY_VIDEO = 2;
1135
1136 /**
1137 * Category for apps which primarily work with images or photos, such as
1138 * camera or gallery apps.
1139 *
1140 * @see #category
1141 */
1142 public static final int CATEGORY_IMAGE = 3;
1143
1144 /**
1145 * Category for apps which are primarily social apps, such as messaging,
Jeff Sharkeyd2b69102017-03-21 19:40:38 -06001146 * communication, email, or social network apps.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001147 *
1148 * @see #category
1149 */
1150 public static final int CATEGORY_SOCIAL = 4;
1151
1152 /**
1153 * Category for apps which are primarily news apps, such as newspapers,
1154 * magazines, or sports apps.
1155 *
1156 * @see #category
1157 */
1158 public static final int CATEGORY_NEWS = 5;
1159
1160 /**
1161 * Category for apps which are primarily maps apps, such as navigation apps.
1162 *
1163 * @see #category
1164 */
1165 public static final int CATEGORY_MAPS = 6;
1166
1167 /**
1168 * Category for apps which are primarily productivity apps, such as cloud
1169 * storage or workplace apps.
1170 *
1171 * @see #category
1172 */
1173 public static final int CATEGORY_PRODUCTIVITY = 7;
1174
1175 /**
1176 * Return a concise, localized title for the given
1177 * {@link ApplicationInfo#category} value, or {@code null} for unknown
1178 * values such as {@link #CATEGORY_UNDEFINED}.
1179 *
1180 * @see #category
1181 */
1182 public static CharSequence getCategoryTitle(Context context, @Category int category) {
1183 switch (category) {
1184 case ApplicationInfo.CATEGORY_GAME:
1185 return context.getText(com.android.internal.R.string.app_category_game);
1186 case ApplicationInfo.CATEGORY_AUDIO:
1187 return context.getText(com.android.internal.R.string.app_category_audio);
1188 case ApplicationInfo.CATEGORY_VIDEO:
1189 return context.getText(com.android.internal.R.string.app_category_video);
1190 case ApplicationInfo.CATEGORY_IMAGE:
1191 return context.getText(com.android.internal.R.string.app_category_image);
1192 case ApplicationInfo.CATEGORY_SOCIAL:
1193 return context.getText(com.android.internal.R.string.app_category_social);
1194 case ApplicationInfo.CATEGORY_NEWS:
1195 return context.getText(com.android.internal.R.string.app_category_news);
1196 case ApplicationInfo.CATEGORY_MAPS:
1197 return context.getText(com.android.internal.R.string.app_category_maps);
1198 case ApplicationInfo.CATEGORY_PRODUCTIVITY:
1199 return context.getText(com.android.internal.R.string.app_category_productivity);
1200 default:
1201 return null;
1202 }
1203 }
1204
Narayan Kamathf9419f02017-06-15 11:35:38 +01001205 /** @hide */
1206 public String classLoaderName;
1207
1208 /** @hide */
1209 public String[] splitClassLoaderNames;
1210
Rhed Jaocd47c262018-06-13 11:16:16 +08001211 /** @hide */
1212 public boolean hiddenUntilInstalled;
1213
Martijn Coenenfb7caa92019-01-29 11:45:56 +01001214 /** @hide */
1215 public String zygotePreloadName;
1216
Mathew Inwoode3299532018-02-22 13:19:53 +00001217 /**
1218 * Represents the default policy. The actual policy used will depend on other properties of
1219 * the application, e.g. the target SDK version.
1220 * @hide
1221 */
1222 public static final int HIDDEN_API_ENFORCEMENT_DEFAULT = -1;
1223 /**
1224 * No API enforcement; the app can access the entire internal private API. Only for use by
1225 * system apps.
1226 * @hide
1227 */
David Brazdil06ae4b82018-11-02 18:01:45 +00001228 public static final int HIDDEN_API_ENFORCEMENT_DISABLED = 0;
Mathew Inwoode3299532018-02-22 13:19:53 +00001229 /**
Mathew Inwooda6d02fb2018-04-05 15:44:20 +01001230 * No API enforcement, but enable the detection logic and warnings. Observed behaviour is the
David Brazdil06ae4b82018-11-02 18:01:45 +00001231 * same as {@link #HIDDEN_API_ENFORCEMENT_DISABLED} but you may see warnings in the log when
1232 * APIs are accessed.
Mathew Inwoode3299532018-02-22 13:19:53 +00001233 * @hide
1234 * */
Mathew Inwooda6d02fb2018-04-05 15:44:20 +01001235 public static final int HIDDEN_API_ENFORCEMENT_JUST_WARN = 1;
Mathew Inwoode3299532018-02-22 13:19:53 +00001236 /**
1237 * Dark grey list enforcement. Enforces the dark grey and black lists
1238 * @hide
1239 */
David Brazdil06ae4b82018-11-02 18:01:45 +00001240 public static final int HIDDEN_API_ENFORCEMENT_ENABLED = 2;
Mathew Inwoode3299532018-02-22 13:19:53 +00001241
David Brazdil06ae4b82018-11-02 18:01:45 +00001242 private static final int HIDDEN_API_ENFORCEMENT_MIN = HIDDEN_API_ENFORCEMENT_DEFAULT;
1243 private static final int HIDDEN_API_ENFORCEMENT_MAX = HIDDEN_API_ENFORCEMENT_ENABLED;
Mathew Inwoode3299532018-02-22 13:19:53 +00001244
1245 /**
1246 * Values in this IntDef MUST be kept in sync with enum hiddenapi::EnforcementPolicy in
1247 * art/runtime/hidden_api.h
1248 * @hide
1249 */
1250 @IntDef(prefix = { "HIDDEN_API_ENFORCEMENT_" }, value = {
1251 HIDDEN_API_ENFORCEMENT_DEFAULT,
David Brazdil06ae4b82018-11-02 18:01:45 +00001252 HIDDEN_API_ENFORCEMENT_DISABLED,
Mathew Inwooda6d02fb2018-04-05 15:44:20 +01001253 HIDDEN_API_ENFORCEMENT_JUST_WARN,
David Brazdil06ae4b82018-11-02 18:01:45 +00001254 HIDDEN_API_ENFORCEMENT_ENABLED,
Mathew Inwoode3299532018-02-22 13:19:53 +00001255 })
1256 @Retention(RetentionPolicy.SOURCE)
1257 public @interface HiddenApiEnforcementPolicy {}
1258
Mathew Inwood1ab30252018-04-03 14:47:26 +01001259 /** @hide */
1260 public static boolean isValidHiddenApiEnforcementPolicy(int policy) {
David Brazdil06ae4b82018-11-02 18:01:45 +00001261 return policy >= HIDDEN_API_ENFORCEMENT_MIN && policy <= HIDDEN_API_ENFORCEMENT_MAX;
Mathew Inwoode3299532018-02-22 13:19:53 +00001262 }
1263
1264 private int mHiddenApiPolicy = HIDDEN_API_ENFORCEMENT_DEFAULT;
1265
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001266 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001267 dump(pw, prefix, DUMP_FLAG_ALL);
1268 }
1269
1270 /** @hide */
Yohei Yukawa8f272172017-08-31 00:26:01 -07001271 public void dump(Printer pw, String prefix, int dumpFlags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 super.dumpFront(pw, prefix);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001273 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && className != null) {
Dianne Hackborn12527f92009-11-11 17:39:50 -08001274 pw.println(prefix + "className=" + className);
1275 }
1276 if (permission != null) {
1277 pw.println(prefix + "permission=" + permission);
1278 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001279 pw.println(prefix + "processName=" + processName);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001280 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001281 pw.println(prefix + "taskAffinity=" + taskAffinity);
1282 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001283 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001284 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -07001285 + " theme=0x" + Integer.toHexString(theme));
Yohei Yukawa8f272172017-08-31 00:26:01 -07001286 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001287 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
1288 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
1289 + " largestWidthLimitDp=" + largestWidthLimitDp);
1290 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001292 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -07001293 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
1294 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001295 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
1296 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
1297 }
1298 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
1299 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
1300 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
1301 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001302 if (resourceDirs != null) {
Andreas Gampee6748ce2015-12-11 18:00:38 -08001303 pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
Dianne Hackborn39792d22010-08-19 18:01:52 -07001304 }
Yohei Yukawa8f272172017-08-31 00:26:01 -07001305 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && seInfo != null) {
Todd Kennedybe0b8892017-02-15 14:13:52 -08001306 pw.println(prefix + "seinfo=" + seInfo);
1307 pw.println(prefix + "seinfoUser=" + seInfoUser);
Robert Craig0f40dc92013-03-25 06:33:03 -04001308 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 pw.println(prefix + "dataDir=" + dataDir);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001310 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001311 pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir);
1312 pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir);
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001313 if (sharedLibraryFiles != null) {
1314 pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
1315 }
Dianne Hackborn12527f92009-11-11 17:39:50 -08001316 }
Narayan Kamathf9419f02017-06-15 11:35:38 +01001317 if (classLoaderName != null) {
1318 pw.println(prefix + "classLoaderName=" + classLoaderName);
1319 }
1320 if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
1321 pw.println(prefix + "splitClassLoaderNames=" + Arrays.toString(splitClassLoaderNames));
1322 }
1323
Todd Kennedy89d60182016-03-11 11:18:32 -08001324 pw.println(prefix + "enabled=" + enabled
1325 + " minSdkVersion=" + minSdkVersion
1326 + " targetSdkVersion=" + targetSdkVersion
Patrick Baumannc2def582018-04-04 12:14:15 -07001327 + " versionCode=" + longVersionCode
Todd Kennedy11e45072017-01-25 13:24:21 -08001328 + " targetSandboxVersion=" + targetSandboxVersion);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001329 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001330 if (manageSpaceActivityName != null) {
1331 pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
1332 }
1333 if (descriptionRes != 0) {
1334 pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes));
1335 }
1336 if (uiOptions != 0) {
1337 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
1338 }
1339 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
1340 if (fullBackupContent > 0) {
1341 pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
1342 } else {
1343 pw.println(prefix + "fullBackupContent="
1344 + (fullBackupContent < 0 ? "false" : "true"));
1345 }
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001346 if (networkSecurityConfigRes != 0) {
1347 pw.println(prefix + "networkSecurityConfigRes=0x"
1348 + Integer.toHexString(networkSecurityConfigRes));
1349 }
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001350 if (category != CATEGORY_UNDEFINED) {
1351 pw.println(prefix + "category=" + category);
1352 }
Mathew Inwoode3299532018-02-22 13:19:53 +00001353 pw.println(prefix + "HiddenApiEnforcementPolicy=" + getHiddenApiEnforcementPolicy());
David Brazdila5b4df22018-09-06 09:49:14 +01001354 pw.println(prefix + "usesNonSdkApi=" + usesNonSdkApi());
Kevin Rocardf91d50b2019-02-21 14:32:46 -08001355 pw.println(prefix + "allowsPlaybackCapture="
1356 + (isAudioPlaybackCaptureAllowed() ? "true" : "false"));
Matthew Williams303650c2015-04-17 18:22:51 -07001357 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 super.dumpBack(pw, prefix);
1359 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -07001360
Yi Jin148d7f42017-11-28 14:23:56 -08001361 /** {@hide} */
1362 public void writeToProto(ProtoOutputStream proto, long fieldId, int dumpFlags) {
1363 long token = proto.start(fieldId);
Dianne Hackborn2f55e5a2018-11-30 16:31:31 -08001364 super.writeToProto(proto, ApplicationInfoProto.PACKAGE, dumpFlags);
Yi Jin148d7f42017-11-28 14:23:56 -08001365 proto.write(ApplicationInfoProto.PERMISSION, permission);
1366 proto.write(ApplicationInfoProto.PROCESS_NAME, processName);
1367 proto.write(ApplicationInfoProto.UID, uid);
1368 proto.write(ApplicationInfoProto.FLAGS, flags);
1369 proto.write(ApplicationInfoProto.PRIVATE_FLAGS, privateFlags);
1370 proto.write(ApplicationInfoProto.THEME, theme);
1371 proto.write(ApplicationInfoProto.SOURCE_DIR, sourceDir);
1372 if (!Objects.equals(sourceDir, publicSourceDir)) {
1373 proto.write(ApplicationInfoProto.PUBLIC_SOURCE_DIR, publicSourceDir);
1374 }
1375 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
1376 for (String dir : splitSourceDirs) {
1377 proto.write(ApplicationInfoProto.SPLIT_SOURCE_DIRS, dir);
1378 }
1379 }
1380 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
1381 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
1382 for (String dir : splitPublicSourceDirs) {
1383 proto.write(ApplicationInfoProto.SPLIT_PUBLIC_SOURCE_DIRS, dir);
1384 }
1385 }
1386 if (resourceDirs != null) {
1387 for (String dir : resourceDirs) {
1388 proto.write(ApplicationInfoProto.RESOURCE_DIRS, dir);
1389 }
1390 }
1391 proto.write(ApplicationInfoProto.DATA_DIR, dataDir);
1392 proto.write(ApplicationInfoProto.CLASS_LOADER_NAME, classLoaderName);
1393 if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
1394 for (String name : splitClassLoaderNames) {
1395 proto.write(ApplicationInfoProto.SPLIT_CLASS_LOADER_NAMES, name);
1396 }
1397 }
1398
1399 long versionToken = proto.start(ApplicationInfoProto.VERSION);
1400 proto.write(ApplicationInfoProto.Version.ENABLED, enabled);
1401 proto.write(ApplicationInfoProto.Version.MIN_SDK_VERSION, minSdkVersion);
1402 proto.write(ApplicationInfoProto.Version.TARGET_SDK_VERSION, targetSdkVersion);
Patrick Baumannc2def582018-04-04 12:14:15 -07001403 proto.write(ApplicationInfoProto.Version.VERSION_CODE, longVersionCode);
Yi Jin148d7f42017-11-28 14:23:56 -08001404 proto.write(ApplicationInfoProto.Version.TARGET_SANDBOX_VERSION, targetSandboxVersion);
1405 proto.end(versionToken);
1406
1407 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
1408 long detailToken = proto.start(ApplicationInfoProto.DETAIL);
1409 if (className != null) {
1410 proto.write(ApplicationInfoProto.Detail.CLASS_NAME, className);
1411 }
1412 proto.write(ApplicationInfoProto.Detail.TASK_AFFINITY, taskAffinity);
1413 proto.write(ApplicationInfoProto.Detail.REQUIRES_SMALLEST_WIDTH_DP,
1414 requiresSmallestWidthDp);
1415 proto.write(ApplicationInfoProto.Detail.COMPATIBLE_WIDTH_LIMIT_DP,
1416 compatibleWidthLimitDp);
1417 proto.write(ApplicationInfoProto.Detail.LARGEST_WIDTH_LIMIT_DP,
1418 largestWidthLimitDp);
1419 if (seInfo != null) {
1420 proto.write(ApplicationInfoProto.Detail.SEINFO, seInfo);
1421 proto.write(ApplicationInfoProto.Detail.SEINFO_USER, seInfoUser);
1422 }
1423 proto.write(ApplicationInfoProto.Detail.DEVICE_PROTECTED_DATA_DIR,
1424 deviceProtectedDataDir);
1425 proto.write(ApplicationInfoProto.Detail.CREDENTIAL_PROTECTED_DATA_DIR,
1426 credentialProtectedDataDir);
1427 if (sharedLibraryFiles != null) {
1428 for (String f : sharedLibraryFiles) {
1429 proto.write(ApplicationInfoProto.Detail.SHARED_LIBRARY_FILES, f);
1430 }
1431 }
1432 if (manageSpaceActivityName != null) {
1433 proto.write(ApplicationInfoProto.Detail.MANAGE_SPACE_ACTIVITY_NAME,
1434 manageSpaceActivityName);
1435 }
1436 if (descriptionRes != 0) {
1437 proto.write(ApplicationInfoProto.Detail.DESCRIPTION_RES, descriptionRes);
1438 }
1439 if (uiOptions != 0) {
1440 proto.write(ApplicationInfoProto.Detail.UI_OPTIONS, uiOptions);
1441 }
1442 proto.write(ApplicationInfoProto.Detail.SUPPORTS_RTL, hasRtlSupport());
1443 if (fullBackupContent > 0) {
1444 proto.write(ApplicationInfoProto.Detail.CONTENT, "@xml/" + fullBackupContent);
1445 } else {
1446 proto.write(ApplicationInfoProto.Detail.IS_FULL_BACKUP, fullBackupContent == 0);
1447 }
1448 if (networkSecurityConfigRes != 0) {
1449 proto.write(ApplicationInfoProto.Detail.NETWORK_SECURITY_CONFIG_RES,
1450 networkSecurityConfigRes);
1451 }
1452 if (category != CATEGORY_UNDEFINED) {
1453 proto.write(ApplicationInfoProto.Detail.CATEGORY, category);
1454 }
1455 proto.end(detailToken);
1456 }
1457 proto.end(token);
1458 }
1459
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -07001460 /**
1461 * @return true if "supportsRtl" has been set to true in the AndroidManifest
1462 * @hide
1463 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001464 @UnsupportedAppUsage
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -07001465 public boolean hasRtlSupport() {
1466 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
1467 }
Jeff Sharkeyba75a9b2016-01-07 11:51:33 -07001468
1469 /** {@hide} */
1470 public boolean hasCode() {
1471 return (flags & FLAG_HAS_CODE) != 0;
1472 }
1473
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001474 public static class DisplayNameComparator
1475 implements Comparator<ApplicationInfo> {
1476 public DisplayNameComparator(PackageManager pm) {
1477 mPM = pm;
1478 }
1479
1480 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
1481 CharSequence sa = mPM.getApplicationLabel(aa);
1482 if (sa == null) {
1483 sa = aa.packageName;
1484 }
1485 CharSequence sb = mPM.getApplicationLabel(ab);
1486 if (sb == null) {
1487 sb = ab.packageName;
1488 }
1489
1490 return sCollator.compare(sa.toString(), sb.toString());
1491 }
1492
Mathew Inwood31755f92018-12-20 13:53:36 +00001493 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001494 private final Collator sCollator = Collator.getInstance();
Mathew Inwood31755f92018-12-20 13:53:36 +00001495 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001496 private PackageManager mPM;
1497 }
1498
1499 public ApplicationInfo() {
1500 }
1501
1502 public ApplicationInfo(ApplicationInfo orig) {
1503 super(orig);
1504 taskAffinity = orig.taskAffinity;
1505 permission = orig.permission;
1506 processName = orig.processName;
1507 className = orig.className;
1508 theme = orig.theme;
1509 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001510 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001511 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
1512 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001513 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07001514 volumeUuid = orig.volumeUuid;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -06001515 storageUuid = orig.storageUuid;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001516 scanSourceDir = orig.scanSourceDir;
1517 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 sourceDir = orig.sourceDir;
1519 publicSourceDir = orig.publicSourceDir;
Adam Lesinski4e862812016-11-21 16:02:24 -08001520 splitNames = orig.splitNames;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001521 splitSourceDirs = orig.splitSourceDirs;
1522 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Adam Lesinski4e862812016-11-21 16:02:24 -08001523 splitDependencies = orig.splitDependencies;
Kenny Root85387d72010-08-26 10:13:11 -07001524 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001525 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -07001526 nativeLibraryRootDir = orig.nativeLibraryRootDir;
1527 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +01001528 primaryCpuAbi = orig.primaryCpuAbi;
1529 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -08001530 resourceDirs = orig.resourceDirs;
Todd Kennedybe0b8892017-02-15 14:13:52 -08001531 seInfo = orig.seInfo;
1532 seInfoUser = orig.seInfoUser;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001533 sharedLibraryFiles = orig.sharedLibraryFiles;
Nicolas Geoffray8d144eb2018-11-15 12:59:52 +00001534 sharedLibraryInfos = orig.sharedLibraryInfos;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001535 dataDir = orig.dataDir;
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001536 deviceProtectedDataDir = orig.deviceProtectedDataDir;
1537 credentialProtectedDataDir = orig.credentialProtectedDataDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001538 uid = orig.uid;
Todd Kennedy89d60182016-03-11 11:18:32 -08001539 minSdkVersion = orig.minSdkVersion;
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001540 targetSdkVersion = orig.targetSdkVersion;
Patrick Baumannc2def582018-04-04 12:14:15 -07001541 setVersionCode(orig.longVersionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001542 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001543 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001544 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001545 manageSpaceActivityName = orig.manageSpaceActivityName;
1546 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -07001547 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -07001548 backupAgentName = orig.backupAgentName;
Matthew Williams303650c2015-04-17 18:22:51 -07001549 fullBackupContent = orig.fullBackupContent;
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001550 networkSecurityConfigRes = orig.networkSecurityConfigRes;
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001551 category = orig.category;
Todd Kennedy11e45072017-01-25 13:24:21 -08001552 targetSandboxVersion = orig.targetSandboxVersion;
Narayan Kamathf9419f02017-06-15 11:35:38 +01001553 classLoaderName = orig.classLoaderName;
1554 splitClassLoaderNames = orig.splitClassLoaderNames;
Jason Monka80bfb52017-11-16 17:15:37 -05001555 appComponentFactory = orig.appComponentFactory;
Adam Lesinskid3ea00992018-02-20 16:51:13 -08001556 compileSdkVersion = orig.compileSdkVersion;
1557 compileSdkVersionCodename = orig.compileSdkVersionCodename;
Mathew Inwoode3299532018-02-22 13:19:53 +00001558 mHiddenApiPolicy = orig.mHiddenApiPolicy;
Rhed Jaocd47c262018-06-13 11:16:16 +08001559 hiddenUntilInstalled = orig.hiddenUntilInstalled;
Martijn Coenenfb7caa92019-01-29 11:45:56 +01001560 zygotePreloadName = orig.zygotePreloadName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001561 }
1562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001563 public String toString() {
1564 return "ApplicationInfo{"
1565 + Integer.toHexString(System.identityHashCode(this))
1566 + " " + packageName + "}";
1567 }
1568
1569 public int describeContents() {
1570 return 0;
1571 }
1572
Adam Lesinski4e862812016-11-21 16:02:24 -08001573 @SuppressWarnings("unchecked")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 public void writeToParcel(Parcel dest, int parcelableFlags) {
1575 super.writeToParcel(dest, parcelableFlags);
1576 dest.writeString(taskAffinity);
1577 dest.writeString(permission);
1578 dest.writeString(processName);
1579 dest.writeString(className);
1580 dest.writeInt(theme);
1581 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001582 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001583 dest.writeInt(requiresSmallestWidthDp);
1584 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001585 dest.writeInt(largestWidthLimitDp);
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001586 if (storageUuid != null) {
1587 dest.writeInt(1);
Jeff Sharkeya4d34d92017-04-27 11:21:41 -06001588 dest.writeLong(storageUuid.getMostSignificantBits());
1589 dest.writeLong(storageUuid.getLeastSignificantBits());
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001590 } else {
1591 dest.writeInt(0);
1592 }
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001593 dest.writeString(scanSourceDir);
1594 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001595 dest.writeString(sourceDir);
1596 dest.writeString(publicSourceDir);
Adam Lesinski4e862812016-11-21 16:02:24 -08001597 dest.writeStringArray(splitNames);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001598 dest.writeStringArray(splitSourceDirs);
1599 dest.writeStringArray(splitPublicSourceDirs);
Adam Lesinski1665d0f2017-03-10 14:46:57 -08001600 dest.writeSparseArray((SparseArray) splitDependencies);
Kenny Root85387d72010-08-26 10:13:11 -07001601 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001602 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -07001603 dest.writeString(nativeLibraryRootDir);
1604 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +01001605 dest.writeString(primaryCpuAbi);
1606 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -08001607 dest.writeStringArray(resourceDirs);
Todd Kennedybe0b8892017-02-15 14:13:52 -08001608 dest.writeString(seInfo);
1609 dest.writeString(seInfoUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 dest.writeStringArray(sharedLibraryFiles);
Nicolas Geoffray8d144eb2018-11-15 12:59:52 +00001611 dest.writeTypedList(sharedLibraryInfos);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001612 dest.writeString(dataDir);
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001613 dest.writeString(deviceProtectedDataDir);
1614 dest.writeString(credentialProtectedDataDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001615 dest.writeInt(uid);
Todd Kennedy6e2e7f52016-05-02 14:56:45 -07001616 dest.writeInt(minSdkVersion);
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001617 dest.writeInt(targetSdkVersion);
Patrick Baumannc2def582018-04-04 12:14:15 -07001618 dest.writeLong(longVersionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001620 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001621 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -07001623 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -07001625 dest.writeInt(uiOptions);
Matthew Williams303650c2015-04-17 18:22:51 -07001626 dest.writeInt(fullBackupContent);
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001627 dest.writeInt(networkSecurityConfigRes);
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001628 dest.writeInt(category);
Todd Kennedy11e45072017-01-25 13:24:21 -08001629 dest.writeInt(targetSandboxVersion);
Narayan Kamathf9419f02017-06-15 11:35:38 +01001630 dest.writeString(classLoaderName);
1631 dest.writeStringArray(splitClassLoaderNames);
Alan Viveretteb6a25732017-11-21 14:49:24 -05001632 dest.writeInt(compileSdkVersion);
1633 dest.writeString(compileSdkVersionCodename);
Jason Monka80bfb52017-11-16 17:15:37 -05001634 dest.writeString(appComponentFactory);
Mathew Inwoode3299532018-02-22 13:19:53 +00001635 dest.writeInt(mHiddenApiPolicy);
Rhed Jaocd47c262018-06-13 11:16:16 +08001636 dest.writeInt(hiddenUntilInstalled ? 1 : 0);
Martijn Coenenfb7caa92019-01-29 11:45:56 +01001637 dest.writeString(zygotePreloadName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001638 }
1639
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07001640 public static final @android.annotation.NonNull Parcelable.Creator<ApplicationInfo> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001641 = new Parcelable.Creator<ApplicationInfo>() {
1642 public ApplicationInfo createFromParcel(Parcel source) {
1643 return new ApplicationInfo(source);
1644 }
1645 public ApplicationInfo[] newArray(int size) {
1646 return new ApplicationInfo[size];
1647 }
1648 };
1649
Adam Lesinski4e862812016-11-21 16:02:24 -08001650 @SuppressWarnings("unchecked")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001651 private ApplicationInfo(Parcel source) {
1652 super(source);
1653 taskAffinity = source.readString();
1654 permission = source.readString();
1655 processName = source.readString();
1656 className = source.readString();
1657 theme = source.readInt();
1658 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001659 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001660 requiresSmallestWidthDp = source.readInt();
1661 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001662 largestWidthLimitDp = source.readInt();
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001663 if (source.readInt() != 0) {
Jeff Sharkeya4d34d92017-04-27 11:21:41 -06001664 storageUuid = new UUID(source.readLong(), source.readLong());
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001665 volumeUuid = StorageManager.convert(storageUuid);
1666 }
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001667 scanSourceDir = source.readString();
1668 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 sourceDir = source.readString();
1670 publicSourceDir = source.readString();
Adam Lesinski4e862812016-11-21 16:02:24 -08001671 splitNames = source.readStringArray();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001672 splitSourceDirs = source.readStringArray();
1673 splitPublicSourceDirs = source.readStringArray();
Adam Lesinski1665d0f2017-03-10 14:46:57 -08001674 splitDependencies = source.readSparseArray(null);
Kenny Root85387d72010-08-26 10:13:11 -07001675 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001676 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -07001677 nativeLibraryRootDir = source.readString();
1678 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +01001679 primaryCpuAbi = source.readString();
1680 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -08001681 resourceDirs = source.readStringArray();
Todd Kennedybe0b8892017-02-15 14:13:52 -08001682 seInfo = source.readString();
1683 seInfoUser = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001684 sharedLibraryFiles = source.readStringArray();
Nicolas Geoffray8d144eb2018-11-15 12:59:52 +00001685 sharedLibraryInfos = source.createTypedArrayList(SharedLibraryInfo.CREATOR);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001686 dataDir = source.readString();
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001687 deviceProtectedDataDir = source.readString();
1688 credentialProtectedDataDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001689 uid = source.readInt();
Todd Kennedy6e2e7f52016-05-02 14:56:45 -07001690 minSdkVersion = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001691 targetSdkVersion = source.readInt();
Patrick Baumannc2def582018-04-04 12:14:15 -07001692 setVersionCode(source.readLong());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001693 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001694 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001695 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -07001697 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001698 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -07001699 uiOptions = source.readInt();
Matthew Williams303650c2015-04-17 18:22:51 -07001700 fullBackupContent = source.readInt();
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001701 networkSecurityConfigRes = source.readInt();
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001702 category = source.readInt();
Todd Kennedy11e45072017-01-25 13:24:21 -08001703 targetSandboxVersion = source.readInt();
Narayan Kamathf9419f02017-06-15 11:35:38 +01001704 classLoaderName = source.readString();
1705 splitClassLoaderNames = source.readStringArray();
Alan Viveretteb6a25732017-11-21 14:49:24 -05001706 compileSdkVersion = source.readInt();
1707 compileSdkVersionCodename = source.readString();
Jason Monka80bfb52017-11-16 17:15:37 -05001708 appComponentFactory = source.readString();
Mathew Inwoode3299532018-02-22 13:19:53 +00001709 mHiddenApiPolicy = source.readInt();
Rhed Jaocd47c262018-06-13 11:16:16 +08001710 hiddenUntilInstalled = source.readInt() != 0;
Martijn Coenenfb7caa92019-01-29 11:45:56 +01001711 zygotePreloadName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001712 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001713
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001714 /**
1715 * Retrieve the textual description of the application. This
1716 * will call back on the given PackageManager to load the description from
1717 * the application.
1718 *
1719 * @param pm A PackageManager from which the label can be loaded; usually
1720 * the PackageManager from which you originally retrieved this item.
1721 *
1722 * @return Returns a CharSequence containing the application's description.
1723 * If there is no description, null is returned.
1724 */
1725 public CharSequence loadDescription(PackageManager pm) {
1726 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -07001727 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001728 if (label != null) {
1729 return label;
1730 }
1731 }
1732 return null;
1733 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001734
1735 /**
1736 * Disable compatibility mode
1737 *
1738 * @hide
1739 */
Mathew Inwood31755f92018-12-20 13:53:36 +00001740 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001741 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -07001742 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -07001743 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -07001744 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001745 }
Jeff Sharkey15447792015-11-05 16:18:51 -08001746
skuhne@google.com7e85eb02017-01-04 13:49:54 -08001747 /**
1748 * Is using compatibility mode for non densty aware legacy applications.
1749 *
1750 * @hide
1751 */
1752 public boolean usesCompatibilityMode() {
1753 return targetSdkVersion < DONUT ||
1754 (flags & (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
1755 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
1756 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS)) == 0;
1757 }
1758
Jeff Sharkey15447792015-11-05 16:18:51 -08001759 /** {@hide} */
1760 public void initForUser(int userId) {
1761 uid = UserHandle.getUid(userId, UserHandle.getAppId(uid));
1762
1763 if ("android".equals(packageName)) {
1764 dataDir = Environment.getDataSystemDirectory().getAbsolutePath();
1765 return;
1766 }
1767
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001768 deviceProtectedDataDir = Environment
Jeff Sharkey8212ae02016-02-10 14:46:43 -07001769 .getDataUserDePackageDirectory(volumeUuid, userId, packageName)
Jeff Sharkey15447792015-11-05 16:18:51 -08001770 .getAbsolutePath();
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001771 credentialProtectedDataDir = Environment
Jeff Sharkey8212ae02016-02-10 14:46:43 -07001772 .getDataUserCePackageDirectory(volumeUuid, userId, packageName)
Jeff Sharkey15447792015-11-05 16:18:51 -08001773 .getAbsolutePath();
1774
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001775 if ((privateFlags & PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0
1776 && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) {
1777 dataDir = deviceProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -08001778 } else {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001779 dataDir = credentialProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -08001780 }
1781 }
1782
Mathew Inwoode3299532018-02-22 13:19:53 +00001783 private boolean isPackageWhitelistedForHiddenApis() {
1784 return SystemConfig.getInstance().getHiddenApiWhitelistedApps().contains(packageName);
1785 }
1786
David Brazdila5b4df22018-09-06 09:49:14 +01001787 /**
1788 * @hide
1789 */
1790 public boolean usesNonSdkApi() {
1791 return (privateFlags & PRIVATE_FLAG_USES_NON_SDK_API) != 0;
1792 }
1793
Philip P. Moltmannae4a4b92018-12-12 11:28:57 -08001794 /**
1795 * Whether an app needs to keep the app data on uninstall.
1796 *
1797 * @return {@code true} if the app indicates that it needs to keep the app data
1798 *
1799 * @hide
1800 */
1801 public boolean hasFragileUserData() {
1802 return (privateFlags & PRIVATE_FLAG_HAS_FRAGILE_USER_DATA) != 0;
1803 }
1804
Kevin Rocardf91d50b2019-02-21 14:32:46 -08001805 /**
1806 * Whether an app allows its playback audio to be captured by other apps.
1807 *
1808 * @return {@code true} if the app indicates that its audio can be captured by other apps.
1809 *
1810 * @hide
1811 */
1812 public boolean isAudioPlaybackCaptureAllowed() {
1813 return (privateFlags & PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE) != 0;
1814 }
1815
Mathew Inwood9d895432018-04-04 16:08:21 +01001816 private boolean isAllowedToUseHiddenApis() {
David Brazdil787b6f22a2018-08-28 12:55:56 +01001817 if (isSignedWithPlatformKey()) {
1818 return true;
1819 } else if (isSystemApp() || isUpdatedSystemApp()) {
David Brazdila5b4df22018-09-06 09:49:14 +01001820 return usesNonSdkApi() || isPackageWhitelistedForHiddenApis();
David Brazdil787b6f22a2018-08-28 12:55:56 +01001821 } else {
1822 return false;
1823 }
Mathew Inwood9d895432018-04-04 16:08:21 +01001824 }
1825
Jeff Brown07330792010-03-30 19:57:08 -07001826 /**
1827 * @hide
1828 */
Mathew Inwoode3299532018-02-22 13:19:53 +00001829 public @HiddenApiEnforcementPolicy int getHiddenApiEnforcementPolicy() {
Mathew Inwood9d895432018-04-04 16:08:21 +01001830 if (isAllowedToUseHiddenApis()) {
David Brazdil06ae4b82018-11-02 18:01:45 +00001831 return HIDDEN_API_ENFORCEMENT_DISABLED;
Mathew Inwoode3299532018-02-22 13:19:53 +00001832 }
Mathew Inwood1ab30252018-04-03 14:47:26 +01001833 if (mHiddenApiPolicy != HIDDEN_API_ENFORCEMENT_DEFAULT) {
1834 return mHiddenApiPolicy;
1835 }
David Brazdil06ae4b82018-11-02 18:01:45 +00001836 return HIDDEN_API_ENFORCEMENT_ENABLED;
Mathew Inwoode3299532018-02-22 13:19:53 +00001837 }
1838
1839 /**
1840 * @hide
1841 */
1842 public void setHiddenApiEnforcementPolicy(@HiddenApiEnforcementPolicy int policy) {
1843 if (!isValidHiddenApiEnforcementPolicy(policy)) {
1844 throw new IllegalArgumentException("Invalid API enforcement policy: " + policy);
1845 }
1846 mHiddenApiPolicy = policy;
David Brazdil464ed3d2018-01-18 15:25:18 +00001847 }
1848
1849 /**
Mathew Inwood1ab30252018-04-03 14:47:26 +01001850 * Updates the hidden API enforcement policy for this app from the given values, if appropriate.
1851 *
1852 * This will have no effect if this app is not subject to hidden API enforcement, i.e. if it
1853 * is on the package whitelist.
1854 *
David Brazdil06ae4b82018-11-02 18:01:45 +00001855 * @param policy configured policy for this app, or {@link #HIDDEN_API_ENFORCEMENT_DEFAULT}
David Brazdil5cd148f2018-11-01 09:54:25 +00001856 * if nothing configured.
Mathew Inwood1ab30252018-04-03 14:47:26 +01001857 * @hide
1858 */
David Brazdil06ae4b82018-11-02 18:01:45 +00001859 public void maybeUpdateHiddenApiEnforcementPolicy(@HiddenApiEnforcementPolicy int policy) {
Mathew Inwood1ab30252018-04-03 14:47:26 +01001860 if (isPackageWhitelistedForHiddenApis()) {
1861 return;
1862 }
David Brazdil06ae4b82018-11-02 18:01:45 +00001863 setHiddenApiEnforcementPolicy(policy);
Mathew Inwood1ab30252018-04-03 14:47:26 +01001864 }
1865
1866 /**
David Brazdil464ed3d2018-01-18 15:25:18 +00001867 * @hide
1868 */
Patrick Baumannc2def582018-04-04 12:14:15 -07001869 public void setVersionCode(long newVersionCode) {
1870 longVersionCode = newVersionCode;
1871 versionCode = (int) newVersionCode;
1872 }
1873
1874 /**
1875 * @hide
1876 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +01001877 @Override
1878 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -07001879 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
1880 && isPackageUnavailable(pm)) {
1881 return Resources.getSystem().getDrawable(
1882 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
1883 }
1884 return pm.getDefaultActivityIcon();
1885 }
1886
Mathew Inwood31755f92018-12-20 13:53:36 +00001887 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Jeff Brown07330792010-03-30 19:57:08 -07001888 private boolean isPackageUnavailable(PackageManager pm) {
1889 try {
1890 return pm.getPackageInfo(packageName, 0) == null;
1891 } catch (NameNotFoundException ex) {
1892 return true;
1893 }
1894 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -07001895
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -08001896 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001897 public boolean isDefaultToDeviceProtectedStorage() {
1898 return (privateFlags
1899 & ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0;
Jeff Sharkeye4697132016-02-06 19:46:15 -07001900 }
1901
1902 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001903 public boolean isDirectBootAware() {
1904 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE) != 0;
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -08001905 }
1906
Hai Zhang14ea9ef2019-01-10 14:56:06 -08001907 /**
1908 * Check whether the application is encryption aware.
1909 *
1910 * @see #isDirectBootAware()
1911 * @see #isPartiallyDirectBootAware()
1912 *
1913 * @hide
1914 */
1915 @SystemApi
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001916 public boolean isEncryptionAware() {
1917 return isDirectBootAware() || isPartiallyDirectBootAware();
1918 }
1919
1920 /** @hide */
1921 public boolean isExternal() {
1922 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
1923 }
1924
Patrick Baumann159cd022018-01-11 13:25:05 -08001925 /**
1926 * True if the application is installed as an instant app.
1927 * @hide
1928 */
1929 @SystemApi
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001930 public boolean isInstantApp() {
1931 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_INSTANT) != 0;
1932 }
1933
1934 /** @hide */
1935 public boolean isInternal() {
1936 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
1937 }
1938
1939 /** @hide */
1940 public boolean isOem() {
1941 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_OEM) != 0;
1942 }
1943
1944 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001945 public boolean isPartiallyDirectBootAware() {
1946 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0;
Jeff Sharkey8924e872015-11-30 12:52:10 -07001947 }
1948
Bryce Lee8558ec72017-08-17 15:37:26 -07001949 /** @hide */
Mathew Inwood9d895432018-04-04 16:08:21 +01001950 public boolean isSignedWithPlatformKey() {
1951 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY) != 0;
1952 }
1953
1954 /** @hide */
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001955 @TestApi
1956 public boolean isPrivilegedApp() {
1957 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0;
Bryce Lee8558ec72017-08-17 15:37:26 -07001958 }
1959
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001960 /** @hide */
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -08001961 public boolean isRequiredForSystemUser() {
1962 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER) != 0;
1963 }
1964
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001965 /** @hide */
Svet Ganov67882122016-12-11 16:36:34 -08001966 public boolean isStaticSharedLibrary() {
1967 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_STATIC_SHARED_LIBRARY) != 0;
1968 }
1969
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001970 /** @hide */
1971 @TestApi
1972 public boolean isSystemApp() {
1973 return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
1974 }
1975
1976 /** @hide */
1977 public boolean isUpdatedSystemApp() {
1978 return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
1979 }
1980
Jiyong Park002fdbd2017-02-13 20:50:31 +09001981 /** @hide */
1982 public boolean isVendor() {
1983 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_VENDOR) != 0;
1984 }
1985
Jaekyun Seok1713d9e2018-01-12 21:47:26 +09001986 /** @hide */
1987 public boolean isProduct() {
1988 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
1989 }
1990
Dario Freni2bef1762018-06-01 14:02:08 +01001991 /** @hide */
1992 public boolean isProductServices() {
1993 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
1994 }
1995
Victor Hsiehf12af2f2019-01-03 10:11:03 -08001996 /** @hide */
Victor Hsiehfa9df0b2019-01-29 12:48:36 -08001997 public boolean isEmbeddedDexUsed() {
1998 return (privateFlags & PRIVATE_FLAG_USE_EMBEDDED_DEX) != 0;
Victor Hsiehf12af2f2019-01-03 10:11:03 -08001999 }
2000
Svet Ganov67882122016-12-11 16:36:34 -08002001 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -07002002 * Returns whether or not this application was installed as a virtual preload.
2003 */
2004 public boolean isVirtualPreload() {
2005 return (privateFlags & PRIVATE_FLAG_VIRTUAL_PRELOAD) != 0;
2006 }
2007
2008 /**
Chris Craikce030282018-10-16 14:33:11 -07002009 * Returns whether or not this application can be profiled by the shell user,
2010 * even when running on a device that is running in user mode.
2011 */
2012 public boolean isProfileableByShell() {
2013 return (privateFlags & PRIVATE_FLAG_PROFILEABLE_BY_SHELL) != 0;
2014 }
2015
2016 /**
Todd Kennedyc29b11a2017-10-23 15:55:59 -07002017 * Returns true if the app has declared in its manifest that it wants its split APKs to be
2018 * loaded into isolated Contexts, with their own ClassLoaders and Resources objects.
Svet Ganov67882122016-12-11 16:36:34 -08002019 * @hide
2020 */
Todd Kennedyc29b11a2017-10-23 15:55:59 -07002021 public boolean requestsIsolatedSplitLoading() {
2022 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ISOLATED_SPLIT_LOADING) != 0;
Svet Ganov087dce22017-09-07 15:42:16 -07002023 }
2024
2025 /**
2026 * @hide
2027 */
Jeff Brown07330792010-03-30 19:57:08 -07002028 @Override protected ApplicationInfo getApplicationInfo() {
2029 return this;
2030 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -07002031
Torne (Richard Coles)1aaae102019-03-01 15:02:29 -05002032 /**
2033 * Return all the APK paths that may be required to load this application, including all
2034 * splits, shared libraries, and resource overlays.
2035 * @hide
2036 */
2037 public String[] getAllApkPaths() {
2038 final String[][] inputLists = { splitSourceDirs, sharedLibraryFiles, resourceDirs };
2039 final List<String> output = new ArrayList<>(10);
2040 if (sourceDir != null) {
2041 output.add(sourceDir);
2042 }
2043 for (String[] inputList : inputLists) {
2044 if (inputList != null) {
2045 for (String input : inputList) {
2046 output.add(input);
2047 }
2048 }
2049 }
2050 return output.toArray(new String[output.size()]);
2051 }
2052
Jeff Sharkeyd7460572014-07-06 20:44:55 -07002053 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
2054 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
2055 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
2056 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
2057 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
2058 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
2059
Mathew Inwood5c0d3542018-08-14 13:54:31 +01002060 /** {@hide} */
2061 @UnsupportedAppUsage
2062 public String getCodePath() { return scanSourceDir; }
Jeff Sharkeyd7460572014-07-06 20:44:55 -07002063 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
2064 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
2065 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
Mathew Inwood5c0d3542018-08-14 13:54:31 +01002066 /** {@hide} */
2067 @UnsupportedAppUsage
2068 public String getBaseResourcePath() { return publicSourceDir; }
Jeff Sharkeya3a43b02016-11-15 17:54:23 -07002069 /** {@hide} */ public String[] getSplitResourcePaths() { return splitPublicSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002070}