Most visited

Recently visited

Added in API level 1

PackageManager

public abstract class PackageManager
extends Object

java.lang.Object
   ↳ android.content.pm.PackageManager
Known Direct Subclasses


用于检索与当前安装在设备上的应用程序包相关的各种信息的类。 你可以通过getPackageManager()找到这个课程。

Summary

Nested classes

class PackageManager.NameNotFoundException

当找不到给定的包,应用程序或组件名称时引发此异常。

Constants

int COMPONENT_ENABLED_STATE_DEFAULT

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :此组件或应用程序处于其默认启用状态(如其清单中所指定)。

int COMPONENT_ENABLED_STATE_DISABLED

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :该组件或应用程序已被显式禁用,无论它在其清单中指定了什么。

int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED

仅限于 setApplicationEnabledSetting(String, int, int)标志:应该考虑这个应用程序,直到用户真正想要使用它为止。

int COMPONENT_ENABLED_STATE_DISABLED_USER

仅限于 setApplicationEnabledSetting(String, int, int)标志:用户已明确禁用应用程序,而不管它在其清单中指定了什么。

int COMPONENT_ENABLED_STATE_ENABLED

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :此组件或应用程序已被明确启用,无论它在其清单中指定了什么内容。

int DONT_KILL_APP

标志参数 setComponentEnabledSetting(android.content.ComponentName, int, int)表示您不想杀死包含组件的应用程序。

String EXTRA_VERIFICATION_ID

包待处理验证的ID的额外字段名称。

String EXTRA_VERIFICATION_RESULT

验证结果的额外字段名称, VERIFICATION_ALLOWVERIFICATION_REJECT

String FEATURE_APP_WIDGETS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持应用程序窗口小部件。

String FEATURE_AUDIO_LOW_LATENCY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的音频管道延迟低,更适合对延迟或声音输入或输出延迟敏感的音频应用程序。

String FEATURE_AUDIO_OUTPUT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备至少包含一种音频输出形式,如扬声器,音频插孔或通过蓝牙串流

String FEATURE_AUDIO_PRO

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有专业级的功能和性能。

String FEATURE_AUTOMOTIVE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :这是一款专门用于显示车辆头部UI的设备。

String FEATURE_BACKUP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以对安装的应用程序执行备份和恢复操作。

String FEATURE_BLUETOOTH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够通过蓝牙与其他设备进行通信。

String FEATURE_BLUETOOTH_LE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够通过蓝牙低功耗无线电与其他设备进行通信。

String FEATURE_CAMERA

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的相机背离屏幕。

String FEATURE_CAMERA_ANY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备至少有一个摄像头指向某个方向,或者可以支持连接到该摄像头的外部摄像头。

String FEATURE_CAMERA_AUTOFOCUS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的相机支持自动对焦。

String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一台摄像机支持 manual post-processing功能级别。

String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一台摄像机支持 manual sensor功能级别。

String FEATURE_CAMERA_CAPABILITY_RAW

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一台摄像机支持 RAW功能级别。

String FEATURE_CAMERA_EXTERNAL

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备可以支持连接外部摄像头。

String FEATURE_CAMERA_FLASH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的摄像头支持闪光灯。

String FEATURE_CAMERA_FRONT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有前置摄像头。

String FEATURE_CAMERA_LEVEL_FULL

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一台摄像机支持 full hardware功能级别。

String FEATURE_CONNECTION_SERVICE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上启用了连接服务API。

String FEATURE_CONSUMER_IR

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够与消费类红外设备进行通信。

String FEATURE_DEVICE_ADMIN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持通过设备管理员实施设备策略。

String FEATURE_ETHERNET

针对 getSystemAvailableFeatures()hasSystemFeature(String) :此设备支持以太网。

String FEATURE_FAKETOUCH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备没有触摸屏,但支持基本事件的触摸仿真。

String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备没有触摸屏,但支持针对支持两个或多个手指的不同跟踪的基本事件的触摸模拟。

String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备没有触摸屏,但支持基本事件的触摸模拟,支持完全独立地跟踪手指(5个或更多手指)。

String FEATURE_FINGERPRINT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有生物识别硬件来检测指纹。

String FEATURE_FREEFORM_WINDOW_MANAGEMENT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持自由形式窗口管理。

String FEATURE_GAMEPAD

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有必须被视为兼容游戏控制器的所有输入,或者包含盒中的兼容游戏控制器。

String FEATURE_HIFI_SENSORS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持高保真度传感器处理功能。

String FEATURE_HOME_SCREEN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持可由第三方应用程序替换的主屏幕。

String FEATURE_INPUT_METHODS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持添加使用 InputMethodService API实现的新输入方法。

String FEATURE_LEANBACK

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持leanback UI。

String FEATURE_LIVE_TV

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持实况电视,并可以显示 TvInputService API实现的电视输入内容。

String FEATURE_LIVE_WALLPAPER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持动态壁纸。

String FEATURE_LOCATION

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持一种或多种报告当前位置的方法。

String FEATURE_LOCATION_GPS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有全球定位系统接收器,可以报告精确的位置。

String FEATURE_LOCATION_NETWORK

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以使用基于网络的地理定位系统以粗略的精度报告位置。

String FEATURE_MANAGED_USERS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持通过 DevicePolicyManager创建辅助用户和受管配置文件。

String FEATURE_MICROPHONE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以通过麦克风录制音频。

String FEATURE_MIDI

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有完整的android.media.midi。* API实现。

String FEATURE_NFC

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以使用近场通信(NFC)进行通信。

String FEATURE_NFC_HOST_CARD_EMULATION

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持基于主机的NFC卡仿真。

String FEATURE_NFC_HOST_CARD_EMULATION_NFCF

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持基于主机的NFC-F卡仿真。

String FEATURE_OPENGLES_EXTENSION_PACK

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持OpenGL ES Android Extension Pack

String FEATURE_PICTURE_IN_PICTURE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持画中画多窗口模式。

String FEATURE_PRINTING

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持打印。

String FEATURE_SCREEN_LANDSCAPE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持横向方向屏幕。

String FEATURE_SCREEN_PORTRAIT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持纵向方向屏幕。

String FEATURE_SECURELY_REMOVES_USERS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持安全移除用户。

String FEATURE_SENSOR_ACCELEROMETER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件包含一个加速度计。

String FEATURE_SENSOR_AMBIENT_TEMPERATURE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个环境温度传感器。

String FEATURE_SENSOR_BAROMETER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个气压计(气压传感器)。

String FEATURE_SENSOR_COMPASS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个磁力计(指南针)。

String FEATURE_SENSOR_GYROSCOPE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个陀螺仪。

String FEATURE_SENSOR_HEART_RATE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个心率监视器。

String FEATURE_SENSOR_HEART_RATE_ECG

针对 getSystemAvailableFeatures()hasSystemFeature(String) :此设备上的心率传感器是心电图。

String FEATURE_SENSOR_LIGHT

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个光传感器。

String FEATURE_SENSOR_PROXIMITY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个接近传感器。

String FEATURE_SENSOR_RELATIVE_HUMIDITY

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个相对湿度传感器。

String FEATURE_SENSOR_STEP_COUNTER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件包含一个硬件步骤计数器。

String FEATURE_SENSOR_STEP_DETECTOR

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个硬件步骤检测器。

String FEATURE_SIP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上已启用SIP API。

String FEATURE_SIP_VOIP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持基于SIP的VOIP。

String FEATURE_TELEPHONY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有支持数据通信的电话无线电。

String FEATURE_TELEPHONY_CDMA

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有CDMA电话堆栈。

String FEATURE_TELEPHONY_GSM

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有GSM电话堆栈。

String FEATURE_TELEVISION

此常数在API级别21中已弃用。 FEATURE_LEANBACK改为使用FEATURE_LEANBACK

String FEATURE_TOUCHSCREEN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的显示屏具有触摸屏。

String FEATURE_TOUCHSCREEN_MULTITOUCH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的触摸屏支持多点触控,足以进行基本的双指手势检测。

String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的触摸屏能够完全独立地跟踪两个或更多手指。

String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的触摸屏能够完全独立地跟踪全手指 - 即5个或更多个同步独立指针。

String FEATURE_USB_ACCESSORY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持连接到USB附件。

String FEATURE_USB_HOST

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持作为USB主机连接到USB设备。

String FEATURE_VERIFIED_BOOT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持验证的引导。

String FEATURE_VR_MODE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备为处理通知的立体渲染的虚拟现实(VR)应用程序实现了优化模式,并在VR应用程序具有用户焦点时禁用大多数单眼系统UI组件。

String FEATURE_VR_MODE_HIGH_PERFORMANCE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备实现了 FEATURE_VR_MODE但额外满足额外的CDD要求以提供高品质的VR体验。

String FEATURE_VULKAN_HARDWARE_LEVEL

针对 getSystemAvailableFeatures()hasSystemFeature(String, int)功能:如果支持此功能,Vulkan本机API将枚举至少一个 VkPhysicalDevice ,功能版本将指示其支持的可选硬件功能限制级别。

String FEATURE_VULKAN_HARDWARE_VERSION

功能为 getSystemAvailableFeatures()hasSystemFeature(String, int) :此功能的版本表示最高 VkPhysicalDeviceProperties::apiVersion由支持所指示的硬件级别的物理设备支持 FEATURE_VULKAN_HARDWARE_LEVEL

String FEATURE_WATCH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :这是专门用于在手表上显示用户界面的设备。

String FEATURE_WEBVIEW

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有完整的android.webkit。* API实现。

String FEATURE_WIFI

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持WiFi(802.11)网络。

String FEATURE_WIFI_DIRECT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持Wi-Fi Direct网络。

int GET_ACTIVITIES

PackageInfo标志:返回有关 activities中包中活动的信息。

int GET_CONFIGURATIONS

PackageInfo标志:返回有关 PackageInfo.configPreferences硬件首选项的 PackageInfo.configPreferences ,以及 reqFeaturesfeatureGroups请求功能。

int GET_DISABLED_COMPONENTS

此常数在API级别24中已被弃用。替换为MATCH_DISABLED_COMPONENTS

int GET_DISABLED_UNTIL_USED_COMPONENTS

该常数在API级别24中已被弃用。替换为MATCH_DISABLED_UNTIL_USED_COMPONENTS

int GET_GIDS

PackageInfo标志:返回与应用程序关联的 group ids

int GET_INSTRUMENTATION

PackageInfo标记:返回有关 instrumentation中的包中的 instrumentation

int GET_INTENT_FILTERS

PackageInfo flag:返回有关活动支持的意图过滤器的信息。

int GET_META_DATA

ComponentInfo标志:返回与组件关联的 metaData数据 Bundle

int GET_PERMISSIONS

PackageInfo标志:返回有关 permissions中的包中的权限的信息。

int GET_PROVIDERS

PackageInfo标志:返回有关 providers中的包中的内容提供者的信息。

int GET_RECEIVERS

PackageInfo flag:返回有关 receivers中包中的intent接收器的信息。

int GET_RESOLVED_FILTER

ResolveInfo标志:返回在特定ResolveInfo匹配的IntentFilter filter

int GET_SERVICES

PackageInfo flag:返回有关 services中包中的服务的信息。

int GET_SHARED_LIBRARY_FILES

ApplicationInfo标志:返回与应用程序关联的 paths to the shared libraries

int GET_SIGNATURES

PackageInfo标志:返回有关包中包含的签名的信息。

int GET_UNINSTALLED_PACKAGES

此常数在API级别24中已被弃用。替换为MATCH_UNINSTALLED_PACKAGES

int GET_URI_PERMISSION_PATTERNS

ProviderInfo标志:返回与内容提供者关联的 URI permission patterns

int MATCH_ALL

查询标志:如果设置,并且平台正在对结果进行任何筛选,则不会发生筛选。

int MATCH_DEFAULT_ONLY

分辨率和查询标志:如果设置,只有支持 CATEGORY_DEFAULT过滤器才会被考虑进行匹配。

int MATCH_DIRECT_BOOT_AWARE

查询标志:匹配组件,这些组件直接引导 意识到在返回的信息,而不管当前用户状态的。

int MATCH_DIRECT_BOOT_UNAWARE

查询标志:匹配在返回信息中 不知道直接启动的组件,而不管当前用户状态如何。

int MATCH_DISABLED_COMPONENTS

PackageInfo标志:在返回的信息中包含禁用的组件。

int MATCH_DISABLED_UNTIL_USED_COMPONENTS

PackageInfo标志:包含仅在返回信息中由于 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED而处于该状态的禁用组件。

int MATCH_SYSTEM_ONLY

查询标志:仅包含来自标记为 FLAG_SYSTEM应用程序的组件。

int MATCH_UNINSTALLED_PACKAGES

标记参数来检索有关所有应用程序(甚至是未安装的应用程序)的有关数据目录的信息。

long MAXIMUM_VERIFICATION_TIMEOUT

可以用作 millisecondsToDelay参数为 extendVerificationTimeout(int, int, long)

int PERMISSION_DENIED

权限检查结果:如果权限尚未授予给定包,则返回 checkPermission(String, String)

int PERMISSION_GRANTED

权限检查结果:如果权限已授予给定包,则返回 checkPermission(String, String)

int SIGNATURE_FIRST_NOT_SIGNED

签名检查结果:如果第一个软件包未签名,但第二个软件包未签名,则返回 checkSignatures(int, int)

int SIGNATURE_MATCH

签名检查结果:如果两个包中的所有签名匹配,则返回 checkSignatures(int, int)

int SIGNATURE_NEITHER_SIGNED

签名检查结果:如果两个包都未签名,则返回 checkSignatures(int, int)

int SIGNATURE_NO_MATCH

签名检查结果:如果两个包中的签名都不匹配,则返回 checkSignatures(int, int)

int SIGNATURE_SECOND_NOT_SIGNED

签名检查结果:如果第二个软件包没有签名,但第一个是,则返回 checkSignatures(int, int)

int SIGNATURE_UNKNOWN_PACKAGE

签名检查结果:如果任何一个软件包无效,则返回 checkSignatures(int, int)

int VERIFICATION_ALLOW

用作 verificationCode参数 verifyPendingInstall(int, int)以指示调用程序包验证程序允许继续安装。

int VERIFICATION_REJECT

用作 verificationCode参数 verifyPendingInstall(int, int)以指示调用程序包验证程序未投票允许安装继续。

Public constructors

PackageManager()

Public methods

abstract void addPackageToPreferred(String packageName)

此方法在API级别7中已弃用。此函数不再执行任何操作; 这是一种管理偏好活动的旧方法,已被现代基于活动的偏好取代(并与之冲突)。

abstract boolean addPermission(PermissionInfo info)

为系统添加一个新的动态权限。

abstract boolean addPermissionAsync(PermissionInfo info)

addPermission(PermissionInfo)一样,但在从调用返回之后异步地保留了包管理器状态,从而允许它更快地返回并批处理一系列添加,但不保证在写入设备之前重新启动设备时将保留添加的权限。

abstract void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity)

此方法在API级别8中已被弃用。这是受保护的API,应该不可用于第三方应用程序。 平台负责分配首选活动,并且不能直接修改。 向系统添加一个新的首选活动映射。 Context.startActivity()找到多个匹配活动并且与给定的过滤器匹配时,这将用于自动选择给定的活动组件。

abstract String[] canonicalToCurrentPackageNames(String[] names)

从软件包规范名称映射到设备上正在使用的当前名称。

abstract int checkPermission(String permName, String pkgName)

检查一个特定的包是否已被授予特定的权限。

abstract int checkSignatures(String pkg1, String pkg2)

比较两个包的签名以确定两个包中是否出现相同的签名。

abstract int checkSignatures(int uid1, int uid2)

checkSignatures(String, String)一样,但需要检查两个软件包的UID。

abstract void clearPackagePreferredActivities(String packageName)

从其活动在给定包名称中实现的系统中删除所有首选的活动映射(以前添加了 addPreferredActivity(IntentFilter, int, ComponentName[], ComponentName)

abstract String[] currentToCanonicalPackageNames(String[] names)

从设备上使用的当前软件包名称映射到该软件包当前的规范名称。

abstract void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay)

允许侦听 package verification broadcast的程序包扩展响应的默认超时值,并声明发生超时后要执行的操作。

abstract Drawable getActivityBanner(Intent intent)

检索与意图关联的横幅。

abstract Drawable getActivityBanner(ComponentName activityName)

检索与活动关联的横幅。

abstract Drawable getActivityIcon(Intent intent)

检索与意图关联的图标。

abstract Drawable getActivityIcon(ComponentName activityName)

检索与活动关联的图标。

abstract ActivityInfo getActivityInfo(ComponentName component, int flags)

检索我们了解的特定活动类的所有信息。

abstract Drawable getActivityLogo(Intent intent)

检索与意图关联的徽标。

abstract Drawable getActivityLogo(ComponentName activityName)

检索与活动关联的徽标。

abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags)

检索系统中的所有已知权限组。

abstract Drawable getApplicationBanner(ApplicationInfo info)

检索与应用程序关联的横幅。

abstract Drawable getApplicationBanner(String packageName)

检索与应用程序关联的横幅。

abstract int getApplicationEnabledSetting(String packageName)

返回应用程序的启用设置。

abstract Drawable getApplicationIcon(String packageName)

检索与应用程序关联的图标。

abstract Drawable getApplicationIcon(ApplicationInfo info)

检索与应用程序关联的图标。

abstract ApplicationInfo getApplicationInfo(String packageName, int flags)

检索我们所了解的有关特定软件包/应用程序的所有信息。

abstract CharSequence getApplicationLabel(ApplicationInfo info)

返回用于此应用程序的标签。

abstract Drawable getApplicationLogo(String packageName)

检索与应用程序关联的徽标。

abstract Drawable getApplicationLogo(ApplicationInfo info)

检索与应用程序关联的徽标。

abstract int getComponentEnabledSetting(ComponentName componentName)

返回包组件(活动,接收者,服务,提供者)的启用设置。

abstract Drawable getDefaultActivityIcon()

返回未定义特定图标时使用的活动的通用图标。

abstract Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo)

从包中检索图像。

abstract List<ApplicationInfo> getInstalledApplications(int flags)

返回设备上安装的所有应用程序包的列表。

abstract List<PackageInfo> getInstalledPackages(int flags)

返回设备上安装的所有软件包的列表。

abstract String getInstallerPackageName(String packageName)

检索安装软件包的应用程序的软件包名称。

abstract InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)

检索我们了解的特定仪器类的所有信息。

abstract Intent getLaunchIntentForPackage(String packageName)

返回一个“良好”的意图在包装中发起前门活动。

abstract Intent getLeanbackLaunchIntentForPackage(String packageName)

返回一个“良好”的意图,在包中打开前门Leanback活动,例如在浏览包时使用“打开”按钮。

abstract String getNameForUid(int uid)

检索与用户标识关联的官方名称。

PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags)

检索关于在包归档文件中定义的应用程序包的整体信息

abstract int[] getPackageGids(String packageName)

返回已分配给给定包的所有POSIX辅助组ID的数组。

abstract int[] getPackageGids(String packageName, int flags)

返回已分配给给定包的所有POSIX辅助组ID的数组。

abstract PackageInfo getPackageInfo(String packageName, int flags)

检索有关系统上安装的应用程序包的整体信息。

abstract PackageInstaller getPackageInstaller()

返回接口,提供在设备上安装,升级和删除应用程序的能力。

abstract int getPackageUid(String packageName, int flags)

返回与给定包名称关联的UID。

abstract String[] getPackagesForUid(int uid)

检索与特定用户标识关联的所有软件包的名称。

abstract List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags)

返回当前持有任何给定权限的所有已安装软件包的列表。

abstract PermissionGroupInfo getPermissionGroupInfo(String name, int flags)

检索我们所了解的有关特定权限组的所有信息。

abstract PermissionInfo getPermissionInfo(String name, int flags)

检索我们了解的特定权限的所有信息。

abstract int getPreferredActivities(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName)

检索当前在系统中注册的所有首选活动(以前添加了 addPreferredActivity(IntentFilter, int, ComponentName[], ComponentName)

abstract List<PackageInfo> getPreferredPackages(int flags)

检索当前配置的所有首选软件包列表。

abstract ProviderInfo getProviderInfo(ComponentName component, int flags)

检索我们了解的特定内容提供者类的所有信息。

abstract ActivityInfo getReceiverInfo(ComponentName component, int flags)

检索我们所了解的关于特定接收器类的所有信息。

abstract Resources getResourcesForActivity(ComponentName activityName)

检索与活动关联的资源。

abstract Resources getResourcesForApplication(String appPackageName)

检索与应用程序关联的资源。

abstract Resources getResourcesForApplication(ApplicationInfo app)

检索应用程序的资源。

abstract ServiceInfo getServiceInfo(ComponentName component, int flags)

检索我们了解的特定服务类的所有信息。

abstract FeatureInfo[] getSystemAvailableFeatures()

获取系统中可用功能的列表。

abstract String[] getSystemSharedLibraryNames()

获取系统上可用的共享库列表。

abstract CharSequence getText(String packageName, int resid, ApplicationInfo appInfo)

从包中检索文本。

abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, UserHandle user, Rect badgeLocation, int badgeDensity)

如果目标用户是主叫用户的托管配置文件,或者主叫方本身是托管配置文件,则会返回给定可绘制副本的标签副本,以便用户将其与原始可绘制区分开来。

abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user)

如果目标用户是托管配置文件,则会返回给定图标的带有标记的副本,以便将其与原始图标区分开来。

abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user)

如果目标用户是主叫用户的托管配置文件,或者主叫方本身是托管配置文件,则会返回该标签的副本,并为可访问性服务(如对讲)制作徽章。

abstract XmlResourceParser getXml(String packageName, int resid, ApplicationInfo appInfo)

从包中检索XML文件。

abstract boolean hasSystemFeature(String name)

检查给定的功能名称是否为 getSystemAvailableFeatures()返回的可用功能 getSystemAvailableFeatures()

abstract boolean hasSystemFeature(String name, int version)

检查给定的功能名称和版本是否为 getSystemAvailableFeatures()所返回的可用功能 getSystemAvailableFeatures()

abstract boolean isPermissionRevokedByPolicy(String permName, String pkgName)

检查策略是否已为某个包撤销特定权限。

abstract boolean isSafeMode()

返回设备是否已启动进入安全模式。

abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags)

检索所有可以处理给定意图广播的接收器。

abstract List<ProviderInfo> queryContentProviders(String processName, int uid, int flags)

检索内容提供商信息。

abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage, int flags)

检索有关可用检测代码的信息。

abstract List<ResolveInfo> queryIntentActivities(Intent intent, int flags)

检索可以针对给定意图执行的所有活动。

abstract List<ResolveInfo> queryIntentActivityOptions(ComponentName caller, Intent[] specifics, Intent intent, int flags)

检索一组应该以类似选项呈现给用户的活动。

abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags)

检索可以匹配给定意图的所有提供者。

abstract List<ResolveInfo> queryIntentServices(Intent intent, int flags)

检索可以匹配给定意图的所有服务。

abstract List<PermissionInfo> queryPermissionsByGroup(String group, int flags)

查询与特定组关联的所有权限。

abstract void removePackageFromPreferred(String packageName)

此方法在API级别7中已弃用。此函数不再执行任何操作; 这是一种管理偏好活动的旧方法,已被现代基于活动的偏好取代(并与之冲突)。

abstract void removePermission(String name)

删除以前使用 addPermission(PermissionInfo)添加的权限。

abstract ResolveInfo resolveActivity(Intent intent, int flags)

确定针对给定意图执行的最佳操作。

abstract ProviderInfo resolveContentProvider(String name, int flags)

按其基本路径名称查找单个内容提供者。

abstract ResolveInfo resolveService(Intent intent, int flags)

确定为给定意图处理的最佳服务。

abstract void setApplicationEnabledSetting(String packageName, int newState, int flags)

设置应用程序的启用设置此设置将覆盖应用程序在其清单中可能已设置的任何启用状态。

abstract void setComponentEnabledSetting(ComponentName componentName, int newState, int flags)

为包组件(活动,接收者,服务,提供者)设置启用的设置。

abstract void setInstallerPackageName(String targetPackage, String installerPackageName)

更改与给定包关联的安装程序。

abstract void verifyPendingInstall(int id, int verificationCode)

允许侦听 package verification broadcast的包响应包管理器。

Inherited methods

From class java.lang.Object

Constants

COMPONENT_ENABLED_STATE_DEFAULT

Added in API level 1
int COMPONENT_ENABLED_STATE_DEFAULT

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :此组件或应用程序处于默认启用状态(如其清单中指定的那样)。

常量值:0(0x00000000)

COMPONENT_ENABLED_STATE_DISABLED

Added in API level 1
int COMPONENT_ENABLED_STATE_DISABLED

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :此组件或应用程序已被显式禁用,无论它在其清单中指定了什么。

常量值:2(0x00000002)

COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED

Added in API level 18
int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED

仅限于setApplicationEnabledSetting(String, int, int)标记:应该考虑此应用程序,直到用户真正想要使用它为止。 这意味着它通常不会显示给用户(例如在启动器中),但用户界面的各个部分可以使用GET_DISABLED_UNTIL_USED_COMPONENTS仍然可以看到它并允许用户选择它(例如IME,设备管理员等)。 这样的代码,一旦用户选择了应用程序,在这一点上也应该启用它。 该选项当前不能setComponentEnabledSetting(ComponentName, int, int)一起使用。

