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