如何将系统服务添加到了Android框架 [英] How to add a system service to the Android Framework

查看:314
本文介绍了如何将系统服务添加到了Android框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要补充一点,在Android的system_server运行我自己的框架code(处理所有的系统级服务)。我的服务加载了会谈我已经加入到内核的驱动程序的JNI库。这项服务被设计为允许应用程序注册一个侦听与它来从驱动程序更新。我发现了一个pretty好的博客文章(<一个href=\"http://www.androidenea.com/2009/12/adding-system-server-to-android.html\">http://www.androidenea.com/2009/12/adding-system-server-to-android.html)说明如何添加系统服务,但我不能让它完全工作。

I want to add my own framework code that runs in the Android "system_server" (handles all the system level services). My service loads a JNI library that talks to a driver I have added to the kernel. The service is designed to allow an app to register a listener with it to get updates from the driver. I found a pretty good blog post (http://www.androidenea.com/2009/12/adding-system-server-to-android.html) that explains how to add a system service, but I cannot get it completely working.

首先,后提到了适当Android.mk文件应该被用于写入的客户端/测试应用程序,但不给这样的一个例子。当我尝试构建它,我得到的编译错误说,它不能找到我已经加入该服务。可能有人给出了这个可能看起来像一个例子吗?

First of all, the post mentions that an "appropriate" Android.mk file should be used to write the client/test application, but does not give an example of this. When I try to build it, I get build errors saying it can't find the service I have added. Could someone give an example of what this might look like?

另外,我想实现这一点的供应商目录(升级Froyo或设备目录),而不是在Android开源$ C ​​$ C。博客文章提到,这样做的适当位置是在供应商目录,但并没有给这个看起来应该像什么的例子。任何人都知道?

Also, I'd like to implement this in the vendor directory (or device directory in froyo) rather than in the Android open source code. The blog post mentions that the proper place for this is the vendor directory, but does not give an example of what this should look like. Anyone know?

这是实施的Andr​​oid自己的系统服务的任何其他信息将是有益的。再次我的具体工作流程是:

ANY additional information on implementing your own system service in Android would be helpful. Again my specific workflow is:

Android应用程序 - >系统服务 - > JNI(本机)库 - >设备驱动程序

Android App -> System Service -> JNI (native) library -> Device Driver

推荐答案

德州仪器提供了一个很好的例子:

Texas instruments has provided a nice example:

<一个href=\"http://processors.wiki.ti.com/index.php/Android-Adding_SystemService\">http://processors.wiki.ti.com/index.php/Android-Adding_SystemService

此外,在CyanogenMod的SystemServer.java也作为阵config_vendorServicesconfig.xml中(见核心/ RES / RES /价值/ config.xml)中定义的code动态加载系统服务,这是我相信可以使用覆盖供应商或设备目录覆盖。这是一个特定的CyanogenMod-另外,加在这个承诺:

Additionally, the CyanogenMod SystemServer.java has also code for dynamically loading system services as defined in the array "config_vendorServices" in config.xml (see core/res/res/values/config.xml), which I believe can be overwritten in the vendor or device directories using the overlays. This is a CyanogenMod-specific addition, added in this commit:

<一个href=\"https://github.com/CyanogenMod/android_frameworks_base/commit/88fff90131f54d45dc496c45127ac1d16ad257df\">https://github.com/CyanogenMod/android_frameworks_base/commit/88fff90131f54d45dc496c45127ac1d16ad257df

这篇关于如何将系统服务添加到了Android框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