Giter VIP home page Giter VIP logo

android.system-services's Introduction

Android System Services

This repo contains additional android system services to set/read GPIOs und read sensor data. The services where testet on an ODROID XU3-Lite (Android 4.4.x), ODROID C2 (Android 6.x.x) and Raspberry Pi 3 (Android 7.1.x).

How to install

Android <=6.x.x

  1. Copy the content of the aidl folder in your android platform folder frameworks/base/core/java/android/os

  2. Copy the content of the server folder in your android platform folder frameworks/base/services/java/com/android/server

  3. Add the AIDL files to your frameworks/base/Android.mk

LOCAL_SRC_FILES += \
//[..]
core/java/android/os/IUpdateLock.aidl \
//[..]
//[ADD]
core/java/android/os/IValueSupplierManager.aidl \
core/java/android/os/IValueSupplierService.aidl \
core/java/android/os/IGPIOService.aidl \
//[/ADD]
//[...]
  1. Add the new services to your frameworks/base/services/java/com/android/server/SystemServer.java
//[..]
//[ADD]
//ValueSupplierManager
import com.android.server.ValueSupplierManager;
//GPIO
import com.android.server.GPIOService;
//[/ADD]
//[..]
class ServerThread {
//[..]
	public void initAndLoop() { // On Android 4.4
	private void startOtherServices() { // On Android 7.1.x
//[..]
//[ADD]
		try {
			Slog.i(TAG, "Value Supplie Manager");
			ValueSupplierManager valueSupplierManager = new ValueSupplierManager();
			ServiceManager.addService(valueSupplierManager.getName(), valueSupplierManager);
		}
		catch (Throwable e) {
			Slog.e(TAG, "Failed to add Value Supplie Manager", e);
		}
		try {
			Slog.i(TAG, "GPIO Service");
			GPIOService gpioService = new GPIOService();
			ServiceManager.addService(gpioService.getName(), gpioService);
		}
		catch (Throwable e) {
			Slog.e(TAG, "Failed to add GPIO Service", e);
		}
//[/ADD]
//[..]
  1. in your main android platform folder call make update-api

Android >=7.1.x

  1. Create the folder frameworks/base/services/grimgal/java/

  2. Copy the content of the server folder to the created folder.

  3. Create a Android.mk file in the grimgal folder with the following content

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := services.grimgal

LOCAL_SRC_FILES += \
	  $(call all-java-files-under,java)

LOCAL_JAVA_LIBRARIES := services.core

include $(BUILD_STATIC_JAVA_LIBRARY)
  1. Add the grimgal services to your frameworks/base/services/Android.mk
services := \
//[..]
//[ADD]
    grimgal
//[/ADD]
  1. Copy the content of the aidl folder in your android platform folder frameworks/base/core/java/android/os

  2. Add the aidl files to your frameworks/base/Android.mk

LOCAL_SRC_FILES += \
//[..]
core/java/android/os/IUpdateLock.aidl \
//[..]
//[ADD]
core/java/android/os/IValueSupplierManager.aidl \
core/java/android/os/IValueSupplierService.aidl \
core/java/android/os/IGPIOService.aidl \
//[/ADD]
//[...]
  1. Add the new services to your frameworks/base/services/java/com/android/server/SystemServer.java
//[..]
//[ADD]
//ValueSupplierManager
import com.android.server.ValueSupplierManager;
//GPIO
import com.android.server.GPIOService;
//[/ADD]
//[..]
class ServerThread {
//[..]
	private void startOtherServices() {
//[..]
//[ADD]
		try {
			Slog.i(TAG, "Value Supplie Manager");
			ValueSupplierManager valueSupplierManager = new ValueSupplierManager();
			ServiceManager.addService(valueSupplierManager.getName(), valueSupplierManager);
		}
		catch (Throwable e) {
			Slog.e(TAG, "Failed to add Value Supplie Manager", e);
		}
		try {
			Slog.i(TAG, "GPIO Service");
			GPIOService gpioService = new GPIOService();
			ServiceManager.addService(gpioService.getName(), gpioService);
		}
		catch (Throwable e) {
			Slog.e(TAG, "Failed to add GPIO Service", e);
		}
	//[/ADD]
	[..]
  1. in your main platform folder call make update-api

License

This project is licensed under Apache 2.0 - see the LICENSE file for details.

Acknowledgments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.