blob: 6c328739a8d89852aac799051c4b31ecc2cb546a [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 Brown07330792010-03-30 19:57:08 -070019import android.content.pm.PackageManager.NameNotFoundException;
20import android.content.res.Resources;
21import android.graphics.drawable.Drawable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.os.Parcel;
23import android.os.Parcelable;
Jeff Sharkeye2d45be2015-04-15 17:14:12 -070024import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.util.Printer;
26
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070027import com.android.internal.util.ArrayUtils;
28
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import java.text.Collator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070030import java.util.Arrays;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import java.util.Comparator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070032import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033
34/**
35 * Information you can retrieve about a particular application. This
36 * corresponds to information collected from the AndroidManifest.xml's
37 * <application> tag.
38 */
39public class ApplicationInfo extends PackageItemInfo implements Parcelable {
40
41 /**
42 * Default task affinity of all activities in this application. See
43 * {@link ActivityInfo#taskAffinity} for more information. This comes
44 * from the "taskAffinity" attribute.
45 */
46 public String taskAffinity;
47
48 /**
49 * Optional name of a permission required to be able to access this
50 * application's components. From the "permission" attribute.
51 */
52 public String permission;
53
54 /**
55 * The name of the process this application should run in. From the
56 * "process" attribute or, if not set, the same as
57 * <var>packageName</var>.
58 */
59 public String processName;
60
61 /**
62 * Class implementing the Application object. From the "class"
63 * attribute.
64 */
65 public String className;
66
67 /**
68 * A style resource identifier (in the package's resources) of the
69 * description of an application. From the "description" attribute
70 * or, if not set, 0.
71 */
72 public int descriptionRes;
73
74 /**
75 * A style resource identifier (in the package's resources) of the
76 * default visual theme of the application. From the "theme" attribute
77 * or, if not set, 0.
78 */
79 public int theme;
80
81 /**
82 * Class implementing the Application's manage space
83 * functionality. From the "manageSpaceActivity"
84 * attribute. This is an optional attribute and will be null if
Christopher Tate181fafa2009-05-14 11:12:14 -070085 * applications don't specify it in their manifest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
87 public String manageSpaceActivityName;
88
89 /**
Christopher Tate181fafa2009-05-14 11:12:14 -070090 * Class implementing the Application's backup functionality. From
91 * the "backupAgent" attribute. This is an optional attribute and
92 * will be null if the application does not specify it in its manifest.
93 *
94 * <p>If android:allowBackup is set to false, this attribute is ignored.
Christopher Tate181fafa2009-05-14 11:12:14 -070095 */
96 public String backupAgentName;
Christopher Tate4a627c72011-04-01 14:43:32 -070097
98 /**
Adam Powell269248d2011-08-02 10:26:54 -070099 * The default extra UI options for activities in this application.
100 * Set from the {@link android.R.attr#uiOptions} attribute in the
101 * activity's manifest.
102 */
103 public int uiOptions = 0;
104
105 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 * Value for {@link #flags}: if set, this application is installed in the
107 * device's system image.
108 */
109 public static final int FLAG_SYSTEM = 1<<0;
110
111 /**
112 * Value for {@link #flags}: set to true if this application would like to
113 * allow debugging of its
114 * code, even when installed on a non-development system. Comes
115 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
116 * android:debuggable} of the &lt;application&gt; tag.
117 */
118 public static final int FLAG_DEBUGGABLE = 1<<1;
119
120 /**
121 * Value for {@link #flags}: set to true if this application has code
122 * associated with it. Comes
123 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
124 * android:hasCode} of the &lt;application&gt; tag.
125 */
126 public static final int FLAG_HAS_CODE = 1<<2;
127
128 /**
129 * Value for {@link #flags}: set to true if this application is persistent.
130 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
131 * android:persistent} of the &lt;application&gt; tag.
132 */
133 public static final int FLAG_PERSISTENT = 1<<3;
134
135 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700136 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
138 * device is running in factory test mode.
139 */
140 public static final int FLAG_FACTORY_TEST = 1<<4;
141
142 /**
143 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
144 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
145 * android:allowTaskReparenting} of the &lt;application&gt; tag.
146 */
147 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
148
149 /**
150 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
151 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
152 * android:allowClearUserData} of the &lt;application&gt; tag.
153 */
154 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
155
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700157 * Value for {@link #flags}: this is set if this application has been
158 * install as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 */
160 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700161
162 /**
Dianne Hackborn7f205432009-07-28 00:13:47 -0700163 * Value for {@link #flags}: this is set of the application has specified
164 * {@link android.R.styleable#AndroidManifestApplication_testOnly
165 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700166 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700167 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700168
169 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700170 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700171 * reduced in size for smaller screens. Corresponds to
172 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
173 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700174 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700175 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
176
177 /**
178 * Value for {@link #flags}: true when the application's window can be
179 * displayed on normal screens. Corresponds to
180 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
181 * android:normalScreens}.
182 */
183 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
184
185 /**
186 * Value for {@link #flags}: true when the application's window can be
187 * increased in size for larger screens. Corresponds to
188 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700189 * android:largeScreens}.
Dianne Hackborn723738c2009-06-25 19:48:04 -0700190 */
191 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700192
193 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700194 * Value for {@link #flags}: true when the application knows how to adjust
195 * its UI for different screen sizes. Corresponds to
196 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
197 * android:resizeable}.
198 */
199 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
200
201 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700202 * Value for {@link #flags}: true when the application knows how to
203 * accomodate different screen densities. Corresponds to
204 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
205 * android:anyDensity}.
206 */
207 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
208
209 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800210 * Value for {@link #flags}: set to true if this application would like to
211 * request the VM to operate under the safe mode. Comes from
Ben Chengef3f5dd2010-03-29 15:47:26 -0700212 * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode
213 * android:vmSafeMode} of the &lt;application&gt; tag.
Ben Cheng23085b72010-02-08 16:06:32 -0800214 */
215 public static final int FLAG_VM_SAFE_MODE = 1<<14;
216
217 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800218 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
219 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700220 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800221 * <p>Comes from the
222 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
223 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700224 */
Ben Cheng23085b72010-02-08 16:06:32 -0800225 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700226
227 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800228 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
229 * in memory following a full-system restore operation; <code>true</code> otherwise.
230 * Ordinarily, during a full system restore operation each application is shut down
231 * following execution of its agent's onRestore() method. Setting this attribute to
232 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700233 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800234 * <p>If
235 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
236 * is set to <code>false</code> or no
237 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700238 * is specified, this flag will be ignored.
239 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800240 * <p>Comes from the
241 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
242 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700243 */
Ben Cheng23085b72010-02-08 16:06:32 -0800244 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700245
246 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800247 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
248 * agent claims to be able to handle restore data even "from the future,"
249 * i.e. from versions of the application with a versionCode greater than
250 * the one currently installed on the device. <i>Use with caution!</i> By default
251 * this attribute is <code>false</code> and the Backup Manager will ensure that data
252 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700253 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800254 * <p>If
255 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
256 * is set to <code>false</code> or no
257 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700258 * is specified, this flag will be ignored.
259 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800260 * <p>Comes from the
261 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
262 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700263 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800264 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700265
Christopher Tate181fafa2009-05-14 11:12:14 -0700266 /**
Dianne Hackborn3202d382010-04-26 17:51:34 -0700267 * Value for {@link #flags}: Set to true if the application is
268 * currently installed on external/removable/unprotected storage. Such
269 * applications may not be available if their storage is not currently
270 * mounted. When the storage it is on is not available, it will look like
271 * the application has been uninstalled (its .apk is no longer available)
272 * but its persistent data is not removed.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800273 */
Dianne Hackborn94c567e2010-04-26 18:13:10 -0700274 public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800275
276 /**
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700277 * Value for {@link #flags}: true when the application's window can be
278 * increased in size for extra large screens. Corresponds to
279 * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700280 * android:xlargeScreens}.
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700281 */
282 public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
283
284 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800285 * Value for {@link #flags}: true when the application has requested a
286 * large heap for its processes. Corresponds to
287 * {@link android.R.styleable#AndroidManifestApplication_largeHeap
288 * android:largeHeap}.
Jason parksa3cdaa52011-01-13 14:15:43 -0600289 */
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800290 public static final int FLAG_LARGE_HEAP = 1<<20;
Jason parksa3cdaa52011-01-13 14:15:43 -0600291
292 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800293 * Value for {@link #flags}: true if this application's package is in
294 * the stopped state.
295 */
296 public static final int FLAG_STOPPED = 1<<21;
297
298 /**
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700299 * Value for {@link #flags}: true when the application is willing to support
300 * RTL (right to left). All activities will inherit this value.
301 *
302 * Set from the {@link android.R.attr#supportsRtl} attribute in the
303 * activity's manifest.
304 *
305 * Default value is false (no support for RTL).
306 */
307 public static final int FLAG_SUPPORTS_RTL = 1<<22;
308
309 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700310 * Value for {@link #flags}: true if the application is currently
311 * installed for the calling user.
312 */
313 public static final int FLAG_INSTALLED = 1<<23;
314
315 /**
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700316 * Value for {@link #flags}: true if the application only has its
317 * data installed; the application package itself does not currently
318 * exist on the device.
319 */
320 public static final int FLAG_IS_DATA_ONLY = 1<<24;
321
322 /**
Jose Lima12d0b4c2014-03-14 16:55:12 -0700323 * Value for {@link #flags}: true if the application was declared to be a game, or
324 * false if it is a non-game application.
325 */
326 public static final int FLAG_IS_GAME = 1<<25;
327
328 /**
Christopher Tated1de2562014-06-17 17:12:35 -0700329 * Value for {@link #flags}: {@code true} if the application asks that only
330 * full-data streaming backups of its data be performed even though it defines
331 * a {@link android.app.backup.BackupAgent BackupAgent}, which normally
332 * indicates that the app will manage its backed-up data via incremental
333 * key/value updates.
334 */
335 public static final int FLAG_FULL_BACKUP_ONLY = 1<<26;
336
337 /**
Alex Klyubin01a959d2015-03-18 10:05:45 -0700338 * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic
339 * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
340 * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
341 * cleartext network traffic, in which case platform components (e.g., HTTP stacks,
Alex Klyubinfbf45992015-04-21 13:44:29 -0700342 * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext
343 * traffic. Third-party libraries are encouraged to honor this flag as well.
344 *
345 * <p>NOTE: {@code WebView} does not honor this flag.
346 *
347 * <p>This flag comes from
348 * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic
349 * android:usesCleartextTraffic} of the &lt;application&gt; tag.
Alex Klyubin01a959d2015-03-18 10:05:45 -0700350 */
351 public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
352
353 /**
Dmitriy Ivanovff193d62014-09-30 15:10:48 -0700354 * When set installer extracts native libs from .apk files.
355 */
356 public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
357
358 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100359 * Value for {@link #flags}: true if code from this application will need to be
360 * loaded into other applications' processes. On devices that support multiple
361 * instruction sets, this implies the code might be loaded into a process that's
362 * using any of the devices supported instruction sets.
363 *
364 * <p> The system might treat such applications specially, for eg., by
365 * extracting the application's native libraries for all supported instruction
366 * sets or by compiling the application's dex code for all supported instruction
367 * sets.
368 */
369 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700370
371 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 * Flags associated with the application. Any combination of
373 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
374 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
375 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700376 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700377 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
378 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700379 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
380 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700381 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800382 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
383 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
384 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
385 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
386 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
Alex Klyubin7cb000f2015-03-26 11:00:04 -0700387 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC},
388 * {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 */
390 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700391
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800393 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
394 * most purposes is considered as not installed.
395 * {@hide}
396 */
397 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
398
399 /**
400 * Value for {@link #privateFlags}: set to <code>true</code> if the application
401 * has reported that it is heavy-weight, and thus can not participate in
402 * the normal application lifecycle.
403 *
404 * <p>Comes from the
405 * android.R.styleable#AndroidManifestApplication_cantSaveState
406 * attribute of the &lt;application&gt; tag.
407 *
408 * {@hide}
409 */
410 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
411
412 /**
413 * Value for {@link #privateFlags}: Set to true if the application has been
414 * installed using the forward lock option.
415 *
416 * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml.
417 *
418 * {@hide}
419 */
420 public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2;
421
422 /**
423 * Value for {@link #privateFlags}: set to {@code true} if the application
424 * is permitted to hold privileged permissions.
425 *
426 * {@hide}
427 */
428 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
429
430 /**
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700431 * Value for {@link #flags}: {@code true} if the application has any IntentFiler with some
432 * data URI using HTTP or HTTPS with an associated VIEW action.
433 *
434 * {@hide}
435 */
436 public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
437
438 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800439 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
440 * {@hide}
441 */
442 public int privateFlags;
443
444 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700445 * The required smallest screen width the application can run on. If 0,
446 * nothing has been specified. Comes from
447 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
448 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
449 */
450 public int requiresSmallestWidthDp = 0;
451
452 /**
453 * The maximum smallest screen width the application is designed for. If 0,
454 * nothing has been specified. Comes from
455 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
456 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
457 */
458 public int compatibleWidthLimitDp = 0;
459
460 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700461 * The maximum smallest screen width the application will work on. If 0,
462 * nothing has been specified. Comes from
463 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
464 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
465 */
466 public int largestWidthLimitDp = 0;
467
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700468 /** {@hide} */
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700469 public String volumeUuid;
470 /** {@hide} */
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700471 public String scanSourceDir;
472 /** {@hide} */
473 public String scanPublicSourceDir;
474
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700475 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700476 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 */
478 public String sourceDir;
479
480 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700481 * Full path to the publicly available parts of {@link #sourceDir},
482 * including resources and manifest. This may be different from
483 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 */
485 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700486
487 /**
488 * Full paths to zero or more split APKs that, when combined with the base
489 * APK defined in {@link #sourceDir}, form a complete application.
490 */
491 public String[] splitSourceDirs;
492
493 /**
494 * Full path to the publicly available parts of {@link #splitSourceDirs},
495 * including resources and manifest. This may be different from
496 * {@link #splitSourceDirs} if an application is forward locked.
497 */
498 public String[] splitPublicSourceDirs;
499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800501 * Full paths to the locations of extra resource packages this application
502 * uses. This field is only used if there are extra resource packages,
503 * otherwise it is null.
Kenny Rootace5a3f2010-02-05 12:59:28 -0800504 *
505 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800506 */
507 public String[] resourceDirs;
508
509 /**
Robert Craig0f40dc92013-03-25 06:33:03 -0400510 * String retrieved from the seinfo tag found in selinux policy. This value
511 * is useful in setting an SELinux security context on the process as well
512 * as its data directory.
513 *
514 * {@hide}
515 */
516 public String seinfo;
517
518 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 * Paths to all shared libraries this application is linked against. This
520 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
521 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
522 * the structure.
523 */
524 public String[] sharedLibraryFiles;
525
526 /**
527 * Full path to a directory assigned to the package for its persistent
528 * data.
529 */
530 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700531
532 /**
533 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700534 */
535 public String nativeLibraryDir;
536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100538 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
539 * are stored, if present.
540 *
541 * The main reason this exists is for bundled multi-arch apps, where
542 * it's not trivial to calculate the location of libs for the secondary abi
543 * given the location of the primary.
544 *
545 * TODO: Change the layout of bundled installs so that we can use
546 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
547 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
548 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
549 *
550 * @hide
551 */
552 public String secondaryNativeLibraryDir;
553
554 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700555 * The root path where unpacked native libraries are stored.
556 * <p>
557 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
558 * placed in ISA-specific subdirectories under this path, otherwise the
559 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100560 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700561 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100562 */
Jeff Sharkey84f12942014-07-10 17:48:11 -0700563 public String nativeLibraryRootDir;
564
565 /**
566 * Flag indicating that ISA must be appended to
567 * {@link #nativeLibraryRootDir} to be useful.
568 *
569 * @hide
570 */
571 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100572
573 /**
574 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100575 * of the native JNI libraries the application bundles. Will be {@code null}
576 * if this application does not require any particular ABI.
577 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100578 * If non-null, the application will always be launched with this ABI.
579 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100580 * {@hide}
581 */
Narayan Kamathff110bd2014-07-04 18:30:45 +0100582 public String primaryCpuAbi;
583
584 /**
585 * The secondary ABI for this application. Might be non-null for multi-arch
586 * installs. The application itself never uses this ABI, but other applications that
587 * use its code might.
588 *
589 * {@hide}
590 */
591 public String secondaryCpuAbi;
592
593 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800594 * The kernel user-ID that has been assigned to this application;
595 * currently this is not a unique ID (multiple applications can have
596 * the same uid).
597 */
598 public int uid;
599
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700600 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700601 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700602 * versions, but it knows how to work with any new behavior added at this
603 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
604 * if this is a development build and the app is targeting that. You should
605 * compare that this number is >= the SDK version number at which your
606 * behavior was introduced.
607 */
608 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800609
610 /**
611 * The app's declared version code.
612 * @hide
613 */
614 public int versionCode;
615
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700616 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800617 * When false, indicates that all components within this application are
618 * considered disabled, regardless of their individually set enabled status.
619 */
620 public boolean enabled = true;
621
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700622 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700623 * For convenient access to the current enabled setting of this app.
624 * @hide
625 */
626 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
627
628 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700629 * For convenient access to package's install location.
630 * @hide
631 */
632 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -0700633
Alan Viverette9b0ab652015-03-18 14:21:04 -0700634 /**
635 * True when the application's rendering should be hardware accelerated.
636 */
637 public boolean hardwareAccelerated;
638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 public void dump(Printer pw, String prefix) {
640 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800641 if (className != null) {
642 pw.println(prefix + "className=" + className);
643 }
644 if (permission != null) {
645 pw.println(prefix + "permission=" + permission);
646 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700647 pw.println(prefix + "processName=" + processName);
648 pw.println(prefix + "taskAffinity=" + taskAffinity);
649 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800650 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -0700651 + " theme=0x" + Integer.toHexString(theme));
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700652 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700653 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
654 + " largestWidthLimitDp=" + largestWidthLimitDp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800655 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700656 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -0700657 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
658 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700659 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
660 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
661 }
662 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
663 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
664 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
665 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700666 if (resourceDirs != null) {
667 pw.println(prefix + "resourceDirs=" + resourceDirs);
668 }
Robert Craig0f40dc92013-03-25 06:33:03 -0400669 if (seinfo != null) {
670 pw.println(prefix + "seinfo=" + seinfo);
671 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 pw.println(prefix + "dataDir=" + dataDir);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800673 if (sharedLibraryFiles != null) {
Flavio Lerdadcc36bf2015-03-25 10:22:05 +0000674 pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
Dianne Hackborn12527f92009-11-11 17:39:50 -0800675 }
Dianne Hackborn8472e612014-01-23 17:57:20 -0800676 pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
677 + " versionCode=" + versionCode);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700678 pw.println(prefix + "hardwareAccelerated=" + hardwareAccelerated);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800679 if (manageSpaceActivityName != null) {
680 pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
681 }
682 if (descriptionRes != 0) {
683 pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
684 }
Adam Powell269248d2011-08-02 10:26:54 -0700685 if (uiOptions != 0) {
686 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
687 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700688 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 super.dumpBack(pw, prefix);
690 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700691
692 /**
693 * @return true if "supportsRtl" has been set to true in the AndroidManifest
694 * @hide
695 */
696 public boolean hasRtlSupport() {
697 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
698 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800699
700 public static class DisplayNameComparator
701 implements Comparator<ApplicationInfo> {
702 public DisplayNameComparator(PackageManager pm) {
703 mPM = pm;
704 }
705
706 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
707 CharSequence sa = mPM.getApplicationLabel(aa);
708 if (sa == null) {
709 sa = aa.packageName;
710 }
711 CharSequence sb = mPM.getApplicationLabel(ab);
712 if (sb == null) {
713 sb = ab.packageName;
714 }
715
716 return sCollator.compare(sa.toString(), sb.toString());
717 }
718
719 private final Collator sCollator = Collator.getInstance();
720 private PackageManager mPM;
721 }
722
723 public ApplicationInfo() {
724 }
725
726 public ApplicationInfo(ApplicationInfo orig) {
727 super(orig);
728 taskAffinity = orig.taskAffinity;
729 permission = orig.permission;
730 processName = orig.processName;
731 className = orig.className;
732 theme = orig.theme;
733 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800734 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700735 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
736 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700737 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700738 volumeUuid = orig.volumeUuid;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700739 scanSourceDir = orig.scanSourceDir;
740 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800741 sourceDir = orig.sourceDir;
742 publicSourceDir = orig.publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700743 splitSourceDirs = orig.splitSourceDirs;
744 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Kenny Root85387d72010-08-26 10:13:11 -0700745 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100746 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -0700747 nativeLibraryRootDir = orig.nativeLibraryRootDir;
748 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100749 primaryCpuAbi = orig.primaryCpuAbi;
750 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -0800751 resourceDirs = orig.resourceDirs;
Robert Craig0f40dc92013-03-25 06:33:03 -0400752 seinfo = orig.seinfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 sharedLibraryFiles = orig.sharedLibraryFiles;
754 dataDir = orig.dataDir;
755 uid = orig.uid;
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700756 targetSdkVersion = orig.targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800757 versionCode = orig.versionCode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700759 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700760 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 manageSpaceActivityName = orig.manageSpaceActivityName;
762 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -0700763 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -0700764 backupAgentName = orig.backupAgentName;
Alan Viverette9b0ab652015-03-18 14:21:04 -0700765 hardwareAccelerated = orig.hardwareAccelerated;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 }
767
768
769 public String toString() {
770 return "ApplicationInfo{"
771 + Integer.toHexString(System.identityHashCode(this))
772 + " " + packageName + "}";
773 }
774
775 public int describeContents() {
776 return 0;
777 }
778
779 public void writeToParcel(Parcel dest, int parcelableFlags) {
780 super.writeToParcel(dest, parcelableFlags);
781 dest.writeString(taskAffinity);
782 dest.writeString(permission);
783 dest.writeString(processName);
784 dest.writeString(className);
785 dest.writeInt(theme);
786 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800787 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700788 dest.writeInt(requiresSmallestWidthDp);
789 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700790 dest.writeInt(largestWidthLimitDp);
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700791 dest.writeString(volumeUuid);
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700792 dest.writeString(scanSourceDir);
793 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 dest.writeString(sourceDir);
795 dest.writeString(publicSourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700796 dest.writeStringArray(splitSourceDirs);
797 dest.writeStringArray(splitPublicSourceDirs);
Kenny Root85387d72010-08-26 10:13:11 -0700798 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100799 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -0700800 dest.writeString(nativeLibraryRootDir);
801 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +0100802 dest.writeString(primaryCpuAbi);
803 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800804 dest.writeStringArray(resourceDirs);
Robert Craig0f40dc92013-03-25 06:33:03 -0400805 dest.writeString(seinfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800806 dest.writeStringArray(sharedLibraryFiles);
807 dest.writeString(dataDir);
808 dest.writeInt(uid);
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700809 dest.writeInt(targetSdkVersion);
Dianne Hackborn8472e612014-01-23 17:57:20 -0800810 dest.writeInt(versionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700812 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700813 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800814 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -0700815 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -0700817 dest.writeInt(uiOptions);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700818 dest.writeInt(hardwareAccelerated ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 }
820
821 public static final Parcelable.Creator<ApplicationInfo> CREATOR
822 = new Parcelable.Creator<ApplicationInfo>() {
823 public ApplicationInfo createFromParcel(Parcel source) {
824 return new ApplicationInfo(source);
825 }
826 public ApplicationInfo[] newArray(int size) {
827 return new ApplicationInfo[size];
828 }
829 };
830
831 private ApplicationInfo(Parcel source) {
832 super(source);
833 taskAffinity = source.readString();
834 permission = source.readString();
835 processName = source.readString();
836 className = source.readString();
837 theme = source.readInt();
838 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800839 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700840 requiresSmallestWidthDp = source.readInt();
841 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700842 largestWidthLimitDp = source.readInt();
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700843 volumeUuid = source.readString();
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700844 scanSourceDir = source.readString();
845 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 sourceDir = source.readString();
847 publicSourceDir = source.readString();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700848 splitSourceDirs = source.readStringArray();
849 splitPublicSourceDirs = source.readStringArray();
Kenny Root85387d72010-08-26 10:13:11 -0700850 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100851 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -0700852 nativeLibraryRootDir = source.readString();
853 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100854 primaryCpuAbi = source.readString();
855 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -0800856 resourceDirs = source.readStringArray();
Robert Craig0f40dc92013-03-25 06:33:03 -0400857 seinfo = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 sharedLibraryFiles = source.readStringArray();
859 dataDir = source.readString();
860 uid = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700861 targetSdkVersion = source.readInt();
Dianne Hackborn8472e612014-01-23 17:57:20 -0800862 versionCode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800863 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700864 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700865 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800866 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -0700867 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700869 uiOptions = source.readInt();
Alan Viverette9b0ab652015-03-18 14:21:04 -0700870 hardwareAccelerated = source.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800871 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 /**
874 * Retrieve the textual description of the application. This
875 * will call back on the given PackageManager to load the description from
876 * the application.
877 *
878 * @param pm A PackageManager from which the label can be loaded; usually
879 * the PackageManager from which you originally retrieved this item.
880 *
881 * @return Returns a CharSequence containing the application's description.
882 * If there is no description, null is returned.
883 */
884 public CharSequence loadDescription(PackageManager pm) {
885 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -0700886 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 if (label != null) {
888 return label;
889 }
890 }
891 return null;
892 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700893
894 /**
895 * Disable compatibility mode
896 *
897 * @hide
898 */
899 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -0700900 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700901 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700902 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700903 }
Jeff Brown07330792010-03-30 19:57:08 -0700904
905 /**
906 * @hide
907 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +0100908 @Override
909 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -0700910 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
911 && isPackageUnavailable(pm)) {
912 return Resources.getSystem().getDrawable(
913 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
914 }
915 return pm.getDefaultActivityIcon();
916 }
917
918 private boolean isPackageUnavailable(PackageManager pm) {
919 try {
920 return pm.getPackageInfo(packageName, 0) == null;
921 } catch (NameNotFoundException ex) {
922 return true;
923 }
924 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700925
Jeff Brown07330792010-03-30 19:57:08 -0700926 /**
927 * @hide
928 */
Fyodor Kupoloveeea67b2015-02-23 17:14:45 -0800929 public boolean isForwardLocked() {
930 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
931 }
932
933 /**
934 * @hide
935 */
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800936 public boolean isSystemApp() {
937 return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
938 }
939
940 /**
941 * @hide
942 */
943 public boolean isUpdatedSystemApp() {
944 return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
945 }
946
Jeff Sharkeye2d45be2015-04-15 17:14:12 -0700947 /** @hide */
948 public boolean isInternal() {
949 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
950 }
951
952 /** @hide */
953 public boolean isExternalAsec() {
954 return TextUtils.isEmpty(volumeUuid)
955 && (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
956 }
957
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800958 /**
959 * @hide
960 */
Jeff Brown07330792010-03-30 19:57:08 -0700961 @Override protected ApplicationInfo getApplicationInfo() {
962 return this;
963 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700964
965 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
966 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
967 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
968 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
969 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
970 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
971
972 /** {@hide} */ public String getCodePath() { return scanSourceDir; }
973 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
974 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
975 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
976 /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
977 /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800978}