blob: caf069f6fb5692d9673cee407a9793ce8387ccb2 [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,
342 * {@code WebView}, {@code MediaPlayer}) will refuse app's requests to use cleartext traffic.
343 * Third-party libraries are encouraged to honor this flag as well.
Alex Klyubin01a959d2015-03-18 10:05:45 -0700344 */
345 public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
346
347 /**
Dmitriy Ivanovff193d62014-09-30 15:10:48 -0700348 * When set installer extracts native libs from .apk files.
349 */
350 public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
351
352 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100353 * Value for {@link #flags}: true if code from this application will need to be
354 * loaded into other applications' processes. On devices that support multiple
355 * instruction sets, this implies the code might be loaded into a process that's
356 * using any of the devices supported instruction sets.
357 *
358 * <p> The system might treat such applications specially, for eg., by
359 * extracting the application's native libraries for all supported instruction
360 * sets or by compiling the application's dex code for all supported instruction
361 * sets.
362 */
363 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700364
365 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 * Flags associated with the application. Any combination of
367 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
368 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
369 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700370 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700371 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
372 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700373 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
374 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700375 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800376 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
377 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
378 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
379 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
380 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
Alex Klyubin7cb000f2015-03-26 11:00:04 -0700381 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC},
382 * {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 */
384 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800387 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
388 * most purposes is considered as not installed.
389 * {@hide}
390 */
391 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
392
393 /**
394 * Value for {@link #privateFlags}: set to <code>true</code> if the application
395 * has reported that it is heavy-weight, and thus can not participate in
396 * the normal application lifecycle.
397 *
398 * <p>Comes from the
399 * android.R.styleable#AndroidManifestApplication_cantSaveState
400 * attribute of the &lt;application&gt; tag.
401 *
402 * {@hide}
403 */
404 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
405
406 /**
407 * Value for {@link #privateFlags}: Set to true if the application has been
408 * installed using the forward lock option.
409 *
410 * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml.
411 *
412 * {@hide}
413 */
414 public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2;
415
416 /**
417 * Value for {@link #privateFlags}: set to {@code true} if the application
418 * is permitted to hold privileged permissions.
419 *
420 * {@hide}
421 */
422 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
423
424 /**
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700425 * Value for {@link #flags}: {@code true} if the application has any IntentFiler with some
426 * data URI using HTTP or HTTPS with an associated VIEW action.
427 *
428 * {@hide}
429 */
430 public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
431
432 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800433 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
434 * {@hide}
435 */
436 public int privateFlags;
437
438 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700439 * The required smallest screen width the application can run on. If 0,
440 * nothing has been specified. Comes from
441 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
442 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
443 */
444 public int requiresSmallestWidthDp = 0;
445
446 /**
447 * The maximum smallest screen width the application is designed for. If 0,
448 * nothing has been specified. Comes from
449 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
450 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
451 */
452 public int compatibleWidthLimitDp = 0;
453
454 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700455 * The maximum smallest screen width the application will work on. If 0,
456 * nothing has been specified. Comes from
457 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
458 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
459 */
460 public int largestWidthLimitDp = 0;
461
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700462 /** {@hide} */
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700463 public String volumeUuid;
464 /** {@hide} */
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700465 public String scanSourceDir;
466 /** {@hide} */
467 public String scanPublicSourceDir;
468
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700469 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700470 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 */
472 public String sourceDir;
473
474 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700475 * Full path to the publicly available parts of {@link #sourceDir},
476 * including resources and manifest. This may be different from
477 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 */
479 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700480
481 /**
482 * Full paths to zero or more split APKs that, when combined with the base
483 * APK defined in {@link #sourceDir}, form a complete application.
484 */
485 public String[] splitSourceDirs;
486
487 /**
488 * Full path to the publicly available parts of {@link #splitSourceDirs},
489 * including resources and manifest. This may be different from
490 * {@link #splitSourceDirs} if an application is forward locked.
491 */
492 public String[] splitPublicSourceDirs;
493
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800495 * Full paths to the locations of extra resource packages this application
496 * uses. This field is only used if there are extra resource packages,
497 * otherwise it is null.
Kenny Rootace5a3f2010-02-05 12:59:28 -0800498 *
499 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800500 */
501 public String[] resourceDirs;
502
503 /**
Robert Craig0f40dc92013-03-25 06:33:03 -0400504 * String retrieved from the seinfo tag found in selinux policy. This value
505 * is useful in setting an SELinux security context on the process as well
506 * as its data directory.
507 *
508 * {@hide}
509 */
510 public String seinfo;
511
512 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 * Paths to all shared libraries this application is linked against. This
514 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
515 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
516 * the structure.
517 */
518 public String[] sharedLibraryFiles;
519
520 /**
521 * Full path to a directory assigned to the package for its persistent
522 * data.
523 */
524 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700525
526 /**
527 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700528 */
529 public String nativeLibraryDir;
530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100532 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
533 * are stored, if present.
534 *
535 * The main reason this exists is for bundled multi-arch apps, where
536 * it's not trivial to calculate the location of libs for the secondary abi
537 * given the location of the primary.
538 *
539 * TODO: Change the layout of bundled installs so that we can use
540 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
541 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
542 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
543 *
544 * @hide
545 */
546 public String secondaryNativeLibraryDir;
547
548 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700549 * The root path where unpacked native libraries are stored.
550 * <p>
551 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
552 * placed in ISA-specific subdirectories under this path, otherwise the
553 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100554 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700555 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100556 */
Jeff Sharkey84f12942014-07-10 17:48:11 -0700557 public String nativeLibraryRootDir;
558
559 /**
560 * Flag indicating that ISA must be appended to
561 * {@link #nativeLibraryRootDir} to be useful.
562 *
563 * @hide
564 */
565 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100566
567 /**
568 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100569 * of the native JNI libraries the application bundles. Will be {@code null}
570 * if this application does not require any particular ABI.
571 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100572 * If non-null, the application will always be launched with this ABI.
573 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100574 * {@hide}
575 */
Narayan Kamathff110bd2014-07-04 18:30:45 +0100576 public String primaryCpuAbi;
577
578 /**
579 * The secondary ABI for this application. Might be non-null for multi-arch
580 * installs. The application itself never uses this ABI, but other applications that
581 * use its code might.
582 *
583 * {@hide}
584 */
585 public String secondaryCpuAbi;
586
587 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 * The kernel user-ID that has been assigned to this application;
589 * currently this is not a unique ID (multiple applications can have
590 * the same uid).
591 */
592 public int uid;
593
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700594 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700595 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700596 * versions, but it knows how to work with any new behavior added at this
597 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
598 * if this is a development build and the app is targeting that. You should
599 * compare that this number is >= the SDK version number at which your
600 * behavior was introduced.
601 */
602 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800603
604 /**
605 * The app's declared version code.
606 * @hide
607 */
608 public int versionCode;
609
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700610 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 * When false, indicates that all components within this application are
612 * considered disabled, regardless of their individually set enabled status.
613 */
614 public boolean enabled = true;
615
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700616 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700617 * For convenient access to the current enabled setting of this app.
618 * @hide
619 */
620 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
621
622 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700623 * For convenient access to package's install location.
624 * @hide
625 */
626 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -0700627
Alan Viverette9b0ab652015-03-18 14:21:04 -0700628 /**
629 * True when the application's rendering should be hardware accelerated.
630 */
631 public boolean hardwareAccelerated;
632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 public void dump(Printer pw, String prefix) {
634 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800635 if (className != null) {
636 pw.println(prefix + "className=" + className);
637 }
638 if (permission != null) {
639 pw.println(prefix + "permission=" + permission);
640 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700641 pw.println(prefix + "processName=" + processName);
642 pw.println(prefix + "taskAffinity=" + taskAffinity);
643 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800644 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -0700645 + " theme=0x" + Integer.toHexString(theme));
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700646 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700647 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
648 + " largestWidthLimitDp=" + largestWidthLimitDp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700650 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -0700651 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
652 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700653 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
654 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
655 }
656 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
657 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
658 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
659 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700660 if (resourceDirs != null) {
661 pw.println(prefix + "resourceDirs=" + resourceDirs);
662 }
Robert Craig0f40dc92013-03-25 06:33:03 -0400663 if (seinfo != null) {
664 pw.println(prefix + "seinfo=" + seinfo);
665 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 pw.println(prefix + "dataDir=" + dataDir);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800667 if (sharedLibraryFiles != null) {
Flavio Lerdadcc36bf2015-03-25 10:22:05 +0000668 pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
Dianne Hackborn12527f92009-11-11 17:39:50 -0800669 }
Dianne Hackborn8472e612014-01-23 17:57:20 -0800670 pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
671 + " versionCode=" + versionCode);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700672 pw.println(prefix + "hardwareAccelerated=" + hardwareAccelerated);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800673 if (manageSpaceActivityName != null) {
674 pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
675 }
676 if (descriptionRes != 0) {
677 pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
678 }
Adam Powell269248d2011-08-02 10:26:54 -0700679 if (uiOptions != 0) {
680 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
681 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700682 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800683 super.dumpBack(pw, prefix);
684 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700685
686 /**
687 * @return true if "supportsRtl" has been set to true in the AndroidManifest
688 * @hide
689 */
690 public boolean hasRtlSupport() {
691 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
692 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693
694 public static class DisplayNameComparator
695 implements Comparator<ApplicationInfo> {
696 public DisplayNameComparator(PackageManager pm) {
697 mPM = pm;
698 }
699
700 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
701 CharSequence sa = mPM.getApplicationLabel(aa);
702 if (sa == null) {
703 sa = aa.packageName;
704 }
705 CharSequence sb = mPM.getApplicationLabel(ab);
706 if (sb == null) {
707 sb = ab.packageName;
708 }
709
710 return sCollator.compare(sa.toString(), sb.toString());
711 }
712
713 private final Collator sCollator = Collator.getInstance();
714 private PackageManager mPM;
715 }
716
717 public ApplicationInfo() {
718 }
719
720 public ApplicationInfo(ApplicationInfo orig) {
721 super(orig);
722 taskAffinity = orig.taskAffinity;
723 permission = orig.permission;
724 processName = orig.processName;
725 className = orig.className;
726 theme = orig.theme;
727 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800728 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700729 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
730 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700731 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700732 volumeUuid = orig.volumeUuid;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700733 scanSourceDir = orig.scanSourceDir;
734 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800735 sourceDir = orig.sourceDir;
736 publicSourceDir = orig.publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700737 splitSourceDirs = orig.splitSourceDirs;
738 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Kenny Root85387d72010-08-26 10:13:11 -0700739 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100740 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -0700741 nativeLibraryRootDir = orig.nativeLibraryRootDir;
742 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100743 primaryCpuAbi = orig.primaryCpuAbi;
744 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -0800745 resourceDirs = orig.resourceDirs;
Robert Craig0f40dc92013-03-25 06:33:03 -0400746 seinfo = orig.seinfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800747 sharedLibraryFiles = orig.sharedLibraryFiles;
748 dataDir = orig.dataDir;
749 uid = orig.uid;
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700750 targetSdkVersion = orig.targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800751 versionCode = orig.versionCode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700753 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700754 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800755 manageSpaceActivityName = orig.manageSpaceActivityName;
756 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -0700757 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -0700758 backupAgentName = orig.backupAgentName;
Alan Viverette9b0ab652015-03-18 14:21:04 -0700759 hardwareAccelerated = orig.hardwareAccelerated;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 }
761
762
763 public String toString() {
764 return "ApplicationInfo{"
765 + Integer.toHexString(System.identityHashCode(this))
766 + " " + packageName + "}";
767 }
768
769 public int describeContents() {
770 return 0;
771 }
772
773 public void writeToParcel(Parcel dest, int parcelableFlags) {
774 super.writeToParcel(dest, parcelableFlags);
775 dest.writeString(taskAffinity);
776 dest.writeString(permission);
777 dest.writeString(processName);
778 dest.writeString(className);
779 dest.writeInt(theme);
780 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800781 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700782 dest.writeInt(requiresSmallestWidthDp);
783 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700784 dest.writeInt(largestWidthLimitDp);
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700785 dest.writeString(volumeUuid);
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700786 dest.writeString(scanSourceDir);
787 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 dest.writeString(sourceDir);
789 dest.writeString(publicSourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700790 dest.writeStringArray(splitSourceDirs);
791 dest.writeStringArray(splitPublicSourceDirs);
Kenny Root85387d72010-08-26 10:13:11 -0700792 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100793 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -0700794 dest.writeString(nativeLibraryRootDir);
795 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +0100796 dest.writeString(primaryCpuAbi);
797 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800798 dest.writeStringArray(resourceDirs);
Robert Craig0f40dc92013-03-25 06:33:03 -0400799 dest.writeString(seinfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800800 dest.writeStringArray(sharedLibraryFiles);
801 dest.writeString(dataDir);
802 dest.writeInt(uid);
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700803 dest.writeInt(targetSdkVersion);
Dianne Hackborn8472e612014-01-23 17:57:20 -0800804 dest.writeInt(versionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800805 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700806 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700807 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -0700809 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -0700811 dest.writeInt(uiOptions);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700812 dest.writeInt(hardwareAccelerated ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800813 }
814
815 public static final Parcelable.Creator<ApplicationInfo> CREATOR
816 = new Parcelable.Creator<ApplicationInfo>() {
817 public ApplicationInfo createFromParcel(Parcel source) {
818 return new ApplicationInfo(source);
819 }
820 public ApplicationInfo[] newArray(int size) {
821 return new ApplicationInfo[size];
822 }
823 };
824
825 private ApplicationInfo(Parcel source) {
826 super(source);
827 taskAffinity = source.readString();
828 permission = source.readString();
829 processName = source.readString();
830 className = source.readString();
831 theme = source.readInt();
832 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800833 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700834 requiresSmallestWidthDp = source.readInt();
835 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700836 largestWidthLimitDp = source.readInt();
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700837 volumeUuid = source.readString();
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700838 scanSourceDir = source.readString();
839 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 sourceDir = source.readString();
841 publicSourceDir = source.readString();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700842 splitSourceDirs = source.readStringArray();
843 splitPublicSourceDirs = source.readStringArray();
Kenny Root85387d72010-08-26 10:13:11 -0700844 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100845 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -0700846 nativeLibraryRootDir = source.readString();
847 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100848 primaryCpuAbi = source.readString();
849 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -0800850 resourceDirs = source.readStringArray();
Robert Craig0f40dc92013-03-25 06:33:03 -0400851 seinfo = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 sharedLibraryFiles = source.readStringArray();
853 dataDir = source.readString();
854 uid = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700855 targetSdkVersion = source.readInt();
Dianne Hackborn8472e612014-01-23 17:57:20 -0800856 versionCode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700858 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700859 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -0700861 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700863 uiOptions = source.readInt();
Alan Viverette9b0ab652015-03-18 14:21:04 -0700864 hardwareAccelerated = source.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 /**
868 * Retrieve the textual description of the application. This
869 * will call back on the given PackageManager to load the description from
870 * the application.
871 *
872 * @param pm A PackageManager from which the label can be loaded; usually
873 * the PackageManager from which you originally retrieved this item.
874 *
875 * @return Returns a CharSequence containing the application's description.
876 * If there is no description, null is returned.
877 */
878 public CharSequence loadDescription(PackageManager pm) {
879 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -0700880 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 if (label != null) {
882 return label;
883 }
884 }
885 return null;
886 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700887
888 /**
889 * Disable compatibility mode
890 *
891 * @hide
892 */
893 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -0700894 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700895 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700896 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700897 }
Jeff Brown07330792010-03-30 19:57:08 -0700898
899 /**
900 * @hide
901 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +0100902 @Override
903 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -0700904 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
905 && isPackageUnavailable(pm)) {
906 return Resources.getSystem().getDrawable(
907 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
908 }
909 return pm.getDefaultActivityIcon();
910 }
911
912 private boolean isPackageUnavailable(PackageManager pm) {
913 try {
914 return pm.getPackageInfo(packageName, 0) == null;
915 } catch (NameNotFoundException ex) {
916 return true;
917 }
918 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700919
Jeff Brown07330792010-03-30 19:57:08 -0700920 /**
921 * @hide
922 */
Fyodor Kupoloveeea67b2015-02-23 17:14:45 -0800923 public boolean isForwardLocked() {
924 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
925 }
926
927 /**
928 * @hide
929 */
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800930 public boolean isSystemApp() {
931 return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
932 }
933
934 /**
935 * @hide
936 */
937 public boolean isUpdatedSystemApp() {
938 return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
939 }
940
Jeff Sharkeye2d45be2015-04-15 17:14:12 -0700941 /** @hide */
942 public boolean isInternal() {
943 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
944 }
945
946 /** @hide */
947 public boolean isExternalAsec() {
948 return TextUtils.isEmpty(volumeUuid)
949 && (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
950 }
951
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800952 /**
953 * @hide
954 */
Jeff Brown07330792010-03-30 19:57:08 -0700955 @Override protected ApplicationInfo getApplicationInfo() {
956 return this;
957 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700958
959 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
960 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
961 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
962 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
963 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
964 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
965
966 /** {@hide} */ public String getCodePath() { return scanSourceDir; }
967 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
968 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
969 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
970 /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
971 /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972}