blob: e1a2aa96c36c2f1777267a48ccce88998cafe501 [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;
24import android.util.Printer;
25
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070026import com.android.internal.util.ArrayUtils;
27
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import java.text.Collator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070029import java.util.Arrays;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import java.util.Comparator;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -070031import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032
33/**
34 * Information you can retrieve about a particular application. This
35 * corresponds to information collected from the AndroidManifest.xml's
36 * <application> tag.
37 */
38public class ApplicationInfo extends PackageItemInfo implements Parcelable {
39
40 /**
41 * Default task affinity of all activities in this application. See
42 * {@link ActivityInfo#taskAffinity} for more information. This comes
43 * from the "taskAffinity" attribute.
44 */
45 public String taskAffinity;
46
47 /**
48 * Optional name of a permission required to be able to access this
49 * application's components. From the "permission" attribute.
50 */
51 public String permission;
52
53 /**
54 * The name of the process this application should run in. From the
55 * "process" attribute or, if not set, the same as
56 * <var>packageName</var>.
57 */
58 public String processName;
59
60 /**
61 * Class implementing the Application object. From the "class"
62 * attribute.
63 */
64 public String className;
65
66 /**
67 * A style resource identifier (in the package's resources) of the
68 * description of an application. From the "description" attribute
69 * or, if not set, 0.
70 */
71 public int descriptionRes;
72
73 /**
74 * A style resource identifier (in the package's resources) of the
75 * default visual theme of the application. From the "theme" attribute
76 * or, if not set, 0.
77 */
78 public int theme;
79
80 /**
81 * Class implementing the Application's manage space
82 * functionality. From the "manageSpaceActivity"
83 * attribute. This is an optional attribute and will be null if
Christopher Tate181fafa2009-05-14 11:12:14 -070084 * applications don't specify it in their manifest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 */
86 public String manageSpaceActivityName;
87
88 /**
Christopher Tate181fafa2009-05-14 11:12:14 -070089 * Class implementing the Application's backup functionality. From
90 * the "backupAgent" attribute. This is an optional attribute and
91 * will be null if the application does not specify it in its manifest.
92 *
93 * <p>If android:allowBackup is set to false, this attribute is ignored.
Christopher Tate181fafa2009-05-14 11:12:14 -070094 */
95 public String backupAgentName;
Christopher Tate4a627c72011-04-01 14:43:32 -070096
97 /**
Adam Powell269248d2011-08-02 10:26:54 -070098 * The default extra UI options for activities in this application.
99 * Set from the {@link android.R.attr#uiOptions} attribute in the
100 * activity's manifest.
101 */
102 public int uiOptions = 0;
103
104 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 * Value for {@link #flags}: if set, this application is installed in the
106 * device's system image.
107 */
108 public static final int FLAG_SYSTEM = 1<<0;
109
110 /**
111 * Value for {@link #flags}: set to true if this application would like to
112 * allow debugging of its
113 * code, even when installed on a non-development system. Comes
114 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
115 * android:debuggable} of the &lt;application&gt; tag.
116 */
117 public static final int FLAG_DEBUGGABLE = 1<<1;
118
119 /**
120 * Value for {@link #flags}: set to true if this application has code
121 * associated with it. Comes
122 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
123 * android:hasCode} of the &lt;application&gt; tag.
124 */
125 public static final int FLAG_HAS_CODE = 1<<2;
126
127 /**
128 * Value for {@link #flags}: set to true if this application is persistent.
129 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
130 * android:persistent} of the &lt;application&gt; tag.
131 */
132 public static final int FLAG_PERSISTENT = 1<<3;
133
134 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700135 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
137 * device is running in factory test mode.
138 */
139 public static final int FLAG_FACTORY_TEST = 1<<4;
140
141 /**
142 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
143 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
144 * android:allowTaskReparenting} of the &lt;application&gt; tag.
145 */
146 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
147
148 /**
149 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
150 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
151 * android:allowClearUserData} of the &lt;application&gt; tag.
152 */
153 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700156 * Value for {@link #flags}: this is set if this application has been
157 * install as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 */
159 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700160
161 /**
Dianne Hackborn7f205432009-07-28 00:13:47 -0700162 * Value for {@link #flags}: this is set of the application has specified
163 * {@link android.R.styleable#AndroidManifestApplication_testOnly
164 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700165 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700166 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700167
168 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700169 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700170 * reduced in size for smaller screens. Corresponds to
171 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
172 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700173 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700174 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
175
176 /**
177 * Value for {@link #flags}: true when the application's window can be
178 * displayed on normal screens. Corresponds to
179 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
180 * android:normalScreens}.
181 */
182 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
183
184 /**
185 * Value for {@link #flags}: true when the application's window can be
186 * increased in size for larger screens. Corresponds to
187 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700188 * android:largeScreens}.
Dianne Hackborn723738c2009-06-25 19:48:04 -0700189 */
190 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700191
192 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700193 * Value for {@link #flags}: true when the application knows how to adjust
194 * its UI for different screen sizes. Corresponds to
195 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
196 * android:resizeable}.
197 */
198 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
199
200 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700201 * Value for {@link #flags}: true when the application knows how to
202 * accomodate different screen densities. Corresponds to
203 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
204 * android:anyDensity}.
205 */
206 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
207
208 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800209 * Value for {@link #flags}: set to true if this application would like to
210 * request the VM to operate under the safe mode. Comes from
Ben Chengef3f5dd2010-03-29 15:47:26 -0700211 * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode
212 * android:vmSafeMode} of the &lt;application&gt; tag.
Ben Cheng23085b72010-02-08 16:06:32 -0800213 */
214 public static final int FLAG_VM_SAFE_MODE = 1<<14;
215
216 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800217 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
218 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700219 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800220 * <p>Comes from the
221 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
222 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700223 */
Ben Cheng23085b72010-02-08 16:06:32 -0800224 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700225
226 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800227 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
228 * in memory following a full-system restore operation; <code>true</code> otherwise.
229 * Ordinarily, during a full system restore operation each application is shut down
230 * following execution of its agent's onRestore() method. Setting this attribute to
231 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700232 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800233 * <p>If
234 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
235 * is set to <code>false</code> or no
236 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700237 * is specified, this flag will be ignored.
238 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800239 * <p>Comes from the
240 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
241 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700242 */
Ben Cheng23085b72010-02-08 16:06:32 -0800243 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700244
245 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800246 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
247 * agent claims to be able to handle restore data even "from the future,"
248 * i.e. from versions of the application with a versionCode greater than
249 * the one currently installed on the device. <i>Use with caution!</i> By default
250 * this attribute is <code>false</code> and the Backup Manager will ensure that data
251 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700252 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800253 * <p>If
254 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
255 * is set to <code>false</code> or no
256 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700257 * is specified, this flag will be ignored.
258 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800259 * <p>Comes from the
260 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
261 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700262 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800263 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700264
Christopher Tate181fafa2009-05-14 11:12:14 -0700265 /**
Dianne Hackborn3202d382010-04-26 17:51:34 -0700266 * Value for {@link #flags}: Set to true if the application is
267 * currently installed on external/removable/unprotected storage. Such
268 * applications may not be available if their storage is not currently
269 * mounted. When the storage it is on is not available, it will look like
270 * the application has been uninstalled (its .apk is no longer available)
271 * but its persistent data is not removed.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800272 */
Dianne Hackborn94c567e2010-04-26 18:13:10 -0700273 public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800274
275 /**
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700276 * Value for {@link #flags}: true when the application's window can be
277 * increased in size for extra large screens. Corresponds to
278 * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
Dianne Hackborn22ec9ab2010-04-29 17:56:03 -0700279 * android:xlargeScreens}.
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700280 */
281 public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
282
283 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800284 * Value for {@link #flags}: true when the application has requested a
285 * large heap for its processes. Corresponds to
286 * {@link android.R.styleable#AndroidManifestApplication_largeHeap
287 * android:largeHeap}.
Jason parksa3cdaa52011-01-13 14:15:43 -0600288 */
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800289 public static final int FLAG_LARGE_HEAP = 1<<20;
Jason parksa3cdaa52011-01-13 14:15:43 -0600290
291 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800292 * Value for {@link #flags}: true if this application's package is in
293 * the stopped state.
294 */
295 public static final int FLAG_STOPPED = 1<<21;
296
297 /**
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700298 * Value for {@link #flags}: true when the application is willing to support
299 * RTL (right to left). All activities will inherit this value.
300 *
301 * Set from the {@link android.R.attr#supportsRtl} attribute in the
302 * activity's manifest.
303 *
304 * Default value is false (no support for RTL).
305 */
306 public static final int FLAG_SUPPORTS_RTL = 1<<22;
307
308 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700309 * Value for {@link #flags}: true if the application is currently
310 * installed for the calling user.
311 */
312 public static final int FLAG_INSTALLED = 1<<23;
313
314 /**
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700315 * Value for {@link #flags}: true if the application only has its
316 * data installed; the application package itself does not currently
317 * exist on the device.
318 */
319 public static final int FLAG_IS_DATA_ONLY = 1<<24;
320
321 /**
Jose Lima12d0b4c2014-03-14 16:55:12 -0700322 * Value for {@link #flags}: true if the application was declared to be a game, or
323 * false if it is a non-game application.
324 */
325 public static final int FLAG_IS_GAME = 1<<25;
326
327 /**
Christopher Tated1de2562014-06-17 17:12:35 -0700328 * Value for {@link #flags}: {@code true} if the application asks that only
329 * full-data streaming backups of its data be performed even though it defines
330 * a {@link android.app.backup.BackupAgent BackupAgent}, which normally
331 * indicates that the app will manage its backed-up data via incremental
332 * key/value updates.
333 */
334 public static final int FLAG_FULL_BACKUP_ONLY = 1<<26;
335
336 /**
Narayan Kamath589a1bc2014-07-03 14:43:26 +0100337 * Value for {@link #flags}: true if code from this application will need to be
338 * loaded into other applications' processes. On devices that support multiple
339 * instruction sets, this implies the code might be loaded into a process that's
340 * using any of the devices supported instruction sets.
341 *
342 * <p> The system might treat such applications specially, for eg., by
343 * extracting the application's native libraries for all supported instruction
344 * sets or by compiling the application's dex code for all supported instruction
345 * sets.
346 */
347 public static final int FLAG_MULTIARCH = 1 << 31;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700348
349 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 * Flags associated with the application. Any combination of
351 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
352 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
353 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700354 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700355 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
356 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700357 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
358 * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700359 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE},
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800360 * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE},
361 * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE},
362 * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED},
363 * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED},
364 * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME},
365 * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_MULTIARCH}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 */
367 public int flags = 0;
Amith Yamasani655d0e22013-06-12 14:19:10 -0700368
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 /**
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800370 * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for
371 * most purposes is considered as not installed.
372 * {@hide}
373 */
374 public static final int PRIVATE_FLAG_HIDDEN = 1<<0;
375
376 /**
377 * Value for {@link #privateFlags}: set to <code>true</code> if the application
378 * has reported that it is heavy-weight, and thus can not participate in
379 * the normal application lifecycle.
380 *
381 * <p>Comes from the
382 * android.R.styleable#AndroidManifestApplication_cantSaveState
383 * attribute of the &lt;application&gt; tag.
384 *
385 * {@hide}
386 */
387 public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1;
388
389 /**
390 * Value for {@link #privateFlags}: Set to true if the application has been
391 * installed using the forward lock option.
392 *
393 * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml.
394 *
395 * {@hide}
396 */
397 public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2;
398
399 /**
400 * Value for {@link #privateFlags}: set to {@code true} if the application
401 * is permitted to hold privileged permissions.
402 *
403 * {@hide}
404 */
405 public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
406
407 /**
408 * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
409 * {@hide}
410 */
411 public int privateFlags;
412
413 /**
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700414 * The required smallest screen width the application can run on. If 0,
415 * nothing has been specified. Comes from
416 * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp
417 * android:requiresSmallestWidthDp} attribute of the &lt;supports-screens&gt; tag.
418 */
419 public int requiresSmallestWidthDp = 0;
420
421 /**
422 * The maximum smallest screen width the application is designed for. If 0,
423 * nothing has been specified. Comes from
424 * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp
425 * android:compatibleWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
426 */
427 public int compatibleWidthLimitDp = 0;
428
429 /**
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700430 * The maximum smallest screen width the application will work on. If 0,
431 * nothing has been specified. Comes from
432 * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp
433 * android:largestWidthLimitDp} attribute of the &lt;supports-screens&gt; tag.
434 */
435 public int largestWidthLimitDp = 0;
436
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700437 /** {@hide} */
438 public String scanSourceDir;
439 /** {@hide} */
440 public String scanPublicSourceDir;
441
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700442 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700443 * Full path to the base APK for this application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 */
445 public String sourceDir;
446
447 /**
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700448 * Full path to the publicly available parts of {@link #sourceDir},
449 * including resources and manifest. This may be different from
450 * {@link #sourceDir} if an application is forward locked.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 */
452 public String publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700453
454 /**
455 * Full paths to zero or more split APKs that, when combined with the base
456 * APK defined in {@link #sourceDir}, form a complete application.
457 */
458 public String[] splitSourceDirs;
459
460 /**
461 * Full path to the publicly available parts of {@link #splitSourceDirs},
462 * including resources and manifest. This may be different from
463 * {@link #splitSourceDirs} if an application is forward locked.
464 */
465 public String[] splitPublicSourceDirs;
466
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800468 * Full paths to the locations of extra resource packages this application
469 * uses. This field is only used if there are extra resource packages,
470 * otherwise it is null.
Kenny Rootace5a3f2010-02-05 12:59:28 -0800471 *
472 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800473 */
474 public String[] resourceDirs;
475
476 /**
Robert Craig0f40dc92013-03-25 06:33:03 -0400477 * String retrieved from the seinfo tag found in selinux policy. This value
478 * is useful in setting an SELinux security context on the process as well
479 * as its data directory.
480 *
481 * {@hide}
482 */
483 public String seinfo;
484
485 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 * Paths to all shared libraries this application is linked against. This
487 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
488 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
489 * the structure.
490 */
491 public String[] sharedLibraryFiles;
492
493 /**
494 * Full path to a directory assigned to the package for its persistent
495 * data.
496 */
497 public String dataDir;
Kenny Root85387d72010-08-26 10:13:11 -0700498
499 /**
500 * Full path to the directory where native JNI libraries are stored.
Kenny Root85387d72010-08-26 10:13:11 -0700501 */
502 public String nativeLibraryDir;
503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 /**
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100505 * Full path where unpacked native libraries for {@link #secondaryCpuAbi}
506 * are stored, if present.
507 *
508 * The main reason this exists is for bundled multi-arch apps, where
509 * it's not trivial to calculate the location of libs for the secondary abi
510 * given the location of the primary.
511 *
512 * TODO: Change the layout of bundled installs so that we can use
513 * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well.
514 * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]}
515 * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}.
516 *
517 * @hide
518 */
519 public String secondaryNativeLibraryDir;
520
521 /**
Jeff Sharkey84f12942014-07-10 17:48:11 -0700522 * The root path where unpacked native libraries are stored.
523 * <p>
524 * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are
525 * placed in ISA-specific subdirectories under this path, otherwise the
526 * libraries are placed directly at this path.
Narayan Kamathff110bd2014-07-04 18:30:45 +0100527 *
Jeff Sharkey84f12942014-07-10 17:48:11 -0700528 * @hide
Narayan Kamathff110bd2014-07-04 18:30:45 +0100529 */
Jeff Sharkey84f12942014-07-10 17:48:11 -0700530 public String nativeLibraryRootDir;
531
532 /**
533 * Flag indicating that ISA must be appended to
534 * {@link #nativeLibraryRootDir} to be useful.
535 *
536 * @hide
537 */
538 public boolean nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100539
540 /**
541 * The primary ABI that this application requires, This is inferred from the ABIs
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100542 * of the native JNI libraries the application bundles. Will be {@code null}
543 * if this application does not require any particular ABI.
544 *
Narayan Kamathff110bd2014-07-04 18:30:45 +0100545 * If non-null, the application will always be launched with this ABI.
546 *
Ramin Zaghiff0c4702014-04-01 15:02:29 +0100547 * {@hide}
548 */
Narayan Kamathff110bd2014-07-04 18:30:45 +0100549 public String primaryCpuAbi;
550
551 /**
552 * The secondary ABI for this application. Might be non-null for multi-arch
553 * installs. The application itself never uses this ABI, but other applications that
554 * use its code might.
555 *
556 * {@hide}
557 */
558 public String secondaryCpuAbi;
559
560 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 * The kernel user-ID that has been assigned to this application;
562 * currently this is not a unique ID (multiple applications can have
563 * the same uid).
564 */
565 public int uid;
566
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700567 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700568 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700569 * versions, but it knows how to work with any new behavior added at this
570 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
571 * if this is a development build and the app is targeting that. You should
572 * compare that this number is >= the SDK version number at which your
573 * behavior was introduced.
574 */
575 public int targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800576
577 /**
578 * The app's declared version code.
579 * @hide
580 */
581 public int versionCode;
582
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700583 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 * When false, indicates that all components within this application are
585 * considered disabled, regardless of their individually set enabled status.
586 */
587 public boolean enabled = true;
588
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700589 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700590 * For convenient access to the current enabled setting of this app.
591 * @hide
592 */
593 public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
594
595 /**
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700596 * For convenient access to package's install location.
597 * @hide
598 */
599 public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
Jose Lima12d0b4c2014-03-14 16:55:12 -0700600
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 public void dump(Printer pw, String prefix) {
602 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800603 if (className != null) {
604 pw.println(prefix + "className=" + className);
605 }
606 if (permission != null) {
607 pw.println(prefix + "permission=" + permission);
608 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700609 pw.println(prefix + "processName=" + processName);
610 pw.println(prefix + "taskAffinity=" + taskAffinity);
611 pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800612 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn39792d22010-08-19 18:01:52 -0700613 + " theme=0x" + Integer.toHexString(theme));
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700614 pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700615 + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
616 + " largestWidthLimitDp=" + largestWidthLimitDp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800617 pw.println(prefix + "sourceDir=" + sourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700618 if (!Objects.equals(sourceDir, publicSourceDir)) {
Dianne Hackborn39792d22010-08-19 18:01:52 -0700619 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
620 }
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700621 if (!ArrayUtils.isEmpty(splitSourceDirs)) {
622 pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
623 }
624 if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
625 && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
626 pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
627 }
Dianne Hackborn39792d22010-08-19 18:01:52 -0700628 if (resourceDirs != null) {
629 pw.println(prefix + "resourceDirs=" + resourceDirs);
630 }
Robert Craig0f40dc92013-03-25 06:33:03 -0400631 if (seinfo != null) {
632 pw.println(prefix + "seinfo=" + seinfo);
633 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800634 pw.println(prefix + "dataDir=" + dataDir);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800635 if (sharedLibraryFiles != null) {
636 pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
637 }
Dianne Hackborn8472e612014-01-23 17:57:20 -0800638 pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
639 + " versionCode=" + versionCode);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800640 if (manageSpaceActivityName != null) {
641 pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
642 }
643 if (descriptionRes != 0) {
644 pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
645 }
Adam Powell269248d2011-08-02 10:26:54 -0700646 if (uiOptions != 0) {
647 pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
648 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700649 pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 super.dumpBack(pw, prefix);
651 }
Fabrice Di Meglio59dfce82012-04-02 16:17:20 -0700652
653 /**
654 * @return true if "supportsRtl" has been set to true in the AndroidManifest
655 * @hide
656 */
657 public boolean hasRtlSupport() {
658 return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
659 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800660
661 public static class DisplayNameComparator
662 implements Comparator<ApplicationInfo> {
663 public DisplayNameComparator(PackageManager pm) {
664 mPM = pm;
665 }
666
667 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
668 CharSequence sa = mPM.getApplicationLabel(aa);
669 if (sa == null) {
670 sa = aa.packageName;
671 }
672 CharSequence sb = mPM.getApplicationLabel(ab);
673 if (sb == null) {
674 sb = ab.packageName;
675 }
676
677 return sCollator.compare(sa.toString(), sb.toString());
678 }
679
680 private final Collator sCollator = Collator.getInstance();
681 private PackageManager mPM;
682 }
683
684 public ApplicationInfo() {
685 }
686
687 public ApplicationInfo(ApplicationInfo orig) {
688 super(orig);
689 taskAffinity = orig.taskAffinity;
690 permission = orig.permission;
691 processName = orig.processName;
692 className = orig.className;
693 theme = orig.theme;
694 flags = orig.flags;
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800695 privateFlags = orig.privateFlags;
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700696 requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
697 compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700698 largestWidthLimitDp = orig.largestWidthLimitDp;
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700699 scanSourceDir = orig.scanSourceDir;
700 scanPublicSourceDir = orig.scanPublicSourceDir;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 sourceDir = orig.sourceDir;
702 publicSourceDir = orig.publicSourceDir;
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700703 splitSourceDirs = orig.splitSourceDirs;
704 splitPublicSourceDirs = orig.splitPublicSourceDirs;
Kenny Root85387d72010-08-26 10:13:11 -0700705 nativeLibraryDir = orig.nativeLibraryDir;
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100706 secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir;
Jeff Sharkey84f12942014-07-10 17:48:11 -0700707 nativeLibraryRootDir = orig.nativeLibraryRootDir;
708 nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100709 primaryCpuAbi = orig.primaryCpuAbi;
710 secondaryCpuAbi = orig.secondaryCpuAbi;
Kenny Rootd1ab0162010-01-21 17:27:14 -0800711 resourceDirs = orig.resourceDirs;
Robert Craig0f40dc92013-03-25 06:33:03 -0400712 seinfo = orig.seinfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 sharedLibraryFiles = orig.sharedLibraryFiles;
714 dataDir = orig.dataDir;
715 uid = orig.uid;
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700716 targetSdkVersion = orig.targetSdkVersion;
Dianne Hackborn8472e612014-01-23 17:57:20 -0800717 versionCode = orig.versionCode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 enabled = orig.enabled;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700719 enabledSetting = orig.enabledSetting;
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700720 installLocation = orig.installLocation;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 manageSpaceActivityName = orig.manageSpaceActivityName;
722 descriptionRes = orig.descriptionRes;
Adam Powell269248d2011-08-02 10:26:54 -0700723 uiOptions = orig.uiOptions;
Christopher Tatebcb02552012-10-16 17:14:34 -0700724 backupAgentName = orig.backupAgentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 }
726
727
728 public String toString() {
729 return "ApplicationInfo{"
730 + Integer.toHexString(System.identityHashCode(this))
731 + " " + packageName + "}";
732 }
733
734 public int describeContents() {
735 return 0;
736 }
737
738 public void writeToParcel(Parcel dest, int parcelableFlags) {
739 super.writeToParcel(dest, parcelableFlags);
740 dest.writeString(taskAffinity);
741 dest.writeString(permission);
742 dest.writeString(processName);
743 dest.writeString(className);
744 dest.writeInt(theme);
745 dest.writeInt(flags);
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800746 dest.writeInt(privateFlags);
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700747 dest.writeInt(requiresSmallestWidthDp);
748 dest.writeInt(compatibleWidthLimitDp);
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700749 dest.writeInt(largestWidthLimitDp);
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700750 dest.writeString(scanSourceDir);
751 dest.writeString(scanPublicSourceDir);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 dest.writeString(sourceDir);
753 dest.writeString(publicSourceDir);
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700754 dest.writeStringArray(splitSourceDirs);
755 dest.writeStringArray(splitPublicSourceDirs);
Kenny Root85387d72010-08-26 10:13:11 -0700756 dest.writeString(nativeLibraryDir);
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100757 dest.writeString(secondaryNativeLibraryDir);
Jeff Sharkey84f12942014-07-10 17:48:11 -0700758 dest.writeString(nativeLibraryRootDir);
759 dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0);
Narayan Kamathff110bd2014-07-04 18:30:45 +0100760 dest.writeString(primaryCpuAbi);
761 dest.writeString(secondaryCpuAbi);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800762 dest.writeStringArray(resourceDirs);
Robert Craig0f40dc92013-03-25 06:33:03 -0400763 dest.writeString(seinfo);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 dest.writeStringArray(sharedLibraryFiles);
765 dest.writeString(dataDir);
766 dest.writeInt(uid);
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700767 dest.writeInt(targetSdkVersion);
Dianne Hackborn8472e612014-01-23 17:57:20 -0800768 dest.writeInt(versionCode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 dest.writeInt(enabled ? 1 : 0);
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700770 dest.writeInt(enabledSetting);
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700771 dest.writeInt(installLocation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800772 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -0700773 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800774 dest.writeInt(descriptionRes);
Adam Powell269248d2011-08-02 10:26:54 -0700775 dest.writeInt(uiOptions);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 }
777
778 public static final Parcelable.Creator<ApplicationInfo> CREATOR
779 = new Parcelable.Creator<ApplicationInfo>() {
780 public ApplicationInfo createFromParcel(Parcel source) {
781 return new ApplicationInfo(source);
782 }
783 public ApplicationInfo[] newArray(int size) {
784 return new ApplicationInfo[size];
785 }
786 };
787
788 private ApplicationInfo(Parcel source) {
789 super(source);
790 taskAffinity = source.readString();
791 permission = source.readString();
792 processName = source.readString();
793 className = source.readString();
794 theme = source.readInt();
795 flags = source.readInt();
Alex Klyubinb9f8a522015-02-03 11:12:59 -0800796 privateFlags = source.readInt();
Dianne Hackborndf6e9802011-05-26 14:20:23 -0700797 requiresSmallestWidthDp = source.readInt();
798 compatibleWidthLimitDp = source.readInt();
Dianne Hackborn2762ff32011-06-01 21:27:05 -0700799 largestWidthLimitDp = source.readInt();
Jeff Sharkey7f1a57a2014-10-08 10:14:53 -0700800 scanSourceDir = source.readString();
801 scanPublicSourceDir = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800802 sourceDir = source.readString();
803 publicSourceDir = source.readString();
Jeff Sharkey8a4c9722014-06-16 13:48:42 -0700804 splitSourceDirs = source.readStringArray();
805 splitPublicSourceDirs = source.readStringArray();
Kenny Root85387d72010-08-26 10:13:11 -0700806 nativeLibraryDir = source.readString();
Narayan Kamath7dba6eb2014-07-16 08:53:30 +0100807 secondaryNativeLibraryDir = source.readString();
Jeff Sharkey84f12942014-07-10 17:48:11 -0700808 nativeLibraryRootDir = source.readString();
809 nativeLibraryRootRequiresIsa = source.readInt() != 0;
Narayan Kamathff110bd2014-07-04 18:30:45 +0100810 primaryCpuAbi = source.readString();
811 secondaryCpuAbi = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -0800812 resourceDirs = source.readStringArray();
Robert Craig0f40dc92013-03-25 06:33:03 -0400813 seinfo = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800814 sharedLibraryFiles = source.readStringArray();
815 dataDir = source.readString();
816 uid = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700817 targetSdkVersion = source.readInt();
Dianne Hackborn8472e612014-01-23 17:57:20 -0800818 versionCode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 enabled = source.readInt() != 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700820 enabledSetting = source.readInt();
Dianne Hackborn54e570f2010-10-04 18:32:32 -0700821 installLocation = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -0700823 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800824 descriptionRes = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700825 uiOptions = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700827
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 /**
829 * Retrieve the textual description of the application. This
830 * will call back on the given PackageManager to load the description from
831 * the application.
832 *
833 * @param pm A PackageManager from which the label can be loaded; usually
834 * the PackageManager from which you originally retrieved this item.
835 *
836 * @return Returns a CharSequence containing the application's description.
837 * If there is no description, null is returned.
838 */
839 public CharSequence loadDescription(PackageManager pm) {
840 if (descriptionRes != 0) {
Jeff Brown07330792010-03-30 19:57:08 -0700841 CharSequence label = pm.getText(packageName, descriptionRes, this);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800842 if (label != null) {
843 return label;
844 }
845 }
846 return null;
847 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700848
849 /**
850 * Disable compatibility mode
851 *
852 * @hide
853 */
854 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -0700855 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700856 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700857 FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700858 }
Jeff Brown07330792010-03-30 19:57:08 -0700859
860 /**
861 * @hide
862 */
Alexandra Gherghinaa7093142014-07-30 13:43:39 +0100863 @Override
864 public Drawable loadDefaultIcon(PackageManager pm) {
Jeff Brown07330792010-03-30 19:57:08 -0700865 if ((flags & FLAG_EXTERNAL_STORAGE) != 0
866 && isPackageUnavailable(pm)) {
867 return Resources.getSystem().getDrawable(
868 com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
869 }
870 return pm.getDefaultActivityIcon();
871 }
872
873 private boolean isPackageUnavailable(PackageManager pm) {
874 try {
875 return pm.getPackageInfo(packageName, 0) == null;
876 } catch (NameNotFoundException ex) {
877 return true;
878 }
879 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700880
Jeff Brown07330792010-03-30 19:57:08 -0700881 /**
882 * @hide
883 */
Fyodor Kupolov74876572015-02-23 17:14:45 -0800884 public boolean isForwardLocked() {
885 return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
886 }
887
888 /**
889 * @hide
890 */
Jeff Brown07330792010-03-30 19:57:08 -0700891 @Override protected ApplicationInfo getApplicationInfo() {
892 return this;
893 }
Jeff Sharkeyd7460572014-07-06 20:44:55 -0700894
895 /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
896 /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
897 /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
898 /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
899 /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
900 /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
901
902 /** {@hide} */ public String getCodePath() { return scanSourceDir; }
903 /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
904 /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
905 /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
906 /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
907 /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908}