blob: 707ef30ffe6a88e195330a55d3e8464072332397 [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 /**
Matthew Williams303650c2015-04-17 18:22:51 -070099 * An optional attribute that indicates the app supports automatic backup of app data.
100 * <p>0 is the default and means the app's entire data folder + managed external storage will
101 * be backed up;
102 * Any negative value indicates the app does not support full-data backup, though it may still
103 * want to participate via the traditional key/value backup API;
104 * A positive number specifies an xml resource in which the application has defined its backup
105 * include/exclude criteria.
106 * <p>If android:allowBackup is set to false, this attribute is ignored.
107 *
108 * @see {@link android.content.Context#getNoBackupFilesDir}
109 * @see {@link #FLAG_ALLOW_BACKUP}
110 */
111 public int fullBackupContent = 0;
112
113 /**
Adam Powell269248d2011-08-02 10:26:54 -0700114 * The default extra UI options for activities in this application.
115 * Set from the {@link android.R.attr#uiOptions} attribute in the
116 * activity's manifest.
117 */
118 public int uiOptions = 0;
119
120 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 * Value for {@link #flags}: if set, this application is installed in the
122 * device's system image.
123 */
124 public static final int FLAG_SYSTEM = 1<<0;
125
126 /**
127 * Value for {@link #flags}: set to true if this application would like to
128 * allow debugging of its
129 * code, even when installed on a non-development system. Comes
130 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
131 * android:debuggable} of the &lt;application&gt; tag.
132 */
133 public static final int FLAG_DEBUGGABLE = 1<<1;
134
135 /**
136 * Value for {@link #flags}: set to true if this application has code
137 * associated with it. Comes
138 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
139 * android:hasCode} of the &lt;application&gt; tag.
140 */
141 public static final int FLAG_HAS_CODE = 1<<2;
142
143 /**
144 * Value for {@link #flags}: set to true if this application is persistent.
145 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
146 * android:persistent} of the &lt;application&gt; tag.
147 */
148 public static final int FLAG_PERSISTENT = 1<<3;
149
150 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700151 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
153 * device is running in factory test mode.
154 */
155 public static final int FLAG_FACTORY_TEST = 1<<4;
156
157 /**
158 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
159 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
160 * android:allowTaskReparenting} of the &lt;application&gt; tag.
161 */
162 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
163
164 /**
165 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
166 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
167 * android:allowClearUserData} of the &lt;application&gt; tag.
168 */
169 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700172 * Value for {@link #flags}: this is set if this application has been
173 * install as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 */
175 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700176
177 /**
Dianne Hackborn7f205432009-07-28 00:13:47 -0700178 * Value for {@link #flags}: this is set of the application has specified
179 * {@link android.R.styleable#AndroidManifestApplication_testOnly
180 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700181 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700182 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700183
184 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700185 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700186 * reduced in size for smaller screens. Corresponds to
187 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
188 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700189 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700190 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
191
192 /**
193 * Value for {@link #flags}: true when the application's window can be
194 * displayed on normal screens. Corresponds to
195 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
196 * android:normalScreens}.
197 */
198 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
199
200 /**
201 * Value for {@link #flags}: true when the application's window can be
202 * increased in size for larger screens. Corresponds to
203 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700204 * android:largeScreens}.
Dianne Hackborn723738c2009-06-25 19:48:04 -0700205 */
206 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700207
208 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700209 * Value for {@link #flags}: true when the application knows how to adjust
210 * its UI for different screen sizes. Corresponds to
211 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
212 * android:resizeable}.
213 */
214 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
215
216 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700217 * Value for {@link #flags}: true when the application knows how to
218 * accomodate different screen densities. Corresponds to
219 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
220 * android:anyDensity}.
221 */
222 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
223
224 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800225 * Value for {@link #flags}: set to true if this application would like to
226 * request the VM to operate under the safe mode. Comes from
Ben Chengef3f5dd2010-03-29 15:47:26 -0700227 * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode
228 * android:vmSafeMode} of the &lt;application&gt; tag.
Ben Cheng23085b72010-02-08 16:06:32 -0800229 */
230 public static final int FLAG_VM_SAFE_MODE = 1<<14;
231
232 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800233 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
234 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700235 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800236 * <p>Comes from the
237 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
238 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700239 */
Ben Cheng23085b72010-02-08 16:06:32 -0800240 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700241
242 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800243 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
244 * in memory following a full-system restore operation; <code>true</code> otherwise.
245 * Ordinarily, during a full system restore operation each application is shut down
246 * following execution of its agent's onRestore() method. Setting this attribute to
247 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700248 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800249 * <p>If
250 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
251 * is set to <code>false</code> or no
252 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700253 * is specified, this flag will be ignored.
254 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800255 * <p>Comes from the
256 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
257 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700258 */
Ben Cheng23085b72010-02-08 16:06:32 -0800259 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700260
261 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800262 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
263 * agent claims to be able to handle restore data even "from the future,"
264 * i.e. from versions of the application with a versionCode greater than
265 * the one currently installed on the device. <i>Use with caution!</i> By default
266 * this attribute is <code>false</code> and the Backup Manager will ensure that data
267 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700268 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800269 * <p>If
270 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
271 * is set to <code>false</code> or no
272 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700273 * is specified, this flag will be ignored.
274 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800275 * <p>Comes from the
276 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
277 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700278 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800279 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700280
Christopher Tate181fafa2009-05-14 11:12:14 -0700281 /**
Dianne Hackborn3202d382010-04-26 17:51:34 -0700282 * Value for {@link #flags}: Set to true if the application is
283 * currently installed on external/removable/unprotected storage. Such
284 * applications may not be available if their storage is not currently
285 * mounted. When the storage it is on is not available, it will look like
286 * the application has been uninstalled (its .apk is no longer available)
287 * but its persistent data is not removed.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800288 */
Dianne Hackborn94c567e2010-04-26 18:13:10 -0700289 public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800290
291 /**
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700292 * Value for {@link #flags}: true when the application's window can be
293 * increased in size for extra large screens. Corresponds to
294 * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700295 * android:xlargeScreens}.
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700296 */
297 public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
298
299 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800300 * Value for {@link #flags}: true when the application has requested a
301 * large heap for its processes. Corresponds to
302 * {@link android.R.styleable#AndroidManifestApplication_largeHeap
303 * android:largeHeap}.
Jason parksa3cdaa52011-01-13 14:15:43 -0600304 */
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800305 public static final int FLAG_LARGE_HEAP = 1<<20;
Jason parksa3cdaa52011-01-13 14:15:43 -0600306
307 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800308 * Value for {@link #flags}: true if this application's package is in
309 * the stopped state.
310 */
311 public static final int FLAG_STOPPED = 1<<21;
312
313 /**
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700314 * Value for {@link #flags}: true when the application is willing to support
315 * RTL (right to left). All activities will inherit this value.
316 *
317 * Set from the {@link android.R.attr#supportsRtl} attribute in the
318 * activity's manifest.
319 *
320 * Default value is false (no support for RTL).
321 */
322 public static final int FLAG_SUPPORTS_RTL = 1<<22;
323
324 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700325 * Value for {@link #flags}: true if the application is currently
326 * installed for the calling user.
327 */
328 public static final int FLAG_INSTALLED = 1<<23;
329
330 /**
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700331 * Value for {@link #flags}: true if the application only has its
332 * data installed; the application package itself does not currently
333 * exist on the device.
334 */
335 public static final int FLAG_IS_DATA_ONLY = 1<<24;
336
337 /**
Jose Lima12d0b4c2014-03-14 16:55:12 -0700338 * Value for {@link #flags}: true if the application was declared to be a game, or
339 * false if it is a non-game application.
340 */
341 public static final int FLAG_IS_GAME = 1<<25;
342
343 /**
Christopher Tated1de2562014-06-17 17:12:35 -0700344 * Value for {@link #flags}: {@code true} if the application asks that only
345 * full-data streaming backups of its data be performed even though it defines
346 * a {@link android.app.backup.BackupAgent BackupAgent}, which normally
347 * indicates that the app will manage its backed-up data via incremental
348 * key/value updates.
349 */
350 public static final int FLAG_FULL_BACKUP_ONLY = 1<<26;
351
352 /**
Alex Klyubin01a959d2015-03-18 10:05:45 -0700353 * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic
354 * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
355 * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
356 * cleartext network traffic, in which case platform components (e.g., HTTP stacks,
Alex Klyubinfbf45992015-04-21 13:44:29 -0700357 * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext
358 * traffic. Third-party libraries are encouraged to honor this flag as well.
359 *
360 * <p>NOTE: {@code WebView} does not honor this flag.
361 *
362 * <p>This flag comes from
363 * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic
364 * android:usesCleartextTraffic} of the &lt;application&gt; tag.
Alex Klyubin01a959d2015-03-18 10:05:45 -0700365 */
366 public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
367
368 /**
Dmitriy Ivanovff193d62014-09-30 15:10:48 -0700369 * When set installer extracts native libs from .apk files.
370 */
371 public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
372
373 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100374 * Value for {@link #flags}: true if code from this application will need to be
375 * loaded into other applications' processes. On devices that support multiple
376 * instruction sets, this implies the code might be loaded into a process that's
377 * using any of the devices supported instruction sets.
378 *
379 * <p> The system might treat such applications specially, for eg., by
380 * extracting the application's native libraries for all supported instruction
381 * sets or by compiling the application's dex code for all supported instruction
382 * sets.
383 */
384 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700385
386 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 * Flags associated with the application. Any combination of
388 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
389 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
390 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700391 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700392 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
393 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700394 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
395 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700396 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800397 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
398 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
399 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
400 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
401 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
Alex Klyubin7cb000f2015-03-26 11:00:04 -0700402 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC},
403 * {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 */
405 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700406
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800407 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800408 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
409 * most purposes is considered as not installed.
410 * {@hide}
411 */
412 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
413
414 /**
415 * Value for {@link #privateFlags}: set to <code>true</code> if the application
416 * has reported that it is heavy-weight, and thus can not participate in
417 * the normal application lifecycle.
418 *
419 * <p>Comes from the
420 * android.R.styleable#AndroidManifestApplication_cantSaveState
421 * attribute of the &lt;application&gt; tag.
422 *
423 * {@hide}
424 */
425 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
426
427 /**
428 * Value for {@link #privateFlags}: Set to true if the application has been
429 * installed using the forward lock option.
430 *
431 * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml.
432 *
433 * {@hide}
434 */
435 public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2;
436
437 /**
438 * Value for {@link #privateFlags}: set to {@code true} if the application
439 * is permitted to hold privileged permissions.
440 *
441 * {@hide}
442 */
443 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
444
445 /**
Fabrice Di Megliod3d8a322015-04-01 15:58:47 -0700446 * Value for {@link #flags}: {@code true} if the application has any IntentFiler with some
447 * data URI using HTTP or HTTPS with an associated VIEW action.
448 *
449 * {@hide}
450 */
451 public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
452
453 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800454 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
455 * {@hide}
456 */
457 public int privateFlags;
458
459 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700460 * The required smallest screen width the application can run on. If 0,
461 * nothing has been specified. Comes from
462 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
463 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
464 */
465 public int requiresSmallestWidthDp = 0;
466
467 /**
468 * The maximum smallest screen width the application is designed for. If 0,
469 * nothing has been specified. Comes from
470 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
471 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
472 */
473 public int compatibleWidthLimitDp = 0;
474
475 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700476 * The maximum smallest screen width the application will work on. If 0,
477 * nothing has been specified. Comes from
478 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
479 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
480 */
481 public int largestWidthLimitDp = 0;
482
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700483 /** {@hide} */
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700484 public String volumeUuid;
485 /** {@hide} */
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700486 public String scanSourceDir;
487 /** {@hide} */
488 public String scanPublicSourceDir;
489
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700490 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700491 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 */
493 public String sourceDir;
494
495 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700496 * Full path to the publicly available parts of {@link #sourceDir},
497 * including resources and manifest. This may be different from
498 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 */
500 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700501
502 /**
503 * Full paths to zero or more split APKs that, when combined with the base
504 * APK defined in {@link #sourceDir}, form a complete application.
505 */
506 public String[] splitSourceDirs;
507
508 /**
509 * Full path to the publicly available parts of {@link #splitSourceDirs},
510 * including resources and manifest. This may be different from
511 * {@link #splitSourceDirs} if an application is forward locked.
512 */
513 public String[] splitPublicSourceDirs;
514
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800516 * Full paths to the locations of extra resource packages this application
517 * uses. This field is only used if there are extra resource packages,
518 * otherwise it is null.
Kenny Rootace5a3f2010-02-05 12:59:28 -0800519 *
520 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800521 */
522 public String[] resourceDirs;
523
524 /**
Robert Craig0f40dc92013-03-25 06:33:03 -0400525 * String retrieved from the seinfo tag found in selinux policy. This value
526 * is useful in setting an SELinux security context on the process as well
527 * as its data directory.
528 *
529 * {@hide}
530 */
531 public String seinfo;
532
533 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 * Paths to all shared libraries this application is linked against. This
535 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
536 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
537 * the structure.
538 */
539 public String[] sharedLibraryFiles;
540
541 /**
542 * Full path to a directory assigned to the package for its persistent
543 * data.
544 */
545 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700546
547 /**
548 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700549 */
550 public String nativeLibraryDir;
551
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100553 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
554 * are stored, if present.
555 *
556 * The main reason this exists is for bundled multi-arch apps, where
557 * it's not trivial to calculate the location of libs for the secondary abi
558 * given the location of the primary.
559 *
560 * TODO: Change the layout of bundled installs so that we can use
561 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
562 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
563 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
564 *
565 * @hide
566 */
567 public String secondaryNativeLibraryDir;
568
569 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700570 * The root path where unpacked native libraries are stored.
571 * <p>
572 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
573 * placed in ISA-specific subdirectories under this path, otherwise the
574 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100575 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700576 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100577 */
Jeff Sharkey84f12942014-07-10 17:48:11 -0700578 public String nativeLibraryRootDir;
579
580 /**
581 * Flag indicating that ISA must be appended to
582 * {@link #nativeLibraryRootDir} to be useful.
583 *
584 * @hide
585 */
586 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100587
588 /**
589 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100590 * of the native JNI libraries the application bundles. Will be {@code null}
591 * if this application does not require any particular ABI.
592 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100593 * If non-null, the application will always be launched with this ABI.
594 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100595 * {@hide}
596 */
Narayan Kamathff110bd2014-07-04 18:30:45 +0100597 public String primaryCpuAbi;
598
599 /**
600 * The secondary ABI for this application. Might be non-null for multi-arch
601 * installs. The application itself never uses this ABI, but other applications that
602 * use its code might.
603 *
604 * {@hide}
605 */
606 public String secondaryCpuAbi;
607
608 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 * The kernel user-ID that has been assigned to this application;
610 * currently this is not a unique ID (multiple applications can have
611 * the same uid).
612 */
613 public int uid;
614
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700615 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700616 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700617 * versions, but it knows how to work with any new behavior added at this
618 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
619 * if this is a development build and the app is targeting that. You should
620 * compare that this number is >= the SDK version number at which your
621 * behavior was introduced.
622 */
623 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800624
625 /**
626 * The app's declared version code.
627 * @hide
628 */
629 public int versionCode;
630
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700631 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 * When false, indicates that all components within this application are
633 * considered disabled, regardless of their individually set enabled status.
634 */
635 public boolean enabled = true;
636
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700637 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700638 * For convenient access to the current enabled setting of this app.
639 * @hide
640 */
641 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
642
643 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700644 * For convenient access to package's install location.
645 * @hide
646 */
647 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -0700648
Alan Viverette9b0ab652015-03-18 14:21:04 -0700649 /**
650 * True when the application's rendering should be hardware accelerated.
651 */
652 public boolean hardwareAccelerated;
653
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 public void dump(Printer pw, String prefix) {
655 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800656 if (className != null) {
657 pw.println(prefix + "className=" + className);
658 }
659 if (permission != null) {
660 pw.println(prefix + "permission=" + permission);
661 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700662 pw.println(prefix + "processName=" + processName);
663 pw.println(prefix + "taskAffinity=" + taskAffinity);
664 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800665 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -0700666 + " theme=0x" + Integer.toHexString(theme));
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700667 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700668 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
669 + " largestWidthLimitDp=" + largestWidthLimitDp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700671 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -0700672 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
673 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700674 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
675 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
676 }
677 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
678 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
679 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
680 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700681 if (resourceDirs != null) {
682 pw.println(prefix + "resourceDirs=" + resourceDirs);
683 }
Robert Craig0f40dc92013-03-25 06:33:03 -0400684 if (seinfo != null) {
685 pw.println(prefix + "seinfo=" + seinfo);
686 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 pw.println(prefix + "dataDir=" + dataDir);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800688 if (sharedLibraryFiles != null) {
Flavio Lerdadcc36bf2015-03-25 10:22:05 +0000689 pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
Dianne Hackborn12527f92009-11-11 17:39:50 -0800690 }
Dianne Hackborn8472e612014-01-23 17:57:20 -0800691 pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
692 + " versionCode=" + versionCode);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700693 pw.println(prefix + "hardwareAccelerated=" + hardwareAccelerated);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800694 if (manageSpaceActivityName != null) {
695 pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
696 }
697 if (descriptionRes != 0) {
698 pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
699 }
Adam Powell269248d2011-08-02 10:26:54 -0700700 if (uiOptions != 0) {
701 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
702 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700703 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
Matthew Williams303650c2015-04-17 18:22:51 -0700704 if (fullBackupContent > 0) {
705 pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
706 } else {
707 pw.println(prefix + "fullBackupContent=" + (fullBackupContent < 0 ? "false" : "true"));
708 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 super.dumpBack(pw, prefix);
710 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700711
712 /**
713 * @return true if "supportsRtl" has been set to true in the AndroidManifest
714 * @hide
715 */
716 public boolean hasRtlSupport() {
717 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719
720 public static class DisplayNameComparator
721 implements Comparator<ApplicationInfo> {
722 public DisplayNameComparator(PackageManager pm) {
723 mPM = pm;
724 }
725
726 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
727 CharSequence sa = mPM.getApplicationLabel(aa);
728 if (sa == null) {
729 sa = aa.packageName;
730 }
731 CharSequence sb = mPM.getApplicationLabel(ab);
732 if (sb == null) {
733 sb = ab.packageName;
734 }
735
736 return sCollator.compare(sa.toString(), sb.toString());
737 }
738
739 private final Collator sCollator = Collator.getInstance();
740 private PackageManager mPM;
741 }
742
743 public ApplicationInfo() {
744 }
745
746 public ApplicationInfo(ApplicationInfo orig) {
747 super(orig);
748 taskAffinity = orig.taskAffinity;
749 permission = orig.permission;
750 processName = orig.processName;
751 className = orig.className;
752 theme = orig.theme;
753 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800754 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700755 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
756 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700757 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700758 volumeUuid = orig.volumeUuid;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700759 scanSourceDir = orig.scanSourceDir;
760 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 sourceDir = orig.sourceDir;
762 publicSourceDir = orig.publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700763 splitSourceDirs = orig.splitSourceDirs;
764 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Kenny Root85387d72010-08-26 10:13:11 -0700765 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100766 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -0700767 nativeLibraryRootDir = orig.nativeLibraryRootDir;
768 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100769 primaryCpuAbi = orig.primaryCpuAbi;
770 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -0800771 resourceDirs = orig.resourceDirs;
Robert Craig0f40dc92013-03-25 06:33:03 -0400772 seinfo = orig.seinfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 sharedLibraryFiles = orig.sharedLibraryFiles;
774 dataDir = orig.dataDir;
775 uid = orig.uid;
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700776 targetSdkVersion = orig.targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800777 versionCode = orig.versionCode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800778 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700779 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700780 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800781 manageSpaceActivityName = orig.manageSpaceActivityName;
782 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -0700783 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -0700784 backupAgentName = orig.backupAgentName;
Alan Viverette9b0ab652015-03-18 14:21:04 -0700785 hardwareAccelerated = orig.hardwareAccelerated;
Matthew Williams303650c2015-04-17 18:22:51 -0700786 fullBackupContent = orig.fullBackupContent;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 }
788
789
790 public String toString() {
791 return "ApplicationInfo{"
792 + Integer.toHexString(System.identityHashCode(this))
793 + " " + packageName + "}";
794 }
795
796 public int describeContents() {
797 return 0;
798 }
799
800 public void writeToParcel(Parcel dest, int parcelableFlags) {
801 super.writeToParcel(dest, parcelableFlags);
802 dest.writeString(taskAffinity);
803 dest.writeString(permission);
804 dest.writeString(processName);
805 dest.writeString(className);
806 dest.writeInt(theme);
807 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800808 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700809 dest.writeInt(requiresSmallestWidthDp);
810 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700811 dest.writeInt(largestWidthLimitDp);
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700812 dest.writeString(volumeUuid);
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700813 dest.writeString(scanSourceDir);
814 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800815 dest.writeString(sourceDir);
816 dest.writeString(publicSourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700817 dest.writeStringArray(splitSourceDirs);
818 dest.writeStringArray(splitPublicSourceDirs);
Kenny Root85387d72010-08-26 10:13:11 -0700819 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100820 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -0700821 dest.writeString(nativeLibraryRootDir);
822 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +0100823 dest.writeString(primaryCpuAbi);
824 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800825 dest.writeStringArray(resourceDirs);
Robert Craig0f40dc92013-03-25 06:33:03 -0400826 dest.writeString(seinfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 dest.writeStringArray(sharedLibraryFiles);
828 dest.writeString(dataDir);
829 dest.writeInt(uid);
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700830 dest.writeInt(targetSdkVersion);
Dianne Hackborn8472e612014-01-23 17:57:20 -0800831 dest.writeInt(versionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700833 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700834 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800835 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -0700836 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800837 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -0700838 dest.writeInt(uiOptions);
Alan Viverette9b0ab652015-03-18 14:21:04 -0700839 dest.writeInt(hardwareAccelerated ? 1 : 0);
Matthew Williams303650c2015-04-17 18:22:51 -0700840 dest.writeInt(fullBackupContent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 }
842
843 public static final Parcelable.Creator<ApplicationInfo> CREATOR
844 = new Parcelable.Creator<ApplicationInfo>() {
845 public ApplicationInfo createFromParcel(Parcel source) {
846 return new ApplicationInfo(source);
847 }
848 public ApplicationInfo[] newArray(int size) {
849 return new ApplicationInfo[size];
850 }
851 };
852
853 private ApplicationInfo(Parcel source) {
854 super(source);
855 taskAffinity = source.readString();
856 permission = source.readString();
857 processName = source.readString();
858 className = source.readString();
859 theme = source.readInt();
860 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800861 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700862 requiresSmallestWidthDp = source.readInt();
863 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700864 largestWidthLimitDp = source.readInt();
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700865 volumeUuid = source.readString();
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700866 scanSourceDir = source.readString();
867 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 sourceDir = source.readString();
869 publicSourceDir = source.readString();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700870 splitSourceDirs = source.readStringArray();
871 splitPublicSourceDirs = source.readStringArray();
Kenny Root85387d72010-08-26 10:13:11 -0700872 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100873 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -0700874 nativeLibraryRootDir = source.readString();
875 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100876 primaryCpuAbi = source.readString();
877 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -0800878 resourceDirs = source.readStringArray();
Robert Craig0f40dc92013-03-25 06:33:03 -0400879 seinfo = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800880 sharedLibraryFiles = source.readStringArray();
881 dataDir = source.readString();
882 uid = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700883 targetSdkVersion = source.readInt();
Dianne Hackborn8472e612014-01-23 17:57:20 -0800884 versionCode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800885 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700886 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700887 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800888 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -0700889 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700891 uiOptions = source.readInt();
Alan Viverette9b0ab652015-03-18 14:21:04 -0700892 hardwareAccelerated = source.readInt() != 0;
Matthew Williams303650c2015-04-17 18:22:51 -0700893 fullBackupContent = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700895
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 /**
897 * Retrieve the textual description of the application. This
898 * will call back on the given PackageManager to load the description from
899 * the application.
900 *
901 * @param pm A PackageManager from which the label can be loaded; usually
902 * the PackageManager from which you originally retrieved this item.
903 *
904 * @return Returns a CharSequence containing the application's description.
905 * If there is no description, null is returned.
906 */
907 public CharSequence loadDescription(PackageManager pm) {
908 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -0700909 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 if (label != null) {
911 return label;
912 }
913 }
914 return null;
915 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700916
917 /**
918 * Disable compatibility mode
919 *
920 * @hide
921 */
922 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -0700923 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700924 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700925 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700926 }
Jeff Brown07330792010-03-30 19:57:08 -0700927
928 /**
929 * @hide
930 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +0100931 @Override
932 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -0700933 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
934 && isPackageUnavailable(pm)) {
935 return Resources.getSystem().getDrawable(
936 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
937 }
938 return pm.getDefaultActivityIcon();
939 }
940
941 private boolean isPackageUnavailable(PackageManager pm) {
942 try {
943 return pm.getPackageInfo(packageName, 0) == null;
944 } catch (NameNotFoundException ex) {
945 return true;
946 }
947 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700948
Jeff Brown07330792010-03-30 19:57:08 -0700949 /**
950 * @hide
951 */
Fyodor Kupoloveeea67b2015-02-23 17:14:45 -0800952 public boolean isForwardLocked() {
953 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
954 }
955
956 /**
957 * @hide
958 */
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800959 public boolean isSystemApp() {
960 return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
961 }
962
963 /**
964 * @hide
965 */
966 public boolean isUpdatedSystemApp() {
967 return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
968 }
969
Jeff Sharkeye2d45be2015-04-15 17:14:12 -0700970 /** @hide */
971 public boolean isInternal() {
972 return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
973 }
974
975 /** @hide */
976 public boolean isExternalAsec() {
977 return TextUtils.isEmpty(volumeUuid)
978 && (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
979 }
980
Fyodor Kupolovb94c1652015-03-03 12:25:30 -0800981 /**
982 * @hide
983 */
Jeff Brown07330792010-03-30 19:57:08 -0700984 @Override protected ApplicationInfo getApplicationInfo() {
985 return this;
986 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700987
988 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
989 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
990 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
991 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
992 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
993 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
994
995 /** {@hide} */ public String getCodePath() { return scanSourceDir; }
996 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
997 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
998 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
999 /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
1000 /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001}