常量值:4(0x00000004)

COMPONENT_ENABLED_STATE_DISABLED_USER

Added in API level 14
int COMPONENT_ENABLED_STATE_DISABLED_USER

仅限于setApplicationEnabledSetting(String, int, int)标志:用户已明确禁用应用程序,无论其清单中指定了什么内容。 因为这是由用户的请求引起的,所以如果需要,他们可以通过适当的系统UI重新启用它。 此选项目前不能setComponentEnabledSetting(ComponentName, int, int)一起使用。

常量值:3(0x00000003)

COMPONENT_ENABLED_STATE_ENABLED

Added in API level 1
int COMPONENT_ENABLED_STATE_ENABLED

标志为 setApplicationEnabledSetting(String, int, int)setComponentEnabledSetting(ComponentName, int, int) :此组件或应用程序已被明确启用,无论其清单中指定了什么内容。

常数值:1(0x00000001)

DONT_KILL_APP

Added in API level 1
int DONT_KILL_APP

标志参数setComponentEnabledSetting(android.content.ComponentName, int, int)表示您不想杀死包含该组件的应用程序。 设置此项时要小心,因为更改的组件状态可能导致包含应用程序的行为不可预测。

常数值:1(0x00000001)

EXTRA_VERIFICATION_ID

Added in API level 14
String EXTRA_VERIFICATION_ID

包待处理验证的ID的额外字段名称。 传递给包验证器并用于回调至verifyPendingInstall(int, int)

常量值:“android.content.pm.extra.VERIFICATION_ID”

EXTRA_VERIFICATION_RESULT

Added in API level 17
String EXTRA_VERIFICATION_RESULT

验证结果的额外字段名称, VERIFICATION_ALLOWVERIFICATION_REJECT 验证包后,传递给包验证者。

常量值:“android.content.pm.extra.VERIFICATION_RESULT”

FEATURE_APP_WIDGETS

Added in API level 18
String FEATURE_APP_WIDGETS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持应用程序窗口小部件。

常量值:“android.software.app_widgets”

FEATURE_AUDIO_LOW_LATENCY

Added in API level 9
String FEATURE_AUDIO_LOW_LATENCY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的音频流水线延迟低,更适合对音频输入或输出延迟或延迟敏感的应用程序。

常量值:“android.hardware.audio.low_latency”

FEATURE_AUDIO_OUTPUT

Added in API level 21
String FEATURE_AUDIO_OUTPUT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备至少包含一种音频输出形式,如扬声器,音频插孔或通过蓝牙串流

常量值:“android.hardware.audio.output”

FEATURE_AUDIO_PRO

Added in API level 23
String FEATURE_AUDIO_PRO

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有专业级的功能和性能。

常量值:“android.hardware.audio.pro”

FEATURE_AUTOMOTIVE

Added in API level 23
String FEATURE_AUTOMOTIVE

针对getSystemAvailableFeatures()hasSystemFeature(String) :这是专门用于显示车辆头部UI的设备。 这里的headunit被定义为在可能或不可以移动的车辆内部。 Headunit使用中央控制台中的主显示器和/或仪表组中的其他显示器或车辆中的其他显示器。 Headunit显示器的尺寸和分辨率有限。 用户可能会专注于驾驶,所以限制驾驶员分心是主要关心的问题。 用户输入可以是各种硬按钮,触摸,旋转控制器,甚至类似鼠标的界面。

常数值:“android.hardware.type.automotive”

FEATURE_BACKUP

Added in API level 20
String FEATURE_BACKUP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以对安装的应用程序执行备份和恢复操作。

常量值:“android.software.backup”

FEATURE_BLUETOOTH

Added in API level 8
String FEATURE_BLUETOOTH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够通过蓝牙与其他设备进行通信。

常量值:“android.hardware.bluetooth”

FEATURE_BLUETOOTH_LE

Added in API level 18
String FEATURE_BLUETOOTH_LE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够通过蓝牙低功耗无线电与其他设备进行通信。

常量值:“android.hardware.bluetooth_le”

FEATURE_CAMERA

Added in API level 7
String FEATURE_CAMERA

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的相机背离屏幕。

常量值:“android.hardware.camera”

FEATURE_CAMERA_ANY

Added in API level 17
String FEATURE_CAMERA_ANY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备至少有一个摄像头指向某个方向,或者可以支持连接到该摄像头的外部摄像头。

常量值:“android.hardware.camera.any”

FEATURE_CAMERA_AUTOFOCUS

Added in API level 7
String FEATURE_CAMERA_AUTOFOCUS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的相机支持自动对焦。

常量值:“android.hardware.camera.autofocus”

FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING

Added in API level 21
String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一个摄像头支持 manual post-processing功能级别。

常量值:“android.hardware.camera.capability.manual_post_processing”

FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR

Added in API level 21
String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一台摄像机支持 manual sensor功能级别。

常量值:“android.hardware.camera.capability.manual_sensor”

FEATURE_CAMERA_CAPABILITY_RAW

Added in API level 21
String FEATURE_CAMERA_CAPABILITY_RAW

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一个摄像头支持 RAW功能级别。

常量值:“android.hardware.camera.capability.raw”

FEATURE_CAMERA_EXTERNAL

Added in API level 20
String FEATURE_CAMERA_EXTERNAL

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备可以支持连接外部相机。 外部摄像头可能并不总是连接或可供应用程序使用。

常量值:“android.hardware.camera.external”

FEATURE_CAMERA_FLASH

Added in API level 7
String FEATURE_CAMERA_FLASH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的相机支持闪光灯。

常量值:“android.hardware.camera.flash”

FEATURE_CAMERA_FRONT

Added in API level 9
String FEATURE_CAMERA_FRONT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有前置摄像头。

常量值:“android.hardware.camera.front”

FEATURE_CAMERA_LEVEL_FULL

Added in API level 21
String FEATURE_CAMERA_LEVEL_FULL

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上至少有一个摄像头支持 full hardware功能级别。

常量值:“android.hardware.camera.level.full”

FEATURE_CONNECTION_SERVICE

Added in API level 21
String FEATURE_CONNECTION_SERVICE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上启用了连接服务API。

常量值:“android.software.connectionservice”

FEATURE_CONSUMER_IR

Added in API level 19
String FEATURE_CONSUMER_IR

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备能够与消费类红外设备进行通信。

常量值:“android.hardware.consumerir”

FEATURE_DEVICE_ADMIN

Added in API level 19
String FEATURE_DEVICE_ADMIN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持通过设备管理员执行设备策略。

常量值:“android.software.device_admin”

FEATURE_ETHERNET

Added in API level 24
String FEATURE_ETHERNET

针对 getSystemAvailableFeatures()hasSystemFeature(String) :此设备支持以太网。

常量值:“android.hardware.ethernet”

FEATURE_FAKETOUCH

Added in API level 11
String FEATURE_FAKETOUCH

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备没有触摸屏,但支持基本事件的触摸模拟。 例如,该设备可能使用鼠标或遥控器来驱动光标,并模拟基本的触摸指针事件,如向下,向上,拖动等。支持android.hardware.touchscreen或子功能的所有设备也被假定为也支持faketouch。

常量值:“android.hardware.faketouch”

FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT

Added in API level 13
String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备没有触摸屏,但支持针对支持两个或多个手指的不同跟踪的基本事件的触摸模拟。 这是具有此功能的输入设备的FEATURE_FAKETOUCH的扩展。 请注意,与FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT定义的不同多点触控屏幕不同,这些类型的输入设备实际上不会提供完整的双指手势,因为输入正在转换为屏幕上的光标移动。 也就是说,单指手势会移动光标; 双指轻扫会导致单指触摸事件; 其他双手指手势将导致相应的双手指触摸事件。

常量值:“android.hardware.faketouch.multitouch.distinct”

FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND

Added in API level 13
String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备没有触摸屏,但支持基本事件的触摸模拟,支持完全独立地跟踪手指(5个或更多手指)。 这是具有此功能的输入设备的FEATURE_FAKETOUCH的扩展。 请注意,与FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND定义的多点触控屏幕不同,由于FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT所述的限制,并非所有两个手指手势都可以被检测到。

常量值:“android.hardware.faketouch.multitouch.jazzhand”

FEATURE_FINGERPRINT

Added in API level 23
String FEATURE_FINGERPRINT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有生物识别硬件来检测指纹。

常量值:“android.hardware.fingerprint”

FEATURE_FREEFORM_WINDOW_MANAGEMENT

Added in API level 24
String FEATURE_FREEFORM_WINDOW_MANAGEMENT

针对getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持自由形式窗口管理。 Windows有标题栏,可以移动和调整大小。

常量值:“android.software.freeform_window_management”

FEATURE_GAMEPAD

Added in API level 21
String FEATURE_GAMEPAD

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有必须被视为兼容游戏控制器的所有输入,或者包含一个兼容的游戏控制器。

常量值:“android.hardware.gamepad”

FEATURE_HIFI_SENSORS

Added in API level 23
String FEATURE_HIFI_SENSORS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持高保真度传感器处理功能。

常量值:“android.hardware.sensor.hifi_sensors”

FEATURE_HOME_SCREEN

Added in API level 18
String FEATURE_HOME_SCREEN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持可由第三方应用程序替换的主屏幕。

常量值:“android.software.home_screen”

FEATURE_INPUT_METHODS

Added in API level 18
String FEATURE_INPUT_METHODS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持添加使用 InputMethodService API实现的新输入方法。

常量值:“android.software.input_methods”

FEATURE_LEANBACK

Added in API level 21
String FEATURE_LEANBACK

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持leanback UI。 这通常用于客厅电视体验,但与FEATURE_TELEVISION不同,它是一种软件功能。 运行此功能的设备将使用与“电视”UI模式相关的资源。

常量值:“android.software.leanback”

FEATURE_LIVE_TV

Added in API level 21
String FEATURE_LIVE_TV

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持实时电视,并且可以显示来自使用 TvInputService API实现的电视输入的内容。

常量值:“android.software.live_tv”

FEATURE_LIVE_WALLPAPER

Added in API level 7
String FEATURE_LIVE_WALLPAPER

功能为 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持动态壁纸。

常量值:“android.software.live_wallpaper”

FEATURE_LOCATION

Added in API level 8
String FEATURE_LOCATION

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持一种或多种报告当前位置的方法。

常量值:“android.hardware.location”

FEATURE_LOCATION_GPS

Added in API level 8
String FEATURE_LOCATION_GPS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有全球定位系统接收器,可以报告精确的位置。

常量值:“android.hardware.location.gps”

FEATURE_LOCATION_NETWORK

Added in API level 8
String FEATURE_LOCATION_NETWORK

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以使用基于网络的地理定位系统以粗略的精度报告位置。

常量值:“android.hardware.location.network”

FEATURE_MANAGED_USERS

Added in API level 21
String FEATURE_MANAGED_USERS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持通过 DevicePolicyManager创建辅助用户和受管配置文件。

常量值:“android.software.managed_users”

FEATURE_MICROPHONE

Added in API level 8
String FEATURE_MICROPHONE

功能 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以通过麦克风录制音频。

常量值:“android.hardware.microphone”

FEATURE_MIDI

Added in API level 23
String FEATURE_MIDI

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有完整的android.media.midi。* API实现。

常量值:“android.software.midi”

FEATURE_NFC

Added in API level 9
String FEATURE_NFC

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备可以使用近场通信(NFC)进行通信。

常量值:“android.hardware.nfc”

FEATURE_NFC_HOST_CARD_EMULATION

Added in API level 19
String FEATURE_NFC_HOST_CARD_EMULATION

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持基于主机的NFC卡仿真。

常量值:“android.hardware.nfc.hce”

FEATURE_NFC_HOST_CARD_EMULATION_NFCF

Added in API level 24
String FEATURE_NFC_HOST_CARD_EMULATION_NFCF

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件支持基于主机的NFC-F卡仿真。

常量值:“android.hardware.nfc.hcef”

FEATURE_OPENGLES_EXTENSION_PACK

Added in API level 21
String FEATURE_OPENGLES_EXTENSION_PACK

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持OpenGL ES Android Extension Pack

常量值:“android.hardware.opengles.aep”

FEATURE_PICTURE_IN_PICTURE

Added in API level 24
String FEATURE_PICTURE_IN_PICTURE

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持画中画多窗口模式。

常量值:“android.software.picture_in_picture”

FEATURE_PRINTING

Added in API level 20
String FEATURE_PRINTING

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持打印。

常量值:“android.software.print”

