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