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