Tag: Android

Android – Creating Shared Memory using Ashmem

In API 27 , Google added SharedMemory class so applications can create and use shared memory using asmem (/dev/ashmem). Today, less than 1% of mobile devices work with API 27 (Android 8.1) so It is useless. In this post I will show you how to work with ashmem, creating and using shared memory between 2 […]

Read more

Signing Android Application

All Android apps (.apk files) must be digitally signed prior to installation on a device and uploading to Android Play store. The embedded certificate can be self-signed and valid for 25+ years. No certification authority needed so the vendor identification is not trusted.  App signing on Android is used to: Ensure the authenticity of the […]

Read more

AOSP – Creating a System Service

In the previous post, we built a native daemon in Android native layer. We wrote a simple application to communicate with the daemon using a socket (UDS/UDP/TCP). Most of the services provided by Android using the Android Framewok layer If for example, the camera application wants to get the current GPS location, it connects to the […]

Read more

AOSP – Adding a Native Daemon

Android is a great OS for many devices and not mobile only. You can even use Android on devices without display (headless). The most important thing about Android is the fact that it is open source and you can build everything from source. Android structure: The lower layer is Linux kernel with some changes (little) […]

Read more

Android HIDL and Project Treble

One of the problems in Android is the fact that when a new version is released only a few devices can be updated. Actually, if you want to enjoy the latest version, you need to buy a new smartphone every 6 months. Google solution is the Project trebel that separates the vendor implementation from the […]

Read more

AOSP – Creating a System Application

When we build a ROM for Android device we can add components on different layers. We can add daemons and libraries on the native layer, system services on the framework layer and system applications we want to build into the ROM (like the phone app, SMS, etc) In this post, I will  cover the process […]

Read more

Android Services and AIDL

Android applications are built from 4 types of components: Activity – Screen (code and GUI) Service – independent code supplying something Content Provider – Data service Broadcast Receiver – component for global events handling The developer can create multiple components from each type and each one can be an entry point. In this tutorial i […]

Read more

Android ION

One of the features google added to linux kernel is a general purpose allocator /dev/ion. The new allocator allows us to allocate memory from different heaps and devices, virtual and physical User space usage #include<stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> #include “/home/developer/kernel3.4/goldfish/include/linux/ion.h” void main() { int *p; struct ion_fd_data fd_data; […]

Read more

Creating a Java VM from Native code

On Android init phase we are running init application that uses its init scripts to start all the code system services. We can add a new daemon easily if we are building a ROM by add an empty folder, adding Android.mk file and C/C++ source file. In this way we can run C/C++ code but […]

Read more

Java and C/C++: JNI Guide

While writing Android application or other generic java application you sometimes need to write code in C/C++. Java is a dynamic language with a lot of security checks for example on every array access, every type cast , on function call and return and more. those checks affect performance and if you want to manipulate […]

Read more