PackageManager.java revision 377ded0fce449f77cd7efae35f97722cdab52693
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.Manifest; 20import android.annotation.CheckResult; 21import android.annotation.DrawableRes; 22import android.annotation.IntDef; 23import android.annotation.NonNull; 24import android.annotation.Nullable; 25import android.annotation.RequiresPermission; 26import android.annotation.SdkConstant; 27import android.annotation.SdkConstant.SdkConstantType; 28import android.annotation.StringRes; 29import android.annotation.SystemApi; 30import android.annotation.TestApi; 31import android.annotation.UserIdInt; 32import android.annotation.XmlRes; 33import android.app.PackageDeleteObserver; 34import android.app.PackageInstallObserver; 35import android.app.admin.DevicePolicyManager; 36import android.content.ComponentName; 37import android.content.Context; 38import android.content.Intent; 39import android.content.IntentFilter; 40import android.content.IntentSender; 41import android.content.pm.PackageParser.PackageParserException; 42import android.content.res.Resources; 43import android.content.res.XmlResourceParser; 44import android.graphics.Rect; 45import android.graphics.drawable.Drawable; 46import android.net.Uri; 47import android.os.Bundle; 48import android.os.Handler; 49import android.os.RemoteException; 50import android.os.UserHandle; 51import android.os.storage.VolumeInfo; 52import android.util.AndroidException; 53import android.util.Log; 54 55import com.android.internal.util.ArrayUtils; 56 57import java.io.File; 58import java.lang.annotation.Retention; 59import java.lang.annotation.RetentionPolicy; 60import java.util.List; 61 62/** 63 * Class for retrieving various kinds of information related to the application 64 * packages that are currently installed on the device. 65 * 66 * You can find this class through {@link Context#getPackageManager}. 67 */ 68public abstract class PackageManager { 69 private static final String TAG = "PackageManager"; 70 71 /** 72 * This exception is thrown when a given package, application, or component 73 * name cannot be found. 74 */ 75 public static class NameNotFoundException extends AndroidException { 76 public NameNotFoundException() { 77 } 78 79 public NameNotFoundException(String name) { 80 super(name); 81 } 82 } 83 84 /** 85 * Listener for changes in permissions granted to a UID. 86 * 87 * @hide 88 */ 89 @SystemApi 90 public interface OnPermissionsChangedListener { 91 92 /** 93 * Called when the permissions for a UID change. 94 * @param uid The UID with a change. 95 */ 96 public void onPermissionsChanged(int uid); 97 } 98 99 /** 100 * As a guiding principle: 101 * <p> 102 * {@code GET_} flags are used to request additional data that may have been 103 * elided to save wire space. 104 * <p> 105 * {@code MATCH_} flags are used to include components or packages that 106 * would have otherwise been omitted from a result set by current system 107 * state. 108 */ 109 110 /** @hide */ 111 @IntDef(flag = true, value = { 112 GET_ACTIVITIES, 113 GET_CONFIGURATIONS, 114 GET_GIDS, 115 GET_INSTRUMENTATION, 116 GET_INTENT_FILTERS, 117 GET_META_DATA, 118 GET_PERMISSIONS, 119 GET_PROVIDERS, 120 GET_RECEIVERS, 121 GET_SERVICES, 122 GET_SHARED_LIBRARY_FILES, 123 GET_SIGNATURES, 124 GET_URI_PERMISSION_PATTERNS, 125 MATCH_UNINSTALLED_PACKAGES, 126 MATCH_DISABLED_COMPONENTS, 127 MATCH_DISABLED_UNTIL_USED_COMPONENTS, 128 MATCH_SYSTEM_ONLY, 129 MATCH_DEBUG_TRIAGED_MISSING, 130 }) 131 @Retention(RetentionPolicy.SOURCE) 132 public @interface PackageInfoFlags {} 133 134 /** @hide */ 135 @IntDef(flag = true, value = { 136 GET_META_DATA, 137 GET_SHARED_LIBRARY_FILES, 138 MATCH_UNINSTALLED_PACKAGES, 139 MATCH_SYSTEM_ONLY, 140 MATCH_DEBUG_TRIAGED_MISSING, 141 }) 142 @Retention(RetentionPolicy.SOURCE) 143 public @interface ApplicationInfoFlags {} 144 145 /** @hide */ 146 @IntDef(flag = true, value = { 147 GET_META_DATA, 148 GET_SHARED_LIBRARY_FILES, 149 MATCH_ALL, 150 MATCH_DEBUG_TRIAGED_MISSING, 151 MATCH_DEFAULT_ONLY, 152 MATCH_DISABLED_COMPONENTS, 153 MATCH_DISABLED_UNTIL_USED_COMPONENTS, 154 MATCH_ENCRYPTION_AWARE, 155 MATCH_ENCRYPTION_AWARE_AND_UNAWARE, 156 MATCH_ENCRYPTION_UNAWARE, 157 MATCH_SYSTEM_ONLY, 158 MATCH_UNINSTALLED_PACKAGES, 159 }) 160 @Retention(RetentionPolicy.SOURCE) 161 public @interface ComponentInfoFlags {} 162 163 /** @hide */ 164 @IntDef(flag = true, value = { 165 GET_META_DATA, 166 GET_RESOLVED_FILTER, 167 GET_SHARED_LIBRARY_FILES, 168 MATCH_ALL, 169 MATCH_DEBUG_TRIAGED_MISSING, 170 MATCH_DISABLED_COMPONENTS, 171 MATCH_DISABLED_UNTIL_USED_COMPONENTS, 172 MATCH_DEFAULT_ONLY, 173 MATCH_ENCRYPTION_AWARE, 174 MATCH_ENCRYPTION_AWARE_AND_UNAWARE, 175 MATCH_ENCRYPTION_UNAWARE, 176 MATCH_SYSTEM_ONLY, 177 MATCH_UNINSTALLED_PACKAGES, 178 }) 179 @Retention(RetentionPolicy.SOURCE) 180 public @interface ResolveInfoFlags {} 181 182 /** @hide */ 183 @IntDef(flag = true, value = { 184 GET_META_DATA, 185 }) 186 @Retention(RetentionPolicy.SOURCE) 187 public @interface PermissionInfoFlags {} 188 189 /** @hide */ 190 @IntDef(flag = true, value = { 191 GET_META_DATA, 192 }) 193 @Retention(RetentionPolicy.SOURCE) 194 public @interface PermissionGroupInfoFlags {} 195 196 /** @hide */ 197 @IntDef(flag = true, value = { 198 GET_META_DATA, 199 }) 200 @Retention(RetentionPolicy.SOURCE) 201 public @interface InstrumentationInfoFlags {} 202 203 /** 204 * {@link PackageInfo} flag: return information about 205 * activities in the package in {@link PackageInfo#activities}. 206 */ 207 public static final int GET_ACTIVITIES = 0x00000001; 208 209 /** 210 * {@link PackageInfo} flag: return information about 211 * intent receivers in the package in 212 * {@link PackageInfo#receivers}. 213 */ 214 public static final int GET_RECEIVERS = 0x00000002; 215 216 /** 217 * {@link PackageInfo} flag: return information about 218 * services in the package in {@link PackageInfo#services}. 219 */ 220 public static final int GET_SERVICES = 0x00000004; 221 222 /** 223 * {@link PackageInfo} flag: return information about 224 * content providers in the package in 225 * {@link PackageInfo#providers}. 226 */ 227 public static final int GET_PROVIDERS = 0x00000008; 228 229 /** 230 * {@link PackageInfo} flag: return information about 231 * instrumentation in the package in 232 * {@link PackageInfo#instrumentation}. 233 */ 234 public static final int GET_INSTRUMENTATION = 0x00000010; 235 236 /** 237 * {@link PackageInfo} flag: return information about the 238 * intent filters supported by the activity. 239 */ 240 public static final int GET_INTENT_FILTERS = 0x00000020; 241 242 /** 243 * {@link PackageInfo} flag: return information about the 244 * signatures included in the package. 245 */ 246 public static final int GET_SIGNATURES = 0x00000040; 247 248 /** 249 * {@link ResolveInfo} flag: return the IntentFilter that 250 * was matched for a particular ResolveInfo in 251 * {@link ResolveInfo#filter}. 252 */ 253 public static final int GET_RESOLVED_FILTER = 0x00000040; 254 255 /** 256 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} 257 * data {@link android.os.Bundle}s that are associated with a component. 258 * This applies for any API returning a ComponentInfo subclass. 259 */ 260 public static final int GET_META_DATA = 0x00000080; 261 262 /** 263 * {@link PackageInfo} flag: return the 264 * {@link PackageInfo#gids group ids} that are associated with an 265 * application. 266 * This applies for any API returning a PackageInfo class, either 267 * directly or nested inside of another. 268 */ 269 public static final int GET_GIDS = 0x00000100; 270 271 /** 272 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS} 273 */ 274 @Deprecated 275 public static final int GET_DISABLED_COMPONENTS = 0x00000200; 276 277 /** 278 * {@link PackageInfo} flag: include disabled components in the returned info. 279 */ 280 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200; 281 282 /** 283 * {@link ApplicationInfo} flag: return the 284 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} 285 * that are associated with an application. 286 * This applies for any API returning an ApplicationInfo class, either 287 * directly or nested inside of another. 288 */ 289 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; 290 291 /** 292 * {@link ProviderInfo} flag: return the 293 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} 294 * that are associated with a content provider. 295 * This applies for any API returning a ProviderInfo class, either 296 * directly or nested inside of another. 297 */ 298 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; 299 /** 300 * {@link PackageInfo} flag: return information about 301 * permissions in the package in 302 * {@link PackageInfo#permissions}. 303 */ 304 public static final int GET_PERMISSIONS = 0x00001000; 305 306 /** 307 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES} 308 */ 309 @Deprecated 310 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; 311 312 /** 313 * Flag parameter to retrieve some information about all applications (even 314 * uninstalled ones) which have data directories. This state could have 315 * resulted if applications have been deleted with flag 316 * {@code DONT_DELETE_DATA} with a possibility of being replaced or 317 * reinstalled in future. 318 * <p> 319 * Note: this flag may cause less information about currently installed 320 * applications to be returned. 321 */ 322 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000; 323 324 /** 325 * {@link PackageInfo} flag: return information about 326 * hardware preferences in 327 * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, 328 * and requested features in {@link PackageInfo#reqFeatures} and 329 * {@link PackageInfo#featureGroups}. 330 */ 331 public static final int GET_CONFIGURATIONS = 0x00004000; 332 333 /** 334 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}. 335 */ 336 @Deprecated 337 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; 338 339 /** 340 * {@link PackageInfo} flag: include disabled components which are in 341 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} 342 * in the returned info. Note that if you set this flag, applications 343 * that are in this disabled state will be reported as enabled. 344 */ 345 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; 346 347 /** 348 * Resolution and querying flag: if set, only filters that support the 349 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for 350 * matching. This is a synonym for including the CATEGORY_DEFAULT in your 351 * supplied Intent. 352 */ 353 public static final int MATCH_DEFAULT_ONLY = 0x00010000; 354 355 /** 356 * Querying flag: if set and if the platform is doing any filtering of the 357 * results, then the filtering will not happen. This is a synonym for saying 358 * that all results should be returned. 359 * <p> 360 * <em>This flag should be used with extreme care.</em> 361 */ 362 public static final int MATCH_ALL = 0x00020000; 363 364 /** 365 * Querying flag: include only components which are encryption unaware in 366 * the returned info, regardless of the current user state. 367 */ 368 public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000; 369 370 /** 371 * Querying flag: include only components which are encryption aware in the 372 * returned info, regardless of the current user state. 373 */ 374 public static final int MATCH_ENCRYPTION_AWARE = 0x00080000; 375 376 /** 377 * Querying flag: include both encryption aware and unaware components in 378 * the returned info, regardless of the current user state. 379 */ 380 public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = MATCH_ENCRYPTION_AWARE 381 | MATCH_ENCRYPTION_UNAWARE; 382 383 /** 384 * Querying flag: include only components from applications that are marked 385 * with {@link ApplicationInfo#FLAG_SYSTEM}. 386 */ 387 public static final int MATCH_SYSTEM_ONLY = 0x00100000; 388 389 /** 390 * Internal flag used to indicate that a system component has done their 391 * homework and verified that they correctly handle packages and components 392 * that come and go over time. In particular: 393 * <ul> 394 * <li>Apps installed on external storage, which will appear to be 395 * uninstalled while the the device is ejected. 396 * <li>Apps with encryption unaware components, which will appear to not 397 * exist while the device is locked. 398 * </ul> 399 * 400 * @see #MATCH_UNINSTALLED_PACKAGES 401 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 402 * @hide 403 */ 404 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; 405 406 /** 407 * Flag for {@link addCrossProfileIntentFilter}: if this flag is set: 408 * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current 409 * profile will be skipped. 410 * Only activities in the target user can respond to the intent. 411 * @hide 412 */ 413 public static final int SKIP_CURRENT_PROFILE = 0x00000002; 414 415 /** 416 * Flag for {@link addCrossProfileIntentFilter}: if this flag is set: 417 * activities in the other profiles can respond to the intent only if no activity with 418 * non-negative priority in current profile can respond to the intent. 419 * @hide 420 */ 421 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004; 422 423 /** @hide */ 424 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED}) 425 @Retention(RetentionPolicy.SOURCE) 426 public @interface PermissionResult {} 427 428 /** 429 * Permission check result: this is returned by {@link #checkPermission} 430 * if the permission has been granted to the given package. 431 */ 432 public static final int PERMISSION_GRANTED = 0; 433 434 /** 435 * Permission check result: this is returned by {@link #checkPermission} 436 * if the permission has not been granted to the given package. 437 */ 438 public static final int PERMISSION_DENIED = -1; 439 440 /** 441 * Signature check result: this is returned by {@link #checkSignatures} 442 * if all signatures on the two packages match. 443 */ 444 public static final int SIGNATURE_MATCH = 0; 445 446 /** 447 * Signature check result: this is returned by {@link #checkSignatures} 448 * if neither of the two packages is signed. 449 */ 450 public static final int SIGNATURE_NEITHER_SIGNED = 1; 451 452 /** 453 * Signature check result: this is returned by {@link #checkSignatures} 454 * if the first package is not signed but the second is. 455 */ 456 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; 457 458 /** 459 * Signature check result: this is returned by {@link #checkSignatures} 460 * if the second package is not signed but the first is. 461 */ 462 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; 463 464 /** 465 * Signature check result: this is returned by {@link #checkSignatures} 466 * if not all signatures on both packages match. 467 */ 468 public static final int SIGNATURE_NO_MATCH = -3; 469 470 /** 471 * Signature check result: this is returned by {@link #checkSignatures} 472 * if either of the packages are not valid. 473 */ 474 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; 475 476 /** 477 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 478 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 479 * component or application is in its default enabled state (as specified 480 * in its manifest). 481 */ 482 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; 483 484 /** 485 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 486 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 487 * component or application has been explictily enabled, regardless of 488 * what it has specified in its manifest. 489 */ 490 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; 491 492 /** 493 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} 494 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This 495 * component or application has been explicitly disabled, regardless of 496 * what it has specified in its manifest. 497 */ 498 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; 499 500 /** 501 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The 502 * user has explicitly disabled the application, regardless of what it has 503 * specified in its manifest. Because this is due to the user's request, 504 * they may re-enable it if desired through the appropriate system UI. This 505 * option currently <strong>cannot</strong> be used with 506 * {@link #setComponentEnabledSetting(ComponentName, int, int)}. 507 */ 508 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; 509 510 /** 511 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This 512 * application should be considered, until the point where the user actually 513 * wants to use it. This means that it will not normally show up to the user 514 * (such as in the launcher), but various parts of the user interface can 515 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow 516 * the user to select it (as for example an IME, device admin, etc). Such code, 517 * once the user has selected the app, should at that point also make it enabled. 518 * This option currently <strong>can not</strong> be used with 519 * {@link #setComponentEnabledSetting(ComponentName, int, int)}. 520 */ 521 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; 522 523 /** 524 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to 525 * indicate that this package should be installed as forward locked, i.e. only the app itself 526 * should have access to its code and non-resource assets. 527 * @hide 528 */ 529 public static final int INSTALL_FORWARD_LOCK = 0x00000001; 530 531 /** 532 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already 533 * installed package, if one exists. 534 * @hide 535 */ 536 public static final int INSTALL_REPLACE_EXISTING = 0x00000002; 537 538 /** 539 * Flag parameter for {@link #installPackage} to indicate that you want to 540 * allow test packages (those that have set android:testOnly in their 541 * manifest) to be installed. 542 * @hide 543 */ 544 public static final int INSTALL_ALLOW_TEST = 0x00000004; 545 546 /** 547 * Flag parameter for {@link #installPackage} to indicate that this package 548 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. 549 * 550 * @hide 551 */ 552 public static final int INSTALL_EXTERNAL = 0x00000008; 553 554 /** 555 * Flag parameter for {@link #installPackage} to indicate that this package 556 * must be installed to internal storage. 557 * 558 * @hide 559 */ 560 public static final int INSTALL_INTERNAL = 0x00000010; 561 562 /** 563 * Flag parameter for {@link #installPackage} to indicate that this install 564 * was initiated via ADB. 565 * 566 * @hide 567 */ 568 public static final int INSTALL_FROM_ADB = 0x00000020; 569 570 /** 571 * Flag parameter for {@link #installPackage} to indicate that this install 572 * should immediately be visible to all users. 573 * 574 * @hide 575 */ 576 public static final int INSTALL_ALL_USERS = 0x00000040; 577 578 /** 579 * Flag parameter for {@link #installPackage} to indicate that it is okay 580 * to install an update to an app where the newly installed app has a lower 581 * version code than the currently installed app. 582 * 583 * @hide 584 */ 585 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; 586 587 /** 588 * Flag parameter for {@link #installPackage} to indicate that all runtime 589 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} 590 * is set the runtime permissions will be granted to all users, otherwise 591 * only to the owner. 592 * 593 * @hide 594 */ 595 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; 596 597 /** {@hide} */ 598 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200; 599 600 /** 601 * Flag parameter for {@link #installPackage} to indicate that we always want to force 602 * the prompt for permission approval. This overrides any special behaviour for internal 603 * components. 604 * 605 * @hide 606 */ 607 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400; 608 609 /** 610 * Flag parameter for {@link #installPackage} to indicate that this package is 611 * to be installed as a lightweight "ephemeral" app. 612 * 613 * @hide 614 */ 615 public static final int INSTALL_EPHEMERAL = 0x00000800; 616 617 /** 618 * Flag parameter for 619 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate 620 * that you don't want to kill the app containing the component. Be careful when you set this 621 * since changing component states can make the containing application's behavior unpredictable. 622 */ 623 public static final int DONT_KILL_APP = 0x00000001; 624 625 /** 626 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 627 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. 628 * @hide 629 */ 630 @SystemApi 631 public static final int INSTALL_SUCCEEDED = 1; 632 633 /** 634 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 635 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is 636 * already installed. 637 * @hide 638 */ 639 @SystemApi 640 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; 641 642 /** 643 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 644 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive 645 * file is invalid. 646 * @hide 647 */ 648 @SystemApi 649 public static final int INSTALL_FAILED_INVALID_APK = -2; 650 651 /** 652 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 653 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in 654 * is invalid. 655 * @hide 656 */ 657 @SystemApi 658 public static final int INSTALL_FAILED_INVALID_URI = -3; 659 660 /** 661 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 662 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager 663 * service found that the device didn't have enough storage space to install the app. 664 * @hide 665 */ 666 @SystemApi 667 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; 668 669 /** 670 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 671 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a 672 * package is already installed with the same name. 673 * @hide 674 */ 675 @SystemApi 676 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; 677 678 /** 679 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 680 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 681 * the requested shared user does not exist. 682 * @hide 683 */ 684 @SystemApi 685 public static final int INSTALL_FAILED_NO_SHARED_USER = -6; 686 687 /** 688 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 689 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 690 * a previously installed package of the same name has a different signature 691 * than the new package (and the old package's data was not removed). 692 * @hide 693 */ 694 @SystemApi 695 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; 696 697 /** 698 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 699 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 700 * the new package is requested a shared user which is already installed on the 701 * device and does not have matching signature. 702 * @hide 703 */ 704 @SystemApi 705 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; 706 707 /** 708 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 709 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 710 * the new package uses a shared library that is not available. 711 * @hide 712 */ 713 @SystemApi 714 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; 715 716 /** 717 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 718 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 719 * the new package uses a shared library that is not available. 720 * @hide 721 */ 722 @SystemApi 723 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; 724 725 /** 726 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 727 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 728 * the new package failed while optimizing and validating its dex files, 729 * either because there was not enough storage or the validation failed. 730 * @hide 731 */ 732 @SystemApi 733 public static final int INSTALL_FAILED_DEXOPT = -11; 734 735 /** 736 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 737 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 738 * the new package failed because the current SDK version is older than 739 * that required by the package. 740 * @hide 741 */ 742 @SystemApi 743 public static final int INSTALL_FAILED_OLDER_SDK = -12; 744 745 /** 746 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 747 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 748 * the new package failed because it contains a content provider with the 749 * same authority as a provider already installed in the system. 750 * @hide 751 */ 752 @SystemApi 753 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; 754 755 /** 756 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 757 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 758 * the new package failed because the current SDK version is newer than 759 * that required by the package. 760 * @hide 761 */ 762 @SystemApi 763 public static final int INSTALL_FAILED_NEWER_SDK = -14; 764 765 /** 766 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 767 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 768 * the new package failed because it has specified that it is a test-only 769 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} 770 * flag. 771 * @hide 772 */ 773 @SystemApi 774 public static final int INSTALL_FAILED_TEST_ONLY = -15; 775 776 /** 777 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 778 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 779 * the package being installed contains native code, but none that is 780 * compatible with the device's CPU_ABI. 781 * @hide 782 */ 783 @SystemApi 784 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; 785 786 /** 787 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 788 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 789 * the new package uses a feature that is not available. 790 * @hide 791 */ 792 @SystemApi 793 public static final int INSTALL_FAILED_MISSING_FEATURE = -17; 794 795 // ------ Errors related to sdcard 796 /** 797 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 798 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 799 * a secure container mount point couldn't be accessed on external media. 800 * @hide 801 */ 802 @SystemApi 803 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; 804 805 /** 806 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 807 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 808 * the new package couldn't be installed in the specified install 809 * location. 810 * @hide 811 */ 812 @SystemApi 813 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; 814 815 /** 816 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 817 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 818 * the new package couldn't be installed in the specified install 819 * location because the media is not available. 820 * @hide 821 */ 822 @SystemApi 823 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; 824 825 /** 826 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 827 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 828 * the new package couldn't be installed because the verification timed out. 829 * @hide 830 */ 831 @SystemApi 832 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; 833 834 /** 835 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 836 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 837 * the new package couldn't be installed because the verification did not succeed. 838 * @hide 839 */ 840 @SystemApi 841 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; 842 843 /** 844 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 845 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 846 * the package changed from what the calling program expected. 847 * @hide 848 */ 849 @SystemApi 850 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; 851 852 /** 853 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 854 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 855 * the new package is assigned a different UID than it previously held. 856 * @hide 857 */ 858 public static final int INSTALL_FAILED_UID_CHANGED = -24; 859 860 /** 861 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 862 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 863 * the new package has an older version code than the currently installed package. 864 * @hide 865 */ 866 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; 867 868 /** 869 * Installation return code: this is passed to the {@link IPackageInstallObserver} by 870 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if 871 * the old package has target SDK high enough to support runtime permission and 872 * the new package has target SDK low enough to not support runtime permissions. 873 * @hide 874 */ 875 @SystemApi 876 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; 877 878 /** 879 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 880 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 881 * if the parser was given a path that is not a file, or does not end with the expected 882 * '.apk' extension. 883 * @hide 884 */ 885 @SystemApi 886 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; 887 888 /** 889 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 890 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 891 * if the parser was unable to retrieve the AndroidManifest.xml file. 892 * @hide 893 */ 894 @SystemApi 895 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; 896 897 /** 898 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 899 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 900 * if the parser encountered an unexpected exception. 901 * @hide 902 */ 903 @SystemApi 904 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; 905 906 /** 907 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 908 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 909 * if the parser did not find any certificates in the .apk. 910 * @hide 911 */ 912 @SystemApi 913 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; 914 915 /** 916 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 917 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 918 * if the parser found inconsistent certificates on the files in the .apk. 919 * @hide 920 */ 921 @SystemApi 922 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; 923 924 /** 925 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 926 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 927 * if the parser encountered a CertificateEncodingException in one of the 928 * files in the .apk. 929 * @hide 930 */ 931 @SystemApi 932 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; 933 934 /** 935 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 936 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 937 * if the parser encountered a bad or missing package name in the manifest. 938 * @hide 939 */ 940 @SystemApi 941 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; 942 943 /** 944 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 945 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 946 * if the parser encountered a bad shared user id name in the manifest. 947 * @hide 948 */ 949 @SystemApi 950 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; 951 952 /** 953 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 954 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 955 * if the parser encountered some structural problem in the manifest. 956 * @hide 957 */ 958 @SystemApi 959 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; 960 961 /** 962 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by 963 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 964 * if the parser did not find any actionable tags (instrumentation or application) 965 * in the manifest. 966 * @hide 967 */ 968 @SystemApi 969 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; 970 971 /** 972 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 973 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 974 * if the system failed to install the package because of system issues. 975 * @hide 976 */ 977 @SystemApi 978 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; 979 980 /** 981 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 982 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 983 * if the system failed to install the package because the user is restricted from installing 984 * apps. 985 * @hide 986 */ 987 public static final int INSTALL_FAILED_USER_RESTRICTED = -111; 988 989 /** 990 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 991 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 992 * if the system failed to install the package because it is attempting to define a 993 * permission that is already defined by some existing package. 994 * 995 * <p>The package name of the app which has already defined the permission is passed to 996 * a {@link PackageInstallObserver}, if any, as the {@link #EXTRA_EXISTING_PACKAGE} 997 * string extra; and the name of the permission being redefined is passed in the 998 * {@link #EXTRA_EXISTING_PERMISSION} string extra. 999 * @hide 1000 */ 1001 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; 1002 1003 /** 1004 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by 1005 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} 1006 * if the system failed to install the package because its packaged native code did not 1007 * match any of the ABIs supported by the system. 1008 * 1009 * @hide 1010 */ 1011 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; 1012 1013 /** 1014 * Internal return code for NativeLibraryHelper methods to indicate that the package 1015 * being processed did not contain any native code. This is placed here only so that 1016 * it can belong to the same value space as the other install failure codes. 1017 * 1018 * @hide 1019 */ 1020 public static final int NO_NATIVE_LIBRARIES = -114; 1021 1022 /** {@hide} */ 1023 public static final int INSTALL_FAILED_ABORTED = -115; 1024 1025 /** 1026 * Installation failed return code: ephemeral app installs are incompatible with some 1027 * other installation flags supplied for the operation; or other circumstances such 1028 * as trying to upgrade a system app via an ephemeral install. 1029 * @hide 1030 */ 1031 public static final int INSTALL_FAILED_EPHEMERAL_INVALID = -116; 1032 1033 /** 1034 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the 1035 * package's data directory. 1036 * 1037 * @hide 1038 */ 1039 public static final int DELETE_KEEP_DATA = 0x00000001; 1040 1041 /** 1042 * Flag parameter for {@link #deletePackage} to indicate that you want the 1043 * package deleted for all users. 1044 * 1045 * @hide 1046 */ 1047 public static final int DELETE_ALL_USERS = 0x00000002; 1048 1049 /** 1050 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling 1051 * uninstall on a system that has been updated, then don't do the normal process 1052 * of uninstalling the update and rolling back to the older system version (which 1053 * needs to happen for all users); instead, just mark the app as uninstalled for 1054 * the current user. 1055 * 1056 * @hide 1057 */ 1058 public static final int DELETE_SYSTEM_APP = 0x00000004; 1059 1060 /** 1061 * Return code for when package deletion succeeds. This is passed to the 1062 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 1063 * succeeded in deleting the package. 1064 * 1065 * @hide 1066 */ 1067 public static final int DELETE_SUCCEEDED = 1; 1068 1069 /** 1070 * Deletion failed return code: this is passed to the 1071 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 1072 * failed to delete the package for an unspecified reason. 1073 * 1074 * @hide 1075 */ 1076 public static final int DELETE_FAILED_INTERNAL_ERROR = -1; 1077 1078 /** 1079 * Deletion failed return code: this is passed to the 1080 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 1081 * failed to delete the package because it is the active DevicePolicy 1082 * manager. 1083 * 1084 * @hide 1085 */ 1086 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; 1087 1088 /** 1089 * Deletion failed return code: this is passed to the 1090 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 1091 * failed to delete the package since the user is restricted. 1092 * 1093 * @hide 1094 */ 1095 public static final int DELETE_FAILED_USER_RESTRICTED = -3; 1096 1097 /** 1098 * Deletion failed return code: this is passed to the 1099 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system 1100 * failed to delete the package because a profile 1101 * or device owner has marked the package as uninstallable. 1102 * 1103 * @hide 1104 */ 1105 public static final int DELETE_FAILED_OWNER_BLOCKED = -4; 1106 1107 /** {@hide} */ 1108 public static final int DELETE_FAILED_ABORTED = -5; 1109 1110 /** 1111 * Return code that is passed to the {@link IPackageMoveObserver} by 1112 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the 1113 * package has been successfully moved by the system. 1114 * 1115 * @hide 1116 */ 1117 public static final int MOVE_SUCCEEDED = -100; 1118 1119 /** 1120 * Error code that is passed to the {@link IPackageMoveObserver} by 1121 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1122 * when the package hasn't been successfully moved by the system 1123 * because of insufficient memory on specified media. 1124 * @hide 1125 */ 1126 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; 1127 1128 /** 1129 * Error code that is passed to the {@link IPackageMoveObserver} by 1130 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1131 * if the specified package doesn't exist. 1132 * @hide 1133 */ 1134 public static final int MOVE_FAILED_DOESNT_EXIST = -2; 1135 1136 /** 1137 * Error code that is passed to the {@link IPackageMoveObserver} by 1138 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1139 * if the specified package cannot be moved since its a system package. 1140 * @hide 1141 */ 1142 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; 1143 1144 /** 1145 * Error code that is passed to the {@link IPackageMoveObserver} by 1146 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1147 * if the specified package cannot be moved since its forward locked. 1148 * @hide 1149 */ 1150 public static final int MOVE_FAILED_FORWARD_LOCKED = -4; 1151 1152 /** 1153 * Error code that is passed to the {@link IPackageMoveObserver} by 1154 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1155 * if the specified package cannot be moved to the specified location. 1156 * @hide 1157 */ 1158 public static final int MOVE_FAILED_INVALID_LOCATION = -5; 1159 1160 /** 1161 * Error code that is passed to the {@link IPackageMoveObserver} by 1162 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} 1163 * if the specified package cannot be moved to the specified location. 1164 * @hide 1165 */ 1166 public static final int MOVE_FAILED_INTERNAL_ERROR = -6; 1167 1168 /** 1169 * Error code that is passed to the {@link IPackageMoveObserver} by 1170 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the 1171 * specified package already has an operation pending in the 1172 * {@link PackageHandler} queue. 1173 * 1174 * @hide 1175 */ 1176 public static final int MOVE_FAILED_OPERATION_PENDING = -7; 1177 1178 /** 1179 * Flag parameter for {@link #movePackage} to indicate that 1180 * the package should be moved to internal storage if its 1181 * been installed on external media. 1182 * @hide 1183 */ 1184 @Deprecated 1185 public static final int MOVE_INTERNAL = 0x00000001; 1186 1187 /** 1188 * Flag parameter for {@link #movePackage} to indicate that 1189 * the package should be moved to external media. 1190 * @hide 1191 */ 1192 @Deprecated 1193 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; 1194 1195 /** {@hide} */ 1196 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID"; 1197 1198 /** 1199 * Usable by the required verifier as the {@code verificationCode} argument 1200 * for {@link PackageManager#verifyPendingInstall} to indicate that it will 1201 * allow the installation to proceed without any of the optional verifiers 1202 * needing to vote. 1203 * 1204 * @hide 1205 */ 1206 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; 1207 1208 /** 1209 * Used as the {@code verificationCode} argument for 1210 * {@link PackageManager#verifyPendingInstall} to indicate that the calling 1211 * package verifier allows the installation to proceed. 1212 */ 1213 public static final int VERIFICATION_ALLOW = 1; 1214 1215 /** 1216 * Used as the {@code verificationCode} argument for 1217 * {@link PackageManager#verifyPendingInstall} to indicate the calling 1218 * package verifier does not vote to allow the installation to proceed. 1219 */ 1220 public static final int VERIFICATION_REJECT = -1; 1221 1222 /** 1223 * Used as the {@code verificationCode} argument for 1224 * {@link PackageManager#verifyIntentFilter} to indicate that the calling 1225 * IntentFilter Verifier confirms that the IntentFilter is verified. 1226 * 1227 * @hide 1228 */ 1229 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; 1230 1231 /** 1232 * Used as the {@code verificationCode} argument for 1233 * {@link PackageManager#verifyIntentFilter} to indicate that the calling 1234 * IntentFilter Verifier confirms that the IntentFilter is NOT verified. 1235 * 1236 * @hide 1237 */ 1238 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; 1239 1240 /** 1241 * Internal status code to indicate that an IntentFilter verification result is not specified. 1242 * 1243 * @hide 1244 */ 1245 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; 1246 1247 /** 1248 * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} 1249 * to indicate that the User will always be prompted the Intent Disambiguation Dialog if there 1250 * are two or more Intent resolved for the IntentFilter's domain(s). 1251 * 1252 * @hide 1253 */ 1254 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; 1255 1256 /** 1257 * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} 1258 * to indicate that the User will never be prompted the Intent Disambiguation Dialog if there 1259 * are two or more resolution of the Intent. The default App for the domain(s) specified in the 1260 * IntentFilter will also ALWAYS be used. 1261 * 1262 * @hide 1263 */ 1264 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; 1265 1266 /** 1267 * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} 1268 * to indicate that the User may be prompted the Intent Disambiguation Dialog if there 1269 * are two or more Intent resolved. The default App for the domain(s) specified in the 1270 * IntentFilter will also NEVER be presented to the User. 1271 * 1272 * @hide 1273 */ 1274 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; 1275 1276 /** 1277 * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} 1278 * to indicate that this app should always be considered as an ambiguous candidate for 1279 * handling the matching Intent even if there are other candidate apps in the "always" 1280 * state. Put another way: if there are any 'always ask' apps in a set of more than 1281 * one candidate app, then a disambiguation is *always* presented even if there is 1282 * another candidate app with the 'always' state. 1283 * 1284 * @hide 1285 */ 1286 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; 1287 1288 /** 1289 * Can be used as the {@code millisecondsToDelay} argument for 1290 * {@link PackageManager#extendVerificationTimeout}. This is the 1291 * maximum time {@code PackageManager} waits for the verification 1292 * agent to return (in milliseconds). 1293 */ 1294 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; 1295 1296 /** 1297 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's 1298 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or 1299 * lag in sound input or output. 1300 */ 1301 @SdkConstant(SdkConstantType.FEATURE) 1302 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; 1303 1304 /** 1305 * Feature for {@link #getSystemAvailableFeatures} and 1306 * {@link #hasSystemFeature}: The device includes at least one form of audio 1307 * output, such as speakers, audio jack or streaming over bluetooth 1308 */ 1309 @SdkConstant(SdkConstantType.FEATURE) 1310 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; 1311 1312 /** 1313 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1314 * The device has professional audio level of functionality and performance. 1315 */ 1316 @SdkConstant(SdkConstantType.FEATURE) 1317 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; 1318 1319 /** 1320 * Feature for {@link #getSystemAvailableFeatures} and 1321 * {@link #hasSystemFeature}: The device is capable of communicating with 1322 * other devices via Bluetooth. 1323 */ 1324 @SdkConstant(SdkConstantType.FEATURE) 1325 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; 1326 1327 /** 1328 * Feature for {@link #getSystemAvailableFeatures} and 1329 * {@link #hasSystemFeature}: The device is capable of communicating with 1330 * other devices via Bluetooth Low Energy radio. 1331 */ 1332 @SdkConstant(SdkConstantType.FEATURE) 1333 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; 1334 1335 /** 1336 * Feature for {@link #getSystemAvailableFeatures} and 1337 * {@link #hasSystemFeature}: The device has a camera facing away 1338 * from the screen. 1339 */ 1340 @SdkConstant(SdkConstantType.FEATURE) 1341 public static final String FEATURE_CAMERA = "android.hardware.camera"; 1342 1343 /** 1344 * Feature for {@link #getSystemAvailableFeatures} and 1345 * {@link #hasSystemFeature}: The device's camera supports auto-focus. 1346 */ 1347 @SdkConstant(SdkConstantType.FEATURE) 1348 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; 1349 1350 /** 1351 * Feature for {@link #getSystemAvailableFeatures} and 1352 * {@link #hasSystemFeature}: The device has at least one camera pointing in 1353 * some direction, or can support an external camera being connected to it. 1354 */ 1355 @SdkConstant(SdkConstantType.FEATURE) 1356 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; 1357 1358 /** 1359 * Feature for {@link #getSystemAvailableFeatures} and 1360 * {@link #hasSystemFeature}: The device can support having an external camera connected to it. 1361 * The external camera may not always be connected or available to applications to use. 1362 */ 1363 @SdkConstant(SdkConstantType.FEATURE) 1364 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; 1365 1366 /** 1367 * Feature for {@link #getSystemAvailableFeatures} and 1368 * {@link #hasSystemFeature}: The device's camera supports flash. 1369 */ 1370 @SdkConstant(SdkConstantType.FEATURE) 1371 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; 1372 1373 /** 1374 * Feature for {@link #getSystemAvailableFeatures} and 1375 * {@link #hasSystemFeature}: The device has a front facing camera. 1376 */ 1377 @SdkConstant(SdkConstantType.FEATURE) 1378 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; 1379 1380 /** 1381 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one 1382 * of the cameras on the device supports the 1383 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} 1384 * capability level. 1385 */ 1386 @SdkConstant(SdkConstantType.FEATURE) 1387 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; 1388 1389 /** 1390 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one 1391 * of the cameras on the device supports the 1392 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} 1393 * capability level. 1394 */ 1395 @SdkConstant(SdkConstantType.FEATURE) 1396 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = 1397 "android.hardware.camera.capability.manual_sensor"; 1398 1399 /** 1400 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one 1401 * of the cameras on the device supports the 1402 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} 1403 * capability level. 1404 */ 1405 @SdkConstant(SdkConstantType.FEATURE) 1406 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = 1407 "android.hardware.camera.capability.manual_post_processing"; 1408 1409 /** 1410 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one 1411 * of the cameras on the device supports the 1412 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} 1413 * capability level. 1414 */ 1415 @SdkConstant(SdkConstantType.FEATURE) 1416 public static final String FEATURE_CAMERA_CAPABILITY_RAW = 1417 "android.hardware.camera.capability.raw"; 1418 1419 /** 1420 * Feature for {@link #getSystemAvailableFeatures} and 1421 * {@link #hasSystemFeature}: The device is capable of communicating with 1422 * consumer IR devices. 1423 */ 1424 @SdkConstant(SdkConstantType.FEATURE) 1425 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; 1426 1427 /** 1428 * Feature for {@link #getSystemAvailableFeatures} and 1429 * {@link #hasSystemFeature}: The device supports one or more methods of 1430 * reporting current location. 1431 */ 1432 @SdkConstant(SdkConstantType.FEATURE) 1433 public static final String FEATURE_LOCATION = "android.hardware.location"; 1434 1435 /** 1436 * Feature for {@link #getSystemAvailableFeatures} and 1437 * {@link #hasSystemFeature}: The device has a Global Positioning System 1438 * receiver and can report precise location. 1439 */ 1440 @SdkConstant(SdkConstantType.FEATURE) 1441 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; 1442 1443 /** 1444 * Feature for {@link #getSystemAvailableFeatures} and 1445 * {@link #hasSystemFeature}: The device can report location with coarse 1446 * accuracy using a network-based geolocation system. 1447 */ 1448 @SdkConstant(SdkConstantType.FEATURE) 1449 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; 1450 1451 /** 1452 * Feature for {@link #getSystemAvailableFeatures} and 1453 * {@link #hasSystemFeature}: The device can record audio via a 1454 * microphone. 1455 */ 1456 @SdkConstant(SdkConstantType.FEATURE) 1457 public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; 1458 1459 /** 1460 * Feature for {@link #getSystemAvailableFeatures} and 1461 * {@link #hasSystemFeature}: The device can communicate using Near-Field 1462 * Communications (NFC). 1463 */ 1464 @SdkConstant(SdkConstantType.FEATURE) 1465 public static final String FEATURE_NFC = "android.hardware.nfc"; 1466 1467 /** 1468 * Feature for {@link #getSystemAvailableFeatures} and 1469 * {@link #hasSystemFeature}: The device supports host- 1470 * based NFC card emulation. 1471 * 1472 * TODO remove when depending apps have moved to new constant. 1473 * @hide 1474 * @deprecated 1475 */ 1476 @Deprecated 1477 @SdkConstant(SdkConstantType.FEATURE) 1478 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; 1479 1480 /** 1481 * Feature for {@link #getSystemAvailableFeatures} and 1482 * {@link #hasSystemFeature}: The device supports host- 1483 * based NFC card emulation. 1484 */ 1485 @SdkConstant(SdkConstantType.FEATURE) 1486 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; 1487 1488 /** 1489 * Feature for {@link #getSystemAvailableFeatures} and 1490 * {@link #hasSystemFeature}: The device supports the OpenGL ES 1491 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> 1492 * Android Extension Pack</a>. 1493 */ 1494 @SdkConstant(SdkConstantType.FEATURE) 1495 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; 1496 1497 /** 1498 * Feature for {@link #getSystemAvailableFeatures} and 1499 * {@link #hasSystemFeature}: The device includes an accelerometer. 1500 */ 1501 @SdkConstant(SdkConstantType.FEATURE) 1502 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; 1503 1504 /** 1505 * Feature for {@link #getSystemAvailableFeatures} and 1506 * {@link #hasSystemFeature}: The device includes a barometer (air 1507 * pressure sensor.) 1508 */ 1509 @SdkConstant(SdkConstantType.FEATURE) 1510 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; 1511 1512 /** 1513 * Feature for {@link #getSystemAvailableFeatures} and 1514 * {@link #hasSystemFeature}: The device includes a magnetometer (compass). 1515 */ 1516 @SdkConstant(SdkConstantType.FEATURE) 1517 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; 1518 1519 /** 1520 * Feature for {@link #getSystemAvailableFeatures} and 1521 * {@link #hasSystemFeature}: The device includes a gyroscope. 1522 */ 1523 @SdkConstant(SdkConstantType.FEATURE) 1524 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; 1525 1526 /** 1527 * Feature for {@link #getSystemAvailableFeatures} and 1528 * {@link #hasSystemFeature}: The device includes a light sensor. 1529 */ 1530 @SdkConstant(SdkConstantType.FEATURE) 1531 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; 1532 1533 /** 1534 * Feature for {@link #getSystemAvailableFeatures} and 1535 * {@link #hasSystemFeature}: The device includes a proximity sensor. 1536 */ 1537 @SdkConstant(SdkConstantType.FEATURE) 1538 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; 1539 1540 /** 1541 * Feature for {@link #getSystemAvailableFeatures} and 1542 * {@link #hasSystemFeature}: The device includes a hardware step counter. 1543 */ 1544 @SdkConstant(SdkConstantType.FEATURE) 1545 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; 1546 1547 /** 1548 * Feature for {@link #getSystemAvailableFeatures} and 1549 * {@link #hasSystemFeature}: The device includes a hardware step detector. 1550 */ 1551 @SdkConstant(SdkConstantType.FEATURE) 1552 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; 1553 1554 /** 1555 * Feature for {@link #getSystemAvailableFeatures} and 1556 * {@link #hasSystemFeature}: The device includes a heart rate monitor. 1557 */ 1558 @SdkConstant(SdkConstantType.FEATURE) 1559 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; 1560 1561 /** 1562 * Feature for {@link #getSystemAvailableFeatures} and 1563 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram. 1564 */ 1565 @SdkConstant(SdkConstantType.FEATURE) 1566 public static final String FEATURE_SENSOR_HEART_RATE_ECG = 1567 "android.hardware.sensor.heartrate.ecg"; 1568 1569 /** 1570 * Feature for {@link #getSystemAvailableFeatures} and 1571 * {@link #hasSystemFeature}: The device includes a relative humidity sensor. 1572 */ 1573 @SdkConstant(SdkConstantType.FEATURE) 1574 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = 1575 "android.hardware.sensor.relative_humidity"; 1576 1577 /** 1578 * Feature for {@link #getSystemAvailableFeatures} and 1579 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. 1580 */ 1581 @SdkConstant(SdkConstantType.FEATURE) 1582 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = 1583 "android.hardware.sensor.ambient_temperature"; 1584 1585 /** 1586 * Feature for {@link #getSystemAvailableFeatures} and 1587 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing 1588 * capabilities. 1589 */ 1590 @SdkConstant(SdkConstantType.FEATURE) 1591 public static final String FEATURE_HIFI_SENSORS = 1592 "android.hardware.sensor.hifi_sensors"; 1593 1594 /** 1595 * Feature for {@link #getSystemAvailableFeatures} and 1596 * {@link #hasSystemFeature}: The device has a telephony radio with data 1597 * communication support. 1598 */ 1599 @SdkConstant(SdkConstantType.FEATURE) 1600 public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; 1601 1602 /** 1603 * Feature for {@link #getSystemAvailableFeatures} and 1604 * {@link #hasSystemFeature}: The device has a CDMA telephony stack. 1605 */ 1606 @SdkConstant(SdkConstantType.FEATURE) 1607 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; 1608 1609 /** 1610 * Feature for {@link #getSystemAvailableFeatures} and 1611 * {@link #hasSystemFeature}: The device has a GSM telephony stack. 1612 */ 1613 @SdkConstant(SdkConstantType.FEATURE) 1614 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; 1615 1616 /** 1617 * Feature for {@link #getSystemAvailableFeatures} and 1618 * {@link #hasSystemFeature}: The device supports connecting to USB devices 1619 * as the USB host. 1620 */ 1621 @SdkConstant(SdkConstantType.FEATURE) 1622 public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; 1623 1624 /** 1625 * Feature for {@link #getSystemAvailableFeatures} and 1626 * {@link #hasSystemFeature}: The device supports connecting to USB accessories. 1627 */ 1628 @SdkConstant(SdkConstantType.FEATURE) 1629 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; 1630 1631 /** 1632 * Feature for {@link #getSystemAvailableFeatures} and 1633 * {@link #hasSystemFeature}: The SIP API is enabled on the device. 1634 */ 1635 @SdkConstant(SdkConstantType.FEATURE) 1636 public static final String FEATURE_SIP = "android.software.sip"; 1637 1638 /** 1639 * Feature for {@link #getSystemAvailableFeatures} and 1640 * {@link #hasSystemFeature}: The device supports SIP-based VOIP. 1641 */ 1642 @SdkConstant(SdkConstantType.FEATURE) 1643 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; 1644 1645 /** 1646 * Feature for {@link #getSystemAvailableFeatures} and 1647 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. 1648 */ 1649 @SdkConstant(SdkConstantType.FEATURE) 1650 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; 1651 1652 /** 1653 * Feature for {@link #getSystemAvailableFeatures} and 1654 * {@link #hasSystemFeature}: The device's display has a touch screen. 1655 */ 1656 @SdkConstant(SdkConstantType.FEATURE) 1657 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; 1658 1659 /** 1660 * Feature for {@link #getSystemAvailableFeatures} and 1661 * {@link #hasSystemFeature}: The device's touch screen supports 1662 * multitouch sufficient for basic two-finger gesture detection. 1663 */ 1664 @SdkConstant(SdkConstantType.FEATURE) 1665 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; 1666 1667 /** 1668 * Feature for {@link #getSystemAvailableFeatures} and 1669 * {@link #hasSystemFeature}: The device's touch screen is capable of 1670 * tracking two or more fingers fully independently. 1671 */ 1672 @SdkConstant(SdkConstantType.FEATURE) 1673 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; 1674 1675 /** 1676 * Feature for {@link #getSystemAvailableFeatures} and 1677 * {@link #hasSystemFeature}: The device's touch screen is capable of 1678 * tracking a full hand of fingers fully independently -- that is, 5 or 1679 * more simultaneous independent pointers. 1680 */ 1681 @SdkConstant(SdkConstantType.FEATURE) 1682 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; 1683 1684 /** 1685 * Feature for {@link #getSystemAvailableFeatures} and 1686 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1687 * does support touch emulation for basic events. For instance, the 1688 * device might use a mouse or remote control to drive a cursor, and 1689 * emulate basic touch pointer events like down, up, drag, etc. All 1690 * devices that support android.hardware.touchscreen or a sub-feature are 1691 * presumed to also support faketouch. 1692 */ 1693 @SdkConstant(SdkConstantType.FEATURE) 1694 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; 1695 1696 /** 1697 * Feature for {@link #getSystemAvailableFeatures} and 1698 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1699 * does support touch emulation for basic events that supports distinct 1700 * tracking of two or more fingers. This is an extension of 1701 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note 1702 * that unlike a distinct multitouch screen as defined by 1703 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input 1704 * devices will not actually provide full two-finger gestures since the 1705 * input is being transformed to cursor movement on the screen. That is, 1706 * single finger gestures will move a cursor; two-finger swipes will 1707 * result in single-finger touch events; other two-finger gestures will 1708 * result in the corresponding two-finger touch event. 1709 */ 1710 @SdkConstant(SdkConstantType.FEATURE) 1711 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; 1712 1713 /** 1714 * Feature for {@link #getSystemAvailableFeatures} and 1715 * {@link #hasSystemFeature}: The device does not have a touch screen, but 1716 * does support touch emulation for basic events that supports tracking 1717 * a hand of fingers (5 or more fingers) fully independently. 1718 * This is an extension of 1719 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note 1720 * that unlike a multitouch screen as defined by 1721 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger 1722 * gestures can be detected due to the limitations described for 1723 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. 1724 */ 1725 @SdkConstant(SdkConstantType.FEATURE) 1726 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; 1727 1728 /** 1729 * Feature for {@link #getSystemAvailableFeatures} and 1730 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint. 1731 */ 1732 @SdkConstant(SdkConstantType.FEATURE) 1733 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint"; 1734 1735 /** 1736 * Feature for {@link #getSystemAvailableFeatures} and 1737 * {@link #hasSystemFeature}: The device supports portrait orientation 1738 * screens. For backwards compatibility, you can assume that if neither 1739 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports 1740 * both portrait and landscape. 1741 */ 1742 @SdkConstant(SdkConstantType.FEATURE) 1743 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; 1744 1745 /** 1746 * Feature for {@link #getSystemAvailableFeatures} and 1747 * {@link #hasSystemFeature}: The device supports landscape orientation 1748 * screens. For backwards compatibility, you can assume that if neither 1749 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports 1750 * both portrait and landscape. 1751 */ 1752 @SdkConstant(SdkConstantType.FEATURE) 1753 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; 1754 1755 /** 1756 * Feature for {@link #getSystemAvailableFeatures} and 1757 * {@link #hasSystemFeature}: The device supports live wallpapers. 1758 */ 1759 @SdkConstant(SdkConstantType.FEATURE) 1760 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; 1761 /** 1762 * Feature for {@link #getSystemAvailableFeatures} and 1763 * {@link #hasSystemFeature}: The device supports app widgets. 1764 */ 1765 @SdkConstant(SdkConstantType.FEATURE) 1766 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; 1767 1768 /** 1769 * @hide 1770 * Feature for {@link #getSystemAvailableFeatures} and 1771 * {@link #hasSystemFeature}: The device supports 1772 * {@link android.service.voice.VoiceInteractionService} and 1773 * {@link android.app.VoiceInteractor}. 1774 */ 1775 @SdkConstant(SdkConstantType.FEATURE) 1776 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; 1777 1778 1779 /** 1780 * Feature for {@link #getSystemAvailableFeatures} and 1781 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable 1782 * by third party applications. 1783 */ 1784 @SdkConstant(SdkConstantType.FEATURE) 1785 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; 1786 1787 /** 1788 * Feature for {@link #getSystemAvailableFeatures} and 1789 * {@link #hasSystemFeature}: The device supports adding new input methods implemented 1790 * with the {@link android.inputmethodservice.InputMethodService} API. 1791 */ 1792 @SdkConstant(SdkConstantType.FEATURE) 1793 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; 1794 1795 /** 1796 * Feature for {@link #getSystemAvailableFeatures} and 1797 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. 1798 */ 1799 @SdkConstant(SdkConstantType.FEATURE) 1800 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; 1801 1802 /** 1803 * Feature for {@link #getSystemAvailableFeatures} and 1804 * {@link #hasSystemFeature}: The device supports leanback UI. This is 1805 * typically used in a living room television experience, but is a software 1806 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this 1807 * feature will use resources associated with the "television" UI mode. 1808 */ 1809 @SdkConstant(SdkConstantType.FEATURE) 1810 public static final String FEATURE_LEANBACK = "android.software.leanback"; 1811 1812 /** 1813 * Feature for {@link #getSystemAvailableFeatures} and 1814 * {@link #hasSystemFeature}: The device supports only leanback UI. Only 1815 * applications designed for this experience should be run, though this is 1816 * not enforced by the system. 1817 * @hide 1818 */ 1819 @SdkConstant(SdkConstantType.FEATURE) 1820 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; 1821 1822 /** 1823 * Feature for {@link #getSystemAvailableFeatures} and 1824 * {@link #hasSystemFeature}: The device supports live TV and can display 1825 * contents from TV inputs implemented with the 1826 * {@link android.media.tv.TvInputService} API. 1827 */ 1828 @SdkConstant(SdkConstantType.FEATURE) 1829 public static final String FEATURE_LIVE_TV = "android.software.live_tv"; 1830 1831 /** 1832 * Feature for {@link #getSystemAvailableFeatures} and 1833 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. 1834 */ 1835 @SdkConstant(SdkConstantType.FEATURE) 1836 public static final String FEATURE_WIFI = "android.hardware.wifi"; 1837 1838 /** 1839 * Feature for {@link #getSystemAvailableFeatures} and 1840 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. 1841 */ 1842 @SdkConstant(SdkConstantType.FEATURE) 1843 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; 1844 1845 /** 1846 * Feature for {@link #getSystemAvailableFeatures} and 1847 * {@link #hasSystemFeature}: This is a device dedicated to showing UI 1848 * on a vehicle headunit. A headunit here is defined to be inside a 1849 * vehicle that may or may not be moving. A headunit uses either a 1850 * primary display in the center console and/or additional displays in 1851 * the instrument cluster or elsewhere in the vehicle. Headunit display(s) 1852 * have limited size and resolution. The user will likely be focused on 1853 * driving so limiting driver distraction is a primary concern. User input 1854 * can be a variety of hard buttons, touch, rotary controllers and even mouse- 1855 * like interfaces. 1856 */ 1857 @SdkConstant(SdkConstantType.FEATURE) 1858 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; 1859 1860 /** 1861 * Feature for {@link #getSystemAvailableFeatures} and 1862 * {@link #hasSystemFeature}: This is a device dedicated to showing UI 1863 * on a television. Television here is defined to be a typical living 1864 * room television experience: displayed on a big screen, where the user 1865 * is sitting far away from it, and the dominant form of input will be 1866 * something like a DPAD, not through touch or mouse. 1867 * @deprecated use {@link #FEATURE_LEANBACK} instead. 1868 */ 1869 @Deprecated 1870 @SdkConstant(SdkConstantType.FEATURE) 1871 public static final String FEATURE_TELEVISION = "android.hardware.type.television"; 1872 1873 /** 1874 * Feature for {@link #getSystemAvailableFeatures} and 1875 * {@link #hasSystemFeature}: This is a device dedicated to showing UI 1876 * on a watch. A watch here is defined to be a device worn on the body, perhaps on 1877 * the wrist. The user is very close when interacting with the device. 1878 */ 1879 @SdkConstant(SdkConstantType.FEATURE) 1880 public static final String FEATURE_WATCH = "android.hardware.type.watch"; 1881 1882 /** 1883 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1884 * The device supports printing. 1885 */ 1886 @SdkConstant(SdkConstantType.FEATURE) 1887 public static final String FEATURE_PRINTING = "android.software.print"; 1888 1889 /** 1890 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1891 * The device can perform backup and restore operations on installed applications. 1892 */ 1893 @SdkConstant(SdkConstantType.FEATURE) 1894 public static final String FEATURE_BACKUP = "android.software.backup"; 1895 1896 /** 1897 * Feature for {@link #getSystemAvailableFeatures} and 1898 * {@link #hasSystemFeature}: The device supports freeform window management. 1899 * Windows have title bars and can be moved and resized. 1900 */ 1901 // If this feature is present, you also need to set 1902 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay. 1903 @SdkConstant(SdkConstantType.FEATURE) 1904 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT 1905 = "android.software.freeform_window_management"; 1906 1907 /** 1908 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1909 * The device supports picture-in-picture multi-window mode. 1910 */ 1911 @SdkConstant(SdkConstantType.FEATURE) 1912 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture"; 1913 1914 /** 1915 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1916 * The device supports creating secondary users and managed profiles via 1917 * {@link DevicePolicyManager}. 1918 */ 1919 @SdkConstant(SdkConstantType.FEATURE) 1920 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; 1921 1922 /** 1923 * @hide 1924 * TODO: Remove after dependencies updated b/17392243 1925 */ 1926 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; 1927 1928 /** 1929 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1930 * The device supports verified boot. 1931 */ 1932 @SdkConstant(SdkConstantType.FEATURE) 1933 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; 1934 1935 /** 1936 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1937 * The device supports secure removal of users. When a user is deleted the data associated 1938 * with that user is securely deleted and no longer available. 1939 */ 1940 @SdkConstant(SdkConstantType.FEATURE) 1941 public static final String FEATURE_SECURELY_REMOVES_USERS 1942 = "android.software.securely_removes_users"; 1943 1944 /** 1945 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1946 * The device has a full implementation of the android.webkit.* APIs. Devices 1947 * lacking this feature will not have a functioning WebView implementation. 1948 */ 1949 @SdkConstant(SdkConstantType.FEATURE) 1950 public static final String FEATURE_WEBVIEW = "android.software.webview"; 1951 1952 /** 1953 * Feature for {@link #getSystemAvailableFeatures} and 1954 * {@link #hasSystemFeature}: This device supports ethernet. 1955 */ 1956 @SdkConstant(SdkConstantType.FEATURE) 1957 public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; 1958 1959 /** 1960 * Feature for {@link #getSystemAvailableFeatures} and 1961 * {@link #hasSystemFeature}: This device supports HDMI-CEC. 1962 * @hide 1963 */ 1964 @SdkConstant(SdkConstantType.FEATURE) 1965 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; 1966 1967 /** 1968 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1969 * The device has all of the inputs necessary to be considered a compatible game controller, or 1970 * includes a compatible game controller in the box. 1971 */ 1972 @SdkConstant(SdkConstantType.FEATURE) 1973 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; 1974 1975 /** 1976 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1977 * The device has a full implementation of the android.media.midi.* APIs. 1978 */ 1979 @SdkConstant(SdkConstantType.FEATURE) 1980 public static final String FEATURE_MIDI = "android.software.midi"; 1981 1982 /** 1983 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: 1984 * The device implements a an optimized mode for virtual reality (VR) applications that handles 1985 * stereoscopic rendering of notifications, and may potentially also include optimizations to 1986 * reduce latency in the graphics, display, and sensor stacks. Presence of this feature 1987 * also indicates that the VrCore library is included on this device. 1988 */ 1989 @SdkConstant(SdkConstantType.FEATURE) 1990 public static final String FEATURE_VR_MODE = "android.software.vr.mode"; 1991 1992 /** 1993 * Action to external storage service to clean out removed apps. 1994 * @hide 1995 */ 1996 public static final String ACTION_CLEAN_EXTERNAL_STORAGE 1997 = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; 1998 1999 /** 2000 * Extra field name for the URI to a verification file. Passed to a package 2001 * verifier. 2002 * 2003 * @hide 2004 */ 2005 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; 2006 2007 /** 2008 * Extra field name for the ID of a package pending verification. Passed to 2009 * a package verifier and is used to call back to 2010 * {@link PackageManager#verifyPendingInstall(int, int)} 2011 */ 2012 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; 2013 2014 /** 2015 * Extra field name for the package identifier which is trying to install 2016 * the package. 2017 * 2018 * @hide 2019 */ 2020 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE 2021 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; 2022 2023 /** 2024 * Extra field name for the requested install flags for a package pending 2025 * verification. Passed to a package verifier. 2026 * 2027 * @hide 2028 */ 2029 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS 2030 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; 2031 2032 /** 2033 * Extra field name for the uid of who is requesting to install 2034 * the package. 2035 * 2036 * @hide 2037 */ 2038 public static final String EXTRA_VERIFICATION_INSTALLER_UID 2039 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; 2040 2041 /** 2042 * Extra field name for the package name of a package pending verification. 2043 * 2044 * @hide 2045 */ 2046 public static final String EXTRA_VERIFICATION_PACKAGE_NAME 2047 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; 2048 /** 2049 * Extra field name for the result of a verification, either 2050 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. 2051 * Passed to package verifiers after a package is verified. 2052 */ 2053 public static final String EXTRA_VERIFICATION_RESULT 2054 = "android.content.pm.extra.VERIFICATION_RESULT"; 2055 2056 /** 2057 * Extra field name for the version code of a package pending verification. 2058 * 2059 * @hide 2060 */ 2061 public static final String EXTRA_VERIFICATION_VERSION_CODE 2062 = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; 2063 2064 /** 2065 * Extra field name for the ID of a intent filter pending verification. Passed to 2066 * an intent filter verifier and is used to call back to 2067 * {@link PackageManager#verifyIntentFilter(int, int)} 2068 * 2069 * @hide 2070 */ 2071 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID 2072 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; 2073 2074 /** 2075 * Extra field name for the scheme used for an intent filter pending verification. Passed to 2076 * an intent filter verifier and is used to construct the URI to verify against. 2077 * 2078 * Usually this is "https" 2079 * 2080 * @hide 2081 */ 2082 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME 2083 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; 2084 2085 /** 2086 * Extra field name for the host names to be used for an intent filter pending verification. 2087 * Passed to an intent filter verifier and is used to construct the URI to verify the 2088 * intent filter. 2089 * 2090 * This is a space delimited list of hosts. 2091 * 2092 * @hide 2093 */ 2094 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS 2095 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; 2096 2097 /** 2098 * Extra field name for the package name to be used for an intent filter pending verification. 2099 * Passed to an intent filter verifier and is used to check the verification responses coming 2100 * from the hosts. Each host response will need to include the package name of APK containing 2101 * the intent filter. 2102 * 2103 * @hide 2104 */ 2105 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME 2106 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; 2107 2108 /** 2109 * The action used to request that the user approve a permission request 2110 * from the application. 2111 * 2112 * @hide 2113 */ 2114 @SystemApi 2115 public static final String ACTION_REQUEST_PERMISSIONS = 2116 "android.content.pm.action.REQUEST_PERMISSIONS"; 2117 2118 /** 2119 * The names of the requested permissions. 2120 * <p> 2121 * <strong>Type:</strong> String[] 2122 * </p> 2123 * 2124 * @hide 2125 */ 2126 @SystemApi 2127 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = 2128 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; 2129 2130 /** 2131 * The results from the permissions request. 2132 * <p> 2133 * <strong>Type:</strong> int[] of #PermissionResult 2134 * </p> 2135 * 2136 * @hide 2137 */ 2138 @SystemApi 2139 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS 2140 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; 2141 2142 /** 2143 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of 2144 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides 2145 * the existing definition for the permission. 2146 * @hide 2147 */ 2148 public static final String EXTRA_FAILURE_EXISTING_PACKAGE 2149 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; 2150 2151 /** 2152 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of 2153 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is 2154 * being redundantly defined by the package being installed. 2155 * @hide 2156 */ 2157 public static final String EXTRA_FAILURE_EXISTING_PERMISSION 2158 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; 2159 2160 /** 2161 * Permission flag: The permission is set in its current state 2162 * by the user and apps can still request it at runtime. 2163 * 2164 * @hide 2165 */ 2166 public static final int FLAG_PERMISSION_USER_SET = 1 << 0; 2167 2168 /** 2169 * Permission flag: The permission is set in its current state 2170 * by the user and it is fixed, i.e. apps can no longer request 2171 * this permission. 2172 * 2173 * @hide 2174 */ 2175 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1; 2176 2177 /** 2178 * Permission flag: The permission is set in its current state 2179 * by device policy and neither apps nor the user can change 2180 * its state. 2181 * 2182 * @hide 2183 */ 2184 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2; 2185 2186 /** 2187 * Permission flag: The permission is set in a granted state but 2188 * access to resources it guards is restricted by other means to 2189 * enable revoking a permission on legacy apps that do not support 2190 * runtime permissions. If this permission is upgraded to runtime 2191 * because the app was updated to support runtime permissions, the 2192 * the permission will be revoked in the upgrade process. 2193 * 2194 * @hide 2195 */ 2196 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3; 2197 2198 /** 2199 * Permission flag: The permission is set in its current state 2200 * because the app is a component that is a part of the system. 2201 * 2202 * @hide 2203 */ 2204 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4; 2205 2206 /** 2207 * Permission flag: The permission is granted by default because it 2208 * enables app functionality that is expected to work out-of-the-box 2209 * for providing a smooth user experience. For example, the phone app 2210 * is expected to have the phone permission. 2211 * 2212 * @hide 2213 */ 2214 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5; 2215 2216 /** 2217 * Permission flag: The permission has to be reviewed before any of 2218 * the app components can run. 2219 * 2220 * @hide 2221 */ 2222 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6; 2223 2224 /** 2225 * Mask for all permission flags. 2226 * 2227 * @hide 2228 */ 2229 @SystemApi 2230 public static final int MASK_PERMISSION_FLAGS = 0xFF; 2231 2232 /** 2233 * Retrieve overall information about an application package that is 2234 * installed on the system. 2235 * 2236 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2237 * desired package. 2238 * @param flags Additional option flags. Use any combination of 2239 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 2240 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 2241 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 2242 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 2243 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 2244 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 2245 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 2246 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2247 * {@link #MATCH_UNINSTALLED_PACKAGES} 2248 * to modify the data returned. 2249 * 2250 * @return A PackageInfo object containing information about the 2251 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the 2252 * package is not found in the list of installed applications, the 2253 * package information is retrieved from the list of uninstalled 2254 * applications (which includes installed applications as well as 2255 * applications with data directory i.e. applications which had been 2256 * deleted with {@code DONT_DELETE_DATA} flag set). 2257 * @throws NameNotFoundException if a package with the given name cannot be 2258 * found on the system. 2259 * @see #GET_ACTIVITIES 2260 * @see #GET_CONFIGURATIONS 2261 * @see #GET_GIDS 2262 * @see #GET_INSTRUMENTATION 2263 * @see #GET_INTENT_FILTERS 2264 * @see #GET_META_DATA 2265 * @see #GET_PERMISSIONS 2266 * @see #GET_PROVIDERS 2267 * @see #GET_RECEIVERS 2268 * @see #GET_SERVICES 2269 * @see #GET_SHARED_LIBRARY_FILES 2270 * @see #GET_SIGNATURES 2271 * @see #GET_URI_PERMISSION_PATTERNS 2272 * @see #MATCH_DISABLED_COMPONENTS 2273 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2274 * @see #MATCH_UNINSTALLED_PACKAGES 2275 */ 2276 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) 2277 throws NameNotFoundException; 2278 2279 /** 2280 * @hide 2281 * Retrieve overall information about an application package that is 2282 * installed on the system. 2283 * 2284 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2285 * desired package. 2286 * @param flags Additional option flags. Use any combination of 2287 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 2288 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 2289 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 2290 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 2291 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 2292 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 2293 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 2294 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2295 * {@link #MATCH_UNINSTALLED_PACKAGES} 2296 * to modify the data returned. 2297 * @param userId The user id. 2298 * 2299 * @return A PackageInfo object containing information about the 2300 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the 2301 * package is not found in the list of installed applications, the 2302 * package information is retrieved from the list of uninstalled 2303 * applications (which includes installed applications as well as 2304 * applications with data directory i.e. applications which had been 2305 * deleted with {@code DONT_DELETE_DATA} flag set). 2306 * @throws NameNotFoundException if a package with the given name cannot be 2307 * found on the system. 2308 * @see #GET_ACTIVITIES 2309 * @see #GET_CONFIGURATIONS 2310 * @see #GET_GIDS 2311 * @see #GET_INSTRUMENTATION 2312 * @see #GET_INTENT_FILTERS 2313 * @see #GET_META_DATA 2314 * @see #GET_PERMISSIONS 2315 * @see #GET_PROVIDERS 2316 * @see #GET_RECEIVERS 2317 * @see #GET_SERVICES 2318 * @see #GET_SHARED_LIBRARY_FILES 2319 * @see #GET_SIGNATURES 2320 * @see #GET_URI_PERMISSION_PATTERNS 2321 * @see #MATCH_DISABLED_COMPONENTS 2322 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2323 * @see #MATCH_UNINSTALLED_PACKAGES 2324 */ 2325 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) 2326 public abstract PackageInfo getPackageInfoAsUser(String packageName, 2327 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; 2328 2329 /** 2330 * Map from the current package names in use on the device to whatever 2331 * the current canonical name of that package is. 2332 * @param names Array of current names to be mapped. 2333 * @return Returns an array of the same size as the original, containing 2334 * the canonical name for each package. 2335 */ 2336 public abstract String[] currentToCanonicalPackageNames(String[] names); 2337 2338 /** 2339 * Map from a packages canonical name to the current name in use on the device. 2340 * @param names Array of new names to be mapped. 2341 * @return Returns an array of the same size as the original, containing 2342 * the current name for each package. 2343 */ 2344 public abstract String[] canonicalToCurrentPackageNames(String[] names); 2345 2346 /** 2347 * Returns a "good" intent to launch a front-door activity in a package. 2348 * This is used, for example, to implement an "open" button when browsing 2349 * through packages. The current implementation looks first for a main 2350 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a 2351 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns 2352 * <code>null</code> if neither are found. 2353 * 2354 * @param packageName The name of the package to inspect. 2355 * 2356 * @return A fully-qualified {@link Intent} that can be used to launch the 2357 * main activity in the package. Returns <code>null</code> if the package 2358 * does not contain such an activity, or if <em>packageName</em> is not 2359 * recognized. 2360 */ 2361 public abstract Intent getLaunchIntentForPackage(String packageName); 2362 2363 /** 2364 * Return a "good" intent to launch a front-door Leanback activity in a 2365 * package, for use for example to implement an "open" button when browsing 2366 * through packages. The current implementation will look for a main 2367 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or 2368 * return null if no main leanback activities are found. 2369 * 2370 * @param packageName The name of the package to inspect. 2371 * @return Returns either a fully-qualified Intent that can be used to launch 2372 * the main Leanback activity in the package, or null if the package 2373 * does not contain such an activity. 2374 */ 2375 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName); 2376 2377 /** 2378 * Return an array of all of the secondary group-ids that have been assigned 2379 * to a package. 2380 * 2381 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2382 * desired package. 2383 * @return Returns an int array of the assigned gids, or null if there are 2384 * none. 2385 * @throws NameNotFoundException if a package with the given name cannot be 2386 * found on the system. 2387 */ 2388 public abstract int[] getPackageGids(String packageName) 2389 throws NameNotFoundException; 2390 2391 /** 2392 * Return an array of all of the secondary group-ids that have been assigned 2393 * to a package. 2394 * 2395 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2396 * desired package. 2397 * @return Returns an int array of the assigned gids, or null if there are 2398 * none. 2399 * @throws NameNotFoundException if a package with the given name cannot be 2400 * found on the system. 2401 */ 2402 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags) 2403 throws NameNotFoundException; 2404 2405 /** 2406 * Return the UID associated with the given package name. 2407 * 2408 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2409 * desired package. 2410 * @return Returns an integer UID who owns the given package name. 2411 * @throws NameNotFoundException if a package with the given name can not be 2412 * found on the system. 2413 */ 2414 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags) 2415 throws NameNotFoundException; 2416 2417 /** 2418 * Return the UID associated with the given package name. 2419 * 2420 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2421 * desired package. 2422 * @param userId The user handle identifier to look up the package under. 2423 * @return Returns an integer UID who owns the given package name. 2424 * @throws NameNotFoundException if a package with the given name can not be 2425 * found on the system. 2426 * @hide 2427 */ 2428 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId) 2429 throws NameNotFoundException; 2430 2431 /** 2432 * Return the UID associated with the given package name. 2433 * 2434 * @param packageName The full name (i.e. com.google.apps.contacts) of the 2435 * desired package. 2436 * @param userId The user handle identifier to look up the package under. 2437 * @return Returns an integer UID who owns the given package name. 2438 * @throws NameNotFoundException if a package with the given name can not be 2439 * found on the system. 2440 * @hide 2441 */ 2442 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags, 2443 @UserIdInt int userId) throws NameNotFoundException; 2444 2445 /** 2446 * Retrieve all of the information we know about a particular permission. 2447 * 2448 * @param name The fully qualified name (i.e. com.google.permission.LOGIN) 2449 * of the permission you are interested in. 2450 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 2451 * retrieve any meta-data associated with the permission. 2452 * 2453 * @return Returns a {@link PermissionInfo} containing information about the 2454 * permission. 2455 * @throws NameNotFoundException if a package with the given name cannot be 2456 * found on the system. 2457 * 2458 * @see #GET_META_DATA 2459 */ 2460 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags) 2461 throws NameNotFoundException; 2462 2463 /** 2464 * Query for all of the permissions associated with a particular group. 2465 * 2466 * @param group The fully qualified name (i.e. com.google.permission.LOGIN) 2467 * of the permission group you are interested in. Use null to 2468 * find all of the permissions not associated with a group. 2469 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 2470 * retrieve any meta-data associated with the permissions. 2471 * 2472 * @return Returns a list of {@link PermissionInfo} containing information 2473 * about all of the permissions in the given group. 2474 * @throws NameNotFoundException if a package with the given name cannot be 2475 * found on the system. 2476 * 2477 * @see #GET_META_DATA 2478 */ 2479 public abstract List<PermissionInfo> queryPermissionsByGroup(String group, 2480 @PermissionInfoFlags int flags) throws NameNotFoundException; 2481 2482 /** 2483 * Retrieve all of the information we know about a particular group of 2484 * permissions. 2485 * 2486 * @param name The fully qualified name (i.e. com.google.permission_group.APPS) 2487 * of the permission you are interested in. 2488 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 2489 * retrieve any meta-data associated with the permission group. 2490 * 2491 * @return Returns a {@link PermissionGroupInfo} containing information 2492 * about the permission. 2493 * @throws NameNotFoundException if a package with the given name cannot be 2494 * found on the system. 2495 * 2496 * @see #GET_META_DATA 2497 */ 2498 public abstract PermissionGroupInfo getPermissionGroupInfo(String name, 2499 @PermissionGroupInfoFlags int flags) throws NameNotFoundException; 2500 2501 /** 2502 * Retrieve all of the known permission groups in the system. 2503 * 2504 * @param flags Additional option flags. Use {@link #GET_META_DATA} to 2505 * retrieve any meta-data associated with the permission group. 2506 * 2507 * @return Returns a list of {@link PermissionGroupInfo} containing 2508 * information about all of the known permission groups. 2509 * 2510 * @see #GET_META_DATA 2511 */ 2512 public abstract List<PermissionGroupInfo> getAllPermissionGroups( 2513 @PermissionGroupInfoFlags int flags); 2514 2515 /** 2516 * Retrieve all of the information we know about a particular 2517 * package/application. 2518 * 2519 * @param packageName The full name (i.e. com.google.apps.contacts) of an 2520 * application. 2521 * @param flags Additional option flags. Use any combination of 2522 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2523 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 2524 * to modify the data returned. 2525 * 2526 * @return An {@link ApplicationInfo} containing information about the 2527 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the 2528 * package is not found in the list of installed applications, the 2529 * application information is retrieved from the list of uninstalled 2530 * applications (which includes installed applications as well as 2531 * applications with data directory i.e. applications which had been 2532 * deleted with {@code DONT_DELETE_DATA} flag set). 2533 * @throws NameNotFoundException if a package with the given name cannot be 2534 * found on the system. 2535 * 2536 * @see #GET_META_DATA 2537 * @see #GET_SHARED_LIBRARY_FILES 2538 * @see #MATCH_SYSTEM_ONLY 2539 * @see #MATCH_UNINSTALLED_PACKAGES 2540 */ 2541 public abstract ApplicationInfo getApplicationInfo(String packageName, 2542 @ApplicationInfoFlags int flags) throws NameNotFoundException; 2543 2544 /** {@hide} */ 2545 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName, 2546 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; 2547 2548 /** 2549 * Retrieve all of the information we know about a particular activity 2550 * class. 2551 * 2552 * @param component The full component name (i.e. 2553 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity 2554 * class. 2555 * @param flags Additional option flags. Use any combination of 2556 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2557 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 2558 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2559 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 2560 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 2561 * {@link #MATCH_UNINSTALLED_PACKAGES} 2562 * to modify the data returned. 2563 * 2564 * @return An {@link ActivityInfo} containing information about the activity. 2565 * @throws NameNotFoundException if a package with the given name cannot be 2566 * found on the system. 2567 * 2568 * @see #GET_META_DATA 2569 * @see #GET_SHARED_LIBRARY_FILES 2570 * @see #MATCH_ALL 2571 * @see #MATCH_DEBUG_TRIAGED_MISSING 2572 * @see #MATCH_DEFAULT_ONLY 2573 * @see #MATCH_DISABLED_COMPONENTS 2574 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2575 * @see #MATCH_ENCRYPTION_AWARE 2576 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 2577 * @see #MATCH_ENCRYPTION_UNAWARE 2578 * @see #MATCH_SYSTEM_ONLY 2579 * @see #MATCH_UNINSTALLED_PACKAGES 2580 */ 2581 public abstract ActivityInfo getActivityInfo(ComponentName component, 2582 @ComponentInfoFlags int flags) throws NameNotFoundException; 2583 2584 /** 2585 * Retrieve all of the information we know about a particular receiver 2586 * class. 2587 * 2588 * @param component The full component name (i.e. 2589 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver 2590 * class. 2591 * @param flags Additional option flags. Use any combination of 2592 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2593 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 2594 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2595 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 2596 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 2597 * {@link #MATCH_UNINSTALLED_PACKAGES} 2598 * to modify the data returned. 2599 * 2600 * @return An {@link ActivityInfo} containing information about the receiver. 2601 * @throws NameNotFoundException if a package with the given name cannot be 2602 * found on the system. 2603 * 2604 * @see #GET_META_DATA 2605 * @see #GET_SHARED_LIBRARY_FILES 2606 * @see #MATCH_ALL 2607 * @see #MATCH_DEBUG_TRIAGED_MISSING 2608 * @see #MATCH_DEFAULT_ONLY 2609 * @see #MATCH_DISABLED_COMPONENTS 2610 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2611 * @see #MATCH_ENCRYPTION_AWARE 2612 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 2613 * @see #MATCH_ENCRYPTION_UNAWARE 2614 * @see #MATCH_SYSTEM_ONLY 2615 * @see #MATCH_UNINSTALLED_PACKAGES 2616 */ 2617 public abstract ActivityInfo getReceiverInfo(ComponentName component, 2618 @ComponentInfoFlags int flags) throws NameNotFoundException; 2619 2620 /** 2621 * Retrieve all of the information we know about a particular service 2622 * class. 2623 * 2624 * @param component The full component name (i.e. 2625 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service 2626 * class. 2627 * @param flags Additional option flags. Use any combination of 2628 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2629 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 2630 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2631 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 2632 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 2633 * {@link #MATCH_UNINSTALLED_PACKAGES} 2634 * to modify the data returned. 2635 * 2636 * @return A {@link ServiceInfo} object containing information about the service. 2637 * @throws NameNotFoundException if a package with the given name cannot be 2638 * found on the system. 2639 * 2640 * @see #GET_META_DATA 2641 * @see #GET_SHARED_LIBRARY_FILES 2642 * @see #MATCH_ALL 2643 * @see #MATCH_DEBUG_TRIAGED_MISSING 2644 * @see #MATCH_DEFAULT_ONLY 2645 * @see #MATCH_DISABLED_COMPONENTS 2646 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2647 * @see #MATCH_ENCRYPTION_AWARE 2648 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 2649 * @see #MATCH_ENCRYPTION_UNAWARE 2650 * @see #MATCH_SYSTEM_ONLY 2651 * @see #MATCH_UNINSTALLED_PACKAGES 2652 */ 2653 public abstract ServiceInfo getServiceInfo(ComponentName component, 2654 @ComponentInfoFlags int flags) throws NameNotFoundException; 2655 2656 /** 2657 * Retrieve all of the information we know about a particular content 2658 * provider class. 2659 * 2660 * @param component The full component name (i.e. 2661 * com.google.providers.media/com.google.providers.media.MediaProvider) of a 2662 * ContentProvider class. 2663 * @param flags Additional option flags. Use any combination of 2664 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 2665 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 2666 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2667 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 2668 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 2669 * {@link #MATCH_UNINSTALLED_PACKAGES} 2670 * to modify the data returned. 2671 * 2672 * @return A {@link ProviderInfo} object containing information about the provider. 2673 * @throws NameNotFoundException if a package with the given name cannot be 2674 * found on the system. 2675 * 2676 * @see #GET_META_DATA 2677 * @see #GET_SHARED_LIBRARY_FILES 2678 * @see #MATCH_ALL 2679 * @see #MATCH_DEBUG_TRIAGED_MISSING 2680 * @see #MATCH_DEFAULT_ONLY 2681 * @see #MATCH_DISABLED_COMPONENTS 2682 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2683 * @see #MATCH_ENCRYPTION_AWARE 2684 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 2685 * @see #MATCH_ENCRYPTION_UNAWARE 2686 * @see #MATCH_SYSTEM_ONLY 2687 * @see #MATCH_UNINSTALLED_PACKAGES 2688 */ 2689 public abstract ProviderInfo getProviderInfo(ComponentName component, 2690 @ComponentInfoFlags int flags) throws NameNotFoundException; 2691 2692 /** 2693 * Return a List of all packages that are installed 2694 * on the device. 2695 * 2696 * @param flags Additional option flags. Use any combination of 2697 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 2698 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 2699 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 2700 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 2701 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 2702 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 2703 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 2704 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2705 * {@link #MATCH_UNINSTALLED_PACKAGES} 2706 * to modify the data returned. 2707 * 2708 * @return A List of PackageInfo objects, one for each installed package, 2709 * containing information about the package. In the unlikely case 2710 * there are no installed packages, an empty list is returned. If 2711 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package 2712 * information is retrieved from the list of uninstalled 2713 * applications (which includes installed applications as well as 2714 * applications with data directory i.e. applications which had been 2715 * deleted with {@code DONT_DELETE_DATA} flag set). 2716 * 2717 * @see #GET_ACTIVITIES 2718 * @see #GET_CONFIGURATIONS 2719 * @see #GET_GIDS 2720 * @see #GET_INSTRUMENTATION 2721 * @see #GET_INTENT_FILTERS 2722 * @see #GET_META_DATA 2723 * @see #GET_PERMISSIONS 2724 * @see #GET_PROVIDERS 2725 * @see #GET_RECEIVERS 2726 * @see #GET_SERVICES 2727 * @see #GET_SHARED_LIBRARY_FILES 2728 * @see #GET_SIGNATURES 2729 * @see #GET_URI_PERMISSION_PATTERNS 2730 * @see #MATCH_DISABLED_COMPONENTS 2731 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2732 * @see #MATCH_UNINSTALLED_PACKAGES 2733 */ 2734 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags); 2735 2736 /** 2737 * Return a List of all installed packages that are currently 2738 * holding any of the given permissions. 2739 * 2740 * @param flags Additional option flags. Use any combination of 2741 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 2742 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 2743 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 2744 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 2745 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 2746 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 2747 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 2748 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2749 * {@link #MATCH_UNINSTALLED_PACKAGES} 2750 * to modify the data returned. 2751 * 2752 * @return A List of PackageInfo objects, one for each installed package 2753 * that holds any of the permissions that were provided, containing 2754 * information about the package. If no installed packages hold any 2755 * of the permissions, an empty list is returned. If flag 2756 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package information 2757 * is retrieved from the list of uninstalled applications (which 2758 * includes installed applications as well as applications with data 2759 * directory i.e. applications which had been deleted with 2760 * {@code DONT_DELETE_DATA} flag set). 2761 * 2762 * @see #GET_ACTIVITIES 2763 * @see #GET_CONFIGURATIONS 2764 * @see #GET_GIDS 2765 * @see #GET_INSTRUMENTATION 2766 * @see #GET_INTENT_FILTERS 2767 * @see #GET_META_DATA 2768 * @see #GET_PERMISSIONS 2769 * @see #GET_PROVIDERS 2770 * @see #GET_RECEIVERS 2771 * @see #GET_SERVICES 2772 * @see #GET_SHARED_LIBRARY_FILES 2773 * @see #GET_SIGNATURES 2774 * @see #GET_URI_PERMISSION_PATTERNS 2775 * @see #MATCH_DISABLED_COMPONENTS 2776 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2777 * @see #MATCH_UNINSTALLED_PACKAGES 2778 */ 2779 public abstract List<PackageInfo> getPackagesHoldingPermissions( 2780 String[] permissions, @PackageInfoFlags int flags); 2781 2782 /** 2783 * Return a List of all packages that are installed on the device, for a specific user. 2784 * Requesting a list of installed packages for another user 2785 * will require the permission INTERACT_ACROSS_USERS_FULL. 2786 * 2787 * @param flags Additional option flags. Use any combination of 2788 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 2789 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 2790 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 2791 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 2792 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 2793 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 2794 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 2795 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 2796 * {@link #MATCH_UNINSTALLED_PACKAGES} 2797 * to modify the data returned. 2798 * @param userId The user for whom the installed packages are to be listed 2799 * 2800 * @return A List of PackageInfo objects, one for each installed package, 2801 * containing information about the package. In the unlikely case 2802 * there are no installed packages, an empty list is returned. If 2803 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package 2804 * information is retrieved from the list of uninstalled 2805 * applications (which includes installed applications as well as 2806 * applications with data directory i.e. applications which had been 2807 * deleted with {@code DONT_DELETE_DATA} flag set). 2808 * 2809 * @see #GET_ACTIVITIES 2810 * @see #GET_CONFIGURATIONS 2811 * @see #GET_GIDS 2812 * @see #GET_INSTRUMENTATION 2813 * @see #GET_INTENT_FILTERS 2814 * @see #GET_META_DATA 2815 * @see #GET_PERMISSIONS 2816 * @see #GET_PROVIDERS 2817 * @see #GET_RECEIVERS 2818 * @see #GET_SERVICES 2819 * @see #GET_SHARED_LIBRARY_FILES 2820 * @see #GET_SIGNATURES 2821 * @see #GET_URI_PERMISSION_PATTERNS 2822 * @see #MATCH_DISABLED_COMPONENTS 2823 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 2824 * @see #MATCH_UNINSTALLED_PACKAGES 2825 * 2826 * @hide 2827 */ 2828 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags, 2829 @UserIdInt int userId); 2830 2831 /** 2832 * Check whether a particular package has been granted a particular 2833 * permission. 2834 * 2835 * @param permName The name of the permission you are checking for. 2836 * @param pkgName The name of the package you are checking against. 2837 * 2838 * @return If the package has the permission, PERMISSION_GRANTED is 2839 * returned. If it does not have the permission, PERMISSION_DENIED 2840 * is returned. 2841 * 2842 * @see #PERMISSION_GRANTED 2843 * @see #PERMISSION_DENIED 2844 */ 2845 @CheckResult 2846 public abstract int checkPermission(String permName, String pkgName); 2847 2848 /** 2849 * Checks whether a particular permissions has been revoked for a 2850 * package by policy. Typically the device owner or the profile owner 2851 * may apply such a policy. The user cannot grant policy revoked 2852 * permissions, hence the only way for an app to get such a permission 2853 * is by a policy change. 2854 * 2855 * @param permName The name of the permission you are checking for. 2856 * @param pkgName The name of the package you are checking against. 2857 * 2858 * @return Whether the permission is restricted by policy. 2859 */ 2860 @CheckResult 2861 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName, 2862 @NonNull String pkgName); 2863 2864 /** 2865 * Gets the package name of the component controlling runtime permissions. 2866 * 2867 * @return The package name. 2868 * 2869 * @hide 2870 */ 2871 public abstract String getPermissionControllerPackageName(); 2872 2873 /** 2874 * Add a new dynamic permission to the system. For this to work, your 2875 * package must have defined a permission tree through the 2876 * {@link android.R.styleable#AndroidManifestPermissionTree 2877 * <permission-tree>} tag in its manifest. A package can only add 2878 * permissions to trees that were defined by either its own package or 2879 * another with the same user id; a permission is in a tree if it 2880 * matches the name of the permission tree + ".": for example, 2881 * "com.foo.bar" is a member of the permission tree "com.foo". 2882 * 2883 * <p>It is good to make your permission tree name descriptive, because you 2884 * are taking possession of that entire set of permission names. Thus, it 2885 * must be under a domain you control, with a suffix that will not match 2886 * any normal permissions that may be declared in any applications that 2887 * are part of that domain. 2888 * 2889 * <p>New permissions must be added before 2890 * any .apks are installed that use those permissions. Permissions you 2891 * add through this method are remembered across reboots of the device. 2892 * If the given permission already exists, the info you supply here 2893 * will be used to update it. 2894 * 2895 * @param info Description of the permission to be added. 2896 * 2897 * @return Returns true if a new permission was created, false if an 2898 * existing one was updated. 2899 * 2900 * @throws SecurityException if you are not allowed to add the 2901 * given permission name. 2902 * 2903 * @see #removePermission(String) 2904 */ 2905 public abstract boolean addPermission(PermissionInfo info); 2906 2907 /** 2908 * Like {@link #addPermission(PermissionInfo)} but asynchronously 2909 * persists the package manager state after returning from the call, 2910 * allowing it to return quicker and batch a series of adds at the 2911 * expense of no guarantee the added permission will be retained if 2912 * the device is rebooted before it is written. 2913 */ 2914 public abstract boolean addPermissionAsync(PermissionInfo info); 2915 2916 /** 2917 * Removes a permission that was previously added with 2918 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply 2919 * -- you are only allowed to remove permissions that you are allowed 2920 * to add. 2921 * 2922 * @param name The name of the permission to remove. 2923 * 2924 * @throws SecurityException if you are not allowed to remove the 2925 * given permission name. 2926 * 2927 * @see #addPermission(PermissionInfo) 2928 */ 2929 public abstract void removePermission(String name); 2930 2931 2932 /** 2933 * Permission flags set when granting or revoking a permission. 2934 * 2935 * @hide 2936 */ 2937 @SystemApi 2938 @IntDef({FLAG_PERMISSION_USER_SET, 2939 FLAG_PERMISSION_USER_FIXED, 2940 FLAG_PERMISSION_POLICY_FIXED, 2941 FLAG_PERMISSION_REVOKE_ON_UPGRADE, 2942 FLAG_PERMISSION_SYSTEM_FIXED, 2943 FLAG_PERMISSION_GRANTED_BY_DEFAULT}) 2944 @Retention(RetentionPolicy.SOURCE) 2945 public @interface PermissionFlags {} 2946 2947 /** 2948 * Grant a runtime permission to an application which the application does not 2949 * already have. The permission must have been requested by the application. 2950 * If the application is not allowed to hold the permission, a {@link 2951 * java.lang.SecurityException} is thrown. 2952 * <p> 2953 * <strong>Note: </strong>Using this API requires holding 2954 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is 2955 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. 2956 * </p> 2957 * 2958 * @param packageName The package to which to grant the permission. 2959 * @param permissionName The permission name to grant. 2960 * @param user The user for which to grant the permission. 2961 * 2962 * @see #revokeRuntimePermission(String, String, android.os.UserHandle) 2963 * @see android.content.pm.PackageManager.PermissionFlags 2964 * 2965 * @hide 2966 */ 2967 @SystemApi 2968 public abstract void grantRuntimePermission(@NonNull String packageName, 2969 @NonNull String permissionName, @NonNull UserHandle user); 2970 2971 /** 2972 * Revoke a runtime permission that was previously granted by {@link 2973 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The 2974 * permission must have been requested by and granted to the application. 2975 * If the application is not allowed to hold the permission, a {@link 2976 * java.lang.SecurityException} is thrown. 2977 * <p> 2978 * <strong>Note: </strong>Using this API requires holding 2979 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is 2980 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. 2981 * </p> 2982 * 2983 * @param packageName The package from which to revoke the permission. 2984 * @param permissionName The permission name to revoke. 2985 * @param user The user for which to revoke the permission. 2986 * 2987 * @see #grantRuntimePermission(String, String, android.os.UserHandle) 2988 * @see android.content.pm.PackageManager.PermissionFlags 2989 * 2990 * @hide 2991 */ 2992 @SystemApi 2993 public abstract void revokeRuntimePermission(@NonNull String packageName, 2994 @NonNull String permissionName, @NonNull UserHandle user); 2995 2996 /** 2997 * Gets the state flags associated with a permission. 2998 * 2999 * @param permissionName The permission for which to get the flags. 3000 * @param packageName The package name for which to get the flags. 3001 * @param user The user for which to get permission flags. 3002 * @return The permission flags. 3003 * 3004 * @hide 3005 */ 3006 @SystemApi 3007 public abstract @PermissionFlags int getPermissionFlags(String permissionName, 3008 String packageName, @NonNull UserHandle user); 3009 3010 /** 3011 * Updates the flags associated with a permission by replacing the flags in 3012 * the specified mask with the provided flag values. 3013 * 3014 * @param permissionName The permission for which to update the flags. 3015 * @param packageName The package name for which to update the flags. 3016 * @param flagMask The flags which to replace. 3017 * @param flagValues The flags with which to replace. 3018 * @param user The user for which to update the permission flags. 3019 * 3020 * @hide 3021 */ 3022 @SystemApi 3023 public abstract void updatePermissionFlags(String permissionName, 3024 String packageName, @PermissionFlags int flagMask, int flagValues, 3025 @NonNull UserHandle user); 3026 3027 /** 3028 * Gets whether you should show UI with rationale for requesting a permission. 3029 * You should do this only if you do not have the permission and the context in 3030 * which the permission is requested does not clearly communicate to the user 3031 * what would be the benefit from grating this permission. 3032 * 3033 * @param permission A permission your app wants to request. 3034 * @return Whether you can show permission rationale UI. 3035 * 3036 * @hide 3037 */ 3038 public abstract boolean shouldShowRequestPermissionRationale(String permission); 3039 3040 /** 3041 * Returns an {@link android.content.Intent} suitable for passing to 3042 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} 3043 * which prompts the user to grant permissions to this application. 3044 * 3045 * @throws NullPointerException if {@code permissions} is {@code null} or empty. 3046 * 3047 * @hide 3048 */ 3049 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { 3050 if (ArrayUtils.isEmpty(permissions)) { 3051 throw new NullPointerException("permission cannot be null or empty"); 3052 } 3053 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); 3054 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); 3055 intent.setPackage(getPermissionControllerPackageName()); 3056 return intent; 3057 } 3058 3059 /** 3060 * Compare the signatures of two packages to determine if the same 3061 * signature appears in both of them. If they do contain the same 3062 * signature, then they are allowed special privileges when working 3063 * with each other: they can share the same user-id, run instrumentation 3064 * against each other, etc. 3065 * 3066 * @param pkg1 First package name whose signature will be compared. 3067 * @param pkg2 Second package name whose signature will be compared. 3068 * 3069 * @return Returns an integer indicating whether all signatures on the 3070 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if 3071 * all signatures match or < 0 if there is not a match ({@link 3072 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). 3073 * 3074 * @see #checkSignatures(int, int) 3075 * @see #SIGNATURE_MATCH 3076 * @see #SIGNATURE_NO_MATCH 3077 * @see #SIGNATURE_UNKNOWN_PACKAGE 3078 */ 3079 @CheckResult 3080 public abstract int checkSignatures(String pkg1, String pkg2); 3081 3082 /** 3083 * Like {@link #checkSignatures(String, String)}, but takes UIDs of 3084 * the two packages to be checked. This can be useful, for example, 3085 * when doing the check in an IPC, where the UID is the only identity 3086 * available. It is functionally identical to determining the package 3087 * associated with the UIDs and checking their signatures. 3088 * 3089 * @param uid1 First UID whose signature will be compared. 3090 * @param uid2 Second UID whose signature will be compared. 3091 * 3092 * @return Returns an integer indicating whether all signatures on the 3093 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if 3094 * all signatures match or < 0 if there is not a match ({@link 3095 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). 3096 * 3097 * @see #checkSignatures(String, String) 3098 * @see #SIGNATURE_MATCH 3099 * @see #SIGNATURE_NO_MATCH 3100 * @see #SIGNATURE_UNKNOWN_PACKAGE 3101 */ 3102 @CheckResult 3103 public abstract int checkSignatures(int uid1, int uid2); 3104 3105 /** 3106 * Retrieve the names of all packages that are associated with a particular 3107 * user id. In most cases, this will be a single package name, the package 3108 * that has been assigned that user id. Where there are multiple packages 3109 * sharing the same user id through the "sharedUserId" mechanism, all 3110 * packages with that id will be returned. 3111 * 3112 * @param uid The user id for which you would like to retrieve the 3113 * associated packages. 3114 * 3115 * @return Returns an array of one or more packages assigned to the user 3116 * id, or null if there are no known packages with the given id. 3117 */ 3118 public abstract @Nullable String[] getPackagesForUid(int uid); 3119 3120 /** 3121 * Retrieve the official name associated with a user id. This name is 3122 * guaranteed to never change, though it is possible for the underlying 3123 * user id to be changed. That is, if you are storing information about 3124 * user ids in persistent storage, you should use the string returned 3125 * by this function instead of the raw user-id. 3126 * 3127 * @param uid The user id for which you would like to retrieve a name. 3128 * @return Returns a unique name for the given user id, or null if the 3129 * user id is not currently assigned. 3130 */ 3131 public abstract @Nullable String getNameForUid(int uid); 3132 3133 /** 3134 * Return the user id associated with a shared user name. Multiple 3135 * applications can specify a shared user name in their manifest and thus 3136 * end up using a common uid. This might be used for new applications 3137 * that use an existing shared user name and need to know the uid of the 3138 * shared user. 3139 * 3140 * @param sharedUserName The shared user name whose uid is to be retrieved. 3141 * @return Returns the UID associated with the shared user. 3142 * @throws NameNotFoundException if a package with the given name cannot be 3143 * found on the system. 3144 * @hide 3145 */ 3146 public abstract int getUidForSharedUser(String sharedUserName) 3147 throws NameNotFoundException; 3148 3149 /** 3150 * Return a List of all application packages that are installed on the 3151 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all 3152 * applications including those deleted with {@code DONT_DELETE_DATA} (partially 3153 * installed apps with data directory) will be returned. 3154 * 3155 * @param flags Additional option flags. Use any combination of 3156 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 3157 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3158 * to modify the data returned. 3159 * 3160 * @return A List of ApplicationInfo objects, one for each installed application. 3161 * In the unlikely case there are no installed packages, an empty list 3162 * is returned. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the 3163 * application information is retrieved from the list of uninstalled 3164 * applications (which includes installed applications as well as 3165 * applications with data directory i.e. applications which had been 3166 * deleted with {@code DONT_DELETE_DATA} flag set). 3167 * 3168 * @see #GET_META_DATA 3169 * @see #GET_SHARED_LIBRARY_FILES 3170 * @see #MATCH_SYSTEM_ONLY 3171 * @see #MATCH_UNINSTALLED_PACKAGES 3172 */ 3173 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags); 3174 3175 /** 3176 * Gets the ephemeral applications the user recently used. Requires 3177 * holding "android.permission.ACCESS_EPHEMERAL_APPS". 3178 * 3179 * @return The ephemeral app list. 3180 * 3181 * @hide 3182 */ 3183 @RequiresPermission(Manifest.permission.ACCESS_EPHEMERAL_APPS) 3184 public abstract List<EphemeralApplicationInfo> getEphemeralApplications(); 3185 3186 /** 3187 * Gets the icon for an ephemeral application. 3188 * 3189 * @param packageName The app package name. 3190 * 3191 * @hide 3192 */ 3193 public abstract Drawable getEphemeralApplicationIcon(String packageName); 3194 3195 /** 3196 * Gets whether the caller is an ephemeral app. 3197 * 3198 * @return Whether caller is an ephemeral app. 3199 * 3200 * @see #setEphemeralCookie(byte[]) 3201 * @see #getEphemeralCookie() 3202 * @see #getEphemeralCookieMaxSizeBytes() 3203 */ 3204 public abstract boolean isEphemeralApplication(); 3205 3206 /** 3207 * Gets the maximum size in bytes of the cookie data an ephemeral app 3208 * can store on the device. 3209 * 3210 * @return The max cookie size in bytes. 3211 * 3212 * @see #isEphemeralApplication() 3213 * @see #setEphemeralCookie(byte[]) 3214 * @see #getEphemeralCookie() 3215 */ 3216 public abstract int getEphemeralCookieMaxSizeBytes(); 3217 3218 /** 3219 * Gets the ephemeral application cookie for this app. Non 3220 * ephemeral apps and apps that were ephemeral but were upgraded 3221 * to non-ephemeral can still access this API. For ephemeral apps 3222 * this cooke is cached for some time after uninstall while for 3223 * normal apps the cookie is deleted after the app is uninstalled. 3224 * The cookie is always present while the app is installed. 3225 * 3226 * @return The cookie. 3227 * 3228 * @see #isEphemeralApplication() 3229 * @see #setEphemeralCookie(byte[]) 3230 * @see #getEphemeralCookieMaxSizeBytes() 3231 */ 3232 public abstract @NonNull byte[] getEphemeralCookie(); 3233 3234 /** 3235 * Sets the ephemeral application cookie for the calling app. Non 3236 * ephemeral apps and apps that were ephemeral but were upgraded 3237 * to non-ephemeral can still access this API. For ephemeral apps 3238 * this cooke is cached for some time after uninstall while for 3239 * normal apps the cookie is deleted after the app is uninstalled. 3240 * The cookie is always present while the app is installed. The 3241 * cookie size is limited by {@link #getEphemeralCookieMaxSizeBytes()}. 3242 * 3243 * @param cookie The cookie data. 3244 * @return True if the cookie was set. 3245 * 3246 * @see #isEphemeralApplication() 3247 * @see #getEphemeralCookieMaxSizeBytes() 3248 * @see #getEphemeralCookie(); 3249 */ 3250 public abstract boolean setEphemeralCookie(@NonNull byte[] cookie); 3251 3252 /** 3253 * Get a list of shared libraries that are available on the 3254 * system. 3255 * 3256 * @return An array of shared library names that are 3257 * available on the system, or null if none are installed. 3258 * 3259 */ 3260 public abstract String[] getSystemSharedLibraryNames(); 3261 3262 /** 3263 * Get a list of features that are available on the 3264 * system. 3265 * 3266 * @return An array of FeatureInfo classes describing the features 3267 * that are available on the system, or null if there are none(!!). 3268 */ 3269 public abstract FeatureInfo[] getSystemAvailableFeatures(); 3270 3271 /** 3272 * Check whether the given feature name is one of the available 3273 * features as returned by {@link #getSystemAvailableFeatures()}. 3274 * 3275 * @return Returns true if the devices supports the feature, else 3276 * false. 3277 */ 3278 public abstract boolean hasSystemFeature(String name); 3279 3280 /** 3281 * Determine the best action to perform for a given Intent. This is how 3282 * {@link Intent#resolveActivity} finds an activity if a class has not 3283 * been explicitly specified. 3284 * 3285 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName 3286 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} 3287 * only flag. You need to do so to resolve the activity in the same way 3288 * that {@link android.content.Context#startActivity(Intent)} and 3289 * {@link android.content.Intent#resolveActivity(PackageManager) 3290 * Intent.resolveActivity(PackageManager)} do.</p> 3291 * 3292 * @param intent An intent containing all of the desired specification 3293 * (action, data, type, category, and/or component). 3294 * @param flags Additional option flags. Use any combination of 3295 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3296 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3297 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3298 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3299 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3300 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3301 * to modify the data returned. The most important is 3302 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 3303 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 3304 * 3305 * @return Returns a ResolveInfo object containing the final activity intent 3306 * that was determined to be the best action. Returns null if no 3307 * matching activity was found. If multiple matching activities are 3308 * found and there is no default set, returns a ResolveInfo object 3309 * containing something else, such as the activity resolver. 3310 * 3311 * @see #GET_META_DATA 3312 * @see #GET_RESOLVED_FILTER 3313 * @see #GET_SHARED_LIBRARY_FILES 3314 * @see #MATCH_ALL 3315 * @see #MATCH_DISABLED_COMPONENTS 3316 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3317 * @see #MATCH_DEFAULT_ONLY 3318 * @see #MATCH_ENCRYPTION_AWARE 3319 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3320 * @see #MATCH_ENCRYPTION_UNAWARE 3321 * @see #MATCH_SYSTEM_ONLY 3322 * @see #MATCH_UNINSTALLED_PACKAGES 3323 */ 3324 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags); 3325 3326 /** 3327 * Determine the best action to perform for a given Intent for a given user. This 3328 * is how {@link Intent#resolveActivity} finds an activity if a class has not 3329 * been explicitly specified. 3330 * 3331 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName 3332 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} 3333 * only flag. You need to do so to resolve the activity in the same way 3334 * that {@link android.content.Context#startActivity(Intent)} and 3335 * {@link android.content.Intent#resolveActivity(PackageManager) 3336 * Intent.resolveActivity(PackageManager)} do.</p> 3337 * 3338 * @param intent An intent containing all of the desired specification 3339 * (action, data, type, category, and/or component). 3340 * @param flags Additional option flags. Use any combination of 3341 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3342 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3343 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3344 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3345 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3346 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3347 * to modify the data returned. The most important is 3348 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 3349 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 3350 * @param userId The user id. 3351 * 3352 * @return Returns a ResolveInfo object containing the final activity intent 3353 * that was determined to be the best action. Returns null if no 3354 * matching activity was found. If multiple matching activities are 3355 * found and there is no default set, returns a ResolveInfo object 3356 * containing something else, such as the activity resolver. 3357 * 3358 * @see #GET_META_DATA 3359 * @see #GET_RESOLVED_FILTER 3360 * @see #GET_SHARED_LIBRARY_FILES 3361 * @see #MATCH_ALL 3362 * @see #MATCH_DISABLED_COMPONENTS 3363 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3364 * @see #MATCH_DEFAULT_ONLY 3365 * @see #MATCH_ENCRYPTION_AWARE 3366 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3367 * @see #MATCH_ENCRYPTION_UNAWARE 3368 * @see #MATCH_SYSTEM_ONLY 3369 * @see #MATCH_UNINSTALLED_PACKAGES 3370 * 3371 * @hide 3372 */ 3373 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags, 3374 @UserIdInt int userId); 3375 3376 /** 3377 * Retrieve all activities that can be performed for the given intent. 3378 * 3379 * @param intent The desired intent as per resolveActivity(). 3380 * @param flags Additional option flags. Use any combination of 3381 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3382 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3383 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3384 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3385 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3386 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3387 * to modify the data returned. The most important is 3388 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 3389 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 3390 * Or, set {@link #MATCH_ALL} to prevent any filtering of the results. 3391 * 3392 * @return Returns a List of ResolveInfo objects containing one entry for each 3393 * matching activity, ordered from best to worst. In other words, the 3394 * first item is what would be returned by {@link #resolveActivity}. 3395 * If there are no matching activities, an empty list is returned. 3396 * 3397 * @see #GET_META_DATA 3398 * @see #GET_RESOLVED_FILTER 3399 * @see #GET_SHARED_LIBRARY_FILES 3400 * @see #MATCH_ALL 3401 * @see #MATCH_DISABLED_COMPONENTS 3402 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3403 * @see #MATCH_DEFAULT_ONLY 3404 * @see #MATCH_ENCRYPTION_AWARE 3405 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3406 * @see #MATCH_ENCRYPTION_UNAWARE 3407 * @see #MATCH_SYSTEM_ONLY 3408 * @see #MATCH_UNINSTALLED_PACKAGES 3409 */ 3410 public abstract List<ResolveInfo> queryIntentActivities(Intent intent, 3411 @ResolveInfoFlags int flags); 3412 3413 /** 3414 * Retrieve all activities that can be performed for the given intent, for a specific user. 3415 * 3416 * @param intent The desired intent as per resolveActivity(). 3417 * @param flags Additional option flags. Use any combination of 3418 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3419 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3420 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3421 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3422 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3423 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3424 * to modify the data returned. The most important is 3425 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 3426 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 3427 * Or, set {@link #MATCH_ALL} to prevent any filtering of the results. 3428 * 3429 * @return Returns a List of ResolveInfo objects containing one entry for each 3430 * matching activity, ordered from best to worst. In other words, the 3431 * first item is what would be returned by {@link #resolveActivity}. 3432 * If there are no matching activities, an empty list is returned. 3433 * 3434 * @see #GET_META_DATA 3435 * @see #GET_RESOLVED_FILTER 3436 * @see #GET_SHARED_LIBRARY_FILES 3437 * @see #MATCH_ALL 3438 * @see #MATCH_DISABLED_COMPONENTS 3439 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3440 * @see #MATCH_DEFAULT_ONLY 3441 * @see #MATCH_ENCRYPTION_AWARE 3442 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3443 * @see #MATCH_ENCRYPTION_UNAWARE 3444 * @see #MATCH_SYSTEM_ONLY 3445 * @see #MATCH_UNINSTALLED_PACKAGES 3446 * 3447 * @hide 3448 */ 3449 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, 3450 @ResolveInfoFlags int flags, @UserIdInt int userId); 3451 3452 /** 3453 * Retrieve a set of activities that should be presented to the user as 3454 * similar options. This is like {@link #queryIntentActivities}, except it 3455 * also allows you to supply a list of more explicit Intents that you would 3456 * like to resolve to particular options, and takes care of returning the 3457 * final ResolveInfo list in a reasonable order, with no duplicates, based 3458 * on those inputs. 3459 * 3460 * @param caller The class name of the activity that is making the 3461 * request. This activity will never appear in the output 3462 * list. Can be null. 3463 * @param specifics An array of Intents that should be resolved to the 3464 * first specific results. Can be null. 3465 * @param intent The desired intent as per resolveActivity(). 3466 * @param flags Additional option flags. Use any combination of 3467 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3468 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3469 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3470 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3471 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3472 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3473 * to modify the data returned. The most important is 3474 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only 3475 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. 3476 * 3477 * @return Returns a List of ResolveInfo objects containing one entry for each 3478 * matching activity. The list is ordered first by all of the intents resolved 3479 * in <var>specifics</var> and then any additional activities that 3480 * can handle <var>intent</var> but did not get included by one of 3481 * the <var>specifics</var> intents. If there are no matching 3482 * activities, an empty list is returned. 3483 * 3484 * @see #GET_META_DATA 3485 * @see #GET_RESOLVED_FILTER 3486 * @see #GET_SHARED_LIBRARY_FILES 3487 * @see #MATCH_ALL 3488 * @see #MATCH_DISABLED_COMPONENTS 3489 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3490 * @see #MATCH_DEFAULT_ONLY 3491 * @see #MATCH_ENCRYPTION_AWARE 3492 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3493 * @see #MATCH_ENCRYPTION_UNAWARE 3494 * @see #MATCH_SYSTEM_ONLY 3495 * @see #MATCH_UNINSTALLED_PACKAGES 3496 */ 3497 public abstract List<ResolveInfo> queryIntentActivityOptions( 3498 ComponentName caller, Intent[] specifics, Intent intent, @ResolveInfoFlags int flags); 3499 3500 /** 3501 * Retrieve all receivers that can handle a broadcast of the given intent. 3502 * 3503 * @param intent The desired intent as per resolveActivity(). 3504 * @param flags Additional option flags. Use any combination of 3505 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3506 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3507 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3508 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3509 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3510 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3511 * to modify the data returned. 3512 * 3513 * @return Returns a List of ResolveInfo objects containing one entry for each 3514 * matching receiver, ordered from best to worst. If there are no matching 3515 * receivers, an empty list or null is returned. 3516 * 3517 * @see #GET_META_DATA 3518 * @see #GET_RESOLVED_FILTER 3519 * @see #GET_SHARED_LIBRARY_FILES 3520 * @see #MATCH_ALL 3521 * @see #MATCH_DISABLED_COMPONENTS 3522 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3523 * @see #MATCH_DEFAULT_ONLY 3524 * @see #MATCH_ENCRYPTION_AWARE 3525 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3526 * @see #MATCH_ENCRYPTION_UNAWARE 3527 * @see #MATCH_SYSTEM_ONLY 3528 * @see #MATCH_UNINSTALLED_PACKAGES 3529 */ 3530 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, 3531 @ResolveInfoFlags int flags); 3532 3533 /** 3534 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific 3535 * user. 3536 * 3537 * @param intent The desired intent as per resolveActivity(). 3538 * @param flags Additional option flags. Use any combination of 3539 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3540 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3541 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3542 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3543 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3544 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3545 * to modify the data returned. 3546 * @param userId The userId of the user being queried. 3547 * 3548 * @return Returns a List of ResolveInfo objects containing one entry for each 3549 * matching receiver, ordered from best to worst. If there are no matching 3550 * receivers, an empty list or null is returned. 3551 * 3552 * @see #GET_META_DATA 3553 * @see #GET_RESOLVED_FILTER 3554 * @see #GET_SHARED_LIBRARY_FILES 3555 * @see #MATCH_ALL 3556 * @see #MATCH_DISABLED_COMPONENTS 3557 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3558 * @see #MATCH_DEFAULT_ONLY 3559 * @see #MATCH_ENCRYPTION_AWARE 3560 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3561 * @see #MATCH_ENCRYPTION_UNAWARE 3562 * @see #MATCH_SYSTEM_ONLY 3563 * @see #MATCH_UNINSTALLED_PACKAGES 3564 * 3565 * @hide 3566 */ 3567 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, 3568 @ResolveInfoFlags int flags, @UserIdInt int userId); 3569 3570 /** {@hide} */ 3571 @Deprecated 3572 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, 3573 @ResolveInfoFlags int flags, @UserIdInt int userId) { 3574 Log.w(TAG, "STAHP USING HIDDEN APIS KTHX"); 3575 return queryBroadcastReceiversAsUser(intent, flags, userId); 3576 } 3577 3578 /** 3579 * Determine the best service to handle for a given Intent. 3580 * 3581 * @param intent An intent containing all of the desired specification 3582 * (action, data, type, category, and/or component). 3583 * @param flags Additional option flags. Use any combination of 3584 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3585 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3586 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3587 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3588 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3589 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3590 * to modify the data returned. 3591 * 3592 * @return Returns a ResolveInfo object containing the final service intent 3593 * that was determined to be the best action. Returns null if no 3594 * matching service was found. 3595 * 3596 * @see #GET_META_DATA 3597 * @see #GET_RESOLVED_FILTER 3598 * @see #GET_SHARED_LIBRARY_FILES 3599 * @see #MATCH_ALL 3600 * @see #MATCH_DISABLED_COMPONENTS 3601 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3602 * @see #MATCH_DEFAULT_ONLY 3603 * @see #MATCH_ENCRYPTION_AWARE 3604 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3605 * @see #MATCH_ENCRYPTION_UNAWARE 3606 * @see #MATCH_SYSTEM_ONLY 3607 * @see #MATCH_UNINSTALLED_PACKAGES 3608 */ 3609 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags); 3610 3611 /** 3612 * Retrieve all services that can match the given intent. 3613 * 3614 * @param intent The desired intent as per resolveService(). 3615 * @param flags Additional option flags. Use any combination of 3616 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3617 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3618 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3619 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3620 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3621 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3622 * to modify the data returned. 3623 * 3624 * @return Returns a List of ResolveInfo objects containing one entry for each 3625 * matching service, ordered from best to worst. In other words, the first 3626 * item is what would be returned by {@link #resolveService}. If there are 3627 * no matching services, an empty list or null is returned. 3628 * 3629 * @see #GET_META_DATA 3630 * @see #GET_RESOLVED_FILTER 3631 * @see #GET_SHARED_LIBRARY_FILES 3632 * @see #MATCH_ALL 3633 * @see #MATCH_DISABLED_COMPONENTS 3634 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3635 * @see #MATCH_DEFAULT_ONLY 3636 * @see #MATCH_ENCRYPTION_AWARE 3637 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3638 * @see #MATCH_ENCRYPTION_UNAWARE 3639 * @see #MATCH_SYSTEM_ONLY 3640 * @see #MATCH_UNINSTALLED_PACKAGES 3641 */ 3642 public abstract List<ResolveInfo> queryIntentServices(Intent intent, 3643 @ResolveInfoFlags int flags); 3644 3645 /** 3646 * Retrieve all services that can match the given intent for a given user. 3647 * 3648 * @param intent The desired intent as per resolveService(). 3649 * @param flags Additional option flags. Use any combination of 3650 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3651 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3652 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3653 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3654 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3655 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3656 * to modify the data returned. 3657 * @param userId The user id. 3658 * 3659 * @return Returns a List of ResolveInfo objects containing one entry for each 3660 * matching service, ordered from best to worst. In other words, the first 3661 * item is what would be returned by {@link #resolveService}. If there are 3662 * no matching services, an empty list or null is returned. 3663 * 3664 * @see #GET_META_DATA 3665 * @see #GET_RESOLVED_FILTER 3666 * @see #GET_SHARED_LIBRARY_FILES 3667 * @see #MATCH_ALL 3668 * @see #MATCH_DISABLED_COMPONENTS 3669 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3670 * @see #MATCH_DEFAULT_ONLY 3671 * @see #MATCH_ENCRYPTION_AWARE 3672 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3673 * @see #MATCH_ENCRYPTION_UNAWARE 3674 * @see #MATCH_SYSTEM_ONLY 3675 * @see #MATCH_UNINSTALLED_PACKAGES 3676 * 3677 * @hide 3678 */ 3679 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, 3680 @ResolveInfoFlags int flags, @UserIdInt int userId); 3681 3682 /** 3683 * Retrieve all providers that can match the given intent. 3684 * 3685 * @param intent An intent containing all of the desired specification 3686 * (action, data, type, category, and/or component). 3687 * @param flags Additional option flags. Use any combination of 3688 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3689 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3690 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3691 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3692 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3693 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3694 * to modify the data returned. 3695 * @param userId The user id. 3696 * 3697 * @return Returns a List of ResolveInfo objects containing one entry for each 3698 * matching provider, ordered from best to worst. If there are no 3699 * matching services, an empty list or null is returned. 3700 * 3701 * @see #GET_META_DATA 3702 * @see #GET_RESOLVED_FILTER 3703 * @see #GET_SHARED_LIBRARY_FILES 3704 * @see #MATCH_ALL 3705 * @see #MATCH_DISABLED_COMPONENTS 3706 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3707 * @see #MATCH_DEFAULT_ONLY 3708 * @see #MATCH_ENCRYPTION_AWARE 3709 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3710 * @see #MATCH_ENCRYPTION_UNAWARE 3711 * @see #MATCH_SYSTEM_ONLY 3712 * @see #MATCH_UNINSTALLED_PACKAGES 3713 * 3714 * @hide 3715 */ 3716 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( 3717 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId); 3718 3719 /** 3720 * Retrieve all providers that can match the given intent. 3721 * 3722 * @param intent An intent containing all of the desired specification 3723 * (action, data, type, category, and/or component). 3724 * @param flags Additional option flags. Use any combination of 3725 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, 3726 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, 3727 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3728 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, 3729 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, 3730 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} 3731 * to modify the data returned. 3732 * 3733 * @return Returns a List of ResolveInfo objects containing one entry for each 3734 * matching provider, ordered from best to worst. If there are no 3735 * matching services, an empty list or null is returned. 3736 * 3737 * @see #GET_META_DATA 3738 * @see #GET_RESOLVED_FILTER 3739 * @see #GET_SHARED_LIBRARY_FILES 3740 * @see #MATCH_ALL 3741 * @see #MATCH_DISABLED_COMPONENTS 3742 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3743 * @see #MATCH_DEFAULT_ONLY 3744 * @see #MATCH_ENCRYPTION_AWARE 3745 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3746 * @see #MATCH_ENCRYPTION_UNAWARE 3747 * @see #MATCH_SYSTEM_ONLY 3748 * @see #MATCH_UNINSTALLED_PACKAGES 3749 */ 3750 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, 3751 @ResolveInfoFlags int flags); 3752 3753 /** 3754 * Find a single content provider by its base path name. 3755 * 3756 * @param name The name of the provider to find. 3757 * @param flags Additional option flags. Use any combination of 3758 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 3759 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 3760 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3761 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 3762 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 3763 * {@link #MATCH_UNINSTALLED_PACKAGES} 3764 * to modify the data returned. 3765 * 3766 * @return A {@link ProviderInfo} object containing information about the provider. 3767 * If a provider was not found, returns null. 3768 * 3769 * @see #GET_META_DATA 3770 * @see #GET_SHARED_LIBRARY_FILES 3771 * @see #MATCH_ALL 3772 * @see #MATCH_DEBUG_TRIAGED_MISSING 3773 * @see #MATCH_DEFAULT_ONLY 3774 * @see #MATCH_DISABLED_COMPONENTS 3775 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3776 * @see #MATCH_ENCRYPTION_AWARE 3777 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3778 * @see #MATCH_ENCRYPTION_UNAWARE 3779 * @see #MATCH_SYSTEM_ONLY 3780 * @see #MATCH_UNINSTALLED_PACKAGES 3781 */ 3782 public abstract ProviderInfo resolveContentProvider(String name, 3783 @ComponentInfoFlags int flags); 3784 3785 /** 3786 * Find a single content provider by its base path name. 3787 * 3788 * @param name The name of the provider to find. 3789 * @param flags Additional option flags. Use any combination of 3790 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 3791 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 3792 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3793 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 3794 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 3795 * {@link #MATCH_UNINSTALLED_PACKAGES} 3796 * to modify the data returned. 3797 * @param userId The user id. 3798 * 3799 * @return A {@link ProviderInfo} object containing information about the provider. 3800 * If a provider was not found, returns null. 3801 * 3802 * @see #GET_META_DATA 3803 * @see #GET_SHARED_LIBRARY_FILES 3804 * @see #MATCH_ALL 3805 * @see #MATCH_DEBUG_TRIAGED_MISSING 3806 * @see #MATCH_DEFAULT_ONLY 3807 * @see #MATCH_DISABLED_COMPONENTS 3808 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3809 * @see #MATCH_ENCRYPTION_AWARE 3810 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3811 * @see #MATCH_ENCRYPTION_UNAWARE 3812 * @see #MATCH_SYSTEM_ONLY 3813 * @see #MATCH_UNINSTALLED_PACKAGES 3814 * 3815 * @hide 3816 */ 3817 public abstract ProviderInfo resolveContentProviderAsUser(String name, 3818 @ComponentInfoFlags int flags, @UserIdInt int userId); 3819 3820 /** 3821 * Retrieve content provider information. 3822 * 3823 * <p><em>Note: unlike most other methods, an empty result set is indicated 3824 * by a null return instead of an empty list.</em> 3825 * 3826 * @param processName If non-null, limits the returned providers to only 3827 * those that are hosted by the given process. If null, 3828 * all content providers are returned. 3829 * @param uid If <var>processName</var> is non-null, this is the required 3830 * uid owning the requested content providers. 3831 * @param flags Additional option flags. Use any combination of 3832 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, 3833 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, 3834 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 3835 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, 3836 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} 3837 * {@link #MATCH_UNINSTALLED_PACKAGES} 3838 * to modify the data returned. 3839 * 3840 * @return A list of {@link ProviderInfo} objects containing one entry for 3841 * each provider either matching <var>processName</var> or, if 3842 * <var>processName</var> is null, all known content providers. 3843 * <em>If there are no matching providers, null is returned.</em> 3844 * 3845 * @see #GET_META_DATA 3846 * @see #GET_SHARED_LIBRARY_FILES 3847 * @see #MATCH_ALL 3848 * @see #MATCH_DEBUG_TRIAGED_MISSING 3849 * @see #MATCH_DEFAULT_ONLY 3850 * @see #MATCH_DISABLED_COMPONENTS 3851 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 3852 * @see #MATCH_ENCRYPTION_AWARE 3853 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE 3854 * @see #MATCH_ENCRYPTION_UNAWARE 3855 * @see #MATCH_SYSTEM_ONLY 3856 * @see #MATCH_UNINSTALLED_PACKAGES 3857 */ 3858 public abstract List<ProviderInfo> queryContentProviders( 3859 String processName, int uid, @ComponentInfoFlags int flags); 3860 3861 /** 3862 * Retrieve all of the information we know about a particular 3863 * instrumentation class. 3864 * 3865 * @param className The full name (i.e. 3866 * com.google.apps.contacts.InstrumentList) of an 3867 * Instrumentation class. 3868 * @param flags Additional option flags. Use any combination of 3869 * {@link #GET_META_DATA} 3870 * to modify the data returned. 3871 * 3872 * @return An {@link InstrumentationInfo} object containing information about the 3873 * instrumentation. 3874 * @throws NameNotFoundException if a package with the given name cannot be 3875 * found on the system. 3876 * 3877 * @see #GET_META_DATA 3878 */ 3879 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className, 3880 @InstrumentationInfoFlags int flags) throws NameNotFoundException; 3881 3882 /** 3883 * Retrieve information about available instrumentation code. May be used 3884 * to retrieve either all instrumentation code, or only the code targeting 3885 * a particular package. 3886 * 3887 * @param targetPackage If null, all instrumentation is returned; only the 3888 * instrumentation targeting this package name is 3889 * returned. 3890 * @param flags Additional option flags. Use any combination of 3891 * {@link #GET_META_DATA} 3892 * to modify the data returned. 3893 * 3894 * @return A list of {@link InstrumentationInfo} objects containing one 3895 * entry for each matching instrumentation. If there are no 3896 * instrumentation available, returns and empty list. 3897 * 3898 * @see #GET_META_DATA 3899 */ 3900 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage, 3901 @InstrumentationInfoFlags int flags); 3902 3903 /** 3904 * Retrieve an image from a package. This is a low-level API used by 3905 * the various package manager info structures (such as 3906 * {@link ComponentInfo} to implement retrieval of their associated 3907 * icon. 3908 * 3909 * @param packageName The name of the package that this icon is coming from. 3910 * Cannot be null. 3911 * @param resid The resource identifier of the desired image. Cannot be 0. 3912 * @param appInfo Overall information about <var>packageName</var>. This 3913 * may be null, in which case the application information will be retrieved 3914 * for you if needed; if you already have this information around, it can 3915 * be much more efficient to supply it here. 3916 * 3917 * @return Returns a Drawable holding the requested image. Returns null if 3918 * an image could not be found for any reason. 3919 */ 3920 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, 3921 ApplicationInfo appInfo); 3922 3923 /** 3924 * Retrieve the icon associated with an activity. Given the full name of 3925 * an activity, retrieves the information about it and calls 3926 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. 3927 * If the activity cannot be found, NameNotFoundException is thrown. 3928 * 3929 * @param activityName Name of the activity whose icon is to be retrieved. 3930 * 3931 * @return Returns the image of the icon, or the default activity icon if 3932 * it could not be found. Does not return null. 3933 * @throws NameNotFoundException Thrown if the resources for the given 3934 * activity could not be loaded. 3935 * 3936 * @see #getActivityIcon(Intent) 3937 */ 3938 public abstract Drawable getActivityIcon(ComponentName activityName) 3939 throws NameNotFoundException; 3940 3941 /** 3942 * Retrieve the icon associated with an Intent. If intent.getClassName() is 3943 * set, this simply returns the result of 3944 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's 3945 * component and returns the icon associated with the resolved component. 3946 * If intent.getClassName() cannot be found or the Intent cannot be resolved 3947 * to a component, NameNotFoundException is thrown. 3948 * 3949 * @param intent The intent for which you would like to retrieve an icon. 3950 * 3951 * @return Returns the image of the icon, or the default activity icon if 3952 * it could not be found. Does not return null. 3953 * @throws NameNotFoundException Thrown if the resources for application 3954 * matching the given intent could not be loaded. 3955 * 3956 * @see #getActivityIcon(ComponentName) 3957 */ 3958 public abstract Drawable getActivityIcon(Intent intent) 3959 throws NameNotFoundException; 3960 3961 /** 3962 * Retrieve the banner associated with an activity. Given the full name of 3963 * an activity, retrieves the information about it and calls 3964 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its 3965 * banner. If the activity cannot be found, NameNotFoundException is thrown. 3966 * 3967 * @param activityName Name of the activity whose banner is to be retrieved. 3968 * @return Returns the image of the banner, or null if the activity has no 3969 * banner specified. 3970 * @throws NameNotFoundException Thrown if the resources for the given 3971 * activity could not be loaded. 3972 * @see #getActivityBanner(Intent) 3973 */ 3974 public abstract Drawable getActivityBanner(ComponentName activityName) 3975 throws NameNotFoundException; 3976 3977 /** 3978 * Retrieve the banner associated with an Intent. If intent.getClassName() 3979 * is set, this simply returns the result of 3980 * getActivityBanner(intent.getClassName()). Otherwise it resolves the 3981 * intent's component and returns the banner associated with the resolved 3982 * component. If intent.getClassName() cannot be found or the Intent cannot 3983 * be resolved to a component, NameNotFoundException is thrown. 3984 * 3985 * @param intent The intent for which you would like to retrieve a banner. 3986 * @return Returns the image of the banner, or null if the activity has no 3987 * banner specified. 3988 * @throws NameNotFoundException Thrown if the resources for application 3989 * matching the given intent could not be loaded. 3990 * @see #getActivityBanner(ComponentName) 3991 */ 3992 public abstract Drawable getActivityBanner(Intent intent) 3993 throws NameNotFoundException; 3994 3995 /** 3996 * Return the generic icon for an activity that is used when no specific 3997 * icon is defined. 3998 * 3999 * @return Drawable Image of the icon. 4000 */ 4001 public abstract Drawable getDefaultActivityIcon(); 4002 4003 /** 4004 * Retrieve the icon associated with an application. If it has not defined 4005 * an icon, the default app icon is returned. Does not return null. 4006 * 4007 * @param info Information about application being queried. 4008 * 4009 * @return Returns the image of the icon, or the default application icon 4010 * if it could not be found. 4011 * 4012 * @see #getApplicationIcon(String) 4013 */ 4014 public abstract Drawable getApplicationIcon(ApplicationInfo info); 4015 4016 /** 4017 * Retrieve the icon associated with an application. Given the name of the 4018 * application's package, retrieves the information about it and calls 4019 * getApplicationIcon() to return its icon. If the application cannot be 4020 * found, NameNotFoundException is thrown. 4021 * 4022 * @param packageName Name of the package whose application icon is to be 4023 * retrieved. 4024 * 4025 * @return Returns the image of the icon, or the default application icon 4026 * if it could not be found. Does not return null. 4027 * @throws NameNotFoundException Thrown if the resources for the given 4028 * application could not be loaded. 4029 * 4030 * @see #getApplicationIcon(ApplicationInfo) 4031 */ 4032 public abstract Drawable getApplicationIcon(String packageName) 4033 throws NameNotFoundException; 4034 4035 /** 4036 * Retrieve the banner associated with an application. 4037 * 4038 * @param info Information about application being queried. 4039 * @return Returns the image of the banner or null if the application has no 4040 * banner specified. 4041 * @see #getApplicationBanner(String) 4042 */ 4043 public abstract Drawable getApplicationBanner(ApplicationInfo info); 4044 4045 /** 4046 * Retrieve the banner associated with an application. Given the name of the 4047 * application's package, retrieves the information about it and calls 4048 * getApplicationIcon() to return its banner. If the application cannot be 4049 * found, NameNotFoundException is thrown. 4050 * 4051 * @param packageName Name of the package whose application banner is to be 4052 * retrieved. 4053 * @return Returns the image of the banner or null if the application has no 4054 * banner specified. 4055 * @throws NameNotFoundException Thrown if the resources for the given 4056 * application could not be loaded. 4057 * @see #getApplicationBanner(ApplicationInfo) 4058 */ 4059 public abstract Drawable getApplicationBanner(String packageName) 4060 throws NameNotFoundException; 4061 4062 /** 4063 * Retrieve the logo associated with an activity. Given the full name of an 4064 * activity, retrieves the information about it and calls 4065 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its 4066 * logo. If the activity cannot be found, NameNotFoundException is thrown. 4067 * 4068 * @param activityName Name of the activity whose logo is to be retrieved. 4069 * @return Returns the image of the logo or null if the activity has no logo 4070 * specified. 4071 * @throws NameNotFoundException Thrown if the resources for the given 4072 * activity could not be loaded. 4073 * @see #getActivityLogo(Intent) 4074 */ 4075 public abstract Drawable getActivityLogo(ComponentName activityName) 4076 throws NameNotFoundException; 4077 4078 /** 4079 * Retrieve the logo associated with an Intent. If intent.getClassName() is 4080 * set, this simply returns the result of 4081 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's 4082 * component and returns the logo associated with the resolved component. 4083 * If intent.getClassName() cannot be found or the Intent cannot be resolved 4084 * to a component, NameNotFoundException is thrown. 4085 * 4086 * @param intent The intent for which you would like to retrieve a logo. 4087 * 4088 * @return Returns the image of the logo, or null if the activity has no 4089 * logo specified. 4090 * 4091 * @throws NameNotFoundException Thrown if the resources for application 4092 * matching the given intent could not be loaded. 4093 * 4094 * @see #getActivityLogo(ComponentName) 4095 */ 4096 public abstract Drawable getActivityLogo(Intent intent) 4097 throws NameNotFoundException; 4098 4099 /** 4100 * Retrieve the logo associated with an application. If it has not specified 4101 * a logo, this method returns null. 4102 * 4103 * @param info Information about application being queried. 4104 * 4105 * @return Returns the image of the logo, or null if no logo is specified 4106 * by the application. 4107 * 4108 * @see #getApplicationLogo(String) 4109 */ 4110 public abstract Drawable getApplicationLogo(ApplicationInfo info); 4111 4112 /** 4113 * Retrieve the logo associated with an application. Given the name of the 4114 * application's package, retrieves the information about it and calls 4115 * getApplicationLogo() to return its logo. If the application cannot be 4116 * found, NameNotFoundException is thrown. 4117 * 4118 * @param packageName Name of the package whose application logo is to be 4119 * retrieved. 4120 * 4121 * @return Returns the image of the logo, or null if no application logo 4122 * has been specified. 4123 * 4124 * @throws NameNotFoundException Thrown if the resources for the given 4125 * application could not be loaded. 4126 * 4127 * @see #getApplicationLogo(ApplicationInfo) 4128 */ 4129 public abstract Drawable getApplicationLogo(String packageName) 4130 throws NameNotFoundException; 4131 4132 /** 4133 * If the target user is a managed profile of the calling user or if the 4134 * target user is the caller and is itself a managed profile, then this 4135 * returns a badged copy of the given icon to be able to distinguish it from 4136 * the original icon. For badging an arbitrary drawable use 4137 * {@link #getUserBadgedDrawableForDensity( 4138 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. 4139 * <p> 4140 * If the original drawable is a BitmapDrawable and the backing bitmap is 4141 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging 4142 * is performed in place and the original drawable is returned. 4143 * </p> 4144 * 4145 * @param icon The icon to badge. 4146 * @param user The target user. 4147 * @return A drawable that combines the original icon and a badge as 4148 * determined by the system. 4149 */ 4150 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); 4151 4152 /** 4153 * If the target user is a managed profile of the calling user or the caller 4154 * is itself a managed profile, then this returns a badged copy of the given 4155 * drawable allowing the user to distinguish it from the original drawable. 4156 * The caller can specify the location in the bounds of the drawable to be 4157 * badged where the badge should be applied as well as the density of the 4158 * badge to be used. 4159 * <p> 4160 * If the original drawable is a BitmapDrawable and the backing bitmap is 4161 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading 4162 * is performed in place and the original drawable is returned. 4163 * </p> 4164 * 4165 * @param drawable The drawable to badge. 4166 * @param user The target user. 4167 * @param badgeLocation Where in the bounds of the badged drawable to place 4168 * the badge. If not provided, the badge is applied on top of the entire 4169 * drawable being badged. 4170 * @param badgeDensity The optional desired density for the badge as per 4171 * {@link android.util.DisplayMetrics#densityDpi}. If not provided, 4172 * the density of the display is used. 4173 * @return A drawable that combines the original drawable and a badge as 4174 * determined by the system. 4175 */ 4176 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, 4177 UserHandle user, Rect badgeLocation, int badgeDensity); 4178 4179 /** 4180 * If the target user is a managed profile of the calling user or the caller 4181 * is itself a managed profile, then this returns a drawable to use as a small 4182 * icon to include in a view to distinguish it from the original icon. 4183 * 4184 * @param user The target user. 4185 * @param density The optional desired density for the badge as per 4186 * {@link android.util.DisplayMetrics#densityDpi}. If not provided 4187 * the density of the current display is used. 4188 * @return the drawable or null if no drawable is required. 4189 * @hide 4190 */ 4191 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); 4192 4193 /** 4194 * If the target user is a managed profile of the calling user or the caller 4195 * is itself a managed profile, then this returns a copy of the label with 4196 * badging for accessibility services like talkback. E.g. passing in "Email" 4197 * and it might return "Work Email" for Email in the work profile. 4198 * 4199 * @param label The label to change. 4200 * @param user The target user. 4201 * @return A label that combines the original label and a badge as 4202 * determined by the system. 4203 */ 4204 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); 4205 4206 /** 4207 * Retrieve text from a package. This is a low-level API used by 4208 * the various package manager info structures (such as 4209 * {@link ComponentInfo} to implement retrieval of their associated 4210 * labels and other text. 4211 * 4212 * @param packageName The name of the package that this text is coming from. 4213 * Cannot be null. 4214 * @param resid The resource identifier of the desired text. Cannot be 0. 4215 * @param appInfo Overall information about <var>packageName</var>. This 4216 * may be null, in which case the application information will be retrieved 4217 * for you if needed; if you already have this information around, it can 4218 * be much more efficient to supply it here. 4219 * 4220 * @return Returns a CharSequence holding the requested text. Returns null 4221 * if the text could not be found for any reason. 4222 */ 4223 public abstract CharSequence getText(String packageName, @StringRes int resid, 4224 ApplicationInfo appInfo); 4225 4226 /** 4227 * Retrieve an XML file from a package. This is a low-level API used to 4228 * retrieve XML meta data. 4229 * 4230 * @param packageName The name of the package that this xml is coming from. 4231 * Cannot be null. 4232 * @param resid The resource identifier of the desired xml. Cannot be 0. 4233 * @param appInfo Overall information about <var>packageName</var>. This 4234 * may be null, in which case the application information will be retrieved 4235 * for you if needed; if you already have this information around, it can 4236 * be much more efficient to supply it here. 4237 * 4238 * @return Returns an XmlPullParser allowing you to parse out the XML 4239 * data. Returns null if the xml resource could not be found for any 4240 * reason. 4241 */ 4242 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, 4243 ApplicationInfo appInfo); 4244 4245 /** 4246 * Return the label to use for this application. 4247 * 4248 * @return Returns the label associated with this application, or null if 4249 * it could not be found for any reason. 4250 * @param info The application to get the label of. 4251 */ 4252 public abstract CharSequence getApplicationLabel(ApplicationInfo info); 4253 4254 /** 4255 * Retrieve the resources associated with an activity. Given the full 4256 * name of an activity, retrieves the information about it and calls 4257 * getResources() to return its application's resources. If the activity 4258 * cannot be found, NameNotFoundException is thrown. 4259 * 4260 * @param activityName Name of the activity whose resources are to be 4261 * retrieved. 4262 * 4263 * @return Returns the application's Resources. 4264 * @throws NameNotFoundException Thrown if the resources for the given 4265 * application could not be loaded. 4266 * 4267 * @see #getResourcesForApplication(ApplicationInfo) 4268 */ 4269 public abstract Resources getResourcesForActivity(ComponentName activityName) 4270 throws NameNotFoundException; 4271 4272 /** 4273 * Retrieve the resources for an application. Throws NameNotFoundException 4274 * if the package is no longer installed. 4275 * 4276 * @param app Information about the desired application. 4277 * 4278 * @return Returns the application's Resources. 4279 * @throws NameNotFoundException Thrown if the resources for the given 4280 * application could not be loaded (most likely because it was uninstalled). 4281 */ 4282 public abstract Resources getResourcesForApplication(ApplicationInfo app) 4283 throws NameNotFoundException; 4284 4285 /** 4286 * Retrieve the resources associated with an application. Given the full 4287 * package name of an application, retrieves the information about it and 4288 * calls getResources() to return its application's resources. If the 4289 * appPackageName cannot be found, NameNotFoundException is thrown. 4290 * 4291 * @param appPackageName Package name of the application whose resources 4292 * are to be retrieved. 4293 * 4294 * @return Returns the application's Resources. 4295 * @throws NameNotFoundException Thrown if the resources for the given 4296 * application could not be loaded. 4297 * 4298 * @see #getResourcesForApplication(ApplicationInfo) 4299 */ 4300 public abstract Resources getResourcesForApplication(String appPackageName) 4301 throws NameNotFoundException; 4302 4303 /** @hide */ 4304 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, 4305 @UserIdInt int userId) throws NameNotFoundException; 4306 4307 /** 4308 * Retrieve overall information about an application package defined 4309 * in a package archive file 4310 * 4311 * @param archiveFilePath The path to the archive file 4312 * @param flags Additional option flags. Use any combination of 4313 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 4314 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 4315 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 4316 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 4317 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 4318 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 4319 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 4320 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 4321 * {@link #MATCH_UNINSTALLED_PACKAGES} 4322 * to modify the data returned. 4323 * 4324 * @return A PackageInfo object containing information about the 4325 * package archive. If the package could not be parsed, 4326 * returns null. 4327 * 4328 * @see #GET_ACTIVITIES 4329 * @see #GET_CONFIGURATIONS 4330 * @see #GET_GIDS 4331 * @see #GET_INSTRUMENTATION 4332 * @see #GET_INTENT_FILTERS 4333 * @see #GET_META_DATA 4334 * @see #GET_PERMISSIONS 4335 * @see #GET_PROVIDERS 4336 * @see #GET_RECEIVERS 4337 * @see #GET_SERVICES 4338 * @see #GET_SHARED_LIBRARY_FILES 4339 * @see #GET_SIGNATURES 4340 * @see #GET_URI_PERMISSION_PATTERNS 4341 * @see #MATCH_DISABLED_COMPONENTS 4342 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 4343 * @see #MATCH_UNINSTALLED_PACKAGES 4344 * 4345 */ 4346 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) { 4347 final PackageParser parser = new PackageParser(); 4348 final File apkFile = new File(archiveFilePath); 4349 try { 4350 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); 4351 if ((flags & GET_SIGNATURES) != 0) { 4352 parser.collectCertificates(pkg, 0); 4353 } 4354 PackageUserState state = new PackageUserState(); 4355 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); 4356 } catch (PackageParserException e) { 4357 return null; 4358 } 4359 } 4360 4361 /** 4362 * @hide Install a package. Since this may take a little while, the result 4363 * will be posted back to the given observer. An installation will 4364 * fail if the calling context lacks the 4365 * {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if 4366 * the package named in the package file's manifest is already 4367 * installed, or if there's no space available on the device. 4368 * @param packageURI The location of the package file to install. This can 4369 * be a 'file:' or a 'content:' URI. 4370 * @param observer An observer callback to get notified when the package 4371 * installation is complete. 4372 * {@link IPackageInstallObserver#packageInstalled(String, int)} 4373 * will be called when that happens. This parameter must not be 4374 * null. 4375 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4376 * {@link #INSTALL_REPLACE_EXISTING}, 4377 * {@link #INSTALL_ALLOW_TEST}. 4378 * @param installerPackageName Optional package name of the application that 4379 * is performing the installation. This identifies which market 4380 * the package came from. 4381 * @deprecated Use {@link #installPackage(Uri, PackageInstallObserver, int, 4382 * String)} instead. This method will continue to be supported 4383 * but the older observer interface will not get additional 4384 * failure details. 4385 */ 4386 public abstract void installPackage( 4387 Uri packageURI, IPackageInstallObserver observer, int flags, 4388 String installerPackageName); 4389 4390 /** 4391 * Similar to 4392 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 4393 * with an extra verification file provided. 4394 * 4395 * @param packageURI The location of the package file to install. This can 4396 * be a 'file:' or a 'content:' URI. 4397 * @param observer An observer callback to get notified when the package 4398 * installation is complete. 4399 * {@link IPackageInstallObserver#packageInstalled(String, int)} 4400 * will be called when that happens. This parameter must not be 4401 * null. 4402 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4403 * {@link #INSTALL_REPLACE_EXISTING}, 4404 * {@link #INSTALL_ALLOW_TEST}. 4405 * @param installerPackageName Optional package name of the application that 4406 * is performing the installation. This identifies which market 4407 * the package came from. 4408 * @param verificationURI The location of the supplementary verification 4409 * file. This can be a 'file:' or a 'content:' URI. May be 4410 * {@code null}. 4411 * @param encryptionParams if the package to be installed is encrypted, 4412 * these parameters describing the encryption and authentication 4413 * used. May be {@code null}. 4414 * @hide 4415 * @deprecated Use {@link #installPackageWithVerification(Uri, 4416 * PackageInstallObserver, int, String, Uri, 4417 * ContainerEncryptionParams)} instead. This method will 4418 * continue to be supported but the older observer interface 4419 * will not get additional failure details. 4420 */ 4421 public abstract void installPackageWithVerification(Uri packageURI, 4422 IPackageInstallObserver observer, int flags, String installerPackageName, 4423 Uri verificationURI, 4424 ContainerEncryptionParams encryptionParams); 4425 4426 /** 4427 * Similar to 4428 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 4429 * with an extra verification information provided. 4430 * 4431 * @param packageURI The location of the package file to install. This can 4432 * be a 'file:' or a 'content:' URI. 4433 * @param observer An observer callback to get notified when the package 4434 * installation is complete. 4435 * {@link IPackageInstallObserver#packageInstalled(String, int)} 4436 * will be called when that happens. This parameter must not be 4437 * null. 4438 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4439 * {@link #INSTALL_REPLACE_EXISTING}, 4440 * {@link #INSTALL_ALLOW_TEST}. 4441 * @param installerPackageName Optional package name of the application that 4442 * is performing the installation. This identifies which market 4443 * the package came from. 4444 * @param verificationParams an object that holds signal information to 4445 * assist verification. May be {@code null}. 4446 * @param encryptionParams if the package to be installed is encrypted, 4447 * these parameters describing the encryption and authentication 4448 * used. May be {@code null}. 4449 * @hide 4450 * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri, 4451 * PackageInstallObserver, int, String, VerificationParams, 4452 * ContainerEncryptionParams)} instead. This method will 4453 * continue to be supported but the older observer interface 4454 * will not get additional failure details. 4455 */ 4456 @Deprecated 4457 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, 4458 IPackageInstallObserver observer, int flags, String installerPackageName, 4459 VerificationParams verificationParams, 4460 ContainerEncryptionParams encryptionParams); 4461 4462 // Package-install variants that take the new, expanded form of observer interface. 4463 // Note that these *also* take the original observer type and will redundantly 4464 // report the same information to that observer if supplied; but it is not required. 4465 4466 /** 4467 * @hide 4468 * 4469 * Install a package. Since this may take a little while, the result will 4470 * be posted back to the given observer. An installation will fail if the calling context 4471 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the 4472 * package named in the package file's manifest is already installed, or if there's no space 4473 * available on the device. 4474 * 4475 * @param packageURI The location of the package file to install. This can be a 'file:' or a 4476 * 'content:' URI. 4477 * @param observer An observer callback to get notified when the package installation is 4478 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 4479 * called when that happens. This parameter must not be null. 4480 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4481 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 4482 * @param installerPackageName Optional package name of the application that is performing the 4483 * installation. This identifies which market the package came from. 4484 */ 4485 public abstract void installPackage( 4486 Uri packageURI, PackageInstallObserver observer, 4487 int flags, String installerPackageName); 4488 4489 4490 /** 4491 * @hide 4492 * Install a package. Since this may take a little while, the result will be 4493 * posted back to the given observer. An installation will fail if the package named 4494 * in the package file's manifest is already installed, or if there's no space 4495 * available on the device. 4496 * @param packageURI The location of the package file to install. This can be a 'file:' or a 4497 * 'content:' URI. 4498 * @param observer An observer callback to get notified when the package installation is 4499 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 4500 * called when that happens. This parameter must not be null. 4501 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4502 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 4503 * @param installerPackageName Optional package name of the application that is performing the 4504 * installation. This identifies which market the package came from. 4505 * @param userId The user id. 4506 */ 4507 @RequiresPermission(anyOf = { 4508 Manifest.permission.INSTALL_PACKAGES, 4509 Manifest.permission.INTERACT_ACROSS_USERS_FULL}) 4510 public abstract void installPackageAsUser( 4511 Uri packageURI, PackageInstallObserver observer, int flags, 4512 String installerPackageName, @UserIdInt int userId); 4513 4514 /** 4515 * Similar to 4516 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 4517 * with an extra verification file provided. 4518 * 4519 * @param packageURI The location of the package file to install. This can 4520 * be a 'file:' or a 'content:' URI. 4521 * @param observer An observer callback to get notified when the package installation is 4522 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 4523 * called when that happens. This parameter must not be null. 4524 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4525 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 4526 * @param installerPackageName Optional package name of the application that 4527 * is performing the installation. This identifies which market 4528 * the package came from. 4529 * @param verificationURI The location of the supplementary verification 4530 * file. This can be a 'file:' or a 'content:' URI. May be 4531 * {@code null}. 4532 * @param encryptionParams if the package to be installed is encrypted, 4533 * these parameters describing the encryption and authentication 4534 * used. May be {@code null}. 4535 * @hide 4536 */ 4537 public abstract void installPackageWithVerification(Uri packageURI, 4538 PackageInstallObserver observer, int flags, String installerPackageName, 4539 Uri verificationURI, 4540 ContainerEncryptionParams encryptionParams); 4541 4542 /** 4543 * Similar to 4544 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but 4545 * with an extra verification information provided. 4546 * 4547 * @param packageURI The location of the package file to install. This can 4548 * be a 'file:' or a 'content:' URI. 4549 * @param observer An observer callback to get notified when the package installation is 4550 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be 4551 * called when that happens. This parameter must not be null. 4552 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, 4553 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. 4554 * @param installerPackageName Optional package name of the application that 4555 * is performing the installation. This identifies which market 4556 * the package came from. 4557 * @param verificationParams an object that holds signal information to 4558 * assist verification. May be {@code null}. 4559 * @param encryptionParams if the package to be installed is encrypted, 4560 * these parameters describing the encryption and authentication 4561 * used. May be {@code null}. 4562 * 4563 * @hide 4564 */ 4565 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, 4566 PackageInstallObserver observer, int flags, String installerPackageName, 4567 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams); 4568 4569 /** 4570 * If there is already an application with the given package name installed 4571 * on the system for other users, also install it for the calling user. 4572 * @hide 4573 */ 4574 public abstract int installExistingPackage(String packageName) throws NameNotFoundException; 4575 4576 /** 4577 * If there is already an application with the given package name installed 4578 * on the system for other users, also install it for the specified user. 4579 * @hide 4580 */ 4581 @RequiresPermission(anyOf = { 4582 Manifest.permission.INSTALL_PACKAGES, 4583 Manifest.permission.INTERACT_ACROSS_USERS_FULL}) 4584 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) 4585 throws NameNotFoundException; 4586 4587 /** 4588 * Allows a package listening to the 4589 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification 4590 * broadcast} to respond to the package manager. The response must include 4591 * the {@code verificationCode} which is one of 4592 * {@link PackageManager#VERIFICATION_ALLOW} or 4593 * {@link PackageManager#VERIFICATION_REJECT}. 4594 * 4595 * @param id pending package identifier as passed via the 4596 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. 4597 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} 4598 * or {@link PackageManager#VERIFICATION_REJECT}. 4599 * @throws SecurityException if the caller does not have the 4600 * PACKAGE_VERIFICATION_AGENT permission. 4601 */ 4602 public abstract void verifyPendingInstall(int id, int verificationCode); 4603 4604 /** 4605 * Allows a package listening to the 4606 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification 4607 * broadcast} to extend the default timeout for a response and declare what 4608 * action to perform after the timeout occurs. The response must include 4609 * the {@code verificationCodeAtTimeout} which is one of 4610 * {@link PackageManager#VERIFICATION_ALLOW} or 4611 * {@link PackageManager#VERIFICATION_REJECT}. 4612 * 4613 * This method may only be called once per package id. Additional calls 4614 * will have no effect. 4615 * 4616 * @param id pending package identifier as passed via the 4617 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. 4618 * @param verificationCodeAtTimeout either 4619 * {@link PackageManager#VERIFICATION_ALLOW} or 4620 * {@link PackageManager#VERIFICATION_REJECT}. If 4621 * {@code verificationCodeAtTimeout} is neither 4622 * {@link PackageManager#VERIFICATION_ALLOW} or 4623 * {@link PackageManager#VERIFICATION_REJECT}, then 4624 * {@code verificationCodeAtTimeout} will default to 4625 * {@link PackageManager#VERIFICATION_REJECT}. 4626 * @param millisecondsToDelay the amount of time requested for the timeout. 4627 * Must be positive and less than 4628 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If 4629 * {@code millisecondsToDelay} is out of bounds, 4630 * {@code millisecondsToDelay} will be set to the closest in 4631 * bounds value; namely, 0 or 4632 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. 4633 * @throws SecurityException if the caller does not have the 4634 * PACKAGE_VERIFICATION_AGENT permission. 4635 */ 4636 public abstract void extendVerificationTimeout(int id, 4637 int verificationCodeAtTimeout, long millisecondsToDelay); 4638 4639 /** 4640 * Allows a package listening to the 4641 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION intent filter verification 4642 * broadcast} to respond to the package manager. The response must include 4643 * the {@code verificationCode} which is one of 4644 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or 4645 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. 4646 * 4647 * @param verificationId pending package identifier as passed via the 4648 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. 4649 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} 4650 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. 4651 * @param outFailedDomains a list of failed domains if the verificationCode is 4652 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; 4653 * @throws SecurityException if the caller does not have the 4654 * INTENT_FILTER_VERIFICATION_AGENT permission. 4655 * 4656 * @hide 4657 */ 4658 @SystemApi 4659 public abstract void verifyIntentFilter(int verificationId, int verificationCode, 4660 List<String> outFailedDomains); 4661 4662 /** 4663 * Get the status of a Domain Verification Result for an IntentFilter. This is 4664 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and 4665 * {@link android.content.IntentFilter#getAutoVerify()} 4666 * 4667 * This is used by the ResolverActivity to change the status depending on what the User select 4668 * in the Disambiguation Dialog and also used by the Settings App for changing the default App 4669 * for a domain. 4670 * 4671 * @param packageName The package name of the Activity associated with the IntentFilter. 4672 * @param userId The user id. 4673 * 4674 * @return The status to set to. This can be 4675 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or 4676 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or 4677 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or 4678 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} 4679 * 4680 * @hide 4681 */ 4682 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId); 4683 4684 /** 4685 * Allow to change the status of a Intent Verification status for all IntentFilter of an App. 4686 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and 4687 * {@link android.content.IntentFilter#getAutoVerify()} 4688 * 4689 * This is used by the ResolverActivity to change the status depending on what the User select 4690 * in the Disambiguation Dialog and also used by the Settings App for changing the default App 4691 * for a domain. 4692 * 4693 * @param packageName The package name of the Activity associated with the IntentFilter. 4694 * @param status The status to set to. This can be 4695 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or 4696 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or 4697 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} 4698 * @param userId The user id. 4699 * 4700 * @return true if the status has been set. False otherwise. 4701 * 4702 * @hide 4703 */ 4704 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status, 4705 @UserIdInt int userId); 4706 4707 /** 4708 * Get the list of IntentFilterVerificationInfo for a specific package and User. 4709 * 4710 * @param packageName the package name. When this parameter is set to a non null value, 4711 * the results will be filtered by the package name provided. 4712 * Otherwise, there will be no filtering and it will return a list 4713 * corresponding for all packages 4714 * 4715 * @return a list of IntentFilterVerificationInfo for a specific package. 4716 * 4717 * @hide 4718 */ 4719 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( 4720 String packageName); 4721 4722 /** 4723 * Get the list of IntentFilter for a specific package. 4724 * 4725 * @param packageName the package name. This parameter is set to a non null value, 4726 * the list will contain all the IntentFilter for that package. 4727 * Otherwise, the list will be empty. 4728 * 4729 * @return a list of IntentFilter for a specific package. 4730 * 4731 * @hide 4732 */ 4733 public abstract List<IntentFilter> getAllIntentFilters(String packageName); 4734 4735 /** 4736 * Get the default Browser package name for a specific user. 4737 * 4738 * @param userId The user id. 4739 * 4740 * @return the package name of the default Browser for the specified user. If the user id passed 4741 * is -1 (all users) it will return a null value. 4742 * 4743 * @hide 4744 */ 4745 @TestApi 4746 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId); 4747 4748 /** 4749 * Set the default Browser package name for a specific user. 4750 * 4751 * @param packageName The package name of the default Browser. 4752 * @param userId The user id. 4753 * 4754 * @return true if the default Browser for the specified user has been set, 4755 * otherwise return false. If the user id passed is -1 (all users) this call will not 4756 * do anything and just return false. 4757 * 4758 * @hide 4759 */ 4760 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName, 4761 @UserIdInt int userId); 4762 4763 /** 4764 * Change the installer associated with a given package. There are limitations 4765 * on how the installer package can be changed; in particular: 4766 * <ul> 4767 * <li> A SecurityException will be thrown if <var>installerPackageName</var> 4768 * is not signed with the same certificate as the calling application. 4769 * <li> A SecurityException will be thrown if <var>targetPackage</var> already 4770 * has an installer package, and that installer package is not signed with 4771 * the same certificate as the calling application. 4772 * </ul> 4773 * 4774 * @param targetPackage The installed package whose installer will be changed. 4775 * @param installerPackageName The package name of the new installer. May be 4776 * null to clear the association. 4777 */ 4778 public abstract void setInstallerPackageName(String targetPackage, 4779 String installerPackageName); 4780 4781 /** 4782 * Attempts to delete a package. Since this may take a little while, the result will 4783 * be posted back to the given observer. A deletion will fail if the calling context 4784 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the 4785 * named package cannot be found, or if the named package is a "system package". 4786 * (TODO: include pointer to documentation on "system packages") 4787 * 4788 * @param packageName The name of the package to delete 4789 * @param observer An observer callback to get notified when the package deletion is 4790 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be 4791 * called when that happens. observer may be null to indicate that no callback is desired. 4792 * @param flags Possible values: {@link #DELETE_KEEP_DATA}, 4793 * {@link #DELETE_ALL_USERS}. 4794 * 4795 * @hide 4796 */ 4797 // @SystemApi 4798 public abstract void deletePackage( 4799 String packageName, IPackageDeleteObserver observer, int flags); 4800 4801 /** 4802 * Attempts to delete a package. Since this may take a little while, the result will 4803 * be posted back to the given observer. A deletion will fail if the named package cannot be 4804 * found, or if the named package is a "system package". 4805 * (TODO: include pointer to documentation on "system packages") 4806 * 4807 * @param packageName The name of the package to delete 4808 * @param observer An observer callback to get notified when the package deletion is 4809 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be 4810 * called when that happens. observer may be null to indicate that no callback is desired. 4811 * @param flags Possible values: {@link #DELETE_KEEP_DATA}, {@link #DELETE_ALL_USERS}. 4812 * @param userId The user Id 4813 * 4814 * @hide 4815 */ 4816 @RequiresPermission(anyOf = { 4817 Manifest.permission.DELETE_PACKAGES, 4818 Manifest.permission.INTERACT_ACROSS_USERS_FULL}) 4819 public abstract void deletePackageAsUser( 4820 String packageName, IPackageDeleteObserver observer, int flags, @UserIdInt int userId); 4821 4822 /** 4823 * Retrieve the package name of the application that installed a package. This identifies 4824 * which market the package came from. 4825 * 4826 * @param packageName The name of the package to query 4827 */ 4828 public abstract String getInstallerPackageName(String packageName); 4829 4830 /** 4831 * Attempts to clear the user data directory of an application. 4832 * Since this may take a little while, the result will 4833 * be posted back to the given observer. A deletion will fail if the 4834 * named package cannot be found, or if the named package is a "system package". 4835 * 4836 * @param packageName The name of the package 4837 * @param observer An observer callback to get notified when the operation is finished 4838 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 4839 * will be called when that happens. observer may be null to indicate that 4840 * no callback is desired. 4841 * 4842 * @hide 4843 */ 4844 public abstract void clearApplicationUserData(String packageName, 4845 IPackageDataObserver observer); 4846 /** 4847 * Attempts to delete the cache files associated with an application. 4848 * Since this may take a little while, the result will 4849 * be posted back to the given observer. A deletion will fail if the calling context 4850 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the 4851 * named package cannot be found, or if the named package is a "system package". 4852 * 4853 * @param packageName The name of the package to delete 4854 * @param observer An observer callback to get notified when the cache file deletion 4855 * is complete. 4856 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} 4857 * will be called when that happens. observer may be null to indicate that 4858 * no callback is desired. 4859 * 4860 * @hide 4861 */ 4862 public abstract void deleteApplicationCacheFiles(String packageName, 4863 IPackageDataObserver observer); 4864 4865 /** 4866 * Free storage by deleting LRU sorted list of cache files across 4867 * all applications. If the currently available free storage 4868 * on the device is greater than or equal to the requested 4869 * free storage, no cache files are cleared. If the currently 4870 * available storage on the device is less than the requested 4871 * free storage, some or all of the cache files across 4872 * all applications are deleted (based on last accessed time) 4873 * to increase the free storage space on the device to 4874 * the requested value. There is no guarantee that clearing all 4875 * the cache files from all applications will clear up 4876 * enough storage to achieve the desired value. 4877 * @param freeStorageSize The number of bytes of storage to be 4878 * freed by the system. Say if freeStorageSize is XX, 4879 * and the current free storage is YY, 4880 * if XX is less than YY, just return. if not free XX-YY number 4881 * of bytes if possible. 4882 * @param observer call back used to notify when 4883 * the operation is completed 4884 * 4885 * @hide 4886 */ 4887 // @SystemApi 4888 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { 4889 freeStorageAndNotify(null, freeStorageSize, observer); 4890 } 4891 4892 /** {@hide} */ 4893 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, 4894 IPackageDataObserver observer); 4895 4896 /** 4897 * Free storage by deleting LRU sorted list of cache files across 4898 * all applications. If the currently available free storage 4899 * on the device is greater than or equal to the requested 4900 * free storage, no cache files are cleared. If the currently 4901 * available storage on the device is less than the requested 4902 * free storage, some or all of the cache files across 4903 * all applications are deleted (based on last accessed time) 4904 * to increase the free storage space on the device to 4905 * the requested value. There is no guarantee that clearing all 4906 * the cache files from all applications will clear up 4907 * enough storage to achieve the desired value. 4908 * @param freeStorageSize The number of bytes of storage to be 4909 * freed by the system. Say if freeStorageSize is XX, 4910 * and the current free storage is YY, 4911 * if XX is less than YY, just return. if not free XX-YY number 4912 * of bytes if possible. 4913 * @param pi IntentSender call back used to 4914 * notify when the operation is completed.May be null 4915 * to indicate that no call back is desired. 4916 * 4917 * @hide 4918 */ 4919 public void freeStorage(long freeStorageSize, IntentSender pi) { 4920 freeStorage(null, freeStorageSize, pi); 4921 } 4922 4923 /** {@hide} */ 4924 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi); 4925 4926 /** 4927 * Retrieve the size information for a package. 4928 * Since this may take a little while, the result will 4929 * be posted back to the given observer. The calling context 4930 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. 4931 * 4932 * @param packageName The name of the package whose size information is to be retrieved 4933 * @param userId The user whose size information should be retrieved. 4934 * @param observer An observer callback to get notified when the operation 4935 * is complete. 4936 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} 4937 * The observer's callback is invoked with a PackageStats object(containing the 4938 * code, data and cache sizes of the package) and a boolean value representing 4939 * the status of the operation. observer may be null to indicate that 4940 * no callback is desired. 4941 * 4942 * @hide 4943 */ 4944 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId, 4945 IPackageStatsObserver observer); 4946 4947 /** 4948 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but 4949 * returns the size for the calling user. 4950 * 4951 * @hide 4952 */ 4953 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { 4954 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer); 4955 } 4956 4957 /** 4958 * @deprecated This function no longer does anything; it was an old 4959 * approach to managing preferred activities, which has been superseded 4960 * by (and conflicts with) the modern activity-based preferences. 4961 */ 4962 @Deprecated 4963 public abstract void addPackageToPreferred(String packageName); 4964 4965 /** 4966 * @deprecated This function no longer does anything; it was an old 4967 * approach to managing preferred activities, which has been superseded 4968 * by (and conflicts with) the modern activity-based preferences. 4969 */ 4970 @Deprecated 4971 public abstract void removePackageFromPreferred(String packageName); 4972 4973 /** 4974 * Retrieve the list of all currently configured preferred packages. The 4975 * first package on the list is the most preferred, the last is the 4976 * least preferred. 4977 * 4978 * @param flags Additional option flags. Use any combination of 4979 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS}, 4980 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION}, 4981 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA}, 4982 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, 4983 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, 4984 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES}, 4985 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES}, 4986 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, 4987 * {@link #MATCH_UNINSTALLED_PACKAGES} 4988 * to modify the data returned. 4989 * 4990 * @return A List of PackageInfo objects, one for each preferred application, 4991 * in order of preference. 4992 * 4993 * @see #GET_ACTIVITIES 4994 * @see #GET_CONFIGURATIONS 4995 * @see #GET_GIDS 4996 * @see #GET_INSTRUMENTATION 4997 * @see #GET_INTENT_FILTERS 4998 * @see #GET_META_DATA 4999 * @see #GET_PERMISSIONS 5000 * @see #GET_PROVIDERS 5001 * @see #GET_RECEIVERS 5002 * @see #GET_SERVICES 5003 * @see #GET_SHARED_LIBRARY_FILES 5004 * @see #GET_SIGNATURES 5005 * @see #GET_URI_PERMISSION_PATTERNS 5006 * @see #MATCH_DISABLED_COMPONENTS 5007 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS 5008 * @see #MATCH_UNINSTALLED_PACKAGES 5009 */ 5010 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags); 5011 5012 /** 5013 * @deprecated This is a protected API that should not have been available 5014 * to third party applications. It is the platform's responsibility for 5015 * assigning preferred activities and this cannot be directly modified. 5016 * 5017 * Add a new preferred activity mapping to the system. This will be used 5018 * to automatically select the given activity component when 5019 * {@link Context#startActivity(Intent) Context.startActivity()} finds 5020 * multiple matching activities and also matches the given filter. 5021 * 5022 * @param filter The set of intents under which this activity will be 5023 * made preferred. 5024 * @param match The IntentFilter match category that this preference 5025 * applies to. 5026 * @param set The set of activities that the user was picking from when 5027 * this preference was made. 5028 * @param activity The component name of the activity that is to be 5029 * preferred. 5030 */ 5031 @Deprecated 5032 public abstract void addPreferredActivity(IntentFilter filter, int match, 5033 ComponentName[] set, ComponentName activity); 5034 5035 /** 5036 * Same as {@link #addPreferredActivity(IntentFilter, int, 5037 ComponentName[], ComponentName)}, but with a specific userId to apply the preference 5038 to. 5039 * @hide 5040 */ 5041 public void addPreferredActivityAsUser(IntentFilter filter, int match, 5042 ComponentName[] set, ComponentName activity, @UserIdInt int userId) { 5043 throw new RuntimeException("Not implemented. Must override in a subclass."); 5044 } 5045 5046 /** 5047 * @deprecated This is a protected API that should not have been available 5048 * to third party applications. It is the platform's responsibility for 5049 * assigning preferred activities and this cannot be directly modified. 5050 * 5051 * Replaces an existing preferred activity mapping to the system, and if that were not present 5052 * adds a new preferred activity. This will be used 5053 * to automatically select the given activity component when 5054 * {@link Context#startActivity(Intent) Context.startActivity()} finds 5055 * multiple matching activities and also matches the given filter. 5056 * 5057 * @param filter The set of intents under which this activity will be 5058 * made preferred. 5059 * @param match The IntentFilter match category that this preference 5060 * applies to. 5061 * @param set The set of activities that the user was picking from when 5062 * this preference was made. 5063 * @param activity The component name of the activity that is to be 5064 * preferred. 5065 * @hide 5066 */ 5067 @Deprecated 5068 public abstract void replacePreferredActivity(IntentFilter filter, int match, 5069 ComponentName[] set, ComponentName activity); 5070 5071 /** 5072 * @hide 5073 */ 5074 @Deprecated 5075 public void replacePreferredActivityAsUser(IntentFilter filter, int match, 5076 ComponentName[] set, ComponentName activity, @UserIdInt int userId) { 5077 throw new RuntimeException("Not implemented. Must override in a subclass."); 5078 } 5079 5080 /** 5081 * Remove all preferred activity mappings, previously added with 5082 * {@link #addPreferredActivity}, from the 5083 * system whose activities are implemented in the given package name. 5084 * An application can only clear its own package(s). 5085 * 5086 * @param packageName The name of the package whose preferred activity 5087 * mappings are to be removed. 5088 */ 5089 public abstract void clearPackagePreferredActivities(String packageName); 5090 5091 /** 5092 * Retrieve all preferred activities, previously added with 5093 * {@link #addPreferredActivity}, that are 5094 * currently registered with the system. 5095 * 5096 * @param outFilters A required list in which to place the filters of all of the 5097 * preferred activities. 5098 * @param outActivities A required list in which to place the component names of 5099 * all of the preferred activities. 5100 * @param packageName An optional package in which you would like to limit 5101 * the list. If null, all activities will be returned; if non-null, only 5102 * those activities in the given package are returned. 5103 * 5104 * @return Returns the total number of registered preferred activities 5105 * (the number of distinct IntentFilter records, not the number of unique 5106 * activity components) that were found. 5107 */ 5108 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, 5109 @NonNull List<ComponentName> outActivities, String packageName); 5110 5111 /** 5112 * Ask for the set of available 'home' activities and the current explicit 5113 * default, if any. 5114 * @hide 5115 */ 5116 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); 5117 5118 /** 5119 * Set the enabled setting for a package component (activity, receiver, service, provider). 5120 * This setting will override any enabled state which may have been set by the component in its 5121 * manifest. 5122 * 5123 * @param componentName The component to enable 5124 * @param newState The new enabled state for the component. The legal values for this state 5125 * are: 5126 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 5127 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 5128 * and 5129 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 5130 * The last one removes the setting, thereby restoring the component's state to 5131 * whatever was set in it's manifest (or enabled, by default). 5132 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 5133 */ 5134 public abstract void setComponentEnabledSetting(ComponentName componentName, 5135 int newState, int flags); 5136 5137 5138 /** 5139 * Return the enabled setting for a package component (activity, 5140 * receiver, service, provider). This returns the last value set by 5141 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most 5142 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 5143 * the value originally specified in the manifest has not been modified. 5144 * 5145 * @param componentName The component to retrieve. 5146 * @return Returns the current enabled state for the component. May 5147 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 5148 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 5149 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 5150 * component's enabled state is based on the original information in 5151 * the manifest as found in {@link ComponentInfo}. 5152 */ 5153 public abstract int getComponentEnabledSetting(ComponentName componentName); 5154 5155 /** 5156 * Set the enabled setting for an application 5157 * This setting will override any enabled state which may have been set by the application in 5158 * its manifest. It also overrides the enabled state set in the manifest for any of the 5159 * application's components. It does not override any enabled state set by 5160 * {@link #setComponentEnabledSetting} for any of the application's components. 5161 * 5162 * @param packageName The package name of the application to enable 5163 * @param newState The new enabled state for the component. The legal values for this state 5164 * are: 5165 * {@link #COMPONENT_ENABLED_STATE_ENABLED}, 5166 * {@link #COMPONENT_ENABLED_STATE_DISABLED} 5167 * and 5168 * {@link #COMPONENT_ENABLED_STATE_DEFAULT} 5169 * The last one removes the setting, thereby restoring the applications's state to 5170 * whatever was set in its manifest (or enabled, by default). 5171 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. 5172 */ 5173 public abstract void setApplicationEnabledSetting(String packageName, 5174 int newState, int flags); 5175 5176 /** 5177 * Return the enabled setting for an application. This returns 5178 * the last value set by 5179 * {@link #setApplicationEnabledSetting(String, int, int)}; in most 5180 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since 5181 * the value originally specified in the manifest has not been modified. 5182 * 5183 * @param packageName The package name of the application to retrieve. 5184 * @return Returns the current enabled state for the application. May 5185 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, 5186 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or 5187 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the 5188 * application's enabled state is based on the original information in 5189 * the manifest as found in {@link ComponentInfo}. 5190 * @throws IllegalArgumentException if the named package does not exist. 5191 */ 5192 public abstract int getApplicationEnabledSetting(String packageName); 5193 5194 /** 5195 * Puts the package in a hidden state, which is almost like an uninstalled state, 5196 * making the package unavailable, but it doesn't remove the data or the actual 5197 * package file. Application can be unhidden by either resetting the hidden state 5198 * or by installing it, such as with {@link #installExistingPackage(String)} 5199 * @hide 5200 */ 5201 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, 5202 UserHandle userHandle); 5203 5204 /** 5205 * Returns the hidden state of a package. 5206 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) 5207 * @hide 5208 */ 5209 public abstract boolean getApplicationHiddenSettingAsUser(String packageName, 5210 UserHandle userHandle); 5211 5212 /** 5213 * Return whether the device has been booted into safe mode. 5214 */ 5215 public abstract boolean isSafeMode(); 5216 5217 /** 5218 * Adds a listener for permission changes for installed packages. 5219 * 5220 * @param listener The listener to add. 5221 * 5222 * @hide 5223 */ 5224 @SystemApi 5225 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) 5226 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); 5227 5228 /** 5229 * Remvoes a listener for permission changes for installed packages. 5230 * 5231 * @param listener The listener to remove. 5232 * 5233 * @hide 5234 */ 5235 @SystemApi 5236 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); 5237 5238 /** 5239 * Return the {@link KeySet} associated with the String alias for this 5240 * application. 5241 * 5242 * @param alias The alias for a given {@link KeySet} as defined in the 5243 * application's AndroidManifest.xml. 5244 * @hide 5245 */ 5246 public abstract KeySet getKeySetByAlias(String packageName, String alias); 5247 5248 /** Return the signing {@link KeySet} for this application. 5249 * @hide 5250 */ 5251 public abstract KeySet getSigningKeySet(String packageName); 5252 5253 /** 5254 * Return whether the package denoted by packageName has been signed by all 5255 * of the keys specified by the {@link KeySet} ks. This will return true if 5256 * the package has been signed by additional keys (a superset) as well. 5257 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. 5258 * @hide 5259 */ 5260 public abstract boolean isSignedBy(String packageName, KeySet ks); 5261 5262 /** 5263 * Return whether the package denoted by packageName has been signed by all 5264 * of, and only, the keys specified by the {@link KeySet} ks. Compare to 5265 * {@link #isSignedBy(String packageName, KeySet ks)}. 5266 * @hide 5267 */ 5268 public abstract boolean isSignedByExactly(String packageName, KeySet ks); 5269 5270 /** 5271 * Attempts to move package resources from internal to external media or vice versa. 5272 * Since this may take a little while, the result will 5273 * be posted back to the given observer. This call may fail if the calling context 5274 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the 5275 * named package cannot be found, or if the named package is a "system package". 5276 * 5277 * @param packageName The name of the package to delete 5278 * @param observer An observer callback to get notified when the package move is 5279 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be 5280 * called when that happens. observer may be null to indicate that no callback is desired. 5281 * @param flags To indicate install location {@link #MOVE_INTERNAL} or 5282 * {@link #MOVE_EXTERNAL_MEDIA} 5283 * 5284 * @hide 5285 */ 5286 @Deprecated 5287 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) { 5288 throw new UnsupportedOperationException(); 5289 } 5290 5291 /** 5292 * Puts the package in a suspended state, making the package un-runnable, 5293 * but it doesn't remove the data or the actual package file. The application notifications 5294 * will be hidden and also the application will not show up in recents. 5295 * 5296 * @param packageName The name of the package to set the suspended status. 5297 * @param suspended If set to {@code true} than the package will be suspended, if set to 5298 * {@code false} the package will be unsuspended. 5299 * @param userId The user id. 5300 * 5301 * @hide 5302 */ 5303 public abstract boolean setPackageSuspendedAsUser( 5304 String packageName, boolean suspended, @UserIdInt int userId); 5305 5306 /** {@hide} */ 5307 public static boolean isMoveStatusFinished(int status) { 5308 return (status < 0 || status > 100); 5309 } 5310 5311 /** {@hide} */ 5312 public static abstract class MoveCallback { 5313 public void onCreated(int moveId, Bundle extras) {} 5314 public abstract void onStatusChanged(int moveId, int status, long estMillis); 5315 } 5316 5317 /** {@hide} */ 5318 public abstract int getMoveStatus(int moveId); 5319 5320 /** {@hide} */ 5321 public abstract void registerMoveCallback(MoveCallback callback, Handler handler); 5322 /** {@hide} */ 5323 public abstract void unregisterMoveCallback(MoveCallback callback); 5324 5325 /** {@hide} */ 5326 public abstract int movePackage(String packageName, VolumeInfo vol); 5327 /** {@hide} */ 5328 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app); 5329 /** {@hide} */ 5330 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app); 5331 5332 /** {@hide} */ 5333 public abstract int movePrimaryStorage(VolumeInfo vol); 5334 /** {@hide} */ 5335 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume(); 5336 /** {@hide} */ 5337 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes(); 5338 5339 /** 5340 * Returns the device identity that verifiers can use to associate their scheme to a particular 5341 * device. This should not be used by anything other than a package verifier. 5342 * 5343 * @return identity that uniquely identifies current device 5344 * @hide 5345 */ 5346 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); 5347 5348 /** 5349 * Returns true if the device is upgrading, such as first boot after OTA. 5350 * 5351 * @hide 5352 */ 5353 public abstract boolean isUpgrade(); 5354 5355 /** 5356 * Return interface that offers the ability to install, upgrade, and remove 5357 * applications on the device. 5358 */ 5359 public abstract @NonNull PackageInstaller getPackageInstaller(); 5360 5361 /** 5362 * Adds a {@link CrossProfileIntentFilter}. After calling this method all intents sent from the 5363 * user with id sourceUserId can also be be resolved by activities in the user with id 5364 * targetUserId if they match the specified intent filter. 5365 * @param filter The {@link IntentFilter} the intent has to match 5366 * @param sourceUserId The source user id. 5367 * @param targetUserId The target user id. 5368 * @param flags The possible values are {@link SKIP_CURRENT_PROFILE} and 5369 * {@link ONLY_IF_NO_MATCH_FOUND}. 5370 * @hide 5371 */ 5372 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, 5373 int targetUserId, int flags); 5374 5375 /** 5376 * Clearing {@link CrossProfileIntentFilter}s which have the specified user as their 5377 * source, and have been set by the app calling this method. 5378 * @param sourceUserId The source user id. 5379 * @hide 5380 */ 5381 public abstract void clearCrossProfileIntentFilters(int sourceUserId); 5382 5383 /** 5384 * @hide 5385 */ 5386 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); 5387 5388 /** 5389 * @hide 5390 */ 5391 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); 5392 5393 /** {@hide} */ 5394 public abstract boolean isPackageAvailable(String packageName); 5395 5396 /** {@hide} */ 5397 public static String installStatusToString(int status, String msg) { 5398 final String str = installStatusToString(status); 5399 if (msg != null) { 5400 return str + ": " + msg; 5401 } else { 5402 return str; 5403 } 5404 } 5405 5406 /** {@hide} */ 5407 public static String installStatusToString(int status) { 5408 switch (status) { 5409 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; 5410 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; 5411 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; 5412 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; 5413 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; 5414 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; 5415 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; 5416 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; 5417 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; 5418 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; 5419 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; 5420 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; 5421 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; 5422 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; 5423 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; 5424 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; 5425 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; 5426 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; 5427 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; 5428 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; 5429 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; 5430 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; 5431 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; 5432 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; 5433 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; 5434 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; 5435 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; 5436 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; 5437 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; 5438 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; 5439 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; 5440 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; 5441 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; 5442 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; 5443 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; 5444 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; 5445 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; 5446 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; 5447 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; 5448 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; 5449 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; 5450 default: return Integer.toString(status); 5451 } 5452 } 5453 5454 /** {@hide} */ 5455 public static int installStatusToPublicStatus(int status) { 5456 switch (status) { 5457 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; 5458 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5459 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; 5460 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; 5461 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; 5462 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5463 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5464 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5465 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5466 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5467 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5468 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; 5469 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5470 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5471 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5472 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; 5473 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5474 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5475 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; 5476 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; 5477 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; 5478 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; 5479 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; 5480 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; 5481 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; 5482 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; 5483 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; 5484 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; 5485 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; 5486 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; 5487 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; 5488 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; 5489 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; 5490 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; 5491 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; 5492 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; 5493 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; 5494 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; 5495 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5496 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; 5497 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; 5498 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; 5499 default: return PackageInstaller.STATUS_FAILURE; 5500 } 5501 } 5502 5503 /** {@hide} */ 5504 public static String deleteStatusToString(int status, String msg) { 5505 final String str = deleteStatusToString(status); 5506 if (msg != null) { 5507 return str + ": " + msg; 5508 } else { 5509 return str; 5510 } 5511 } 5512 5513 /** {@hide} */ 5514 public static String deleteStatusToString(int status) { 5515 switch (status) { 5516 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; 5517 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; 5518 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; 5519 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; 5520 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; 5521 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; 5522 default: return Integer.toString(status); 5523 } 5524 } 5525 5526 /** {@hide} */ 5527 public static int deleteStatusToPublicStatus(int status) { 5528 switch (status) { 5529 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; 5530 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; 5531 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; 5532 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; 5533 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; 5534 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; 5535 default: return PackageInstaller.STATUS_FAILURE; 5536 } 5537 } 5538 5539 /** {@hide} */ 5540 public static String permissionFlagToString(int flag) { 5541 switch (flag) { 5542 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT"; 5543 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED"; 5544 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED"; 5545 case FLAG_PERMISSION_USER_SET: return "USER_SET"; 5546 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE"; 5547 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED"; 5548 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED"; 5549 default: return Integer.toString(flag); 5550 } 5551 } 5552 5553 /** {@hide} */ 5554 public static class LegacyPackageInstallObserver extends PackageInstallObserver { 5555 private final IPackageInstallObserver mLegacy; 5556 5557 public LegacyPackageInstallObserver(IPackageInstallObserver legacy) { 5558 mLegacy = legacy; 5559 } 5560 5561 @Override 5562 public void onPackageInstalled(String basePackageName, int returnCode, String msg, 5563 Bundle extras) { 5564 if (mLegacy == null) return; 5565 try { 5566 mLegacy.packageInstalled(basePackageName, returnCode); 5567 } catch (RemoteException ignored) { 5568 } 5569 } 5570 } 5571 5572 /** {@hide} */ 5573 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { 5574 private final IPackageDeleteObserver mLegacy; 5575 5576 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { 5577 mLegacy = legacy; 5578 } 5579 5580 @Override 5581 public void onPackageDeleted(String basePackageName, int returnCode, String msg) { 5582 if (mLegacy == null) return; 5583 try { 5584 mLegacy.packageDeleted(basePackageName, returnCode); 5585 } catch (RemoteException ignored) { 5586 } 5587 } 5588 } 5589} 5590