Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.content.pm; |
| 18 | |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 19 | import android.annotation.TestApi; |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 20 | import android.content.pm.PackageManager.NameNotFoundException; |
| 21 | import android.content.res.Resources; |
| 22 | import android.graphics.drawable.Drawable; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 23 | import android.os.Environment; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | import android.os.Parcel; |
| 25 | import android.os.Parcelable; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 26 | import android.os.UserHandle; |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 27 | import android.os.storage.StorageManager; |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 28 | import android.text.TextUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | import android.util.Printer; |
| 30 | |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 31 | import com.android.internal.util.ArrayUtils; |
| 32 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | import java.text.Collator; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 34 | import java.util.Arrays; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | import java.util.Comparator; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 36 | import java.util.Objects; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Information you can retrieve about a particular application. This |
| 40 | * corresponds to information collected from the AndroidManifest.xml's |
| 41 | * <application> tag. |
| 42 | */ |
| 43 | public class ApplicationInfo extends PackageItemInfo implements Parcelable { |
| 44 | |
| 45 | /** |
| 46 | * Default task affinity of all activities in this application. See |
| 47 | * {@link ActivityInfo#taskAffinity} for more information. This comes |
| 48 | * from the "taskAffinity" attribute. |
| 49 | */ |
| 50 | public String taskAffinity; |
| 51 | |
| 52 | /** |
| 53 | * Optional name of a permission required to be able to access this |
| 54 | * application's components. From the "permission" attribute. |
| 55 | */ |
| 56 | public String permission; |
| 57 | |
| 58 | /** |
| 59 | * The name of the process this application should run in. From the |
| 60 | * "process" attribute or, if not set, the same as |
| 61 | * <var>packageName</var>. |
| 62 | */ |
| 63 | public String processName; |
| 64 | |
| 65 | /** |
| 66 | * Class implementing the Application object. From the "class" |
| 67 | * attribute. |
| 68 | */ |
| 69 | public String className; |
| 70 | |
| 71 | /** |
| 72 | * A style resource identifier (in the package's resources) of the |
| 73 | * description of an application. From the "description" attribute |
| 74 | * or, if not set, 0. |
| 75 | */ |
| 76 | public int descriptionRes; |
| 77 | |
| 78 | /** |
| 79 | * A style resource identifier (in the package's resources) of the |
| 80 | * default visual theme of the application. From the "theme" attribute |
| 81 | * or, if not set, 0. |
| 82 | */ |
| 83 | public int theme; |
| 84 | |
| 85 | /** |
| 86 | * Class implementing the Application's manage space |
| 87 | * functionality. From the "manageSpaceActivity" |
| 88 | * attribute. This is an optional attribute and will be null if |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 89 | * applications don't specify it in their manifest |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | */ |
| 91 | public String manageSpaceActivityName; |
| 92 | |
| 93 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 94 | * Class implementing the Application's backup functionality. From |
| 95 | * the "backupAgent" attribute. This is an optional attribute and |
| 96 | * will be null if the application does not specify it in its manifest. |
| 97 | * |
| 98 | * <p>If android:allowBackup is set to false, this attribute is ignored. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 99 | */ |
| 100 | public String backupAgentName; |
Christopher Tate | 4a627c7 | 2011-04-01 14:43:32 -0700 | [diff] [blame] | 101 | |
| 102 | /** |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 103 | * An optional attribute that indicates the app supports automatic backup of app data. |
| 104 | * <p>0 is the default and means the app's entire data folder + managed external storage will |
| 105 | * be backed up; |
| 106 | * Any negative value indicates the app does not support full-data backup, though it may still |
| 107 | * want to participate via the traditional key/value backup API; |
| 108 | * A positive number specifies an xml resource in which the application has defined its backup |
| 109 | * include/exclude criteria. |
| 110 | * <p>If android:allowBackup is set to false, this attribute is ignored. |
| 111 | * |
| 112 | * @see {@link android.content.Context#getNoBackupFilesDir} |
| 113 | * @see {@link #FLAG_ALLOW_BACKUP} |
Christopher Tate | 98fa656 | 2015-05-14 13:20:10 -0700 | [diff] [blame] | 114 | * |
| 115 | * @hide |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 116 | */ |
| 117 | public int fullBackupContent = 0; |
| 118 | |
| 119 | /** |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 120 | * The default extra UI options for activities in this application. |
| 121 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 122 | * activity's manifest. |
| 123 | */ |
| 124 | public int uiOptions = 0; |
| 125 | |
| 126 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 127 | * Value for {@link #flags}: if set, this application is installed in the |
| 128 | * device's system image. |
| 129 | */ |
| 130 | public static final int FLAG_SYSTEM = 1<<0; |
| 131 | |
| 132 | /** |
| 133 | * Value for {@link #flags}: set to true if this application would like to |
| 134 | * allow debugging of its |
| 135 | * code, even when installed on a non-development system. Comes |
| 136 | * from {@link android.R.styleable#AndroidManifestApplication_debuggable |
| 137 | * android:debuggable} of the <application> tag. |
| 138 | */ |
| 139 | public static final int FLAG_DEBUGGABLE = 1<<1; |
| 140 | |
| 141 | /** |
| 142 | * Value for {@link #flags}: set to true if this application has code |
| 143 | * associated with it. Comes |
| 144 | * from {@link android.R.styleable#AndroidManifestApplication_hasCode |
| 145 | * android:hasCode} of the <application> tag. |
| 146 | */ |
| 147 | public static final int FLAG_HAS_CODE = 1<<2; |
| 148 | |
| 149 | /** |
| 150 | * Value for {@link #flags}: set to true if this application is persistent. |
| 151 | * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent |
| 152 | * android:persistent} of the <application> tag. |
| 153 | */ |
| 154 | public static final int FLAG_PERSISTENT = 1<<3; |
| 155 | |
| 156 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 157 | * Value for {@link #flags}: set to true if this application holds the |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 158 | * {@link android.Manifest.permission#FACTORY_TEST} permission and the |
| 159 | * device is running in factory test mode. |
| 160 | */ |
| 161 | public static final int FLAG_FACTORY_TEST = 1<<4; |
| 162 | |
| 163 | /** |
| 164 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 165 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting |
| 166 | * android:allowTaskReparenting} of the <application> tag. |
| 167 | */ |
| 168 | public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5; |
| 169 | |
| 170 | /** |
| 171 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 172 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData |
| 173 | * android:allowClearUserData} of the <application> tag. |
| 174 | */ |
| 175 | public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6; |
| 176 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 177 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 178 | * Value for {@link #flags}: this is set if this application has been |
Kweku Adams | 8de29ca | 2016-01-22 12:30:26 -0800 | [diff] [blame] | 179 | * installed as an update to a built-in system application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | */ |
| 181 | public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7; |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 182 | |
| 183 | /** |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame] | 184 | * Value for {@link #flags}: this is set of the application has specified |
| 185 | * {@link android.R.styleable#AndroidManifestApplication_testOnly |
| 186 | * android:testOnly} to be true. |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 187 | */ |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 188 | public static final int FLAG_TEST_ONLY = 1<<8; |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 189 | |
| 190 | /** |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 191 | * Value for {@link #flags}: true when the application's window can be |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 192 | * reduced in size for smaller screens. Corresponds to |
| 193 | * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens |
| 194 | * android:smallScreens}. |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 195 | */ |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 196 | public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9; |
| 197 | |
| 198 | /** |
| 199 | * Value for {@link #flags}: true when the application's window can be |
| 200 | * displayed on normal screens. Corresponds to |
| 201 | * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens |
| 202 | * android:normalScreens}. |
| 203 | */ |
| 204 | public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10; |
| 205 | |
| 206 | /** |
| 207 | * Value for {@link #flags}: true when the application's window can be |
| 208 | * increased in size for larger screens. Corresponds to |
| 209 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 210 | * android:largeScreens}. |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 211 | */ |
| 212 | public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11; |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 213 | |
| 214 | /** |
Dianne Hackborn | c4db95c | 2009-07-21 17:46:02 -0700 | [diff] [blame] | 215 | * Value for {@link #flags}: true when the application knows how to adjust |
| 216 | * its UI for different screen sizes. Corresponds to |
| 217 | * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable |
| 218 | * android:resizeable}. |
| 219 | */ |
| 220 | public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12; |
| 221 | |
| 222 | /** |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 223 | * Value for {@link #flags}: true when the application knows how to |
| 224 | * accomodate different screen densities. Corresponds to |
| 225 | * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity |
| 226 | * android:anyDensity}. |
| 227 | */ |
| 228 | public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13; |
| 229 | |
| 230 | /** |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 231 | * Value for {@link #flags}: set to true if this application would like to |
| 232 | * request the VM to operate under the safe mode. Comes from |
Ben Cheng | ef3f5dd | 2010-03-29 15:47:26 -0700 | [diff] [blame] | 233 | * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode |
| 234 | * android:vmSafeMode} of the <application> tag. |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 235 | */ |
| 236 | public static final int FLAG_VM_SAFE_MODE = 1<<14; |
| 237 | |
| 238 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 239 | * Value for {@link #flags}: set to <code>false</code> if the application does not wish |
| 240 | * to permit any OS-driven backups of its data; <code>true</code> otherwise. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 241 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 242 | * <p>Comes from the |
| 243 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 244 | * attribute of the <application> tag. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 245 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 246 | public static final int FLAG_ALLOW_BACKUP = 1<<15; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 247 | |
| 248 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 249 | * Value for {@link #flags}: set to <code>false</code> if the application must be kept |
| 250 | * in memory following a full-system restore operation; <code>true</code> otherwise. |
| 251 | * Ordinarily, during a full system restore operation each application is shut down |
| 252 | * following execution of its agent's onRestore() method. Setting this attribute to |
| 253 | * <code>false</code> prevents this. Most applications will not need to set this attribute. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 254 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 255 | * <p>If |
| 256 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 257 | * is set to <code>false</code> or no |
| 258 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 259 | * is specified, this flag will be ignored. |
| 260 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 261 | * <p>Comes from the |
| 262 | * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore} |
| 263 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 264 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 265 | public static final int FLAG_KILL_AFTER_RESTORE = 1<<16; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 266 | |
| 267 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 268 | * Value for {@link #flags}: Set to <code>true</code> if the application's backup |
| 269 | * agent claims to be able to handle restore data even "from the future," |
| 270 | * i.e. from versions of the application with a versionCode greater than |
| 271 | * the one currently installed on the device. <i>Use with caution!</i> By default |
| 272 | * this attribute is <code>false</code> and the Backup Manager will ensure that data |
| 273 | * from "future" versions of the application are never supplied during a restore operation. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 274 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 275 | * <p>If |
| 276 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 277 | * is set to <code>false</code> or no |
| 278 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 279 | * is specified, this flag will be ignored. |
| 280 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 281 | * <p>Comes from the |
| 282 | * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion} |
| 283 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 284 | */ |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 285 | public static final int FLAG_RESTORE_ANY_VERSION = 1<<17; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 286 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 287 | /** |
Dianne Hackborn | 3202d38 | 2010-04-26 17:51:34 -0700 | [diff] [blame] | 288 | * Value for {@link #flags}: Set to true if the application is |
| 289 | * currently installed on external/removable/unprotected storage. Such |
| 290 | * applications may not be available if their storage is not currently |
| 291 | * mounted. When the storage it is on is not available, it will look like |
| 292 | * the application has been uninstalled (its .apk is no longer available) |
| 293 | * but its persistent data is not removed. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 294 | */ |
Dianne Hackborn | 94c567e | 2010-04-26 18:13:10 -0700 | [diff] [blame] | 295 | public static final int FLAG_EXTERNAL_STORAGE = 1<<18; |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 296 | |
| 297 | /** |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 298 | * Value for {@link #flags}: true when the application's window can be |
| 299 | * increased in size for extra large screens. Corresponds to |
| 300 | * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 301 | * android:xlargeScreens}. |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 302 | */ |
| 303 | public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19; |
| 304 | |
| 305 | /** |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 306 | * Value for {@link #flags}: true when the application has requested a |
| 307 | * large heap for its processes. Corresponds to |
| 308 | * {@link android.R.styleable#AndroidManifestApplication_largeHeap |
| 309 | * android:largeHeap}. |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 310 | */ |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 311 | public static final int FLAG_LARGE_HEAP = 1<<20; |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 312 | |
| 313 | /** |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 314 | * Value for {@link #flags}: true if this application's package is in |
| 315 | * the stopped state. |
| 316 | */ |
| 317 | public static final int FLAG_STOPPED = 1<<21; |
| 318 | |
| 319 | /** |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 320 | * Value for {@link #flags}: true when the application is willing to support |
| 321 | * RTL (right to left). All activities will inherit this value. |
| 322 | * |
| 323 | * Set from the {@link android.R.attr#supportsRtl} attribute in the |
| 324 | * activity's manifest. |
| 325 | * |
| 326 | * Default value is false (no support for RTL). |
| 327 | */ |
| 328 | public static final int FLAG_SUPPORTS_RTL = 1<<22; |
| 329 | |
| 330 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 331 | * Value for {@link #flags}: true if the application is currently |
| 332 | * installed for the calling user. |
| 333 | */ |
| 334 | public static final int FLAG_INSTALLED = 1<<23; |
| 335 | |
| 336 | /** |
Dianne Hackborn | 5e03e2c | 2012-09-06 14:21:19 -0700 | [diff] [blame] | 337 | * Value for {@link #flags}: true if the application only has its |
| 338 | * data installed; the application package itself does not currently |
| 339 | * exist on the device. |
| 340 | */ |
| 341 | public static final int FLAG_IS_DATA_ONLY = 1<<24; |
| 342 | |
| 343 | /** |
Jose Lima | 12d0b4c | 2014-03-14 16:55:12 -0700 | [diff] [blame] | 344 | * Value for {@link #flags}: true if the application was declared to be a game, or |
| 345 | * false if it is a non-game application. |
| 346 | */ |
| 347 | public static final int FLAG_IS_GAME = 1<<25; |
| 348 | |
| 349 | /** |
Christopher Tate | d1de256 | 2014-06-17 17:12:35 -0700 | [diff] [blame] | 350 | * Value for {@link #flags}: {@code true} if the application asks that only |
| 351 | * full-data streaming backups of its data be performed even though it defines |
| 352 | * a {@link android.app.backup.BackupAgent BackupAgent}, which normally |
| 353 | * indicates that the app will manage its backed-up data via incremental |
| 354 | * key/value updates. |
| 355 | */ |
| 356 | public static final int FLAG_FULL_BACKUP_ONLY = 1<<26; |
| 357 | |
| 358 | /** |
Alex Klyubin | 01a959d | 2015-03-18 10:05:45 -0700 | [diff] [blame] | 359 | * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic |
| 360 | * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP |
| 361 | * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use |
| 362 | * cleartext network traffic, in which case platform components (e.g., HTTP stacks, |
Alex Klyubin | fbf4599 | 2015-04-21 13:44:29 -0700 | [diff] [blame] | 363 | * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext |
| 364 | * traffic. Third-party libraries are encouraged to honor this flag as well. |
| 365 | * |
| 366 | * <p>NOTE: {@code WebView} does not honor this flag. |
| 367 | * |
| 368 | * <p>This flag comes from |
| 369 | * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic |
| 370 | * android:usesCleartextTraffic} of the <application> tag. |
Alex Klyubin | 01a959d | 2015-03-18 10:05:45 -0700 | [diff] [blame] | 371 | */ |
| 372 | public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27; |
| 373 | |
| 374 | /** |
Dmitriy Ivanov | ff193d6 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 375 | * When set installer extracts native libs from .apk files. |
| 376 | */ |
| 377 | public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28; |
| 378 | |
| 379 | /** |
Alan Viverette | d70b9e7 | 2015-05-27 14:29:20 -0700 | [diff] [blame] | 380 | * Value for {@link #flags}: {@code true} when the application's rendering |
| 381 | * should be hardware accelerated. |
| 382 | */ |
| 383 | public static final int FLAG_HARDWARE_ACCELERATED = 1<<29; |
| 384 | |
| 385 | /** |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 386 | * Value for {@link #flags}: true if this application's package is in |
| 387 | * the suspended state. |
| 388 | */ |
| 389 | public static final int FLAG_SUSPENDED = 1<<30; |
| 390 | |
| 391 | /** |
Narayan Kamath | 589a1bc | 2014-07-03 14:43:26 +0100 | [diff] [blame] | 392 | * Value for {@link #flags}: true if code from this application will need to be |
| 393 | * loaded into other applications' processes. On devices that support multiple |
| 394 | * instruction sets, this implies the code might be loaded into a process that's |
| 395 | * using any of the devices supported instruction sets. |
| 396 | * |
| 397 | * <p> The system might treat such applications specially, for eg., by |
| 398 | * extracting the application's native libraries for all supported instruction |
| 399 | * sets or by compiling the application's dex code for all supported instruction |
| 400 | * sets. |
| 401 | */ |
| 402 | public static final int FLAG_MULTIARCH = 1 << 31; |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 403 | |
| 404 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 405 | * Flags associated with the application. Any combination of |
| 406 | * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE}, |
| 407 | * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and |
| 408 | * {@link #FLAG_ALLOW_TASK_REPARENTING} |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 409 | * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 410 | * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS}, |
| 411 | * {@link #FLAG_SUPPORTS_NORMAL_SCREENS}, |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 412 | * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS}, |
| 413 | * {@link #FLAG_RESIZEABLE_FOR_SCREENS}, |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 414 | * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}, |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 415 | * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE}, |
| 416 | * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE}, |
| 417 | * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED}, |
| 418 | * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED}, |
| 419 | * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME}, |
Alex Klyubin | 7cb000f | 2015-03-26 11:00:04 -0700 | [diff] [blame] | 420 | * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC}, |
| 421 | * {@link #FLAG_MULTIARCH}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 422 | */ |
| 423 | public int flags = 0; |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 424 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 425 | /** |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 426 | * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for |
| 427 | * most purposes is considered as not installed. |
| 428 | * {@hide} |
| 429 | */ |
| 430 | public static final int PRIVATE_FLAG_HIDDEN = 1<<0; |
| 431 | |
| 432 | /** |
| 433 | * Value for {@link #privateFlags}: set to <code>true</code> if the application |
| 434 | * has reported that it is heavy-weight, and thus can not participate in |
| 435 | * the normal application lifecycle. |
| 436 | * |
| 437 | * <p>Comes from the |
| 438 | * android.R.styleable#AndroidManifestApplication_cantSaveState |
| 439 | * attribute of the <application> tag. |
| 440 | * |
| 441 | * {@hide} |
| 442 | */ |
| 443 | public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1; |
| 444 | |
| 445 | /** |
| 446 | * Value for {@link #privateFlags}: Set to true if the application has been |
| 447 | * installed using the forward lock option. |
| 448 | * |
| 449 | * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml. |
| 450 | * |
| 451 | * {@hide} |
| 452 | */ |
| 453 | public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2; |
| 454 | |
| 455 | /** |
| 456 | * Value for {@link #privateFlags}: set to {@code true} if the application |
| 457 | * is permitted to hold privileged permissions. |
| 458 | * |
| 459 | * {@hide} |
| 460 | */ |
| 461 | public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3; |
| 462 | |
| 463 | /** |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 464 | * Value for {@link #privateFlags}: {@code true} if the application has any IntentFiler |
| 465 | * with some data URI using HTTP or HTTPS with an associated VIEW action. |
Fabrice Di Meglio | d3d8a32 | 2015-04-01 15:58:47 -0700 | [diff] [blame] | 466 | * |
| 467 | * {@hide} |
| 468 | */ |
| 469 | public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4; |
| 470 | |
| 471 | /** |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 472 | * When set, default data storage directory for given app is pointed at |
| 473 | * device-encrypted location. |
| 474 | * |
| 475 | * @hide |
| 476 | */ |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 477 | public static final int PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED = 1 << 5; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 478 | |
| 479 | /** |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 480 | * When set, assume that all components under the given app are encryption |
| 481 | * aware, unless otherwise specified. |
| 482 | * |
| 483 | * @hide |
| 484 | */ |
| 485 | public static final int PRIVATE_FLAG_ENCRYPTION_AWARE = 1 << 6; |
| 486 | |
| 487 | /** |
Jeff Vander Stoep | a4407bf | 2015-10-30 13:15:58 -0700 | [diff] [blame] | 488 | * Value for {@link #privateFlags}: set to {@code true} if the application |
| 489 | * is AutoPlay. |
| 490 | * |
| 491 | * {@hide} |
| 492 | */ |
Jeff Vander Stoep | 9edb7bf | 2015-11-16 15:23:38 -0800 | [diff] [blame] | 493 | public static final int PRIVATE_FLAG_AUTOPLAY = 1 << 7; |
Jeff Vander Stoep | a4407bf | 2015-10-30 13:15:58 -0700 | [diff] [blame] | 494 | |
| 495 | /** |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 496 | * When set, at least one component inside this application is encryption aware. |
| 497 | * |
| 498 | * @hide |
| 499 | */ |
| 500 | public static final int PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE = 1 << 8; |
| 501 | |
| 502 | /** |
Fyodor Kupolov | f99104d | 2015-12-14 11:31:29 -0800 | [diff] [blame] | 503 | * Value for {@link #flags}: {@code true} if the application is blocked via restrictions |
| 504 | * and for most purposes is considered as not installed. |
| 505 | * {@hide} |
| 506 | */ |
| 507 | public static final int PRIVATE_FLAG_EPHEMERAL = 1 << 9; |
| 508 | |
| 509 | /** |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 510 | * When set, signals that the application is required for the system user and should not be |
| 511 | * uninstalled. |
| 512 | * |
| 513 | * @hide |
| 514 | */ |
| 515 | public static final int PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER = 1 << 10; |
| 516 | |
| 517 | /** |
Wale Ogunwale | 6afdf91 | 2016-01-30 13:01:33 -0800 | [diff] [blame^] | 518 | * When set, the activities associated with this application are resizeable by default. |
| 519 | * @see android.R.styleable#AndroidManifestActivity_resizeableActivity |
| 520 | * |
| 521 | * @hide |
| 522 | */ |
| 523 | public static final int PRIVATE_FLAG_RESIZEABLE_ACTIVITIES = 1 << 11; |
| 524 | |
| 525 | /** |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 526 | * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants. |
| 527 | * {@hide} |
| 528 | */ |
| 529 | public int privateFlags; |
| 530 | |
| 531 | /** |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 532 | * The required smallest screen width the application can run on. If 0, |
| 533 | * nothing has been specified. Comes from |
| 534 | * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp |
| 535 | * android:requiresSmallestWidthDp} attribute of the <supports-screens> tag. |
| 536 | */ |
| 537 | public int requiresSmallestWidthDp = 0; |
| 538 | |
| 539 | /** |
| 540 | * The maximum smallest screen width the application is designed for. If 0, |
| 541 | * nothing has been specified. Comes from |
| 542 | * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp |
| 543 | * android:compatibleWidthLimitDp} attribute of the <supports-screens> tag. |
| 544 | */ |
| 545 | public int compatibleWidthLimitDp = 0; |
| 546 | |
| 547 | /** |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 548 | * The maximum smallest screen width the application will work on. If 0, |
| 549 | * nothing has been specified. Comes from |
| 550 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp |
| 551 | * android:largestWidthLimitDp} attribute of the <supports-screens> tag. |
| 552 | */ |
| 553 | public int largestWidthLimitDp = 0; |
| 554 | |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 555 | /** {@hide} */ |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 556 | public String volumeUuid; |
| 557 | /** {@hide} */ |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 558 | public String scanSourceDir; |
| 559 | /** {@hide} */ |
| 560 | public String scanPublicSourceDir; |
| 561 | |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 562 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 563 | * Full path to the base APK for this application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 564 | */ |
| 565 | public String sourceDir; |
| 566 | |
| 567 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 568 | * Full path to the publicly available parts of {@link #sourceDir}, |
| 569 | * including resources and manifest. This may be different from |
| 570 | * {@link #sourceDir} if an application is forward locked. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 571 | */ |
| 572 | public String publicSourceDir; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 573 | |
| 574 | /** |
| 575 | * Full paths to zero or more split APKs that, when combined with the base |
| 576 | * APK defined in {@link #sourceDir}, form a complete application. |
| 577 | */ |
| 578 | public String[] splitSourceDirs; |
| 579 | |
| 580 | /** |
| 581 | * Full path to the publicly available parts of {@link #splitSourceDirs}, |
| 582 | * including resources and manifest. This may be different from |
| 583 | * {@link #splitSourceDirs} if an application is forward locked. |
| 584 | */ |
| 585 | public String[] splitPublicSourceDirs; |
| 586 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 587 | /** |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 588 | * Full paths to the locations of extra resource packages this application |
| 589 | * uses. This field is only used if there are extra resource packages, |
| 590 | * otherwise it is null. |
Kenny Root | ace5a3f | 2010-02-05 12:59:28 -0800 | [diff] [blame] | 591 | * |
| 592 | * {@hide} |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 593 | */ |
| 594 | public String[] resourceDirs; |
| 595 | |
| 596 | /** |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 597 | * String retrieved from the seinfo tag found in selinux policy. This value |
Robert Craig | 5e16bc5 | 2015-08-28 12:11:41 -0400 | [diff] [blame] | 598 | * can be overridden with a value set through the mac_permissions.xml policy |
| 599 | * construct. This value is useful in setting an SELinux security context on |
| 600 | * the process as well as its data directory. The String default is being used |
| 601 | * here to represent a catchall label when no policy matches. |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 602 | * |
| 603 | * {@hide} |
| 604 | */ |
Robert Craig | 5e16bc5 | 2015-08-28 12:11:41 -0400 | [diff] [blame] | 605 | public String seinfo = "default"; |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 606 | |
| 607 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 608 | * Paths to all shared libraries this application is linked against. This |
| 609 | * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES |
| 610 | * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving |
| 611 | * the structure. |
| 612 | */ |
| 613 | public String[] sharedLibraryFiles; |
| 614 | |
| 615 | /** |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 616 | * Full path to the default directory assigned to the package for its |
| 617 | * persistent data. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 618 | */ |
| 619 | public String dataDir; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 620 | |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 621 | /** |
| 622 | * Full path to the device-encrypted directory assigned to the package for |
| 623 | * its persistent data. |
| 624 | */ |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 625 | public String deviceEncryptedDataDir; |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 626 | |
| 627 | /** |
| 628 | * Full path to the credential-encrypted directory assigned to the package |
| 629 | * for its persistent data. |
| 630 | */ |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 631 | public String credentialEncryptedDataDir; |
| 632 | |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 633 | /** |
| 634 | * Full path to the directory where native JNI libraries are stored. |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 635 | */ |
| 636 | public String nativeLibraryDir; |
| 637 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 638 | /** |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 639 | * Full path where unpacked native libraries for {@link #secondaryCpuAbi} |
| 640 | * are stored, if present. |
| 641 | * |
| 642 | * The main reason this exists is for bundled multi-arch apps, where |
| 643 | * it's not trivial to calculate the location of libs for the secondary abi |
| 644 | * given the location of the primary. |
| 645 | * |
| 646 | * TODO: Change the layout of bundled installs so that we can use |
| 647 | * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well. |
| 648 | * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]} |
| 649 | * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}. |
| 650 | * |
| 651 | * @hide |
| 652 | */ |
| 653 | public String secondaryNativeLibraryDir; |
| 654 | |
| 655 | /** |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 656 | * The root path where unpacked native libraries are stored. |
| 657 | * <p> |
| 658 | * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are |
| 659 | * placed in ISA-specific subdirectories under this path, otherwise the |
| 660 | * libraries are placed directly at this path. |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 661 | * |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 662 | * @hide |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 663 | */ |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 664 | public String nativeLibraryRootDir; |
| 665 | |
| 666 | /** |
| 667 | * Flag indicating that ISA must be appended to |
| 668 | * {@link #nativeLibraryRootDir} to be useful. |
| 669 | * |
| 670 | * @hide |
| 671 | */ |
| 672 | public boolean nativeLibraryRootRequiresIsa; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 673 | |
| 674 | /** |
| 675 | * The primary ABI that this application requires, This is inferred from the ABIs |
Ramin Zaghi | ff0c470 | 2014-04-01 15:02:29 +0100 | [diff] [blame] | 676 | * of the native JNI libraries the application bundles. Will be {@code null} |
| 677 | * if this application does not require any particular ABI. |
| 678 | * |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 679 | * If non-null, the application will always be launched with this ABI. |
| 680 | * |
Ramin Zaghi | ff0c470 | 2014-04-01 15:02:29 +0100 | [diff] [blame] | 681 | * {@hide} |
| 682 | */ |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 683 | public String primaryCpuAbi; |
| 684 | |
| 685 | /** |
| 686 | * The secondary ABI for this application. Might be non-null for multi-arch |
| 687 | * installs. The application itself never uses this ABI, but other applications that |
| 688 | * use its code might. |
| 689 | * |
| 690 | * {@hide} |
| 691 | */ |
| 692 | public String secondaryCpuAbi; |
| 693 | |
| 694 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 695 | * The kernel user-ID that has been assigned to this application; |
| 696 | * currently this is not a unique ID (multiple applications can have |
| 697 | * the same uid). |
| 698 | */ |
| 699 | public int uid; |
| 700 | |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 701 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 702 | * The minimum SDK version this application targets. It may run on earlier |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 703 | * versions, but it knows how to work with any new behavior added at this |
| 704 | * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT} |
| 705 | * if this is a development build and the app is targeting that. You should |
| 706 | * compare that this number is >= the SDK version number at which your |
| 707 | * behavior was introduced. |
| 708 | */ |
| 709 | public int targetSdkVersion; |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 710 | |
| 711 | /** |
| 712 | * The app's declared version code. |
| 713 | * @hide |
| 714 | */ |
| 715 | public int versionCode; |
| 716 | |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 717 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 718 | * When false, indicates that all components within this application are |
| 719 | * considered disabled, regardless of their individually set enabled status. |
| 720 | */ |
| 721 | public boolean enabled = true; |
| 722 | |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 723 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 724 | * For convenient access to the current enabled setting of this app. |
| 725 | * @hide |
| 726 | */ |
| 727 | public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; |
| 728 | |
| 729 | /** |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 730 | * For convenient access to package's install location. |
| 731 | * @hide |
| 732 | */ |
| 733 | public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED; |
Jose Lima | 12d0b4c | 2014-03-14 16:55:12 -0700 | [diff] [blame] | 734 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 735 | public void dump(Printer pw, String prefix) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 736 | dump(pw, prefix, DUMP_FLAG_ALL); |
| 737 | } |
| 738 | |
| 739 | /** @hide */ |
| 740 | public void dump(Printer pw, String prefix, int flags) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 741 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 742 | if ((flags&DUMP_FLAG_DETAILS) != 0 && className != null) { |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 743 | pw.println(prefix + "className=" + className); |
| 744 | } |
| 745 | if (permission != null) { |
| 746 | pw.println(prefix + "permission=" + permission); |
| 747 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 748 | pw.println(prefix + "processName=" + processName); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 749 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 750 | pw.println(prefix + "taskAffinity=" + taskAffinity); |
| 751 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 752 | pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags) |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 753 | + " privateFlags=0x" + Integer.toHexString(privateFlags) |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 754 | + " theme=0x" + Integer.toHexString(theme)); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 755 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 756 | pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp |
| 757 | + " compatibleWidthLimitDp=" + compatibleWidthLimitDp |
| 758 | + " largestWidthLimitDp=" + largestWidthLimitDp); |
| 759 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 760 | pw.println(prefix + "sourceDir=" + sourceDir); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 761 | if (!Objects.equals(sourceDir, publicSourceDir)) { |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 762 | pw.println(prefix + "publicSourceDir=" + publicSourceDir); |
| 763 | } |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 764 | if (!ArrayUtils.isEmpty(splitSourceDirs)) { |
| 765 | pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs)); |
| 766 | } |
| 767 | if (!ArrayUtils.isEmpty(splitPublicSourceDirs) |
| 768 | && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) { |
| 769 | pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs)); |
| 770 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 771 | if (resourceDirs != null) { |
Andreas Gampe | e6748ce | 2015-12-11 18:00:38 -0800 | [diff] [blame] | 772 | pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs)); |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 773 | } |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 774 | if ((flags&DUMP_FLAG_DETAILS) != 0 && seinfo != null) { |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 775 | pw.println(prefix + "seinfo=" + seinfo); |
| 776 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 777 | pw.println(prefix + "dataDir=" + dataDir); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 778 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 779 | pw.println(prefix + "deviceEncryptedDataDir=" + deviceEncryptedDataDir); |
| 780 | pw.println(prefix + "credentialEncryptedDataDir=" + credentialEncryptedDataDir); |
| 781 | if (sharedLibraryFiles != null) { |
| 782 | pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles)); |
| 783 | } |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 784 | } |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 785 | pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion |
| 786 | + " versionCode=" + versionCode); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 787 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 788 | if (manageSpaceActivityName != null) { |
| 789 | pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName); |
| 790 | } |
| 791 | if (descriptionRes != 0) { |
| 792 | pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes)); |
| 793 | } |
| 794 | if (uiOptions != 0) { |
| 795 | pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 796 | } |
| 797 | pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false")); |
| 798 | if (fullBackupContent > 0) { |
| 799 | pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent); |
| 800 | } else { |
| 801 | pw.println(prefix + "fullBackupContent=" |
| 802 | + (fullBackupContent < 0 ? "false" : "true")); |
| 803 | } |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 804 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 805 | super.dumpBack(pw, prefix); |
| 806 | } |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 807 | |
| 808 | /** |
| 809 | * @return true if "supportsRtl" has been set to true in the AndroidManifest |
| 810 | * @hide |
| 811 | */ |
| 812 | public boolean hasRtlSupport() { |
| 813 | return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL; |
| 814 | } |
Jeff Sharkey | ba75a9b | 2016-01-07 11:51:33 -0700 | [diff] [blame] | 815 | |
| 816 | /** {@hide} */ |
| 817 | public boolean hasCode() { |
| 818 | return (flags & FLAG_HAS_CODE) != 0; |
| 819 | } |
| 820 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 821 | public static class DisplayNameComparator |
| 822 | implements Comparator<ApplicationInfo> { |
| 823 | public DisplayNameComparator(PackageManager pm) { |
| 824 | mPM = pm; |
| 825 | } |
| 826 | |
| 827 | public final int compare(ApplicationInfo aa, ApplicationInfo ab) { |
| 828 | CharSequence sa = mPM.getApplicationLabel(aa); |
| 829 | if (sa == null) { |
| 830 | sa = aa.packageName; |
| 831 | } |
| 832 | CharSequence sb = mPM.getApplicationLabel(ab); |
| 833 | if (sb == null) { |
| 834 | sb = ab.packageName; |
| 835 | } |
| 836 | |
| 837 | return sCollator.compare(sa.toString(), sb.toString()); |
| 838 | } |
| 839 | |
| 840 | private final Collator sCollator = Collator.getInstance(); |
| 841 | private PackageManager mPM; |
| 842 | } |
| 843 | |
| 844 | public ApplicationInfo() { |
| 845 | } |
| 846 | |
| 847 | public ApplicationInfo(ApplicationInfo orig) { |
| 848 | super(orig); |
| 849 | taskAffinity = orig.taskAffinity; |
| 850 | permission = orig.permission; |
| 851 | processName = orig.processName; |
| 852 | className = orig.className; |
| 853 | theme = orig.theme; |
| 854 | flags = orig.flags; |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 855 | privateFlags = orig.privateFlags; |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 856 | requiresSmallestWidthDp = orig.requiresSmallestWidthDp; |
| 857 | compatibleWidthLimitDp = orig.compatibleWidthLimitDp; |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 858 | largestWidthLimitDp = orig.largestWidthLimitDp; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 859 | volumeUuid = orig.volumeUuid; |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 860 | scanSourceDir = orig.scanSourceDir; |
| 861 | scanPublicSourceDir = orig.scanPublicSourceDir; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 862 | sourceDir = orig.sourceDir; |
| 863 | publicSourceDir = orig.publicSourceDir; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 864 | splitSourceDirs = orig.splitSourceDirs; |
| 865 | splitPublicSourceDirs = orig.splitPublicSourceDirs; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 866 | nativeLibraryDir = orig.nativeLibraryDir; |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 867 | secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir; |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 868 | nativeLibraryRootDir = orig.nativeLibraryRootDir; |
| 869 | nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 870 | primaryCpuAbi = orig.primaryCpuAbi; |
| 871 | secondaryCpuAbi = orig.secondaryCpuAbi; |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 872 | resourceDirs = orig.resourceDirs; |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 873 | seinfo = orig.seinfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 874 | sharedLibraryFiles = orig.sharedLibraryFiles; |
| 875 | dataDir = orig.dataDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 876 | deviceEncryptedDataDir = orig.deviceEncryptedDataDir; |
| 877 | credentialEncryptedDataDir = orig.credentialEncryptedDataDir; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 878 | uid = orig.uid; |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 879 | targetSdkVersion = orig.targetSdkVersion; |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 880 | versionCode = orig.versionCode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 881 | enabled = orig.enabled; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 882 | enabledSetting = orig.enabledSetting; |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 883 | installLocation = orig.installLocation; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 884 | manageSpaceActivityName = orig.manageSpaceActivityName; |
| 885 | descriptionRes = orig.descriptionRes; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 886 | uiOptions = orig.uiOptions; |
Christopher Tate | bcb0255 | 2012-10-16 17:14:34 -0700 | [diff] [blame] | 887 | backupAgentName = orig.backupAgentName; |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 888 | fullBackupContent = orig.fullBackupContent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 889 | } |
| 890 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 891 | public String toString() { |
| 892 | return "ApplicationInfo{" |
| 893 | + Integer.toHexString(System.identityHashCode(this)) |
| 894 | + " " + packageName + "}"; |
| 895 | } |
| 896 | |
| 897 | public int describeContents() { |
| 898 | return 0; |
| 899 | } |
| 900 | |
| 901 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 902 | super.writeToParcel(dest, parcelableFlags); |
| 903 | dest.writeString(taskAffinity); |
| 904 | dest.writeString(permission); |
| 905 | dest.writeString(processName); |
| 906 | dest.writeString(className); |
| 907 | dest.writeInt(theme); |
| 908 | dest.writeInt(flags); |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 909 | dest.writeInt(privateFlags); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 910 | dest.writeInt(requiresSmallestWidthDp); |
| 911 | dest.writeInt(compatibleWidthLimitDp); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 912 | dest.writeInt(largestWidthLimitDp); |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 913 | dest.writeString(volumeUuid); |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 914 | dest.writeString(scanSourceDir); |
| 915 | dest.writeString(scanPublicSourceDir); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 916 | dest.writeString(sourceDir); |
| 917 | dest.writeString(publicSourceDir); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 918 | dest.writeStringArray(splitSourceDirs); |
| 919 | dest.writeStringArray(splitPublicSourceDirs); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 920 | dest.writeString(nativeLibraryDir); |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 921 | dest.writeString(secondaryNativeLibraryDir); |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 922 | dest.writeString(nativeLibraryRootDir); |
| 923 | dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0); |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 924 | dest.writeString(primaryCpuAbi); |
| 925 | dest.writeString(secondaryCpuAbi); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 926 | dest.writeStringArray(resourceDirs); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 927 | dest.writeString(seinfo); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 928 | dest.writeStringArray(sharedLibraryFiles); |
| 929 | dest.writeString(dataDir); |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 930 | dest.writeString(deviceEncryptedDataDir); |
| 931 | dest.writeString(credentialEncryptedDataDir); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 932 | dest.writeInt(uid); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 933 | dest.writeInt(targetSdkVersion); |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 934 | dest.writeInt(versionCode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 935 | dest.writeInt(enabled ? 1 : 0); |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 936 | dest.writeInt(enabledSetting); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 937 | dest.writeInt(installLocation); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 938 | dest.writeString(manageSpaceActivityName); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 939 | dest.writeString(backupAgentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 940 | dest.writeInt(descriptionRes); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 941 | dest.writeInt(uiOptions); |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 942 | dest.writeInt(fullBackupContent); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | public static final Parcelable.Creator<ApplicationInfo> CREATOR |
| 946 | = new Parcelable.Creator<ApplicationInfo>() { |
| 947 | public ApplicationInfo createFromParcel(Parcel source) { |
| 948 | return new ApplicationInfo(source); |
| 949 | } |
| 950 | public ApplicationInfo[] newArray(int size) { |
| 951 | return new ApplicationInfo[size]; |
| 952 | } |
| 953 | }; |
| 954 | |
| 955 | private ApplicationInfo(Parcel source) { |
| 956 | super(source); |
| 957 | taskAffinity = source.readString(); |
| 958 | permission = source.readString(); |
| 959 | processName = source.readString(); |
| 960 | className = source.readString(); |
| 961 | theme = source.readInt(); |
| 962 | flags = source.readInt(); |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 963 | privateFlags = source.readInt(); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 964 | requiresSmallestWidthDp = source.readInt(); |
| 965 | compatibleWidthLimitDp = source.readInt(); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 966 | largestWidthLimitDp = source.readInt(); |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 967 | volumeUuid = source.readString(); |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 968 | scanSourceDir = source.readString(); |
| 969 | scanPublicSourceDir = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 970 | sourceDir = source.readString(); |
| 971 | publicSourceDir = source.readString(); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 972 | splitSourceDirs = source.readStringArray(); |
| 973 | splitPublicSourceDirs = source.readStringArray(); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 974 | nativeLibraryDir = source.readString(); |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 975 | secondaryNativeLibraryDir = source.readString(); |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 976 | nativeLibraryRootDir = source.readString(); |
| 977 | nativeLibraryRootRequiresIsa = source.readInt() != 0; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 978 | primaryCpuAbi = source.readString(); |
| 979 | secondaryCpuAbi = source.readString(); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 980 | resourceDirs = source.readStringArray(); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 981 | seinfo = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 982 | sharedLibraryFiles = source.readStringArray(); |
| 983 | dataDir = source.readString(); |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 984 | deviceEncryptedDataDir = source.readString(); |
| 985 | credentialEncryptedDataDir = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 986 | uid = source.readInt(); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 987 | targetSdkVersion = source.readInt(); |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 988 | versionCode = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 989 | enabled = source.readInt() != 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 990 | enabledSetting = source.readInt(); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 991 | installLocation = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 992 | manageSpaceActivityName = source.readString(); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 993 | backupAgentName = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 994 | descriptionRes = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 995 | uiOptions = source.readInt(); |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 996 | fullBackupContent = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 997 | } |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 998 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 999 | /** |
| 1000 | * Retrieve the textual description of the application. This |
| 1001 | * will call back on the given PackageManager to load the description from |
| 1002 | * the application. |
| 1003 | * |
| 1004 | * @param pm A PackageManager from which the label can be loaded; usually |
| 1005 | * the PackageManager from which you originally retrieved this item. |
| 1006 | * |
| 1007 | * @return Returns a CharSequence containing the application's description. |
| 1008 | * If there is no description, null is returned. |
| 1009 | */ |
| 1010 | public CharSequence loadDescription(PackageManager pm) { |
| 1011 | if (descriptionRes != 0) { |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1012 | CharSequence label = pm.getText(packageName, descriptionRes, this); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1013 | if (label != null) { |
| 1014 | return label; |
| 1015 | } |
| 1016 | } |
| 1017 | return null; |
| 1018 | } |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1019 | |
| 1020 | /** |
| 1021 | * Disable compatibility mode |
| 1022 | * |
| 1023 | * @hide |
| 1024 | */ |
| 1025 | public void disableCompatibilityMode() { |
Mitsuru Oshima | 69fff4a | 2009-07-21 09:51:05 -0700 | [diff] [blame] | 1026 | flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS | |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 1027 | FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS | |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 1028 | FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS); |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1029 | } |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1030 | |
| 1031 | /** {@hide} */ |
| 1032 | public void initForUser(int userId) { |
| 1033 | uid = UserHandle.getUid(userId, UserHandle.getAppId(uid)); |
| 1034 | |
| 1035 | if ("android".equals(packageName)) { |
| 1036 | dataDir = Environment.getDataSystemDirectory().getAbsolutePath(); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | deviceEncryptedDataDir = Environment |
| 1041 | .getDataUserDeviceEncryptedPackageDirectory(volumeUuid, userId, packageName) |
| 1042 | .getAbsolutePath(); |
| 1043 | credentialEncryptedDataDir = Environment |
| 1044 | .getDataUserCredentialEncryptedPackageDirectory(volumeUuid, userId, packageName) |
| 1045 | .getAbsolutePath(); |
| 1046 | |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 1047 | if ((privateFlags & PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED) != 0 |
Jeff Sharkey | ba51235 | 2015-11-12 20:17:45 -0800 | [diff] [blame] | 1048 | && StorageManager.isFileBasedEncryptionEnabled()) { |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1049 | dataDir = deviceEncryptedDataDir; |
| 1050 | } else { |
| 1051 | dataDir = credentialEncryptedDataDir; |
| 1052 | } |
| 1053 | } |
| 1054 | |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1055 | /** |
| 1056 | * @hide |
| 1057 | */ |
Alexandra Gherghina | a709314 | 2014-07-30 13:43:39 +0100 | [diff] [blame] | 1058 | @Override |
| 1059 | public Drawable loadDefaultIcon(PackageManager pm) { |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1060 | if ((flags & FLAG_EXTERNAL_STORAGE) != 0 |
| 1061 | && isPackageUnavailable(pm)) { |
| 1062 | return Resources.getSystem().getDrawable( |
| 1063 | com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon); |
| 1064 | } |
| 1065 | return pm.getDefaultActivityIcon(); |
| 1066 | } |
| 1067 | |
| 1068 | private boolean isPackageUnavailable(PackageManager pm) { |
| 1069 | try { |
| 1070 | return pm.getPackageInfo(packageName, 0) == null; |
| 1071 | } catch (NameNotFoundException ex) { |
| 1072 | return true; |
| 1073 | } |
| 1074 | } |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 1075 | |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1076 | /** |
| 1077 | * @hide |
| 1078 | */ |
Fyodor Kupolov | eeea67b | 2015-02-23 17:14:45 -0800 | [diff] [blame] | 1079 | public boolean isForwardLocked() { |
| 1080 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0; |
| 1081 | } |
| 1082 | |
| 1083 | /** |
| 1084 | * @hide |
| 1085 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 1086 | @TestApi |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1087 | public boolean isSystemApp() { |
| 1088 | return (flags & ApplicationInfo.FLAG_SYSTEM) != 0; |
| 1089 | } |
| 1090 | |
| 1091 | /** |
| 1092 | * @hide |
| 1093 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 1094 | @TestApi |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 1095 | public boolean isPrivilegedApp() { |
| 1096 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0; |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * @hide |
| 1101 | */ |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1102 | public boolean isUpdatedSystemApp() { |
| 1103 | return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; |
| 1104 | } |
| 1105 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 1106 | /** @hide */ |
| 1107 | public boolean isInternal() { |
| 1108 | return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0; |
| 1109 | } |
| 1110 | |
| 1111 | /** @hide */ |
| 1112 | public boolean isExternalAsec() { |
| 1113 | return TextUtils.isEmpty(volumeUuid) |
| 1114 | && (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0; |
| 1115 | } |
| 1116 | |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 1117 | /** @hide */ |
| 1118 | public boolean isEncryptionAware() { |
| 1119 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE) != 0; |
| 1120 | } |
| 1121 | |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 1122 | /** @hide */ |
| 1123 | public boolean isPartiallyEncryptionAware() { |
| 1124 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE) != 0; |
| 1125 | } |
| 1126 | |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1127 | /** |
| 1128 | * @hide |
| 1129 | */ |
Jeff Vander Stoep | a4407bf | 2015-10-30 13:15:58 -0700 | [diff] [blame] | 1130 | public boolean isAutoPlayApp() { |
| 1131 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_AUTOPLAY) != 0; |
| 1132 | } |
| 1133 | |
| 1134 | /** |
| 1135 | * @hide |
| 1136 | */ |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 1137 | public boolean isEphemeralApp() { |
| 1138 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_EPHEMERAL) != 0; |
| 1139 | } |
| 1140 | |
| 1141 | /** |
| 1142 | * @hide |
| 1143 | */ |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 1144 | public boolean isRequiredForSystemUser() { |
| 1145 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER) != 0; |
| 1146 | } |
| 1147 | |
| 1148 | /** |
| 1149 | * @hide |
| 1150 | */ |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1151 | @Override protected ApplicationInfo getApplicationInfo() { |
| 1152 | return this; |
| 1153 | } |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 1154 | |
| 1155 | /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; } |
| 1156 | /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; } |
| 1157 | /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; } |
| 1158 | /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; } |
| 1159 | /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; } |
| 1160 | /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; } |
| 1161 | |
| 1162 | /** {@hide} */ public String getCodePath() { return scanSourceDir; } |
| 1163 | /** {@hide} */ public String getBaseCodePath() { return sourceDir; } |
| 1164 | /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; } |
| 1165 | /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; } |
| 1166 | /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; } |
| 1167 | /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1168 | } |