PackageManager.java revision 08ee42ce864dc2b3ca2ca92af7220a3681d06835
1/* 2 * Copyright (C) 2006 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 17package android.content.pm; 18 19import android.content.ComponentName; 20import android.content.Context; 21import android.content.Intent; 22import android.content.IntentFilter; 23import android.content.IntentSender; 24import android.content.res.Resources; 25import android.content.res.XmlResourceParser; 26import android.graphics.drawable.Drawable; 27import android.net.Uri; 28import android.util.AndroidException; 29import android.util.DisplayMetrics; 30 31import java.io.File; 32import java.util.List; 33 34/** 35 * Class for retrieving various kinds of information related to the application 36 * packages that are currently installed on the device. 37 * 38 * You can find this class through {@link Context#getPackageManager}. 39 */ 40public abstract class PackageManager { 41 42 /** 43 * This exception is thrown when a given package, application, or component 44 * name can not be found. 45 */ 46 public static class NameNotFoundException extends AndroidException { 47 public NameNotFoundException() { 48 } 49 50 public NameNotFoundException(String name) { 51 super(name); 52 } 53 } 54 55 /** 56 * {@link PackageInfo} flag: return information about 57 * activities in the package in {@link PackageInfo#activities}. 58 */ 59 public static final int GET_ACTIVITIES = 0x00000001; 60 61 /** 62 * {@link PackageInfo} flag: return information about 63 * intent receivers in the package in 64 * {@link PackageInfo#receivers}. 65 */ 66 public static final int GET_RECEIVERS = 0x00000002; 67 68 /** 69 * {@link PackageInfo} flag: return information about 70 * services in the package in {@link PackageInfo#services}. 71 */ 72 public static final int GET_SERVICES = 0x00000004; 73 74 /** 75 * {@link PackageInfo} flag: return information about 76 * content providers in the package in 77 * {@link PackageInfo#providers}. 78 */ 79 public static final int GET_PROVIDERS = 0x00000008; 80 81 /** 82 * {@link PackageInfo} flag: return information about 83 * instrumentation in the package in 84 * {@link PackageInfo#instrumentation}. 85 */ 86 public static final int GET_INSTRUMENTATION = 0x00000010; 87 88 /** 89 * {@link PackageInfo} flag: return information about the 90 * intent filters supported by the activity. 91 */ 92 public static final int GET_INTENT_FILTERS = 0x00000020; 93 94 /** 95 * {@link PackageInfo} flag: return information about the 96 * signatures included in the package. 97 */ 98 public static final int GET_SIGNATURES = 0x00000040; 99 100 /** 101 * {@link ResolveInfo} flag: return the IntentFilter that 102 * was matched for a particular ResolveInfo in 103 * {@link ResolveInfo#filter}. 104 */ 105 public static final int GET_RESOLVED_FILTER = 0x00000040; 106 107 /** 108 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} 109 * data {@link android.os.Bundle}s that are associated with a component. 110 * This applies for any API returning a ComponentInfo subclass. 111 */ 112 public static final int GET_META_DATA = 0x00000080; 113 114 /** 115 * {@link PackageInfo} flag: return the 116 * {@link PackageInfo#gids group ids} that are associated with an 117 * application. 118 * This applies for any API returning an PackageInfo class, either 119 * directly or nested inside of another. 120 */ 121 public static final int GET_GIDS = 0x00000100; 122 123 /** 124 * {@link PackageInfo} flag: include disabled components in the returned info. 125 */ 126 public static final int GET_DISABLED_COMPONENTS = 0x00000200; 127 128 /** 129 * {@link ApplicationInfo} flag: return the 130 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} 131 * that are associated with an application. 132 * This applies for any API returning an ApplicationInfo class, either 133 * directly or nested inside of another. 134 */ 135 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; 136 137 /** 138 * {@link ProviderInfo} flag: return the 139 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} 140 * that are associated with a content provider. 141 * This applies for any API returning an ProviderInfo class, either 142 * directly or nested inside of another. 143 */ 144 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; 145 /** 146 * {@link PackageInfo} flag: return information about 147 * permissions in the package in 148 * {@link PackageInfo#permissions}. 149 */ 150 public static final int GET_PERMISSIONS = 0x00001000; 151 152 /** 153 * Flag parameter to retrieve all applications(even uninstalled ones) with data directories. 154 * This state could have resulted if applications have been deleted with flag 155 * DONT_DELETE_DATA 156 * with a possibility of being replaced or reinstalled in future 157 */ 158 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; 159 160 /** 161 * {@link PackageInfo} flag: return information about 162 * hardware preferences in 163 * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and 164 * requested features in {@link PackageInfo#reqFeatures 165 * PackageInfo.reqFeatures}. 166 */ 167 public static final int GET_CONFIGURATIONS = 0x00004000; 168 169 /** 170 * Resolution and querying flag: if set, only filters that support the 171 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for 172 * matching. This is a synonym for including the CATEGORY_DEFAULT in your 173 * supplied Intent. 174 */ 175 public static final int MATCH_DEFAULT_ONLY = 0x00010000; 176 177 /** 178 * Permission check result: this is returned by {@link #checkPermission} 179 * if the permission has been granted to the given package. 180 */ 181 public static final int PERMISSION_GRANTED = 0; 182 183 /** 184 * Permission check result: this is returned by {@link #checkPermission} 185 * if the permission has not been granted to the given package. 186 */ 187 public static final int PERMISSION_DENIED = -1; 188 189 /** 190 * Signature check result: this is returned by {@link #checkSignatures} 191 * if the two packages have a matching signature. 192 */ 193 public static final int SIGNATURE_MATCH = 0; 194 195 /** 196 * Signature check result: this is returned by {@link #checkSignatures} 197 * if neither of the two packages is signed. 198 */ 199 public static final int SIGNATURE_NEITHER_SIGNED = 1; 200 201 /** 202 * Signature check result: this is returned by {@link #checkSignatures} 203 * if the first package is not signed, but the second is. 204 */ 205 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; 206 207 /** 208 * Signature check result: this is returned by {@link #checkSignatures} 209 * if the second package is not signed, but the first is. 210 */ 211 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; 212 213 /** 214 * Signature check result: this is returned by {@link #checkSignatures} 215 * if both packages are signed but there is no matching signature. 216 */ 217 public static final int SIGNATURE_NO_MATCH = -3; 218 219 /** 220 * Signature check result: this is returned by {@link #checkSignatures} 221 * if either of the given package names are not valid. 222 */ 223 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; 224 225 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; 226 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; 227 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; 228 229 /** 230 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to 231 * indicate that this package should be installed as forward locked, i.e. only the app itself 232 * should have access to it's code and non-resource assets. 233 * @hide 234 */ 235 public static final int INSTALL_FORWARD_LOCK = 0x00000001; 236 237 /** 238 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already 239 * installed package, if one exists. 240 * @hide 241 */ 242 public static final int INSTALL_REPLACE_EXISTING = 0x00000002; 243 244 /** 245 * Flag parameter for {@link #installPackage} to indicate that you want to 246 * allow test packages (those that have set android:testOnly in their 247 * manifest) to be installed. 248 * @hide 249 */ 250 public static final int INSTALL_ALLOW_TEST = 0x00000004; 251 252 /** 253 * Flag parameter for 254 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate 255 * that you don't want to kill the app containing the component. Be careful when you set this 256 * since changing component states can make the containing application's behavior unpredictable. 257 */ 258 public static final int DONT_KILL_APP = 0x00000001; 259 260 /** 261 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 262 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. 263 * @hide 264 */ 265 public static final int INSTALL_SUCCEEDED = 1; 266 267 /** 268 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 269 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is 270 * already installed. 271 * @hide 272 */ 273 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; 274 275 /** 276 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 277 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive 278 * file is invalid. 279 * @hide 280 */ 281 public static final int INSTALL_FAILED_INVALID_APK = -2; 282 283 /** 284 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 285 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in 286 * is invalid. 287 * @hide 288 */ 289 public static final int INSTALL_FAILED_INVALID_URI = -3; 290 291 /** 292 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 293 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager 294 * service found that the device didn't have enough storage space to install the app. 295 * @hide 296 */ 297 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; 298 299 /** 300 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 301 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a 302 * package is already installed with the same name. 303 * @hide 304 */ 305 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; 306 307 /** 308 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 309 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 310 * the requested shared user does not exist. 311 * @hide 312 */ 313 public static final int INSTALL_FAILED_NO_SHARED_USER = -6; 314 315 /** 316 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 317 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 318 * a previously installed package of the same name has a different signature 319 * than the new package (and the old package's data was not removed). 320 * @hide 321 */ 322 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; 323 324 /** 325 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 326 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 327 * the new package is requested a shared user which is already installed on the 328 * device and does not have matching signature. 329 * @hide 330 */ 331 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; 332 333 /** 334 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 335 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 336 * the new package uses a shared library that is not available. 337 * @hide 338 */ 339 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; 340 341 /** 342 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 343 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 344 * the new package uses a shared library that is not available. 345 * @hide 346 */ 347 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; 348 349 /** 350 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 351 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 352 * the new package failed while optimizing and validating its dex files, 353 * either because there was not enough storage or the validation failed. 354 * @hide 355 */ 356 public static final int INSTALL_FAILED_DEXOPT = -11; 357 358 /** 359 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 360 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 361 * the new package failed because the current SDK version is older than 362 * that required by the package. 363 * @hide 364 */ 365 public static final int INSTALL_FAILED_OLDER_SDK = -12; 366 367 /** 368 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 369 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 370 * the new package failed because it contains a content provider with the 371 * same authority as a provider already installed in the system. 372 * @hide 373 */ 374 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; 375 376 /** 377 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 378 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 379 * the new package failed because the current SDK version is newer than 380 * that required by the package. 381 * @hide 382 */ 383 public static final int INSTALL_FAILED_NEWER_SDK = -14; 384 385 /** 386 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 387 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 388 * the new package failed because it has specified that it is a test-only 389 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} 390 * flag. 391 * @hide 392 */ 393 public static final int INSTALL_FAILED_TEST_ONLY = -15; 394 395 /** 396 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 397 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 398 * the package being installed contains native code, but none that is 399 * compatible with the the device's CPU_ABI. 400 * @hide 401 */ 402 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; 403 404 /** 405 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 406 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 407 * the new package uses a feature that is not available. 408 * @hide 409 */ 410 public static final int INSTALL_FAILED_MISSING_FEATURE = -17; 411 412 /** 413 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 414 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 415 * if the parser was given a path that is not a file, or does not end with the expected 416 * '.apk' extension. 417 * @hide 418 */ 419 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; 420 421 /** 422 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 423 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 424 * if the parser was unable to retrieve the AndroidManifest.xml file. 425 * @hide 426 */ 427 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; 428 429 /** 430 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 431 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 432 * if the parser encountered an unexpected exception. 433 * @hide 434 */ 435 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; 436 437 /** 438 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 439 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 440 * if the parser did not find any certificates in the .apk. 441 * @hide 442 */ 443 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; 444 445 /** 446 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 447 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 448 * if the parser found inconsistent certificates on the files in the .apk. 449 * @hide 450 */ 451 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; 452 453 /** 454 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 455 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 456 * if the parser encountered a CertificateEncodingException in one of the 457 * files in the .apk. 458 * @hide 459 */ 460 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; 461 462 /** 463 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 464 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 465 * if the parser encountered a bad or missing package name in the manifest. 466 * @hide 467 */ 468 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; 469 470 /** 471 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 472 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 473 * if the parser encountered a bad shared user id name in the manifest. 474 * @hide 475 */ 476 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; 477 478 /** 479 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 480 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 481 * if the parser encountered some structural problem in the manifest. 482 * @hide 483 */ 484 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; 485 486 /** 487 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 488 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 489 * if the parser did not find any actionable tags (instrumentation or application) 490 * in the manifest. 491 * @hide 492 */ 493 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; 494 495 /** 496 * Indicates the state of installation. Used by PackageManager to 497 * figure out incomplete installations. Say a package is being installed 498 * (the state is set to PKG_INSTALL_INCOMPLETE) and remains so till 499 * the package installation is successful or unsuccesful lin which case 500 * the PackageManager will no longer maintain state information associated 501 * with the package. If some exception(like device freeze or battery being 502 * pulled out) occurs during installation of a package, the PackageManager 503 * needs this information to clean up the previously failed installation. 504 */ 505 public static final int PKG_INSTALL_INCOMPLETE = 0; 506 public static final int PKG_INSTALL_COMPLETE = 1; 507 508 /** 509 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the 510 * package's data directory. 511 * 512 * @hide 513 */ 514 public static final int DONT_DELETE_DATA = 0x00000001; 515 516 /** 517 * Feature for {@link #getSystemAvailableFeatures} and 518 * {@link #hasSystemFeature}: The device has a camera facing away 519 * from the screen. 520 */ 521 public static final String FEATURE_CAMERA = "android.hardware.camera"; 522 523 /** 524 * Feature for {@link #getSystemAvailableFeatures} and 525 * {@link #hasSystemFeature}: The device's camera supports auto-focus. 526 */ 527 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; 528 529 /** 530 * Feature for {@link #getSystemAvailableFeatures} and 531 * {@link #hasSystemFeature}: The device's camera supports flash. 532 */ 533 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; 534 535 /** 536 * Feature for {@link #getSystemAvailableFeatures} and 537 * {@link #hasSystemFeature}: The device includes a light sensor. 538 */ 539 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; 540 541 /** 542 * Feature for {@link #getSystemAvailableFeatures} and 543 * {@link #hasSystemFeature}: The device includes a proximity sensor. 544 */ 545 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; 546 547 /** 548 * Feature for {@link #getSystemAvailableFeatures} and 549 * {@link #hasSystemFeature}: The device has a telephony radio with data 550 * communication support. 551 */ 552 public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; 553 554 /** 555 * Feature for {@link #getSystemAvailableFeatures} and 556 * {@link #hasSystemFeature}: The device has a CDMA telephony stack. 557 */ 558 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; 559 560 /** 561 * Feature for {@link #getSystemAvailableFeatures} and 562 * {@link #hasSystemFeature}: The device has a GSM telephony stack. 563 */ 564 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; 565 566 /** 567 * Feature for {@link #getSystemAvailableFeatures} and 568 * {@link #hasSystemFeature}: The device's touch screen supports multitouch. 569 */ 570 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; 571 572 /** 573 * Feature for {@link #getSystemAvailableFeatures} and 574 * {@link #hasSystemFeature}: The device supports live wallpapers. 575 */ 576 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; 577 578 /** 579 * Retrieve overall information about an application package that is 580 * installed on the system. 581 * 582 * <p>Throws {@link NameNotFoundException} if a package with the given 583 * name can not be found on the system. 584 * 585 * @param packageName The full name (i.e. com.google.apps.contacts) of the 586 * desired package. 587 588 * @param flags Additional option flags. Use any combination of 589 * {@link #GET_ACTIVITIES}, 590 * {@link #GET_GIDS}, 591 * {@link #GET_CONFIGURATIONS}, 592 * {@link #GET_INSTRUMENTATION}, 593 * {@link #GET_PERMISSIONS}, 594 * {@link #GET_PROVIDERS}, 595 * {@link #GET_RECEIVERS}, 596 * {@link #GET_SERVICES}, 597 * {@link #GET_SIGNATURES}, 598 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 599 * 600 * @return Returns a PackageInfo object containing information about the package. 601 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not 602 * found in the list of installed applications, the package information is 603 * retrieved from the list of uninstalled applications(which includes 604 * installed applications as well as applications 605 * with data directory ie applications which had been 606 * deleted with DONT_DELTE_DATA flag set). 607 * 608 * @see #GET_ACTIVITIES 609 * @see #GET_GIDS 610 * @see #GET_CONFIGURATIONS 611 * @see #GET_INSTRUMENTATION 612 * @see #GET_PERMISSIONS 613 * @see #GET_PROVIDERS 614 * @see #GET_RECEIVERS 615 * @see #GET_SERVICES 616 * @see #GET_SIGNATURES 617 * @see #GET_UNINSTALLED_PACKAGES 618 * 619 */ 620 public abstract PackageInfo getPackageInfo(String packageName, int flags) 621 throws NameNotFoundException; 622 623 /** 624 * Return a "good" intent to launch a front-door activity in a package, 625 * for use for example to implement an "open" button when browsing through 626 * packages. The current implementation will look first for a main 627 * activity in the category {@link Intent#CATEGORY_INFO}, next for a 628 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return 629 * null if neither are found. 630 * 631 * <p>Throws {@link NameNotFoundException} if a package with the given 632 * name can not be found on the system. 633 * 634 * @param packageName The name of the package to inspect. 635 * 636 * @return Returns either a fully-qualified Intent that can be used to 637 * launch the main activity in the package, or null if the package does 638 * not contain such an activity. 639 */ 640 public abstract Intent getLaunchIntentForPackage(String packageName); 641 642 /** 643 * Return an array of all of the secondary group-ids that have been 644 * assigned to a package. 645 * 646 * <p>Throws {@link NameNotFoundException} if a package with the given 647 * name can not be found on the system. 648 * 649 * @param packageName The full name (i.e. com.google.apps.contacts) of the 650 * desired package. 651 * 652 * @return Returns an int array of the assigned gids, or null if there 653 * are none. 654 */ 655 public abstract int[] getPackageGids(String packageName) 656 throws NameNotFoundException; 657 658 /** 659 * Retrieve all of the information we know about a particular permission. 660 * 661 * <p>Throws {@link NameNotFoundException} if a permission with the given 662 * name can not be found on the system. 663 * 664 * @param name The fully qualified name (i.e. com.google.permission.LOGIN) 665 * of the permission you are interested in. 666 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 667 * retrieve any meta-data associated with the permission. 668 * 669 * @return Returns a {@link PermissionInfo} containing information about the 670 * permission. 671 */ 672 public abstract PermissionInfo getPermissionInfo(String name, int flags) 673 throws NameNotFoundException; 674 675 /** 676 * Query for all of the permissions associated with a particular group. 677 * 678 * <p>Throws {@link NameNotFoundException} if the given group does not 679 * exist. 680 * 681 * @param group The fully qualified name (i.e. com.google.permission.LOGIN) 682 * of the permission group you are interested in. Use null to 683 * find all of the permissions not associated with a group. 684 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 685 * retrieve any meta-data associated with the permissions. 686 * 687 * @return Returns a list of {@link PermissionInfo} containing information 688 * about all of the permissions in the given group. 689 */ 690 public abstract List<PermissionInfo> queryPermissionsByGroup(String group, 691 int flags) throws NameNotFoundException; 692 693 /** 694 * Retrieve all of the information we know about a particular group of 695 * permissions. 696 * 697 * <p>Throws {@link NameNotFoundException} if a permission group with the given 698 * name can not be found on the system. 699 * 700 * @param name The fully qualified name (i.e. com.google.permission_group.APPS) 701 * of the permission you are interested in. 702 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 703 * retrieve any meta-data associated with the permission group. 704 * 705 * @return Returns a {@link PermissionGroupInfo} containing information 706 * about the permission. 707 */ 708 public abstract PermissionGroupInfo getPermissionGroupInfo(String name, 709 int flags) throws NameNotFoundException; 710 711 /** 712 * Retrieve all of the known permission groups in the system. 713 * 714 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 715 * retrieve any meta-data associated with the permission group. 716 * 717 * @return Returns a list of {@link PermissionGroupInfo} containing 718 * information about all of the known permission groups. 719 */ 720 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags); 721 722 /** 723 * Retrieve all of the information we know about a particular 724 * package/application. 725 * 726 * <p>Throws {@link NameNotFoundException} if an application with the given 727 * package name can not be found on the system. 728 * 729 * @param packageName The full name (i.e. com.google.apps.contacts) of an 730 * application. 731 * @param flags Additional option flags. Use any combination of 732 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 733 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 734 * 735 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing 736 * information about the package. 737 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not 738 * found in the list of installed applications, 739 * the application information is retrieved from the 740 * list of uninstalled applications(which includes 741 * installed applications as well as applications 742 * with data directory ie applications which had been 743 * deleted with DONT_DELTE_DATA flag set). 744 * 745 * @see #GET_META_DATA 746 * @see #GET_SHARED_LIBRARY_FILES 747 * @see #GET_UNINSTALLED_PACKAGES 748 */ 749 public abstract ApplicationInfo getApplicationInfo(String packageName, 750 int flags) throws NameNotFoundException; 751 752 /** 753 * Retrieve all of the information we know about a particular activity 754 * class. 755 * 756 * <p>Throws {@link NameNotFoundException} if an activity with the given 757 * class name can not be found on the system. 758 * 759 * @param className The full name (i.e. 760 * com.google.apps.contacts.ContactsList) of an Activity 761 * class. 762 * @param flags Additional option flags. Use any combination of 763 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 764 * to modify the data (in ApplicationInfo) returned. 765 * 766 * @return {@link ActivityInfo} containing information about the activity. 767 * 768 * @see #GET_INTENT_FILTERS 769 * @see #GET_META_DATA 770 * @see #GET_SHARED_LIBRARY_FILES 771 */ 772 public abstract ActivityInfo getActivityInfo(ComponentName className, 773 int flags) throws NameNotFoundException; 774 775 /** 776 * Retrieve all of the information we know about a particular receiver 777 * class. 778 * 779 * <p>Throws {@link NameNotFoundException} if a receiver with the given 780 * class name can not be found on the system. 781 * 782 * @param className The full name (i.e. 783 * com.google.apps.contacts.CalendarAlarm) of a Receiver 784 * class. 785 * @param flags Additional option flags. Use any combination of 786 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 787 * to modify the data returned. 788 * 789 * @return {@link ActivityInfo} containing information about the receiver. 790 * 791 * @see #GET_INTENT_FILTERS 792 * @see #GET_META_DATA 793 * @see #GET_SHARED_LIBRARY_FILES 794 */ 795 public abstract ActivityInfo getReceiverInfo(ComponentName className, 796 int flags) throws NameNotFoundException; 797 798 /** 799 * Retrieve all of the information we know about a particular service 800 * class. 801 * 802 * <p>Throws {@link NameNotFoundException} if a service with the given 803 * class name can not be found on the system. 804 * 805 * @param className The full name (i.e. 806 * com.google.apps.media.BackgroundPlayback) of a Service 807 * class. 808 * @param flags Additional option flags. Use any combination of 809 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 810 * to modify the data returned. 811 * 812 * @return ServiceInfo containing information about the service. 813 * 814 * @see #GET_META_DATA 815 * @see #GET_SHARED_LIBRARY_FILES 816 */ 817 public abstract ServiceInfo getServiceInfo(ComponentName className, 818 int flags) throws NameNotFoundException; 819 820 /** 821 * Return a List of all packages that are installed 822 * on the device. 823 * 824 * @param flags Additional option flags. Use any combination of 825 * {@link #GET_ACTIVITIES}, 826 * {@link #GET_GIDS}, 827 * {@link #GET_CONFIGURATIONS}, 828 * {@link #GET_INSTRUMENTATION}, 829 * {@link #GET_PERMISSIONS}, 830 * {@link #GET_PROVIDERS}, 831 * {@link #GET_RECEIVERS}, 832 * {@link #GET_SERVICES}, 833 * {@link #GET_SIGNATURES}, 834 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 835 * 836 * @return A List of PackageInfo objects, one for each package that is 837 * installed on the device. In the unlikely case of there being no 838 * installed packages, an empty list is returned. 839 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all 840 * applications including those deleted with DONT_DELETE_DATA 841 * (partially installed apps with data directory) will be returned. 842 * 843 * @see #GET_ACTIVITIES 844 * @see #GET_GIDS 845 * @see #GET_CONFIGURATIONS 846 * @see #GET_INSTRUMENTATION 847 * @see #GET_PERMISSIONS 848 * @see #GET_PROVIDERS 849 * @see #GET_RECEIVERS 850 * @see #GET_SERVICES 851 * @see #GET_SIGNATURES 852 * @see #GET_UNINSTALLED_PACKAGES 853 * 854 */ 855 public abstract List<PackageInfo> getInstalledPackages(int flags); 856 857 /** 858 * Check whether a particular package has been granted a particular 859 * permission. 860 * 861 * @param permName The name of the permission you are checking for, 862 * @param pkgName The name of the package you are checking against. 863 * 864 * @return If the package has the permission, PERMISSION_GRANTED is 865 * returned. If it does not have the permission, PERMISSION_DENIED 866 * is returned. 867 * 868 * @see #PERMISSION_GRANTED 869 * @see #PERMISSION_DENIED 870 */ 871 public abstract int checkPermission(String permName, String pkgName); 872 873 /** 874 * Add a new dynamic permission to the system. For this to work, your 875 * package must have defined a permission tree through the 876 * {@link android.R.styleable#AndroidManifestPermissionTree 877 * <permission-tree>} tag in its manifest. A package can only add 878 * permissions to trees that were defined by either its own package or 879 * another with the same user id; a permission is in a tree if it 880 * matches the name of the permission tree + ".": for example, 881 * "com.foo.bar" is a member of the permission tree "com.foo". 882 * 883 * <p>It is good to make your permission tree name descriptive, because you 884 * are taking possession of that entire set of permission names. Thus, it 885 * must be under a domain you control, with a suffix that will not match 886 * any normal permissions that may be declared in any applications that 887 * are part of that domain. 888 * 889 * <p>New permissions must be added before 890 * any .apks are installed that use those permissions. Permissions you 891 * add through this method are remembered across reboots of the device. 892 * If the given permission already exists, the info you supply here 893 * will be used to update it. 894 * 895 * @param info Description of the permission to be added. 896 * 897 * @return Returns true if a new permission was created, false if an 898 * existing one was updated. 899 * 900 * @throws SecurityException if you are not allowed to add the 901 * given permission name. 902 * 903 * @see #removePermission(String) 904 */ 905 public abstract boolean addPermission(PermissionInfo info); 906 907 /** 908 * Removes a permission that was previously added with 909 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply 910 * -- you are only allowed to remove permissions that you are allowed 911 * to add. 912 * 913 * @param name The name of the permission to remove. 914 * 915 * @throws SecurityException if you are not allowed to remove the 916 * given permission name. 917 * 918 * @see #addPermission(PermissionInfo) 919 */ 920 public abstract void removePermission(String name); 921 922 /** 923 * Compare the signatures of two packages to determine if the same 924 * signature appears in both of them. If they do contain the same 925 * signature, then they are allowed special privileges when working 926 * with each other: they can share the same user-id, run instrumentation 927 * against each other, etc. 928 * 929 * @param pkg1 First package name whose signature will be compared. 930 * @param pkg2 Second package name whose signature will be compared. 931 * @return Returns an integer indicating whether there is a matching 932 * signature: the value is >= 0 if there is a match (or neither package 933 * is signed), or < 0 if there is not a match. The match result can be 934 * further distinguished with the success (>= 0) constants 935 * {@link #SIGNATURE_MATCH}, {@link #SIGNATURE_NEITHER_SIGNED}; or 936 * failure (< 0) constants {@link #SIGNATURE_FIRST_NOT_SIGNED}, 937 * {@link #SIGNATURE_SECOND_NOT_SIGNED}, {@link #SIGNATURE_NO_MATCH}, 938 * or {@link #SIGNATURE_UNKNOWN_PACKAGE}. 939 * 940 * @see #checkSignatures(int, int) 941 * @see #SIGNATURE_MATCH 942 * @see #SIGNATURE_NEITHER_SIGNED 943 * @see #SIGNATURE_FIRST_NOT_SIGNED 944 * @see #SIGNATURE_SECOND_NOT_SIGNED 945 * @see #SIGNATURE_NO_MATCH 946 * @see #SIGNATURE_UNKNOWN_PACKAGE 947 */ 948 public abstract int checkSignatures(String pkg1, String pkg2); 949 950 /** 951 * Like {@link #checkSignatures(String, String)}, but takes UIDs of 952 * the two packages to be checked. This can be useful, for example, 953 * when doing the check in an IPC, where the UID is the only identity 954 * available. It is functionally identical to determining the package 955 * associated with the UIDs and checking their signatures. 956 * 957 * @param uid1 First UID whose signature will be compared. 958 * @param uid2 Second UID whose signature will be compared. 959 * @return Returns an integer indicating whether there is a matching 960 * signature: the value is >= 0 if there is a match (or neither package 961 * is signed), or < 0 if there is not a match. The match result can be 962 * further distinguished with the success (>= 0) constants 963 * {@link #SIGNATURE_MATCH}, {@link #SIGNATURE_NEITHER_SIGNED}; or 964 * failure (< 0) constants {@link #SIGNATURE_FIRST_NOT_SIGNED}, 965 * {@link #SIGNATURE_SECOND_NOT_SIGNED}, {@link #SIGNATURE_NO_MATCH}, 966 * or {@link #SIGNATURE_UNKNOWN_PACKAGE}. 967 * 968 * @see #checkSignatures(int, int) 969 * @see #SIGNATURE_MATCH 970 * @see #SIGNATURE_NEITHER_SIGNED 971 * @see #SIGNATURE_FIRST_NOT_SIGNED 972 * @see #SIGNATURE_SECOND_NOT_SIGNED 973 * @see #SIGNATURE_NO_MATCH 974 * @see #SIGNATURE_UNKNOWN_PACKAGE 975 */ 976 public abstract int checkSignatures(int uid1, int uid2); 977 978 /** 979 * Retrieve the names of all packages that are associated with a particular 980 * user id. In most cases, this will be a single package name, the package 981 * that has been assigned that user id. Where there are multiple packages 982 * sharing the same user id through the "sharedUserId" mechanism, all 983 * packages with that id will be returned. 984 * 985 * @param uid The user id for which you would like to retrieve the 986 * associated packages. 987 * 988 * @return Returns an array of one or more packages assigned to the user 989 * id, or null if there are no known packages with the given id. 990 */ 991 public abstract String[] getPackagesForUid(int uid); 992 993 /** 994 * Retrieve the official name associated with a user id. This name is 995 * guaranteed to never change, though it is possibly for the underlying 996 * user id to be changed. That is, if you are storing information about 997 * user ids in persistent storage, you should use the string returned 998 * by this function instead of the raw user-id. 999 * 1000 * @param uid The user id for which you would like to retrieve a name. 1001 * @return Returns a unique name for the given user id, or null if the 1002 * user id is not currently assigned. 1003 */ 1004 public abstract String getNameForUid(int uid); 1005 1006 /** 1007 * Return the user id associated with a shared user name. Multiple 1008 * applications can specify a shared user name in their manifest and thus 1009 * end up using a common uid. This might be used for new applications 1010 * that use an existing shared user name and need to know the uid of the 1011 * shared user. 1012 * 1013 * @param sharedUserName The shared user name whose uid is to be retrieved. 1014 * @return Returns the uid associated with the shared user, or NameNotFoundException 1015 * if the shared user name is not being used by any installed packages 1016 * @hide 1017 */ 1018 public abstract int getUidForSharedUser(String sharedUserName) 1019 throws NameNotFoundException; 1020 1021 /** 1022 * Return a List of all application packages that are installed on the 1023 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all 1024 * applications including those deleted with DONT_DELETE_DATA(partially 1025 * installed apps with data directory) will be returned. 1026 * 1027 * @param flags Additional option flags. Use any combination of 1028 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1029 * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 1030 * 1031 * @return A List of ApplicationInfo objects, one for each application that 1032 * is installed on the device. In the unlikely case of there being 1033 * no installed applications, an empty list is returned. 1034 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all 1035 * applications including those deleted with DONT_DELETE_DATA 1036 * (partially installed apps with data directory) will be returned. 1037 * 1038 * @see #GET_META_DATA 1039 * @see #GET_SHARED_LIBRARY_FILES 1040 * @see #GET_UNINSTALLED_PACKAGES 1041 */ 1042 public abstract List<ApplicationInfo> getInstalledApplications(int flags); 1043 1044 /** 1045 * Get a list of shared libraries that are available on the 1046 * system. 1047 * 1048 * @return An array of shared library names that are 1049 * available on the system, or null if none are installed. 1050 * 1051 */ 1052 public abstract String[] getSystemSharedLibraryNames(); 1053 1054 /** 1055 * Get a list of features that are available on the 1056 * system. 1057 * 1058 * @return An array of FeatureInfo classes describing the features 1059 * that are available on the system, or null if there are none(!!). 1060 */ 1061 public abstract FeatureInfo[] getSystemAvailableFeatures(); 1062 1063 /** 1064 * Check whether the given feature name is one of the available 1065 * features as returned by {@link #getSystemAvailableFeatures()}. 1066 * 1067 * @return Returns true if the devices supports the feature, else 1068 * false. 1069 */ 1070 public abstract boolean hasSystemFeature(String name); 1071 1072 /** 1073 * Determine the best action to perform for a given Intent. This is how 1074 * {@link Intent#resolveActivity} finds an activity if a class has not 1075 * been explicitly specified. 1076 * 1077 * @param intent An intent containing all of the desired specification 1078 * (action, data, type, category, and/or component). 1079 * @param flags Additional option flags. The most important is 1080 * MATCH_DEFAULT_ONLY, to limit the resolution to only 1081 * those activities that support the CATEGORY_DEFAULT. 1082 * 1083 * @return Returns a ResolveInfo containing the final activity intent that 1084 * was determined to be the best action. Returns null if no 1085 * matching activity was found. 1086 * 1087 * @see #MATCH_DEFAULT_ONLY 1088 * @see #GET_INTENT_FILTERS 1089 * @see #GET_RESOLVED_FILTER 1090 */ 1091 public abstract ResolveInfo resolveActivity(Intent intent, int flags); 1092 1093 /** 1094 * Retrieve all activities that can be performed for the given intent. 1095 * 1096 * @param intent The desired intent as per resolveActivity(). 1097 * @param flags Additional option flags. The most important is 1098 * MATCH_DEFAULT_ONLY, to limit the resolution to only 1099 * those activities that support the CATEGORY_DEFAULT. 1100 * 1101 * @return A List<ResolveInfo> containing one entry for each matching 1102 * Activity. These are ordered from best to worst match -- that 1103 * is, the first item in the list is what is returned by 1104 * resolveActivity(). If there are no matching activities, an empty 1105 * list is returned. 1106 * 1107 * @see #MATCH_DEFAULT_ONLY 1108 * @see #GET_INTENT_FILTERS 1109 * @see #GET_RESOLVED_FILTER 1110 */ 1111 public abstract List<ResolveInfo> queryIntentActivities(Intent intent, 1112 int flags); 1113 1114 /** 1115 * Retrieve a set of activities that should be presented to the user as 1116 * similar options. This is like {@link #queryIntentActivities}, except it 1117 * also allows you to supply a list of more explicit Intents that you would 1118 * like to resolve to particular options, and takes care of returning the 1119 * final ResolveInfo list in a reasonable order, with no duplicates, based 1120 * on those inputs. 1121 * 1122 * @param caller The class name of the activity that is making the 1123 * request. This activity will never appear in the output 1124 * list. Can be null. 1125 * @param specifics An array of Intents that should be resolved to the 1126 * first specific results. Can be null. 1127 * @param intent The desired intent as per resolveActivity(). 1128 * @param flags Additional option flags. The most important is 1129 * MATCH_DEFAULT_ONLY, to limit the resolution to only 1130 * those activities that support the CATEGORY_DEFAULT. 1131 * 1132 * @return A List<ResolveInfo> containing one entry for each matching 1133 * Activity. These are ordered first by all of the intents resolved 1134 * in <var>specifics</var> and then any additional activities that 1135 * can handle <var>intent</var> but did not get included by one of 1136 * the <var>specifics</var> intents. If there are no matching 1137 * activities, an empty list is returned. 1138 * 1139 * @see #MATCH_DEFAULT_ONLY 1140 * @see #GET_INTENT_FILTERS 1141 * @see #GET_RESOLVED_FILTER 1142 */ 1143 public abstract List<ResolveInfo> queryIntentActivityOptions( 1144 ComponentName caller, Intent[] specifics, Intent intent, int flags); 1145 1146 /** 1147 * Retrieve all receivers that can handle a broadcast of the given intent. 1148 * 1149 * @param intent The desired intent as per resolveActivity(). 1150 * @param flags Additional option flags. The most important is 1151 * MATCH_DEFAULT_ONLY, to limit the resolution to only 1152 * those activities that support the CATEGORY_DEFAULT. 1153 * 1154 * @return A List<ResolveInfo> containing one entry for each matching 1155 * Receiver. These are ordered from first to last in priority. If 1156 * there are no matching receivers, an empty list is returned. 1157 * 1158 * @see #MATCH_DEFAULT_ONLY 1159 * @see #GET_INTENT_FILTERS 1160 * @see #GET_RESOLVED_FILTER 1161 */ 1162 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, 1163 int flags); 1164 1165 /** 1166 * Determine the best service to handle for a given Intent. 1167 * 1168 * @param intent An intent containing all of the desired specification 1169 * (action, data, type, category, and/or component). 1170 * @param flags Additional option flags. 1171 * 1172 * @return Returns a ResolveInfo containing the final service intent that 1173 * was determined to be the best action. Returns null if no 1174 * matching service was found. 1175 * 1176 * @see #GET_INTENT_FILTERS 1177 * @see #GET_RESOLVED_FILTER 1178 */ 1179 public abstract ResolveInfo resolveService(Intent intent, int flags); 1180 1181 /** 1182 * Retrieve all services that can match the given intent. 1183 * 1184 * @param intent The desired intent as per resolveService(). 1185 * @param flags Additional option flags. 1186 * 1187 * @return A List<ResolveInfo> containing one entry for each matching 1188 * ServiceInfo. These are ordered from best to worst match -- that 1189 * is, the first item in the list is what is returned by 1190 * resolveService(). If there are no matching services, an empty 1191 * list is returned. 1192 * 1193 * @see #GET_INTENT_FILTERS 1194 * @see #GET_RESOLVED_FILTER 1195 */ 1196 public abstract List<ResolveInfo> queryIntentServices(Intent intent, 1197 int flags); 1198 1199 /** 1200 * Find a single content provider by its base path name. 1201 * 1202 * @param name The name of the provider to find. 1203 * @param flags Additional option flags. Currently should always be 0. 1204 * 1205 * @return ContentProviderInfo Information about the provider, if found, 1206 * else null. 1207 */ 1208 public abstract ProviderInfo resolveContentProvider(String name, 1209 int flags); 1210 1211 /** 1212 * Retrieve content provider information. 1213 * 1214 * <p><em>Note: unlike most other methods, an empty result set is indicated 1215 * by a null return instead of an empty list.</em> 1216 * 1217 * @param processName If non-null, limits the returned providers to only 1218 * those that are hosted by the given process. If null, 1219 * all content providers are returned. 1220 * @param uid If <var>processName</var> is non-null, this is the required 1221 * uid owning the requested content providers. 1222 * @param flags Additional option flags. Currently should always be 0. 1223 * 1224 * @return A List<ContentProviderInfo> containing one entry for each 1225 * content provider either patching <var>processName</var> or, if 1226 * <var>processName</var> is null, all known content providers. 1227 * <em>If there are no matching providers, null is returned.</em> 1228 */ 1229 public abstract List<ProviderInfo> queryContentProviders( 1230 String processName, int uid, int flags); 1231 1232 /** 1233 * Retrieve all of the information we know about a particular 1234 * instrumentation class. 1235 * 1236 * <p>Throws {@link NameNotFoundException} if instrumentation with the 1237 * given class name can not be found on the system. 1238 * 1239 * @param className The full name (i.e. 1240 * com.google.apps.contacts.InstrumentList) of an 1241 * Instrumentation class. 1242 * @param flags Additional option flags. Currently should always be 0. 1243 * 1244 * @return InstrumentationInfo containing information about the 1245 * instrumentation. 1246 */ 1247 public abstract InstrumentationInfo getInstrumentationInfo( 1248 ComponentName className, int flags) throws NameNotFoundException; 1249 1250 /** 1251 * Retrieve information about available instrumentation code. May be used 1252 * to retrieve either all instrumentation code, or only the code targeting 1253 * a particular package. 1254 * 1255 * @param targetPackage If null, all instrumentation is returned; only the 1256 * instrumentation targeting this package name is 1257 * returned. 1258 * @param flags Additional option flags. Currently should always be 0. 1259 * 1260 * @return A List<InstrumentationInfo> containing one entry for each 1261 * matching available Instrumentation. Returns an empty list if 1262 * there is no instrumentation available for the given package. 1263 */ 1264 public abstract List<InstrumentationInfo> queryInstrumentation( 1265 String targetPackage, int flags); 1266 1267 /** 1268 * Retrieve an image from a package. This is a low-level API used by 1269 * the various package manager info structures (such as 1270 * {@link ComponentInfo} to implement retrieval of their associated 1271 * icon. 1272 * 1273 * @param packageName The name of the package that this icon is coming from. 1274 * Can not be null. 1275 * @param resid The resource identifier of the desired image. Can not be 0. 1276 * @param appInfo Overall information about <var>packageName</var>. This 1277 * may be null, in which case the application information will be retrieved 1278 * for you if needed; if you already have this information around, it can 1279 * be much more efficient to supply it here. 1280 * 1281 * @return Returns a Drawable holding the requested image. Returns null if 1282 * an image could not be found for any reason. 1283 */ 1284 public abstract Drawable getDrawable(String packageName, int resid, 1285 ApplicationInfo appInfo); 1286 1287 /** 1288 * Retrieve the icon associated with an activity. Given the full name of 1289 * an activity, retrieves the information about it and calls 1290 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. 1291 * If the activity can not be found, NameNotFoundException is thrown. 1292 * 1293 * @param activityName Name of the activity whose icon is to be retrieved. 1294 * 1295 * @return Returns the image of the icon, or the default activity icon if 1296 * it could not be found. Does not return null. 1297 * @throws NameNotFoundException Thrown if the resources for the given 1298 * activity could not be loaded. 1299 * 1300 * @see #getActivityIcon(Intent) 1301 */ 1302 public abstract Drawable getActivityIcon(ComponentName activityName) 1303 throws NameNotFoundException; 1304 1305 /** 1306 * Retrieve the icon associated with an Intent. If intent.getClassName() is 1307 * set, this simply returns the result of 1308 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's 1309 * component and returns the icon associated with the resolved component. 1310 * If intent.getClassName() can not be found or the Intent can not be resolved 1311 * to a component, NameNotFoundException is thrown. 1312 * 1313 * @param intent The intent for which you would like to retrieve an icon. 1314 * 1315 * @return Returns the image of the icon, or the default activity icon if 1316 * it could not be found. Does not return null. 1317 * @throws NameNotFoundException Thrown if the resources for application 1318 * matching the given intent could not be loaded. 1319 * 1320 * @see #getActivityIcon(ComponentName) 1321 */ 1322 public abstract Drawable getActivityIcon(Intent intent) 1323 throws NameNotFoundException; 1324 1325 /** 1326 * Return the generic icon for an activity that is used when no specific 1327 * icon is defined. 1328 * 1329 * @return Drawable Image of the icon. 1330 */ 1331 public abstract Drawable getDefaultActivityIcon(); 1332 1333 /** 1334 * Retrieve the icon associated with an application. If it has not defined 1335 * an icon, the default app icon is returned. Does not return null. 1336 * 1337 * @param info Information about application being queried. 1338 * 1339 * @return Returns the image of the icon, or the default application icon 1340 * if it could not be found. 1341 * 1342 * @see #getApplicationIcon(String) 1343 */ 1344 public abstract Drawable getApplicationIcon(ApplicationInfo info); 1345 1346 /** 1347 * Retrieve the icon associated with an application. Given the name of the 1348 * application's package, retrieves the information about it and calls 1349 * getApplicationIcon() to return its icon. If the application can not be 1350 * found, NameNotFoundException is thrown. 1351 * 1352 * @param packageName Name of the package whose application icon is to be 1353 * retrieved. 1354 * 1355 * @return Returns the image of the icon, or the default application icon 1356 * if it could not be found. Does not return null. 1357 * @throws NameNotFoundException Thrown if the resources for the given 1358 * application could not be loaded. 1359 * 1360 * @see #getApplicationIcon(ApplicationInfo) 1361 */ 1362 public abstract Drawable getApplicationIcon(String packageName) 1363 throws NameNotFoundException; 1364 1365 /** 1366 * Retrieve text from a package. This is a low-level API used by 1367 * the various package manager info structures (such as 1368 * {@link ComponentInfo} to implement retrieval of their associated 1369 * labels and other text. 1370 * 1371 * @param packageName The name of the package that this text is coming from. 1372 * Can not be null. 1373 * @param resid The resource identifier of the desired text. Can not be 0. 1374 * @param appInfo Overall information about <var>packageName</var>. This 1375 * may be null, in which case the application information will be retrieved 1376 * for you if needed; if you already have this information around, it can 1377 * be much more efficient to supply it here. 1378 * 1379 * @return Returns a CharSequence holding the requested text. Returns null 1380 * if the text could not be found for any reason. 1381 */ 1382 public abstract CharSequence getText(String packageName, int resid, 1383 ApplicationInfo appInfo); 1384 1385 /** 1386 * Retrieve an XML file from a package. This is a low-level API used to 1387 * retrieve XML meta data. 1388 * 1389 * @param packageName The name of the package that this xml is coming from. 1390 * Can not be null. 1391 * @param resid The resource identifier of the desired xml. Can not be 0. 1392 * @param appInfo Overall information about <var>packageName</var>. This 1393 * may be null, in which case the application information will be retrieved 1394 * for you if needed; if you already have this information around, it can 1395 * be much more efficient to supply it here. 1396 * 1397 * @return Returns an XmlPullParser allowing you to parse out the XML 1398 * data. Returns null if the xml resource could not be found for any 1399 * reason. 1400 */ 1401 public abstract XmlResourceParser getXml(String packageName, int resid, 1402 ApplicationInfo appInfo); 1403 1404 /** 1405 * Return the label to use for this application. 1406 * 1407 * @return Returns the label associated with this application, or null if 1408 * it could not be found for any reason. 1409 * @param info The application to get the label of 1410 */ 1411 public abstract CharSequence getApplicationLabel(ApplicationInfo info); 1412 1413 /** 1414 * Retrieve the resources associated with an activity. Given the full 1415 * name of an activity, retrieves the information about it and calls 1416 * getResources() to return its application's resources. If the activity 1417 * can not be found, NameNotFoundException is thrown. 1418 * 1419 * @param activityName Name of the activity whose resources are to be 1420 * retrieved. 1421 * 1422 * @return Returns the application's Resources. 1423 * @throws NameNotFoundException Thrown if the resources for the given 1424 * application could not be loaded. 1425 * 1426 * @see #getResourcesForApplication(ApplicationInfo) 1427 */ 1428 public abstract Resources getResourcesForActivity(ComponentName activityName) 1429 throws NameNotFoundException; 1430 1431 /** 1432 * Retrieve the resources for an application. Throws NameNotFoundException 1433 * if the package is no longer installed. 1434 * 1435 * @param app Information about the desired application. 1436 * 1437 * @return Returns the application's Resources. 1438 * @throws NameNotFoundException Thrown if the resources for the given 1439 * application could not be loaded (most likely because it was uninstalled). 1440 */ 1441 public abstract Resources getResourcesForApplication(ApplicationInfo app) 1442 throws NameNotFoundException; 1443 1444 /** 1445 * Retrieve the resources associated with an application. Given the full 1446 * package name of an application, retrieves the information about it and 1447 * calls getResources() to return its application's resources. If the 1448 * appPackageName can not be found, NameNotFoundException is thrown. 1449 * 1450 * @param appPackageName Package name of the application whose resources 1451 * are to be retrieved. 1452 * 1453 * @return Returns the application's Resources. 1454 * @throws NameNotFoundException Thrown if the resources for the given 1455 * application could not be loaded. 1456 * 1457 * @see #getResourcesForApplication(ApplicationInfo) 1458 */ 1459 public abstract Resources getResourcesForApplication(String appPackageName) 1460 throws NameNotFoundException; 1461 1462 /** 1463 * Retrieve overall information about an application package defined 1464 * in a package archive file 1465 * 1466 * @param archiveFilePath The path to the archive file 1467 * @param flags Additional option flags. Use any combination of 1468 * {@link #GET_ACTIVITIES}, 1469 * {@link #GET_GIDS}, 1470 * {@link #GET_CONFIGURATIONS}, 1471 * {@link #GET_INSTRUMENTATION}, 1472 * {@link #GET_PERMISSIONS}, 1473 * {@link #GET_PROVIDERS}, 1474 * {@link #GET_RECEIVERS}, 1475 * {@link #GET_SERVICES}, 1476 * {@link #GET_SIGNATURES}, to modify the data returned. 1477 * 1478 * @return Returns the information about the package. Returns 1479 * null if the package could not be successfully parsed. 1480 * 1481 * @see #GET_ACTIVITIES 1482 * @see #GET_GIDS 1483 * @see #GET_CONFIGURATIONS 1484 * @see #GET_INSTRUMENTATION 1485 * @see #GET_PERMISSIONS 1486 * @see #GET_PROVIDERS 1487 * @see #GET_RECEIVERS 1488 * @see #GET_SERVICES 1489 * @see #GET_SIGNATURES 1490 * 1491 */ 1492 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { 1493 PackageParser packageParser = new PackageParser(archiveFilePath); 1494 DisplayMetrics metrics = new DisplayMetrics(); 1495 metrics.setToDefaults(); 1496 final File sourceFile = new File(archiveFilePath); 1497 PackageParser.Package pkg = packageParser.parsePackage( 1498 sourceFile, archiveFilePath, metrics, 0); 1499 if (pkg == null) { 1500 return null; 1501 } 1502 return PackageParser.generatePackageInfo(pkg, null, flags); 1503 } 1504 1505 /** 1506 * @hide 1507 * 1508 * Install a package. Since this may take a little while, the result will 1509 * be posted back to the given observer. An installation will fail if the calling context 1510 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the 1511 * package named in the package file's manifest is already installed, or if there's no space 1512 * available on the device. 1513 * 1514 * @param packageURI The location of the package file to install. This can be a 'file:' or a 1515 * 'content:' URI. 1516 * @param observer An observer callback to get notified when the package installation is 1517 * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be 1518 * called when that happens. observer may be null to indicate that no callback is desired. 1519 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 1520 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 1521 * @param installerPackageName Optional package name of the application that is performing the 1522 * installation. This identifies which market the package came from. 1523 */ 1524 public abstract void installPackage( 1525 Uri packageURI, IPackageInstallObserver observer, int flags, 1526 String installerPackageName); 1527 1528 /** 1529 * Attempts to delete a package. Since this may take a little while, the result will 1530 * be posted back to the given observer. A deletion will fail if the calling context 1531 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the 1532 * named package cannot be found, or if the named package is a "system package". 1533 * (TODO: include pointer to documentation on "system packages") 1534 * 1535 * @param packageName The name of the package to delete 1536 * @param observer An observer callback to get notified when the package deletion is 1537 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be 1538 * called when that happens. observer may be null to indicate that no callback is desired. 1539 * @param flags - possible values: {@link #DONT_DELETE_DATA} 1540 * 1541 * @hide 1542 */ 1543 public abstract void deletePackage( 1544 String packageName, IPackageDeleteObserver observer, int flags); 1545 1546 /** 1547 * Retrieve the package name of the application that installed a package. This identifies 1548 * which market the package came from. 1549 * 1550 * @param packageName The name of the package to query 1551 */ 1552 public abstract String getInstallerPackageName(String packageName); 1553 1554 /** 1555 * Attempts to clear the user data directory of an application. 1556 * Since this may take a little while, the result will 1557 * be posted back to the given observer. A deletion will fail if the 1558 * named package cannot be found, or if the named package is a "system package". 1559 * 1560 * @param packageName The name of the package 1561 * @param observer An observer callback to get notified when the operation is finished 1562 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 1563 * will be called when that happens. observer may be null to indicate that 1564 * no callback is desired. 1565 * 1566 * @hide 1567 */ 1568 public abstract void clearApplicationUserData(String packageName, 1569 IPackageDataObserver observer); 1570 /** 1571 * Attempts to delete the cache files associated with an application. 1572 * Since this may take a little while, the result will 1573 * be posted back to the given observer. A deletion will fail if the calling context 1574 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the 1575 * named package cannot be found, or if the named package is a "system package". 1576 * 1577 * @param packageName The name of the package to delete 1578 * @param observer An observer callback to get notified when the cache file deletion 1579 * is complete. 1580 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 1581 * will be called when that happens. observer may be null to indicate that 1582 * no callback is desired. 1583 * 1584 * @hide 1585 */ 1586 public abstract void deleteApplicationCacheFiles(String packageName, 1587 IPackageDataObserver observer); 1588 1589 /** 1590 * Free storage by deleting LRU sorted list of cache files across 1591 * all applications. If the currently available free storage 1592 * on the device is greater than or equal to the requested 1593 * free storage, no cache files are cleared. If the currently 1594 * available storage on the device is less than the requested 1595 * free storage, some or all of the cache files across 1596 * all applications are deleted (based on last accessed time) 1597 * to increase the free storage space on the device to 1598 * the requested value. There is no guarantee that clearing all 1599 * the cache files from all applications will clear up 1600 * enough storage to achieve the desired value. 1601 * @param freeStorageSize The number of bytes of storage to be 1602 * freed by the system. Say if freeStorageSize is XX, 1603 * and the current free storage is YY, 1604 * if XX is less than YY, just return. if not free XX-YY number 1605 * of bytes if possible. 1606 * @param observer call back used to notify when 1607 * the operation is completed 1608 * 1609 * @hide 1610 */ 1611 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer); 1612 1613 /** 1614 * Free storage by deleting LRU sorted list of cache files across 1615 * all applications. If the currently available free storage 1616 * on the device is greater than or equal to the requested 1617 * free storage, no cache files are cleared. If the currently 1618 * available storage on the device is less than the requested 1619 * free storage, some or all of the cache files across 1620 * all applications are deleted (based on last accessed time) 1621 * to increase the free storage space on the device to 1622 * the requested value. There is no guarantee that clearing all 1623 * the cache files from all applications will clear up 1624 * enough storage to achieve the desired value. 1625 * @param freeStorageSize The number of bytes of storage to be 1626 * freed by the system. Say if freeStorageSize is XX, 1627 * and the current free storage is YY, 1628 * if XX is less than YY, just return. if not free XX-YY number 1629 * of bytes if possible. 1630 * @param pi IntentSender call back used to 1631 * notify when the operation is completed.May be null 1632 * to indicate that no call back is desired. 1633 * 1634 * @hide 1635 */ 1636 public abstract void freeStorage(long freeStorageSize, IntentSender pi); 1637 1638 /** 1639 * Retrieve the size information for a package. 1640 * Since this may take a little while, the result will 1641 * be posted back to the given observer. The calling context 1642 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. 1643 * 1644 * @param packageName The name of the package whose size information is to be retrieved 1645 * @param observer An observer callback to get notified when the operation 1646 * is complete. 1647 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} 1648 * The observer's callback is invoked with a PackageStats object(containing the 1649 * code, data and cache sizes of the package) and a boolean value representing 1650 * the status of the operation. observer may be null to indicate that 1651 * no callback is desired. 1652 * 1653 * @hide 1654 */ 1655 public abstract void getPackageSizeInfo(String packageName, 1656 IPackageStatsObserver observer); 1657 1658 /** 1659 * Add a new package to the list of preferred packages. This new package 1660 * will be added to the front of the list (removed from its current location 1661 * if already listed), meaning it will now be preferred over all other 1662 * packages when resolving conflicts. 1663 * 1664 * @param packageName The package name of the new package to make preferred. 1665 */ 1666 public abstract void addPackageToPreferred(String packageName); 1667 1668 /** 1669 * Remove a package from the list of preferred packages. If it was on 1670 * the list, it will no longer be preferred over other packages. 1671 * 1672 * @param packageName The package name to remove. 1673 */ 1674 public abstract void removePackageFromPreferred(String packageName); 1675 1676 /** 1677 * Retrieve the list of all currently configured preferred packages. The 1678 * first package on the list is the most preferred, the last is the 1679 * least preferred. 1680 * 1681 * @param flags Additional option flags. Use any combination of 1682 * {@link #GET_ACTIVITIES}, 1683 * {@link #GET_GIDS}, 1684 * {@link #GET_CONFIGURATIONS}, 1685 * {@link #GET_INSTRUMENTATION}, 1686 * {@link #GET_PERMISSIONS}, 1687 * {@link #GET_PROVIDERS}, 1688 * {@link #GET_RECEIVERS}, 1689 * {@link #GET_SERVICES}, 1690 * {@link #GET_SIGNATURES}, to modify the data returned. 1691 * 1692 * @return Returns a list of PackageInfo objects describing each 1693 * preferred application, in order of preference. 1694 * 1695 * @see #GET_ACTIVITIES 1696 * @see #GET_GIDS 1697 * @see #GET_CONFIGURATIONS 1698 * @see #GET_INSTRUMENTATION 1699 * @see #GET_PERMISSIONS 1700 * @see #GET_PROVIDERS 1701 * @see #GET_RECEIVERS 1702 * @see #GET_SERVICES 1703 * @see #GET_SIGNATURES 1704 */ 1705 public abstract List<PackageInfo> getPreferredPackages(int flags); 1706 1707 /** 1708 * Add a new preferred activity mapping to the system. This will be used 1709 * to automatically select the given activity component when 1710 * {@link Context#startActivity(Intent) Context.startActivity()} finds 1711 * multiple matching activities and also matches the given filter. 1712 * 1713 * @param filter The set of intents under which this activity will be 1714 * made preferred. 1715 * @param match The IntentFilter match category that this preference 1716 * applies to. 1717 * @param set The set of activities that the user was picking from when 1718 * this preference was made. 1719 * @param activity The component name of the activity that is to be 1720 * preferred. 1721 */ 1722 public abstract void addPreferredActivity(IntentFilter filter, int match, 1723 ComponentName[] set, ComponentName activity); 1724 1725 /** 1726 * Replaces an existing preferred activity mapping to the system, and if that were not present 1727 * adds a new preferred activity. This will be used 1728 * to automatically select the given activity component when 1729 * {@link Context#startActivity(Intent) Context.startActivity()} finds 1730 * multiple matching activities and also matches the given filter. 1731 * 1732 * @param filter The set of intents under which this activity will be 1733 * made preferred. 1734 * @param match The IntentFilter match category that this preference 1735 * applies to. 1736 * @param set The set of activities that the user was picking from when 1737 * this preference was made. 1738 * @param activity The component name of the activity that is to be 1739 * preferred. 1740 * @hide 1741 */ 1742 public abstract void replacePreferredActivity(IntentFilter filter, int match, 1743 ComponentName[] set, ComponentName activity); 1744 1745 /** 1746 * Remove all preferred activity mappings, previously added with 1747 * {@link #addPreferredActivity}, from the 1748 * system whose activities are implemented in the given package name. 1749 * 1750 * @param packageName The name of the package whose preferred activity 1751 * mappings are to be removed. 1752 */ 1753 public abstract void clearPackagePreferredActivities(String packageName); 1754 1755 /** 1756 * Retrieve all preferred activities, previously added with 1757 * {@link #addPreferredActivity}, that are 1758 * currently registered with the system. 1759 * 1760 * @param outFilters A list in which to place the filters of all of the 1761 * preferred activities, or null for none. 1762 * @param outActivities A list in which to place the component names of 1763 * all of the preferred activities, or null for none. 1764 * @param packageName An option package in which you would like to limit 1765 * the list. If null, all activities will be returned; if non-null, only 1766 * those activities in the given package are returned. 1767 * 1768 * @return Returns the total number of registered preferred activities 1769 * (the number of distinct IntentFilter records, not the number of unique 1770 * activity components) that were found. 1771 */ 1772 public abstract int getPreferredActivities(List<IntentFilter> outFilters, 1773 List<ComponentName> outActivities, String packageName); 1774 1775 /** 1776 * Set the enabled setting for a package component (activity, receiver, service, provider). 1777 * This setting will override any enabled state which may have been set by the component in its 1778 * manifest. 1779 * 1780 * @param componentName The component to enable 1781 * @param newState The new enabled state for the component. The legal values for this state 1782 * are: 1783 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 1784 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 1785 * and 1786 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 1787 * The last one removes the setting, thereby restoring the component's state to 1788 * whatever was set in it's manifest (or enabled, by default). 1789 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 1790 */ 1791 public abstract void setComponentEnabledSetting(ComponentName componentName, 1792 int newState, int flags); 1793 1794 1795 /** 1796 * Return the the enabled setting for a package component (activity, 1797 * receiver, service, provider). This returns the last value set by 1798 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most 1799 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 1800 * the value originally specified in the manifest has not been modified. 1801 * 1802 * @param componentName The component to retrieve. 1803 * @return Returns the current enabled state for the component. May 1804 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 1805 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 1806 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 1807 * component's enabled state is based on the original information in 1808 * the manifest as found in {@link ComponentInfo}. 1809 */ 1810 public abstract int getComponentEnabledSetting(ComponentName componentName); 1811 1812 /** 1813 * Set the enabled setting for an application 1814 * This setting will override any enabled state which may have been set by the application in 1815 * its manifest. It also overrides the enabled state set in the manifest for any of the 1816 * application's components. It does not override any enabled state set by 1817 * {@link #setComponentEnabledSetting} for any of the application's components. 1818 * 1819 * @param packageName The package name of the application to enable 1820 * @param newState The new enabled state for the component. The legal values for this state 1821 * are: 1822 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 1823 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 1824 * and 1825 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 1826 * The last one removes the setting, thereby restoring the applications's state to 1827 * whatever was set in its manifest (or enabled, by default). 1828 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 1829 */ 1830 public abstract void setApplicationEnabledSetting(String packageName, 1831 int newState, int flags); 1832 1833 /** 1834 * Return the the enabled setting for an application. This returns 1835 * the last value set by 1836 * {@link #setApplicationEnabledSetting(String, int, int)}; in most 1837 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 1838 * the value originally specified in the manifest has not been modified. 1839 * 1840 * @param packageName The component to retrieve. 1841 * @return Returns the current enabled state for the component. May 1842 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 1843 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 1844 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 1845 * application's enabled state is based on the original information in 1846 * the manifest as found in {@link ComponentInfo}. 1847 */ 1848 public abstract int getApplicationEnabledSetting(String packageName); 1849 1850 /** 1851 * Return whether the device has been booted into safe mode. 1852 */ 1853 public abstract boolean isSafeMode(); 1854} 1855