简体   繁体   English

在应用程序中使用自定义系统服务(Android Studio)

[英]Use custom system service in app (Android Studio)

First of all, thank you for your help. 首先,谢谢您的帮助。

Here is my problem. 这是我的问题。

  1. I have made a custom system service (it does connect through the binder, and hooks into the system server, then into the HAL, etc). 我做了一个自定义的系统服务(它确实通过活页夹连接,并钩接到系统服务器,然后钩到HAL等)。 One of the main commands is isBacklightOn(). 主要命令之一是BacklightOn()。 I also ran the make update-api to include it in my ROM build. 我还运行了make update-api以将其包含在我的ROM版本中。
  2. I am now ready to test the functionality using an app. 我现在准备使用应用程序测试功能。 I am using the following code: 我正在使用以下代码:

 import android.os.BacklightManager; //My service manager name ... BacklightManager bm = (BacklightManager) getSystemService(BACKLIGHT_SERVICE); ... if(!bm.isBacklightOn()) { //Turn it on. } else { //Other Things... } 

My problem occurs because Android Studio will not build the application due to not knowing what the BacklightManager is. 发生我的问题是因为Android Studio由于不知道BacklightManager是什么而无法生成应用程序。 How can I build this application to test my code? 如何构建此应用程序以测试我的代码? (import something into Android Manager, force a build ignoring errors, etc.) (将某些内容导入Android Manager,强制构建忽略错误等)

It looks like the solution is to build a custom SDK within the AOSP build environment. 看来解决方案是在AOSP构建环境中构建自定义SDK。 And then import that into Android Studio 然后将其导入Android Studio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Android Studio 中使用系统自定义 fonts - How to use system custom fonts in Android Studio 如何使用自定义权限在Android中创建系统服务? - How to create a system service in Android with a custom permission? 应用启动时Android启动系统服务 - Android start system service at app startup 在Android中自动启动系统应用程序的服务 - Auto start of a Service of a System app in Android 使用键盘应用程序或服务在 android 系统中使用 unicode fonts(非英语)的方法 - Ways to use unicode fonts (non-english) in android system using keyboard app or a service 签署Android Studio项目apk作为系统应用程序使用权限INJECT_EVENTS - sign Android Studio project apk as system app to use permission INJECT_EVENTS 在Android Studio项目中使用系统字体 - Use System Font in Android Studio Project 如何在Android Studio中使用自定义Android SDK? - How to use custom android SDK in Android Studio? 系统应用程序设置中的Android自定义通知声音 - Android custom notification sound in system app settings 什么时候为MediaPlayerin android studio使用服务 - when to use service for MediaPlayerin android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM