PackageManager.java revision 8b0cfb7dbde6f19a5dd5879fef3d16576f2eeba4
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.annotation.IntDef; 20import android.annotation.PrivateApi; 21import android.annotation.SdkConstant; 22import android.annotation.SdkConstant.SdkConstantType; 23import android.app.PackageInstallObserver; 24import android.content.ComponentName; 25import android.content.Context; 26import android.content.Intent; 27import android.content.IntentFilter; 28import android.content.IntentSender; 29import android.content.res.Resources; 30import android.content.res.XmlResourceParser; 31import android.graphics.drawable.Drawable; 32import android.net.Uri; 33import android.os.Environment; 34import android.os.UserHandle; 35import android.util.AndroidException; 36import android.util.DisplayMetrics; 37 38import java.io.File; 39import java.lang.annotation.Retention; 40import java.lang.annotation.RetentionPolicy; 41import java.util.List; 42 43/** 44 * Class for retrieving various kinds of information related to the application 45 * packages that are currently installed on the device. 46 * 47 * You can find this class through {@link Context#getPackageManager}. 48 */ 49public abstract class PackageManager { 50 51 /** 52 * This exception is thrown when a given package, application, or component 53 * name cannot be found. 54 */ 55 public static class NameNotFoundException extends AndroidException { 56 public NameNotFoundException() { 57 } 58 59 public NameNotFoundException(String name) { 60 super(name); 61 } 62 } 63 64 /** 65 * {@link PackageInfo} flag: return information about 66 * activities in the package in {@link PackageInfo#activities}. 67 */ 68 public static final int GET_ACTIVITIES = 0x00000001; 69 70 /** 71 * {@link PackageInfo} flag: return information about 72 * intent receivers in the package in 73 * {@link PackageInfo#receivers}. 74 */ 75 public static final int GET_RECEIVERS = 0x00000002; 76 77 /** 78 * {@link PackageInfo} flag: return information about 79 * services in the package in {@link PackageInfo#services}. 80 */ 81 public static final int GET_SERVICES = 0x00000004; 82 83 /** 84 * {@link PackageInfo} flag: return information about 85 * content providers in the package in 86 * {@link PackageInfo#providers}. 87 */ 88 public static final int GET_PROVIDERS = 0x00000008; 89 90 /** 91 * {@link PackageInfo} flag: return information about 92 * instrumentation in the package in 93 * {@link PackageInfo#instrumentation}. 94 */ 95 public static final int GET_INSTRUMENTATION = 0x00000010; 96 97 /** 98 * {@link PackageInfo} flag: return information about the 99 * intent filters supported by the activity. 100 */ 101 public static final int GET_INTENT_FILTERS = 0x00000020; 102 103 /** 104 * {@link PackageInfo} flag: return information about the 105 * signatures included in the package. 106 */ 107 public static final int GET_SIGNATURES = 0x00000040; 108 109 /** 110 * {@link ResolveInfo} flag: return the IntentFilter that 111 * was matched for a particular ResolveInfo in 112 * {@link ResolveInfo#filter}. 113 */ 114 public static final int GET_RESOLVED_FILTER = 0x00000040; 115 116 /** 117 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} 118 * data {@link android.os.Bundle}s that are associated with a component. 119 * This applies for any API returning a ComponentInfo subclass. 120 */ 121 public static final int GET_META_DATA = 0x00000080; 122 123 /** 124 * {@link PackageInfo} flag: return the 125 * {@link PackageInfo#gids group ids} that are associated with an 126 * application. 127 * This applies for any API returning a PackageInfo class, either 128 * directly or nested inside of another. 129 */ 130 public static final int GET_GIDS = 0x00000100; 131 132 /** 133 * {@link PackageInfo} flag: include disabled components in the returned info. 134 */ 135 public static final int GET_DISABLED_COMPONENTS = 0x00000200; 136 137 /** 138 * {@link ApplicationInfo} flag: return the 139 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} 140 * that are associated with an application. 141 * This applies for any API returning an ApplicationInfo class, either 142 * directly or nested inside of another. 143 */ 144 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; 145 146 /** 147 * {@link ProviderInfo} flag: return the 148 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} 149 * that are associated with a content provider. 150 * This applies for any API returning a ProviderInfo class, either 151 * directly or nested inside of another. 152 */ 153 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; 154 /** 155 * {@link PackageInfo} flag: return information about 156 * permissions in the package in 157 * {@link PackageInfo#permissions}. 158 */ 159 public static final int GET_PERMISSIONS = 0x00001000; 160 161 /** 162 * Flag parameter to retrieve some information about all applications (even 163 * uninstalled ones) which have data directories. This state could have 164 * resulted if applications have been deleted with flag 165 * {@code DONT_DELETE_DATA} with a possibility of being replaced or 166 * reinstalled in future. 167 * <p> 168 * Note: this flag may cause less information about currently installed 169 * applications to be returned. 170 */ 171 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; 172 173 /** 174 * {@link PackageInfo} flag: return information about 175 * hardware preferences in 176 * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and 177 * requested features in {@link PackageInfo#reqFeatures 178 * PackageInfo.reqFeatures}. 179 */ 180 public static final int GET_CONFIGURATIONS = 0x00004000; 181 182 /** 183 * {@link PackageInfo} flag: include disabled components which are in 184 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} 185 * in the returned info. Note that if you set this flag, applications 186 * that are in this disabled state will be reported as enabled. 187 */ 188 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; 189 190 /** 191 * Resolution and querying flag: if set, only filters that support the 192 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for 193 * matching. This is a synonym for including the CATEGORY_DEFAULT in your 194 * supplied Intent. 195 */ 196 public static final int MATCH_DEFAULT_ONLY = 0x00010000; 197 198 /** @hide */ 199 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED}) 200 @Retention(RetentionPolicy.SOURCE) 201 public @interface PermissionResult {} 202 203 /** 204 * Permission check result: this is returned by {@link #checkPermission} 205 * if the permission has been granted to the given package. 206 */ 207 public static final int PERMISSION_GRANTED = 0; 208 209 /** 210 * Permission check result: this is returned by {@link #checkPermission} 211 * if the permission has not been granted to the given package. 212 */ 213 public static final int PERMISSION_DENIED = -1; 214 215 /** 216 * Signature check result: this is returned by {@link #checkSignatures} 217 * if all signatures on the two packages match. 218 */ 219 public static final int SIGNATURE_MATCH = 0; 220 221 /** 222 * Signature check result: this is returned by {@link #checkSignatures} 223 * if neither of the two packages is signed. 224 */ 225 public static final int SIGNATURE_NEITHER_SIGNED = 1; 226 227 /** 228 * Signature check result: this is returned by {@link #checkSignatures} 229 * if the first package is not signed but the second is. 230 */ 231 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; 232 233 /** 234 * Signature check result: this is returned by {@link #checkSignatures} 235 * if the second package is not signed but the first is. 236 */ 237 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; 238 239 /** 240 * Signature check result: this is returned by {@link #checkSignatures} 241 * if not all signatures on both packages match. 242 */ 243 public static final int SIGNATURE_NO_MATCH = -3; 244 245 /** 246 * Signature check result: this is returned by {@link #checkSignatures} 247 * if either of the packages are not valid. 248 */ 249 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; 250 251 /** 252 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 253 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 254 * component or application is in its default enabled state (as specified 255 * in its manifest). 256 */ 257 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; 258 259 /** 260 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 261 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 262 * component or application has been explictily enabled, regardless of 263 * what it has specified in its manifest. 264 */ 265 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; 266 267 /** 268 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 269 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 270 * component or application has been explicitly disabled, regardless of 271 * what it has specified in its manifest. 272 */ 273 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; 274 275 /** 276 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The 277 * user has explicitly disabled the application, regardless of what it has 278 * specified in its manifest. Because this is due to the user's request, 279 * they may re-enable it if desired through the appropriate system UI. This 280 * option currently <strong>cannot</strong> be used with 281 * {@link #setComponentEnabledSetting(ComponentName, int, int)}. 282 */ 283 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; 284 285 /** 286 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This 287 * application should be considered, until the point where the user actually 288 * wants to use it. This means that it will not normally show up to the user 289 * (such as in the launcher), but various parts of the user interface can 290 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow 291 * the user to select it (as for example an IME, device admin, etc). Such code, 292 * once the user has selected the app, should at that point also make it enabled. 293 * This option currently <strong>can not</strong> be used with 294 * {@link #setComponentEnabledSetting(ComponentName, int, int)}. 295 */ 296 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; 297 298 /** 299 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to 300 * indicate that this package should be installed as forward locked, i.e. only the app itself 301 * should have access to its code and non-resource assets. 302 * @hide 303 */ 304 public static final int INSTALL_FORWARD_LOCK = 0x00000001; 305 306 /** 307 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already 308 * installed package, if one exists. 309 * @hide 310 */ 311 public static final int INSTALL_REPLACE_EXISTING = 0x00000002; 312 313 /** 314 * Flag parameter for {@link #installPackage} to indicate that you want to 315 * allow test packages (those that have set android:testOnly in their 316 * manifest) to be installed. 317 * @hide 318 */ 319 public static final int INSTALL_ALLOW_TEST = 0x00000004; 320 321 /** 322 * Flag parameter for {@link #installPackage} to indicate that this 323 * package has to be installed on the sdcard. 324 * @hide 325 */ 326 public static final int INSTALL_EXTERNAL = 0x00000008; 327 328 /** 329 * Flag parameter for {@link #installPackage} to indicate that this package 330 * has to be installed on the sdcard. 331 * @hide 332 */ 333 public static final int INSTALL_INTERNAL = 0x00000010; 334 335 /** 336 * Flag parameter for {@link #installPackage} to indicate that this install 337 * was initiated via ADB. 338 * 339 * @hide 340 */ 341 public static final int INSTALL_FROM_ADB = 0x00000020; 342 343 /** 344 * Flag parameter for {@link #installPackage} to indicate that this install 345 * should immediately be visible to all users. 346 * 347 * @hide 348 */ 349 public static final int INSTALL_ALL_USERS = 0x00000040; 350 351 /** 352 * Flag parameter for {@link #installPackage} to indicate that it is okay 353 * to install an update to an app where the newly installed app has a lower 354 * version code than the currently installed app. 355 * 356 * @hide 357 */ 358 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; 359 360 /** 361 * Flag parameter for 362 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate 363 * that you don't want to kill the app containing the component. Be careful when you set this 364 * since changing component states can make the containing application's behavior unpredictable. 365 */ 366 public static final int DONT_KILL_APP = 0x00000001; 367 368 /** 369 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 370 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. 371 * @hide 372 */ 373 @PrivateApi 374 public static final int INSTALL_SUCCEEDED = 1; 375 376 /** 377 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 378 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is 379 * already installed. 380 * @hide 381 */ 382 @PrivateApi 383 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; 384 385 /** 386 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 387 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive 388 * file is invalid. 389 * @hide 390 */ 391 @PrivateApi 392 public static final int INSTALL_FAILED_INVALID_APK = -2; 393 394 /** 395 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 396 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in 397 * is invalid. 398 * @hide 399 */ 400 @PrivateApi 401 public static final int INSTALL_FAILED_INVALID_URI = -3; 402 403 /** 404 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 405 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager 406 * service found that the device didn't have enough storage space to install the app. 407 * @hide 408 */ 409 @PrivateApi 410 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; 411 412 /** 413 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 414 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a 415 * package is already installed with the same name. 416 * @hide 417 */ 418 @PrivateApi 419 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; 420 421 /** 422 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 423 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 424 * the requested shared user does not exist. 425 * @hide 426 */ 427 @PrivateApi 428 public static final int INSTALL_FAILED_NO_SHARED_USER = -6; 429 430 /** 431 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 432 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 433 * a previously installed package of the same name has a different signature 434 * than the new package (and the old package's data was not removed). 435 * @hide 436 */ 437 @PrivateApi 438 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; 439 440 /** 441 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 442 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 443 * the new package is requested a shared user which is already installed on the 444 * device and does not have matching signature. 445 * @hide 446 */ 447 @PrivateApi 448 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; 449 450 /** 451 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 452 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 453 * the new package uses a shared library that is not available. 454 * @hide 455 */ 456 @PrivateApi 457 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; 458 459 /** 460 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 461 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 462 * the new package uses a shared library that is not available. 463 * @hide 464 */ 465 @PrivateApi 466 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; 467 468 /** 469 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 470 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 471 * the new package failed while optimizing and validating its dex files, 472 * either because there was not enough storage or the validation failed. 473 * @hide 474 */ 475 @PrivateApi 476 public static final int INSTALL_FAILED_DEXOPT = -11; 477 478 /** 479 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 480 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 481 * the new package failed because the current SDK version is older than 482 * that required by the package. 483 * @hide 484 */ 485 @PrivateApi 486 public static final int INSTALL_FAILED_OLDER_SDK = -12; 487 488 /** 489 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 490 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 491 * the new package failed because it contains a content provider with the 492 * same authority as a provider already installed in the system. 493 * @hide 494 */ 495 @PrivateApi 496 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; 497 498 /** 499 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 500 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 501 * the new package failed because the current SDK version is newer than 502 * that required by the package. 503 * @hide 504 */ 505 @PrivateApi 506 public static final int INSTALL_FAILED_NEWER_SDK = -14; 507 508 /** 509 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 510 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 511 * the new package failed because it has specified that it is a test-only 512 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} 513 * flag. 514 * @hide 515 */ 516 @PrivateApi 517 public static final int INSTALL_FAILED_TEST_ONLY = -15; 518 519 /** 520 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 521 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 522 * the package being installed contains native code, but none that is 523 * compatible with the the device's CPU_ABI. 524 * @hide 525 */ 526 @PrivateApi 527 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; 528 529 /** 530 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 531 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 532 * the new package uses a feature that is not available. 533 * @hide 534 */ 535 @PrivateApi 536 public static final int INSTALL_FAILED_MISSING_FEATURE = -17; 537 538 // ------ Errors related to sdcard 539 /** 540 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 541 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 542 * a secure container mount point couldn't be accessed on external media. 543 * @hide 544 */ 545 @PrivateApi 546 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; 547 548 /** 549 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 550 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 551 * the new package couldn't be installed in the specified install 552 * location. 553 * @hide 554 */ 555 @PrivateApi 556 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; 557 558 /** 559 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 560 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 561 * the new package couldn't be installed in the specified install 562 * location because the media is not available. 563 * @hide 564 */ 565 @PrivateApi 566 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; 567 568 /** 569 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 570 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 571 * the new package couldn't be installed because the verification timed out. 572 * @hide 573 */ 574 @PrivateApi 575 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; 576 577 /** 578 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 579 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 580 * the new package couldn't be installed because the verification did not succeed. 581 * @hide 582 */ 583 @PrivateApi 584 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; 585 586 /** 587 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 588 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 589 * the package changed from what the calling program expected. 590 * @hide 591 */ 592 @PrivateApi 593 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; 594 595 /** 596 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 597 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 598 * the new package is assigned a different UID than it previously held. 599 * @hide 600 */ 601 public static final int INSTALL_FAILED_UID_CHANGED = -24; 602 603 /** 604 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 605 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 606 * the new package has an older version code than the currently installed package. 607 * @hide 608 */ 609 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; 610 611 /** 612 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 613 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 614 * if the parser was given a path that is not a file, or does not end with the expected 615 * '.apk' extension. 616 * @hide 617 */ 618 @PrivateApi 619 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; 620 621 /** 622 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 623 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 624 * if the parser was unable to retrieve the AndroidManifest.xml file. 625 * @hide 626 */ 627 @PrivateApi 628 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; 629 630 /** 631 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 632 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 633 * if the parser encountered an unexpected exception. 634 * @hide 635 */ 636 @PrivateApi 637 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; 638 639 /** 640 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 641 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 642 * if the parser did not find any certificates in the .apk. 643 * @hide 644 */ 645 @PrivateApi 646 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; 647 648 /** 649 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 650 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 651 * if the parser found inconsistent certificates on the files in the .apk. 652 * @hide 653 */ 654 @PrivateApi 655 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; 656 657 /** 658 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 659 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 660 * if the parser encountered a CertificateEncodingException in one of the 661 * files in the .apk. 662 * @hide 663 */ 664 @PrivateApi 665 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; 666 667 /** 668 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 669 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 670 * if the parser encountered a bad or missing package name in the manifest. 671 * @hide 672 */ 673 @PrivateApi 674 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; 675 676 /** 677 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 678 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 679 * if the parser encountered a bad shared user id name in the manifest. 680 * @hide 681 */ 682 @PrivateApi 683 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; 684 685 /** 686 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 687 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 688 * if the parser encountered some structural problem in the manifest. 689 * @hide 690 */ 691 @PrivateApi 692 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; 693 694 /** 695 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 696 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 697 * if the parser did not find any actionable tags (instrumentation or application) 698 * in the manifest. 699 * @hide 700 */ 701 @PrivateApi 702 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; 703 704 /** 705 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 706 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 707 * if the system failed to install the package because of system issues. 708 * @hide 709 */ 710 @PrivateApi 711 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; 712 713 /** 714 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 715 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 716 * if the system failed to install the package because the user is restricted from installing 717 * apps. 718 * @hide 719 */ 720 public static final int INSTALL_FAILED_USER_RESTRICTED = -111; 721 722 /** 723 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 724 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 725 * if the system failed to install the package because it is attempting to define a 726 * permission that is already defined by some existing package. 727 * 728 * <p>The package name of the app which has already defined the permission is passed to 729 * a {@link IPackageInstallObserver2}, if any, as the {@link #EXTRA_EXISTING_PACKAGE} 730 * string extra; and the name of the permission being redefined is passed in the 731 * {@link #EXTRA_EXISTING_PERMISSION} string extra. 732 * @hide 733 */ 734 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; 735 736 /** 737 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 738 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 739 * if the system failed to install the package because its packaged native code did not 740 * match any of the ABIs supported by the system. 741 * 742 * @hide 743 */ 744 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; 745 746 /** 747 * Internal return code for NativeLibraryHelper methods to indicate that the package 748 * being processed did not contain any native code. This is placed here only so that 749 * it can belong to the same value space as the other install failure codes. 750 * 751 * @hide 752 */ 753 public static final int NO_NATIVE_LIBRARIES = -114; 754 755 /** 756 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the 757 * package's data directory. 758 * 759 * @hide 760 */ 761 public static final int DELETE_KEEP_DATA = 0x00000001; 762 763 /** 764 * Flag parameter for {@link #deletePackage} to indicate that you want the 765 * package deleted for all users. 766 * 767 * @hide 768 */ 769 public static final int DELETE_ALL_USERS = 0x00000002; 770 771 /** 772 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling 773 * uninstall on a system that has been updated, then don't do the normal process 774 * of uninstalling the update and rolling back to the older system version (which 775 * needs to happen for all users); instead, just mark the app as uninstalled for 776 * the current user. 777 * 778 * @hide 779 */ 780 public static final int DELETE_SYSTEM_APP = 0x00000004; 781 782 /** 783 * Return code for when package deletion succeeds. This is passed to the 784 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 785 * succeeded in deleting the package. 786 * 787 * @hide 788 */ 789 public static final int DELETE_SUCCEEDED = 1; 790 791 /** 792 * Deletion failed return code: this is passed to the 793 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 794 * failed to delete the package for an unspecified reason. 795 * 796 * @hide 797 */ 798 public static final int DELETE_FAILED_INTERNAL_ERROR = -1; 799 800 /** 801 * Deletion failed return code: this is passed to the 802 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 803 * failed to delete the package because it is the active DevicePolicy 804 * manager. 805 * 806 * @hide 807 */ 808 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; 809 810 /** 811 * Deletion failed return code: this is passed to the 812 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 813 * failed to delete the package since the user is restricted. 814 * 815 * @hide 816 */ 817 public static final int DELETE_FAILED_USER_RESTRICTED = -3; 818 819 /** 820 * Return code that is passed to the {@link IPackageMoveObserver} by 821 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the 822 * package has been successfully moved by the system. 823 * 824 * @hide 825 */ 826 public static final int MOVE_SUCCEEDED = 1; 827 /** 828 * Error code that is passed to the {@link IPackageMoveObserver} by 829 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 830 * when the package hasn't been successfully moved by the system 831 * because of insufficient memory on specified media. 832 * @hide 833 */ 834 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; 835 836 /** 837 * Error code that is passed to the {@link IPackageMoveObserver} by 838 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 839 * if the specified package doesn't exist. 840 * @hide 841 */ 842 public static final int MOVE_FAILED_DOESNT_EXIST = -2; 843 844 /** 845 * Error code that is passed to the {@link IPackageMoveObserver} by 846 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 847 * if the specified package cannot be moved since its a system package. 848 * @hide 849 */ 850 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; 851 852 /** 853 * Error code that is passed to the {@link IPackageMoveObserver} by 854 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 855 * if the specified package cannot be moved since its forward locked. 856 * @hide 857 */ 858 public static final int MOVE_FAILED_FORWARD_LOCKED = -4; 859 860 /** 861 * Error code that is passed to the {@link IPackageMoveObserver} by 862 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 863 * if the specified package cannot be moved to the specified location. 864 * @hide 865 */ 866 public static final int MOVE_FAILED_INVALID_LOCATION = -5; 867 868 /** 869 * Error code that is passed to the {@link IPackageMoveObserver} by 870 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 871 * if the specified package cannot be moved to the specified location. 872 * @hide 873 */ 874 public static final int MOVE_FAILED_INTERNAL_ERROR = -6; 875 876 /** 877 * Error code that is passed to the {@link IPackageMoveObserver} by 878 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the 879 * specified package already has an operation pending in the 880 * {@link PackageHandler} queue. 881 * 882 * @hide 883 */ 884 public static final int MOVE_FAILED_OPERATION_PENDING = -7; 885 886 /** 887 * Flag parameter for {@link #movePackage} to indicate that 888 * the package should be moved to internal storage if its 889 * been installed on external media. 890 * @hide 891 */ 892 public static final int MOVE_INTERNAL = 0x00000001; 893 894 /** 895 * Flag parameter for {@link #movePackage} to indicate that 896 * the package should be moved to external media. 897 * @hide 898 */ 899 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; 900 901 /** 902 * Usable by the required verifier as the {@code verificationCode} argument 903 * for {@link PackageManager#verifyPendingInstall} to indicate that it will 904 * allow the installation to proceed without any of the optional verifiers 905 * needing to vote. 906 * 907 * @hide 908 */ 909 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; 910 911 /** 912 * Used as the {@code verificationCode} argument for 913 * {@link PackageManager#verifyPendingInstall} to indicate that the calling 914 * package verifier allows the installation to proceed. 915 */ 916 public static final int VERIFICATION_ALLOW = 1; 917 918 /** 919 * Used as the {@code verificationCode} argument for 920 * {@link PackageManager#verifyPendingInstall} to indicate the calling 921 * package verifier does not vote to allow the installation to proceed. 922 */ 923 public static final int VERIFICATION_REJECT = -1; 924 925 /** 926 * Can be used as the {@code millisecondsToDelay} argument for 927 * {@link PackageManager#extendVerificationTimeout}. This is the 928 * maximum time {@code PackageManager} waits for the verification 929 * agent to return (in milliseconds). 930 */ 931 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; 932 933 /** 934 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's 935 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or 936 * lag in sound input or output. 937 */ 938 @SdkConstant(SdkConstantType.FEATURE) 939 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; 940 941 /** 942 * Feature for {@link #getSystemAvailableFeatures} and 943 * {@link #hasSystemFeature}: The device is capable of communicating with 944 * other devices via Bluetooth. 945 */ 946 @SdkConstant(SdkConstantType.FEATURE) 947 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; 948 949 /** 950 * Feature for {@link #getSystemAvailableFeatures} and 951 * {@link #hasSystemFeature}: The device is capable of communicating with 952 * other devices via Bluetooth Low Energy radio. 953 */ 954 @SdkConstant(SdkConstantType.FEATURE) 955 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; 956 957 /** 958 * Feature for {@link #getSystemAvailableFeatures} and 959 * {@link #hasSystemFeature}: The device has a camera facing away 960 * from the screen. 961 */ 962 @SdkConstant(SdkConstantType.FEATURE) 963 public static final String FEATURE_CAMERA = "android.hardware.camera"; 964 965 /** 966 * Feature for {@link #getSystemAvailableFeatures} and 967 * {@link #hasSystemFeature}: The device's camera supports auto-focus. 968 */ 969 @SdkConstant(SdkConstantType.FEATURE) 970 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; 971 972 /** 973 * Feature for {@link #getSystemAvailableFeatures} and 974 * {@link #hasSystemFeature}: The device has at least one camera pointing in 975 * some direction, or can support an external camera being connected to it. 976 */ 977 @SdkConstant(SdkConstantType.FEATURE) 978 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; 979 980 /** 981 * Feature for {@link #getSystemAvailableFeatures} and 982 * {@link #hasSystemFeature}: The device can support having an external camera connected to it. 983 * The external camera may not always be connected or available to applications to use. 984 */ 985 @SdkConstant(SdkConstantType.FEATURE) 986 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; 987 988 /** 989 * Feature for {@link #getSystemAvailableFeatures} and 990 * {@link #hasSystemFeature}: The device's camera supports flash. 991 */ 992 @SdkConstant(SdkConstantType.FEATURE) 993 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; 994 995 /** 996 * Feature for {@link #getSystemAvailableFeatures} and 997 * {@link #hasSystemFeature}: The device has a front facing camera. 998 */ 999 @SdkConstant(SdkConstantType.FEATURE) 1000 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; 1001 1002 /** 1003 * Feature for {@link #getSystemAvailableFeatures} and 1004 * {@link #hasSystemFeature}: The device is capable of communicating with 1005 * consumer IR devices. 1006 */ 1007 @SdkConstant(SdkConstantType.FEATURE) 1008 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; 1009 1010 /** 1011 * Feature for {@link #getSystemAvailableFeatures} and 1012 * {@link #hasSystemFeature}: The device supports one or more methods of 1013 * reporting current location. 1014 */ 1015 @SdkConstant(SdkConstantType.FEATURE) 1016 public static final String FEATURE_LOCATION = "android.hardware.location"; 1017 1018 /** 1019 * Feature for {@link #getSystemAvailableFeatures} and 1020 * {@link #hasSystemFeature}: The device has a Global Positioning System 1021 * receiver and can report precise location. 1022 */ 1023 @SdkConstant(SdkConstantType.FEATURE) 1024 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; 1025 1026 /** 1027 * Feature for {@link #getSystemAvailableFeatures} and 1028 * {@link #hasSystemFeature}: The device can report location with coarse 1029 * accuracy using a network-based geolocation system. 1030 */ 1031 @SdkConstant(SdkConstantType.FEATURE) 1032 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; 1033 1034 /** 1035 * Feature for {@link #getSystemAvailableFeatures} and 1036 * {@link #hasSystemFeature}: The device can record audio via a 1037 * microphone. 1038 */ 1039 @SdkConstant(SdkConstantType.FEATURE) 1040 public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; 1041 1042 /** 1043 * Feature for {@link #getSystemAvailableFeatures} and 1044 * {@link #hasSystemFeature}: The device can communicate using Near-Field 1045 * Communications (NFC). 1046 */ 1047 @SdkConstant(SdkConstantType.FEATURE) 1048 public static final String FEATURE_NFC = "android.hardware.nfc"; 1049 1050 /** 1051 * Feature for {@link #getSystemAvailableFeatures} and 1052 * {@link #hasSystemFeature}: The device supports host- 1053 * based NFC card emulation. 1054 * 1055 * TODO remove when depending apps have moved to new constant. 1056 * @hide 1057 * @deprecated 1058 */ 1059 @Deprecated 1060 @SdkConstant(SdkConstantType.FEATURE) 1061 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; 1062 1063 /** 1064 * Feature for {@link #getSystemAvailableFeatures} and 1065 * {@link #hasSystemFeature}: The device supports host- 1066 * based NFC card emulation. 1067 */ 1068 @SdkConstant(SdkConstantType.FEATURE) 1069 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; 1070 1071 /** 1072 * Feature for {@link #getSystemAvailableFeatures} and 1073 * {@link #hasSystemFeature}: The device includes an accelerometer. 1074 */ 1075 @SdkConstant(SdkConstantType.FEATURE) 1076 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; 1077 1078 /** 1079 * Feature for {@link #getSystemAvailableFeatures} and 1080 * {@link #hasSystemFeature}: The device includes a barometer (air 1081 * pressure sensor.) 1082 */ 1083 @SdkConstant(SdkConstantType.FEATURE) 1084 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; 1085 1086 /** 1087 * Feature for {@link #getSystemAvailableFeatures} and 1088 * {@link #hasSystemFeature}: The device includes a magnetometer (compass). 1089 */ 1090 @SdkConstant(SdkConstantType.FEATURE) 1091 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; 1092 1093 /** 1094 * Feature for {@link #getSystemAvailableFeatures} and 1095 * {@link #hasSystemFeature}: The device includes a gyroscope. 1096 */ 1097 @SdkConstant(SdkConstantType.FEATURE) 1098 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; 1099 1100 /** 1101 * Feature for {@link #getSystemAvailableFeatures} and 1102 * {@link #hasSystemFeature}: The device includes a light sensor. 1103 */ 1104 @SdkConstant(SdkConstantType.FEATURE) 1105 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; 1106 1107 /** 1108 * Feature for {@link #getSystemAvailableFeatures} and 1109 * {@link #hasSystemFeature}: The device includes a proximity sensor. 1110 */ 1111 @SdkConstant(SdkConstantType.FEATURE) 1112 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; 1113 1114 /** 1115 * Feature for {@link #getSystemAvailableFeatures} and 1116 * {@link #hasSystemFeature}: The device includes a hardware step counter. 1117 */ 1118 @SdkConstant(SdkConstantType.FEATURE) 1119 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; 1120 1121 /** 1122 * Feature for {@link #getSystemAvailableFeatures} and 1123 * {@link #hasSystemFeature}: The device includes a hardware step detector. 1124 */ 1125 @SdkConstant(SdkConstantType.FEATURE) 1126 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; 1127 1128 /** 1129 * Feature for {@link #getSystemAvailableFeatures} and 1130 * {@link #hasSystemFeature}: The device includes a heart rate monitor. 1131 */ 1132 @SdkConstant(SdkConstantType.FEATURE) 1133 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; 1134 1135 /** 1136 * Feature for {@link #getSystemAvailableFeatures} and 1137 * {@link #hasSystemFeature}: The device has a telephony radio with data 1138 * communication support. 1139 */ 1140 @SdkConstant(SdkConstantType.FEATURE) 1141 public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; 1142 1143 /** 1144 * Feature for {@link #getSystemAvailableFeatures} and 1145 * {@link #hasSystemFeature}: The device has a CDMA telephony stack. 1146 */ 1147 @SdkConstant(SdkConstantType.FEATURE) 1148 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; 1149 1150 /** 1151 * Feature for {@link #getSystemAvailableFeatures} and 1152 * {@link #hasSystemFeature}: The device has a GSM telephony stack. 1153 */ 1154 @SdkConstant(SdkConstantType.FEATURE) 1155 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; 1156 1157 /** 1158 * Feature for {@link #getSystemAvailableFeatures} and 1159 * {@link #hasSystemFeature}: The device supports connecting to USB devices 1160 * as the USB host. 1161 */ 1162 @SdkConstant(SdkConstantType.FEATURE) 1163 public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; 1164 1165 /** 1166 * Feature for {@link #getSystemAvailableFeatures} and 1167 * {@link #hasSystemFeature}: The device supports connecting to USB accessories. 1168 */ 1169 @SdkConstant(SdkConstantType.FEATURE) 1170 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; 1171 1172 /** 1173 * Feature for {@link #getSystemAvailableFeatures} and 1174 * {@link #hasSystemFeature}: The SIP API is enabled on the device. 1175 */ 1176 @SdkConstant(SdkConstantType.FEATURE) 1177 public static final String FEATURE_SIP = "android.software.sip"; 1178 1179 /** 1180 * Feature for {@link #getSystemAvailableFeatures} and 1181 * {@link #hasSystemFeature}: The device supports SIP-based VOIP. 1182 */ 1183 @SdkConstant(SdkConstantType.FEATURE) 1184 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; 1185 1186 /** 1187 * Feature for {@link #getSystemAvailableFeatures} and 1188 * {@link #hasSystemFeature}: The device's display has a touch screen. 1189 */ 1190 @SdkConstant(SdkConstantType.FEATURE) 1191 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; 1192 1193 1194 /** 1195 * Feature for {@link #getSystemAvailableFeatures} and 1196 * {@link #hasSystemFeature}: The device's touch screen supports 1197 * multitouch sufficient for basic two-finger gesture detection. 1198 */ 1199 @SdkConstant(SdkConstantType.FEATURE) 1200 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; 1201 1202 /** 1203 * Feature for {@link #getSystemAvailableFeatures} and 1204 * {@link #hasSystemFeature}: The device's touch screen is capable of 1205 * tracking two or more fingers fully independently. 1206 */ 1207 @SdkConstant(SdkConstantType.FEATURE) 1208 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; 1209 1210 /** 1211 * Feature for {@link #getSystemAvailableFeatures} and 1212 * {@link #hasSystemFeature}: The device's touch screen is capable of 1213 * tracking a full hand of fingers fully independently -- that is, 5 or 1214 * more simultaneous independent pointers. 1215 */ 1216 @SdkConstant(SdkConstantType.FEATURE) 1217 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; 1218 1219 /** 1220 * Feature for {@link #getSystemAvailableFeatures} and 1221 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1222 * does support touch emulation for basic events. For instance, the 1223 * device might use a mouse or remote control to drive a cursor, and 1224 * emulate basic touch pointer events like down, up, drag, etc. All 1225 * devices that support android.hardware.touchscreen or a sub-feature are 1226 * presumed to also support faketouch. 1227 */ 1228 @SdkConstant(SdkConstantType.FEATURE) 1229 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; 1230 1231 /** 1232 * Feature for {@link #getSystemAvailableFeatures} and 1233 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1234 * does support touch emulation for basic events that supports distinct 1235 * tracking of two or more fingers. This is an extension of 1236 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note 1237 * that unlike a distinct multitouch screen as defined by 1238 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input 1239 * devices will not actually provide full two-finger gestures since the 1240 * input is being transformed to cursor movement on the screen. That is, 1241 * single finger gestures will move a cursor; two-finger swipes will 1242 * result in single-finger touch events; other two-finger gestures will 1243 * result in the corresponding two-finger touch event. 1244 */ 1245 @SdkConstant(SdkConstantType.FEATURE) 1246 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; 1247 1248 /** 1249 * Feature for {@link #getSystemAvailableFeatures} and 1250 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1251 * does support touch emulation for basic events that supports tracking 1252 * a hand of fingers (5 or more fingers) fully independently. 1253 * This is an extension of 1254 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note 1255 * that unlike a multitouch screen as defined by 1256 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger 1257 * gestures can be detected due to the limitations described for 1258 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. 1259 */ 1260 @SdkConstant(SdkConstantType.FEATURE) 1261 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; 1262 1263 /** 1264 * Feature for {@link #getSystemAvailableFeatures} and 1265 * {@link #hasSystemFeature}: The device supports portrait orientation 1266 * screens. For backwards compatibility, you can assume that if neither 1267 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports 1268 * both portrait and landscape. 1269 */ 1270 @SdkConstant(SdkConstantType.FEATURE) 1271 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; 1272 1273 /** 1274 * Feature for {@link #getSystemAvailableFeatures} and 1275 * {@link #hasSystemFeature}: The device supports landscape orientation 1276 * screens. For backwards compatibility, you can assume that if neither 1277 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports 1278 * both portrait and landscape. 1279 */ 1280 @SdkConstant(SdkConstantType.FEATURE) 1281 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; 1282 1283 /** 1284 * Feature for {@link #getSystemAvailableFeatures} and 1285 * {@link #hasSystemFeature}: The device supports live wallpapers. 1286 */ 1287 @SdkConstant(SdkConstantType.FEATURE) 1288 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; 1289 /** 1290 * Feature for {@link #getSystemAvailableFeatures} and 1291 * {@link #hasSystemFeature}: The device supports app widgets. 1292 */ 1293 @SdkConstant(SdkConstantType.FEATURE) 1294 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; 1295 1296 /** 1297 * @hide 1298 * Feature for {@link #getSystemAvailableFeatures} and 1299 * {@link #hasSystemFeature}: The device supports 1300 * {@link android.service.voice.VoiceInteractionService} and 1301 * {@link android.app.VoiceInteractor}. 1302 */ 1303 @SdkConstant(SdkConstantType.FEATURE) 1304 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; 1305 1306 1307 /** 1308 * Feature for {@link #getSystemAvailableFeatures} and 1309 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable 1310 * by third party applications. 1311 */ 1312 @SdkConstant(SdkConstantType.FEATURE) 1313 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; 1314 1315 /** 1316 * Feature for {@link #getSystemAvailableFeatures} and 1317 * {@link #hasSystemFeature}: The device supports adding new input methods implemented 1318 * with the {@link android.inputmethodservice.InputMethodService} API. 1319 */ 1320 @SdkConstant(SdkConstantType.FEATURE) 1321 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; 1322 1323 /** 1324 * Feature for {@link #getSystemAvailableFeatures} and 1325 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. 1326 */ 1327 @SdkConstant(SdkConstantType.FEATURE) 1328 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; 1329 1330 /** 1331 * Feature for {@link #getSystemAvailableFeatures} and 1332 * {@link #hasSystemFeature}: The device supports leanback UI. This is 1333 * typically used in a living room television experience, but is a software 1334 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this 1335 * feature will use resources associated with the "television" UI mode. 1336 */ 1337 @SdkConstant(SdkConstantType.FEATURE) 1338 public static final String FEATURE_LEANBACK = "android.software.leanback"; 1339 1340 /** 1341 * Feature for {@link #getSystemAvailableFeatures} and 1342 * {@link #hasSystemFeature}: The device supports only leanback UI. Only 1343 * applications designed for this experience should be run, though this is 1344 * not enforced by the system. 1345 * @hide 1346 */ 1347 @SdkConstant(SdkConstantType.FEATURE) 1348 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; 1349 1350 /** 1351 * Feature for {@link #getSystemAvailableFeatures} and 1352 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. 1353 */ 1354 @SdkConstant(SdkConstantType.FEATURE) 1355 public static final String FEATURE_WIFI = "android.hardware.wifi"; 1356 1357 /** 1358 * Feature for {@link #getSystemAvailableFeatures} and 1359 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. 1360 */ 1361 @SdkConstant(SdkConstantType.FEATURE) 1362 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; 1363 1364 /** 1365 * Feature for {@link #getSystemAvailableFeatures} and 1366 * {@link #hasSystemFeature}: This is a device dedicated to showing UI 1367 * on a television. Television here is defined to be a typical living 1368 * room television experience: displayed on a big screen, where the user 1369 * is sitting far away from it, and the dominant form of input will be 1370 * something like a DPAD, not through touch or mouse. 1371 * @deprecated use {@link #FEATURE_LEANBACK} instead. 1372 */ 1373 @Deprecated 1374 @SdkConstant(SdkConstantType.FEATURE) 1375 public static final String FEATURE_TELEVISION = "android.hardware.type.television"; 1376 1377 /** 1378 * Feature for {@link #getSystemAvailableFeatures} and 1379 * {@link #hasSystemFeature}: This is a device dedicated to showing UI 1380 * on a watch. A watch here is defined to be a device worn on the body, perhaps on 1381 * the wrist. The user is very close when interacting with the device. 1382 */ 1383 @SdkConstant(SdkConstantType.FEATURE) 1384 public static final String FEATURE_WATCH = "android.hardware.type.watch"; 1385 1386 /** 1387 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1388 * The device supports printing. 1389 */ 1390 @SdkConstant(SdkConstantType.FEATURE) 1391 public static final String FEATURE_PRINTING = "android.software.print"; 1392 1393 /** 1394 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1395 * The device can perform backup and restore operations on installed applications. 1396 */ 1397 @SdkConstant(SdkConstantType.FEATURE) 1398 public static final String FEATURE_BACKUP = "android.software.backup"; 1399 1400 /** 1401 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1402 * The device supports managed profiles for enterprise users. 1403 */ 1404 @SdkConstant(SdkConstantType.FEATURE) 1405 public static final String FEATURE_MANAGEDPROFILES = "android.software.managedprofiles"; 1406 1407 /** 1408 * Action to external storage service to clean out removed apps. 1409 * @hide 1410 */ 1411 public static final String ACTION_CLEAN_EXTERNAL_STORAGE 1412 = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; 1413 1414 /** 1415 * Extra field name for the URI to a verification file. Passed to a package 1416 * verifier. 1417 * 1418 * @hide 1419 */ 1420 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; 1421 1422 /** 1423 * Extra field name for the ID of a package pending verification. Passed to 1424 * a package verifier and is used to call back to 1425 * {@link PackageManager#verifyPendingInstall(int, int)} 1426 */ 1427 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; 1428 1429 /** 1430 * Extra field name for the package identifier which is trying to install 1431 * the package. 1432 * 1433 * @hide 1434 */ 1435 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE 1436 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; 1437 1438 /** 1439 * Extra field name for the requested install flags for a package pending 1440 * verification. Passed to a package verifier. 1441 * 1442 * @hide 1443 */ 1444 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS 1445 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; 1446 1447 /** 1448 * Extra field name for the uid of who is requesting to install 1449 * the package. 1450 * 1451 * @hide 1452 */ 1453 public static final String EXTRA_VERIFICATION_INSTALLER_UID 1454 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; 1455 1456 /** 1457 * Extra field name for the package name of a package pending verification. 1458 * 1459 * @hide 1460 */ 1461 public static final String EXTRA_VERIFICATION_PACKAGE_NAME 1462 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; 1463 /** 1464 * Extra field name for the result of a verification, either 1465 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. 1466 * Passed to package verifiers after a package is verified. 1467 */ 1468 public static final String EXTRA_VERIFICATION_RESULT 1469 = "android.content.pm.extra.VERIFICATION_RESULT"; 1470 1471 /** 1472 * Extra field name for the version code of a package pending verification. 1473 * 1474 * @hide 1475 */ 1476 public static final String EXTRA_VERIFICATION_VERSION_CODE 1477 = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; 1478 1479 /** 1480 * The action used to request that the user approve a permission request 1481 * from the application. 1482 * 1483 * @hide 1484 */ 1485 public static final String ACTION_REQUEST_PERMISSION 1486 = "android.content.pm.action.REQUEST_PERMISSION"; 1487 1488 /** 1489 * Extra field name for the list of permissions, which the user must approve. 1490 * 1491 * @hide 1492 */ 1493 public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST 1494 = "android.content.pm.extra.PERMISSION_LIST"; 1495 1496 /** 1497 * String extra for {@link IPackageInstallObserver2} in the 'extras' Bundle in case of 1498 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides 1499 * the existing definition for the permission. 1500 * @hide 1501 */ 1502 public static final String EXTRA_FAILURE_EXISTING_PACKAGE 1503 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; 1504 1505 /** 1506 * String extra for {@link IPackageInstallObserver2} in the 'extras' Bundle in case of 1507 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is 1508 * being redundantly defined by the package being installed. 1509 * @hide 1510 */ 1511 public static final String EXTRA_FAILURE_EXISTING_PERMISSION 1512 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; 1513 1514 /** 1515 * Retrieve overall information about an application package that is 1516 * installed on the system. 1517 * <p> 1518 * Throws {@link NameNotFoundException} if a package with the given name can 1519 * not be found on the system. 1520 * 1521 * @param packageName The full name (i.e. com.google.apps.contacts) of the 1522 * desired package. 1523 * @param flags Additional option flags. Use any combination of 1524 * {@link #GET_ACTIVITIES}, {@link #GET_GIDS}, 1525 * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION}, 1526 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 1527 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 1528 * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to 1529 * modify the data returned. 1530 * @return Returns a PackageInfo object containing information about the 1531 * package. If flag GET_UNINSTALLED_PACKAGES is set and if the 1532 * package is not found in the list of installed applications, the 1533 * package information is retrieved from the list of uninstalled 1534 * applications (which includes installed applications as well as 1535 * applications with data directory i.e. applications which had been 1536 * deleted with {@code DONT_DELETE_DATA} flag set). 1537 * @see #GET_ACTIVITIES 1538 * @see #GET_GIDS 1539 * @see #GET_CONFIGURATIONS 1540 * @see #GET_INSTRUMENTATION 1541 * @see #GET_PERMISSIONS 1542 * @see #GET_PROVIDERS 1543 * @see #GET_RECEIVERS 1544 * @see #GET_SERVICES 1545 * @see #GET_SIGNATURES 1546 * @see #GET_UNINSTALLED_PACKAGES 1547 */ 1548 public abstract PackageInfo getPackageInfo(String packageName, int flags) 1549 throws NameNotFoundException; 1550 1551 /** 1552 * Map from the current package names in use on the device to whatever 1553 * the current canonical name of that package is. 1554 * @param names Array of current names to be mapped. 1555 * @return Returns an array of the same size as the original, containing 1556 * the canonical name for each package. 1557 */ 1558 public abstract String[] currentToCanonicalPackageNames(String[] names); 1559 1560 /** 1561 * Map from a packages canonical name to the current name in use on the device. 1562 * @param names Array of new names to be mapped. 1563 * @return Returns an array of the same size as the original, containing 1564 * the current name for each package. 1565 */ 1566 public abstract String[] canonicalToCurrentPackageNames(String[] names); 1567 1568 /** 1569 * Return a "good" intent to launch a front-door activity in a package, 1570 * for use for example to implement an "open" button when browsing through 1571 * packages. The current implementation will look first for a main 1572 * activity in the category {@link Intent#CATEGORY_INFO}, next for a 1573 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return 1574 * null if neither are found. 1575 * 1576 * <p>Throws {@link NameNotFoundException} if a package with the given 1577 * name cannot be found on the system. 1578 * 1579 * @param packageName The name of the package to inspect. 1580 * 1581 * @return Returns either a fully-qualified Intent that can be used to 1582 * launch the main activity in the package, or null if the package does 1583 * not contain such an activity. 1584 */ 1585 public abstract Intent getLaunchIntentForPackage(String packageName); 1586 1587 /** 1588 * Return a "good" intent to launch a front-door Leanback activity in a 1589 * package, for use for example to implement an "open" button when browsing 1590 * through packages. The current implementation will look for a main 1591 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or 1592 * return null if no main leanback activities are found. 1593 * <p> 1594 * Throws {@link NameNotFoundException} if a package with the given name 1595 * cannot be found on the system. 1596 * 1597 * @param packageName The name of the package to inspect. 1598 * @return Returns either a fully-qualified Intent that can be used to launch 1599 * the main Leanback activity in the package, or null if the package 1600 * does not contain such an activity. 1601 */ 1602 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName); 1603 1604 /** 1605 * Return an array of all of the secondary group-ids that have been assigned 1606 * to a package. 1607 * <p> 1608 * Throws {@link NameNotFoundException} if a package with the given name 1609 * cannot be found on the system. 1610 * 1611 * @param packageName The full name (i.e. com.google.apps.contacts) of the 1612 * desired package. 1613 * @return Returns an int array of the assigned gids, or null if there are 1614 * none. 1615 */ 1616 public abstract int[] getPackageGids(String packageName) 1617 throws NameNotFoundException; 1618 1619 /** 1620 * @hide Return the uid associated with the given package name for the 1621 * given user. 1622 * 1623 * <p>Throws {@link NameNotFoundException} if a package with the given 1624 * name can not be found on the system. 1625 * 1626 * @param packageName The full name (i.e. com.google.apps.contacts) of the 1627 * desired package. 1628 * @param userHandle The user handle identifier to look up the package under. 1629 * 1630 * @return Returns an integer uid who owns the given package name. 1631 */ 1632 public abstract int getPackageUid(String packageName, int userHandle) 1633 throws NameNotFoundException; 1634 1635 /** 1636 * Retrieve all of the information we know about a particular permission. 1637 * 1638 * <p>Throws {@link NameNotFoundException} if a permission with the given 1639 * name cannot be found on the system. 1640 * 1641 * @param name The fully qualified name (i.e. com.google.permission.LOGIN) 1642 * of the permission you are interested in. 1643 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 1644 * retrieve any meta-data associated with the permission. 1645 * 1646 * @return Returns a {@link PermissionInfo} containing information about the 1647 * permission. 1648 */ 1649 public abstract PermissionInfo getPermissionInfo(String name, int flags) 1650 throws NameNotFoundException; 1651 1652 /** 1653 * Query for all of the permissions associated with a particular group. 1654 * 1655 * <p>Throws {@link NameNotFoundException} if the given group does not 1656 * exist. 1657 * 1658 * @param group The fully qualified name (i.e. com.google.permission.LOGIN) 1659 * of the permission group you are interested in. Use null to 1660 * find all of the permissions not associated with a group. 1661 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 1662 * retrieve any meta-data associated with the permissions. 1663 * 1664 * @return Returns a list of {@link PermissionInfo} containing information 1665 * about all of the permissions in the given group. 1666 */ 1667 public abstract List<PermissionInfo> queryPermissionsByGroup(String group, 1668 int flags) throws NameNotFoundException; 1669 1670 /** 1671 * Retrieve all of the information we know about a particular group of 1672 * permissions. 1673 * 1674 * <p>Throws {@link NameNotFoundException} if a permission group with the given 1675 * name cannot be found on the system. 1676 * 1677 * @param name The fully qualified name (i.e. com.google.permission_group.APPS) 1678 * of the permission you are interested in. 1679 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 1680 * retrieve any meta-data associated with the permission group. 1681 * 1682 * @return Returns a {@link PermissionGroupInfo} containing information 1683 * about the permission. 1684 */ 1685 public abstract PermissionGroupInfo getPermissionGroupInfo(String name, 1686 int flags) throws NameNotFoundException; 1687 1688 /** 1689 * Retrieve all of the known permission groups in the system. 1690 * 1691 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 1692 * retrieve any meta-data associated with the permission group. 1693 * 1694 * @return Returns a list of {@link PermissionGroupInfo} containing 1695 * information about all of the known permission groups. 1696 */ 1697 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags); 1698 1699 /** 1700 * Retrieve all of the information we know about a particular 1701 * package/application. 1702 * 1703 * <p>Throws {@link NameNotFoundException} if an application with the given 1704 * package name cannot be found on the system. 1705 * 1706 * @param packageName The full name (i.e. com.google.apps.contacts) of an 1707 * application. 1708 * @param flags Additional option flags. Use any combination of 1709 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1710 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 1711 * 1712 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing 1713 * information about the package. 1714 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not 1715 * found in the list of installed applications, 1716 * the application information is retrieved from the 1717 * list of uninstalled applications(which includes 1718 * installed applications as well as applications 1719 * with data directory ie applications which had been 1720 * deleted with {@code DONT_DELETE_DATA} flag set). 1721 * 1722 * @see #GET_META_DATA 1723 * @see #GET_SHARED_LIBRARY_FILES 1724 * @see #GET_UNINSTALLED_PACKAGES 1725 */ 1726 public abstract ApplicationInfo getApplicationInfo(String packageName, 1727 int flags) throws NameNotFoundException; 1728 1729 /** 1730 * Retrieve all of the information we know about a particular activity 1731 * class. 1732 * 1733 * <p>Throws {@link NameNotFoundException} if an activity with the given 1734 * class name cannot be found on the system. 1735 * 1736 * @param component The full component name (i.e. 1737 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity 1738 * class. 1739 * @param flags Additional option flags. Use any combination of 1740 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1741 * to modify the data (in ApplicationInfo) returned. 1742 * 1743 * @return {@link ActivityInfo} containing information about the activity. 1744 * 1745 * @see #GET_INTENT_FILTERS 1746 * @see #GET_META_DATA 1747 * @see #GET_SHARED_LIBRARY_FILES 1748 */ 1749 public abstract ActivityInfo getActivityInfo(ComponentName component, 1750 int flags) throws NameNotFoundException; 1751 1752 /** 1753 * Retrieve all of the information we know about a particular receiver 1754 * class. 1755 * 1756 * <p>Throws {@link NameNotFoundException} if a receiver with the given 1757 * class name cannot be found on the system. 1758 * 1759 * @param component The full component name (i.e. 1760 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver 1761 * class. 1762 * @param flags Additional option flags. Use any combination of 1763 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1764 * to modify the data returned. 1765 * 1766 * @return {@link ActivityInfo} containing information about the receiver. 1767 * 1768 * @see #GET_INTENT_FILTERS 1769 * @see #GET_META_DATA 1770 * @see #GET_SHARED_LIBRARY_FILES 1771 */ 1772 public abstract ActivityInfo getReceiverInfo(ComponentName component, 1773 int flags) throws NameNotFoundException; 1774 1775 /** 1776 * Retrieve all of the information we know about a particular service 1777 * class. 1778 * 1779 * <p>Throws {@link NameNotFoundException} if a service with the given 1780 * class name cannot be found on the system. 1781 * 1782 * @param component The full component name (i.e. 1783 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service 1784 * class. 1785 * @param flags Additional option flags. Use any combination of 1786 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1787 * to modify the data returned. 1788 * 1789 * @return ServiceInfo containing information about the service. 1790 * 1791 * @see #GET_META_DATA 1792 * @see #GET_SHARED_LIBRARY_FILES 1793 */ 1794 public abstract ServiceInfo getServiceInfo(ComponentName component, 1795 int flags) throws NameNotFoundException; 1796 1797 /** 1798 * Retrieve all of the information we know about a particular content 1799 * provider class. 1800 * 1801 * <p>Throws {@link NameNotFoundException} if a provider with the given 1802 * class name cannot be found on the system. 1803 * 1804 * @param component The full component name (i.e. 1805 * com.google.providers.media/com.google.providers.media.MediaProvider) of a 1806 * ContentProvider class. 1807 * @param flags Additional option flags. Use any combination of 1808 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 1809 * to modify the data returned. 1810 * 1811 * @return ProviderInfo containing information about the service. 1812 * 1813 * @see #GET_META_DATA 1814 * @see #GET_SHARED_LIBRARY_FILES 1815 */ 1816 public abstract ProviderInfo getProviderInfo(ComponentName component, 1817 int flags) throws NameNotFoundException; 1818 1819 /** 1820 * Return a List of all packages that are installed 1821 * on the device. 1822 * 1823 * @param flags Additional option flags. Use any combination of 1824 * {@link #GET_ACTIVITIES}, 1825 * {@link #GET_GIDS}, 1826 * {@link #GET_CONFIGURATIONS}, 1827 * {@link #GET_INSTRUMENTATION}, 1828 * {@link #GET_PERMISSIONS}, 1829 * {@link #GET_PROVIDERS}, 1830 * {@link #GET_RECEIVERS}, 1831 * {@link #GET_SERVICES}, 1832 * {@link #GET_SIGNATURES}, 1833 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 1834 * 1835 * @return A List of PackageInfo objects, one for each package that is 1836 * installed on the device. In the unlikely case of there being no 1837 * installed packages, an empty list is returned. 1838 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all 1839 * applications including those deleted with {@code DONT_DELETE_DATA} 1840 * (partially installed apps with data directory) will be returned. 1841 * 1842 * @see #GET_ACTIVITIES 1843 * @see #GET_GIDS 1844 * @see #GET_CONFIGURATIONS 1845 * @see #GET_INSTRUMENTATION 1846 * @see #GET_PERMISSIONS 1847 * @see #GET_PROVIDERS 1848 * @see #GET_RECEIVERS 1849 * @see #GET_SERVICES 1850 * @see #GET_SIGNATURES 1851 * @see #GET_UNINSTALLED_PACKAGES 1852 */ 1853 public abstract List<PackageInfo> getInstalledPackages(int flags); 1854 1855 /** 1856 * Return a List of all installed packages that are currently 1857 * holding any of the given permissions. 1858 * 1859 * @param flags Additional option flags. Use any combination of 1860 * {@link #GET_ACTIVITIES}, 1861 * {@link #GET_GIDS}, 1862 * {@link #GET_CONFIGURATIONS}, 1863 * {@link #GET_INSTRUMENTATION}, 1864 * {@link #GET_PERMISSIONS}, 1865 * {@link #GET_PROVIDERS}, 1866 * {@link #GET_RECEIVERS}, 1867 * {@link #GET_SERVICES}, 1868 * {@link #GET_SIGNATURES}, 1869 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 1870 * 1871 * @return Returns a List of PackageInfo objects, one for each installed 1872 * application that is holding any of the permissions that were provided. 1873 * 1874 * @see #GET_ACTIVITIES 1875 * @see #GET_GIDS 1876 * @see #GET_CONFIGURATIONS 1877 * @see #GET_INSTRUMENTATION 1878 * @see #GET_PERMISSIONS 1879 * @see #GET_PROVIDERS 1880 * @see #GET_RECEIVERS 1881 * @see #GET_SERVICES 1882 * @see #GET_SIGNATURES 1883 * @see #GET_UNINSTALLED_PACKAGES 1884 */ 1885 public abstract List<PackageInfo> getPackagesHoldingPermissions( 1886 String[] permissions, int flags); 1887 1888 /** 1889 * Return a List of all packages that are installed on the device, for a specific user. 1890 * Requesting a list of installed packages for another user 1891 * will require the permission INTERACT_ACROSS_USERS_FULL. 1892 * @param flags Additional option flags. Use any combination of 1893 * {@link #GET_ACTIVITIES}, 1894 * {@link #GET_GIDS}, 1895 * {@link #GET_CONFIGURATIONS}, 1896 * {@link #GET_INSTRUMENTATION}, 1897 * {@link #GET_PERMISSIONS}, 1898 * {@link #GET_PROVIDERS}, 1899 * {@link #GET_RECEIVERS}, 1900 * {@link #GET_SERVICES}, 1901 * {@link #GET_SIGNATURES}, 1902 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 1903 * @param userId The user for whom the installed packages are to be listed 1904 * 1905 * @return A List of PackageInfo objects, one for each package that is 1906 * installed on the device. In the unlikely case of there being no 1907 * installed packages, an empty list is returned. 1908 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all 1909 * applications including those deleted with {@code DONT_DELETE_DATA} 1910 * (partially installed apps with data directory) will be returned. 1911 * 1912 * @see #GET_ACTIVITIES 1913 * @see #GET_GIDS 1914 * @see #GET_CONFIGURATIONS 1915 * @see #GET_INSTRUMENTATION 1916 * @see #GET_PERMISSIONS 1917 * @see #GET_PROVIDERS 1918 * @see #GET_RECEIVERS 1919 * @see #GET_SERVICES 1920 * @see #GET_SIGNATURES 1921 * @see #GET_UNINSTALLED_PACKAGES 1922 * 1923 * @hide 1924 */ 1925 public abstract List<PackageInfo> getInstalledPackages(int flags, int userId); 1926 1927 /** 1928 * Check whether a particular package has been granted a particular 1929 * permission. 1930 * 1931 * @param permName The name of the permission you are checking for, 1932 * @param pkgName The name of the package you are checking against. 1933 * 1934 * @return If the package has the permission, PERMISSION_GRANTED is 1935 * returned. If it does not have the permission, PERMISSION_DENIED 1936 * is returned. 1937 * 1938 * @see #PERMISSION_GRANTED 1939 * @see #PERMISSION_DENIED 1940 */ 1941 public abstract int checkPermission(String permName, String pkgName); 1942 1943 /** 1944 * Add a new dynamic permission to the system. For this to work, your 1945 * package must have defined a permission tree through the 1946 * {@link android.R.styleable#AndroidManifestPermissionTree 1947 * <permission-tree>} tag in its manifest. A package can only add 1948 * permissions to trees that were defined by either its own package or 1949 * another with the same user id; a permission is in a tree if it 1950 * matches the name of the permission tree + ".": for example, 1951 * "com.foo.bar" is a member of the permission tree "com.foo". 1952 * 1953 * <p>It is good to make your permission tree name descriptive, because you 1954 * are taking possession of that entire set of permission names. Thus, it 1955 * must be under a domain you control, with a suffix that will not match 1956 * any normal permissions that may be declared in any applications that 1957 * are part of that domain. 1958 * 1959 * <p>New permissions must be added before 1960 * any .apks are installed that use those permissions. Permissions you 1961 * add through this method are remembered across reboots of the device. 1962 * If the given permission already exists, the info you supply here 1963 * will be used to update it. 1964 * 1965 * @param info Description of the permission to be added. 1966 * 1967 * @return Returns true if a new permission was created, false if an 1968 * existing one was updated. 1969 * 1970 * @throws SecurityException if you are not allowed to add the 1971 * given permission name. 1972 * 1973 * @see #removePermission(String) 1974 */ 1975 public abstract boolean addPermission(PermissionInfo info); 1976 1977 /** 1978 * Like {@link #addPermission(PermissionInfo)} but asynchronously 1979 * persists the package manager state after returning from the call, 1980 * allowing it to return quicker and batch a series of adds at the 1981 * expense of no guarantee the added permission will be retained if 1982 * the device is rebooted before it is written. 1983 */ 1984 public abstract boolean addPermissionAsync(PermissionInfo info); 1985 1986 /** 1987 * Removes a permission that was previously added with 1988 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply 1989 * -- you are only allowed to remove permissions that you are allowed 1990 * to add. 1991 * 1992 * @param name The name of the permission to remove. 1993 * 1994 * @throws SecurityException if you are not allowed to remove the 1995 * given permission name. 1996 * 1997 * @see #addPermission(PermissionInfo) 1998 */ 1999 public abstract void removePermission(String name); 2000 2001 /** 2002 * Returns an {@link Intent} suitable for passing to {@code startActivityForResult} 2003 * which prompts the user to grant {@code permissions} to this application. 2004 * @hide 2005 * 2006 * @throws NullPointerException if {@code permissions} is {@code null}. 2007 * @throws IllegalArgumentException if {@code permissions} contains {@code null}. 2008 */ 2009 public Intent buildPermissionRequestIntent(String... permissions) { 2010 if (permissions == null) { 2011 throw new NullPointerException("permissions cannot be null"); 2012 } 2013 for (String permission : permissions) { 2014 if (permission == null) { 2015 throw new IllegalArgumentException("permissions cannot contain null"); 2016 } 2017 } 2018 2019 Intent i = new Intent(ACTION_REQUEST_PERMISSION); 2020 i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions); 2021 i.setPackage("com.android.packageinstaller"); 2022 return i; 2023 } 2024 2025 /** 2026 * Grant a permission to an application which the application does not 2027 * already have. The permission must have been requested by the application, 2028 * but as an optional permission. If the application is not allowed to 2029 * hold the permission, a SecurityException is thrown. 2030 * @hide 2031 * 2032 * @param packageName The name of the package that the permission will be 2033 * granted to. 2034 * @param permissionName The name of the permission. 2035 */ 2036 public abstract void grantPermission(String packageName, String permissionName); 2037 2038 /** 2039 * Revoke a permission that was previously granted by {@link #grantPermission}. 2040 * @hide 2041 * 2042 * @param packageName The name of the package that the permission will be 2043 * granted to. 2044 * @param permissionName The name of the permission. 2045 */ 2046 public abstract void revokePermission(String packageName, String permissionName); 2047 2048 /** 2049 * Compare the signatures of two packages to determine if the same 2050 * signature appears in both of them. If they do contain the same 2051 * signature, then they are allowed special privileges when working 2052 * with each other: they can share the same user-id, run instrumentation 2053 * against each other, etc. 2054 * 2055 * @param pkg1 First package name whose signature will be compared. 2056 * @param pkg2 Second package name whose signature will be compared. 2057 * 2058 * @return Returns an integer indicating whether all signatures on the 2059 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if 2060 * all signatures match or < 0 if there is not a match ({@link 2061 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). 2062 * 2063 * @see #checkSignatures(int, int) 2064 * @see #SIGNATURE_MATCH 2065 * @see #SIGNATURE_NO_MATCH 2066 * @see #SIGNATURE_UNKNOWN_PACKAGE 2067 */ 2068 public abstract int checkSignatures(String pkg1, String pkg2); 2069 2070 /** 2071 * Like {@link #checkSignatures(String, String)}, but takes UIDs of 2072 * the two packages to be checked. This can be useful, for example, 2073 * when doing the check in an IPC, where the UID is the only identity 2074 * available. It is functionally identical to determining the package 2075 * associated with the UIDs and checking their signatures. 2076 * 2077 * @param uid1 First UID whose signature will be compared. 2078 * @param uid2 Second UID whose signature will be compared. 2079 * 2080 * @return Returns an integer indicating whether all signatures on the 2081 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if 2082 * all signatures match or < 0 if there is not a match ({@link 2083 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). 2084 * 2085 * @see #checkSignatures(String, String) 2086 * @see #SIGNATURE_MATCH 2087 * @see #SIGNATURE_NO_MATCH 2088 * @see #SIGNATURE_UNKNOWN_PACKAGE 2089 */ 2090 public abstract int checkSignatures(int uid1, int uid2); 2091 2092 /** 2093 * Retrieve the names of all packages that are associated with a particular 2094 * user id. In most cases, this will be a single package name, the package 2095 * that has been assigned that user id. Where there are multiple packages 2096 * sharing the same user id through the "sharedUserId" mechanism, all 2097 * packages with that id will be returned. 2098 * 2099 * @param uid The user id for which you would like to retrieve the 2100 * associated packages. 2101 * 2102 * @return Returns an array of one or more packages assigned to the user 2103 * id, or null if there are no known packages with the given id. 2104 */ 2105 public abstract String[] getPackagesForUid(int uid); 2106 2107 /** 2108 * Retrieve the official name associated with a user id. This name is 2109 * guaranteed to never change, though it is possibly for the underlying 2110 * user id to be changed. That is, if you are storing information about 2111 * user ids in persistent storage, you should use the string returned 2112 * by this function instead of the raw user-id. 2113 * 2114 * @param uid The user id for which you would like to retrieve a name. 2115 * @return Returns a unique name for the given user id, or null if the 2116 * user id is not currently assigned. 2117 */ 2118 public abstract String getNameForUid(int uid); 2119 2120 /** 2121 * Return the user id associated with a shared user name. Multiple 2122 * applications can specify a shared user name in their manifest and thus 2123 * end up using a common uid. This might be used for new applications 2124 * that use an existing shared user name and need to know the uid of the 2125 * shared user. 2126 * 2127 * @param sharedUserName The shared user name whose uid is to be retrieved. 2128 * @return Returns the uid associated with the shared user, or NameNotFoundException 2129 * if the shared user name is not being used by any installed packages 2130 * @hide 2131 */ 2132 public abstract int getUidForSharedUser(String sharedUserName) 2133 throws NameNotFoundException; 2134 2135 /** 2136 * Return a List of all application packages that are installed on the 2137 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all 2138 * applications including those deleted with {@code DONT_DELETE_DATA} (partially 2139 * installed apps with data directory) will be returned. 2140 * 2141 * @param flags Additional option flags. Use any combination of 2142 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2143 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. 2144 * 2145 * @return Returns a List of ApplicationInfo objects, one for each application that 2146 * is installed on the device. In the unlikely case of there being 2147 * no installed applications, an empty list is returned. 2148 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all 2149 * applications including those deleted with {@code DONT_DELETE_DATA} 2150 * (partially installed apps with data directory) will be returned. 2151 * 2152 * @see #GET_META_DATA 2153 * @see #GET_SHARED_LIBRARY_FILES 2154 * @see #GET_UNINSTALLED_PACKAGES 2155 */ 2156 public abstract List<ApplicationInfo> getInstalledApplications(int flags); 2157 2158 /** 2159 * Get a list of shared libraries that are available on the 2160 * system. 2161 * 2162 * @return An array of shared library names that are 2163 * available on the system, or null if none are installed. 2164 * 2165 */ 2166 public abstract String[] getSystemSharedLibraryNames(); 2167 2168 /** 2169 * Get a list of features that are available on the 2170 * system. 2171 * 2172 * @return An array of FeatureInfo classes describing the features 2173 * that are available on the system, or null if there are none(!!). 2174 */ 2175 public abstract FeatureInfo[] getSystemAvailableFeatures(); 2176 2177 /** 2178 * Check whether the given feature name is one of the available 2179 * features as returned by {@link #getSystemAvailableFeatures()}. 2180 * 2181 * @return Returns true if the devices supports the feature, else 2182 * false. 2183 */ 2184 public abstract boolean hasSystemFeature(String name); 2185 2186 /** 2187 * Determine the best action to perform for a given Intent. This is how 2188 * {@link Intent#resolveActivity} finds an activity if a class has not 2189 * been explicitly specified. 2190 * 2191 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName 2192 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} 2193 * only flag. You need to do so to resolve the activity in the same way 2194 * that {@link android.content.Context#startActivity(Intent)} and 2195 * {@link android.content.Intent#resolveActivity(PackageManager) 2196 * Intent.resolveActivity(PackageManager)} do.</p> 2197 * 2198 * @param intent An intent containing all of the desired specification 2199 * (action, data, type, category, and/or component). 2200 * @param flags Additional option flags. The most important is 2201 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 2202 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 2203 * 2204 * @return Returns a ResolveInfo containing the final activity intent that 2205 * was determined to be the best action. Returns null if no 2206 * matching activity was found. If multiple matching activities are 2207 * found and there is no default set, returns a ResolveInfo 2208 * containing something else, such as the activity resolver. 2209 * 2210 * @see #MATCH_DEFAULT_ONLY 2211 * @see #GET_INTENT_FILTERS 2212 * @see #GET_RESOLVED_FILTER 2213 */ 2214 public abstract ResolveInfo resolveActivity(Intent intent, int flags); 2215 2216 /** 2217 * Determine the best action to perform for a given Intent for a given user. This 2218 * is how {@link Intent#resolveActivity} finds an activity if a class has not 2219 * been explicitly specified. 2220 * 2221 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName 2222 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} 2223 * only flag. You need to do so to resolve the activity in the same way 2224 * that {@link android.content.Context#startActivity(Intent)} and 2225 * {@link android.content.Intent#resolveActivity(PackageManager) 2226 * Intent.resolveActivity(PackageManager)} do.</p> 2227 * 2228 * @param intent An intent containing all of the desired specification 2229 * (action, data, type, category, and/or component). 2230 * @param flags Additional option flags. The most important is 2231 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 2232 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 2233 * @param userId The user id. 2234 * 2235 * @return Returns a ResolveInfo containing the final activity intent that 2236 * was determined to be the best action. Returns null if no 2237 * matching activity was found. If multiple matching activities are 2238 * found and there is no default set, returns a ResolveInfo 2239 * containing something else, such as the activity resolver. 2240 * 2241 * @see #MATCH_DEFAULT_ONLY 2242 * @see #GET_INTENT_FILTERS 2243 * @see #GET_RESOLVED_FILTER 2244 * 2245 * @hide 2246 */ 2247 public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId); 2248 2249 /** 2250 * Retrieve all activities that can be performed for the given intent. 2251 * 2252 * @param intent The desired intent as per resolveActivity(). 2253 * @param flags Additional option flags. The most important is 2254 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 2255 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 2256 * 2257 * @return A List<ResolveInfo> containing one entry for each matching 2258 * Activity. These are ordered from best to worst match -- that 2259 * is, the first item in the list is what is returned by 2260 * {@link #resolveActivity}. If there are no matching activities, an empty 2261 * list is returned. 2262 * 2263 * @see #MATCH_DEFAULT_ONLY 2264 * @see #GET_INTENT_FILTERS 2265 * @see #GET_RESOLVED_FILTER 2266 */ 2267 public abstract List<ResolveInfo> queryIntentActivities(Intent intent, 2268 int flags); 2269 2270 /** 2271 * Retrieve all activities that can be performed for the given intent, for a specific user. 2272 * 2273 * @param intent The desired intent as per resolveActivity(). 2274 * @param flags Additional option flags. The most important is 2275 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 2276 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 2277 * 2278 * @return A List<ResolveInfo> containing one entry for each matching 2279 * Activity. These are ordered from best to worst match -- that 2280 * is, the first item in the list is what is returned by 2281 * {@link #resolveActivity}. If there are no matching activities, an empty 2282 * list is returned. 2283 * 2284 * @see #MATCH_DEFAULT_ONLY 2285 * @see #GET_INTENT_FILTERS 2286 * @see #GET_RESOLVED_FILTER 2287 * @hide 2288 */ 2289 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, 2290 int flags, int userId); 2291 2292 2293 /** 2294 * Retrieve a set of activities that should be presented to the user as 2295 * similar options. This is like {@link #queryIntentActivities}, except it 2296 * also allows you to supply a list of more explicit Intents that you would 2297 * like to resolve to particular options, and takes care of returning the 2298 * final ResolveInfo list in a reasonable order, with no duplicates, based 2299 * on those inputs. 2300 * 2301 * @param caller The class name of the activity that is making the 2302 * request. This activity will never appear in the output 2303 * list. Can be null. 2304 * @param specifics An array of Intents that should be resolved to the 2305 * first specific results. Can be null. 2306 * @param intent The desired intent as per resolveActivity(). 2307 * @param flags Additional option flags. The most important is 2308 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 2309 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 2310 * 2311 * @return A List<ResolveInfo> containing one entry for each matching 2312 * Activity. These are ordered first by all of the intents resolved 2313 * in <var>specifics</var> and then any additional activities that 2314 * can handle <var>intent</var> but did not get included by one of 2315 * the <var>specifics</var> intents. If there are no matching 2316 * activities, an empty list is returned. 2317 * 2318 * @see #MATCH_DEFAULT_ONLY 2319 * @see #GET_INTENT_FILTERS 2320 * @see #GET_RESOLVED_FILTER 2321 */ 2322 public abstract List<ResolveInfo> queryIntentActivityOptions( 2323 ComponentName caller, Intent[] specifics, Intent intent, int flags); 2324 2325 /** 2326 * Retrieve all receivers that can handle a broadcast of the given intent. 2327 * 2328 * @param intent The desired intent as per resolveActivity(). 2329 * @param flags Additional option flags. 2330 * 2331 * @return A List<ResolveInfo> containing one entry for each matching 2332 * Receiver. These are ordered from first to last in priority. If 2333 * there are no matching receivers, an empty list is returned. 2334 * 2335 * @see #MATCH_DEFAULT_ONLY 2336 * @see #GET_INTENT_FILTERS 2337 * @see #GET_RESOLVED_FILTER 2338 */ 2339 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, 2340 int flags); 2341 2342 /** 2343 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific 2344 * user. 2345 * 2346 * @param intent The desired intent as per resolveActivity(). 2347 * @param flags Additional option flags. 2348 * @param userId The userId of the user being queried. 2349 * 2350 * @return A List<ResolveInfo> containing one entry for each matching 2351 * Receiver. These are ordered from first to last in priority. If 2352 * there are no matching receivers, an empty list is returned. 2353 * 2354 * @see #MATCH_DEFAULT_ONLY 2355 * @see #GET_INTENT_FILTERS 2356 * @see #GET_RESOLVED_FILTER 2357 * @hide 2358 */ 2359 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, 2360 int flags, int userId); 2361 2362 /** 2363 * Determine the best service to handle for a given Intent. 2364 * 2365 * @param intent An intent containing all of the desired specification 2366 * (action, data, type, category, and/or component). 2367 * @param flags Additional option flags. 2368 * 2369 * @return Returns a ResolveInfo containing the final service intent that 2370 * was determined to be the best action. Returns null if no 2371 * matching service was found. 2372 * 2373 * @see #GET_INTENT_FILTERS 2374 * @see #GET_RESOLVED_FILTER 2375 */ 2376 public abstract ResolveInfo resolveService(Intent intent, int flags); 2377 2378 /** 2379 * Retrieve all services that can match the given intent. 2380 * 2381 * @param intent The desired intent as per resolveService(). 2382 * @param flags Additional option flags. 2383 * 2384 * @return A List<ResolveInfo> containing one entry for each matching 2385 * ServiceInfo. These are ordered from best to worst match -- that 2386 * is, the first item in the list is what is returned by 2387 * resolveService(). If there are no matching services, an empty 2388 * list is returned. 2389 * 2390 * @see #GET_INTENT_FILTERS 2391 * @see #GET_RESOLVED_FILTER 2392 */ 2393 public abstract List<ResolveInfo> queryIntentServices(Intent intent, 2394 int flags); 2395 2396 /** 2397 * Retrieve all services that can match the given intent for a given user. 2398 * 2399 * @param intent The desired intent as per resolveService(). 2400 * @param flags Additional option flags. 2401 * @param userId The user id. 2402 * 2403 * @return A List<ResolveInfo> containing one entry for each matching 2404 * ServiceInfo. These are ordered from best to worst match -- that 2405 * is, the first item in the list is what is returned by 2406 * resolveService(). If there are no matching services, an empty 2407 * list is returned. 2408 * 2409 * @see #GET_INTENT_FILTERS 2410 * @see #GET_RESOLVED_FILTER 2411 * 2412 * @hide 2413 */ 2414 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, 2415 int flags, int userId); 2416 2417 /** {@hide} */ 2418 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( 2419 Intent intent, int flags, int userId); 2420 2421 /** 2422 * Retrieve all providers that can match the given intent. 2423 * 2424 * @param intent An intent containing all of the desired specification 2425 * (action, data, type, category, and/or component). 2426 * @param flags Additional option flags. 2427 * @return A List<ResolveInfo> containing one entry for each matching 2428 * ProviderInfo. These are ordered from best to worst match. If 2429 * there are no matching providers, an empty list is returned. 2430 * @see #GET_INTENT_FILTERS 2431 * @see #GET_RESOLVED_FILTER 2432 */ 2433 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags); 2434 2435 /** 2436 * Find a single content provider by its base path name. 2437 * 2438 * @param name The name of the provider to find. 2439 * @param flags Additional option flags. Currently should always be 0. 2440 * 2441 * @return ContentProviderInfo Information about the provider, if found, 2442 * else null. 2443 */ 2444 public abstract ProviderInfo resolveContentProvider(String name, 2445 int flags); 2446 2447 /** 2448 * Retrieve content provider information. 2449 * 2450 * <p><em>Note: unlike most other methods, an empty result set is indicated 2451 * by a null return instead of an empty list.</em> 2452 * 2453 * @param processName If non-null, limits the returned providers to only 2454 * those that are hosted by the given process. If null, 2455 * all content providers are returned. 2456 * @param uid If <var>processName</var> is non-null, this is the required 2457 * uid owning the requested content providers. 2458 * @param flags Additional option flags. Currently should always be 0. 2459 * 2460 * @return A List<ContentProviderInfo> containing one entry for each 2461 * content provider either patching <var>processName</var> or, if 2462 * <var>processName</var> is null, all known content providers. 2463 * <em>If there are no matching providers, null is returned.</em> 2464 */ 2465 public abstract List<ProviderInfo> queryContentProviders( 2466 String processName, int uid, int flags); 2467 2468 /** 2469 * Retrieve all of the information we know about a particular 2470 * instrumentation class. 2471 * 2472 * <p>Throws {@link NameNotFoundException} if instrumentation with the 2473 * given class name cannot be found on the system. 2474 * 2475 * @param className The full name (i.e. 2476 * com.google.apps.contacts.InstrumentList) of an 2477 * Instrumentation class. 2478 * @param flags Additional option flags. Currently should always be 0. 2479 * 2480 * @return InstrumentationInfo containing information about the 2481 * instrumentation. 2482 */ 2483 public abstract InstrumentationInfo getInstrumentationInfo( 2484 ComponentName className, int flags) throws NameNotFoundException; 2485 2486 /** 2487 * Retrieve information about available instrumentation code. May be used 2488 * to retrieve either all instrumentation code, or only the code targeting 2489 * a particular package. 2490 * 2491 * @param targetPackage If null, all instrumentation is returned; only the 2492 * instrumentation targeting this package name is 2493 * returned. 2494 * @param flags Additional option flags. Currently should always be 0. 2495 * 2496 * @return A List<InstrumentationInfo> containing one entry for each 2497 * matching available Instrumentation. Returns an empty list if 2498 * there is no instrumentation available for the given package. 2499 */ 2500 public abstract List<InstrumentationInfo> queryInstrumentation( 2501 String targetPackage, int flags); 2502 2503 /** 2504 * Retrieve an image from a package. This is a low-level API used by 2505 * the various package manager info structures (such as 2506 * {@link ComponentInfo} to implement retrieval of their associated 2507 * icon. 2508 * 2509 * @param packageName The name of the package that this icon is coming from. 2510 * Cannot be null. 2511 * @param resid The resource identifier of the desired image. Cannot be 0. 2512 * @param appInfo Overall information about <var>packageName</var>. This 2513 * may be null, in which case the application information will be retrieved 2514 * for you if needed; if you already have this information around, it can 2515 * be much more efficient to supply it here. 2516 * 2517 * @return Returns a Drawable holding the requested image. Returns null if 2518 * an image could not be found for any reason. 2519 */ 2520 public abstract Drawable getDrawable(String packageName, int resid, 2521 ApplicationInfo appInfo); 2522 2523 /** 2524 * Retrieve the icon associated with an activity. Given the full name of 2525 * an activity, retrieves the information about it and calls 2526 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. 2527 * If the activity cannot be found, NameNotFoundException is thrown. 2528 * 2529 * @param activityName Name of the activity whose icon is to be retrieved. 2530 * 2531 * @return Returns the image of the icon, or the default activity icon if 2532 * it could not be found. Does not return null. 2533 * @throws NameNotFoundException Thrown if the resources for the given 2534 * activity could not be loaded. 2535 * 2536 * @see #getActivityIcon(Intent) 2537 */ 2538 public abstract Drawable getActivityIcon(ComponentName activityName) 2539 throws NameNotFoundException; 2540 2541 /** 2542 * Retrieve the icon associated with an Intent. If intent.getClassName() is 2543 * set, this simply returns the result of 2544 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's 2545 * component and returns the icon associated with the resolved component. 2546 * If intent.getClassName() cannot be found or the Intent cannot be resolved 2547 * to a component, NameNotFoundException is thrown. 2548 * 2549 * @param intent The intent for which you would like to retrieve an icon. 2550 * 2551 * @return Returns the image of the icon, or the default activity icon if 2552 * it could not be found. Does not return null. 2553 * @throws NameNotFoundException Thrown if the resources for application 2554 * matching the given intent could not be loaded. 2555 * 2556 * @see #getActivityIcon(ComponentName) 2557 */ 2558 public abstract Drawable getActivityIcon(Intent intent) 2559 throws NameNotFoundException; 2560 2561 /** 2562 * Retrieve the banner associated with an activity. Given the full name of 2563 * an activity, retrieves the information about it and calls 2564 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its 2565 * banner. If the activity cannot be found, NameNotFoundException is thrown. 2566 * 2567 * @param activityName Name of the activity whose banner is to be retrieved. 2568 * @return Returns the image of the banner, or null if the activity has no 2569 * banner specified. 2570 * @throws NameNotFoundException Thrown if the resources for the given 2571 * activity could not be loaded. 2572 * @see #getActivityBanner(Intent) 2573 */ 2574 public abstract Drawable getActivityBanner(ComponentName activityName) 2575 throws NameNotFoundException; 2576 2577 /** 2578 * Retrieve the banner associated with an Intent. If intent.getClassName() 2579 * is set, this simply returns the result of 2580 * getActivityBanner(intent.getClassName()). Otherwise it resolves the 2581 * intent's component and returns the banner associated with the resolved 2582 * component. If intent.getClassName() cannot be found or the Intent cannot 2583 * be resolved to a component, NameNotFoundException is thrown. 2584 * 2585 * @param intent The intent for which you would like to retrieve a banner. 2586 * @return Returns the image of the banner, or null if the activity has no 2587 * banner specified. 2588 * @throws NameNotFoundException Thrown if the resources for application 2589 * matching the given intent could not be loaded. 2590 * @see #getActivityBanner(ComponentName) 2591 */ 2592 public abstract Drawable getActivityBanner(Intent intent) 2593 throws NameNotFoundException; 2594 2595 /** 2596 * Return the generic icon for an activity that is used when no specific 2597 * icon is defined. 2598 * 2599 * @return Drawable Image of the icon. 2600 */ 2601 public abstract Drawable getDefaultActivityIcon(); 2602 2603 /** 2604 * Retrieve the icon associated with an application. If it has not defined 2605 * an icon, the default app icon is returned. Does not return null. 2606 * 2607 * @param info Information about application being queried. 2608 * 2609 * @return Returns the image of the icon, or the default application icon 2610 * if it could not be found. 2611 * 2612 * @see #getApplicationIcon(String) 2613 */ 2614 public abstract Drawable getApplicationIcon(ApplicationInfo info); 2615 2616 /** 2617 * Retrieve the icon associated with an application. Given the name of the 2618 * application's package, retrieves the information about it and calls 2619 * getApplicationIcon() to return its icon. If the application cannot be 2620 * found, NameNotFoundException is thrown. 2621 * 2622 * @param packageName Name of the package whose application icon is to be 2623 * retrieved. 2624 * 2625 * @return Returns the image of the icon, or the default application icon 2626 * if it could not be found. Does not return null. 2627 * @throws NameNotFoundException Thrown if the resources for the given 2628 * application could not be loaded. 2629 * 2630 * @see #getApplicationIcon(ApplicationInfo) 2631 */ 2632 public abstract Drawable getApplicationIcon(String packageName) 2633 throws NameNotFoundException; 2634 2635 /** 2636 * Retrieve the banner associated with an application. 2637 * 2638 * @param info Information about application being queried. 2639 * @return Returns the image of the banner or null if the application has no 2640 * banner specified. 2641 * @see #getApplicationBanner(String) 2642 */ 2643 public abstract Drawable getApplicationBanner(ApplicationInfo info); 2644 2645 /** 2646 * Retrieve the banner associated with an application. Given the name of the 2647 * application's package, retrieves the information about it and calls 2648 * getApplicationIcon() to return its banner. If the application cannot be 2649 * found, NameNotFoundException is thrown. 2650 * 2651 * @param packageName Name of the package whose application banner is to be 2652 * retrieved. 2653 * @return Returns the image of the banner or null if the application has no 2654 * banner specified. 2655 * @throws NameNotFoundException Thrown if the resources for the given 2656 * application could not be loaded. 2657 * @see #getApplicationBanner(ApplicationInfo) 2658 */ 2659 public abstract Drawable getApplicationBanner(String packageName) 2660 throws NameNotFoundException; 2661 2662 /** 2663 * Retrieve the logo associated with an activity. Given the full name of an 2664 * activity, retrieves the information about it and calls 2665 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its 2666 * logo. If the activity cannot be found, NameNotFoundException is thrown. 2667 * 2668 * @param activityName Name of the activity whose logo is to be retrieved. 2669 * @return Returns the image of the logo or null if the activity has no logo 2670 * specified. 2671 * @throws NameNotFoundException Thrown if the resources for the given 2672 * activity could not be loaded. 2673 * @see #getActivityLogo(Intent) 2674 */ 2675 public abstract Drawable getActivityLogo(ComponentName activityName) 2676 throws NameNotFoundException; 2677 2678 /** 2679 * Retrieve the logo associated with an Intent. If intent.getClassName() is 2680 * set, this simply returns the result of 2681 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's 2682 * component and returns the logo associated with the resolved component. 2683 * If intent.getClassName() cannot be found or the Intent cannot be resolved 2684 * to a component, NameNotFoundException is thrown. 2685 * 2686 * @param intent The intent for which you would like to retrieve a logo. 2687 * 2688 * @return Returns the image of the logo, or null if the activity has no 2689 * logo specified. 2690 * 2691 * @throws NameNotFoundException Thrown if the resources for application 2692 * matching the given intent could not be loaded. 2693 * 2694 * @see #getActivityLogo(ComponentName) 2695 */ 2696 public abstract Drawable getActivityLogo(Intent intent) 2697 throws NameNotFoundException; 2698 2699 /** 2700 * Retrieve the logo associated with an application. If it has not specified 2701 * a logo, this method returns null. 2702 * 2703 * @param info Information about application being queried. 2704 * 2705 * @return Returns the image of the logo, or null if no logo is specified 2706 * by the application. 2707 * 2708 * @see #getApplicationLogo(String) 2709 */ 2710 public abstract Drawable getApplicationLogo(ApplicationInfo info); 2711 2712 /** 2713 * Retrieve the logo associated with an application. Given the name of the 2714 * application's package, retrieves the information about it and calls 2715 * getApplicationLogo() to return its logo. If the application cannot be 2716 * found, NameNotFoundException is thrown. 2717 * 2718 * @param packageName Name of the package whose application logo is to be 2719 * retrieved. 2720 * 2721 * @return Returns the image of the logo, or null if no application logo 2722 * has been specified. 2723 * 2724 * @throws NameNotFoundException Thrown if the resources for the given 2725 * application could not be loaded. 2726 * 2727 * @see #getApplicationLogo(ApplicationInfo) 2728 */ 2729 public abstract Drawable getApplicationLogo(String packageName) 2730 throws NameNotFoundException; 2731 2732 /** 2733 * Retrieve text from a package. This is a low-level API used by 2734 * the various package manager info structures (such as 2735 * {@link ComponentInfo} to implement retrieval of their associated 2736 * labels and other text. 2737 * 2738 * @param packageName The name of the package that this text is coming from. 2739 * Cannot be null. 2740 * @param resid The resource identifier of the desired text. Cannot be 0. 2741 * @param appInfo Overall information about <var>packageName</var>. This 2742 * may be null, in which case the application information will be retrieved 2743 * for you if needed; if you already have this information around, it can 2744 * be much more efficient to supply it here. 2745 * 2746 * @return Returns a CharSequence holding the requested text. Returns null 2747 * if the text could not be found for any reason. 2748 */ 2749 public abstract CharSequence getText(String packageName, int resid, 2750 ApplicationInfo appInfo); 2751 2752 /** 2753 * Retrieve an XML file from a package. This is a low-level API used to 2754 * retrieve XML meta data. 2755 * 2756 * @param packageName The name of the package that this xml is coming from. 2757 * Cannot be null. 2758 * @param resid The resource identifier of the desired xml. Cannot be 0. 2759 * @param appInfo Overall information about <var>packageName</var>. This 2760 * may be null, in which case the application information will be retrieved 2761 * for you if needed; if you already have this information around, it can 2762 * be much more efficient to supply it here. 2763 * 2764 * @return Returns an XmlPullParser allowing you to parse out the XML 2765 * data. Returns null if the xml resource could not be found for any 2766 * reason. 2767 */ 2768 public abstract XmlResourceParser getXml(String packageName, int resid, 2769 ApplicationInfo appInfo); 2770 2771 /** 2772 * Return the label to use for this application. 2773 * 2774 * @return Returns the label associated with this application, or null if 2775 * it could not be found for any reason. 2776 * @param info The application to get the label of. 2777 */ 2778 public abstract CharSequence getApplicationLabel(ApplicationInfo info); 2779 2780 /** 2781 * Retrieve the resources associated with an activity. Given the full 2782 * name of an activity, retrieves the information about it and calls 2783 * getResources() to return its application's resources. If the activity 2784 * cannot be found, NameNotFoundException is thrown. 2785 * 2786 * @param activityName Name of the activity whose resources are to be 2787 * retrieved. 2788 * 2789 * @return Returns the application's Resources. 2790 * @throws NameNotFoundException Thrown if the resources for the given 2791 * application could not be loaded. 2792 * 2793 * @see #getResourcesForApplication(ApplicationInfo) 2794 */ 2795 public abstract Resources getResourcesForActivity(ComponentName activityName) 2796 throws NameNotFoundException; 2797 2798 /** 2799 * Retrieve the resources for an application. Throws NameNotFoundException 2800 * if the package is no longer installed. 2801 * 2802 * @param app Information about the desired application. 2803 * 2804 * @return Returns the application's Resources. 2805 * @throws NameNotFoundException Thrown if the resources for the given 2806 * application could not be loaded (most likely because it was uninstalled). 2807 */ 2808 public abstract Resources getResourcesForApplication(ApplicationInfo app) 2809 throws NameNotFoundException; 2810 2811 /** 2812 * Retrieve the resources associated with an application. Given the full 2813 * package name of an application, retrieves the information about it and 2814 * calls getResources() to return its application's resources. If the 2815 * appPackageName cannot be found, NameNotFoundException is thrown. 2816 * 2817 * @param appPackageName Package name of the application whose resources 2818 * are to be retrieved. 2819 * 2820 * @return Returns the application's Resources. 2821 * @throws NameNotFoundException Thrown if the resources for the given 2822 * application could not be loaded. 2823 * 2824 * @see #getResourcesForApplication(ApplicationInfo) 2825 */ 2826 public abstract Resources getResourcesForApplication(String appPackageName) 2827 throws NameNotFoundException; 2828 2829 /** @hide */ 2830 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId) 2831 throws NameNotFoundException; 2832 2833 /** 2834 * Retrieve overall information about an application package defined 2835 * in a package archive file 2836 * 2837 * @param archiveFilePath The path to the archive file 2838 * @param flags Additional option flags. Use any combination of 2839 * {@link #GET_ACTIVITIES}, 2840 * {@link #GET_GIDS}, 2841 * {@link #GET_CONFIGURATIONS}, 2842 * {@link #GET_INSTRUMENTATION}, 2843 * {@link #GET_PERMISSIONS}, 2844 * {@link #GET_PROVIDERS}, 2845 * {@link #GET_RECEIVERS}, 2846 * {@link #GET_SERVICES}, 2847 * {@link #GET_SIGNATURES}, to modify the data returned. 2848 * 2849 * @return Returns the information about the package. Returns 2850 * null if the package could not be successfully parsed. 2851 * 2852 * @see #GET_ACTIVITIES 2853 * @see #GET_GIDS 2854 * @see #GET_CONFIGURATIONS 2855 * @see #GET_INSTRUMENTATION 2856 * @see #GET_PERMISSIONS 2857 * @see #GET_PROVIDERS 2858 * @see #GET_RECEIVERS 2859 * @see #GET_SERVICES 2860 * @see #GET_SIGNATURES 2861 * 2862 */ 2863 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { 2864 PackageParser packageParser = new PackageParser(archiveFilePath); 2865 DisplayMetrics metrics = new DisplayMetrics(); 2866 metrics.setToDefaults(); 2867 final File sourceFile = new File(archiveFilePath); 2868 PackageParser.Package pkg = packageParser.parsePackage( 2869 sourceFile, archiveFilePath, metrics, 0); 2870 if (pkg == null) { 2871 return null; 2872 } 2873 if ((flags & GET_SIGNATURES) != 0) { 2874 packageParser.collectCertificates(pkg, 0); 2875 } 2876 PackageUserState state = new PackageUserState(); 2877 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); 2878 } 2879 2880 /** 2881 * @hide 2882 * 2883 * Install a package. Since this may take a little while, the result will 2884 * be posted back to the given observer. An installation will fail if the calling context 2885 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the 2886 * package named in the package file's manifest is already installed, or if there's no space 2887 * available on the device. 2888 * 2889 * @param packageURI The location of the package file to install. This can be a 'file:' or a 2890 * 'content:' URI. 2891 * @param observer An observer callback to get notified when the package installation is 2892 * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be 2893 * called when that happens. This parameter must not be null. 2894 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 2895 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 2896 * @param installerPackageName Optional package name of the application that is performing the 2897 * installation. This identifies which market the package came from. 2898 * @deprecated Use {@link #installPackage(Uri, IPackageInstallObserver2, int, String)} 2899 * instead. This method will continue to be supported but the older observer interface 2900 * will not get additional failure details. 2901 */ 2902 // @PrivateApi 2903 public abstract void installPackage( 2904 Uri packageURI, IPackageInstallObserver observer, int flags, 2905 String installerPackageName); 2906 2907 /** 2908 * Similar to 2909 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 2910 * with an extra verification file provided. 2911 * 2912 * @param packageURI The location of the package file to install. This can 2913 * be a 'file:' or a 'content:' URI. 2914 * @param observer An observer callback to get notified when the package 2915 * installation is complete. 2916 * {@link IPackageInstallObserver#packageInstalled(String, int)} 2917 * will be called when that happens. This parameter must not be null. 2918 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 2919 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 2920 * @param installerPackageName Optional package name of the application that 2921 * is performing the installation. This identifies which market 2922 * the package came from. 2923 * @param verificationURI The location of the supplementary verification 2924 * file. This can be a 'file:' or a 'content:' URI. May be 2925 * {@code null}. 2926 * @param manifestDigest an object that holds the digest of the package 2927 * which can be used to verify ownership. May be {@code null}. 2928 * @param encryptionParams if the package to be installed is encrypted, 2929 * these parameters describing the encryption and authentication 2930 * used. May be {@code null}. 2931 * @hide 2932 * @deprecated Use {@link #installPackageWithVerification(Uri, IPackageInstallObserver2, 2933 * int, String, Uri, ManifestDigest, ContainerEncryptionParams)} instead. This method will 2934 * continue to be supported but the older observer interface will not get additional failure 2935 * details. 2936 */ 2937 // @PrivateApi 2938 public abstract void installPackageWithVerification(Uri packageURI, 2939 IPackageInstallObserver observer, int flags, String installerPackageName, 2940 Uri verificationURI, ManifestDigest manifestDigest, 2941 ContainerEncryptionParams encryptionParams); 2942 2943 /** 2944 * Similar to 2945 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 2946 * with an extra verification information provided. 2947 * 2948 * @param packageURI The location of the package file to install. This can 2949 * be a 'file:' or a 'content:' URI. 2950 * @param observer An observer callback to get notified when the package 2951 * installation is complete. 2952 * {@link IPackageInstallObserver#packageInstalled(String, int)} 2953 * will be called when that happens. This parameter must not be null. 2954 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 2955 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 2956 * @param installerPackageName Optional package name of the application that 2957 * is performing the installation. This identifies which market 2958 * the package came from. 2959 * @param verificationParams an object that holds signal information to 2960 * assist verification. May be {@code null}. 2961 * @param encryptionParams if the package to be installed is encrypted, 2962 * these parameters describing the encryption and authentication 2963 * used. May be {@code null}. 2964 * 2965 * @hide 2966 * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri, 2967 * IPackageInstallObserver2, int, String, VerificationParams, 2968 * ContainerEncryptionParams)} instead. This method will continue to be 2969 * supported but the older observer interface will not get additional failure details. 2970 */ 2971 @Deprecated 2972 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, 2973 IPackageInstallObserver observer, int flags, String installerPackageName, 2974 VerificationParams verificationParams, 2975 ContainerEncryptionParams encryptionParams); 2976 2977 // Package-install variants that take the new, expanded form of observer interface. 2978 // Note that these *also* take the original observer type and will redundantly 2979 // report the same information to that observer if supplied; but it is not required. 2980 2981 /** 2982 * @hide 2983 * 2984 * Install a package. Since this may take a little while, the result will 2985 * be posted back to the given observer. An installation will fail if the calling context 2986 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the 2987 * package named in the package file's manifest is already installed, or if there's no space 2988 * available on the device. 2989 * 2990 * @param packageURI The location of the package file to install. This can be a 'file:' or a 2991 * 'content:' URI. 2992 * @param observer An observer callback to get notified when the package installation is 2993 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 2994 * called when that happens. This parameter must not be null. 2995 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 2996 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 2997 * @param installerPackageName Optional package name of the application that is performing the 2998 * installation. This identifies which market the package came from. 2999 */ 3000 public abstract void installPackage( 3001 Uri packageURI, PackageInstallObserver observer, 3002 int flags, String installerPackageName); 3003 3004 /** 3005 * Similar to 3006 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 3007 * with an extra verification file provided. 3008 * 3009 * @param packageURI The location of the package file to install. This can 3010 * be a 'file:' or a 'content:' URI. 3011 * @param observer An observer callback to get notified when the package installation is 3012 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 3013 * called when that happens. This parameter must not be null. 3014 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 3015 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 3016 * @param installerPackageName Optional package name of the application that 3017 * is performing the installation. This identifies which market 3018 * the package came from. 3019 * @param verificationURI The location of the supplementary verification 3020 * file. This can be a 'file:' or a 'content:' URI. May be 3021 * {@code null}. 3022 * @param manifestDigest an object that holds the digest of the package 3023 * which can be used to verify ownership. May be {@code null}. 3024 * @param encryptionParams if the package to be installed is encrypted, 3025 * these parameters describing the encryption and authentication 3026 * used. May be {@code null}. 3027 * @hide 3028 */ 3029 public abstract void installPackageWithVerification(Uri packageURI, 3030 PackageInstallObserver observer, int flags, String installerPackageName, 3031 Uri verificationURI, ManifestDigest manifestDigest, 3032 ContainerEncryptionParams encryptionParams); 3033 3034 /** 3035 * Similar to 3036 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 3037 * with an extra verification information provided. 3038 * 3039 * @param packageURI The location of the package file to install. This can 3040 * be a 'file:' or a 'content:' URI. 3041 * @param observer An observer callback to get notified when the package installation is 3042 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 3043 * called when that happens. This parameter must not be null. 3044 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 3045 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 3046 * @param installerPackageName Optional package name of the application that 3047 * is performing the installation. This identifies which market 3048 * the package came from. 3049 * @param verificationParams an object that holds signal information to 3050 * assist verification. May be {@code null}. 3051 * @param encryptionParams if the package to be installed is encrypted, 3052 * these parameters describing the encryption and authentication 3053 * used. May be {@code null}. 3054 * 3055 * @hide 3056 */ 3057 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, 3058 PackageInstallObserver observer, int flags, String installerPackageName, 3059 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams); 3060 3061 /** 3062 * If there is already an application with the given package name installed 3063 * on the system for other users, also install it for the calling user. 3064 * @hide 3065 */ 3066 // @PrivateApi 3067 public abstract int installExistingPackage(String packageName) 3068 throws NameNotFoundException; 3069 3070 /** 3071 * Allows a package listening to the 3072 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification 3073 * broadcast} to respond to the package manager. The response must include 3074 * the {@code verificationCode} which is one of 3075 * {@link PackageManager#VERIFICATION_ALLOW} or 3076 * {@link PackageManager#VERIFICATION_REJECT}. 3077 * 3078 * @param id pending package identifier as passed via the 3079 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. 3080 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} 3081 * or {@link PackageManager#VERIFICATION_REJECT}. 3082 * @throws SecurityException if the caller does not have the 3083 * PACKAGE_VERIFICATION_AGENT permission. 3084 */ 3085 public abstract void verifyPendingInstall(int id, int verificationCode); 3086 3087 /** 3088 * Allows a package listening to the 3089 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification 3090 * broadcast} to extend the default timeout for a response and declare what 3091 * action to perform after the timeout occurs. The response must include 3092 * the {@code verificationCodeAtTimeout} which is one of 3093 * {@link PackageManager#VERIFICATION_ALLOW} or 3094 * {@link PackageManager#VERIFICATION_REJECT}. 3095 * 3096 * This method may only be called once per package id. Additional calls 3097 * will have no effect. 3098 * 3099 * @param id pending package identifier as passed via the 3100 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. 3101 * @param verificationCodeAtTimeout either 3102 * {@link PackageManager#VERIFICATION_ALLOW} or 3103 * {@link PackageManager#VERIFICATION_REJECT}. If 3104 * {@code verificationCodeAtTimeout} is neither 3105 * {@link PackageManager#VERIFICATION_ALLOW} or 3106 * {@link PackageManager#VERIFICATION_REJECT}, then 3107 * {@code verificationCodeAtTimeout} will default to 3108 * {@link PackageManager#VERIFICATION_REJECT}. 3109 * @param millisecondsToDelay the amount of time requested for the timeout. 3110 * Must be positive and less than 3111 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If 3112 * {@code millisecondsToDelay} is out of bounds, 3113 * {@code millisecondsToDelay} will be set to the closest in 3114 * bounds value; namely, 0 or 3115 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. 3116 * @throws SecurityException if the caller does not have the 3117 * PACKAGE_VERIFICATION_AGENT permission. 3118 */ 3119 public abstract void extendVerificationTimeout(int id, 3120 int verificationCodeAtTimeout, long millisecondsToDelay); 3121 3122 /** 3123 * Change the installer associated with a given package. There are limitations 3124 * on how the installer package can be changed; in particular: 3125 * <ul> 3126 * <li> A SecurityException will be thrown if <var>installerPackageName</var> 3127 * is not signed with the same certificate as the calling application. 3128 * <li> A SecurityException will be thrown if <var>targetPackage</var> already 3129 * has an installer package, and that installer package is not signed with 3130 * the same certificate as the calling application. 3131 * </ul> 3132 * 3133 * @param targetPackage The installed package whose installer will be changed. 3134 * @param installerPackageName The package name of the new installer. May be 3135 * null to clear the association. 3136 */ 3137 public abstract void setInstallerPackageName(String targetPackage, 3138 String installerPackageName); 3139 3140 /** 3141 * Attempts to delete a package. Since this may take a little while, the result will 3142 * be posted back to the given observer. A deletion will fail if the calling context 3143 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the 3144 * named package cannot be found, or if the named package is a "system package". 3145 * (TODO: include pointer to documentation on "system packages") 3146 * 3147 * @param packageName The name of the package to delete 3148 * @param observer An observer callback to get notified when the package deletion is 3149 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be 3150 * called when that happens. observer may be null to indicate that no callback is desired. 3151 * @param flags - possible values: {@link #DELETE_KEEP_DATA}, 3152 * {@link #DELETE_ALL_USERS}. 3153 * 3154 * @hide 3155 */ 3156 // @PrivateApi 3157 public abstract void deletePackage( 3158 String packageName, IPackageDeleteObserver observer, int flags); 3159 3160 /** 3161 * Retrieve the package name of the application that installed a package. This identifies 3162 * which market the package came from. 3163 * 3164 * @param packageName The name of the package to query 3165 */ 3166 public abstract String getInstallerPackageName(String packageName); 3167 3168 /** 3169 * Attempts to clear the user data directory of an application. 3170 * Since this may take a little while, the result will 3171 * be posted back to the given observer. A deletion will fail if the 3172 * named package cannot be found, or if the named package is a "system package". 3173 * 3174 * @param packageName The name of the package 3175 * @param observer An observer callback to get notified when the operation is finished 3176 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 3177 * will be called when that happens. observer may be null to indicate that 3178 * no callback is desired. 3179 * 3180 * @hide 3181 */ 3182 public abstract void clearApplicationUserData(String packageName, 3183 IPackageDataObserver observer); 3184 /** 3185 * Attempts to delete the cache files associated with an application. 3186 * Since this may take a little while, the result will 3187 * be posted back to the given observer. A deletion will fail if the calling context 3188 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the 3189 * named package cannot be found, or if the named package is a "system package". 3190 * 3191 * @param packageName The name of the package to delete 3192 * @param observer An observer callback to get notified when the cache file deletion 3193 * is complete. 3194 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 3195 * will be called when that happens. observer may be null to indicate that 3196 * no callback is desired. 3197 * 3198 * @hide 3199 */ 3200 public abstract void deleteApplicationCacheFiles(String packageName, 3201 IPackageDataObserver observer); 3202 3203 /** 3204 * Free storage by deleting LRU sorted list of cache files across 3205 * all applications. If the currently available free storage 3206 * on the device is greater than or equal to the requested 3207 * free storage, no cache files are cleared. If the currently 3208 * available storage on the device is less than the requested 3209 * free storage, some or all of the cache files across 3210 * all applications are deleted (based on last accessed time) 3211 * to increase the free storage space on the device to 3212 * the requested value. There is no guarantee that clearing all 3213 * the cache files from all applications will clear up 3214 * enough storage to achieve the desired value. 3215 * @param freeStorageSize The number of bytes of storage to be 3216 * freed by the system. Say if freeStorageSize is XX, 3217 * and the current free storage is YY, 3218 * if XX is less than YY, just return. if not free XX-YY number 3219 * of bytes if possible. 3220 * @param observer call back used to notify when 3221 * the operation is completed 3222 * 3223 * @hide 3224 */ 3225 // @PrivateApi 3226 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer); 3227 3228 /** 3229 * Free storage by deleting LRU sorted list of cache files across 3230 * all applications. If the currently available free storage 3231 * on the device is greater than or equal to the requested 3232 * free storage, no cache files are cleared. If the currently 3233 * available storage on the device is less than the requested 3234 * free storage, some or all of the cache files across 3235 * all applications are deleted (based on last accessed time) 3236 * to increase the free storage space on the device to 3237 * the requested value. There is no guarantee that clearing all 3238 * the cache files from all applications will clear up 3239 * enough storage to achieve the desired value. 3240 * @param freeStorageSize The number of bytes of storage to be 3241 * freed by the system. Say if freeStorageSize is XX, 3242 * and the current free storage is YY, 3243 * if XX is less than YY, just return. if not free XX-YY number 3244 * of bytes if possible. 3245 * @param pi IntentSender call back used to 3246 * notify when the operation is completed.May be null 3247 * to indicate that no call back is desired. 3248 * 3249 * @hide 3250 */ 3251 public abstract void freeStorage(long freeStorageSize, IntentSender pi); 3252 3253 /** 3254 * Retrieve the size information for a package. 3255 * Since this may take a little while, the result will 3256 * be posted back to the given observer. The calling context 3257 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. 3258 * 3259 * @param packageName The name of the package whose size information is to be retrieved 3260 * @param userHandle The user whose size information should be retrieved. 3261 * @param observer An observer callback to get notified when the operation 3262 * is complete. 3263 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} 3264 * The observer's callback is invoked with a PackageStats object(containing the 3265 * code, data and cache sizes of the package) and a boolean value representing 3266 * the status of the operation. observer may be null to indicate that 3267 * no callback is desired. 3268 * 3269 * @hide 3270 */ 3271 public abstract void getPackageSizeInfo(String packageName, int userHandle, 3272 IPackageStatsObserver observer); 3273 3274 /** 3275 * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but 3276 * returns the size for the calling user. 3277 * 3278 * @hide 3279 */ 3280 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { 3281 getPackageSizeInfo(packageName, UserHandle.myUserId(), observer); 3282 } 3283 3284 /** 3285 * @deprecated This function no longer does anything; it was an old 3286 * approach to managing preferred activities, which has been superseded 3287 * by (and conflicts with) the modern activity-based preferences. 3288 */ 3289 @Deprecated 3290 public abstract void addPackageToPreferred(String packageName); 3291 3292 /** 3293 * @deprecated This function no longer does anything; it was an old 3294 * approach to managing preferred activities, which has been superseded 3295 * by (and conflicts with) the modern activity-based preferences. 3296 */ 3297 @Deprecated 3298 public abstract void removePackageFromPreferred(String packageName); 3299 3300 /** 3301 * Retrieve the list of all currently configured preferred packages. The 3302 * first package on the list is the most preferred, the last is the 3303 * least preferred. 3304 * 3305 * @param flags Additional option flags. Use any combination of 3306 * {@link #GET_ACTIVITIES}, 3307 * {@link #GET_GIDS}, 3308 * {@link #GET_CONFIGURATIONS}, 3309 * {@link #GET_INSTRUMENTATION}, 3310 * {@link #GET_PERMISSIONS}, 3311 * {@link #GET_PROVIDERS}, 3312 * {@link #GET_RECEIVERS}, 3313 * {@link #GET_SERVICES}, 3314 * {@link #GET_SIGNATURES}, to modify the data returned. 3315 * 3316 * @return Returns a list of PackageInfo objects describing each 3317 * preferred application, in order of preference. 3318 * 3319 * @see #GET_ACTIVITIES 3320 * @see #GET_GIDS 3321 * @see #GET_CONFIGURATIONS 3322 * @see #GET_INSTRUMENTATION 3323 * @see #GET_PERMISSIONS 3324 * @see #GET_PROVIDERS 3325 * @see #GET_RECEIVERS 3326 * @see #GET_SERVICES 3327 * @see #GET_SIGNATURES 3328 */ 3329 public abstract List<PackageInfo> getPreferredPackages(int flags); 3330 3331 /** 3332 * @deprecated This is a protected API that should not have been available 3333 * to third party applications. It is the platform's responsibility for 3334 * assigning preferred activities and this cannot be directly modified. 3335 * 3336 * Add a new preferred activity mapping to the system. This will be used 3337 * to automatically select the given activity component when 3338 * {@link Context#startActivity(Intent) Context.startActivity()} finds 3339 * multiple matching activities and also matches the given filter. 3340 * 3341 * @param filter The set of intents under which this activity will be 3342 * made preferred. 3343 * @param match The IntentFilter match category that this preference 3344 * applies to. 3345 * @param set The set of activities that the user was picking from when 3346 * this preference was made. 3347 * @param activity The component name of the activity that is to be 3348 * preferred. 3349 */ 3350 @Deprecated 3351 public abstract void addPreferredActivity(IntentFilter filter, int match, 3352 ComponentName[] set, ComponentName activity); 3353 3354 /** 3355 * Same as {@link #addPreferredActivity(IntentFilter, int, 3356 ComponentName[], ComponentName)}, but with a specific userId to apply the preference 3357 to. 3358 * @hide 3359 */ 3360 public void addPreferredActivity(IntentFilter filter, int match, 3361 ComponentName[] set, ComponentName activity, int userId) { 3362 throw new RuntimeException("Not implemented. Must override in a subclass."); 3363 } 3364 3365 /** 3366 * @deprecated This is a protected API that should not have been available 3367 * to third party applications. It is the platform's responsibility for 3368 * assigning preferred activities and this cannot be directly modified. 3369 * 3370 * Replaces an existing preferred activity mapping to the system, and if that were not present 3371 * adds a new preferred activity. This will be used 3372 * to automatically select the given activity component when 3373 * {@link Context#startActivity(Intent) Context.startActivity()} finds 3374 * multiple matching activities and also matches the given filter. 3375 * 3376 * @param filter The set of intents under which this activity will be 3377 * made preferred. 3378 * @param match The IntentFilter match category that this preference 3379 * applies to. 3380 * @param set The set of activities that the user was picking from when 3381 * this preference was made. 3382 * @param activity The component name of the activity that is to be 3383 * preferred. 3384 * @hide 3385 */ 3386 @Deprecated 3387 public abstract void replacePreferredActivity(IntentFilter filter, int match, 3388 ComponentName[] set, ComponentName activity); 3389 3390 /** 3391 * Remove all preferred activity mappings, previously added with 3392 * {@link #addPreferredActivity}, from the 3393 * system whose activities are implemented in the given package name. 3394 * An application can only clear its own package(s). 3395 * 3396 * @param packageName The name of the package whose preferred activity 3397 * mappings are to be removed. 3398 */ 3399 public abstract void clearPackagePreferredActivities(String packageName); 3400 3401 /** 3402 * Retrieve all preferred activities, previously added with 3403 * {@link #addPreferredActivity}, that are 3404 * currently registered with the system. 3405 * 3406 * @param outFilters A list in which to place the filters of all of the 3407 * preferred activities, or null for none. 3408 * @param outActivities A list in which to place the component names of 3409 * all of the preferred activities, or null for none. 3410 * @param packageName An option package in which you would like to limit 3411 * the list. If null, all activities will be returned; if non-null, only 3412 * those activities in the given package are returned. 3413 * 3414 * @return Returns the total number of registered preferred activities 3415 * (the number of distinct IntentFilter records, not the number of unique 3416 * activity components) that were found. 3417 */ 3418 public abstract int getPreferredActivities(List<IntentFilter> outFilters, 3419 List<ComponentName> outActivities, String packageName); 3420 3421 /** 3422 * Ask for the set of available 'home' activities and the current explicit 3423 * default, if any. 3424 * @hide 3425 */ 3426 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); 3427 3428 /** 3429 * Set the enabled setting for a package component (activity, receiver, service, provider). 3430 * This setting will override any enabled state which may have been set by the component in its 3431 * manifest. 3432 * 3433 * @param componentName The component to enable 3434 * @param newState The new enabled state for the component. The legal values for this state 3435 * are: 3436 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 3437 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 3438 * and 3439 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 3440 * The last one removes the setting, thereby restoring the component's state to 3441 * whatever was set in it's manifest (or enabled, by default). 3442 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 3443 */ 3444 public abstract void setComponentEnabledSetting(ComponentName componentName, 3445 int newState, int flags); 3446 3447 3448 /** 3449 * Return the the enabled setting for a package component (activity, 3450 * receiver, service, provider). This returns the last value set by 3451 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most 3452 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 3453 * the value originally specified in the manifest has not been modified. 3454 * 3455 * @param componentName The component to retrieve. 3456 * @return Returns the current enabled state for the component. May 3457 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 3458 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 3459 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 3460 * component's enabled state is based on the original information in 3461 * the manifest as found in {@link ComponentInfo}. 3462 */ 3463 public abstract int getComponentEnabledSetting(ComponentName componentName); 3464 3465 /** 3466 * Set the enabled setting for an application 3467 * This setting will override any enabled state which may have been set by the application in 3468 * its manifest. It also overrides the enabled state set in the manifest for any of the 3469 * application's components. It does not override any enabled state set by 3470 * {@link #setComponentEnabledSetting} for any of the application's components. 3471 * 3472 * @param packageName The package name of the application to enable 3473 * @param newState The new enabled state for the component. The legal values for this state 3474 * are: 3475 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 3476 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 3477 * and 3478 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 3479 * The last one removes the setting, thereby restoring the applications's state to 3480 * whatever was set in its manifest (or enabled, by default). 3481 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 3482 */ 3483 public abstract void setApplicationEnabledSetting(String packageName, 3484 int newState, int flags); 3485 3486 /** 3487 * Return the the enabled setting for an application. This returns 3488 * the last value set by 3489 * {@link #setApplicationEnabledSetting(String, int, int)}; in most 3490 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 3491 * the value originally specified in the manifest has not been modified. 3492 * 3493 * @param packageName The component to retrieve. 3494 * @return Returns the current enabled state for the component. May 3495 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 3496 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 3497 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 3498 * application's enabled state is based on the original information in 3499 * the manifest as found in {@link ComponentInfo}. 3500 * @throws IllegalArgumentException if the named package does not exist. 3501 */ 3502 public abstract int getApplicationEnabledSetting(String packageName); 3503 3504 /** 3505 * Puts the package in a blocked state, which is almost like an uninstalled state, 3506 * making the package unavailable, but it doesn't remove the data or the actual 3507 * package file. 3508 * @hide 3509 */ 3510 public abstract boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked, 3511 UserHandle userHandle); 3512 3513 /** 3514 * Returns the blocked state of a package. 3515 * @see #setApplicationBlockedSettingAsUser(String, boolean, UserHandle) 3516 * @hide 3517 */ 3518 public abstract boolean getApplicationBlockedSettingAsUser(String packageName, 3519 UserHandle userHandle); 3520 3521 /** 3522 * Return whether the device has been booted into safe mode. 3523 */ 3524 public abstract boolean isSafeMode(); 3525 3526 /** 3527 * Attempts to move package resources from internal to external media or vice versa. 3528 * Since this may take a little while, the result will 3529 * be posted back to the given observer. This call may fail if the calling context 3530 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the 3531 * named package cannot be found, or if the named package is a "system package". 3532 * 3533 * @param packageName The name of the package to delete 3534 * @param observer An observer callback to get notified when the package move is 3535 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be 3536 * called when that happens. observer may be null to indicate that no callback is desired. 3537 * @param flags To indicate install location {@link #MOVE_INTERNAL} or 3538 * {@link #MOVE_EXTERNAL_MEDIA} 3539 * 3540 * @hide 3541 */ 3542 public abstract void movePackage( 3543 String packageName, IPackageMoveObserver observer, int flags); 3544 3545 /** 3546 * Returns the device identity that verifiers can use to associate their scheme to a particular 3547 * device. This should not be used by anything other than a package verifier. 3548 * 3549 * @return identity that uniquely identifies current device 3550 * @hide 3551 */ 3552 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); 3553 3554 /** {@hide} */ 3555 public abstract PackageInstaller getPackageInstaller(); 3556 3557 /** 3558 * Returns the data directory for a particular user and package, given the uid of the package. 3559 * @param uid uid of the package, including the userId and appId 3560 * @param packageName name of the package 3561 * @return the user-specific data directory for the package 3562 * @hide 3563 */ 3564 public static String getDataDirForUser(int userId, String packageName) { 3565 // TODO: This should be shared with Installer's knowledge of user directory 3566 return Environment.getDataDirectory().toString() + "/user/" + userId 3567 + "/" + packageName; 3568 } 3569 3570 /** 3571 * Adds a forwarding intent filter. After calling this method all intents sent from the user 3572 * with id userIdOrig can also be be resolved by activities in the user with id userIdDest if 3573 * they match the specified intent filter. 3574 * @param filter the {@link IntentFilter} the intent has to match to be forwarded 3575 * @param removable if set to false, {@link clearForwardingIntents} will not remove this intent 3576 * filter 3577 * @param userIdOrig user from which the intent can be forwarded 3578 * @param userIdDest user to which the intent can be forwarded 3579 * @hide 3580 */ 3581 public abstract void addForwardingIntentFilter(IntentFilter filter, boolean removable, 3582 int userIdOrig, int userIdDest); 3583 3584 /** 3585 * Clearing all removable {@link ForwardingIntentFilter}s that are set with the given user as 3586 * the origin. 3587 * @param userIdOrig user from which the intent can be forwarded 3588 * @hide 3589 */ 3590 public abstract void clearForwardingIntentFilters(int userIdOrig); 3591} 3592