FEATURE_SCREEN_LANDSCAPE

Added in API level 13
String FEATURE_SCREEN_LANDSCAPE

针对getSystemAvailableFeatures()hasSystemFeature(String) :设备支持横向方向屏幕。 为了向后兼容,您可以假设如果既没有设置也没有设置FEATURE_SCREEN_PORTRAIT ,那么设备支持纵向和横向。

常量值:“android.hardware.screen.landscape”

FEATURE_SCREEN_PORTRAIT

Added in API level 13
String FEATURE_SCREEN_PORTRAIT

功能getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持纵向方向屏幕。 为了向后兼容,您可以假设如果既没有设置也没有设置FEATURE_SCREEN_LANDSCAPE ,那么设备支持纵向和横向。

常量值:“android.hardware.screen.portrait”

FEATURE_SECURELY_REMOVES_USERS

Added in API level 21
String FEATURE_SECURELY_REMOVES_USERS

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持安全移除用户。 当用户被删除时,与该用户关联的数据将被安全删除并且不再可用。

常量值:“android.software.securely_removes_users”

FEATURE_SENSOR_ACCELEROMETER

Added in API level 8
String FEATURE_SENSOR_ACCELEROMETER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件包含一个加速计。

常量值:“android.hardware.sensor.accelerometer”

FEATURE_SENSOR_AMBIENT_TEMPERATURE

Added in API level 21
String FEATURE_SENSOR_AMBIENT_TEMPERATURE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个环境温度传感器。

常量值:“android.hardware.sensor.ambient_temperature”

FEATURE_SENSOR_BAROMETER

Added in API level 9
String FEATURE_SENSOR_BAROMETER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个气压计(气压传感器)。

常数值:“android.hardware.sensor.barometer”

FEATURE_SENSOR_COMPASS

Added in API level 8
String FEATURE_SENSOR_COMPASS

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个磁力计(指南针)。

常量值:“android.hardware.sensor.compass”

FEATURE_SENSOR_GYROSCOPE

Added in API level 9
String FEATURE_SENSOR_GYROSCOPE

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个陀螺仪。

常量值:“android.hardware.sensor.gyroscope”

FEATURE_SENSOR_HEART_RATE

Added in API level 20
String FEATURE_SENSOR_HEART_RATE

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个心率监测器。

常量值:“android.hardware.sensor.heartrate”

FEATURE_SENSOR_HEART_RATE_ECG

Added in API level 21
String FEATURE_SENSOR_HEART_RATE_ECG

针对 getSystemAvailableFeatures()hasSystemFeature(String) :此设备上的心率传感器是心电图。

常量值:“android.hardware.sensor.heartrate.ecg”

FEATURE_SENSOR_LIGHT

Added in API level 7
String FEATURE_SENSOR_LIGHT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包含一个光线传感器。

常量值:“android.hardware.sensor.light”

FEATURE_SENSOR_PROXIMITY

Added in API level 7
String FEATURE_SENSOR_PROXIMITY

特征为 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个接近传感器。

常量值:“android.hardware.sensor.proximity”

FEATURE_SENSOR_RELATIVE_HUMIDITY

Added in API level 21
String FEATURE_SENSOR_RELATIVE_HUMIDITY

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备包括一个相对湿度传感器。

常量值:“android.hardware.sensor.relative_humidity”

FEATURE_SENSOR_STEP_COUNTER

Added in API level 19
String FEATURE_SENSOR_STEP_COUNTER

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件包含一个硬件步进计数器。

常量值:“android.hardware.sensor.stepcounter”

FEATURE_SENSOR_STEP_DETECTOR

Added in API level 19
String FEATURE_SENSOR_STEP_DETECTOR

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该器件包含一个硬件步骤检测器。

常量值:“android.hardware.sensor.stepdetector”

FEATURE_SIP

Added in API level 9
String FEATURE_SIP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备上已启用SIP API。

常量值:“android.software.sip”

FEATURE_SIP_VOIP

Added in API level 9
String FEATURE_SIP_VOIP

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持基于SIP的VOIP。

常量值:“android.software.sip.voip”

FEATURE_TELEPHONY

Added in API level 7
String FEATURE_TELEPHONY

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有支持数据通信的电话无线电。

常量值:“android.hardware.telephony”

FEATURE_TELEPHONY_CDMA

Added in API level 7
String FEATURE_TELEPHONY_CDMA

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有CDMA电话堆栈。

常量值:“android.hardware.telephony.cdma”

FEATURE_TELEPHONY_GSM

Added in API level 7
String FEATURE_TELEPHONY_GSM

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有GSM电话堆栈。

常量值:“android.hardware.telephony.gsm”

FEATURE_TELEVISION

Added in API level 16
String FEATURE_TELEVISION

此常数在API级别21中已弃用。
改为使用FEATURE_LEANBACK

针对getSystemAvailableFeatures()hasSystemFeature(String) :这是专门用于在电视上显示用户界面的设备。 这里的电视被定义为典型的起居室电视体验:显示在大屏幕上,用户远离它,并且主要输入形式将像DPAD那样,而不是通过触摸或鼠标。

常量值:“android.hardware.type.television”

FEATURE_TOUCHSCREEN

Added in API level 8
String FEATURE_TOUCHSCREEN

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的显示屏具有触摸屏。

常数值:“android.hardware.touchscreen”

FEATURE_TOUCHSCREEN_MULTITOUCH

Added in API level 7
String FEATURE_TOUCHSCREEN_MULTITOUCH

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的触摸屏支持多点触控,足以进行基本的双指手势检测。

常量值:“android.hardware.touchscreen.multitouch”

FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT

Added in API level 8
String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备的触摸屏能够完全独立地跟踪两个或更多手指。

常量值:“android.hardware.touchscreen.multitouch.distinct”

FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND

Added in API level 9
String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备的触摸屏能够完全独立地跟踪完整的手指 - 即5个或更多同步独立指针。

常量值:“android.hardware.touchscreen.multitouch.jazzhand”

FEATURE_USB_ACCESSORY

Added in API level 12
String FEATURE_USB_ACCESSORY

功能 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持连接到USB附件。

常量值:“android.hardware.usb.accessory”

FEATURE_USB_HOST

Added in API level 12
String FEATURE_USB_HOST

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持作为USB主机连接到USB设备。

常量值:“android.hardware.usb.host”

FEATURE_VERIFIED_BOOT

Added in API level 21
String FEATURE_VERIFIED_BOOT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :设备支持验证的引导。

常量值:“android.software.verified_boot”

FEATURE_VR_MODE

Added in API level 24
String FEATURE_VR_MODE

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备为处理通知的立体渲染的虚拟现实(VR)应用程序实现了优化模式,并在VR应用程序具有用户焦点时禁用大多数单眼系统UI组件。 宣布此功能的设备必须包含一个实现VrListenerService的应用程序,该应用程序可以通过setVrModeEnabled(boolean, ComponentName)由VR应用程序进行setVrModeEnabled(boolean, ComponentName)

常量值:“android.software.vr.mode”

FEATURE_VR_MODE_HIGH_PERFORMANCE

Added in API level 24
String FEATURE_VR_MODE_HIGH_PERFORMANCE

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备实现了FEATURE_VR_MODE但额外满足额外的CDD要求以提供高质量的VR体验。 一般来说,声明此功能的设备还将:

  • Deliver consistent performance at a high framerate over an extended period of time for typical VR application CPU/GPU workloads with a minimal number of frame drops for VR applications that have called setSustainedPerformanceMode(boolean).
  • Implement FEATURE_HIFI_SENSORS and have a low sensor latency.
  • Include optimizations to lower display persistence while running VR applications.
  • Implement an optimized render path to minimize latency to draw to the device's main display.
  • Include the following EGL extensions: EGL_ANDROID_create_native_client_buffer, EGL_ANDROID_front_buffer_auto_refresh, EGL_EXT_protected_content, EGL_KHR_mutable_render_buffer, EGL_KHR_reusable_sync, and EGL_KHR_wait_sync.
  • Provide at least one CPU core that is reserved for use solely by the top, foreground VR application process for critical render threads while such an application is running.

常量值:“android.hardware.vr.high_performance”

FEATURE_VULKAN_HARDWARE_LEVEL

Added in API level 24
String FEATURE_VULKAN_HARDWARE_LEVEL

针对 getSystemAvailableFeatures()hasSystemFeature(String, int)功能:如果支持此功能,Vulkan本地API将枚举至少一个 VkPhysicalDevice ,功能版本将指示其支持的可选硬件功能的限制级别。

0级包含Vulkan的基本要求以及:

  • VkPhysicalDeviceFeatures::textureCompressionETC2

1级还包括:

  • VkPhysicalDeviceFeatures::fullDrawIndexUint32
  • VkPhysicalDeviceFeatures::imageCubeArray
  • VkPhysicalDeviceFeatures::independentBlend
  • VkPhysicalDeviceFeatures::geometryShader
  • VkPhysicalDeviceFeatures::tessellationShader
  • VkPhysicalDeviceFeatures::sampleRateShading
  • VkPhysicalDeviceFeatures::textureCompressionASTC_LDR
  • VkPhysicalDeviceFeatures::fragmentStoresAndAtomics
  • VkPhysicalDeviceFeatures::shaderImageGatherExtended
  • VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing
  • VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing

常量值:“android.hardware.vulkan.level”

FEATURE_VULKAN_HARDWARE_VERSION

Added in API level 24
String FEATURE_VULKAN_HARDWARE_VERSION

功能为getSystemAvailableFeatures()hasSystemFeature(String, int) :此功能的版本表示最高VkPhysicalDeviceProperties::apiVersion由支持所指示的硬件级别的物理设备支持FEATURE_VULKAN_HARDWARE_LEVEL 功能版本使用与Vulkan版本号相同的编码:

  • Major version number in bits 31-22
  • Minor version number in bits 21-12
  • Patch version number in bits 11-0

常量值:“android.hardware.vulkan.version”

FEATURE_WATCH

Added in API level 20
String FEATURE_WATCH

针对getSystemAvailableFeatures()hasSystemFeature(String) :这是一款专门用于在手表上显示用户界面的设备。 这里的腕表被定义为佩戴在身体上的装置,可能是手腕上的装置。 与设备进行交互时,用户非常靠近。

常量值:“android.hardware.type.watch”

FEATURE_WEBVIEW

Added in API level 20
String FEATURE_WEBVIEW

针对getSystemAvailableFeatures()hasSystemFeature(String) :该设备具有完整的android.webkit。* API实现。 缺少此功能的设备将无法正常运行WebView实施。

常量值:“android.software.webview”

FEATURE_WIFI

Added in API level 8
String FEATURE_WIFI

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持WiFi(802.11)网络。

常量值:“android.hardware.wifi”

FEATURE_WIFI_DIRECT

Added in API level 14
String FEATURE_WIFI_DIRECT

针对 getSystemAvailableFeatures()hasSystemFeature(String) :该设备支持Wi-Fi Direct网络。

常量值:“android.hardware.wifi.direct”

GET_ACTIVITIES

Added in API level 1
int GET_ACTIVITIES

PackageInfo标志:返回有关 activities中包中活动的信息。

常数值:1(0x00000001)

GET_CONFIGURATIONS

Added in API level 3
int GET_CONFIGURATIONS

PackageInfo标志:返回有关 PackageInfo.configPreferences硬件首选项的 PackageInfo.configPreferences ,以及 reqFeaturesfeatureGroups请求功能。

常量值:16384(0x00004000)

GET_DISABLED_COMPONENTS

Added in API level 1
int GET_DISABLED_COMPONENTS

此常数在API级别24中已弃用。
换成MATCH_DISABLED_COMPONENTS

常量值:512(0x00000200)

GET_DISABLED_UNTIL_USED_COMPONENTS

Added in API level 18
int GET_DISABLED_UNTIL_USED_COMPONENTS

此常数在API级别24中已弃用。
换成MATCH_DISABLED_UNTIL_USED_COMPONENTS

常量值:32768(0x00008000)

GET_GIDS

Added in API level 1
int GET_GIDS

PackageInfo标志:返回与应用程序关联的group ids 这适用于任何直接返回PackageInfo类或嵌套在另一个类中的API。

常量值:256(0x00000100)

GET_INSTRUMENTATION

Added in API level 1
int GET_INSTRUMENTATION

PackageInfo标志:返回有关 instrumentation中的包中的 instrumentation

常量值:16(0x00000010)

GET_INTENT_FILTERS

Added in API level 1
int GET_INTENT_FILTERS

PackageInfo flag:返回有关活动支持的意图过滤器的信息。

常量值:32(0x00000020)

GET_META_DATA

Added in API level 1
int GET_META_DATA

