blob: f6697e8148a0f182d7dc63ec247a155a8f3769bd [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;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060025import android.content.Context;
Jeff Brown07330792010-03-30 19:57:08 -070026import android.content.pm.PackageManager.NameNotFoundException;
27import android.content.res.Resources;
28import android.graphics.drawable.Drawable;
Jeff Sharkey15447792015-11-05 16:18:51 -080029import android.os.Environment;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.os.Parcel;
31import android.os.Parcelable;
Jeff Sharkey15447792015-11-05 16:18:51 -080032import android.os.UserHandle;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -060033import android.os.storage.StorageManager;
Jeff Sharkeye2d45be2015-04-15 17:14:12 -070034import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.util.Printer;
Adam Lesinski1665d0f2017-03-10 14:46:57 -080036import android.util.SparseArray;
Yi Jin148d7f42017-11-28 14:23:56 -080037import android.util.proto.ProtoOutputStream;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070039import com.android.internal.util.ArrayUtils;
40
Jeff Sharkey9bc89af2017-01-11 11:25:50 -070041import java.lang.annotation.Retention;
42import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import java.text.Collator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070044import java.util.Arrays;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import java.util.Comparator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070046import java.util.Objects;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -060047import java.util.UUID;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
49/**
50 * Information you can retrieve about a particular application. This
51 * corresponds to information collected from the AndroidManifest.xml's
52 * <application> tag.
53 */
54public class ApplicationInfo extends PackageItemInfo implements Parcelable {
55
56 /**
57 * Default task affinity of all activities in this application. See
58 * {@link ActivityInfo#taskAffinity} for more information. This comes
59 * from the "taskAffinity" attribute.
60 */
61 public String taskAffinity;
62
63 /**
64 * Optional name of a permission required to be able to access this
65 * application's components. From the "permission" attribute.
66 */
67 public String permission;
68
69 /**
70 * The name of the process this application should run in. From the
71 * "process" attribute or, if not set, the same as
72 * <var>packageName</var>.
73 */
74 public String processName;
75
76 /**
77 * Class implementing the Application object. From the "class"
78 * attribute.
79 */
80 public String className;
81
82 /**
83 * A style resource identifier (in the package's resources) of the
84 * description of an application. From the "description" attribute
85 * or, if not set, 0.
86 */
87 public int descriptionRes;
88
89 /**
90 * A style resource identifier (in the package's resources) of the
91 * default visual theme of the application. From the "theme" attribute
92 * or, if not set, 0.
93 */
94 public int theme;
95
96 /**
97 * Class implementing the Application's manage space
98 * functionality. From the "manageSpaceActivity"
99 * attribute. This is an optional attribute and will be null if
Christopher Tate181fafa2009-05-14 11:12:14 -0700100 * applications don't specify it in their manifest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 */
102 public String manageSpaceActivityName;
103
104 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700105 * Class implementing the Application's backup functionality. From
106 * the "backupAgent" attribute. This is an optional attribute and
107 * will be null if the application does not specify it in its manifest.
108 *
109 * <p>If android:allowBackup is set to false, this attribute is ignored.
Christopher Tate181fafa2009-05-14 11:12:14 -0700110 */
111 public String backupAgentName;
Christopher Tate4a627c72011-04-01 14:43:32 -0700112
113 /**
Matthew Williams303650c2015-04-17 18:22:51 -0700114 * An optional attribute that indicates the app supports automatic backup of app data.
115 * <p>0 is the default and means the app's entire data folder + managed external storage will
116 * be backed up;
117 * Any negative value indicates the app does not support full-data backup, though it may still
118 * want to participate via the traditional key/value backup API;
119 * A positive number specifies an xml resource in which the application has defined its backup
120 * include/exclude criteria.
121 * <p>If android:allowBackup is set to false, this attribute is ignored.
122 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600123 * @see android.content.Context#getNoBackupFilesDir()
124 * @see #FLAG_ALLOW_BACKUP
Christopher Tate98fa6562015-05-14 13:20:10 -0700125 *
126 * @hide
Matthew Williams303650c2015-04-17 18:22:51 -0700127 */
128 public int fullBackupContent = 0;
129
130 /**
Adam Powell269248d2011-08-02 10:26:54 -0700131 * The default extra UI options for activities in this application.
132 * Set from the {@link android.R.attr#uiOptions} attribute in the
133 * activity's manifest.
134 */
135 public int uiOptions = 0;
136
137 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 * Value for {@link #flags}: if set, this application is installed in the
139 * device's system image.
140 */
141 public static final int FLAG_SYSTEM = 1<<0;
142
143 /**
144 * Value for {@link #flags}: set to true if this application would like to
145 * allow debugging of its
146 * code, even when installed on a non-development system. Comes
147 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
148 * android:debuggable} of the &lt;application&gt; tag.
149 */
150 public static final int FLAG_DEBUGGABLE = 1<<1;
151
152 /**
153 * Value for {@link #flags}: set to true if this application has code
154 * associated with it. Comes
155 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
156 * android:hasCode} of the &lt;application&gt; tag.
157 */
158 public static final int FLAG_HAS_CODE = 1<<2;
159
160 /**
161 * Value for {@link #flags}: set to true if this application is persistent.
162 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
163 * android:persistent} of the &lt;application&gt; tag.
164 */
165 public static final int FLAG_PERSISTENT = 1<<3;
166
167 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700168 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
170 * device is running in factory test mode.
171 */
172 public static final int FLAG_FACTORY_TEST = 1<<4;
173
174 /**
175 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
176 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
177 * android:allowTaskReparenting} of the &lt;application&gt; tag.
178 */
179 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
180
181 /**
182 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
183 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
184 * android:allowClearUserData} of the &lt;application&gt; tag.
185 */
186 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800188 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700189 * Value for {@link #flags}: this is set if this application has been
Kweku Adams8de29ca2016-01-22 12:30:26 -0800190 * installed as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800191 */
192 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700193
194 /**
Svet Ganov354cd3c2015-12-17 11:35:04 -0800195 * Value for {@link #flags}: this is set if the application has specified
Dianne Hackborn7f205432009-07-28 00:13:47 -0700196 * {@link android.R.styleable#AndroidManifestApplication_testOnly
197 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700198 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700199 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700200
201 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700202 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700203 * reduced in size for smaller screens. Corresponds to
204 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
205 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700206 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700207 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
208
209 /**
210 * Value for {@link #flags}: true when the application's window can be
211 * displayed on normal screens. Corresponds to
212 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
213 * android:normalScreens}.
214 */
215 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
216
217 /**
218 * Value for {@link #flags}: true when the application's window can be
219 * increased in size for larger screens. Corresponds to
220 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700221 * android:largeScreens}.
Dianne Hackborn723738c2009-06-25 19:48:04 -0700222 */
223 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700224
225 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700226 * Value for {@link #flags}: true when the application knows how to adjust
227 * its UI for different screen sizes. Corresponds to
228 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
229 * android:resizeable}.
230 */
231 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
232
233 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700234 * Value for {@link #flags}: true when the application knows how to
235 * accomodate different screen densities. Corresponds to
236 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
237 * android:anyDensity}.
238 */
239 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
240
241 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800242 * Value for {@link #flags}: set to true if this application would like to
243 * request the VM to operate under the safe mode. Comes from
Ben Chengef3f5dd2010-03-29 15:47:26 -0700244 * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode
245 * android:vmSafeMode} of the &lt;application&gt; tag.
Ben Cheng23085b72010-02-08 16:06:32 -0800246 */
247 public static final int FLAG_VM_SAFE_MODE = 1<<14;
248
249 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800250 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
251 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700252 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800253 * <p>Comes from the
254 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
255 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700256 */
Ben Cheng23085b72010-02-08 16:06:32 -0800257 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700258
259 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800260 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
261 * in memory following a full-system restore operation; <code>true</code> otherwise.
262 * Ordinarily, during a full system restore operation each application is shut down
263 * following execution of its agent's onRestore() method. Setting this attribute to
264 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700265 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800266 * <p>If
267 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
268 * is set to <code>false</code> or no
269 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700270 * is specified, this flag will be ignored.
271 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800272 * <p>Comes from the
273 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
274 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700275 */
Ben Cheng23085b72010-02-08 16:06:32 -0800276 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700277
278 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800279 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
280 * agent claims to be able to handle restore data even "from the future,"
281 * i.e. from versions of the application with a versionCode greater than
282 * the one currently installed on the device. <i>Use with caution!</i> By default
283 * this attribute is <code>false</code> and the Backup Manager will ensure that data
284 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700285 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800286 * <p>If
287 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
288 * is set to <code>false</code> or no
289 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700290 * is specified, this flag will be ignored.
291 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800292 * <p>Comes from the
293 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
294 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700295 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800296 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700297
Christopher Tate181fafa2009-05-14 11:12:14 -0700298 /**
Dianne Hackborn3202d382010-04-26 17:51:34 -0700299 * Value for {@link #flags}: Set to true if the application is
300 * currently installed on external/removable/unprotected storage. Such
301 * applications may not be available if their storage is not currently
302 * mounted. When the storage it is on is not available, it will look like
303 * the application has been uninstalled (its .apk is no longer available)
304 * but its persistent data is not removed.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800305 */
Dianne Hackborn94c567e2010-04-26 18:13:10 -0700306 public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800307
308 /**
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700309 * Value for {@link #flags}: true when the application's window can be
310 * increased in size for extra large screens. Corresponds to
311 * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700312 * android:xlargeScreens}.
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700313 */
314 public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
315
316 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800317 * Value for {@link #flags}: true when the application has requested a
318 * large heap for its processes. Corresponds to
319 * {@link android.R.styleable#AndroidManifestApplication_largeHeap
320 * android:largeHeap}.
Jason parksa3cdaa52011-01-13 14:15:43 -0600321 */
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800322 public static final int FLAG_LARGE_HEAP = 1<<20;
Jason parksa3cdaa52011-01-13 14:15:43 -0600323
324 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800325 * Value for {@link #flags}: true if this application's package is in
326 * the stopped state.
327 */
328 public static final int FLAG_STOPPED = 1<<21;
329
330 /**
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700331 * Value for {@link #flags}: true when the application is willing to support
332 * RTL (right to left). All activities will inherit this value.
333 *
334 * Set from the {@link android.R.attr#supportsRtl} attribute in the
335 * activity's manifest.
336 *
337 * Default value is false (no support for RTL).
338 */
339 public static final int FLAG_SUPPORTS_RTL = 1<<22;
340
341 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700342 * Value for {@link #flags}: true if the application is currently
343 * installed for the calling user.
344 */
345 public static final int FLAG_INSTALLED = 1<<23;
346
347 /**
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700348 * Value for {@link #flags}: true if the application only has its
349 * data installed; the application package itself does not currently
350 * exist on the device.
351 */
352 public static final int FLAG_IS_DATA_ONLY = 1<<24;
353
354 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700355 * Value for {@link #flags}: true if the application was declared to be a
356 * game, or false if it is a non-game application.
357 *
358 * @deprecated use {@link #CATEGORY_GAME} instead.
Jose Lima12d0b4c2014-03-14 16:55:12 -0700359 */
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700360 @Deprecated
Jose Lima12d0b4c2014-03-14 16:55:12 -0700361 public static final int FLAG_IS_GAME = 1<<25;
362
363 /**
Christopher Tated1de2562014-06-17 17:12:35 -0700364 * Value for {@link #flags}: {@code true} if the application asks that only
365 * full-data streaming backups of its data be performed even though it defines
366 * a {@link android.app.backup.BackupAgent BackupAgent}, which normally
367 * indicates that the app will manage its backed-up data via incremental
368 * key/value updates.
369 */
370 public static final int FLAG_FULL_BACKUP_ONLY = 1<<26;
371
372 /**
Alex Klyubin01a959d2015-03-18 10:05:45 -0700373 * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic
374 * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
375 * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
376 * cleartext network traffic, in which case platform components (e.g., HTTP stacks,
Alex Klyubinfbf45992015-04-21 13:44:29 -0700377 * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext
378 * traffic. Third-party libraries are encouraged to honor this flag as well.
379 *
Nate Fischer6a2a5412017-10-23 18:02:41 -0700380 * <p>NOTE: {@code WebView} honors this flag for applications targeting API level 26 and up.
Alex Klyubinfbf45992015-04-21 13:44:29 -0700381 *
Chad Brubaker2df5ba72016-04-11 13:31:24 -0700382 * <p>This flag is ignored on Android N and above if an Android Network Security Config is
383 * present.
384 *
Alex Klyubinfbf45992015-04-21 13:44:29 -0700385 * <p>This flag comes from
386 * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic
387 * android:usesCleartextTraffic} of the &lt;application&gt; tag.
Alex Klyubin01a959d2015-03-18 10:05:45 -0700388 */
389 public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
390
391 /**
Dmitriy Ivanovff193d62014-09-30 15:10:48 -0700392 * When set installer extracts native libs from .apk files.
393 */
394 public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
395
396 /**
Alan Viveretted70b9e72015-05-27 14:29:20 -0700397 * Value for {@link #flags}: {@code true} when the application's rendering
398 * should be hardware accelerated.
399 */
400 public static final int FLAG_HARDWARE_ACCELERATED = 1<<29;
401
402 /**
Andrei Stingaceanu1e283912015-11-26 15:26:28 +0000403 * Value for {@link #flags}: true if this application's package is in
404 * the suspended state.
405 */
406 public static final int FLAG_SUSPENDED = 1<<30;
407
408 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100409 * Value for {@link #flags}: true if code from this application will need to be
410 * loaded into other applications' processes. On devices that support multiple
411 * instruction sets, this implies the code might be loaded into a process that's
412 * using any of the devices supported instruction sets.
413 *
414 * <p> The system might treat such applications specially, for eg., by
415 * extracting the application's native libraries for all supported instruction
416 * sets or by compiling the application's dex code for all supported instruction
417 * sets.
418 */
419 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700420
421 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 * Flags associated with the application. Any combination of
423 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
424 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
425 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700426 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700427 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
428 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700429 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
430 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700431 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800432 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
433 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
434 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
435 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
436 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
Alex Klyubin7cb000f2015-03-26 11:00:04 -0700437 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC},
438 * {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 */
440 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700441
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800443 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
444 * most purposes is considered as not installed.
445 * {@hide}
446 */
447 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
448
449 /**
450 * Value for {@link #privateFlags}: set to <code>true</code> if the application
451 * has reported that it is heavy-weight, and thus can not participate in
452 * the normal application lifecycle.
453 *
454 * <p>Comes from the
455 * android.R.styleable#AndroidManifestApplication_cantSaveState
456 * attribute of the &lt;application&gt; tag.
457 *
458 * {@hide}
459 */
460 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
461
462 /**
463 * Value for {@link #privateFlags}: Set to true if the application has been
464 * installed using the forward lock option.
465 *
466 * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml.
467 *
468 * {@hide}
469 */
470 public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2;
471
472 /**
473 * Value for {@link #privateFlags}: set to {@code true} if the application
474 * is permitted to hold privileged permissions.
475 *
476 * {@hide}
477 */
478 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
479
480 /**
Svet Ganov2acf0632015-11-24 19:10:59 -0800481 * Value for {@link #privateFlags}: {@code true} if the application has any IntentFiler
482 * with some data URI using HTTP or HTTPS with an associated VIEW action.
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700483 *
484 * {@hide}
485 */
486 public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
487
488 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600489 * When set, the default data storage directory for this app is pointed at
490 * the device-protected location.
Jeff Sharkey15447792015-11-05 16:18:51 -0800491 *
492 * @hide
493 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600494 public static final int PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = 1 << 5;
Jeff Sharkey15447792015-11-05 16:18:51 -0800495
496 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600497 * When set, assume that all components under the given app are direct boot
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -0800498 * aware, unless otherwise specified.
499 *
500 * @hide
501 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600502 public static final int PRIVATE_FLAG_DIRECT_BOOT_AWARE = 1 << 6;
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -0800503
504 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -0800505 * Value for {@link #privateFlags}: {@code true} if the application is installed
506 * as instant app.
507 *
508 * @hide
Chad Brubaker4389c232016-11-04 14:50:50 -0700509 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800510 public static final int PRIVATE_FLAG_INSTANT = 1 << 7;
Chad Brubaker4389c232016-11-04 14:50:50 -0700511
512 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600513 * When set, at least one component inside this application is direct boot
514 * aware.
Jeff Sharkey8924e872015-11-30 12:52:10 -0700515 *
516 * @hide
517 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600518 public static final int PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE = 1 << 8;
Jeff Sharkey8924e872015-11-30 12:52:10 -0700519
Fyodor Kupolovf99104d2015-12-14 11:31:29 -0800520
521 /**
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -0800522 * When set, signals that the application is required for the system user and should not be
523 * uninstalled.
524 *
525 * @hide
526 */
Chad Brubaker4389c232016-11-04 14:50:50 -0700527 public static final int PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER = 1 << 9;
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -0800528
529 /**
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700530 * When set, the application explicitly requested that its activities be resizeable by default.
Wale Ogunwale6afdf912016-01-30 13:01:33 -0800531 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
532 *
533 * @hide
534 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700535 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE = 1 << 10;
536
537 /**
538 * When set, the application explicitly requested that its activities *not* be resizeable by
539 * default.
540 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
541 *
542 * @hide
543 */
544 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE = 1 << 11;
Wale Ogunwale72a73e32016-10-13 12:16:39 -0700545
546 /**
547 * The application isn't requesting explicitly requesting for its activities to be resizeable or
548 * non-resizeable by default. So, we are making it activities resizeable by default based on the
549 * target SDK version of the app.
550 * @see android.R.styleable#AndroidManifestActivity_resizeableActivity
551 *
552 * NOTE: This only affects apps with target SDK >= N where the resizeableActivity attribute was
553 * introduced. It shouldn't be confused with {@link ActivityInfo#RESIZE_MODE_FORCE_RESIZEABLE}
554 * where certain pre-N apps are forced to the resizeable.
555 *
556 * @hide
557 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700558 public static final int PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION =
559 1 << 12;
Wale Ogunwale6afdf912016-01-30 13:01:33 -0800560
561 /**
Christopher Tate43fbc5f2016-02-17 18:00:48 -0800562 * Value for {@link #privateFlags}: {@code true} means the OS should go ahead and
563 * run full-data backup operations for the app even when it is in a
564 * foreground-equivalent run state. Defaults to {@code false} if unspecified.
565 * @hide
566 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700567 public static final int PRIVATE_FLAG_BACKUP_IN_FOREGROUND = 1 << 13;
Christopher Tate43fbc5f2016-02-17 18:00:48 -0800568
569 /**
Svet Ganov67882122016-12-11 16:36:34 -0800570 * Value for {@link #privateFlags}: {@code true} means this application
571 * contains a static shared library. Defaults to {@code false} if unspecified.
572 * @hide
573 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700574 public static final int PRIVATE_FLAG_STATIC_SHARED_LIBRARY = 1 << 14;
Svet Ganov67882122016-12-11 16:36:34 -0800575
576 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700577 * Value for {@link #privateFlags}: When set, the application will only have its splits loaded
Adam Lesinski4e862812016-11-21 16:02:24 -0800578 * if they are required to load a component. Splits can be loaded on demand using the
579 * {@link Context#createContextForSplit(String)} API.
580 * @hide
581 */
Wale Ogunwalee633eb02017-03-30 12:57:29 -0700582 public static final int PRIVATE_FLAG_ISOLATED_SPLIT_LOADING = 1 << 15;
Adam Lesinski4e862812016-11-21 16:02:24 -0800583
584 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700585 * Value for {@link #privateFlags}: When set, the application was installed as
586 * a virtual preload.
587 * @hide
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800588 */
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700589 public static final int PRIVATE_FLAG_VIRTUAL_PRELOAD = 1 << 16;
590
Svet Ganov087dce22017-09-07 15:42:16 -0700591 /**
592 * Value for {@linl #privateFlags}: whether this app is pre-installed on the
593 * OEM partition of the system image.
594 * @hide
595 */
596 public static final int PRIVATE_FLAG_OEM = 1 << 17;
597
Jiyong Park002fdbd2017-02-13 20:50:31 +0900598 /**
599 * Value for {@linl #privateFlags}: whether this app is pre-installed on the
600 * vendor partition of the system image.
601 * @hide
602 */
603 public static final int PRIVATE_FLAG_VENDOR = 1 << 18;
604
Jaekyun Seok1713d9e2018-01-12 21:47:26 +0900605 /**
606 * Value for {@linl #privateFlags}: whether this app is pre-installed on the
607 * product partition of the system image.
608 * @hide
609 */
610 public static final int PRIVATE_FLAG_PRODUCT = 1 << 19;
611
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700612 /** @hide */
613 @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
Svet Ganov087dce22017-09-07 15:42:16 -0700614 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
615 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION,
616 PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE,
617 PRIVATE_FLAG_BACKUP_IN_FOREGROUND,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700618 PRIVATE_FLAG_CANT_SAVE_STATE,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700619 PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE,
620 PRIVATE_FLAG_DIRECT_BOOT_AWARE,
Svet Ganov087dce22017-09-07 15:42:16 -0700621 PRIVATE_FLAG_FORWARD_LOCK,
622 PRIVATE_FLAG_HAS_DOMAIN_URLS,
623 PRIVATE_FLAG_HIDDEN,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700624 PRIVATE_FLAG_INSTANT,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700625 PRIVATE_FLAG_ISOLATED_SPLIT_LOADING,
Svet Ganov087dce22017-09-07 15:42:16 -0700626 PRIVATE_FLAG_OEM,
627 PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE,
628 PRIVATE_FLAG_PRIVILEGED,
Jaekyun Seok1713d9e2018-01-12 21:47:26 +0900629 PRIVATE_FLAG_PRODUCT,
Svet Ganov087dce22017-09-07 15:42:16 -0700630 PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
631 PRIVATE_FLAG_STATIC_SHARED_LIBRARY,
Jiyong Park002fdbd2017-02-13 20:50:31 +0900632 PRIVATE_FLAG_VENDOR,
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -0700633 PRIVATE_FLAG_VIRTUAL_PRELOAD,
634 })
635 @Retention(RetentionPolicy.SOURCE)
636 public @interface ApplicationInfoPrivateFlags {}
637
638 /**
639 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
640 * @hide
641 */
642 public @ApplicationInfoPrivateFlags int privateFlags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800643
644 /**
Clara Bayarri4b5a4d22017-01-27 20:15:45 +0000645 * @hide
646 */
647 public static final String METADATA_PRELOADED_FONTS = "preloaded_fonts";
648
649 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700650 * The required smallest screen width the application can run on. If 0,
651 * nothing has been specified. Comes from
652 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
653 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
654 */
655 public int requiresSmallestWidthDp = 0;
656
657 /**
658 * The maximum smallest screen width the application is designed for. If 0,
659 * nothing has been specified. Comes from
660 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
661 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
662 */
663 public int compatibleWidthLimitDp = 0;
664
665 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700666 * The maximum smallest screen width the application will work on. If 0,
667 * nothing has been specified. Comes from
668 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
669 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
670 */
671 public int largestWidthLimitDp = 0;
672
Jeff Sharkey61128602017-01-26 17:07:35 -0700673 /**
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700674 * Value indicating the maximum aspect ratio the application supports.
675 * <p>
676 * 0 means unset.
677 * @See {@link android.R.attr#maxAspectRatio}.
678 * @hide
679 */
680 public float maxAspectRatio;
681
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600682 /** @removed */
683 @Deprecated
684 public String volumeUuid;
685
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700686 /**
Jeff Sharkey61128602017-01-26 17:07:35 -0700687 * UUID of the storage volume on which this application is being hosted. For
688 * apps hosted on the default internal storage at
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600689 * {@link Environment#getDataDirectory()}, the UUID value is
690 * {@link StorageManager#UUID_DEFAULT}.
Jeff Sharkey61128602017-01-26 17:07:35 -0700691 */
Jeff Sharkey789a8fc2017-04-16 13:18:35 -0600692 public UUID storageUuid;
Jeff Sharkey61128602017-01-26 17:07:35 -0700693
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700694 /** {@hide} */
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700695 public String scanSourceDir;
696 /** {@hide} */
697 public String scanPublicSourceDir;
698
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700699 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700700 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 */
702 public String sourceDir;
703
704 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700705 * Full path to the publicly available parts of {@link #sourceDir},
706 * including resources and manifest. This may be different from
707 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 */
709 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700710
711 /**
Adam Lesinski4e862812016-11-21 16:02:24 -0800712 * The names of all installed split APKs, ordered lexicographically.
713 */
714 public String[] splitNames;
715
716 /**
717 * Full paths to zero or more split APKs, indexed by the same order as {@link #splitNames}.
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700718 */
719 public String[] splitSourceDirs;
720
721 /**
722 * Full path to the publicly available parts of {@link #splitSourceDirs},
723 * including resources and manifest. This may be different from
724 * {@link #splitSourceDirs} if an application is forward locked.
Adam Lesinski4e862812016-11-21 16:02:24 -0800725 *
726 * @see #splitSourceDirs
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700727 */
728 public String[] splitPublicSourceDirs;
729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 /**
Adam Lesinski4e862812016-11-21 16:02:24 -0800731 * Maps the dependencies between split APKs. All splits implicitly depend on the base APK.
732 *
733 * Available since platform version O.
734 *
735 * Only populated if the application opts in to isolated split loading via the
736 * {@link android.R.attr.isolatedSplits} attribute in the &lt;manifest&gt; tag of the app's
737 * AndroidManifest.xml.
738 *
739 * The keys and values are all indices into the {@link #splitNames}, {@link #splitSourceDirs},
740 * and {@link #splitPublicSourceDirs} arrays.
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800741 * Each key represents a split and its value is an array of splits. The first element of this
742 * array is the parent split, and the rest are configuration splits. These configuration splits
743 * have no dependencies themselves.
Adam Lesinski4e862812016-11-21 16:02:24 -0800744 * Cycles do not exist because they are illegal and screened for during installation.
745 *
746 * May be null if no splits are installed, or if no dependencies exist between them.
Calin Juravleda098152017-09-01 17:30:01 -0700747 *
748 * NOTE: Any change to the way split dependencies are stored must update the logic that
749 * creates the class loader context for dexopt (DexoptUtils#getClassLoaderContexts).
750 *
Adam Lesinski4e862812016-11-21 16:02:24 -0800751 * @hide
752 */
Adam Lesinski1665d0f2017-03-10 14:46:57 -0800753 public SparseArray<int[]> splitDependencies;
Adam Lesinski4e862812016-11-21 16:02:24 -0800754
755 /**
756 * Full paths to the locations of extra resource packages (runtime overlays)
757 * this application uses. This field is only used if there are extra resource
758 * packages, otherwise it is null.
759 *
Kenny Rootace5a3f2010-02-05 12:59:28 -0800760 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800761 */
762 public String[] resourceDirs;
763
764 /**
Robert Craig0f40dc92013-03-25 06:33:03 -0400765 * String retrieved from the seinfo tag found in selinux policy. This value
Robert Craig5e16bc52015-08-28 12:11:41 -0400766 * can be overridden with a value set through the mac_permissions.xml policy
767 * construct. This value is useful in setting an SELinux security context on
768 * the process as well as its data directory. The String default is being used
769 * here to represent a catchall label when no policy matches.
Robert Craig0f40dc92013-03-25 06:33:03 -0400770 *
771 * {@hide}
772 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800773 public String seInfo = "default";
774
775 /**
776 * The seinfo tag generated per-user. This value may change based upon the
777 * user's configuration. For example, when an instant app is installed for
778 * a user. It is an error if this field is ever {@code null} when trying to
779 * start a new process.
780 * <p>NOTE: We need to separate this out because we modify per-user values
781 * multiple times. This needs to be refactored since we're performing more
782 * work than necessary and these values should only be set once. When that
783 * happens, we can merge the per-user value with the seInfo state above.
784 *
785 * {@hide}
786 */
787 public String seInfoUser;
Robert Craig0f40dc92013-03-25 06:33:03 -0400788
789 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800790 * Paths to all shared libraries this application is linked against. This
791 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
792 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
793 * the structure.
794 */
795 public String[] sharedLibraryFiles;
796
797 /**
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700798 * Full path to the default directory assigned to the package for its
799 * persistent data.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800800 */
801 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700802
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700803 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600804 * Full path to the device-protected directory assigned to the package for
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700805 * its persistent data.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600806 *
807 * @see Context#createDeviceProtectedStorageContext()
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700808 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600809 public String deviceProtectedDataDir;
810
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700811 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600812 * Full path to the credential-protected directory assigned to the package
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700813 * for its persistent data.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600814 *
815 * @hide
Jeff Sharkey7a30a302015-12-08 14:20:06 -0700816 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600817 @SystemApi
818 public String credentialProtectedDataDir;
819
Kenny Root85387d72010-08-26 10:13:11 -0700820 /**
821 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700822 */
823 public String nativeLibraryDir;
824
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100826 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
827 * are stored, if present.
828 *
829 * The main reason this exists is for bundled multi-arch apps, where
830 * it's not trivial to calculate the location of libs for the secondary abi
831 * given the location of the primary.
832 *
833 * TODO: Change the layout of bundled installs so that we can use
834 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
835 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
836 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
837 *
838 * @hide
839 */
840 public String secondaryNativeLibraryDir;
841
842 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700843 * The root path where unpacked native libraries are stored.
844 * <p>
845 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
846 * placed in ISA-specific subdirectories under this path, otherwise the
847 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100848 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700849 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100850 */
Jeff Sharkey84f12942014-07-10 17:48:11 -0700851 public String nativeLibraryRootDir;
852
853 /**
854 * Flag indicating that ISA must be appended to
855 * {@link #nativeLibraryRootDir} to be useful.
856 *
857 * @hide
858 */
859 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100860
861 /**
862 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100863 * of the native JNI libraries the application bundles. Will be {@code null}
864 * if this application does not require any particular ABI.
865 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100866 * If non-null, the application will always be launched with this ABI.
867 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100868 * {@hide}
869 */
Narayan Kamathff110bd2014-07-04 18:30:45 +0100870 public String primaryCpuAbi;
871
872 /**
873 * The secondary ABI for this application. Might be non-null for multi-arch
874 * installs. The application itself never uses this ABI, but other applications that
875 * use its code might.
876 *
877 * {@hide}
878 */
879 public String secondaryCpuAbi;
880
881 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 * The kernel user-ID that has been assigned to this application;
883 * currently this is not a unique ID (multiple applications can have
884 * the same uid).
885 */
886 public int uid;
887
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700888 /**
Todd Kennedy89d60182016-03-11 11:18:32 -0800889 * The minimum SDK version this application can run on. It will not run
890 * on earlier versions.
891 */
Todd Kennedy6e2e7f52016-05-02 14:56:45 -0700892 public int minSdkVersion;
Todd Kennedy89d60182016-03-11 11:18:32 -0800893
894 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700895 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700896 * versions, but it knows how to work with any new behavior added at this
897 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
898 * if this is a development build and the app is targeting that. You should
899 * compare that this number is >= the SDK version number at which your
900 * behavior was introduced.
901 */
902 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800903
904 /**
905 * The app's declared version code.
906 * @hide
907 */
Dianne Hackborn3accca02013-09-20 09:32:11 -0700908 public long versionCode;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800909
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700910 /**
Alan Viveretteb6a25732017-11-21 14:49:24 -0500911 * The user-visible SDK version (ex. 26) of the framework against which the application claims
912 * to have been compiled, or {@code 0} if not specified.
913 * <p>
914 * This property is the compile-time equivalent of
915 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.SDK_INT}.
916 *
917 * @hide For platform use only; we don't expect developers to need to read this value.
918 */
919 public int compileSdkVersion;
920
921 /**
922 * The development codename (ex. "O", "REL") of the framework against which the application
923 * claims to have been compiled, or {@code null} if not specified.
924 * <p>
925 * This property is the compile-time equivalent of
926 * {@link android.os.Build.VERSION#CODENAME Build.VERSION.CODENAME}.
927 *
928 * @hide For platform use only; we don't expect developers to need to read this value.
929 */
930 @Nullable
931 public String compileSdkVersionCodename;
932
933 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 * When false, indicates that all components within this application are
935 * considered disabled, regardless of their individually set enabled status.
936 */
937 public boolean enabled = true;
938
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700939 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700940 * For convenient access to the current enabled setting of this app.
941 * @hide
942 */
943 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
944
945 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700946 * For convenient access to package's install location.
947 * @hide
948 */
949 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -0700950
Chad Brubakerc845b2a2016-05-13 14:09:27 -0700951 /**
952 * Resource file providing the application's Network Security Config.
953 * @hide
954 */
955 public int networkSecurityConfigRes;
956
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700957 /**
Todd Kennedy11e45072017-01-25 13:24:21 -0800958 * Version of the sandbox the application wants to run in.
959 * @hide
960 */
961 public int targetSandboxVersion;
962
963 /**
Jason Monka80bfb52017-11-16 17:15:37 -0500964 * The factory of this package, as specified by the &lt;manifest&gt;
965 * tag's {@link android.R.styleable#AndroidManifestApplication_appComponentFactory}
966 * attribute.
967 */
968 public String appComponentFactory;
969
970 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700971 * The category of this app. Categories are used to cluster multiple apps
972 * together into meaningful groups, such as when summarizing battery,
973 * network, or disk usage. Apps should only define this value when they fit
974 * well into one of the specific categories.
975 * <p>
976 * Set from the {@link android.R.attr#appCategory} attribute in the
977 * manifest. If the manifest doesn't define a category, this value may have
978 * been provided by the installer via
979 * {@link PackageManager#setApplicationCategoryHint(String, int)}.
980 */
981 public @Category int category = CATEGORY_UNDEFINED;
982
983 /** {@hide} */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600984 @IntDef(prefix = { "CATEGORY_" }, value = {
Jeff Sharkey9bc89af2017-01-11 11:25:50 -0700985 CATEGORY_UNDEFINED,
986 CATEGORY_GAME,
987 CATEGORY_AUDIO,
988 CATEGORY_VIDEO,
989 CATEGORY_IMAGE,
990 CATEGORY_SOCIAL,
991 CATEGORY_NEWS,
992 CATEGORY_MAPS,
993 CATEGORY_PRODUCTIVITY
994 })
995 @Retention(RetentionPolicy.SOURCE)
996 public @interface Category {
997 }
998
999 /**
1000 * Value when category is undefined.
1001 *
1002 * @see #category
1003 */
1004 public static final int CATEGORY_UNDEFINED = -1;
1005
1006 /**
1007 * Category for apps which are primarily games.
1008 *
1009 * @see #category
1010 */
1011 public static final int CATEGORY_GAME = 0;
1012
1013 /**
1014 * Category for apps which primarily work with audio or music, such as music
1015 * players.
1016 *
1017 * @see #category
1018 */
1019 public static final int CATEGORY_AUDIO = 1;
1020
1021 /**
1022 * Category for apps which primarily work with video or movies, such as
1023 * streaming video apps.
1024 *
1025 * @see #category
1026 */
1027 public static final int CATEGORY_VIDEO = 2;
1028
1029 /**
1030 * Category for apps which primarily work with images or photos, such as
1031 * camera or gallery apps.
1032 *
1033 * @see #category
1034 */
1035 public static final int CATEGORY_IMAGE = 3;
1036
1037 /**
1038 * Category for apps which are primarily social apps, such as messaging,
Jeff Sharkeyd2b69102017-03-21 19:40:38 -06001039 * communication, email, or social network apps.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001040 *
1041 * @see #category
1042 */
1043 public static final int CATEGORY_SOCIAL = 4;
1044
1045 /**
1046 * Category for apps which are primarily news apps, such as newspapers,
1047 * magazines, or sports apps.
1048 *
1049 * @see #category
1050 */
1051 public static final int CATEGORY_NEWS = 5;
1052
1053 /**
1054 * Category for apps which are primarily maps apps, such as navigation apps.
1055 *
1056 * @see #category
1057 */
1058 public static final int CATEGORY_MAPS = 6;
1059
1060 /**
1061 * Category for apps which are primarily productivity apps, such as cloud
1062 * storage or workplace apps.
1063 *
1064 * @see #category
1065 */
1066 public static final int CATEGORY_PRODUCTIVITY = 7;
1067
1068 /**
1069 * Return a concise, localized title for the given
1070 * {@link ApplicationInfo#category} value, or {@code null} for unknown
1071 * values such as {@link #CATEGORY_UNDEFINED}.
1072 *
1073 * @see #category
1074 */
1075 public static CharSequence getCategoryTitle(Context context, @Category int category) {
1076 switch (category) {
1077 case ApplicationInfo.CATEGORY_GAME:
1078 return context.getText(com.android.internal.R.string.app_category_game);
1079 case ApplicationInfo.CATEGORY_AUDIO:
1080 return context.getText(com.android.internal.R.string.app_category_audio);
1081 case ApplicationInfo.CATEGORY_VIDEO:
1082 return context.getText(com.android.internal.R.string.app_category_video);
1083 case ApplicationInfo.CATEGORY_IMAGE:
1084 return context.getText(com.android.internal.R.string.app_category_image);
1085 case ApplicationInfo.CATEGORY_SOCIAL:
1086 return context.getText(com.android.internal.R.string.app_category_social);
1087 case ApplicationInfo.CATEGORY_NEWS:
1088 return context.getText(com.android.internal.R.string.app_category_news);
1089 case ApplicationInfo.CATEGORY_MAPS:
1090 return context.getText(com.android.internal.R.string.app_category_maps);
1091 case ApplicationInfo.CATEGORY_PRODUCTIVITY:
1092 return context.getText(com.android.internal.R.string.app_category_productivity);
1093 default:
1094 return null;
1095 }
1096 }
1097
Narayan Kamathf9419f02017-06-15 11:35:38 +01001098 /** @hide */
1099 public String classLoaderName;
1100
1101 /** @hide */
1102 public String[] splitClassLoaderNames;
1103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001104 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001105 dump(pw, prefix, DUMP_FLAG_ALL);
1106 }
1107
1108 /** @hide */
Yohei Yukawa8f272172017-08-31 00:26:01 -07001109 public void dump(Printer pw, String prefix, int dumpFlags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 super.dumpFront(pw, prefix);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001111 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && className != null) {
Dianne Hackborn12527f92009-11-11 17:39:50 -08001112 pw.println(prefix + "className=" + className);
1113 }
1114 if (permission != null) {
1115 pw.println(prefix + "permission=" + permission);
1116 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001117 pw.println(prefix + "processName=" + processName);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001118 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001119 pw.println(prefix + "taskAffinity=" + taskAffinity);
1120 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001121 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001122 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -07001123 + " theme=0x" + Integer.toHexString(theme));
Yohei Yukawa8f272172017-08-31 00:26:01 -07001124 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001125 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
1126 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
1127 + " largestWidthLimitDp=" + largestWidthLimitDp);
1128 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001130 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -07001131 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
1132 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001133 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
1134 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
1135 }
1136 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
1137 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
1138 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
1139 }
Dianne Hackborn39792d22010-08-19 18:01:52 -07001140 if (resourceDirs != null) {
Andreas Gampee6748ce2015-12-11 18:00:38 -08001141 pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
Dianne Hackborn39792d22010-08-19 18:01:52 -07001142 }
Yohei Yukawa8f272172017-08-31 00:26:01 -07001143 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && seInfo != null) {
Todd Kennedybe0b8892017-02-15 14:13:52 -08001144 pw.println(prefix + "seinfo=" + seInfo);
1145 pw.println(prefix + "seinfoUser=" + seInfoUser);
Robert Craig0f40dc92013-03-25 06:33:03 -04001146 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 pw.println(prefix + "dataDir=" + dataDir);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001148 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001149 pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir);
1150 pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir);
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001151 if (sharedLibraryFiles != null) {
1152 pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
1153 }
Dianne Hackborn12527f92009-11-11 17:39:50 -08001154 }
Narayan Kamathf9419f02017-06-15 11:35:38 +01001155 if (classLoaderName != null) {
1156 pw.println(prefix + "classLoaderName=" + classLoaderName);
1157 }
1158 if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
1159 pw.println(prefix + "splitClassLoaderNames=" + Arrays.toString(splitClassLoaderNames));
1160 }
1161
Todd Kennedy89d60182016-03-11 11:18:32 -08001162 pw.println(prefix + "enabled=" + enabled
1163 + " minSdkVersion=" + minSdkVersion
1164 + " targetSdkVersion=" + targetSdkVersion
Todd Kennedy11e45072017-01-25 13:24:21 -08001165 + " versionCode=" + versionCode
1166 + " targetSandboxVersion=" + targetSandboxVersion);
Yohei Yukawa8f272172017-08-31 00:26:01 -07001167 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001168 if (manageSpaceActivityName != null) {
1169 pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
1170 }
1171 if (descriptionRes != 0) {
1172 pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes));
1173 }
1174 if (uiOptions != 0) {
1175 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
1176 }
1177 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
1178 if (fullBackupContent > 0) {
1179 pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
1180 } else {
1181 pw.println(prefix + "fullBackupContent="
1182 + (fullBackupContent < 0 ? "false" : "true"));
1183 }
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001184 if (networkSecurityConfigRes != 0) {
1185 pw.println(prefix + "networkSecurityConfigRes=0x"
1186 + Integer.toHexString(networkSecurityConfigRes));
1187 }
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001188 if (category != CATEGORY_UNDEFINED) {
1189 pw.println(prefix + "category=" + category);
1190 }
Matthew Williams303650c2015-04-17 18:22:51 -07001191 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001192 super.dumpBack(pw, prefix);
1193 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -07001194
Yi Jin148d7f42017-11-28 14:23:56 -08001195 /** {@hide} */
1196 public void writeToProto(ProtoOutputStream proto, long fieldId, int dumpFlags) {
1197 long token = proto.start(fieldId);
1198 super.writeToProto(proto, ApplicationInfoProto.PACKAGE);
1199 proto.write(ApplicationInfoProto.PERMISSION, permission);
1200 proto.write(ApplicationInfoProto.PROCESS_NAME, processName);
1201 proto.write(ApplicationInfoProto.UID, uid);
1202 proto.write(ApplicationInfoProto.FLAGS, flags);
1203 proto.write(ApplicationInfoProto.PRIVATE_FLAGS, privateFlags);
1204 proto.write(ApplicationInfoProto.THEME, theme);
1205 proto.write(ApplicationInfoProto.SOURCE_DIR, sourceDir);
1206 if (!Objects.equals(sourceDir, publicSourceDir)) {
1207 proto.write(ApplicationInfoProto.PUBLIC_SOURCE_DIR, publicSourceDir);
1208 }
1209 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
1210 for (String dir : splitSourceDirs) {
1211 proto.write(ApplicationInfoProto.SPLIT_SOURCE_DIRS, dir);
1212 }
1213 }
1214 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
1215 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
1216 for (String dir : splitPublicSourceDirs) {
1217 proto.write(ApplicationInfoProto.SPLIT_PUBLIC_SOURCE_DIRS, dir);
1218 }
1219 }
1220 if (resourceDirs != null) {
1221 for (String dir : resourceDirs) {
1222 proto.write(ApplicationInfoProto.RESOURCE_DIRS, dir);
1223 }
1224 }
1225 proto.write(ApplicationInfoProto.DATA_DIR, dataDir);
1226 proto.write(ApplicationInfoProto.CLASS_LOADER_NAME, classLoaderName);
1227 if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
1228 for (String name : splitClassLoaderNames) {
1229 proto.write(ApplicationInfoProto.SPLIT_CLASS_LOADER_NAMES, name);
1230 }
1231 }
1232
1233 long versionToken = proto.start(ApplicationInfoProto.VERSION);
1234 proto.write(ApplicationInfoProto.Version.ENABLED, enabled);
1235 proto.write(ApplicationInfoProto.Version.MIN_SDK_VERSION, minSdkVersion);
1236 proto.write(ApplicationInfoProto.Version.TARGET_SDK_VERSION, targetSdkVersion);
1237 proto.write(ApplicationInfoProto.Version.VERSION_CODE, versionCode);
1238 proto.write(ApplicationInfoProto.Version.TARGET_SANDBOX_VERSION, targetSandboxVersion);
1239 proto.end(versionToken);
1240
1241 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
1242 long detailToken = proto.start(ApplicationInfoProto.DETAIL);
1243 if (className != null) {
1244 proto.write(ApplicationInfoProto.Detail.CLASS_NAME, className);
1245 }
1246 proto.write(ApplicationInfoProto.Detail.TASK_AFFINITY, taskAffinity);
1247 proto.write(ApplicationInfoProto.Detail.REQUIRES_SMALLEST_WIDTH_DP,
1248 requiresSmallestWidthDp);
1249 proto.write(ApplicationInfoProto.Detail.COMPATIBLE_WIDTH_LIMIT_DP,
1250 compatibleWidthLimitDp);
1251 proto.write(ApplicationInfoProto.Detail.LARGEST_WIDTH_LIMIT_DP,
1252 largestWidthLimitDp);
1253 if (seInfo != null) {
1254 proto.write(ApplicationInfoProto.Detail.SEINFO, seInfo);
1255 proto.write(ApplicationInfoProto.Detail.SEINFO_USER, seInfoUser);
1256 }
1257 proto.write(ApplicationInfoProto.Detail.DEVICE_PROTECTED_DATA_DIR,
1258 deviceProtectedDataDir);
1259 proto.write(ApplicationInfoProto.Detail.CREDENTIAL_PROTECTED_DATA_DIR,
1260 credentialProtectedDataDir);
1261 if (sharedLibraryFiles != null) {
1262 for (String f : sharedLibraryFiles) {
1263 proto.write(ApplicationInfoProto.Detail.SHARED_LIBRARY_FILES, f);
1264 }
1265 }
1266 if (manageSpaceActivityName != null) {
1267 proto.write(ApplicationInfoProto.Detail.MANAGE_SPACE_ACTIVITY_NAME,
1268 manageSpaceActivityName);
1269 }
1270 if (descriptionRes != 0) {
1271 proto.write(ApplicationInfoProto.Detail.DESCRIPTION_RES, descriptionRes);
1272 }
1273 if (uiOptions != 0) {
1274 proto.write(ApplicationInfoProto.Detail.UI_OPTIONS, uiOptions);
1275 }
1276 proto.write(ApplicationInfoProto.Detail.SUPPORTS_RTL, hasRtlSupport());
1277 if (fullBackupContent > 0) {
1278 proto.write(ApplicationInfoProto.Detail.CONTENT, "@xml/" + fullBackupContent);
1279 } else {
1280 proto.write(ApplicationInfoProto.Detail.IS_FULL_BACKUP, fullBackupContent == 0);
1281 }
1282 if (networkSecurityConfigRes != 0) {
1283 proto.write(ApplicationInfoProto.Detail.NETWORK_SECURITY_CONFIG_RES,
1284 networkSecurityConfigRes);
1285 }
1286 if (category != CATEGORY_UNDEFINED) {
1287 proto.write(ApplicationInfoProto.Detail.CATEGORY, category);
1288 }
1289 proto.end(detailToken);
1290 }
1291 proto.end(token);
1292 }
1293
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -07001294 /**
1295 * @return true if "supportsRtl" has been set to true in the AndroidManifest
1296 * @hide
1297 */
1298 public boolean hasRtlSupport() {
1299 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
1300 }
Jeff Sharkeyba75a9b2016-01-07 11:51:33 -07001301
1302 /** {@hide} */
1303 public boolean hasCode() {
1304 return (flags & FLAG_HAS_CODE) != 0;
1305 }
1306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 public static class DisplayNameComparator
1308 implements Comparator<ApplicationInfo> {
1309 public DisplayNameComparator(PackageManager pm) {
1310 mPM = pm;
1311 }
1312
1313 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
1314 CharSequence sa = mPM.getApplicationLabel(aa);
1315 if (sa == null) {
1316 sa = aa.packageName;
1317 }
1318 CharSequence sb = mPM.getApplicationLabel(ab);
1319 if (sb == null) {
1320 sb = ab.packageName;
1321 }
1322
1323 return sCollator.compare(sa.toString(), sb.toString());
1324 }
1325
1326 private final Collator sCollator = Collator.getInstance();
1327 private PackageManager mPM;
1328 }
1329
1330 public ApplicationInfo() {
1331 }
1332
1333 public ApplicationInfo(ApplicationInfo orig) {
1334 super(orig);
1335 taskAffinity = orig.taskAffinity;
1336 permission = orig.permission;
1337 processName = orig.processName;
1338 className = orig.className;
1339 theme = orig.theme;
1340 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001341 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001342 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
1343 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001344 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07001345 volumeUuid = orig.volumeUuid;
Jeff Sharkey789a8fc2017-04-16 13:18:35 -06001346 storageUuid = orig.storageUuid;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001347 scanSourceDir = orig.scanSourceDir;
1348 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 sourceDir = orig.sourceDir;
1350 publicSourceDir = orig.publicSourceDir;
Adam Lesinski4e862812016-11-21 16:02:24 -08001351 splitNames = orig.splitNames;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001352 splitSourceDirs = orig.splitSourceDirs;
1353 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Adam Lesinski4e862812016-11-21 16:02:24 -08001354 splitDependencies = orig.splitDependencies;
Kenny Root85387d72010-08-26 10:13:11 -07001355 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001356 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -07001357 nativeLibraryRootDir = orig.nativeLibraryRootDir;
1358 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +01001359 primaryCpuAbi = orig.primaryCpuAbi;
1360 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -08001361 resourceDirs = orig.resourceDirs;
Todd Kennedybe0b8892017-02-15 14:13:52 -08001362 seInfo = orig.seInfo;
1363 seInfoUser = orig.seInfoUser;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 sharedLibraryFiles = orig.sharedLibraryFiles;
1365 dataDir = orig.dataDir;
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001366 deviceProtectedDataDir = orig.deviceProtectedDataDir;
1367 credentialProtectedDataDir = orig.credentialProtectedDataDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 uid = orig.uid;
Todd Kennedy89d60182016-03-11 11:18:32 -08001369 minSdkVersion = orig.minSdkVersion;
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001370 targetSdkVersion = orig.targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -08001371 versionCode = orig.versionCode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001373 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001374 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 manageSpaceActivityName = orig.manageSpaceActivityName;
1376 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -07001377 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -07001378 backupAgentName = orig.backupAgentName;
Matthew Williams303650c2015-04-17 18:22:51 -07001379 fullBackupContent = orig.fullBackupContent;
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001380 networkSecurityConfigRes = orig.networkSecurityConfigRes;
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001381 category = orig.category;
Todd Kennedy11e45072017-01-25 13:24:21 -08001382 targetSandboxVersion = orig.targetSandboxVersion;
Narayan Kamathf9419f02017-06-15 11:35:38 +01001383 classLoaderName = orig.classLoaderName;
1384 splitClassLoaderNames = orig.splitClassLoaderNames;
Jason Monka80bfb52017-11-16 17:15:37 -05001385 appComponentFactory = orig.appComponentFactory;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 }
1387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 public String toString() {
1389 return "ApplicationInfo{"
1390 + Integer.toHexString(System.identityHashCode(this))
1391 + " " + packageName + "}";
1392 }
1393
1394 public int describeContents() {
1395 return 0;
1396 }
1397
Adam Lesinski4e862812016-11-21 16:02:24 -08001398 @SuppressWarnings("unchecked")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 public void writeToParcel(Parcel dest, int parcelableFlags) {
1400 super.writeToParcel(dest, parcelableFlags);
1401 dest.writeString(taskAffinity);
1402 dest.writeString(permission);
1403 dest.writeString(processName);
1404 dest.writeString(className);
1405 dest.writeInt(theme);
1406 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001407 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001408 dest.writeInt(requiresSmallestWidthDp);
1409 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001410 dest.writeInt(largestWidthLimitDp);
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001411 if (storageUuid != null) {
1412 dest.writeInt(1);
Jeff Sharkeya4d34d92017-04-27 11:21:41 -06001413 dest.writeLong(storageUuid.getMostSignificantBits());
1414 dest.writeLong(storageUuid.getLeastSignificantBits());
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001415 } else {
1416 dest.writeInt(0);
1417 }
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001418 dest.writeString(scanSourceDir);
1419 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001420 dest.writeString(sourceDir);
1421 dest.writeString(publicSourceDir);
Adam Lesinski4e862812016-11-21 16:02:24 -08001422 dest.writeStringArray(splitNames);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001423 dest.writeStringArray(splitSourceDirs);
1424 dest.writeStringArray(splitPublicSourceDirs);
Adam Lesinski1665d0f2017-03-10 14:46:57 -08001425 dest.writeSparseArray((SparseArray) splitDependencies);
Kenny Root85387d72010-08-26 10:13:11 -07001426 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001427 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -07001428 dest.writeString(nativeLibraryRootDir);
1429 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +01001430 dest.writeString(primaryCpuAbi);
1431 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -08001432 dest.writeStringArray(resourceDirs);
Todd Kennedybe0b8892017-02-15 14:13:52 -08001433 dest.writeString(seInfo);
1434 dest.writeString(seInfoUser);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001435 dest.writeStringArray(sharedLibraryFiles);
1436 dest.writeString(dataDir);
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001437 dest.writeString(deviceProtectedDataDir);
1438 dest.writeString(credentialProtectedDataDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001439 dest.writeInt(uid);
Todd Kennedy6e2e7f52016-05-02 14:56:45 -07001440 dest.writeInt(minSdkVersion);
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001441 dest.writeInt(targetSdkVersion);
Dianne Hackborn3accca02013-09-20 09:32:11 -07001442 dest.writeLong(versionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001444 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001445 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001446 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -07001447 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001448 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -07001449 dest.writeInt(uiOptions);
Matthew Williams303650c2015-04-17 18:22:51 -07001450 dest.writeInt(fullBackupContent);
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001451 dest.writeInt(networkSecurityConfigRes);
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001452 dest.writeInt(category);
Todd Kennedy11e45072017-01-25 13:24:21 -08001453 dest.writeInt(targetSandboxVersion);
Narayan Kamathf9419f02017-06-15 11:35:38 +01001454 dest.writeString(classLoaderName);
1455 dest.writeStringArray(splitClassLoaderNames);
Alan Viveretteb6a25732017-11-21 14:49:24 -05001456 dest.writeInt(compileSdkVersion);
1457 dest.writeString(compileSdkVersionCodename);
Jason Monka80bfb52017-11-16 17:15:37 -05001458 dest.writeString(appComponentFactory);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001459 }
1460
1461 public static final Parcelable.Creator<ApplicationInfo> CREATOR
1462 = new Parcelable.Creator<ApplicationInfo>() {
1463 public ApplicationInfo createFromParcel(Parcel source) {
1464 return new ApplicationInfo(source);
1465 }
1466 public ApplicationInfo[] newArray(int size) {
1467 return new ApplicationInfo[size];
1468 }
1469 };
1470
Adam Lesinski4e862812016-11-21 16:02:24 -08001471 @SuppressWarnings("unchecked")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 private ApplicationInfo(Parcel source) {
1473 super(source);
1474 taskAffinity = source.readString();
1475 permission = source.readString();
1476 processName = source.readString();
1477 className = source.readString();
1478 theme = source.readInt();
1479 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -08001480 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -07001481 requiresSmallestWidthDp = source.readInt();
1482 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -07001483 largestWidthLimitDp = source.readInt();
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001484 if (source.readInt() != 0) {
Jeff Sharkeya4d34d92017-04-27 11:21:41 -06001485 storageUuid = new UUID(source.readLong(), source.readLong());
Jeff Sharkey67c8c1e2017-04-19 11:22:02 -06001486 volumeUuid = StorageManager.convert(storageUuid);
1487 }
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -07001488 scanSourceDir = source.readString();
1489 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 sourceDir = source.readString();
1491 publicSourceDir = source.readString();
Adam Lesinski4e862812016-11-21 16:02:24 -08001492 splitNames = source.readStringArray();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -07001493 splitSourceDirs = source.readStringArray();
1494 splitPublicSourceDirs = source.readStringArray();
Adam Lesinski1665d0f2017-03-10 14:46:57 -08001495 splitDependencies = source.readSparseArray(null);
Kenny Root85387d72010-08-26 10:13:11 -07001496 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +01001497 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -07001498 nativeLibraryRootDir = source.readString();
1499 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +01001500 primaryCpuAbi = source.readString();
1501 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -08001502 resourceDirs = source.readStringArray();
Todd Kennedybe0b8892017-02-15 14:13:52 -08001503 seInfo = source.readString();
1504 seInfoUser = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001505 sharedLibraryFiles = source.readStringArray();
1506 dataDir = source.readString();
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001507 deviceProtectedDataDir = source.readString();
1508 credentialProtectedDataDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001509 uid = source.readInt();
Todd Kennedy6e2e7f52016-05-02 14:56:45 -07001510 minSdkVersion = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -07001511 targetSdkVersion = source.readInt();
Dianne Hackborn3accca02013-09-20 09:32:11 -07001512 versionCode = source.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001513 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -07001514 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -07001515 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -07001517 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -07001519 uiOptions = source.readInt();
Matthew Williams303650c2015-04-17 18:22:51 -07001520 fullBackupContent = source.readInt();
Chad Brubakerc845b2a2016-05-13 14:09:27 -07001521 networkSecurityConfigRes = source.readInt();
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07001522 category = source.readInt();
Todd Kennedy11e45072017-01-25 13:24:21 -08001523 targetSandboxVersion = source.readInt();
Narayan Kamathf9419f02017-06-15 11:35:38 +01001524 classLoaderName = source.readString();
1525 splitClassLoaderNames = source.readStringArray();
Alan Viveretteb6a25732017-11-21 14:49:24 -05001526 compileSdkVersion = source.readInt();
1527 compileSdkVersionCodename = source.readString();
Jason Monka80bfb52017-11-16 17:15:37 -05001528 appComponentFactory = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 /**
1532 * Retrieve the textual description of the application. This
1533 * will call back on the given PackageManager to load the description from
1534 * the application.
1535 *
1536 * @param pm A PackageManager from which the label can be loaded; usually
1537 * the PackageManager from which you originally retrieved this item.
1538 *
1539 * @return Returns a CharSequence containing the application's description.
1540 * If there is no description, null is returned.
1541 */
1542 public CharSequence loadDescription(PackageManager pm) {
1543 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -07001544 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001545 if (label != null) {
1546 return label;
1547 }
1548 }
1549 return null;
1550 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001551
1552 /**
1553 * Disable compatibility mode
1554 *
1555 * @hide
1556 */
1557 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -07001558 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -07001559 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -07001560 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001561 }
Jeff Sharkey15447792015-11-05 16:18:51 -08001562
skuhne@google.com7e85eb02017-01-04 13:49:54 -08001563 /**
1564 * Is using compatibility mode for non densty aware legacy applications.
1565 *
1566 * @hide
1567 */
1568 public boolean usesCompatibilityMode() {
1569 return targetSdkVersion < DONUT ||
1570 (flags & (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
1571 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
1572 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS)) == 0;
1573 }
1574
Jeff Sharkey15447792015-11-05 16:18:51 -08001575 /** {@hide} */
1576 public void initForUser(int userId) {
1577 uid = UserHandle.getUid(userId, UserHandle.getAppId(uid));
1578
1579 if ("android".equals(packageName)) {
1580 dataDir = Environment.getDataSystemDirectory().getAbsolutePath();
1581 return;
1582 }
1583
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001584 deviceProtectedDataDir = Environment
Jeff Sharkey8212ae02016-02-10 14:46:43 -07001585 .getDataUserDePackageDirectory(volumeUuid, userId, packageName)
Jeff Sharkey15447792015-11-05 16:18:51 -08001586 .getAbsolutePath();
Jeff Sharkeydd9bda82017-02-23 17:38:31 -07001587 credentialProtectedDataDir = Environment
Jeff Sharkey8212ae02016-02-10 14:46:43 -07001588 .getDataUserCePackageDirectory(volumeUuid, userId, packageName)
Jeff Sharkey15447792015-11-05 16:18:51 -08001589 .getAbsolutePath();
1590
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001591 if ((privateFlags & PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0
1592 && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) {
1593 dataDir = deviceProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -08001594 } else {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001595 dataDir = credentialProtectedDataDir;
Jeff Sharkey15447792015-11-05 16:18:51 -08001596 }
1597 }
1598
Jeff Brown07330792010-03-30 19:57:08 -07001599 /**
1600 * @hide
1601 */
David Brazdil464ed3d2018-01-18 15:25:18 +00001602 public boolean isAllowedToUseHiddenApi() {
1603 return isSystemApp();
1604 }
1605
1606 /**
1607 * @hide
1608 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +01001609 @Override
1610 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -07001611 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
1612 && isPackageUnavailable(pm)) {
1613 return Resources.getSystem().getDrawable(
1614 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
1615 }
1616 return pm.getDefaultActivityIcon();
1617 }
1618
1619 private boolean isPackageUnavailable(PackageManager pm) {
1620 try {
1621 return pm.getPackageInfo(packageName, 0) == null;
1622 } catch (NameNotFoundException ex) {
1623 return true;
1624 }
1625 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -07001626
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -08001627 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001628 public boolean isDefaultToDeviceProtectedStorage() {
1629 return (privateFlags
1630 & ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0;
Jeff Sharkeye4697132016-02-06 19:46:15 -07001631 }
1632
1633 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001634 public boolean isDirectBootAware() {
1635 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE) != 0;
Jeff Sharkeyf9fc6d62015-11-08 16:46:05 -08001636 }
1637
Jeff Sharkey8924e872015-11-30 12:52:10 -07001638 /** @hide */
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001639 public boolean isEncryptionAware() {
1640 return isDirectBootAware() || isPartiallyDirectBootAware();
1641 }
1642
1643 /** @hide */
1644 public boolean isExternal() {
1645 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
1646 }
1647
1648 /** @hide */
1649 public boolean isExternalAsec() {
1650 return TextUtils.isEmpty(volumeUuid) && isExternal();
1651 }
1652
1653 /** @hide */
1654 public boolean isForwardLocked() {
1655 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
1656 }
1657
1658 /** @hide */
1659 public boolean isInstantApp() {
1660 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_INSTANT) != 0;
1661 }
1662
1663 /** @hide */
1664 public boolean isInternal() {
1665 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
1666 }
1667
1668 /** @hide */
1669 public boolean isOem() {
1670 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_OEM) != 0;
1671 }
1672
1673 /** @hide */
Jeff Sharkey8a372a02016-03-16 16:25:45 -06001674 public boolean isPartiallyDirectBootAware() {
1675 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0;
Jeff Sharkey8924e872015-11-30 12:52:10 -07001676 }
1677
Bryce Lee8558ec72017-08-17 15:37:26 -07001678 /** @hide */
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001679 @TestApi
1680 public boolean isPrivilegedApp() {
1681 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0;
Bryce Lee8558ec72017-08-17 15:37:26 -07001682 }
1683
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001684 /** @hide */
Fyodor Kupolovbdbc9692015-12-14 13:11:13 -08001685 public boolean isRequiredForSystemUser() {
1686 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER) != 0;
1687 }
1688
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001689 /** @hide */
Svet Ganov67882122016-12-11 16:36:34 -08001690 public boolean isStaticSharedLibrary() {
1691 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_STATIC_SHARED_LIBRARY) != 0;
1692 }
1693
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001694 /** @hide */
1695 @TestApi
1696 public boolean isSystemApp() {
1697 return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
1698 }
1699
1700 /** @hide */
1701 public boolean isUpdatedSystemApp() {
1702 return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
1703 }
1704
Jiyong Park002fdbd2017-02-13 20:50:31 +09001705 /** @hide */
1706 public boolean isVendor() {
1707 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_VENDOR) != 0;
1708 }
1709
Jaekyun Seok1713d9e2018-01-12 21:47:26 +09001710 /** @hide */
1711 public boolean isProduct() {
1712 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
1713 }
1714
Svet Ganov67882122016-12-11 16:36:34 -08001715 /**
Todd Kennedy5eb5a7d2017-08-01 07:42:47 -07001716 * Returns whether or not this application was installed as a virtual preload.
1717 */
1718 public boolean isVirtualPreload() {
1719 return (privateFlags & PRIVATE_FLAG_VIRTUAL_PRELOAD) != 0;
1720 }
1721
1722 /**
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001723 * Returns true if the app has declared in its manifest that it wants its split APKs to be
1724 * loaded into isolated Contexts, with their own ClassLoaders and Resources objects.
Svet Ganov67882122016-12-11 16:36:34 -08001725 * @hide
1726 */
Todd Kennedyc29b11a2017-10-23 15:55:59 -07001727 public boolean requestsIsolatedSplitLoading() {
1728 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ISOLATED_SPLIT_LOADING) != 0;
Svet Ganov087dce22017-09-07 15:42:16 -07001729 }
1730
1731 /**
1732 * @hide
1733 */
Jeff Brown07330792010-03-30 19:57:08 -07001734 @Override protected ApplicationInfo getApplicationInfo() {
1735 return this;
1736 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -07001737
1738 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
1739 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
1740 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
1741 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
1742 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
1743 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
1744
1745 /** {@hide} */ public String getCodePath() { return scanSourceDir; }
1746 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
1747 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
1748 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
1749 /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
Jeff Sharkeya3a43b02016-11-15 17:54:23 -07001750 /** {@hide} */ public String[] getSplitResourcePaths() { return splitPublicSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001751}