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 Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 19 | import android.content.pm.PackageManager.NameNotFoundException; |
| 20 | import android.content.res.Resources; |
| 21 | import android.graphics.drawable.Drawable; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | import android.os.Parcel; |
| 23 | import android.os.Parcelable; |
| 24 | import android.util.Printer; |
| 25 | |
| 26 | import java.text.Collator; |
| 27 | import java.util.Comparator; |
| 28 | |
| 29 | /** |
| 30 | * Information you can retrieve about a particular application. This |
| 31 | * corresponds to information collected from the AndroidManifest.xml's |
| 32 | * <application> tag. |
| 33 | */ |
| 34 | public class ApplicationInfo extends PackageItemInfo implements Parcelable { |
| 35 | |
| 36 | /** |
| 37 | * Default task affinity of all activities in this application. See |
| 38 | * {@link ActivityInfo#taskAffinity} for more information. This comes |
| 39 | * from the "taskAffinity" attribute. |
| 40 | */ |
| 41 | public String taskAffinity; |
| 42 | |
| 43 | /** |
| 44 | * Optional name of a permission required to be able to access this |
| 45 | * application's components. From the "permission" attribute. |
| 46 | */ |
| 47 | public String permission; |
| 48 | |
| 49 | /** |
| 50 | * The name of the process this application should run in. From the |
| 51 | * "process" attribute or, if not set, the same as |
| 52 | * <var>packageName</var>. |
| 53 | */ |
| 54 | public String processName; |
| 55 | |
| 56 | /** |
| 57 | * Class implementing the Application object. From the "class" |
| 58 | * attribute. |
| 59 | */ |
| 60 | public String className; |
| 61 | |
| 62 | /** |
| 63 | * A style resource identifier (in the package's resources) of the |
| 64 | * description of an application. From the "description" attribute |
| 65 | * or, if not set, 0. |
| 66 | */ |
| 67 | public int descriptionRes; |
| 68 | |
| 69 | /** |
| 70 | * A style resource identifier (in the package's resources) of the |
| 71 | * default visual theme of the application. From the "theme" attribute |
| 72 | * or, if not set, 0. |
| 73 | */ |
| 74 | public int theme; |
| 75 | |
| 76 | /** |
| 77 | * Class implementing the Application's manage space |
| 78 | * functionality. From the "manageSpaceActivity" |
| 79 | * attribute. This is an optional attribute and will be null if |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 80 | * applications don't specify it in their manifest |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | */ |
| 82 | public String manageSpaceActivityName; |
| 83 | |
| 84 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 85 | * Class implementing the Application's backup functionality. From |
| 86 | * the "backupAgent" attribute. This is an optional attribute and |
| 87 | * will be null if the application does not specify it in its manifest. |
| 88 | * |
| 89 | * <p>If android:allowBackup is set to false, this attribute is ignored. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 90 | */ |
| 91 | public String backupAgentName; |
Christopher Tate | 4a627c7 | 2011-04-01 14:43:32 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 94 | * The default extra UI options for activities in this application. |
| 95 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 96 | * activity's manifest. |
| 97 | */ |
| 98 | public int uiOptions = 0; |
| 99 | |
| 100 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | * Value for {@link #flags}: if set, this application is installed in the |
| 102 | * device's system image. |
| 103 | */ |
| 104 | public static final int FLAG_SYSTEM = 1<<0; |
| 105 | |
| 106 | /** |
| 107 | * Value for {@link #flags}: set to true if this application would like to |
| 108 | * allow debugging of its |
| 109 | * code, even when installed on a non-development system. Comes |
| 110 | * from {@link android.R.styleable#AndroidManifestApplication_debuggable |
| 111 | * android:debuggable} of the <application> tag. |
| 112 | */ |
| 113 | public static final int FLAG_DEBUGGABLE = 1<<1; |
| 114 | |
| 115 | /** |
| 116 | * Value for {@link #flags}: set to true if this application has code |
| 117 | * associated with it. Comes |
| 118 | * from {@link android.R.styleable#AndroidManifestApplication_hasCode |
| 119 | * android:hasCode} of the <application> tag. |
| 120 | */ |
| 121 | public static final int FLAG_HAS_CODE = 1<<2; |
| 122 | |
| 123 | /** |
| 124 | * Value for {@link #flags}: set to true if this application is persistent. |
| 125 | * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent |
| 126 | * android:persistent} of the <application> tag. |
| 127 | */ |
| 128 | public static final int FLAG_PERSISTENT = 1<<3; |
| 129 | |
| 130 | /** |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 131 | * 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] | 132 | * {@link android.Manifest.permission#FACTORY_TEST} permission and the |
| 133 | * device is running in factory test mode. |
| 134 | */ |
| 135 | public static final int FLAG_FACTORY_TEST = 1<<4; |
| 136 | |
| 137 | /** |
| 138 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 139 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting |
| 140 | * android:allowTaskReparenting} of the <application> tag. |
| 141 | */ |
| 142 | public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5; |
| 143 | |
| 144 | /** |
| 145 | * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. |
| 146 | * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData |
| 147 | * android:allowClearUserData} of the <application> tag. |
| 148 | */ |
| 149 | public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6; |
| 150 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 151 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 152 | * Value for {@link #flags}: this is set if this application has been |
| 153 | * install as an update to a built-in system application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 154 | */ |
| 155 | public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7; |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 156 | |
| 157 | /** |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame] | 158 | * Value for {@link #flags}: this is set of the application has specified |
| 159 | * {@link android.R.styleable#AndroidManifestApplication_testOnly |
| 160 | * android:testOnly} to be true. |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 161 | */ |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 162 | public static final int FLAG_TEST_ONLY = 1<<8; |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 163 | |
| 164 | /** |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 165 | * Value for {@link #flags}: true when the application's window can be |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 166 | * reduced in size for smaller screens. Corresponds to |
| 167 | * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens |
| 168 | * android:smallScreens}. |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 169 | */ |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 170 | public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9; |
| 171 | |
| 172 | /** |
| 173 | * Value for {@link #flags}: true when the application's window can be |
| 174 | * displayed on normal screens. Corresponds to |
| 175 | * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens |
| 176 | * android:normalScreens}. |
| 177 | */ |
| 178 | public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10; |
| 179 | |
| 180 | /** |
| 181 | * Value for {@link #flags}: true when the application's window can be |
| 182 | * increased in size for larger screens. Corresponds to |
| 183 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 184 | * android:largeScreens}. |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 185 | */ |
| 186 | public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11; |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 187 | |
| 188 | /** |
Dianne Hackborn | c4db95c | 2009-07-21 17:46:02 -0700 | [diff] [blame] | 189 | * Value for {@link #flags}: true when the application knows how to adjust |
| 190 | * its UI for different screen sizes. Corresponds to |
| 191 | * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable |
| 192 | * android:resizeable}. |
| 193 | */ |
| 194 | public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12; |
| 195 | |
| 196 | /** |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 197 | * Value for {@link #flags}: true when the application knows how to |
| 198 | * accomodate different screen densities. Corresponds to |
| 199 | * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity |
| 200 | * android:anyDensity}. |
| 201 | */ |
| 202 | public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13; |
| 203 | |
| 204 | /** |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 205 | * Value for {@link #flags}: set to true if this application would like to |
| 206 | * request the VM to operate under the safe mode. Comes from |
Ben Cheng | ef3f5dd | 2010-03-29 15:47:26 -0700 | [diff] [blame] | 207 | * {@link android.R.styleable#AndroidManifestApplication_vmSafeMode |
| 208 | * android:vmSafeMode} of the <application> tag. |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 209 | */ |
| 210 | public static final int FLAG_VM_SAFE_MODE = 1<<14; |
| 211 | |
| 212 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 213 | * Value for {@link #flags}: set to <code>false</code> if the application does not wish |
| 214 | * 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] | 215 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 216 | * <p>Comes from the |
| 217 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 218 | * attribute of the <application> tag. |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 219 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 220 | public static final int FLAG_ALLOW_BACKUP = 1<<15; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 221 | |
| 222 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 223 | * Value for {@link #flags}: set to <code>false</code> if the application must be kept |
| 224 | * in memory following a full-system restore operation; <code>true</code> otherwise. |
| 225 | * Ordinarily, during a full system restore operation each application is shut down |
| 226 | * following execution of its agent's onRestore() method. Setting this attribute to |
| 227 | * <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] | 228 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 229 | * <p>If |
| 230 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 231 | * is set to <code>false</code> or no |
| 232 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 233 | * is specified, this flag will be ignored. |
| 234 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 235 | * <p>Comes from the |
| 236 | * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore} |
| 237 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 238 | */ |
Ben Cheng | 23085b7 | 2010-02-08 16:06:32 -0800 | [diff] [blame] | 239 | public static final int FLAG_KILL_AFTER_RESTORE = 1<<16; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 240 | |
| 241 | /** |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 242 | * Value for {@link #flags}: Set to <code>true</code> if the application's backup |
| 243 | * agent claims to be able to handle restore data even "from the future," |
| 244 | * i.e. from versions of the application with a versionCode greater than |
| 245 | * the one currently installed on the device. <i>Use with caution!</i> By default |
| 246 | * this attribute is <code>false</code> and the Backup Manager will ensure that data |
| 247 | * 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] | 248 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 249 | * <p>If |
| 250 | * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup} |
| 251 | * is set to <code>false</code> or no |
| 252 | * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent} |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 253 | * is specified, this flag will be ignored. |
| 254 | * |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 255 | * <p>Comes from the |
| 256 | * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion} |
| 257 | * attribute of the <application> tag. |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 258 | */ |
Christopher Tate | 3de55bc | 2010-03-12 17:28:08 -0800 | [diff] [blame] | 259 | public static final int FLAG_RESTORE_ANY_VERSION = 1<<17; |
Christopher Tate | 5e1ab33 | 2009-09-01 20:32:49 -0700 | [diff] [blame] | 260 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 261 | /** |
Dianne Hackborn | 3202d38 | 2010-04-26 17:51:34 -0700 | [diff] [blame] | 262 | * Value for {@link #flags}: Set to true if the application is |
| 263 | * currently installed on external/removable/unprotected storage. Such |
| 264 | * applications may not be available if their storage is not currently |
| 265 | * mounted. When the storage it is on is not available, it will look like |
| 266 | * the application has been uninstalled (its .apk is no longer available) |
| 267 | * but its persistent data is not removed. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 268 | */ |
Dianne Hackborn | 94c567e | 2010-04-26 18:13:10 -0700 | [diff] [blame] | 269 | public static final int FLAG_EXTERNAL_STORAGE = 1<<18; |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 270 | |
| 271 | /** |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 272 | * Value for {@link #flags}: true when the application's window can be |
| 273 | * increased in size for extra large screens. Corresponds to |
| 274 | * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens |
Dianne Hackborn | 22ec9ab | 2010-04-29 17:56:03 -0700 | [diff] [blame] | 275 | * android:xlargeScreens}. |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 276 | */ |
| 277 | public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19; |
| 278 | |
| 279 | /** |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 280 | * Value for {@link #flags}: true when the application has requested a |
| 281 | * large heap for its processes. Corresponds to |
| 282 | * {@link android.R.styleable#AndroidManifestApplication_largeHeap |
| 283 | * android:largeHeap}. |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 284 | */ |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 285 | public static final int FLAG_LARGE_HEAP = 1<<20; |
Jason parks | a3cdaa5 | 2011-01-13 14:15:43 -0600 | [diff] [blame] | 286 | |
| 287 | /** |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 288 | * Value for {@link #flags}: true if this application's package is in |
| 289 | * the stopped state. |
| 290 | */ |
| 291 | public static final int FLAG_STOPPED = 1<<21; |
| 292 | |
| 293 | /** |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 294 | * Value for {@link #flags}: true when the application is willing to support |
| 295 | * RTL (right to left). All activities will inherit this value. |
| 296 | * |
| 297 | * Set from the {@link android.R.attr#supportsRtl} attribute in the |
| 298 | * activity's manifest. |
| 299 | * |
| 300 | * Default value is false (no support for RTL). |
| 301 | */ |
| 302 | public static final int FLAG_SUPPORTS_RTL = 1<<22; |
| 303 | |
| 304 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 305 | * Value for {@link #flags}: true if the application is currently |
| 306 | * installed for the calling user. |
| 307 | */ |
| 308 | public static final int FLAG_INSTALLED = 1<<23; |
| 309 | |
| 310 | /** |
Dianne Hackborn | 5e03e2c | 2012-09-06 14:21:19 -0700 | [diff] [blame] | 311 | * Value for {@link #flags}: true if the application only has its |
| 312 | * data installed; the application package itself does not currently |
| 313 | * exist on the device. |
| 314 | */ |
| 315 | public static final int FLAG_IS_DATA_ONLY = 1<<24; |
| 316 | |
| 317 | /** |
Christopher Tate | 4ce55a3 | 2013-06-24 16:43:51 -0700 | [diff] [blame] | 318 | * Value for {@link #flags}: set to {@code true} if the application |
| 319 | * is permitted to hold privileged permissions. |
| 320 | * |
| 321 | * {@hide} |
| 322 | */ |
| 323 | public static final int FLAG_PRIVILEGED = 1<<30; |
| 324 | |
| 325 | /** |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 326 | * Value for {@link #flags}: Set to true if the application has been |
| 327 | * installed using the forward lock option. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 328 | * |
Dianne Hackborn | 75e616e | 2011-01-16 13:31:24 -0800 | [diff] [blame] | 329 | * NOTE: DO NOT CHANGE THIS VALUE! It is saved in packages.xml. |
| 330 | * |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 331 | * {@hide} |
| 332 | */ |
Dianne Hackborn | 75e616e | 2011-01-16 13:31:24 -0800 | [diff] [blame] | 333 | public static final int FLAG_FORWARD_LOCK = 1<<29; |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 334 | |
| 335 | /** |
Dianne Hackborn | 02486b1 | 2010-08-26 14:18:37 -0700 | [diff] [blame] | 336 | * Value for {@link #flags}: set to <code>true</code> if the application |
| 337 | * has reported that it is heavy-weight, and thus can not participate in |
| 338 | * the normal application lifecycle. |
| 339 | * |
| 340 | * <p>Comes from the |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 341 | * {@link android.R.styleable#AndroidManifestApplication_cantSaveState android:cantSaveState} |
Dianne Hackborn | 02486b1 | 2010-08-26 14:18:37 -0700 | [diff] [blame] | 342 | * attribute of the <application> tag. |
| 343 | * |
| 344 | * {@hide} |
| 345 | */ |
Dianne Hackborn | 75e616e | 2011-01-16 13:31:24 -0800 | [diff] [blame] | 346 | public static final int FLAG_CANT_SAVE_STATE = 1<<28; |
Dianne Hackborn | 02486b1 | 2010-08-26 14:18:37 -0700 | [diff] [blame] | 347 | |
| 348 | /** |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame^] | 349 | * Value for {@link #flags}: true if the application is blocked via restrictions and for |
| 350 | * most purposes is considered as not installed. |
| 351 | * {@hide} |
| 352 | */ |
| 353 | public static final int FLAG_BLOCKED = 1<<27; |
| 354 | |
| 355 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 356 | * Flags associated with the application. Any combination of |
| 357 | * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE}, |
| 358 | * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and |
| 359 | * {@link #FLAG_ALLOW_TASK_REPARENTING} |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 360 | * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 361 | * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS}, |
| 362 | * {@link #FLAG_SUPPORTS_NORMAL_SCREENS}, |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 363 | * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS}, |
| 364 | * {@link #FLAG_RESIZEABLE_FOR_SCREENS}, |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 365 | * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}, |
| 366 | * {@link #FLAG_INSTALLED}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 367 | */ |
| 368 | public int flags = 0; |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame^] | 369 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 370 | /** |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 371 | * The required smallest screen width the application can run on. If 0, |
| 372 | * nothing has been specified. Comes from |
| 373 | * {@link android.R.styleable#AndroidManifestSupportsScreens_requiresSmallestWidthDp |
| 374 | * android:requiresSmallestWidthDp} attribute of the <supports-screens> tag. |
| 375 | */ |
| 376 | public int requiresSmallestWidthDp = 0; |
| 377 | |
| 378 | /** |
| 379 | * The maximum smallest screen width the application is designed for. If 0, |
| 380 | * nothing has been specified. Comes from |
| 381 | * {@link android.R.styleable#AndroidManifestSupportsScreens_compatibleWidthLimitDp |
| 382 | * android:compatibleWidthLimitDp} attribute of the <supports-screens> tag. |
| 383 | */ |
| 384 | public int compatibleWidthLimitDp = 0; |
| 385 | |
| 386 | /** |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 387 | * The maximum smallest screen width the application will work on. If 0, |
| 388 | * nothing has been specified. Comes from |
| 389 | * {@link android.R.styleable#AndroidManifestSupportsScreens_largestWidthLimitDp |
| 390 | * android:largestWidthLimitDp} attribute of the <supports-screens> tag. |
| 391 | */ |
| 392 | public int largestWidthLimitDp = 0; |
| 393 | |
| 394 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 395 | * Full path to the location of this package. |
| 396 | */ |
| 397 | public String sourceDir; |
| 398 | |
| 399 | /** |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 400 | * Full path to the location of the publicly available parts of this |
| 401 | * package (i.e. the primary resource package and manifest). For |
| 402 | * non-forward-locked apps this will be the same as {@link #sourceDir). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 403 | */ |
| 404 | public String publicSourceDir; |
| 405 | |
| 406 | /** |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 407 | * Full paths to the locations of extra resource packages this application |
| 408 | * uses. This field is only used if there are extra resource packages, |
| 409 | * otherwise it is null. |
Kenny Root | ace5a3f | 2010-02-05 12:59:28 -0800 | [diff] [blame] | 410 | * |
| 411 | * {@hide} |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 412 | */ |
| 413 | public String[] resourceDirs; |
| 414 | |
| 415 | /** |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 416 | * String retrieved from the seinfo tag found in selinux policy. This value |
| 417 | * is useful in setting an SELinux security context on the process as well |
| 418 | * as its data directory. |
| 419 | * |
| 420 | * {@hide} |
| 421 | */ |
| 422 | public String seinfo; |
| 423 | |
| 424 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 425 | * Paths to all shared libraries this application is linked against. This |
| 426 | * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES |
| 427 | * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving |
| 428 | * the structure. |
| 429 | */ |
| 430 | public String[] sharedLibraryFiles; |
| 431 | |
| 432 | /** |
| 433 | * Full path to a directory assigned to the package for its persistent |
| 434 | * data. |
| 435 | */ |
| 436 | public String dataDir; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 437 | |
| 438 | /** |
| 439 | * Full path to the directory where native JNI libraries are stored. |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 440 | */ |
| 441 | public String nativeLibraryDir; |
| 442 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 443 | /** |
| 444 | * The kernel user-ID that has been assigned to this application; |
| 445 | * currently this is not a unique ID (multiple applications can have |
| 446 | * the same uid). |
| 447 | */ |
| 448 | public int uid; |
| 449 | |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 450 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 451 | * The minimum SDK version this application targets. It may run on earlier |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 452 | * versions, but it knows how to work with any new behavior added at this |
| 453 | * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT} |
| 454 | * if this is a development build and the app is targeting that. You should |
| 455 | * compare that this number is >= the SDK version number at which your |
| 456 | * behavior was introduced. |
| 457 | */ |
| 458 | public int targetSdkVersion; |
| 459 | |
| 460 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 461 | * When false, indicates that all components within this application are |
| 462 | * considered disabled, regardless of their individually set enabled status. |
| 463 | */ |
| 464 | public boolean enabled = true; |
| 465 | |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 466 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 467 | * For convenient access to the current enabled setting of this app. |
| 468 | * @hide |
| 469 | */ |
| 470 | public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; |
| 471 | |
| 472 | /** |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 473 | * For convenient access to package's install location. |
| 474 | * @hide |
| 475 | */ |
| 476 | public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED; |
| 477 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 478 | public void dump(Printer pw, String prefix) { |
| 479 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 480 | if (className != null) { |
| 481 | pw.println(prefix + "className=" + className); |
| 482 | } |
| 483 | if (permission != null) { |
| 484 | pw.println(prefix + "permission=" + permission); |
| 485 | } |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 486 | pw.println(prefix + "processName=" + processName); |
| 487 | pw.println(prefix + "taskAffinity=" + taskAffinity); |
| 488 | pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags) |
| 489 | + " theme=0x" + Integer.toHexString(theme)); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 490 | pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 491 | + " compatibleWidthLimitDp=" + compatibleWidthLimitDp |
| 492 | + " largestWidthLimitDp=" + largestWidthLimitDp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 493 | pw.println(prefix + "sourceDir=" + sourceDir); |
Dianne Hackborn | 817c247 | 2010-10-05 14:40:22 -0700 | [diff] [blame] | 494 | if (sourceDir == null) { |
| 495 | if (publicSourceDir != null) { |
| 496 | pw.println(prefix + "publicSourceDir=" + publicSourceDir); |
| 497 | } |
| 498 | } else if (!sourceDir.equals(publicSourceDir)) { |
Dianne Hackborn | 39792d2 | 2010-08-19 18:01:52 -0700 | [diff] [blame] | 499 | pw.println(prefix + "publicSourceDir=" + publicSourceDir); |
| 500 | } |
| 501 | if (resourceDirs != null) { |
| 502 | pw.println(prefix + "resourceDirs=" + resourceDirs); |
| 503 | } |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 504 | if (seinfo != null) { |
| 505 | pw.println(prefix + "seinfo=" + seinfo); |
| 506 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 507 | pw.println(prefix + "dataDir=" + dataDir); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 508 | if (sharedLibraryFiles != null) { |
| 509 | pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles); |
| 510 | } |
| 511 | pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion); |
| 512 | if (manageSpaceActivityName != null) { |
| 513 | pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName); |
| 514 | } |
| 515 | if (descriptionRes != 0) { |
| 516 | pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes)); |
| 517 | } |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 518 | if (uiOptions != 0) { |
| 519 | pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 520 | } |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 521 | pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false")); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 522 | super.dumpBack(pw, prefix); |
| 523 | } |
Fabrice Di Meglio | 59dfce8 | 2012-04-02 16:17:20 -0700 | [diff] [blame] | 524 | |
| 525 | /** |
| 526 | * @return true if "supportsRtl" has been set to true in the AndroidManifest |
| 527 | * @hide |
| 528 | */ |
| 529 | public boolean hasRtlSupport() { |
| 530 | return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL; |
| 531 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 532 | |
| 533 | public static class DisplayNameComparator |
| 534 | implements Comparator<ApplicationInfo> { |
| 535 | public DisplayNameComparator(PackageManager pm) { |
| 536 | mPM = pm; |
| 537 | } |
| 538 | |
| 539 | public final int compare(ApplicationInfo aa, ApplicationInfo ab) { |
| 540 | CharSequence sa = mPM.getApplicationLabel(aa); |
| 541 | if (sa == null) { |
| 542 | sa = aa.packageName; |
| 543 | } |
| 544 | CharSequence sb = mPM.getApplicationLabel(ab); |
| 545 | if (sb == null) { |
| 546 | sb = ab.packageName; |
| 547 | } |
| 548 | |
| 549 | return sCollator.compare(sa.toString(), sb.toString()); |
| 550 | } |
| 551 | |
| 552 | private final Collator sCollator = Collator.getInstance(); |
| 553 | private PackageManager mPM; |
| 554 | } |
| 555 | |
| 556 | public ApplicationInfo() { |
| 557 | } |
| 558 | |
| 559 | public ApplicationInfo(ApplicationInfo orig) { |
| 560 | super(orig); |
| 561 | taskAffinity = orig.taskAffinity; |
| 562 | permission = orig.permission; |
| 563 | processName = orig.processName; |
| 564 | className = orig.className; |
| 565 | theme = orig.theme; |
| 566 | flags = orig.flags; |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 567 | requiresSmallestWidthDp = orig.requiresSmallestWidthDp; |
| 568 | compatibleWidthLimitDp = orig.compatibleWidthLimitDp; |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 569 | largestWidthLimitDp = orig.largestWidthLimitDp; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 570 | sourceDir = orig.sourceDir; |
| 571 | publicSourceDir = orig.publicSourceDir; |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 572 | nativeLibraryDir = orig.nativeLibraryDir; |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 573 | resourceDirs = orig.resourceDirs; |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 574 | seinfo = orig.seinfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 575 | sharedLibraryFiles = orig.sharedLibraryFiles; |
| 576 | dataDir = orig.dataDir; |
| 577 | uid = orig.uid; |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 578 | targetSdkVersion = orig.targetSdkVersion; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 579 | enabled = orig.enabled; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 580 | enabledSetting = orig.enabledSetting; |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 581 | installLocation = orig.installLocation; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 582 | manageSpaceActivityName = orig.manageSpaceActivityName; |
| 583 | descriptionRes = orig.descriptionRes; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 584 | uiOptions = orig.uiOptions; |
Christopher Tate | bcb0255 | 2012-10-16 17:14:34 -0700 | [diff] [blame] | 585 | backupAgentName = orig.backupAgentName; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | |
| 589 | public String toString() { |
| 590 | return "ApplicationInfo{" |
| 591 | + Integer.toHexString(System.identityHashCode(this)) |
| 592 | + " " + packageName + "}"; |
| 593 | } |
| 594 | |
| 595 | public int describeContents() { |
| 596 | return 0; |
| 597 | } |
| 598 | |
| 599 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 600 | super.writeToParcel(dest, parcelableFlags); |
| 601 | dest.writeString(taskAffinity); |
| 602 | dest.writeString(permission); |
| 603 | dest.writeString(processName); |
| 604 | dest.writeString(className); |
| 605 | dest.writeInt(theme); |
| 606 | dest.writeInt(flags); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 607 | dest.writeInt(requiresSmallestWidthDp); |
| 608 | dest.writeInt(compatibleWidthLimitDp); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 609 | dest.writeInt(largestWidthLimitDp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 610 | dest.writeString(sourceDir); |
| 611 | dest.writeString(publicSourceDir); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 612 | dest.writeString(nativeLibraryDir); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 613 | dest.writeStringArray(resourceDirs); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 614 | dest.writeString(seinfo); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 615 | dest.writeStringArray(sharedLibraryFiles); |
| 616 | dest.writeString(dataDir); |
| 617 | dest.writeInt(uid); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 618 | dest.writeInt(targetSdkVersion); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 619 | dest.writeInt(enabled ? 1 : 0); |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 620 | dest.writeInt(enabledSetting); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 621 | dest.writeInt(installLocation); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 622 | dest.writeString(manageSpaceActivityName); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 623 | dest.writeString(backupAgentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 624 | dest.writeInt(descriptionRes); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 625 | dest.writeInt(uiOptions); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | public static final Parcelable.Creator<ApplicationInfo> CREATOR |
| 629 | = new Parcelable.Creator<ApplicationInfo>() { |
| 630 | public ApplicationInfo createFromParcel(Parcel source) { |
| 631 | return new ApplicationInfo(source); |
| 632 | } |
| 633 | public ApplicationInfo[] newArray(int size) { |
| 634 | return new ApplicationInfo[size]; |
| 635 | } |
| 636 | }; |
| 637 | |
| 638 | private ApplicationInfo(Parcel source) { |
| 639 | super(source); |
| 640 | taskAffinity = source.readString(); |
| 641 | permission = source.readString(); |
| 642 | processName = source.readString(); |
| 643 | className = source.readString(); |
| 644 | theme = source.readInt(); |
| 645 | flags = source.readInt(); |
Dianne Hackborn | df6e980 | 2011-05-26 14:20:23 -0700 | [diff] [blame] | 646 | requiresSmallestWidthDp = source.readInt(); |
| 647 | compatibleWidthLimitDp = source.readInt(); |
Dianne Hackborn | 2762ff3 | 2011-06-01 21:27:05 -0700 | [diff] [blame] | 648 | largestWidthLimitDp = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 649 | sourceDir = source.readString(); |
| 650 | publicSourceDir = source.readString(); |
Kenny Root | 85387d7 | 2010-08-26 10:13:11 -0700 | [diff] [blame] | 651 | nativeLibraryDir = source.readString(); |
Kenny Root | d1ab016 | 2010-01-21 17:27:14 -0800 | [diff] [blame] | 652 | resourceDirs = source.readStringArray(); |
Robert Craig | 0f40dc9 | 2013-03-25 06:33:03 -0400 | [diff] [blame] | 653 | seinfo = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 654 | sharedLibraryFiles = source.readStringArray(); |
| 655 | dataDir = source.readString(); |
| 656 | uid = source.readInt(); |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 657 | targetSdkVersion = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 658 | enabled = source.readInt() != 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 659 | enabledSetting = source.readInt(); |
Dianne Hackborn | 54e570f | 2010-10-04 18:32:32 -0700 | [diff] [blame] | 660 | installLocation = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 661 | manageSpaceActivityName = source.readString(); |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 662 | backupAgentName = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 663 | descriptionRes = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 664 | uiOptions = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 665 | } |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 666 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 667 | /** |
| 668 | * Retrieve the textual description of the application. This |
| 669 | * will call back on the given PackageManager to load the description from |
| 670 | * the application. |
| 671 | * |
| 672 | * @param pm A PackageManager from which the label can be loaded; usually |
| 673 | * the PackageManager from which you originally retrieved this item. |
| 674 | * |
| 675 | * @return Returns a CharSequence containing the application's description. |
| 676 | * If there is no description, null is returned. |
| 677 | */ |
| 678 | public CharSequence loadDescription(PackageManager pm) { |
| 679 | if (descriptionRes != 0) { |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 680 | CharSequence label = pm.getText(packageName, descriptionRes, this); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 681 | if (label != null) { |
| 682 | return label; |
| 683 | } |
| 684 | } |
| 685 | return null; |
| 686 | } |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 687 | |
| 688 | /** |
| 689 | * Disable compatibility mode |
| 690 | * |
| 691 | * @hide |
| 692 | */ |
| 693 | public void disableCompatibilityMode() { |
Mitsuru Oshima | 69fff4a | 2009-07-21 09:51:05 -0700 | [diff] [blame] | 694 | flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS | |
Dianne Hackborn | 11b822d | 2009-07-21 20:03:02 -0700 | [diff] [blame] | 695 | FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS | |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 696 | FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS); |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 697 | } |
Jeff Brown | 0733079 | 2010-03-30 19:57:08 -0700 | [diff] [blame] | 698 | |
| 699 | /** |
| 700 | * @hide |
| 701 | */ |
| 702 | @Override protected Drawable loadDefaultIcon(PackageManager pm) { |
| 703 | if ((flags & FLAG_EXTERNAL_STORAGE) != 0 |
| 704 | && isPackageUnavailable(pm)) { |
| 705 | return Resources.getSystem().getDrawable( |
| 706 | com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon); |
| 707 | } |
| 708 | return pm.getDefaultActivityIcon(); |
| 709 | } |
| 710 | |
| 711 | private boolean isPackageUnavailable(PackageManager pm) { |
| 712 | try { |
| 713 | return pm.getPackageInfo(packageName, 0) == null; |
| 714 | } catch (NameNotFoundException ex) { |
| 715 | return true; |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | /** |
| 720 | * @hide |
| 721 | */ |
| 722 | @Override protected ApplicationInfo getApplicationInfo() { |
| 723 | return this; |
| 724 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 725 | } |