ComponentInfo标志:返回与组件关联的metaData数据Bundle 这适用于返回ComponentInfo子类的任何API。

常量值:128(0x00000080)

GET_PERMISSIONS

Added in API level 1
int GET_PERMISSIONS

PackageInfo标志:返回有关 permissions中的包中的权限的信息。

常量值:4096(0x00001000)

GET_PROVIDERS

Added in API level 1
int GET_PROVIDERS

PackageInfo flag:返回有关 providers中的包中的内容提供者的信息。

常量值:8(0x00000008)

GET_RECEIVERS

Added in API level 1
int GET_RECEIVERS

PackageInfo标志:返回有关 receivers中包中的意图接收者的信息。

常量值:2(0x00000002)

GET_RESOLVED_FILTER

Added in API level 1
int GET_RESOLVED_FILTER

ResolveInfo标志:返回在特定ResolveInfo匹配的IntentFilter filter

常量值:64(0x00000040)

GET_SERVICES

Added in API level 1
int GET_SERVICES

PackageInfo flag:返回有关 services中的包中的服务的信息。

常量值:4(0x00000004)

GET_SHARED_LIBRARY_FILES

Added in API level 1
int GET_SHARED_LIBRARY_FILES

ApplicationInfo标志:返回与应用程序关联的paths to the shared libraries 这适用于任何直接返回ApplicationInfo类或嵌套在另一个API中的API。

常量值:1024(0x00000400)

GET_SIGNATURES

Added in API level 1
int GET_SIGNATURES

PackageInfo标记:返回有关包中包含的签名的信息。

常量值:64(0x00000040)

GET_UNINSTALLED_PACKAGES

Added in API level 3
int GET_UNINSTALLED_PACKAGES

此常数在API级别24中已弃用。
换成MATCH_UNINSTALLED_PACKAGES

常量值:8192(0x00002000)

GET_URI_PERMISSION_PATTERNS

Added in API level 1
int GET_URI_PERMISSION_PATTERNS

ProviderInfo标志:返回与内容提供者关联的URI permission patterns 这适用于任何直接返回ProviderInfo类或嵌套在另一个API内的API。

常量值:2048(0x00000800)

MATCH_ALL

Added in API level 23
int MATCH_ALL

查询标志:如果设置,并且平台正在对结果进行任何筛选,则不会发生筛选。 这是说所有结果都应该返回的同义词。

这个标志应该非常小心使用。

常量值:131072(0x00020000)

MATCH_DEFAULT_ONLY

Added in API level 1
int MATCH_DEFAULT_ONLY

分辨率和查询标志:如果设置,仅支持CATEGORY_DEFAULT过滤器将被视为匹配。 这是在您提供的Intent中包含CATEGORY_DEFAULT的同义词。

常量值:65536(0x00010000)

MATCH_DIRECT_BOOT_AWARE

Added in API level 24
int MATCH_DIRECT_BOOT_AWARE

查询标志:匹配组件,这些组件直接引导 意识到在返回的信息,而不管当前用户状态的。

如果未指定MATCH_DIRECT_BOOT_AWAREMATCH_DIRECT_BOOT_UNAWARE ,则缺省行为是仅基于用户状态匹配可运行组件。 例如,当用户启动但凭证尚未呈现时,用户正在运行“锁定”,并且仅返回MATCH_DIRECT_BOOT_AWARE组件。 一旦用户证书已经呈现,用户正在运行“解锁”,并返回MATCH_DIRECT_BOOT_AWAREMATCH_DIRECT_BOOT_UNAWARE组件。

也可以看看:

常量值:524288(0x00080000)

MATCH_DIRECT_BOOT_UNAWARE

Added in API level 24
int MATCH_DIRECT_BOOT_UNAWARE

查询标志:匹配在返回信息中 不知道直接启动的组件,而不管当前用户状态如何。

如果未指定MATCH_DIRECT_BOOT_AWAREMATCH_DIRECT_BOOT_UNAWARE ,则默认行为是仅基于用户状态匹配可运行组件。 例如,当用户启动但凭证尚未显示时,用户正在运行“锁定”,并且仅返回MATCH_DIRECT_BOOT_AWARE组件。 一旦用户证书被提交,用户正在运行“解锁”,并返回MATCH_DIRECT_BOOT_AWAREMATCH_DIRECT_BOOT_UNAWARE组件。

也可以看看:

常量值:262144(0x00040000)

MATCH_DISABLED_COMPONENTS

Added in API level 24
int MATCH_DISABLED_COMPONENTS

PackageInfo标志:在返回的信息中包含禁用的组件。

常量值:512(0x00000200)

MATCH_DISABLED_UNTIL_USED_COMPONENTS

Added in API level 24
int MATCH_DISABLED_UNTIL_USED_COMPONENTS

PackageInfo标志:包含仅在返回信息中因为COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED而处于该状态的禁用组件。 请注意,如果您设置此标志,处于此禁用状态的应用程序将被报告为已启用。

常量值:32768(0x00008000)

MATCH_SYSTEM_ONLY

Added in API level 24
int MATCH_SYSTEM_ONLY

查询标志:仅包含来自标记为 FLAG_SYSTEM应用程序的组件。

常量值:1048576(0x00100000)

MATCH_UNINSTALLED_PACKAGES

Added in API level 24
int MATCH_UNINSTALLED_PACKAGES

标记参数来检索有关所有应用程序(甚至是未安装的应用程序)的有关数据目录的信息。 如果应用程序已被删除,并且标志DONT_DELETE_DATA将来可能被替换或重新安装,则可能导致此状态。

注意:此标志可能会导致返回有关当前安装的应用程序的更少信息。

常量值:8192(0x00002000)

MAXIMUM_VERIFICATION_TIMEOUT

Added in API level 17
long MAXIMUM_VERIFICATION_TIMEOUT

可以用作millisecondsToDelay参数为extendVerificationTimeout(int, int, long) 这是PackageManager等待验证代理返回的最长时间(以毫秒为单位)。

常量值:3600000(0x000000000036ee80)

PERMISSION_DENIED

Added in API level 1
int PERMISSION_DENIED

权限检查结果:如果权限未被授予给定包,则返回 checkPermission(String, String)

常量值:-1(0xffffffff)

PERMISSION_GRANTED

Added in API level 1
int PERMISSION_GRANTED

权限检查结果:如果权限已授予给定包,则返回 checkPermission(String, String)

常量值:0(0x00000000)

SIGNATURE_FIRST_NOT_SIGNED

Added in API level 1
int SIGNATURE_FIRST_NOT_SIGNED

签名检查结果:如果第一个包没有签名,但第二个包没有签名,则返回 checkSignatures(int, int)

常量值:-1(0xffffffff)

SIGNATURE_MATCH

Added in API level 1
int SIGNATURE_MATCH

签名检查结果:如果两个包中的所有签名匹配,则返回 checkSignatures(int, int)

常量值:0(0x00000000)

SIGNATURE_NEITHER_SIGNED

Added in API level 1
int SIGNATURE_NEITHER_SIGNED

签名检查结果:如果两个软件包均未签名,则返回 checkSignatures(int, int)

常数值:1(0x00000001)

SIGNATURE_NO_MATCH

Added in API level 1
int SIGNATURE_NO_MATCH

签名检查结果:如果两个包中的签名都不匹配,则返回 checkSignatures(int, int)

常量值:-3(0xfffffffd)

SIGNATURE_SECOND_NOT_SIGNED

Added in API level 1
int SIGNATURE_SECOND_NOT_SIGNED

签名检查结果:如果第二个软件包未签名,但第一个签名为,则返回 checkSignatures(int, int)

常量值:-2(0xfffffffe)

SIGNATURE_UNKNOWN_PACKAGE

Added in API level 1
int SIGNATURE_UNKNOWN_PACKAGE

签名检查结果:如果任一软件包无效,则返回 checkSignatures(int, int)

常量值:-4(0xfffffffc)

VERIFICATION_ALLOW

Added in API level 14
int VERIFICATION_ALLOW

用作 verificationCode参数 verifyPendingInstall(int, int)以指示调用程序包验证程序允许继续安装。

常数值:1(0x00000001)

VERIFICATION_REJECT

Added in API level 14
int VERIFICATION_REJECT

用作 verificationCode参数 verifyPendingInstall(int, int)以指示调用程序包验证程序未投票允许安装继续。

常量值:-1(0xffffffff)

Public constructors

PackageManager

Added in API level 1
PackageManager ()

Public methods

addPackageToPreferred

Added in API level 1
void addPackageToPreferred (String packageName)

此方法在API级别7中已被弃用。
这个功能不再做任何事情; 这是一种管理偏好活动的旧方法,已被现代基于活动的偏好取代(并与之冲突)。

Parameters
packageName String

addPermission

Added in API level 1
boolean addPermission (PermissionInfo info)

为系统添加一个新的动态权限。 为此,您的包必须通过清单中的<permission-tree>标记定义一个权限树。 一个包只能向由自己的包或另一个用相同的用户ID定义的树添加权限; 如果许可树与许可树的名称匹配+“。”,则许可在树中:例如,“com.foo.bar”是许可树“com.foo”的成员。

允许您的权限树名称是描述性的,因为您正在占有整套权限名称。 因此,它必须位于您控制的域下,其后缀不会与可能在属于该域的任何应用程序中声明的任何常规权限相匹配。

在使用这些权限的任何.apks安装之前,必须添加新权限。 通过此方法添加的权限在设备重新启动时会被记住。 如果授予的权限已经存在,则您在此提供的信息将用于更新它。

Parameters
info PermissionInfo: Description of the permission to be added.
Returns
boolean Returns true if a new permission was created, false if an existing one was updated.
Throws
SecurityException if you are not allowed to add the given permission name.

也可以看看:

addPermissionAsync

Added in API level 8
boolean addPermissionAsync (PermissionInfo info)

addPermission(PermissionInfo)但在从调用返回后异步地保留了包管理器状态,从而允许它更快地返回并批处理一系列添加,但不保证在写入设备之前重新启动设备时将保留添加的权限。

Parameters
info PermissionInfo
Returns
boolean

addPreferredActivity

Added in API level 1
void addPreferredActivity (IntentFilter filter, 
                int match, 
                ComponentName[] set, 
                ComponentName activity)

此方法在API级别8中已被弃用。
这是一个受保护的API,应该不可用于第三方应用程序。 平台负责分配首选活动,并且不能直接修改。 向系统添加一个新的首选活动映射。 Context.startActivity()找到多个匹配活动并且与给定的过滤器匹配时,这将用于自动选择给定的活动组件。

Parameters
filter IntentFilter: The set of intents under which this activity will be made preferred.
match int: The IntentFilter match category that this preference applies to.
set ComponentName: The set of activities that the user was picking from when this preference was made.
activity ComponentName: The component name of the activity that is to be preferred.

canonicalToCurrentPackageNames

Added in API level 8
String[] canonicalToCurrentPackageNames (String[] names)

从软件包规范名称映射到设备上正在使用的当前名称。

Parameters
names String: Array of new names to be mapped.
Returns
String[] Returns an array of the same size as the original, containing the current name for each package.

checkPermission

Added in API level 1
int checkPermission (String permName, 
                String pkgName)

检查一个特定的包是否已被授予特定的权限。

Parameters
permName String: The name of the permission you are checking for.
pkgName String: The name of the package you are checking against.
Returns
int If the package has the permission, PERMISSION_GRANTED is returned. If it does not have the permission, PERMISSION_DENIED is returned.

也可以看看:

checkSignatures

Added in API level 1
int checkSignatures (String pkg1, 
                String pkg2)

比较两个包的签名以确定两个包中是否出现相同的签名。 如果它们包含相同的签名,则在彼此协作时允许使用特殊权限:它们可以共享相同的用户标识,相互运行检测等。

Parameters
pkg1 String: First package name whose signature will be compared.
pkg2 String: Second package name whose signature will be compared.
Returns
int Returns an integer indicating whether all signatures on the two packages match. The value is >= 0 (SIGNATURE_MATCH) if all signatures match or < 0 if there is not a match (SIGNATURE_NO_MATCH or SIGNATURE_UNKNOWN_PACKAGE).

也可以看看:

checkSignatures

Added in API level 5
int checkSignatures (int uid1, 
                int uid2)

checkSignatures(String, String)一样,但需要检查两个软件包的UID。 例如,在IPC中进行检查时,这可能很有用,其中UID是唯一可用的标识。 它在功能上与确定与UID相关的包并检查其签名的功能相同。

Parameters
uid1 int: First UID whose signature will be compared.
uid2 int: Second UID whose signature will be compared.
Returns
int Returns an integer indicating whether all signatures on the two packages match. The value is >= 0 (SIGNATURE_MATCH) if all signatures match or < 0 if there is not a match (SIGNATURE_NO_MATCH or SIGNATURE_UNKNOWN_PACKAGE).

