Giter VIP home page Giter VIP logo

android_system_service_example's Introduction

Android System Service IPC Example

In Android system, the main IPC is the binder. App can invoke a API from other app by binder, or it can create a binder service.

And you can make many system services for customing a ROM. Here we create many base codes for creating a system service in native code c level and Java code level.

How to install

Important:

  • Base environment: Ubuntu 12.04

Under AOSP

Compile them by AOSP mm.

AOSP should have compiled.

# In AOSP topdir
## source
source build/envsetup.sh
## lunch
lunch XXXX

# to source code
cd android_system_service_example
# Compile
mm

With Android SDK & NDK

System service Binder API is a hack techincal for customing ROM, so the system binder API invoking is also the hack techincal. Such as reflecting in Java and linking binder header in native codes.

  • Java code, you can use SDK to compile.

NDK for native code

#Go to sourcecode
cd android_system_service_example/NDKBuild
#Invoke NDK Command
XXXXXX/bins/android-ndk-r10c/ndk-build

For natice c code, there is not a better way for compiling in NDK because of some Binder APIs which are not Supported in NDK. If we want to make compiling in NDK, we need to copy a lot of frameworks header files. So here I copy headers and shared libraries for compiling as demo.

And the environment is:

    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.4
    TARGET_PRODUCT=aosp_mako
    TARGET_BUILD_VARIANT=userdebug
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a-neon
    TARGET_CPU_VARIANT=krait
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_OS_EXTRA=Linux-3.2.0-60-generic-x86_64-with-Ubuntu-12.04-precise
    HOST_BUILD_TYPE=release
    BUILD_ID=KRT16S
    OUT_DIR=out

Running

Because of using system API, the program should have SYSTEM permission.

  • Native code: running in root
  • Java code: sign by platfrom certificate

android_system_service_example's People

Contributors

qianjigui avatar

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.