一下为官方文档的一部分,为了学习我将试着去翻译,能力有限,有错的地方望指出
Class Overview
类概述
Class for retrieving(检索,恢复‘取回’补偿) various kinds of information related to the application packages that are currently installed on the device. You can find this class through getPackageManager()
.
该类用于检索当前安装在设备上的各种有关应用程序包的信息。可以通过getPackgeManager()获得实例对象。
Summary
概要
Nested Classes
class
PackageManager.NameNotFoundException
This exception is thrown when a given package, application, or component name cannot be found.
当给出的包,应用程序或者组件名字没有找到时抛出PackaManager.NameNotFoundException异常
Constants
常量
int
COMPONENT_ENABLED_STATE_DEFAULT
Flag for setApplicationEnabledSetting(String, int, int)
and setComponentEnabledSetting(ComponentName, int, int)
: This component or application is in its default enabled state (as specified in its manifest).
该组件或者程序处于默认启动状态(如果在manifest文件中制定)
int
COMPONENT_ENABLED_STATE_DISABLED
Flag for setApplicationEnabledSetting(String, int, int)
and setComponentEnabledSetting(ComponentName, int, int)
: This component or application has been explicitly disabled, regardless of what it has specified in its manifest.
该组件或者应用程序是不可启动的,不管你是否在manifest文件中指定
int
COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
Flag for setApplicationEnabledSetting(String, int, int)
only: This application should be considered, until the point where the user actually wants to use it.
直到用户实际上使用它,这个应用程序才会被启动
int
COMPONENT_ENABLED_STATE_DISABLED_USER
Flag for setApplicationEnabledSetting(String, int, int)
only: The user has explicitly disabled the application, regardless of what it has specified in its manifest.
用户明确禁止启动该应用程序,不管是否在manifest文件中指定
int
COMPONENT_ENABLED_STATE_ENABLED
Flag for setApplicationEnabledSetting(String, int, int)
and setComponentEnabledSetting(ComponentName, int, int)
: This component or application has been explictily enabled, regardless of what it has specified in its manifest.
该组件或者应用程序是可启动的,不管你是否在manifest文件中指定
int
DONT_KILL_APP
Flag parameter forsetComponentEnabledSetting(android.content.ComponentName, int, int)
to indicate that you don't want to kill the app containing the component.
DONT_KILL_APP指出你不能杀死这个app所包含的组件
String
EXTRA_VERIFICATION_ID
Extra field name for the ID of a package pending verification.
I等待验证的一个ID的额外的字段名
String
EXTRA_VERIFICATION_RESULT
Extra field name for the result of a verification, either VERIFICATION_ALLOW
, or VERIFICATION_REJECT
.
确切的结果的一个额外的名称,为VERIFICATION_ALLOW或者
VERIFICATION_REJECT
String
FEATURE_APP_WIDGETS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports app widgets.
这个设备支持的应用程序窗口小组件
String
FEATURE_AUDIO_LOW_LATENCY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device's audio pipeline is low-latency, more suitable for audio applications sensitive to delays or lag in sound input or output.
设备的音频管道低延迟,更适合音频应用程序对延迟敏感或滞后声音输入或输出。
String
FEATURE_AUDIO_OUTPUT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device includes at least one form of audio output, such as speakers, audio jack or streaming over bluetooth
该设备至少包含一个音频输出,例如扬声器,音频或者蓝牙传输流
String
FEATURE_AUDIO_PRO
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has professional audio level of functionality and performance.
这个设备在功能和性能上达到专业的音频水平
Strig
FEATURE_AUTOMOTIVE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
This is a device dedicated to showing UI on a vehicle headunit.
致力于展示车载设备的UI
String
FEATURE_BACKUP
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device can perform backup and restore operations on installed applications.
对于已经安装的应用程序,该设备后台执行应用并将操作保存下来
String
FEATURE_BLUETOOTH
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device is capable of communicating with other devices via Bluetooth.
该设备能够通过蓝牙与其他设备进行交流
String
FEATURE_BLUETOOTH_LE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device is capable of communicating with other devices via Bluetooth Low Energy radio.
该设备能够通过低频率低耗能的蓝牙与其他设备进行交流
String
FEATURE_CAMERA
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has a camera facing away from the screen.
该设备在屏幕中有一个前置摄像头
String
FEATURE_CAMERA_ANY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has at least one camera pointing in some direction, or can support an external camera being connected to it.
该设备在某个方向上至少有一个摄像机,或者可以支持外部链接的摄像头
String
FEATURE_CAMERA_AUTOFOCUS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device's camera supports auto-focus.
该设备的摄像机支持自动对焦
String
FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
At least one of the cameras on the device supports the manual post-processing
capability level.
该设备至少有一个能手工后处理能力的水平的摄像头
String
FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
At least one of the cameras on the device supports the manual sensor
capability level.
至少有一个摄像头支持手动传感的能力
String
FEATURE_CAMERA_CAPABILITY_RAW
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
At least one of the cameras on the device supports the RAW
capability level.
在设备上至少有一个摄像头支持RAW能力
String
FEATURE_CAMERA_EXTERNAL
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device can support having an external camera connected to it.
设备可支持一个外部链接的摄像头
String
FEATURE_CAMERA_FLASH
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device's camera supports flash.
设备的照相机支持flash
String
FEATURE_CAMERA_FRONT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has a front facing camera.
设备有一个前置照相机
String
FEATURE_CAMERA_LEVEL_FULL
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
At least one of the cameras on the device supports the full hardware
capability level.
String
FEATURE_CONNECTION_SERVICE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The Connection Service API is enabled on the device.
设备的链接服务的APi是可开启的
String
FEATURE_CONSUMER_IR
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device is capable of communicating with consumer IR devices.
设备能够和用户的信息检索设备交流
String
FEATURE_DEVICE_ADMIN
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports device policy enforcement via device admins.
设备支持通过虚拟设备管理执行策略
String
FEATURE_FAKETOUCH
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device does not have a touch screen, but does support touch emulation for basic events.
设备没有触摸屏幕,但是它支持基本的触摸仿真
String
FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device does not have a touch screen, but does support touch emulation for basic events that supports distinct tracking of two or more fingers.
设备没有触摸屏幕,但是它支持基本的两店或者多点触摸仿真
String
FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device does not have a touch screen, but does support touch emulation for basic events that supports tracking a hand of fingers (5 or more fingers) fully independently.
设备没有触摸屏幕,但是它支持五点或者更多点的触摸仿真
String
FEATURE_FINGERPRINT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has biometric hardware to detect a fingerprint.
设备有一个计量设备去检测手指
String
FEATURE_GAMEPAD
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device has all of the inputs necessary to be considered a compatible game controller, or includes a compatible game controller in the box.
这设备具有所有必须的输入能力,可兼容游戏控制,或者在盒子中包括一个兼容的游戏控制
String
FEATURE_HIFI_SENSORS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports high fidelity sensor processing capabilities.
设备支持高精度处理能力
String
FEATURE_HOME_SCREEN
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports a home screen that is replaceable by third party applications.
设备支持主屏幕可被第三方应用替换的能力
String
FEATURE_INPUT_METHODS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports adding new input methods implemented with the InputMethodService
API.
通过实现InputMethodService设备支持新增一个输入方法
String
FEATURE_LEANBACK
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports leanback UI.
String
FEATURE_LIVE_TV
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports live TV and can display contents from TV inputs implemented with theTvInputService
API.
通过实现TvInputService,设备支持活动的TV和展示一些来自TV内容
String
FEATURE_LIVE_WALLPAPER
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports live wallpapers.
设备支持动态壁纸
String
FEATURE_LOCATION
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports one or more methods of reporting current location.
设备有一个或者多个报告当前位置的方法
String
FEATURE_LOCATION_GPS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a Global Positioning System receiver and can report precise location.
设备有一个全球定位系统并且提供精确定位
String
FEATURE_LOCATION_NETWORK
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device can report location with coarse accuracy using a network-based geolocation system.
设备可以通过网络定位系统提供精确度不高的定位
String
FEATURE_MANAGED_USERS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
:
The device supports creating secondary users and managed profiles via DevicePolicyManager
.
设备支持通过DevicePolicyManager创建二级管理用户
String
FEATURE_MICROPHONE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device can record audio via a microphone.
设备可通过麦克风记录音频
String
FEATURE_MIDI
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a full implementation of the android.media.midi.* APIs.
String
FEATURE_NFC
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device can communicate using Near-Field Communications (NFC).
设备可以与扫描设备交流
String
FEATURE_NFC_HOST_CARD_EMULATION
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports host-based NFC card emulation.
设备支持NFC卡仿真
String
FEATURE_OPENGLES_EXTENSION_PACK
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports the OpenGL ESAndroid Extension Pack.
String
FEATURE_PRINTING
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports printing.
设备支持打印
String
FEATURE_SCREEN_LANDSCAPE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports landscape orientation screens.
设备屏幕支持横向操作
String
FEATURE_SCREEN_PORTRAIT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports portrait orientation screens.
设备屏幕支持纵向操作
String
FEATURE_SECURELY_REMOVES_USERS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports secure removal of users.
设备支持安全删除用户
String
FEATURE_SENSOR_ACCELEROMETER
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes an accelerometer.
设备具有加速器
String
FEATURE_SENSOR_AMBIENT_TEMPERATURE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes an ambient temperature sensor.
设备具有温度传感器
String
FEATURE_SENSOR_BAROMETER
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a barometer (air pressure sensor.)
设备具有压力全干起
String
FEATURE_SENSOR_COMPASS
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a magnetometer (compass).
设备具有指南针
String
FEATURE_SENSOR_GYROSCOPE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a gyroscope.
设备具有陀螺仪
String
FEATURE_SENSOR_HEART_RATE
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a heart rate monitor.
设备具有心率监视器
String
FEATURE_SENSOR_HEART_RATE_ECG
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The heart rate sensor on this device is an Electrocargiogram.
String
FEATURE_SENSOR_LIGHT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a light sensor.
String
FEATURE_SENSOR_PROXIMITY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a proximity sensor.
String
FEATURE_SENSOR_RELATIVE_HUMIDITY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a relative humidity sensor.
String
FEATURE_SENSOR_STEP_COUNTER
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a hardware step counter.
设备具有计步器
String
FEATURE_SENSOR_STEP_DETECTOR
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device includes a hardware step detector.
String
FEATURE_SIP
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The SIP API is enabled on the device.
String
FEATURE_SIP_VOIP
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports SIP-based VOIP.
String
FEATURE_TELEPHONY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a telephony radio with data communication support.
String
FEATURE_TELEPHONY_CDMA
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a CDMA telephony stack.
String
FEATURE_TELEPHONY_GSM
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a GSM telephony stack.
String
FEATURE_TELEVISION
This constant was deprecated in API level 21. useFEATURE_LEANBACK
instead.
String
FEATURE_TOUCHSCREEN
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device's display has a touch screen.
String
FEATURE_TOUCHSCREEN_MULTITOUCH
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device's touch screen supports multitouch sufficient for basic two-finger gesture detection.
String
FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device's touch screen is capable of tracking two or more fingers fully independently.
String
FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device's touch screen is capable of tracking a full hand of fingers fully independently -- that is, 5 or more simultaneous independent pointers.
String
FEATURE_USB_ACCESSORY
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports connecting to USB accessories.
String
FEATURE_USB_HOST
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports connecting to USB devices as the USB host.
String
FEATURE_VERIFIED_BOOT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports verified boot.
String
FEATURE_WATCH
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: This is a device dedicated to showing UI on a watch.
String
FEATURE_WEBVIEW
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device has a full implementation of the android.webkit.* APIs.
String
FEATURE_WIFI
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports WiFi (802.11) networking.
String
FEATURE_WIFI_DIRECT
Feature for getSystemAvailableFeatures()
andhasSystemFeature(String)
: The device supports Wi-Fi Direct networking.
int
GET_ACTIVITIES PackageInfo
flag: return information about activities in the package in activities
.
返回包中有关activity的信息
int
GET_CONFIGURATIONS PackageInfo
flag: return information about hardware preferences in PackageInfo.configPreferences
, and requested features in reqFeatures
and featureGroups
.
以PackageInfo.configPreferences
的形式返回在硬件配置信息,以reqFeatures和
featureGroups形式返回请求的特性
int
GET_DISABLED_COMPONENTS PackageInfo
flag: include disabled components in the returned info.
返回的信息柏涵不能被启动的组件
int
GET_DISABLED_UNTIL_USED_COMPONENTS PackageInfo
flag: include disabled components which are in that state only because ofCOMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
in the returned info.
返回的信息包括只因为状态是COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED的而不能启动的组件
int
GET_GIDS PackageInfo
flag: return the group ids
that are associated with an application.
返回与一个应用程序关联的group ids
int
GET_INSTRUMENTATION PackageInfo
flag: return information about instrumentation in the package in instrumentation
.
返回包中有关instrumentation测试的信息
int
GET_INTENT_FILTERS PackageInfo
flag: return information about the intent filters supported by the activity.
返回activty所支持的意图过滤器的信息
int
GET_META_DATA ComponentInfo
flag: return the metaData
data Bundle
s that are associated with a component.
返回与组件绑定的有关的元数据
int
GET_PERMISSIONS PackageInfo
flag: return information about permissions in the package in permissions
.
返回包中的权限的信息
int
GET_PROVIDERS PackageInfo
flag: return information about content providers in the package in providers
.
返回宝中提供者的信息
int
GET_RECEIVERS PackageInfo
flag: return information about intent receivers in the package in receivers
.
int
GET_RESOLVED_FILTER ResolveInfo
flag: return the IntentFilter that was matched for a particular ResolveInfo in filter
.
返回与制定的解析信息匹配的意图过滤器
int
GET_SERVICES PackageInfo
flag: return information about services in the package in services
.
返回服务的信息
int
GET_SHARED_LIBRARY_FILES ApplicationInfo
flag: return the paths to the shared libraries
that are associated with an application.
返回与应用有关的分享库的路径信息
int
GET_SIGNATURES PackageInfo
flag: return information about the signatures included in the package.
返回签名的信息
int
GET_UNINSTALLED_PACKAGES
Flag parameter to retrieve some information about all applications (even uninstalled ones) which have data directories.
检索所有应用程序data目录的一些信息,甚至是没安装的应用
int
GET_URI_PERMISSION_PATTERNS ProviderInfo
flag: return the URI permission patterns
that are associated with a content provider.
int
MATCH_ALL
Querying flag: if set and if the platform is doing any filtering of the results, then the filtering will not happen.
int
MATCH_DEFAULT_ONLY
Resolution and querying flag: if set, only filters that support theCATEGORY_DEFAULT
will be considered for matching.
long
MAXIMUM_VERIFICATION_TIMEOUT
Can be used as the millisecondsToDelay
argument forextendVerificationTimeout(int, int, long)
.
int
PERMISSION_DENIED
Permission check result: this is returned bycheckPermission(String, String)
if the permission has not been granted to the given package.
int
PERMISSION_GRANTED
Permission check result: this is returned bycheckPermission(String, String)
if the permission has been granted to the given package.
int
SIGNATURE_FIRST_NOT_SIGNED
Signature check result: this is returned by checkSignatures(int, int)
if the first package is not signed but the second is.
int
SIGNATURE_MATCH
Signature check result: this is returned by checkSignatures(int, int)
if all signatures on the two packages match.
int
SIGNATURE_NEITHER_SIGNED
Signature check result: this is returned by checkSignatures(int, int)
if neither of the two packages is signed.
int
SIGNATURE_NO_MATCH
Signature check result: this is returned by checkSignatures(int, int)
if not all signatures on both packages match.
int
SIGNATURE_SECOND_NOT_SIGNED
Signature check result: this is returned by checkSignatures(int, int)
if the second package is not signed but the first is.
int
SIGNATURE_UNKNOWN_PACKAGE
Signature check result: this is returned by checkSignatures(int, int)
if either of the packages are not valid.
int
VERIFICATION_ALLOW
Used as the verificationCode
argument forverifyPendingInstall(int, int)
to indicate that the calling package verifier allows the installation to proceed.
int
VERIFICATION_REJECT
Used as the verificationCode
argument forverifyPendingInstall(int, int)
to indicate the calling package verifier does not vote to allow the installation to proceed.