也可以看看:

clearPackagePreferredActivities

Added in API level 1
void clearPackagePreferredActivities (String packageName)

从其活动以给定包名称实现的系统中删除以前添加了addPreferredActivity(IntentFilter, int, ComponentName[], ComponentName)所有首选活动映射。 应用程序只能清除自己的包。

Parameters
packageName String: The name of the package whose preferred activity mappings are to be removed.

currentToCanonicalPackageNames

Added in API level 8
String[] currentToCanonicalPackageNames (String[] names)

从设备上使用的当前软件包名称映射到该软件包当前的规范名称。

Parameters
names String: Array of current names to be mapped.
Returns
String[] Returns an array of the same size as the original, containing the canonical name for each package.

extendVerificationTimeout

Added in API level 17
void extendVerificationTimeout (int id, 
                int verificationCodeAtTimeout, 
                long millisecondsToDelay)

允许侦听package verification broadcast的包延长响应的默认超时时间,并声明发生超时后要执行的操作。 响应必须包含verificationCodeAtTimeout这是一个VERIFICATION_ALLOWVERIFICATION_REJECT 此方法只能在每个包ID中调用一次。 其他呼叫将不起作用。

Parameters
id int: pending package identifier as passed via the EXTRA_VERIFICATION_ID Intent extra.
verificationCodeAtTimeout int: either VERIFICATION_ALLOW or VERIFICATION_REJECT. If verificationCodeAtTimeout is neither VERIFICATION_ALLOW or VERIFICATION_REJECT, then verificationCodeAtTimeout will default to VERIFICATION_REJECT.
millisecondsToDelay long: the amount of time requested for the timeout. Must be positive and less than MAXIMUM_VERIFICATION_TIMEOUT. If millisecondsToDelay is out of bounds, millisecondsToDelay will be set to the closest in bounds value; namely, 0 or MAXIMUM_VERIFICATION_TIMEOUT.
Throws
SecurityException if the caller does not have the PACKAGE_VERIFICATION_AGENT permission.

getActivityBanner

Added in API level 20
Drawable getActivityBanner (Intent intent)

检索与意图关联的横幅。 如果设置了intent.getClassName(),则只返回getActivityBanner(intent.getClassName())的结果。 否则,它将解析意图的组件并返回与已解析组件关联的横幅。 如果找不到intent.getClassName()或Intent不能解析为组件,则引发NameNotFoundException。

Parameters
intent Intent: The intent for which you would like to retrieve a banner.
Returns
Drawable Returns the image of the banner, or null if the activity has no banner specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

也可以看看:

getActivityBanner

Added in API level 20
Drawable getActivityBanner (ComponentName activityName)

检索与活动关联的横幅。 给定一个活动的全名,检索关于它的信息并且调用ComponentInfo.loadIcon()返回其横幅。 如果找不到该活动,则抛出NameNotFoundException。

Parameters
activityName ComponentName: Name of the activity whose banner is to be retrieved.
Returns
Drawable Returns the image of the banner, or null if the activity has no banner specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

也可以看看:

getActivityIcon

Added in API level 1
Drawable getActivityIcon (Intent intent)

检索与意图关联的图标。 如果设置了intent.getClassName(),则只返回getActivityIcon(intent.getClassName())的结果。 否则,它会解析意图的组件并返回与解析组件相关联的图标。 如果找不到intent.getClassName()或Intent不能解析为组件,则引发NameNotFoundException。

Parameters
intent Intent: The intent for which you would like to retrieve an icon.
Returns
Drawable Returns the image of the icon, or the default activity icon if it could not be found. Does not return null.
Throws
PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

也可以看看:

getActivityIcon

Added in API level 1
Drawable getActivityIcon (ComponentName activityName)

检索与活动关联的图标。 给定一个活动的全名,检索关于它的信息并且调用ComponentInfo.loadIcon()返回它的图标。 如果找不到该活动,则抛出NameNotFoundException。

Parameters
activityName ComponentName: Name of the activity whose icon is to be retrieved.
Returns
Drawable Returns the image of the icon, or the default activity icon if it could not be found. Does not return null.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

也可以看看:

getActivityInfo

Added in API level 1
ActivityInfo getActivityInfo (ComponentName component, 
                int flags)

检索我们了解的特定活动类的所有信息。

Parameters
component ComponentName: The full component name (i.e. com.google.apps.contacts/com.google.apps.contacts. ContactsList) of an Activity class.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ActivityInfo An ActivityInfo containing information about the activity.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getActivityLogo

Added in API level 9
Drawable getActivityLogo (Intent intent)

检索与意图关联的徽标。 如果设置了intent.getClassName(),则只返回getActivityLogo(intent.getClassName())的结果。 否则,它会解析意图的组件并返回与已解析组件关联的徽标。 如果找不到intent.getClassName()或Intent不能解析为组件,则引发NameNotFoundException。

Parameters
intent Intent: The intent for which you would like to retrieve a logo.
Returns
Drawable Returns the image of the logo, or null if the activity has no logo specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

也可以看看:

getActivityLogo

Added in API level 9
Drawable getActivityLogo (ComponentName activityName)

检索与活动关联的徽标。 给定一个活动的全名,检索关于它的信息并且调用ComponentInfo.loadLogo()返回它的标志。 如果找不到该活动,则抛出NameNotFoundException。

Parameters
activityName ComponentName: Name of the activity whose logo is to be retrieved.
Returns
Drawable Returns the image of the logo or null if the activity has no logo specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

也可以看看:

getAllPermissionGroups

Added in API level 1
List<PermissionGroupInfo> getAllPermissionGroups (int flags)

检索系统中的所有已知权限组。

Parameters
flags int: Additional option flags. Use GET_META_DATA to retrieve any meta-data associated with the permission group.
Returns
List<PermissionGroupInfo> Returns a list of PermissionGroupInfo containing information about all of the known permission groups.

也可以看看:

getApplicationBanner

Added in API level 20
Drawable getApplicationBanner (ApplicationInfo info)

检索与应用程序关联的横幅。

Parameters
info ApplicationInfo: Information about application being queried.
Returns
Drawable Returns the image of the banner or null if the application has no banner specified.

也可以看看:

getApplicationBanner

Added in API level 20
Drawable getApplicationBanner (String packageName)

检索与应用程序关联的横幅。 给定应用程序包的名称,检索关于它的信息并调用getApplicationIcon()返回其横幅。 如果找不到应用程序,则引发NameNotFoundException。

Parameters
packageName String: Name of the package whose application banner is to be retrieved.
Returns
Drawable Returns the image of the banner or null if the application has no banner specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

也可以看看:

getApplicationEnabledSetting

Added in API level 1
int getApplicationEnabledSetting (String packageName)

返回应用程序的启用设置。 这将返回由setApplicationEnabledSetting(String, int, int)设置的最后一个值; 在大多数情况下,该值将是COMPONENT_ENABLED_STATE_DEFAULT因为清单中最初指定的值未被修改。

Parameters
packageName String: The package name of the application to retrieve.
Returns
int Returns the current enabled state for the application. May be one of COMPONENT_ENABLED_STATE_ENABLED, COMPONENT_ENABLED_STATE_DISABLED, or COMPONENT_ENABLED_STATE_DEFAULT. The last one means the application's enabled state is based on the original information in the manifest as found in ComponentInfo.
Throws
IllegalArgumentException if the named package does not exist.

getApplicationIcon

Added in API level 1
Drawable getApplicationIcon (String packageName)

检索与应用程序关联的图标。 给定应用程序包的名称,检索关于它的信息并调用getApplicationIcon()返回其图标。 如果找不到应用程序,则引发NameNotFoundException。

Parameters
packageName String: Name of the package whose application icon is to be retrieved.
Returns
Drawable Returns the image of the icon, or the default application icon if it could not be found. Does not return null.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

也可以看看:

getApplicationIcon

Added in API level 1
Drawable getApplicationIcon (ApplicationInfo info)

检索与应用程序关联的图标。 如果它没有定义图标,则返回默认的应用程序图标。 不返回null。

Parameters
info ApplicationInfo: Information about application being queried.
Returns
Drawable Returns the image of the icon, or the default application icon if it could not be found.

也可以看看:

getApplicationInfo

Added in API level 1
ApplicationInfo getApplicationInfo (String packageName, 
                int flags)

检索我们所了解的有关特定软件包/应用程序的所有信息。

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of an application.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_SYSTEM_ONLY, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ApplicationInfo An ApplicationInfo containing information about the package. If flag MATCH_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the application information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DONT_DELETE_DATA flag set).
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getApplicationLabel

Added in API level 1
CharSequence getApplicationLabel (ApplicationInfo info)

返回用于此应用程序的标签。

Parameters
info ApplicationInfo: The application to get the label of.
Returns
CharSequence Returns the label associated with this application, or null if it could not be found for any reason.

getApplicationLogo

Added in API level 9
Drawable getApplicationLogo (String packageName)

检索与应用程序关联的徽标。 鉴于应用程序包的名称,检索有关它的信息并调用getApplicationLogo()返回其徽标。 如果找不到应用程序,则引发NameNotFoundException。

Parameters
packageName String: Name of the package whose application logo is to be retrieved.
Returns
Drawable Returns the image of the logo, or null if no application logo has been specified.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

也可以看看:

getApplicationLogo

Added in API level 9
Drawable getApplicationLogo (ApplicationInfo info)

检索与应用程序关联的徽标。 如果它没有指定徽标,则此方法返回null。

Parameters
info ApplicationInfo: Information about application being queried.
Returns
Drawable Returns the image of the logo, or null if no logo is specified by the application.

也可以看看:

getComponentEnabledSetting

Added in API level 1
int getComponentEnabledSetting (ComponentName componentName)

返回包组件(活动,接收者,服务,提供者)的启用设置。 这将返回由setComponentEnabledSetting(ComponentName, int, int)设置的最后一个值; 在大多数情况下,该值将是COMPONENT_ENABLED_STATE_DEFAULT因为清单中最初指定的值未被修改。

Parameters
componentName ComponentName: The component to retrieve.
Returns
int Returns the current enabled state for the component. May be one of COMPONENT_ENABLED_STATE_ENABLED, COMPONENT_ENABLED_STATE_DISABLED, or COMPONENT_ENABLED_STATE_DEFAULT. The last one means the component's enabled state is based on the original information in the manifest as found in ComponentInfo.

getDefaultActivityIcon

Added in API level 1
Drawable getDefaultActivityIcon ()

返回未定义特定图标时使用的活动的通用图标。

Returns
Drawable Drawable Image of the icon.

getDrawable

Added in API level 1
Drawable getDrawable (String packageName, 
                int resid, 
                ApplicationInfo appInfo)

从包中检索图像。 这是各种包管理器信息结构(例如ComponentInfo用于实现其关联图标检索的低级API。

Parameters
packageName String: The name of the package that this icon is coming from. Cannot be null.
resid int: The resource identifier of the desired image. Cannot be 0.
appInfo ApplicationInfo: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Returns
Drawable Returns a Drawable holding the requested image. Returns null if an image could not be found for any reason.

getInstalledApplications

Added in API level 1
List<ApplicationInfo> getInstalledApplications (int flags)

返回设备上安装的所有应用程序包的列表。 如果已设置标志GET_UNINSTALLED_PACKAGES,则将返回所有应用程序的列表,包括使用DONT_DELETE_DATA (部分安装的具有数据目录的应用程序)删除的应用程序的列表。

Parameters
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_SYSTEM_ONLY, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<ApplicationInfo> A List of ApplicationInfo objects, one for each installed application. In the unlikely case there are no installed packages, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the application information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DONT_DELETE_DATA flag set).

也可以看看:

getInstalledPackages

Added in API level 1
List<PackageInfo> getInstalledPackages (int flags)

返回设备上安装的所有软件包的列表。

Parameters
flags int: Additional option flags. Use any combination of GET_ACTIVITIES, GET_CONFIGURATIONS, GET_GIDS, GET_INSTRUMENTATION, GET_INTENT_FILTERS, GET_META_DATA, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SHARED_LIBRARY_FILES, GET_SIGNATURES, GET_URI_PERMISSION_PATTERNS, GET_UNINSTALLED_PACKAGES, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<PackageInfo> A List of PackageInfo objects, one for each installed package, containing information about the package. In the unlikely case there are no installed packages, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DONT_DELETE_DATA flag set).

也可以看看:

getInstallerPackageName

Added in API level 5
String getInstallerPackageName (String packageName)

检索安装软件包的应用程序的软件包名称。 这标识了该软件包来自哪个市场。

Parameters
packageName String: The name of the package to query
Returns
String

getInstrumentationInfo

