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