android中对服务的应用管理 .
2012-10-11 21:57
447 查看
在android的组织结构图中,可以看到,在service的上一层为manager层,包括activitymanager, windowmanager, packagemanager, telephonymanager, resourcemanager, locationmanager, notificationmanager.
至于这个结构图中的manager和实际中的service是否一一对应,还要看。现在一个个的来找对应。
1 statusbarservice 对应statusbarmanager
/frameworks/base/core/java/android/app/StatusBarManager.java
在statusbarmanager的构造函数中,会实例化一个IStatusBar mService,同时向外暴露几个接口,
disable, expand, collapse, toggle, addIcon, updateIcon ,removeIcon,这几个向外暴露的方法都是通过调用mService的方法,也即是statusbarservice中的方法来实现。
SDK中并没有找到该类,可见该类并没有暴露给用户使用,只是给android内部使用。
2. powermanagerservice与powermanager对应
通过powermanager向外暴露接口。具体的接口用法,用途可以看响应的方法注释。
SDK中可以看到其类 android.os.PowerManager
其中说明用途的一句:This class gives you control of the power state of the device.
具体的使用可以看SDK的说明。
3. ActivityManagerService这里的对应实现方法有区别,ActivityManagerService是通过继承binder的类ActivityManagerNative来实现的。
ActivityManagerService与ActivityManager相对应。ActivityManager向外暴露接口方法。
SDK中有其类 , android.app.ActivityManager 提供给用户使用。
说明 :Interact with the overall activities running in the system. 具体的用法参见SDK。
4.TelephonyRegistry对应暴露的接口的manager没有找到,也许没有暴露,也许通过其他的方法。
5.PackageManagerService.java 与PackageManager.java
/frameworks/base/core/java/android/content/pm/PackageManager.java
SDK:android.content.pm.PackageManager 抽象类
SDK中注释:
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().
6.ContentService
没有找到对应的manager,可能由provider提供接口。
7.BatteryService 对应BatteryManager
SDK:android.os.BatteryManager
SDK中注释:
The BatteryManager class contains strings and constants used for values in the
ACTION_BATTERY_CHANGEDIntent.
8.HardwareService 没有找到对应的类来暴露其接口,可能没有做
9.AlarmManagerService对应AlarmManager.java
/frameworks/base/core/java/android/app/AlarmManager.java
SDK:android.app.AlarmManager
SDK中注释:This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future.
10.SensorService 对应 SensorManager.java
/frameworks/base/core/java/android/hardware/SensorManager.java
SDK:android.hardware.SensorManager
SDK中注释:Class that lets you access the device's sensors. Get an instance of this class by calling
Context.getSystemService()with
an argument of
SENSOR_SERVICE.
11.WindowManagerService 对应 WindowManager.java
/frameworks/base/core/java/android/view/WindowManager.java
SDK:android.view.WindowManager 接口
SDK中注释:
The interface that apps use to talk to the window manager.
Use
Context.getSystemService(Context.WINDOW_SERVICE)to get one of these.
12. BluetoothDeviceService对应 BluetoothDevice(待验证)
13.StatusBarService对应StatusBarManager
SDK中没有
14.ClipboardService 对应ClipboardManager.java
/frameworks/base/core/java/android/text/ClipboardManager.java
SDK: android.text.ClipboardManager
SDK中注释:
Interface to the clipboard service, for placing and retrieving text in the global clipboard.
You do not instantiate this class directly; instead, retrieve it through
getSystemService(String).
15.InputMethodManagerService对应InputMethodManager
frameworks/base/core/java/android/view/inputmethod/InputMethodManager.java
SDK中居然没有!!
16.NetStatService NetStat.java
frameworks/base/core/java/android/os/NetStat.java
SDK中没有。
17.ConnectivityService ConnectivityManager.java
/frameworks/base/core/java/android/net/ConnectivityManager.java
SDK: android.net.ConnectivityManager
SDK中注释:
Class that answers queries about the state of network connectivity. It also notifies applications when network connectivity changes. Get an instance of this class by calling
Context.getSystemService(Context.CONNECTIVITY_SERVICE).
The primary responsibilities of this class are to:
Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)
Send broadcast intents when network connectivity changes
Attempt to "fail over" to another network when connectivity to a network is lost
Provide an API that allows applications to query the coarse-grained or fine-grained state of the available networks
18.AccessibilityManagerService AccessibilityManager.java
/frameworks/base/core/java/android/view/accessibility/AccessibilityManager.java
SDK中没有。
19. NotificationManagerService NotificationManage
SDK: android.app.NotificationManager
SDK中注释:
Class to notify the user of events that happen. This is how you tell the user that something has happened in the background.
Notifications can take different forms:
A persistent icon that goes in the status bar and is accessible through the launcher, (when the user selects it, a designated Intent can be launched),
Turning on or flashing LEDs on the device, or
Alerting the user by flashing the backlight, playing a sound, or vibrating.
20.MountService 没有找到对应
21.DeviceStorageMonitorService 没有找到对应
22. LocationManagerService 没有对应,自身就是一个manager
23.SearchManagerService SearchManager.java
SDK:android.app.SearchManager
SDK中注释:
This class provides access to the system search services.
In practice, you won't interact with this class directly, as search services are provided through methods in
Activitymethods and the the
ACTION_SEARCH
Intent.
This class does provide a basic overview of search services and how to integrate them with your activities. If you do require direct access to the SearchManager, do not instantiate this class directly; instead, retrieve it through
context.getSystemService(Context.SEARCH_SERVICE).
24.WallpaperService
25.AudioService
26.BackupManagerService
27. AppWidgetService 对应 AppWidgetManager.java
SDK中没有
以上为android提供的基本service,也许有对应的manager向外暴露接口,也许有对应的provider提供数据,也许没有暴露,需要用到的时候进一步查看。
相关文章推荐
- android中对服务的应用管理 .
- android中对服务的应用管理 .
- android中对服务的应用管理
- Android 输入管理服务-输入事件向详细应用的分发
- Android 输入管理服务-输入事件向具体应用的分发
- android中对服务的应用管理
- 半转载半总结:Activity管理---Android之后台服务判断本应用Activity是否处于栈顶
- Android高德地图加载WMS服务应用实践
- Android 绑定类型服务---管理绑定类型服务的生命周期
- 提高系统的业务价值—柯莱特钱建宇谈应用管理服务外包
- Android 自带的应用统计服务(UsageStatsService)
- [Android 性能优化系列]内存之提升篇--应用应该如何管理内存
- 第四篇 ANDROID窗口管理服务实现机制
- SaaS,如何应用到IT服务管理中
- Winform开发框架之通用定时服务管理2---如何开发定时服务应用
- Android 应用权限管理默认开关的修改方法
- Android 之 ServiceManager与服务管理
- Android应用开发之(管理好你的网络操作)
- 第十八篇 ANDROID的声音管理系统及服务
- Android 的Backup服务管理机制与架构分析