Added in API level 1
InstrumentationInfo getInstrumentationInfo (ComponentName className, 
                int flags)

检索我们了解的特定仪器类的所有信息。

Parameters
className ComponentName: The full name (i.e. com.google.apps.contacts.InstrumentList) of an Instrumentation class.
flags int: Additional option flags. Use any combination of GET_META_DATA to modify the data returned.
Returns
InstrumentationInfo An InstrumentationInfo object containing information about the instrumentation.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getLaunchIntentForPackage

Added in API level 3
Intent getLaunchIntentForPackage (String packageName)

返回一个“良好”的意图在包装中发起前门活动。 例如,这用于在浏览包时实现“打开”按钮。 目前的实现首先查找在类别中的主要活动CATEGORY_INFO ,并在下一类为主要活动CATEGORY_LAUNCHER 如果null则返回null

Parameters
packageName String: The name of the package to inspect.
Returns
Intent A fully-qualified Intent that can be used to launch the main activity in the package. Returns null if the package does not contain such an activity, or if packageName is not recognized.

getLeanbackLaunchIntentForPackage

Added in API level 21
Intent getLeanbackLaunchIntentForPackage (String packageName)

返回一个“良好”的意图,在包中打开前门Leanback活动,例如在浏览包时使用“打开”按钮。 当前的实现将在类别CATEGORY_LEANBACK_LAUNCHER查找主要活动,如果未找到主要的leanback活动,则返回null。

Parameters
packageName String: The name of the package to inspect.
Returns
Intent Returns either a fully-qualified Intent that can be used to launch the main Leanback activity in the package, or null if the package does not contain such an activity.

getNameForUid

Added in API level 1
String getNameForUid (int uid)

检索与用户标识关联的官方名称。 这个名字保证永远不会改变,尽管可以改变底层用户ID。 也就是说,如果要将有关用户标识的信息存储在持久性存储中,则应该使用此函数返回的字符串而不是原始用户标识。

Parameters
uid int: The user id for which you would like to retrieve a name.
Returns
String Returns a unique name for the given user id, or null if the user id is not currently assigned.

getPackageArchiveInfo

Added in API level 1
PackageInfo getPackageArchiveInfo (String archiveFilePath, 
                int flags)

检索关于在包归档文件中定义的应用程序包的整体信息

Parameters
archiveFilePath String: The path to the archive file
flags int: Additional option flags. Use any combination of GET_ACTIVITIES, GET_CONFIGURATIONS, GET_GIDS, GET_INSTRUMENTATION, GET_INTENT_FILTERS, GET_META_DATA, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SHARED_LIBRARY_FILES, GET_SIGNATURES, GET_URI_PERMISSION_PATTERNS, GET_UNINSTALLED_PACKAGES, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
PackageInfo A PackageInfo object containing information about the package archive. If the package could not be parsed, returns null.

也可以看看:

getPackageGids

Added in API level 1
int[] getPackageGids (String packageName)

返回已分配给给定包的所有POSIX辅助组ID的数组。

请注意,相同设备上的相同包可能在不同的 UserHandle下具有不同的GID。

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package.
Returns
int[] Returns an int array of the assigned GIDs, or null if there are none.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getPackageGids

Added in API level 24
int[] getPackageGids (String packageName, 
                int flags)

返回已分配给给定包的所有POSIX辅助组ID的数组。

请注意,相同设备上的相同包可能在不同的 UserHandle下具有不同的GID。

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package.
flags int
Returns
int[] Returns an int array of the assigned gids, or null if there are none.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getPackageInfo

Added in API level 1
PackageInfo getPackageInfo (String packageName, 
                int flags)

检索有关系统上安装的应用程序包的整体信息。

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package.
flags int: Additional option flags. Use any combination of GET_ACTIVITIES, GET_CONFIGURATIONS, GET_GIDS, GET_INSTRUMENTATION, GET_INTENT_FILTERS, GET_META_DATA, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SHARED_LIBRARY_FILES, GET_SIGNATURES, GET_URI_PERMISSION_PATTERNS, GET_UNINSTALLED_PACKAGES, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
PackageInfo A PackageInfo object containing information about the package. If flag MATCH_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DONT_DELETE_DATA flag set).
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getPackageInstaller

Added in API level 21
PackageInstaller getPackageInstaller ()

返回接口,提供在设备上安装,升级和删除应用程序的能力。

Returns
PackageInstaller

getPackageUid

Added in API level 24
int getPackageUid (String packageName, 
                int flags)

返回与给定包名称关联的UID。

请注意,相同设备上的相同包在不同的 UserHandle下将具有不同的UID。

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package.
flags int
Returns
int Returns an integer UID who owns the given package name.
Throws
PackageManager.NameNotFoundException if a package with the given name can not be found on the system.

getPackagesForUid

Added in API level 1
String[] getPackagesForUid (int uid)

检索与特定用户标识关联的所有软件包的名称。 在大多数情况下,这将是一个包名称,即已分配了该用户标识的包。 在有多个包通过“sharedUserId”机制共享相同用户ID的情况下,将返回具有该ID的所有包。

Parameters
uid int: The user id for which you would like to retrieve the associated packages.
Returns
String[] Returns an array of one or more packages assigned to the user id, or null if there are no known packages with the given id.

getPackagesHoldingPermissions

Added in API level 18
List<PackageInfo> getPackagesHoldingPermissions (String[] permissions, 
                int flags)

返回当前持有任何给定权限的所有已安装软件包的列表。

Parameters
permissions String
flags int: Additional option flags. Use any combination of GET_ACTIVITIES, GET_CONFIGURATIONS, GET_GIDS, GET_INSTRUMENTATION, GET_INTENT_FILTERS, GET_META_DATA, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SHARED_LIBRARY_FILES, GET_SIGNATURES, GET_URI_PERMISSION_PATTERNS, GET_UNINSTALLED_PACKAGES, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<PackageInfo> A List of PackageInfo objects, one for each installed package that holds any of the permissions that were provided, containing information about the package. If no installed packages hold any of the permissions, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DONT_DELETE_DATA flag set).

也可以看看:

getPermissionGroupInfo

Added in API level 1
PermissionGroupInfo getPermissionGroupInfo (String name, 
                int flags)

检索我们所了解的有关特定权限组的所有信息。

Parameters
name String: The fully qualified name (i.e. com.google.permission_group.APPS) of the permission you are interested in.
flags int: Additional option flags. Use GET_META_DATA to retrieve any meta-data associated with the permission group.
Returns
PermissionGroupInfo Returns a PermissionGroupInfo containing information about the permission.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getPermissionInfo

Added in API level 1
PermissionInfo getPermissionInfo (String name, 
                int flags)

检索我们了解的特定权限的所有信息。

Parameters
name String: The fully qualified name (i.e. com.google.permission.LOGIN) of the permission you are interested in.
flags int: Additional option flags. Use GET_META_DATA to retrieve any meta-data associated with the permission.
Returns
PermissionInfo Returns a PermissionInfo containing information about the permission.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getPreferredActivities

Added in API level 1
int getPreferredActivities (List<IntentFilter> outFilters, 
                List<ComponentName> outActivities, 
                String packageName)

检索当前在系统中注册的所有首选活动,以前添加了 addPreferredActivity(IntentFilter, int, ComponentName[], ComponentName)

Parameters
outFilters List: A required list in which to place the filters of all of the preferred activities.
outActivities List: A required list in which to place the component names of all of the preferred activities.
packageName String: An optional package in which you would like to limit the list. If null, all activities will be returned; if non-null, only those activities in the given package are returned.
Returns
int Returns the total number of registered preferred activities (the number of distinct IntentFilter records, not the number of unique activity components) that were found.

getPreferredPackages

Added in API level 1
List<PackageInfo> getPreferredPackages (int flags)

检索当前配置的所有首选软件包列表。 列表中的第一个包是最优选的,最后一个是最不优选的。

Parameters
flags int: Additional option flags. Use any combination of GET_ACTIVITIES, GET_CONFIGURATIONS, GET_GIDS, GET_INSTRUMENTATION, GET_INTENT_FILTERS, GET_META_DATA, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SHARED_LIBRARY_FILES, GET_SIGNATURES, GET_URI_PERMISSION_PATTERNS, GET_UNINSTALLED_PACKAGES, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<PackageInfo> A List of PackageInfo objects, one for each preferred application, in order of preference.

也可以看看:

getProviderInfo

Added in API level 9
ProviderInfo getProviderInfo (ComponentName component, 
                int flags)

检索我们了解的特定内容提供者类的所有信息。

Parameters
component ComponentName: The full component name (i.e. com.google.providers.media/com.google.providers.media. MediaProvider) of a ContentProvider class.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ProviderInfo A ProviderInfo object containing information about the provider.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getReceiverInfo

Added in API level 1
ActivityInfo getReceiverInfo (ComponentName component, 
                int flags)

检索我们所了解的关于特定接收器类的所有信息。

Parameters
component ComponentName: The full component name (i.e. com.google.apps.calendar/com.google.apps.calendar. CalendarAlarm) of a Receiver class.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ActivityInfo An ActivityInfo containing information about the receiver.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getResourcesForActivity

Added in API level 1
Resources getResourcesForActivity (ComponentName activityName)

检索与活动关联的资源。 给定活动的全名,检索关于它的信息并调用getResources()返回其应用程序的资源。 如果找不到该活动,则抛出NameNotFoundException。

Parameters
activityName ComponentName: Name of the activity whose resources are to be retrieved.
Returns
Resources Returns the application's Resources.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

也可以看看:

getResourcesForApplication

Added in API level 1
Resources getResourcesForApplication (String appPackageName)

检索与应用程序关联的资源。 给定应用程序的完整软件包名称,检索关于它的信息并调用getResources()来返回其应用程序的资源。 如果找不到appPackageName,则引发NameNotFoundException。

Parameters
appPackageName String: Package name of the application whose resources are to be retrieved.
Returns
Resources Returns the application's Resources.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

也可以看看:

getResourcesForApplication

Added in API level 1
Resources getResourcesForApplication (ApplicationInfo app)

检索应用程序的资源。 如果程序包不再安装,则抛出NameNotFoundException。

Parameters
app ApplicationInfo: Information about the desired application.
Returns
Resources Returns the application's Resources.
Throws
PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded (most likely because it was uninstalled).

getServiceInfo

Added in API level 1
ServiceInfo getServiceInfo (ComponentName component, 
                int flags)

检索我们了解的特定服务类的所有信息。

Parameters
component ComponentName: The full component name (i.e. com.google.apps.media/com.google.apps.media. BackgroundPlayback) of a Service class.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ServiceInfo A ServiceInfo object containing information about the service.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

getSystemAvailableFeatures

Added in API level 5
FeatureInfo[] getSystemAvailableFeatures ()

获取系统中可用功能的列表。

Returns
FeatureInfo[] An array of FeatureInfo classes describing the features that are available on the system, or null if there are none(!!).

getSystemSharedLibraryNames

Added in API level 3
String[] getSystemSharedLibraryNames ()

获取系统上可用的共享库列表。

Returns
String[] An array of shared library names that are available on the system, or null if none are installed.

getText

Added in API level 1
CharSequence getText (String packageName, 
                int resid, 
                ApplicationInfo appInfo)

