Source code directory structure for Android device

https://habr.com/ru/post/264507/image

The article was written 10 years ago! But until now, the same version of Android has remained free and open source. Until now, many small companies continue to in their devices focus on Android 4.4.

Chinese and Taiwanese Android device manufacturers provide source code and add-ons without documentation. Now (Author’s note: at the time of autumn 2012) in the Taipei and Shenzhen region there is an explosive growth of technology parks. Often, employees of numerous companies have just started working with code. And, as a rule, the project deadlines are very tight. There is no documentation at all.

Let’s try to figure out what parts the source code tree of a typical Android device consists of and what are the favorite places for code modification among software manufacturers from Southeast Asia.

WP9900 car navigation box (Android)

This article provides information on a typical device WP9900 by Wonde Proud Technology Co., Ltd. (Taiwan) on A8 / Cortex 1 Ghz.

Usually the code is transferred as is in one large archive. In our case, the packed archive took about 6 gigabytes. And unpacked – 8 800 MB. It was a directory called Android_2.3.7.1. You might guess that this is Android 2.3.x “Gingerbread” or “Gingerbread”. The number 1 in the version is probably a release from the manufacturer itself.

In large companies, there is the concept of a platform – it is a certain fixed set of hardware version, Linux kernel version and Android OS version. The practice is that with a new version of hardware, they usually switch to new versions of software. In this case, this is 1 version of hardware and, apparently, 1 version of the Android platform for the manufacturer.

Inside the following directories

  • bionic is a BSD version of the open standard C library;
  • bootable – directory with bootloader, recovery.c and installer.c programs;
  • build – directory for building Android;
  • cts – Compatibility Test Suite, compatibility test for Android;
  • dalvik – Java virtual machine source code for Android;
  • development – programs and utilities necessary for a developer;
  • device – platform-specific libraries for various devices (HTC, Samsung, etc.);
  • external – various system utilities from the Linux legacy that the Android OS uses;
  • frameworks – Android OS framework in which applications run;
  • hardware – the source code of Linux drivers and modules specific to the platform hardware;
  • image – the place where ready-made images for device firmware are copied;
  • kernel – the source code of the Linux kernel;
  • libcore – source code of Java libraries for Android OS;
  • ndk – Native Development Kit, source code for developing C applications for Android OS;
  • out – directory for the results of the build system;
  • packages – source codes of application packages (APK);
  • prebuilt – cross compilers for different platforms (toolchain);
  • sdk – Software Development Kit, an environment for building applications and libraries;
  • system – system utilities and libraries for Android OS in C and C ++;
  • Data – closed, hardware-specific libraries;
  • cp_image.sh – script for copying images and creating a device update file;
  • mk_image.sh – script for building all software;
  • touch_android.sh – script for removing collected images.

What do programmers from China and Southeast Asia change in the code?

Since there is a lot of source code, we will limit ourselves to a detailed study of only individual directories in the source tree. These places are most often modified in the process of creativity of engineers from Southeast Asia.

packages / apps Is a directory where sources and binaries of application packages for Android OS are stored.

Most often, applications are written in Java. Usually, Launcher, Video, Radio, Settings and other device-specific app packages are the first to be modified or reworked.

frameworks / base / services / java / com / android / server – the directory where the source codes of individual OS vital processes are stored. In particular, there is a class (PackageManagerService.java) for installing APK packages, linking additional libraries with it, granting system rights to the application.

frameworks / base / packages / SystemUI – the place where the system packages are located that modify the status bar and access to USB.

In general, the frameworks / base / packages directory contains applications for setting external connections and access rights to the system. Also inside the source code of the framework frameworks / base / core / java / android in a separate directory, for example, by the name of the device manufacturer, a small set of classes is located, which resembles backdoor in functionality (from the English back door).

Let’s list the functions of these small Java classes: default settings in the system, GPS access, bluetooth access, remote FTP access, device screenshot, phonebook database and digital keys access. Like these ones reasonable framework modifications are made by our colleagues from Southeast Asia.

For example, you can access other devices. For example, car navigation boxes, these can be CAN interface adapters. There is a chance that this interface will allow to intervene in driving.

The hardware catalog contains a variety of drivers from external devices that are supplied by other major manufacturers from China. For example, here is the directory for the library that provides the functionality of the 3G modem – hardware / ril / reference-ril… If you look inside, you can find a binding to a specific modem.

According to our assumption, it is precisely such minor changes in the library that greatly help manufacturers from Southeast Asia to artificially force buyers to purchase the entire set of peripheral devices at a premium.

kernel – here is the source code of the Linux kernel, usually heavily patched. This is often 10-15 different patches. No documentation or hints as to which patch sequence was used. Only in the boot logs can you find individual kernel modules. Without these modules, a publicly compiled kernel will most likely not work on the device. Usually this is support for video outputs, power, touchscreen, bluetooth, and other specific protocols.

Conclusion

As a rule, all these additions do not go through any testing procedures, which accordingly affects the final quality of the product. Lack of documentation only exacerbates the situation.

I would like to wish the manufacturers of Southeast Asia to quickly move from earning money on peripheral devices to the production of a quality product accompanied by full documentation.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *