Author: Liran B.H

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

Python – Writing Functions – Complete Guide

Writing Python code is fun and easy. You can use Procedural programming, Functional programming , Object oriented programming or any combination.  Functions are basic unit in any method you choose. Functions are objects, defined with the ‘def’ statement followed by argument list. The function body is defined using indentation like other python statements

Arguments […]

Read more

Linux – IO Multiplexing – Select vs Poll vs Epoll

One basic concept of Linux (actually Unix) is the rule that everything in Unix/Linux is a file. Each process has a table of file descriptors that point to files, sockets, devices and other operating system objects. Typical system that works with many IO sources has an initializaion phase and then enter some kind of standby […]

Read more

Python – Understanding Generators

Many functions in Python use or generate in-memory lists for iteration.  This is fine for relatively small list, but for large lists it becomes a problem. Lazy Lists A lazy list is when the next item is supplied when needed, and not before.  If we stop processing before reaching the end of the list then those […]

Read more

Linux – Writing a Simple Container App with Namespaces

One of the building blocks to implement containers is Linux namespaces. Namespaces control what a process can see. It can be the processes IDs, mount points, network adapters and more. To use namespaces we call the clone(2) system call. Creating a child process – fork vs clone To create a new process in Linux, we can […]

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

Python – Basics of Cryptography and API

Python is a great programming language for data analysis, web development, networking and more. While working with data , storing in files, sending to a remote machine and so on, we sometimes need to encrypt the data to prevent unauthorised access. With python cryptographic packages we can encrypt and decrypt data using various methods , […]

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

Understanding sed – Practical Guide

Sed is a powerful stream editor, typically used for editing large amounts of data by providing a simple command. Sed is also used for sophisticated searches, where the Regular Expressions are used. You can use sed to: Automate editing actions to be performed on one or more files Simplify the task of performing the same edit […]

Read more