从包中检索文本。 这是各种包管理器信息结构(例如ComponentInfo用来实现检索其关联标签和其他文本的低级API。

Parameters
packageName String: The name of the package that this text is coming from. Cannot be null.
resid int: The resource identifier of the desired text. Cannot be 0.
appInfo ApplicationInfo: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Returns
CharSequence Returns a CharSequence holding the requested text. Returns null if the text could not be found for any reason.

getUserBadgedDrawableForDensity

Added in API level 21
Drawable getUserBadgedDrawableForDensity (Drawable drawable, 
                UserHandle user, 
                Rect badgeLocation, 
                int badgeDensity)

如果目标用户是主叫用户的托管配置文件,或者主叫方本身是托管配置文件,则会返回给定可绘制副本的标签副本,以便用户将其与原始可绘制区分开来。 来电者可以指定要在其中应用徽章的徽章的边界中的位置以及要使用的徽章的密度。

如果原始绘图是一个BitmapDrawable,并且支持位图可以按照 isMutable()进行 isMutable() ,则会在适当位置执行徽章并返回原始绘图。

Parameters
drawable Drawable: The drawable to badge.
user UserHandle: The target user.
badgeLocation Rect: Where in the bounds of the badged drawable to place the badge. If it's null, the badge is applied on top of the entire drawable being badged.
badgeDensity int: The optional desired density for the badge as per densityDpi. If it's not positive, the density of the display is used.
Returns
Drawable A drawable that combines the original drawable and a badge as determined by the system.

getUserBadgedIcon

Added in API level 21
Drawable getUserBadgedIcon (Drawable icon, 
                UserHandle user)

如果目标用户是托管配置文件,则会返回给定图标的带有标记的副本,以便将其与原始图标区分开来。 用于标记任意可绘制使用getUserBadgedDrawableForDensity(android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)

如果原始绘图是一个BitmapDrawable,并且支持位图可根据 isMutable()进行 isMutable() ,则会在适当位置执行徽章并返回原始绘图。

Parameters
icon Drawable: The icon to badge.
user UserHandle: The target user.
Returns
Drawable A drawable that combines the original icon and a badge as determined by the system.

getUserBadgedLabel

Added in API level 21
CharSequence getUserBadgedLabel (CharSequence label, 
                UserHandle user)

如果目标用户是主叫用户的托管配置文件,或者主叫方本身是托管配置文件,则会返回该标签的副本,并为可访问性服务(如对讲)制作徽章。 例如传入“电子邮件”,它可能会在工作资料中返回“工作电子邮件”电子邮件。

Parameters
label CharSequence: The label to change.
user UserHandle: The target user.
Returns
CharSequence A label that combines the original label and a badge as determined by the system.

getXml

Added in API level 1
XmlResourceParser getXml (String packageName, 
                int resid, 
                ApplicationInfo appInfo)

从包中检索XML文件。 这是一个用于检索XML元数据的低级API。

Parameters
packageName String: The name of the package that this xml is coming from. Cannot be null.
resid int: The resource identifier of the desired xml. Cannot be 0.
appInfo ApplicationInfo: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Returns
XmlResourceParser Returns an XmlPullParser allowing you to parse out the XML data. Returns null if the xml resource could not be found for any reason.

hasSystemFeature

Added in API level 5
boolean hasSystemFeature (String name)

检查给定的功能名称是否为getSystemAvailableFeatures()返回的可用功能getSystemAvailableFeatures() 这测试是否存在给定功能名称的任何版本; 使用hasSystemFeature(String, int)检查最低版本。

Parameters
name String
Returns
boolean Returns true if the devices supports the feature, else false.

hasSystemFeature

Added in API level 24
boolean hasSystemFeature (String name, 
                int version)

检查给定的功能名称和版本是否为getSystemAvailableFeatures()返回的可用功能getSystemAvailableFeatures() 由于功能被定义为始终向后兼容,如果可用功能版本大于或等于请求版本,则返回true。

Parameters
name String
version int
Returns
boolean Returns true if the devices supports the feature, else false.

isPermissionRevokedByPolicy

Added in API level 23
boolean isPermissionRevokedByPolicy (String permName, 
                String pkgName)

检查策略是否已为某个包撤销特定权限。 通常,设备所有者或配置文件所有者可以应用这样的策略。 用户不能授予策略撤销的权限,因此应用获得此类权限的唯一方法是通过策略更改。

Parameters
permName String: The name of the permission you are checking for.
pkgName String: The name of the package you are checking against.
Returns
boolean Whether the permission is restricted by policy.

isSafeMode

Added in API level 3
boolean isSafeMode ()

返回设备是否已启动进入安全模式。

Returns
boolean

queryBroadcastReceivers

Added in API level 1
List<ResolveInfo> queryBroadcastReceivers (Intent intent, 
                int flags)

检索所有可以处理给定意图广播的接收器。

Parameters
intent Intent: The desired intent as per resolveActivity().
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<ResolveInfo> Returns a List of ResolveInfo objects containing one entry for each matching receiver, ordered from best to worst. If there are no matching receivers, an empty list or null is returned.

也可以看看:

queryContentProviders

Added in API level 1
List<ProviderInfo> queryContentProviders (String processName, 
                int uid, 
                int flags)

检索内容提供商信息。

注意:与大多数其他方法不同,空结果集由空返回而不是空列表表示。

Parameters
processName String: If non-null, limits the returned providers to only those that are hosted by the given process. If null, all content providers are returned.
uid int: If processName is non-null, this is the required uid owning the requested content providers.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<ProviderInfo> A list of ProviderInfo objects containing one entry for each provider either matching processName or, if processName is null, all known content providers. If there are no matching providers, null is returned.

也可以看看:

queryInstrumentation

Added in API level 1
List<InstrumentationInfo> queryInstrumentation (String targetPackage, 
                int flags)

检索有关可用检测代码的信息。 可以用来检索所有的检测代码,或者只检索针对特定软件包的代码。

Parameters
targetPackage String: If null, all instrumentation is returned; only the instrumentation targeting this package name is returned.
flags int: Additional option flags. Use any combination of GET_META_DATA to modify the data returned.
Returns
List<InstrumentationInfo> A list of InstrumentationInfo objects containing one entry for each matching instrumentation. If there are no instrumentation available, returns an empty list.

也可以看看:

queryIntentActivities

Added in API level 1
List<ResolveInfo> queryIntentActivities (Intent intent, 
                int flags)

检索可以针对给定意图执行的所有活动。

Parameters
intent Intent: The desired intent as per resolveActivity().
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the CATEGORY_DEFAULT. Or, set MATCH_ALL to prevent any filtering of the results.
Returns
List<ResolveInfo> Returns a List of ResolveInfo objects containing one entry for each matching activity, ordered from best to worst. In other words, the first item is what would be returned by resolveActivity(Intent, int). If there are no matching activities, an empty list is returned.

也可以看看:

queryIntentActivityOptions

Added in API level 1
List<ResolveInfo> queryIntentActivityOptions (ComponentName caller, 
                Intent[] specifics, 
                Intent intent, 
                int flags)

检索一组应该以类似选项呈现给用户的活动。 这就像queryIntentActivities(Intent, int) ,除了它还允许你提供一个你想解析为特定选项的更明确的Intents列表,并且负责根据这些输入以合理的顺序返回最终的ResolveInfo列表,并且没有重复。

Parameters
caller ComponentName: The class name of the activity that is making the request. This activity will never appear in the output list. Can be null.
specifics Intent: An array of Intents that should be resolved to the first specific results. Can be null.
intent Intent: The desired intent as per resolveActivity().
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the CATEGORY_DEFAULT.
Returns
List<ResolveInfo> Returns a List of ResolveInfo objects containing one entry for each matching activity. The list is ordered first by all of the intents resolved in specifics and then any additional activities that can handle intent but did not get included by one of the specifics intents. If there are no matching activities, an empty list is returned.

也可以看看:

queryIntentContentProviders

Added in API level 19
List<ResolveInfo> queryIntentContentProviders (Intent intent, 
                int flags)

检索可以匹配给定意图的所有提供者。

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component).
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<ResolveInfo> Returns a List of ResolveInfo objects containing one entry for each matching provider, ordered from best to worst. If there are no matching services, an empty list or null is returned.

也可以看看:

queryIntentServices

Added in API level 1
List<ResolveInfo> queryIntentServices (Intent intent, 
                int flags)

检索可以匹配给定意图的所有服务。

Parameters
intent Intent: The desired intent as per resolveService().
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
List<ResolveInfo> Returns a List of ResolveInfo objects containing one entry for each matching service, ordered from best to worst. In other words, the first item is what would be returned by resolveService(Intent, int). If there are no matching services, an empty list or null is returned.

也可以看看:

queryPermissionsByGroup

Added in API level 1
List<PermissionInfo> queryPermissionsByGroup (String group, 
                int flags)

查询与特定组关联的所有权限。

Parameters
group String: The fully qualified name (i.e. com.google.permission.LOGIN) of the permission group you are interested in. Use null to find all of the permissions not associated with a group.
flags int: Additional option flags. Use GET_META_DATA to retrieve any meta-data associated with the permissions.
Returns
List<PermissionInfo> Returns a list of PermissionInfo containing information about all of the permissions in the given group.
Throws
PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

也可以看看:

removePackageFromPreferred

Added in API level 1
void removePackageFromPreferred (String packageName)

此方法在API级别7中已被弃用。
这个功能不再做任何事情; 这是一种管理偏好活动的旧方法,已被现代基于活动的偏好取代(并与之冲突)。

Parameters
packageName String

removePermission

Added in API level 1
void removePermission (String name)

删除以前使用addPermission(PermissionInfo)添加的权限。 相同的所有权规则适用 - 您只能删除允许添加的权限。

Parameters
name String: The name of the permission to remove.
Throws
SecurityException if you are not allowed to remove the given permission name.

也可以看看:

resolveActivity

Added in API level 1
ResolveInfo resolveActivity (Intent intent, 
                int flags)

确定针对给定意图执行的最佳操作。 这是resolveActivity(PackageManager)如果没有明确指定类的情况下如何找到活动。

注意:如果使用隐式Intent(没有指定明确的ComponentName),请务必考虑是否设置MATCH_DEFAULT_ONLY唯一标志。 您需要这样做来解决该活动,其方式与startActivity(Intent)Intent.resolveActivity(PackageManager)相同。

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component).
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the CATEGORY_DEFAULT.
Returns
ResolveInfo Returns a ResolveInfo object containing the final activity intent that was determined to be the best action. Returns null if no matching activity was found. If multiple matching activities are found and there is no default set, returns a ResolveInfo object containing something else, such as the activity resolver.

也可以看看:

resolveContentProvider

Added in API level 1
ProviderInfo resolveContentProvider (String name, 
                int flags)

按其基本路径名称查找单个内容提供者。

Parameters
name String: The name of the provider to find.
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ProviderInfo A ProviderInfo object containing information about the provider. If a provider was not found, returns null.

也可以看看:

resolveService

Added in API level 1
ResolveInfo resolveService (Intent intent, 
                int flags)

确定为给定意图处理的最佳服务。

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component).
flags int: Additional option flags. Use any combination of GET_META_DATA, GET_RESOLVED_FILTER, GET_SHARED_LIBRARY_FILES, MATCH_ALL, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, MATCH_DIRECT_BOOT_AWARE, MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY or MATCH_UNINSTALLED_PACKAGES to modify the data returned.
Returns
ResolveInfo Returns a ResolveInfo object containing the final service intent that was determined to be the best action. Returns null if no matching service was found.

也可以看看:

setApplicationEnabledSetting

Added in API level 1
void setApplicationEnabledSetting (String packageName, 
                int newState, 
                int flags)

设置应用程序的启用设置此设置将覆盖应用程序在其清单中可能已设置的任何启用状态。 它还覆盖了清单中为应用程序的任何组件设置的启用状态。 它不覆盖任何应用程序组件的由setComponentEnabledSetting(ComponentName, int, int)设置的任何启用状态。

Parameters
packageName String: The package name of the application to enable
newState int: The new enabled state for the component. The legal values for this state are: COMPONENT_ENABLED_STATE_ENABLED, COMPONENT_ENABLED_STATE_DISABLED and COMPONENT_ENABLED_STATE_DEFAULT The last one removes the setting, thereby restoring the applications's state to whatever was set in its manifest (or enabled, by default).
flags int: Optional behavior flags: DONT_KILL_APP or 0.

setComponentEnabledSetting

Added in API level 1
void setComponentEnabledSetting (ComponentName componentName, 
                int newState, 
                int flags)

为包组件(活动,接收者,服务,提供者)设置启用的设置。 该设置将覆盖组件在其清单中可能已设置的任何启用状态。

Parameters
componentName ComponentName: The component to enable
newState int: The new enabled state for the component. The legal values for this state are: COMPONENT_ENABLED_STATE_ENABLED, COMPONENT_ENABLED_STATE_DISABLED and COMPONENT_ENABLED_STATE_DEFAULT The last one removes the setting, thereby restoring the component's state to whatever was set in it's manifest (or enabled, by default).
flags int: Optional behavior flags: DONT_KILL_APP or 0.

setInstallerPackageName

Added in API level 11
void setInstallerPackageName (String targetPackage, 
                String installerPackageName)

更改与给定包关联的安装程序。 安装程序包的更改方式存在限制; 尤其是:

  • A SecurityException will be thrown if installerPackageName is not signed with the same certificate as the calling application.
  • A SecurityException will be thrown if targetPackage already has an installer package, and that installer package is not signed with the same certificate as the calling application.

Parameters
targetPackage String: The installed package whose installer will be changed.
installerPackageName String: The package name of the new installer. May be null to clear the association.

verifyPendingInstall

Added in API level 14
void verifyPendingInstall (int id, 
                int verificationCode)

允许侦听package verification broadcast的包响应包管理器。 响应必须包含verificationCode ,即VERIFICATION_ALLOWVERIFICATION_REJECT

Parameters
id int: pending package identifier as passed via the EXTRA_VERIFICATION_ID Intent extra.
verificationCode int: either VERIFICATION_ALLOW or VERIFICATION_REJECT.
Throws
SecurityException if the caller does not have the PACKAGE_VERIFICATION_AGENT permission.

Hooray!