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 | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 19 | import static android.os.Build.VERSION_CODES.DONUT; |
| 20 | |
| 21 | import android.annotation.IntDef; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 22 | import android.annotation.SystemApi; |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 23 | import android.annotation.TestApi; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 24 | import android.content.Context; |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 25 | import android.content.pm.PackageManager.NameNotFoundException; |
| 26 | import android.content.res.Resources; |
| 27 | import android.graphics.drawable.Drawable; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 28 | import android.os.Environment; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | import android.os.Parcel; |
| 30 | import android.os.Parcelable; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 31 | import android.os.UserHandle; |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 32 | import android.text.TextUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | import android.util.Printer; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 34 | import android.util.SparseIntArray; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 36 | import com.android.internal.util.ArrayUtils; |
| 37 | |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 38 | import java.lang.annotation.Retention; |
| 39 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | import java.text.Collator; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 41 | import java.util.Arrays; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | import java.util.Comparator; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 43 | import java.util.Objects; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Information you can retrieve about a particular application. This |
| 47 | * corresponds to information collected from the AndroidManifest.xml's |
| 48 | * <application> tag. |
| 49 | */ |
| 50 | public class ApplicationInfo extends PackageItemInfo implements Parcelable { |
| 51 | |
| 52 | /** |
| 53 | * Default task affinity of all activities in this application. See |
| 54 | * {@link ActivityInfo#taskAffinity} for more information. This comes |
| 55 | * from the "taskAffinity" attribute. |
| 56 | */ |
| 57 | public String taskAffinity; |
| 58 | |
| 59 | /** |
| 60 | * Optional name of a permission required to be able to access this |
| 61 | * application's components. From the "permission" attribute. |
| 62 | */ |
| 63 | public String permission; |
| 64 | |
| 65 | /** |
| 66 | * The name of the process this application should run in. From the |
| 67 | * "process" attribute or, if not set, the same as |
| 68 | * <var>packageName</var>. |
| 69 | */ |
| 70 | public String processName; |
| 71 | |
| 72 | /** |
| 73 | * Class implementing the Application object. From the "class" |
| 74 | * attribute. |
| 75 | */ |
| 76 | public String className; |
| 77 | |
| 78 | /** |
| 79 | * A style resource identifier (in the package's resources) of the |
| 80 | * description of an application. From the "description" attribute |
| 81 | * or, if not set, 0. |
| 82 | */ |
| 83 | public int descriptionRes; |
| 84 | |
| 85 | /** |
| 86 | * A style resource identifier (in the package's resources) of the |
| 87 | * default visual theme of the application. From the "theme" attribute |
| 88 | * or, if not set, 0. |
| 89 | */ |
| 90 | public int theme; |
| 91 | |
| 92 | /** |
| 93 | * Class implementing the Application's manage space |
| 94 | * functionality. From the "manageSpaceActivity" |
| 95 | * attribute. This is an optional attribute and will be null if |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 96 | * applications don't specify it in their manifest |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | */ |
| 98 | public String manageSpaceActivityName; |
| 99 | |
| 100 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 101 | * Class implementing the Application's backup functionality. From |
| 102 | * the "backupAgent" attribute. This is an optional attribute and |
| 103 | * will be null if the application does not specify it in its manifest. |
| 104 | * |
| 105 | * <p>If android:allowBackup is set to false, this attribute is ignored. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 106 | */ |
| 107 | public String backupAgentName; |
Christopher Tate | 4a627c7 | 2011-04-01 14:43:32 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 110 | * An optional attribute that indicates the app supports automatic backup of app data. |
| 111 | * <p>0 is the default and means the app's entire data folder + managed external storage will |
| 112 | * be backed up; |
| 113 | * Any negative value indicates the app does not support full-data backup, though it may still |
| 114 | * want to participate via the traditional key/value backup API; |
| 115 | * A positive number specifies an xml resource in which the application has defined its backup |
| 116 | * include/exclude criteria. |
| 117 | * <p>If android:allowBackup is set to false, this attribute is ignored. |
| 118 | * |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 119 | * @see android.content.Context#getNoBackupFilesDir() |
| 120 | * @see #FLAG_ALLOW_BACKUP |
Christopher Tate | 98fa656 | 2015-05-14 13:20:10 -0700 | [diff] [blame] | 121 | * |
| 122 | * @hide |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 123 | */ |
| 124 | public int fullBackupContent = 0; |
| 125 | |
| 126 | /** |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 127 | * The default extra UI options for activities in this application. |
| 128 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 129 | * activity's manifest. |
| 130 | */ |
| 131 | public int uiOptions = 0; |
| 132 | |
| 133 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | * Value for {@link #flags}: if set, this application is installed in the |
| 135 | * device's system image. |
| 136 | */ |
| 137 | public static final int FLAG_SYSTEM = 1<<0; |
| 138 | |
| 139 | /** |
| 140 | * Value for {@link #flags}: set to true if this application would like to |
| 141 | * allow debugging of its |
| 142 | * code, even when installed on a non-development system. Comes |
| 143 | * from {@link android.R.styleable#AndroidManifestApplication_debuggable |
| 144 | * android:debuggable} of the <application> tag. |
| 145 | */ |
| 146 | public static final int FLAG_DEBUGGABLE = 1<<1; |
| 147 | |
| 148 | /** |
| 149 | * Value for {@link #flags}: set to true if this application has code |
| 150 | * associated with it. Comes |
| 151 | * from {@link android.R.styleable#AndroidManifestApplication_hasCode |
| 152 | * android:hasCode} of the <application> tag. |
| 153 | */ |
| 154 | public static final int FLAG_HAS_CODE = 1<<2; |
| 155 | |
| 156 | /** |
| 157 | * Value for {@link #flags}: set to true if this application is persistent. |
| 158 | * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent |
| 159 | * android:persistent} of the <application> tag. |
| 160 | */ |
| 161 | public static final int FLAG_PERSISTENT = 1<<3; |
| 162 | |
| 163 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 164 | * 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] | 165 | * {@link android.Manifest.permission#FACTORY_TEST} permission and the |
| 166 | * device is running in factory test mode. |
| 167 | */ |
| 168 | public static final int FLAG_FACTORY_TEST = 1<<4; |
| 169 | |
| 170 | /** |
| 171 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 172 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting |
| 173 | * android:allowTaskReparenting} of the <application> tag. |
| 174 | */ |
| 175 | public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5; |
| 176 | |
| 177 | /** |
| 178 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 179 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData |
| 180 | * android:allowClearUserData} of the <application> tag. |
| 181 | */ |
| 182 | public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6; |
| 183 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 184 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 185 | * Value for {@link #flags}: this is set if this application has been |
Kweku Adams | 8de29ca | 2016-01-22 12:30:26 -0800 | [diff] [blame] | 186 | * 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] | 187 | */ |
| 188 | public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7; |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 189 | |
| 190 | /** |
Svet Ganov | 354cd3c | 2015-12-17 11:35:04 -0800 | [diff] [blame] | 191 | * Value for {@link #flags}: this is set if the application has specified |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame] | 192 | * {@link android.R.styleable#AndroidManifestApplication_testOnly |
| 193 | * android:testOnly} to be true. |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 194 | */ |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 195 | public static final int FLAG_TEST_ONLY = 1<<8; |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 196 | |
| 197 | /** |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 198 | * Value for {@link #flags}: true when the application's window can be |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 199 | * reduced in size for smaller screens. Corresponds to |
| 200 | * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens |
| 201 | * android:smallScreens}. |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 202 | */ |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 203 | public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9; |
| 204 | |
| 205 | /** |
| 206 | * Value for {@link #flags}: true when the application's window can be |
| 207 | * displayed on normal screens. Corresponds to |
| 208 | * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens |
| 209 | * android:normalScreens}. |
| 210 | */ |
| 211 | public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10; |
| 212 | |
| 213 | /** |
| 214 | * Value for {@link #flags}: true when the application's window can be |
| 215 | * increased in size for larger screens. Corresponds to |
| 216 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 217 | * android:largeScreens}. |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 218 | */ |
| 219 | public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11; |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 220 | |
| 221 | /** |
Dianne Hackborn | c4db95c | 2009-07-21 17:46:02 -0700 | [diff] [blame] | 222 | * Value for {@link #flags}: true when the application knows how to adjust |
| 223 | * its UI for different screen sizes. Corresponds to |
| 224 | * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable |
| 225 | * android:resizeable}. |
| 226 | */ |
| 227 | public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12; |
| 228 | |
| 229 | /** |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 230 | * Value for {@link #flags}: true when the application knows how to |
| 231 | * accomodate different screen densities. Corresponds to |
| 232 | * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity |
| 233 | * android:anyDensity}. |
| 234 | */ |
| 235 | public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13; |
| 236 | |
| 237 | /** |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 238 | * Value for {@link #flags}: set to true if this application would like to |
| 239 | * request the VM to operate under the safe mode. Comes from |
Ben Cheng | ef3f5dd | 2010-03-29 15:47:26 -0700 | [diff] [blame] | 240 | * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode |
| 241 | * android:vmSafeMode} of the <application> tag. |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 242 | */ |
| 243 | public static final int FLAG_VM_SAFE_MODE = 1<<14; |
| 244 | |
| 245 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 246 | * Value for {@link #flags}: set to <code>false</code> if the application does not wish |
| 247 | * 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] | 248 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 249 | * <p>Comes from the |
| 250 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 251 | * attribute of the <application> tag. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 252 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 253 | public static final int FLAG_ALLOW_BACKUP = 1<<15; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 254 | |
| 255 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 256 | * Value for {@link #flags}: set to <code>false</code> if the application must be kept |
| 257 | * in memory following a full-system restore operation; <code>true</code> otherwise. |
| 258 | * Ordinarily, during a full system restore operation each application is shut down |
| 259 | * following execution of its agent's onRestore() method. Setting this attribute to |
| 260 | * <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] | 261 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 262 | * <p>If |
| 263 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 264 | * is set to <code>false</code> or no |
| 265 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 266 | * is specified, this flag will be ignored. |
| 267 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 268 | * <p>Comes from the |
| 269 | * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore} |
| 270 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 271 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 272 | public static final int FLAG_KILL_AFTER_RESTORE = 1<<16; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 273 | |
| 274 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 275 | * Value for {@link #flags}: Set to <code>true</code> if the application's backup |
| 276 | * agent claims to be able to handle restore data even "from the future," |
| 277 | * i.e. from versions of the application with a versionCode greater than |
| 278 | * the one currently installed on the device. <i>Use with caution!</i> By default |
| 279 | * this attribute is <code>false</code> and the Backup Manager will ensure that data |
| 280 | * 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] | 281 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 282 | * <p>If |
| 283 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 284 | * is set to <code>false</code> or no |
| 285 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 286 | * is specified, this flag will be ignored. |
| 287 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 288 | * <p>Comes from the |
| 289 | * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion} |
| 290 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 291 | */ |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 292 | public static final int FLAG_RESTORE_ANY_VERSION = 1<<17; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 293 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 294 | /** |
Dianne Hackborn | 3202d38 | 2010-04-26 17:51:34 -0700 | [diff] [blame] | 295 | * Value for {@link #flags}: Set to true if the application is |
| 296 | * currently installed on external/removable/unprotected storage. Such |
| 297 | * applications may not be available if their storage is not currently |
| 298 | * mounted. When the storage it is on is not available, it will look like |
| 299 | * the application has been uninstalled (its .apk is no longer available) |
| 300 | * but its persistent data is not removed. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 301 | */ |
Dianne Hackborn | 94c567e | 2010-04-26 18:13:10 -0700 | [diff] [blame] | 302 | public static final int FLAG_EXTERNAL_STORAGE = 1<<18; |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 303 | |
| 304 | /** |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 305 | * Value for {@link #flags}: true when the application's window can be |
| 306 | * increased in size for extra large screens. Corresponds to |
| 307 | * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 308 | * android:xlargeScreens}. |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 309 | */ |
| 310 | public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19; |
| 311 | |
| 312 | /** |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 313 | * Value for {@link #flags}: true when the application has requested a |
| 314 | * large heap for its processes. Corresponds to |
| 315 | * {@link android.R.styleable#AndroidManifestApplication_largeHeap |
| 316 | * android:largeHeap}. |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 317 | */ |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 318 | public static final int FLAG_LARGE_HEAP = 1<<20; |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 319 | |
| 320 | /** |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 321 | * Value for {@link #flags}: true if this application's package is in |
| 322 | * the stopped state. |
| 323 | */ |
| 324 | public static final int FLAG_STOPPED = 1<<21; |
| 325 | |
| 326 | /** |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 327 | * Value for {@link #flags}: true when the application is willing to support |
| 328 | * RTL (right to left). All activities will inherit this value. |
| 329 | * |
| 330 | * Set from the {@link android.R.attr#supportsRtl} attribute in the |
| 331 | * activity's manifest. |
| 332 | * |
| 333 | * Default value is false (no support for RTL). |
| 334 | */ |
| 335 | public static final int FLAG_SUPPORTS_RTL = 1<<22; |
| 336 | |
| 337 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 338 | * Value for {@link #flags}: true if the application is currently |
| 339 | * installed for the calling user. |
| 340 | */ |
| 341 | public static final int FLAG_INSTALLED = 1<<23; |
| 342 | |
| 343 | /** |
Dianne Hackborn | 5e03e2c | 2012-09-06 14:21:19 -0700 | [diff] [blame] | 344 | * Value for {@link #flags}: true if the application only has its |
| 345 | * data installed; the application package itself does not currently |
| 346 | * exist on the device. |
| 347 | */ |
| 348 | public static final int FLAG_IS_DATA_ONLY = 1<<24; |
| 349 | |
| 350 | /** |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 351 | * Value for {@link #flags}: true if the application was declared to be a |
| 352 | * game, or false if it is a non-game application. |
| 353 | * |
| 354 | * @deprecated use {@link #CATEGORY_GAME} instead. |
Jose Lima | 12d0b4c | 2014-03-14 16:55:12 -0700 | [diff] [blame] | 355 | */ |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 356 | @Deprecated |
Jose Lima | 12d0b4c | 2014-03-14 16:55:12 -0700 | [diff] [blame] | 357 | public static final int FLAG_IS_GAME = 1<<25; |
| 358 | |
| 359 | /** |
Christopher Tate | d1de256 | 2014-06-17 17:12:35 -0700 | [diff] [blame] | 360 | * Value for {@link #flags}: {@code true} if the application asks that only |
| 361 | * full-data streaming backups of its data be performed even though it defines |
| 362 | * a {@link android.app.backup.BackupAgent BackupAgent}, which normally |
| 363 | * indicates that the app will manage its backed-up data via incremental |
| 364 | * key/value updates. |
| 365 | */ |
| 366 | public static final int FLAG_FULL_BACKUP_ONLY = 1<<26; |
| 367 | |
| 368 | /** |
Alex Klyubin | 01a959d | 2015-03-18 10:05:45 -0700 | [diff] [blame] | 369 | * Value for {@link #flags}: {@code true} if the application may use cleartext network traffic |
| 370 | * (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP |
| 371 | * without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use |
| 372 | * cleartext network traffic, in which case platform components (e.g., HTTP stacks, |
Alex Klyubin | fbf4599 | 2015-04-21 13:44:29 -0700 | [diff] [blame] | 373 | * {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to use cleartext |
| 374 | * traffic. Third-party libraries are encouraged to honor this flag as well. |
| 375 | * |
| 376 | * <p>NOTE: {@code WebView} does not honor this flag. |
| 377 | * |
Chad Brubaker | 2df5ba7 | 2016-04-11 13:31:24 -0700 | [diff] [blame] | 378 | * <p>This flag is ignored on Android N and above if an Android Network Security Config is |
| 379 | * present. |
| 380 | * |
Alex Klyubin | fbf4599 | 2015-04-21 13:44:29 -0700 | [diff] [blame] | 381 | * <p>This flag comes from |
| 382 | * {@link android.R.styleable#AndroidManifestApplication_usesCleartextTraffic |
| 383 | * android:usesCleartextTraffic} of the <application> tag. |
Alex Klyubin | 01a959d | 2015-03-18 10:05:45 -0700 | [diff] [blame] | 384 | */ |
| 385 | public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27; |
| 386 | |
| 387 | /** |
Dmitriy Ivanov | ff193d6 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 388 | * When set installer extracts native libs from .apk files. |
| 389 | */ |
| 390 | public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28; |
| 391 | |
| 392 | /** |
Alan Viverette | d70b9e7 | 2015-05-27 14:29:20 -0700 | [diff] [blame] | 393 | * Value for {@link #flags}: {@code true} when the application's rendering |
| 394 | * should be hardware accelerated. |
| 395 | */ |
| 396 | public static final int FLAG_HARDWARE_ACCELERATED = 1<<29; |
| 397 | |
| 398 | /** |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 399 | * Value for {@link #flags}: true if this application's package is in |
| 400 | * the suspended state. |
| 401 | */ |
| 402 | public static final int FLAG_SUSPENDED = 1<<30; |
| 403 | |
| 404 | /** |
Narayan Kamath | 589a1bc | 2014-07-03 14:43:26 +0100 | [diff] [blame] | 405 | * Value for {@link #flags}: true if code from this application will need to be |
| 406 | * loaded into other applications' processes. On devices that support multiple |
| 407 | * instruction sets, this implies the code might be loaded into a process that's |
| 408 | * using any of the devices supported instruction sets. |
| 409 | * |
| 410 | * <p> The system might treat such applications specially, for eg., by |
| 411 | * extracting the application's native libraries for all supported instruction |
| 412 | * sets or by compiling the application's dex code for all supported instruction |
| 413 | * sets. |
| 414 | */ |
| 415 | public static final int FLAG_MULTIARCH = 1 << 31; |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 416 | |
| 417 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 418 | * Flags associated with the application. Any combination of |
| 419 | * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE}, |
| 420 | * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and |
| 421 | * {@link #FLAG_ALLOW_TASK_REPARENTING} |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 422 | * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 423 | * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS}, |
| 424 | * {@link #FLAG_SUPPORTS_NORMAL_SCREENS}, |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 425 | * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS}, |
| 426 | * {@link #FLAG_RESIZEABLE_FOR_SCREENS}, |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 427 | * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}, |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 428 | * {@link #FLAG_ALLOW_BACKUP}, {@link #FLAG_KILL_AFTER_RESTORE}, |
| 429 | * {@link #FLAG_RESTORE_ANY_VERSION}, {@link #FLAG_EXTERNAL_STORAGE}, |
| 430 | * {@link #FLAG_LARGE_HEAP}, {@link #FLAG_STOPPED}, |
| 431 | * {@link #FLAG_SUPPORTS_RTL}, {@link #FLAG_INSTALLED}, |
| 432 | * {@link #FLAG_IS_DATA_ONLY}, {@link #FLAG_IS_GAME}, |
Alex Klyubin | 7cb000f | 2015-03-26 11:00:04 -0700 | [diff] [blame] | 433 | * {@link #FLAG_FULL_BACKUP_ONLY}, {@link #FLAG_USES_CLEARTEXT_TRAFFIC}, |
| 434 | * {@link #FLAG_MULTIARCH}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 435 | */ |
| 436 | public int flags = 0; |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 437 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | /** |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 439 | * Value for {@link #privateFlags}: true if the application is hidden via restrictions and for |
| 440 | * most purposes is considered as not installed. |
| 441 | * {@hide} |
| 442 | */ |
| 443 | public static final int PRIVATE_FLAG_HIDDEN = 1<<0; |
| 444 | |
| 445 | /** |
| 446 | * Value for {@link #privateFlags}: set to <code>true</code> if the application |
| 447 | * has reported that it is heavy-weight, and thus can not participate in |
| 448 | * the normal application lifecycle. |
| 449 | * |
| 450 | * <p>Comes from the |
| 451 | * android.R.styleable#AndroidManifestApplication_cantSaveState |
| 452 | * attribute of the <application> tag. |
| 453 | * |
| 454 | * {@hide} |
| 455 | */ |
| 456 | public static final int PRIVATE_FLAG_CANT_SAVE_STATE = 1<<1; |
| 457 | |
| 458 | /** |
| 459 | * Value for {@link #privateFlags}: Set to true if the application has been |
| 460 | * installed using the forward lock option. |
| 461 | * |
| 462 | * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml. |
| 463 | * |
| 464 | * {@hide} |
| 465 | */ |
| 466 | public static final int PRIVATE_FLAG_FORWARD_LOCK = 1<<2; |
| 467 | |
| 468 | /** |
| 469 | * Value for {@link #privateFlags}: set to {@code true} if the application |
| 470 | * is permitted to hold privileged permissions. |
| 471 | * |
| 472 | * {@hide} |
| 473 | */ |
| 474 | public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3; |
| 475 | |
| 476 | /** |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 477 | * Value for {@link #privateFlags}: {@code true} if the application has any IntentFiler |
| 478 | * 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] | 479 | * |
| 480 | * {@hide} |
| 481 | */ |
| 482 | public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4; |
| 483 | |
| 484 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 485 | * When set, the default data storage directory for this app is pointed at |
| 486 | * the device-protected location. |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 487 | * |
| 488 | * @hide |
| 489 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 490 | public static final int PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = 1 << 5; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 491 | |
| 492 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 493 | * When set, assume that all components under the given app are direct boot |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 494 | * aware, unless otherwise specified. |
| 495 | * |
| 496 | * @hide |
| 497 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 498 | public static final int PRIVATE_FLAG_DIRECT_BOOT_AWARE = 1 << 6; |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 499 | |
| 500 | /** |
Chad Brubaker | 4389c23 | 2016-11-04 14:50:50 -0700 | [diff] [blame] | 501 | * Value for {@link #flags}: {@code true} if the application is blocked via restrictions |
| 502 | * and for most purposes is considered as not installed. |
| 503 | * {@hide} |
| 504 | */ |
| 505 | public static final int PRIVATE_FLAG_EPHEMERAL = 1 << 7; |
| 506 | |
| 507 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 508 | * When set, at least one component inside this application is direct boot |
| 509 | * aware. |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 510 | * |
| 511 | * @hide |
| 512 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 513 | public static final int PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE = 1 << 8; |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 514 | |
Fyodor Kupolov | f99104d | 2015-12-14 11:31:29 -0800 | [diff] [blame] | 515 | |
| 516 | /** |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 517 | * When set, signals that the application is required for the system user and should not be |
| 518 | * uninstalled. |
| 519 | * |
| 520 | * @hide |
| 521 | */ |
Chad Brubaker | 4389c23 | 2016-11-04 14:50:50 -0700 | [diff] [blame] | 522 | public static final int PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER = 1 << 9; |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 523 | |
| 524 | /** |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 525 | * When set, the application explicitly requested that its activities by resizeable by default. |
Wale Ogunwale | 6afdf91 | 2016-01-30 13:01:33 -0800 | [diff] [blame] | 526 | * @see android.R.styleable#AndroidManifestActivity_resizeableActivity |
| 527 | * |
| 528 | * @hide |
| 529 | */ |
Chad Brubaker | 4389c23 | 2016-11-04 14:50:50 -0700 | [diff] [blame] | 530 | public static final int PRIVATE_FLAG_RESIZEABLE_ACTIVITIES_EXPLICITLY_SET = 1 << 10; |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 531 | |
| 532 | /** |
| 533 | * The application isn't requesting explicitly requesting for its activities to be resizeable or |
| 534 | * non-resizeable by default. So, we are making it activities resizeable by default based on the |
| 535 | * target SDK version of the app. |
| 536 | * @see android.R.styleable#AndroidManifestActivity_resizeableActivity |
| 537 | * |
| 538 | * NOTE: This only affects apps with target SDK >= N where the resizeableActivity attribute was |
| 539 | * introduced. It shouldn't be confused with {@link ActivityInfo#RESIZE_MODE_FORCE_RESIZEABLE} |
| 540 | * where certain pre-N apps are forced to the resizeable. |
| 541 | * |
| 542 | * @hide |
| 543 | */ |
Chad Brubaker | 4389c23 | 2016-11-04 14:50:50 -0700 | [diff] [blame] | 544 | public static final int PRIVATE_FLAG_RESIZEABLE_ACTIVITIES_VIA_SDK_VERSION = 1 << 11; |
Wale Ogunwale | 6afdf91 | 2016-01-30 13:01:33 -0800 | [diff] [blame] | 545 | |
| 546 | /** |
Christopher Tate | 43fbc5f | 2016-02-17 18:00:48 -0800 | [diff] [blame] | 547 | * Value for {@link #privateFlags}: {@code true} means the OS should go ahead and |
| 548 | * run full-data backup operations for the app even when it is in a |
| 549 | * foreground-equivalent run state. Defaults to {@code false} if unspecified. |
| 550 | * @hide |
| 551 | */ |
Chad Brubaker | 4389c23 | 2016-11-04 14:50:50 -0700 | [diff] [blame] | 552 | public static final int PRIVATE_FLAG_BACKUP_IN_FOREGROUND = 1 << 12; |
Christopher Tate | 43fbc5f | 2016-02-17 18:00:48 -0800 | [diff] [blame] | 553 | |
| 554 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 555 | * Value for {@link #privateFlags}: {@code true} means this application |
| 556 | * contains a static shared library. Defaults to {@code false} if unspecified. |
| 557 | * @hide |
| 558 | */ |
| 559 | public static final int PRIVATE_FLAG_STATIC_SHARED_LIBRARY = 1 << 13; |
| 560 | |
| 561 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 562 | * Value for {@linl #privateFlags}: When set, the application will only have its splits loaded |
| 563 | * if they are required to load a component. Splits can be loaded on demand using the |
| 564 | * {@link Context#createContextForSplit(String)} API. |
| 565 | * @hide |
| 566 | */ |
| 567 | public static final int PRIVATE_FLAG_ISOLATED_SPLIT_LOADING = 1 << 14; |
| 568 | |
| 569 | /** |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 570 | * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants. |
| 571 | * {@hide} |
| 572 | */ |
| 573 | public int privateFlags; |
| 574 | |
| 575 | /** |
Clara Bayarri | 4b5a4d2 | 2017-01-27 20:15:45 +0000 | [diff] [blame^] | 576 | * @hide |
| 577 | */ |
| 578 | public static final String METADATA_PRELOADED_FONTS = "preloaded_fonts"; |
| 579 | |
| 580 | /** |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 581 | * The required smallest screen width the application can run on. If 0, |
| 582 | * nothing has been specified. Comes from |
| 583 | * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp |
| 584 | * android:requiresSmallestWidthDp} attribute of the <supports-screens> tag. |
| 585 | */ |
| 586 | public int requiresSmallestWidthDp = 0; |
| 587 | |
| 588 | /** |
| 589 | * The maximum smallest screen width the application is designed for. If 0, |
| 590 | * nothing has been specified. Comes from |
| 591 | * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp |
| 592 | * android:compatibleWidthLimitDp} attribute of the <supports-screens> tag. |
| 593 | */ |
| 594 | public int compatibleWidthLimitDp = 0; |
| 595 | |
| 596 | /** |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 597 | * The maximum smallest screen width the application will work on. If 0, |
| 598 | * nothing has been specified. Comes from |
| 599 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp |
| 600 | * android:largestWidthLimitDp} attribute of the <supports-screens> tag. |
| 601 | */ |
| 602 | public int largestWidthLimitDp = 0; |
| 603 | |
Jeff Sharkey | 6112860 | 2017-01-26 17:07:35 -0700 | [diff] [blame] | 604 | /** |
| 605 | * UUID of the storage volume on which this application is being hosted. For |
| 606 | * apps hosted on the default internal storage at |
| 607 | * {@link Environment#getDataDirectory()}, the UUID value is {@code null}. |
| 608 | */ |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 609 | public String volumeUuid; |
Jeff Sharkey | 6112860 | 2017-01-26 17:07:35 -0700 | [diff] [blame] | 610 | |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 611 | /** {@hide} */ |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 612 | public String scanSourceDir; |
| 613 | /** {@hide} */ |
| 614 | public String scanPublicSourceDir; |
| 615 | |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 616 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 617 | * Full path to the base APK for this application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 618 | */ |
| 619 | public String sourceDir; |
| 620 | |
| 621 | /** |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 622 | * Full path to the publicly available parts of {@link #sourceDir}, |
| 623 | * including resources and manifest. This may be different from |
| 624 | * {@link #sourceDir} if an application is forward locked. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 625 | */ |
| 626 | public String publicSourceDir; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 627 | |
| 628 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 629 | * The names of all installed split APKs, ordered lexicographically. |
| 630 | */ |
| 631 | public String[] splitNames; |
| 632 | |
| 633 | /** |
| 634 | * Full paths to zero or more split APKs, indexed by the same order as {@link #splitNames}. |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 635 | */ |
| 636 | public String[] splitSourceDirs; |
| 637 | |
| 638 | /** |
| 639 | * Full path to the publicly available parts of {@link #splitSourceDirs}, |
| 640 | * including resources and manifest. This may be different from |
| 641 | * {@link #splitSourceDirs} if an application is forward locked. |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 642 | * |
| 643 | * @see #splitSourceDirs |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 644 | */ |
| 645 | public String[] splitPublicSourceDirs; |
| 646 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 647 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 648 | * Maps the dependencies between split APKs. All splits implicitly depend on the base APK. |
| 649 | * |
| 650 | * Available since platform version O. |
| 651 | * |
| 652 | * Only populated if the application opts in to isolated split loading via the |
| 653 | * {@link android.R.attr.isolatedSplits} attribute in the <manifest> tag of the app's |
| 654 | * AndroidManifest.xml. |
| 655 | * |
| 656 | * The keys and values are all indices into the {@link #splitNames}, {@link #splitSourceDirs}, |
| 657 | * and {@link #splitPublicSourceDirs} arrays. |
| 658 | * Each key represents a split and its value is its parent split. |
| 659 | * Cycles do not exist because they are illegal and screened for during installation. |
| 660 | * |
| 661 | * May be null if no splits are installed, or if no dependencies exist between them. |
| 662 | * @hide |
| 663 | */ |
| 664 | public SparseIntArray splitDependencies; |
| 665 | |
| 666 | /** |
| 667 | * Full paths to the locations of extra resource packages (runtime overlays) |
| 668 | * this application uses. This field is only used if there are extra resource |
| 669 | * packages, otherwise it is null. |
| 670 | * |
Kenny Root | ace5a3f | 2010-02-05 12:59:28 -0800 | [diff] [blame] | 671 | * {@hide} |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 672 | */ |
| 673 | public String[] resourceDirs; |
| 674 | |
| 675 | /** |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 676 | * String retrieved from the seinfo tag found in selinux policy. This value |
Robert Craig | 5e16bc5 | 2015-08-28 12:11:41 -0400 | [diff] [blame] | 677 | * can be overridden with a value set through the mac_permissions.xml policy |
| 678 | * construct. This value is useful in setting an SELinux security context on |
| 679 | * the process as well as its data directory. The String default is being used |
| 680 | * here to represent a catchall label when no policy matches. |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 681 | * |
| 682 | * {@hide} |
| 683 | */ |
Robert Craig | 5e16bc5 | 2015-08-28 12:11:41 -0400 | [diff] [blame] | 684 | public String seinfo = "default"; |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 685 | |
| 686 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 687 | * Paths to all shared libraries this application is linked against. This |
| 688 | * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES |
| 689 | * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving |
| 690 | * the structure. |
| 691 | */ |
| 692 | public String[] sharedLibraryFiles; |
| 693 | |
| 694 | /** |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 695 | * Full path to the default directory assigned to the package for its |
| 696 | * persistent data. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 697 | */ |
| 698 | public String dataDir; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 699 | |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 700 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 701 | * Full path to the device-protected directory assigned to the package for |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 702 | * its persistent data. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 703 | * |
| 704 | * @see Context#createDeviceProtectedStorageContext() |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 705 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 706 | public String deviceProtectedDataDir; |
| 707 | |
| 708 | /** @removed */ |
| 709 | @Deprecated |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 710 | public String deviceEncryptedDataDir; |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 711 | |
| 712 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 713 | * Full path to the credential-protected directory assigned to the package |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 714 | * for its persistent data. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 715 | * |
| 716 | * @hide |
Jeff Sharkey | 7a30a30 | 2015-12-08 14:20:06 -0700 | [diff] [blame] | 717 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 718 | @SystemApi |
| 719 | public String credentialProtectedDataDir; |
| 720 | |
| 721 | /** @removed */ |
| 722 | @Deprecated |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 723 | public String credentialEncryptedDataDir; |
| 724 | |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 725 | /** |
| 726 | * Full path to the directory where native JNI libraries are stored. |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 727 | */ |
| 728 | public String nativeLibraryDir; |
| 729 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 730 | /** |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 731 | * Full path where unpacked native libraries for {@link #secondaryCpuAbi} |
| 732 | * are stored, if present. |
| 733 | * |
| 734 | * The main reason this exists is for bundled multi-arch apps, where |
| 735 | * it's not trivial to calculate the location of libs for the secondary abi |
| 736 | * given the location of the primary. |
| 737 | * |
| 738 | * TODO: Change the layout of bundled installs so that we can use |
| 739 | * nativeLibraryRootDir & nativeLibraryRootRequiresIsa there as well. |
| 740 | * (e.g {@code [ "/system/app-lib/Foo/arm", "/system/app-lib/Foo/arm64" ]} |
| 741 | * instead of {@code [ "/system/lib/Foo", "/system/lib64/Foo" ]}. |
| 742 | * |
| 743 | * @hide |
| 744 | */ |
| 745 | public String secondaryNativeLibraryDir; |
| 746 | |
| 747 | /** |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 748 | * The root path where unpacked native libraries are stored. |
| 749 | * <p> |
| 750 | * When {@link #nativeLibraryRootRequiresIsa} is set, the libraries are |
| 751 | * placed in ISA-specific subdirectories under this path, otherwise the |
| 752 | * libraries are placed directly at this path. |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 753 | * |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 754 | * @hide |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 755 | */ |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 756 | public String nativeLibraryRootDir; |
| 757 | |
| 758 | /** |
| 759 | * Flag indicating that ISA must be appended to |
| 760 | * {@link #nativeLibraryRootDir} to be useful. |
| 761 | * |
| 762 | * @hide |
| 763 | */ |
| 764 | public boolean nativeLibraryRootRequiresIsa; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 765 | |
| 766 | /** |
| 767 | * 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] | 768 | * of the native JNI libraries the application bundles. Will be {@code null} |
| 769 | * if this application does not require any particular ABI. |
| 770 | * |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 771 | * If non-null, the application will always be launched with this ABI. |
| 772 | * |
Ramin Zaghi | ff0c470 | 2014-04-01 15:02:29 +0100 | [diff] [blame] | 773 | * {@hide} |
| 774 | */ |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 775 | public String primaryCpuAbi; |
| 776 | |
| 777 | /** |
| 778 | * The secondary ABI for this application. Might be non-null for multi-arch |
| 779 | * installs. The application itself never uses this ABI, but other applications that |
| 780 | * use its code might. |
| 781 | * |
| 782 | * {@hide} |
| 783 | */ |
| 784 | public String secondaryCpuAbi; |
| 785 | |
| 786 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 787 | * The kernel user-ID that has been assigned to this application; |
| 788 | * currently this is not a unique ID (multiple applications can have |
| 789 | * the same uid). |
| 790 | */ |
| 791 | public int uid; |
| 792 | |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 793 | /** |
Todd Kennedy | 89d6018 | 2016-03-11 11:18:32 -0800 | [diff] [blame] | 794 | * The minimum SDK version this application can run on. It will not run |
| 795 | * on earlier versions. |
| 796 | */ |
Todd Kennedy | 6e2e7f5 | 2016-05-02 14:56:45 -0700 | [diff] [blame] | 797 | public int minSdkVersion; |
Todd Kennedy | 89d6018 | 2016-03-11 11:18:32 -0800 | [diff] [blame] | 798 | |
| 799 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 800 | * The minimum SDK version this application targets. It may run on earlier |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 801 | * versions, but it knows how to work with any new behavior added at this |
| 802 | * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT} |
| 803 | * if this is a development build and the app is targeting that. You should |
| 804 | * compare that this number is >= the SDK version number at which your |
| 805 | * behavior was introduced. |
| 806 | */ |
| 807 | public int targetSdkVersion; |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 808 | |
| 809 | /** |
| 810 | * The app's declared version code. |
| 811 | * @hide |
| 812 | */ |
| 813 | public int versionCode; |
| 814 | |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 815 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 816 | * When false, indicates that all components within this application are |
| 817 | * considered disabled, regardless of their individually set enabled status. |
| 818 | */ |
| 819 | public boolean enabled = true; |
| 820 | |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 821 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 822 | * For convenient access to the current enabled setting of this app. |
| 823 | * @hide |
| 824 | */ |
| 825 | public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; |
| 826 | |
| 827 | /** |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 828 | * For convenient access to package's install location. |
| 829 | * @hide |
| 830 | */ |
| 831 | public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED; |
Jose Lima | 12d0b4c | 2014-03-14 16:55:12 -0700 | [diff] [blame] | 832 | |
Chad Brubaker | c845b2a | 2016-05-13 14:09:27 -0700 | [diff] [blame] | 833 | /** |
| 834 | * Resource file providing the application's Network Security Config. |
| 835 | * @hide |
| 836 | */ |
| 837 | public int networkSecurityConfigRes; |
| 838 | |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 839 | /** |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 840 | * Version of the sandbox the application wants to run in. |
| 841 | * @hide |
| 842 | */ |
| 843 | public int targetSandboxVersion; |
| 844 | |
| 845 | /** |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 846 | * The category of this app. Categories are used to cluster multiple apps |
| 847 | * together into meaningful groups, such as when summarizing battery, |
| 848 | * network, or disk usage. Apps should only define this value when they fit |
| 849 | * well into one of the specific categories. |
| 850 | * <p> |
| 851 | * Set from the {@link android.R.attr#appCategory} attribute in the |
| 852 | * manifest. If the manifest doesn't define a category, this value may have |
| 853 | * been provided by the installer via |
| 854 | * {@link PackageManager#setApplicationCategoryHint(String, int)}. |
| 855 | */ |
| 856 | public @Category int category = CATEGORY_UNDEFINED; |
| 857 | |
| 858 | /** {@hide} */ |
| 859 | @IntDef({ |
| 860 | CATEGORY_UNDEFINED, |
| 861 | CATEGORY_GAME, |
| 862 | CATEGORY_AUDIO, |
| 863 | CATEGORY_VIDEO, |
| 864 | CATEGORY_IMAGE, |
| 865 | CATEGORY_SOCIAL, |
| 866 | CATEGORY_NEWS, |
| 867 | CATEGORY_MAPS, |
| 868 | CATEGORY_PRODUCTIVITY |
| 869 | }) |
| 870 | @Retention(RetentionPolicy.SOURCE) |
| 871 | public @interface Category { |
| 872 | } |
| 873 | |
| 874 | /** |
| 875 | * Value when category is undefined. |
| 876 | * |
| 877 | * @see #category |
| 878 | */ |
| 879 | public static final int CATEGORY_UNDEFINED = -1; |
| 880 | |
| 881 | /** |
| 882 | * Category for apps which are primarily games. |
| 883 | * |
| 884 | * @see #category |
| 885 | */ |
| 886 | public static final int CATEGORY_GAME = 0; |
| 887 | |
| 888 | /** |
| 889 | * Category for apps which primarily work with audio or music, such as music |
| 890 | * players. |
| 891 | * |
| 892 | * @see #category |
| 893 | */ |
| 894 | public static final int CATEGORY_AUDIO = 1; |
| 895 | |
| 896 | /** |
| 897 | * Category for apps which primarily work with video or movies, such as |
| 898 | * streaming video apps. |
| 899 | * |
| 900 | * @see #category |
| 901 | */ |
| 902 | public static final int CATEGORY_VIDEO = 2; |
| 903 | |
| 904 | /** |
| 905 | * Category for apps which primarily work with images or photos, such as |
| 906 | * camera or gallery apps. |
| 907 | * |
| 908 | * @see #category |
| 909 | */ |
| 910 | public static final int CATEGORY_IMAGE = 3; |
| 911 | |
| 912 | /** |
| 913 | * Category for apps which are primarily social apps, such as messaging, |
| 914 | * communication, or social network apps. |
| 915 | * |
| 916 | * @see #category |
| 917 | */ |
| 918 | public static final int CATEGORY_SOCIAL = 4; |
| 919 | |
| 920 | /** |
| 921 | * Category for apps which are primarily news apps, such as newspapers, |
| 922 | * magazines, or sports apps. |
| 923 | * |
| 924 | * @see #category |
| 925 | */ |
| 926 | public static final int CATEGORY_NEWS = 5; |
| 927 | |
| 928 | /** |
| 929 | * Category for apps which are primarily maps apps, such as navigation apps. |
| 930 | * |
| 931 | * @see #category |
| 932 | */ |
| 933 | public static final int CATEGORY_MAPS = 6; |
| 934 | |
| 935 | /** |
| 936 | * Category for apps which are primarily productivity apps, such as cloud |
| 937 | * storage or workplace apps. |
| 938 | * |
| 939 | * @see #category |
| 940 | */ |
| 941 | public static final int CATEGORY_PRODUCTIVITY = 7; |
| 942 | |
| 943 | /** |
| 944 | * Return a concise, localized title for the given |
| 945 | * {@link ApplicationInfo#category} value, or {@code null} for unknown |
| 946 | * values such as {@link #CATEGORY_UNDEFINED}. |
| 947 | * |
| 948 | * @see #category |
| 949 | */ |
| 950 | public static CharSequence getCategoryTitle(Context context, @Category int category) { |
| 951 | switch (category) { |
| 952 | case ApplicationInfo.CATEGORY_GAME: |
| 953 | return context.getText(com.android.internal.R.string.app_category_game); |
| 954 | case ApplicationInfo.CATEGORY_AUDIO: |
| 955 | return context.getText(com.android.internal.R.string.app_category_audio); |
| 956 | case ApplicationInfo.CATEGORY_VIDEO: |
| 957 | return context.getText(com.android.internal.R.string.app_category_video); |
| 958 | case ApplicationInfo.CATEGORY_IMAGE: |
| 959 | return context.getText(com.android.internal.R.string.app_category_image); |
| 960 | case ApplicationInfo.CATEGORY_SOCIAL: |
| 961 | return context.getText(com.android.internal.R.string.app_category_social); |
| 962 | case ApplicationInfo.CATEGORY_NEWS: |
| 963 | return context.getText(com.android.internal.R.string.app_category_news); |
| 964 | case ApplicationInfo.CATEGORY_MAPS: |
| 965 | return context.getText(com.android.internal.R.string.app_category_maps); |
| 966 | case ApplicationInfo.CATEGORY_PRODUCTIVITY: |
| 967 | return context.getText(com.android.internal.R.string.app_category_productivity); |
| 968 | default: |
| 969 | return null; |
| 970 | } |
| 971 | } |
| 972 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 973 | public void dump(Printer pw, String prefix) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 974 | dump(pw, prefix, DUMP_FLAG_ALL); |
| 975 | } |
| 976 | |
| 977 | /** @hide */ |
| 978 | public void dump(Printer pw, String prefix, int flags) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 979 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 980 | if ((flags&DUMP_FLAG_DETAILS) != 0 && className != null) { |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 981 | pw.println(prefix + "className=" + className); |
| 982 | } |
| 983 | if (permission != null) { |
| 984 | pw.println(prefix + "permission=" + permission); |
| 985 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 986 | pw.println(prefix + "processName=" + processName); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 987 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 988 | pw.println(prefix + "taskAffinity=" + taskAffinity); |
| 989 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 990 | pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags) |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 991 | + " privateFlags=0x" + Integer.toHexString(privateFlags) |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 992 | + " theme=0x" + Integer.toHexString(theme)); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 993 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 994 | pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp |
| 995 | + " compatibleWidthLimitDp=" + compatibleWidthLimitDp |
| 996 | + " largestWidthLimitDp=" + largestWidthLimitDp); |
| 997 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 998 | pw.println(prefix + "sourceDir=" + sourceDir); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 999 | if (!Objects.equals(sourceDir, publicSourceDir)) { |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 1000 | pw.println(prefix + "publicSourceDir=" + publicSourceDir); |
| 1001 | } |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 1002 | if (!ArrayUtils.isEmpty(splitSourceDirs)) { |
| 1003 | pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs)); |
| 1004 | } |
| 1005 | if (!ArrayUtils.isEmpty(splitPublicSourceDirs) |
| 1006 | && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) { |
| 1007 | pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs)); |
| 1008 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 1009 | if (resourceDirs != null) { |
Andreas Gampe | e6748ce | 2015-12-11 18:00:38 -0800 | [diff] [blame] | 1010 | pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs)); |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 1011 | } |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1012 | if ((flags&DUMP_FLAG_DETAILS) != 0 && seinfo != null) { |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 1013 | pw.println(prefix + "seinfo=" + seinfo); |
| 1014 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1015 | pw.println(prefix + "dataDir=" + dataDir); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1016 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1017 | pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir); |
| 1018 | pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1019 | if (sharedLibraryFiles != null) { |
| 1020 | pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles)); |
| 1021 | } |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1022 | } |
Todd Kennedy | 89d6018 | 2016-03-11 11:18:32 -0800 | [diff] [blame] | 1023 | pw.println(prefix + "enabled=" + enabled |
| 1024 | + " minSdkVersion=" + minSdkVersion |
| 1025 | + " targetSdkVersion=" + targetSdkVersion |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 1026 | + " versionCode=" + versionCode |
| 1027 | + " targetSandboxVersion=" + targetSandboxVersion); |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1028 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 1029 | if (manageSpaceActivityName != null) { |
| 1030 | pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName); |
| 1031 | } |
| 1032 | if (descriptionRes != 0) { |
| 1033 | pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes)); |
| 1034 | } |
| 1035 | if (uiOptions != 0) { |
| 1036 | pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 1037 | } |
| 1038 | pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false")); |
| 1039 | if (fullBackupContent > 0) { |
| 1040 | pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent); |
| 1041 | } else { |
| 1042 | pw.println(prefix + "fullBackupContent=" |
| 1043 | + (fullBackupContent < 0 ? "false" : "true")); |
| 1044 | } |
Chad Brubaker | c845b2a | 2016-05-13 14:09:27 -0700 | [diff] [blame] | 1045 | if (networkSecurityConfigRes != 0) { |
| 1046 | pw.println(prefix + "networkSecurityConfigRes=0x" |
| 1047 | + Integer.toHexString(networkSecurityConfigRes)); |
| 1048 | } |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 1049 | if (category != CATEGORY_UNDEFINED) { |
| 1050 | pw.println(prefix + "category=" + category); |
| 1051 | } |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 1052 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1053 | super.dumpBack(pw, prefix); |
| 1054 | } |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 1055 | |
| 1056 | /** |
| 1057 | * @return true if "supportsRtl" has been set to true in the AndroidManifest |
| 1058 | * @hide |
| 1059 | */ |
| 1060 | public boolean hasRtlSupport() { |
| 1061 | return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL; |
| 1062 | } |
Jeff Sharkey | ba75a9b | 2016-01-07 11:51:33 -0700 | [diff] [blame] | 1063 | |
| 1064 | /** {@hide} */ |
| 1065 | public boolean hasCode() { |
| 1066 | return (flags & FLAG_HAS_CODE) != 0; |
| 1067 | } |
| 1068 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1069 | public static class DisplayNameComparator |
| 1070 | implements Comparator<ApplicationInfo> { |
| 1071 | public DisplayNameComparator(PackageManager pm) { |
| 1072 | mPM = pm; |
| 1073 | } |
| 1074 | |
| 1075 | public final int compare(ApplicationInfo aa, ApplicationInfo ab) { |
| 1076 | CharSequence sa = mPM.getApplicationLabel(aa); |
| 1077 | if (sa == null) { |
| 1078 | sa = aa.packageName; |
| 1079 | } |
| 1080 | CharSequence sb = mPM.getApplicationLabel(ab); |
| 1081 | if (sb == null) { |
| 1082 | sb = ab.packageName; |
| 1083 | } |
| 1084 | |
| 1085 | return sCollator.compare(sa.toString(), sb.toString()); |
| 1086 | } |
| 1087 | |
| 1088 | private final Collator sCollator = Collator.getInstance(); |
| 1089 | private PackageManager mPM; |
| 1090 | } |
| 1091 | |
| 1092 | public ApplicationInfo() { |
| 1093 | } |
| 1094 | |
| 1095 | public ApplicationInfo(ApplicationInfo orig) { |
| 1096 | super(orig); |
| 1097 | taskAffinity = orig.taskAffinity; |
| 1098 | permission = orig.permission; |
| 1099 | processName = orig.processName; |
| 1100 | className = orig.className; |
| 1101 | theme = orig.theme; |
| 1102 | flags = orig.flags; |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 1103 | privateFlags = orig.privateFlags; |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 1104 | requiresSmallestWidthDp = orig.requiresSmallestWidthDp; |
| 1105 | compatibleWidthLimitDp = orig.compatibleWidthLimitDp; |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 1106 | largestWidthLimitDp = orig.largestWidthLimitDp; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 1107 | volumeUuid = orig.volumeUuid; |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 1108 | scanSourceDir = orig.scanSourceDir; |
| 1109 | scanPublicSourceDir = orig.scanPublicSourceDir; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1110 | sourceDir = orig.sourceDir; |
| 1111 | publicSourceDir = orig.publicSourceDir; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1112 | splitNames = orig.splitNames; |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 1113 | splitSourceDirs = orig.splitSourceDirs; |
| 1114 | splitPublicSourceDirs = orig.splitPublicSourceDirs; |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1115 | splitDependencies = orig.splitDependencies; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 1116 | nativeLibraryDir = orig.nativeLibraryDir; |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 1117 | secondaryNativeLibraryDir = orig.secondaryNativeLibraryDir; |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 1118 | nativeLibraryRootDir = orig.nativeLibraryRootDir; |
| 1119 | nativeLibraryRootRequiresIsa = orig.nativeLibraryRootRequiresIsa; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 1120 | primaryCpuAbi = orig.primaryCpuAbi; |
| 1121 | secondaryCpuAbi = orig.secondaryCpuAbi; |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 1122 | resourceDirs = orig.resourceDirs; |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 1123 | seinfo = orig.seinfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1124 | sharedLibraryFiles = orig.sharedLibraryFiles; |
| 1125 | dataDir = orig.dataDir; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1126 | deviceEncryptedDataDir = deviceProtectedDataDir = orig.deviceProtectedDataDir; |
| 1127 | credentialEncryptedDataDir = credentialProtectedDataDir = orig.credentialProtectedDataDir; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1128 | uid = orig.uid; |
Todd Kennedy | 89d6018 | 2016-03-11 11:18:32 -0800 | [diff] [blame] | 1129 | minSdkVersion = orig.minSdkVersion; |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 1130 | targetSdkVersion = orig.targetSdkVersion; |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 1131 | versionCode = orig.versionCode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1132 | enabled = orig.enabled; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 1133 | enabledSetting = orig.enabledSetting; |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 1134 | installLocation = orig.installLocation; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1135 | manageSpaceActivityName = orig.manageSpaceActivityName; |
| 1136 | descriptionRes = orig.descriptionRes; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1137 | uiOptions = orig.uiOptions; |
Christopher Tate | bcb0255 | 2012-10-16 17:14:34 -0700 | [diff] [blame] | 1138 | backupAgentName = orig.backupAgentName; |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 1139 | fullBackupContent = orig.fullBackupContent; |
Chad Brubaker | c845b2a | 2016-05-13 14:09:27 -0700 | [diff] [blame] | 1140 | networkSecurityConfigRes = orig.networkSecurityConfigRes; |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 1141 | category = orig.category; |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 1142 | targetSandboxVersion = orig.targetSandboxVersion; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1143 | } |
| 1144 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1145 | public String toString() { |
| 1146 | return "ApplicationInfo{" |
| 1147 | + Integer.toHexString(System.identityHashCode(this)) |
| 1148 | + " " + packageName + "}"; |
| 1149 | } |
| 1150 | |
| 1151 | public int describeContents() { |
| 1152 | return 0; |
| 1153 | } |
| 1154 | |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1155 | @SuppressWarnings("unchecked") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1156 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 1157 | super.writeToParcel(dest, parcelableFlags); |
| 1158 | dest.writeString(taskAffinity); |
| 1159 | dest.writeString(permission); |
| 1160 | dest.writeString(processName); |
| 1161 | dest.writeString(className); |
| 1162 | dest.writeInt(theme); |
| 1163 | dest.writeInt(flags); |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 1164 | dest.writeInt(privateFlags); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 1165 | dest.writeInt(requiresSmallestWidthDp); |
| 1166 | dest.writeInt(compatibleWidthLimitDp); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 1167 | dest.writeInt(largestWidthLimitDp); |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 1168 | dest.writeString(volumeUuid); |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 1169 | dest.writeString(scanSourceDir); |
| 1170 | dest.writeString(scanPublicSourceDir); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1171 | dest.writeString(sourceDir); |
| 1172 | dest.writeString(publicSourceDir); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1173 | dest.writeStringArray(splitNames); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 1174 | dest.writeStringArray(splitSourceDirs); |
| 1175 | dest.writeStringArray(splitPublicSourceDirs); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1176 | dest.writeSparseIntArray(splitDependencies); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 1177 | dest.writeString(nativeLibraryDir); |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 1178 | dest.writeString(secondaryNativeLibraryDir); |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 1179 | dest.writeString(nativeLibraryRootDir); |
| 1180 | dest.writeInt(nativeLibraryRootRequiresIsa ? 1 : 0); |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 1181 | dest.writeString(primaryCpuAbi); |
| 1182 | dest.writeString(secondaryCpuAbi); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 1183 | dest.writeStringArray(resourceDirs); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 1184 | dest.writeString(seinfo); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1185 | dest.writeStringArray(sharedLibraryFiles); |
| 1186 | dest.writeString(dataDir); |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1187 | dest.writeString(deviceProtectedDataDir); |
| 1188 | dest.writeString(credentialProtectedDataDir); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1189 | dest.writeInt(uid); |
Todd Kennedy | 6e2e7f5 | 2016-05-02 14:56:45 -0700 | [diff] [blame] | 1190 | dest.writeInt(minSdkVersion); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 1191 | dest.writeInt(targetSdkVersion); |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 1192 | dest.writeInt(versionCode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1193 | dest.writeInt(enabled ? 1 : 0); |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 1194 | dest.writeInt(enabledSetting); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 1195 | dest.writeInt(installLocation); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1196 | dest.writeString(manageSpaceActivityName); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 1197 | dest.writeString(backupAgentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1198 | dest.writeInt(descriptionRes); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1199 | dest.writeInt(uiOptions); |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 1200 | dest.writeInt(fullBackupContent); |
Chad Brubaker | c845b2a | 2016-05-13 14:09:27 -0700 | [diff] [blame] | 1201 | dest.writeInt(networkSecurityConfigRes); |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 1202 | dest.writeInt(category); |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 1203 | dest.writeInt(targetSandboxVersion); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1204 | } |
| 1205 | |
| 1206 | public static final Parcelable.Creator<ApplicationInfo> CREATOR |
| 1207 | = new Parcelable.Creator<ApplicationInfo>() { |
| 1208 | public ApplicationInfo createFromParcel(Parcel source) { |
| 1209 | return new ApplicationInfo(source); |
| 1210 | } |
| 1211 | public ApplicationInfo[] newArray(int size) { |
| 1212 | return new ApplicationInfo[size]; |
| 1213 | } |
| 1214 | }; |
| 1215 | |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1216 | @SuppressWarnings("unchecked") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1217 | private ApplicationInfo(Parcel source) { |
| 1218 | super(source); |
| 1219 | taskAffinity = source.readString(); |
| 1220 | permission = source.readString(); |
| 1221 | processName = source.readString(); |
| 1222 | className = source.readString(); |
| 1223 | theme = source.readInt(); |
| 1224 | flags = source.readInt(); |
Alex Klyubin | b9f8a52 | 2015-02-03 11:12:59 -0800 | [diff] [blame] | 1225 | privateFlags = source.readInt(); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 1226 | requiresSmallestWidthDp = source.readInt(); |
| 1227 | compatibleWidthLimitDp = source.readInt(); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 1228 | largestWidthLimitDp = source.readInt(); |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 1229 | volumeUuid = source.readString(); |
Jeff Sharkey | 7f1a57a | 2014-10-08 10:14:53 -0700 | [diff] [blame] | 1230 | scanSourceDir = source.readString(); |
| 1231 | scanPublicSourceDir = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1232 | sourceDir = source.readString(); |
| 1233 | publicSourceDir = source.readString(); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1234 | splitNames = source.readStringArray(); |
Jeff Sharkey | 8a4c972 | 2014-06-16 13:48:42 -0700 | [diff] [blame] | 1235 | splitSourceDirs = source.readStringArray(); |
| 1236 | splitPublicSourceDirs = source.readStringArray(); |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1237 | splitDependencies = source.readSparseIntArray(); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 1238 | nativeLibraryDir = source.readString(); |
Narayan Kamath | 7dba6eb | 2014-07-16 08:53:30 +0100 | [diff] [blame] | 1239 | secondaryNativeLibraryDir = source.readString(); |
Jeff Sharkey | 84f1294 | 2014-07-10 17:48:11 -0700 | [diff] [blame] | 1240 | nativeLibraryRootDir = source.readString(); |
| 1241 | nativeLibraryRootRequiresIsa = source.readInt() != 0; |
Narayan Kamath | ff110bd | 2014-07-04 18:30:45 +0100 | [diff] [blame] | 1242 | primaryCpuAbi = source.readString(); |
| 1243 | secondaryCpuAbi = source.readString(); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 1244 | resourceDirs = source.readStringArray(); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 1245 | seinfo = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1246 | sharedLibraryFiles = source.readStringArray(); |
| 1247 | dataDir = source.readString(); |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1248 | deviceEncryptedDataDir = deviceProtectedDataDir = source.readString(); |
| 1249 | credentialEncryptedDataDir = credentialProtectedDataDir = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1250 | uid = source.readInt(); |
Todd Kennedy | 6e2e7f5 | 2016-05-02 14:56:45 -0700 | [diff] [blame] | 1251 | minSdkVersion = source.readInt(); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 1252 | targetSdkVersion = source.readInt(); |
Dianne Hackborn | 8472e61 | 2014-01-23 17:57:20 -0800 | [diff] [blame] | 1253 | versionCode = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1254 | enabled = source.readInt() != 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 1255 | enabledSetting = source.readInt(); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 1256 | installLocation = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1257 | manageSpaceActivityName = source.readString(); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 1258 | backupAgentName = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1259 | descriptionRes = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1260 | uiOptions = source.readInt(); |
Matthew Williams | 303650c | 2015-04-17 18:22:51 -0700 | [diff] [blame] | 1261 | fullBackupContent = source.readInt(); |
Chad Brubaker | c845b2a | 2016-05-13 14:09:27 -0700 | [diff] [blame] | 1262 | networkSecurityConfigRes = source.readInt(); |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 1263 | category = source.readInt(); |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 1264 | targetSandboxVersion = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1265 | } |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 1266 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1267 | /** |
| 1268 | * Retrieve the textual description of the application. This |
| 1269 | * will call back on the given PackageManager to load the description from |
| 1270 | * the application. |
| 1271 | * |
| 1272 | * @param pm A PackageManager from which the label can be loaded; usually |
| 1273 | * the PackageManager from which you originally retrieved this item. |
| 1274 | * |
| 1275 | * @return Returns a CharSequence containing the application's description. |
| 1276 | * If there is no description, null is returned. |
| 1277 | */ |
| 1278 | public CharSequence loadDescription(PackageManager pm) { |
| 1279 | if (descriptionRes != 0) { |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1280 | CharSequence label = pm.getText(packageName, descriptionRes, this); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1281 | if (label != null) { |
| 1282 | return label; |
| 1283 | } |
| 1284 | } |
| 1285 | return null; |
| 1286 | } |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1287 | |
| 1288 | /** |
| 1289 | * Disable compatibility mode |
| 1290 | * |
| 1291 | * @hide |
| 1292 | */ |
| 1293 | public void disableCompatibilityMode() { |
Mitsuru Oshima | 69fff4a | 2009-07-21 09:51:05 -0700 | [diff] [blame] | 1294 | flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS | |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 1295 | FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS | |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 1296 | FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS); |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1297 | } |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1298 | |
skuhne@google.com | 7e85eb0 | 2017-01-04 13:49:54 -0800 | [diff] [blame] | 1299 | /** |
| 1300 | * Is using compatibility mode for non densty aware legacy applications. |
| 1301 | * |
| 1302 | * @hide |
| 1303 | */ |
| 1304 | public boolean usesCompatibilityMode() { |
| 1305 | return targetSdkVersion < DONUT || |
| 1306 | (flags & (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS | |
| 1307 | FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS | |
| 1308 | FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS)) == 0; |
| 1309 | } |
| 1310 | |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1311 | /** {@hide} */ |
| 1312 | public void initForUser(int userId) { |
| 1313 | uid = UserHandle.getUid(userId, UserHandle.getAppId(uid)); |
| 1314 | |
| 1315 | if ("android".equals(packageName)) { |
| 1316 | dataDir = Environment.getDataSystemDirectory().getAbsolutePath(); |
| 1317 | return; |
| 1318 | } |
| 1319 | |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1320 | deviceEncryptedDataDir = deviceProtectedDataDir = Environment |
Jeff Sharkey | 8212ae0 | 2016-02-10 14:46:43 -0700 | [diff] [blame] | 1321 | .getDataUserDePackageDirectory(volumeUuid, userId, packageName) |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1322 | .getAbsolutePath(); |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1323 | credentialEncryptedDataDir = credentialProtectedDataDir = Environment |
Jeff Sharkey | 8212ae0 | 2016-02-10 14:46:43 -0700 | [diff] [blame] | 1324 | .getDataUserCePackageDirectory(volumeUuid, userId, packageName) |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1325 | .getAbsolutePath(); |
| 1326 | |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1327 | if ((privateFlags & PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0 |
| 1328 | && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) { |
| 1329 | dataDir = deviceProtectedDataDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1330 | } else { |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1331 | dataDir = credentialProtectedDataDir; |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1332 | } |
Todd Kennedy | 11e4507 | 2017-01-25 13:24:21 -0800 | [diff] [blame] | 1333 | // TODO: modify per-user ephemerality |
Jeff Sharkey | 1544779 | 2015-11-05 16:18:51 -0800 | [diff] [blame] | 1334 | } |
| 1335 | |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1336 | /** |
| 1337 | * @hide |
| 1338 | */ |
Alexandra Gherghina | a709314 | 2014-07-30 13:43:39 +0100 | [diff] [blame] | 1339 | @Override |
| 1340 | public Drawable loadDefaultIcon(PackageManager pm) { |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1341 | if ((flags & FLAG_EXTERNAL_STORAGE) != 0 |
| 1342 | && isPackageUnavailable(pm)) { |
| 1343 | return Resources.getSystem().getDrawable( |
| 1344 | com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon); |
| 1345 | } |
| 1346 | return pm.getDefaultActivityIcon(); |
| 1347 | } |
| 1348 | |
| 1349 | private boolean isPackageUnavailable(PackageManager pm) { |
| 1350 | try { |
| 1351 | return pm.getPackageInfo(packageName, 0) == null; |
| 1352 | } catch (NameNotFoundException ex) { |
| 1353 | return true; |
| 1354 | } |
| 1355 | } |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 1356 | |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1357 | /** |
| 1358 | * @hide |
| 1359 | */ |
Fyodor Kupolov | eeea67b | 2015-02-23 17:14:45 -0800 | [diff] [blame] | 1360 | public boolean isForwardLocked() { |
| 1361 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0; |
| 1362 | } |
| 1363 | |
| 1364 | /** |
| 1365 | * @hide |
| 1366 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 1367 | @TestApi |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1368 | public boolean isSystemApp() { |
| 1369 | return (flags & ApplicationInfo.FLAG_SYSTEM) != 0; |
| 1370 | } |
| 1371 | |
| 1372 | /** |
| 1373 | * @hide |
| 1374 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 1375 | @TestApi |
Svet Ganov | adc1cf4 | 2015-06-15 16:36:24 -0700 | [diff] [blame] | 1376 | public boolean isPrivilegedApp() { |
| 1377 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0; |
| 1378 | } |
| 1379 | |
| 1380 | /** |
| 1381 | * @hide |
| 1382 | */ |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1383 | public boolean isUpdatedSystemApp() { |
| 1384 | return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; |
| 1385 | } |
| 1386 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 1387 | /** @hide */ |
| 1388 | public boolean isInternal() { |
| 1389 | return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0; |
| 1390 | } |
| 1391 | |
| 1392 | /** @hide */ |
| 1393 | public boolean isExternalAsec() { |
| 1394 | return TextUtils.isEmpty(volumeUuid) |
| 1395 | && (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0; |
| 1396 | } |
| 1397 | |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 1398 | /** @hide */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1399 | public boolean isDefaultToDeviceProtectedStorage() { |
| 1400 | return (privateFlags |
| 1401 | & ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0; |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 1402 | } |
| 1403 | |
| 1404 | /** @hide */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1405 | public boolean isDirectBootAware() { |
| 1406 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE) != 0; |
Jeff Sharkey | f9fc6d6 | 2015-11-08 16:46:05 -0800 | [diff] [blame] | 1407 | } |
| 1408 | |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 1409 | /** @hide */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 1410 | public boolean isPartiallyDirectBootAware() { |
| 1411 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0; |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 1412 | } |
| 1413 | |
Fyodor Kupolov | b94c165 | 2015-03-03 12:25:30 -0800 | [diff] [blame] | 1414 | /** |
| 1415 | * @hide |
| 1416 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 1417 | public boolean isInstantApp() { |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 1418 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_EPHEMERAL) != 0; |
| 1419 | } |
| 1420 | |
| 1421 | /** |
| 1422 | * @hide |
| 1423 | */ |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 1424 | public boolean isRequiredForSystemUser() { |
| 1425 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER) != 0; |
| 1426 | } |
| 1427 | |
| 1428 | /** |
Adam Lesinski | 4e86281 | 2016-11-21 16:02:24 -0800 | [diff] [blame] | 1429 | * Returns true if the app has declared in its manifest that it wants its split APKs to be |
| 1430 | * loaded into isolated Contexts, with their own ClassLoaders and Resources objects. |
| 1431 | * @hide |
| 1432 | */ |
| 1433 | public boolean requestsIsolatedSplitLoading() { |
| 1434 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ISOLATED_SPLIT_LOADING) != 0; |
| 1435 | } |
| 1436 | |
| 1437 | /** |
Fyodor Kupolov | bdbc969 | 2015-12-14 13:11:13 -0800 | [diff] [blame] | 1438 | * @hide |
| 1439 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 1440 | public boolean isStaticSharedLibrary() { |
| 1441 | return (privateFlags & ApplicationInfo.PRIVATE_FLAG_STATIC_SHARED_LIBRARY) != 0; |
| 1442 | } |
| 1443 | |
| 1444 | /** |
| 1445 | * @hide |
| 1446 | */ |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 1447 | @Override protected ApplicationInfo getApplicationInfo() { |
| 1448 | return this; |
| 1449 | } |
Jeff Sharkey | d746057 | 2014-07-06 20:44:55 -0700 | [diff] [blame] | 1450 | |
| 1451 | /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; } |
| 1452 | /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; } |
| 1453 | /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; } |
| 1454 | /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; } |
| 1455 | /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; } |
| 1456 | /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; } |
| 1457 | |
| 1458 | /** {@hide} */ public String getCodePath() { return scanSourceDir; } |
| 1459 | /** {@hide} */ public String getBaseCodePath() { return sourceDir; } |
| 1460 | /** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; } |
| 1461 | /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; } |
| 1462 | /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; } |
Jeff Sharkey | a3a43b0 | 2016-11-15 17:54:23 -0700 | [diff] [blame] | 1463 | /** {@hide} */ public String[] getSplitResourcePaths() { return splitPublicSourceDirs; } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1464 | } |