Android Rom Customization
Android Rom Customization
Introduction
Android is Linux based operating system which is Developed by Google for android devices with
java interface. Android developed for touchscreen Devices like mobile and tablet. Android is
also an open source Alliance. It means each user can customized android firmware according to
own requirement. Generally, we see each manufacture customized android operating system or
firmware according to his requirement and provide different UI to the user like Samsung and LG
device has the same operating system and same version but provide the different-different User
interface. This operating system takes input through touch from the user and provides solution
according to input provide by the user. Touch may be resistive or capacitive. Android is popular
in technology because it provides low-cost and customizable operating system for high-tech
devices.
It is the pure open source operating system, For example, an application can call any of the
phone's core functionality such as making calls, sending text messages, or using the camera.
Android is built on the open source Linux Kernel. It utilizes virtual machine (Dalvik virtual
machine) that was designed for optimizing memory and hardware resources in a mobile
environment.
Android does not differentiate between the phone's core applications or system applications and
third-party applications. They can have equal access to a phone's capabilities.
Android provides the wide range of useful libraries and tools that can be used to build
applications. For example, Android enables developers to Developed access the location of the
device and allows devices to communicate with one another social applications.
BADA- It is partially java based operating system and it was used in old Samsung non-
smartphone devices.
Simbian - It is partially java based operating system and it was used in old Nokia non-
smartphone devices.
J2ME- It is also java based pure operating system and it was used in old Nokia,samsung and
china non-smartphone Devices.
BLACKBERRY- It also java also based operating system but partially and it is used in
blackberry devices.
IOS- It is objective c based operating system and it is used in apple device like iPhone and
IPAD.
android- It is java based operating based operating system and it is used in around 70% device
like HTC, LG, Samsung, Micromax, Lemon, Carbon, Lava
Web browser
Android web browser provides open source web kit.
Voice Features
Android provide the voice-based feature for text, voice, and calling.
Multi-touch
Android also provide the multi-touch feature.
Multitasking
We can do multiple tasks at a time in android, for example, we can listen to music and chat
together at same time.
Calling
Android include two types of calling features audio and video.
Wifi Hotspot
Wi-Fi Hotspot connects internet data to another device.
Media
Android provide media support also like png, jpg, Gif, BMP (image) mp3, mp4, amr.wav (audio
and video) formats.
Screen Capture and Screen Recording
Android provide screen capture facility in all version and screen recording in kit-Kat and upper
version.
Data Storage
Android also provide data storage facility. There is three data storage facility in android device
first one os storage which contains app and system file the second one is internal data storage it
provides internal memory for data storage and the third one is external storage.
Sqlite
Sqlite use data storage in android application. It is a lightweight database.
Android versions
Name Version API level
Alfa 1.0 1
Beta 1.1 2
Cupcake 1.5 3
Donut 1.6 4
Froyo 2.2-2.2.3 8
Android Architecture
This is the android architecture, it has five layer and it work from bottom to top.
Android ROM Architecture
Application Layer
This is the most upper layer in android architecture. This layer contains all Applications of
devices. There are two types of applications in android, first types are system applications like
phone contact, SMS, call and second types are third party applications which are installed
externally or from play store. System application cannot be Uninstall but Third party application
can uninstall by a user from the device.
Application framework
This is the second layer of the android structure. This layer contains set of services which is
required for android activity and reuses by other applications like that if we want to perform
calling so we will have to need telephony manager service to perform this task. So there are lot
of other services just like activity manager perform activity task and lifecycle task, window
manager perform system UI, content provider manage shared set of data of device like contact
and message, system view manage application widget, package manager manage all install
application packages, Resource manager manage another resource like String, color, and
layout, location manager manage map related functions, notification manager manage system
notification like battery, message, location.
Libraries
This layer divides into two parts one is android libraries and second is android runtime. Libraries
contain java based libraries and C/C++ libraries. Java libraries contain a lot of libraries.
Java libraries
android.app- this library has fully model of an android application.
Android.view-this library provide the user interface to the user.
android.widget-this library provide user interface component for an application like button, edit
text etc.
android.webkit-this library contains all classes regarding web server.
android.os-this library contains all classes for os just like message passing between activity
messaging.
android.media-this library contains media classes.
android.openGL- this library contains 3D graphic classes.
Android.provider- this library provides classes for the shared set of database or predefined
database.
android.content- this library contains all classes to use transfer data from one activity to other
activity.
android.database-this library contains all classes to use store data of any application.
android.graphics-this library contains all classes for graphic 2D and 3D.
android.hardware-this library contains all classes to interact with hardware like a sensor.
android.net-this library contains app classes for network programming.
android.util-this library contains all classes for string data conversion and collection framework.
C/C++ libraries
This library contains slandered libraries of C/C++. This libraries communicate between the
android driver and android libraries because all drivers developed with C/C++ libraries. This
library also used for NDK (native development kit).
Android Runtime
It is a type of JVM used in android devices to run apps and optimized for low processing power
and low memory environments. Android runtime contains core libraries which communicate with
the kernel. JVM provides the environment for multitasking execution. Each task executes
directly by the kernel in android.
Linux kernel
The fourth layer of android architecture is Linux kernel which provides communication between
hardware and software. The whole Android OS is built on top of the Linux Kernel. Kernel means
the core of Operating System. Linux kernel that interacts with the hardware and it contains all
the essential hardware drivers.
Drivers are programs that communicate with the hardware. For example, all devices have a
Bluetooth hardware in it. Therefore the kernel must include a Bluetooth driver to communicate
with the Bluetooth hardware.
Android drivers
This is the fifth layer of the android architecture. This layer provides all drivers which are
necessary for android device. Android drivers communicate between hardware and Linux
kernel. Drivers recognize the hardware and perform talk with software or we can say that it
perform exactly what we want with hardware, for example, suppose we want to extend out
device memory for this task we will need flash memory driver which recognize external memory
then process to software.
Android hardware
This is the last layer of android architecture which contains device hardware. We can easily
understand by this diagram
Flow of android execution
From above Diagram, we can easily understand that the execution of any task done from
bottom to top. For example, supposes we want to perform any action on our device then firstly
we will have to interact with device hardware by touchscreen or any other hardware. then
screen recognize what action you want to perform and hardware interact with the driver
according to your requirement for example if you want to play music then will go to the audio
driver or if want to use wifi it goes to wifi driver. The driver interacts with libraries by Linux kernel
then the process will be forward to Native libraries Because Native libraries used to develop
android operating system files, then it forwards to java and android libraries to execute the
process. java libraries contain core libraries android libraries predefined classes just like calling
messaging etc. then finally application perform the task.
Chapter 2 android ROM HAL Audio and Bluetooth Architecture
It is the main layer of the android architecture. This layer provides Communication between
hardware and software, mean that it provide communication between android driver and android
services. Android open source provides the facility that you can download the android software
and customize this software according to your requirement. HAL contain audio, graphics, wifi,
Bluetooth, camera, media and storage drivers.
A hardware abstraction layer (HAL) is a logical division that provides communication between a
computer's physical hardware and its software. It provides a device driver interface allowing a
program to communicate with the hardware.
The HAL, or Hardware Abstraction Layer, provides the application developer with a set of
standard functions that can be used to access hardware functions without a detailed
understanding of how the hardware works.
Low-Level android architecture
Hardware Abstraction Layer
Application Layer
This Layer has all application including system and third party application. Application Layer
provides User interface to the user that interact directly to the user for example contact,
messaging, calling etc.
Application Framework
Android framework provides API to provide android libraries to user applications. The
application may be system applications or third party applications.
Native Libraries
Native libraries provide the interface to system API. These files are written in c/c++ code.
Services
Services are bang round process which provides the interface between API. There are two
types of services, system service and media service. System service includes Window and
notification services and media service includes Media player and Media Recording.
Kernel
Linux processes any task with providing resources with adding hardware and software. It is the
link of hardware and software.
Drivers
This layer provides all drivers which are necessary for android device. Android drivers
communicate between hardware and Linux kernel. Drivers recognize the hardware and perform
talk with software or we can say that it perform exactly what we want with hardware, for
example, suppose we want to extend out device memory for this task we will need flash
memory driver which recognize external memory then process to software.
We had been running Linux PC as our Audiophile system for a year now, and it simply beats
every other OS ever built when it comes to bit-perfect audio.
It provides AudioFlinger interface to applications that interact with Libaudio (HAL), hiding the
unnecessary details.
Audio Architecture has mainly two process media player and media recording.
ROM Audio Architecture
Application Layer
The application layer of audio architecture includes media player application and media
recording application.
JNI
JNI access by Application framework layer and it contain java core code. It is located in
framework/base/core/JNI and framework/base/media/JNI folder.
Native Libraries
Native libraries contain c/c++ core libraries which communicate with android.media API. It is
located in framework/av/media/libmedia.
Media Service
Media service providers interface with HAL. It is located in framework/av/services/audio flinger.
HAL
HAL provide the interface with audio hardware component with audio HAL. It is located in
device/vendor/product/audio.
Kernal
The Main work of Kernel is that executes the process and provide the interface with the driver
with native code.
Driver
Driver layer contains audio drivers.
ROM Bluetooth Architecture
Android support Bluetooth and wifi which provide communication between deferent devices.
Bluetooth sends text, audio and video files between two devices and wifi provide internet data
connectivity.
The Android platform includes support for the Bluetooth network stack, which allows connecting
a device to wirelessly exchange data with other Bluetooth devices. The application framework
provides access to the Bluetooth functionality through the Android Bluetooth APIs. These APIs
wirelessly connect to other Bluetooth devices, capable point-to-point, and multipoint wireless
features.
Bluetooth architecture executes all Bluetooth related application and provides API to third party
applications.
ROM Bluetooth Architecture
Application Layer
The application layer of audio architecture includes Bluetooth applications.
JNI
JNI access by Application framework layer and it contain java core code. It is located in
package/app/Bluetooth/JNI.
Native Libraries
Native libraries contain c/c++ core libraries which communicate with android.Bluetooth API.
System Service
Media service providers interface with HAL. It is located in package/app/Bluetooth.
HAL
HAL provide the interface with audio hardware component with android.Bluetooth libraries. It is
located in hardware/libhardware/include/hardware.
Kernal
The Main work of Kernel is that executes the process and provide the interface with the driver
with native code.
Driver
Driver layer contains Bluetooth drivers.
Chapter 3 Android ROM Sensor & Graphics Architecture
The Android system provides APIs for recording and playing audio and video, and for using the
built-in camera as an input device.
MediaPlayer
The MediaPlayer class provides basic audio and video playback capabilities.
MediaRecorder
The MediaRecorder class provides basic audio recording capabilities using the device's
microphone.
Media Routing
Apps use the Android routing APIs to play audio and video on remote devices.
Camera API
The Camera API is used to specify image capture settings, start/stop imaging preview, take
pictures, and retrieve the raw video.
The Android multimedia framework contains support for playing various of common media
types, so that you can easily integrate audio, video and images into your applications. You can
play audio or video from media files stored in your application's resources (raw resources,
assets) using MediaPlayer APIs.
In media, architecture executes all media application and provides API to third party
applications.
android ROM Media Architecture
Application Layer
The application layer of audio architecture includes media applications.
Native Libraries
Native libraries provide the interface to system API. These files are written in c/c++ code.
Media Service
It is the multimedia framework which provides the engine for audio and video Record. For this
process use mediaplayerservice.cpp and located into
framework/av/media/libmediaframewrokservice.
OMX Integration
OMX Integration provides interface with the hardware-based component.
Android has built-in sensors that measure motion, orientation, and various environmental
conditions. These sensors are providing raw data with accuracy and provide three-dimensional
device movement or positioning, or you want to monitor changes in the environment near a
device. For example, a game might track readings from a device's gravity sensor to infer
complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather
application might use a device's temperature sensor and humidity sensor to calculate or a travel
application might use the geomagnetic field sensor and accelerometer to report a compass
bearing.
Sensors Architecture executes all applications which are related Sensors.
android ROM Sensors Architecture
Application layer
The application layer of audio architecture includes Sensor applications.
Native Libraries
Native libraries provide the interface to system API. These files are written in c/c++ code. This
included in frameworks/native folder.
Sensor Service
Sensor service provides interface with HAL.
Sensor HAL
Sensor HAL provides userspace. It provides Interface with your hardware and drives. Its contain
sensors.h and sensors.app files. Its located into hardware/libhardware/include/hardware.
Sensor Driver
Sensor driver contains input event and sensor hub driver which understand by the kernel.
Sensor Hub
Sensor hub use in low-level computation.
Batching
Batching process is used to store sensor event in hardware in FIFO to process to HAL.
Sensor Types
Base Sensor
This types sensor associated with hardware
ACCELEROMETER
GYROSCOPE
MAGNETOMETER
Composite Sensors
A sensor which not associated with the base sensor is called composite sensor.
android Provides low-level graphics features such as canvases, color, points, and rectangles to
drawing to the screen directly.
The Android framework provides a various of graphics APIs for 2D and 3D that interact with
manufacturer implementations of graphics drivers, so it is important to the understanding of how
those APIs work at a higher level. This page introduces the graphics hardware abstraction layer
(HAL) upon which those drivers are built.
Application developers draw images to the screen in two ways: with Canvas or OpenGL.
Graphics Architecture executes all applications which are related to 2D and 3D graphics.
android ROM Graphics Architecture
Application Layer
This layer contains media player app, camera applications, OpenGL app.
Application Framework
This Layer includes window Manager Lib and OpenGL lib.
2D and 3D Engine
This layer contains java lib for 2d and 3d Graphics.
HwComposer HAL
HwComposer HAL Layer provides interface HwComposer with CPU 2D core layer.
The Android platform provides an extensible DRM framework that lets applications manage
rights-protected content according to the license constraints associated with the content. The
DRM framework supports many DRM schemes; which DRM schemes a device supports is up to
the device manufacturer.
DRM is an acronym for Digital Rights Management. Android developers include DRM licenses
in applications that protect their best interests. The DRM framework on your Android device
makes the use of DRM licenses possible. Android DRM licensing is free service offered to
Android application developers who publish apps through the Android Market.
android ROM DRM Architecture
Application Layer
Application layer contains many android apps which provide interface with application
framework layer.
Application Framework
Application framework layer contains android.media.mediacrypto API which accesses by the
application layer.
JNI
This API contain core code of c/c++ code. It is located in frameworks/base/media/JNI folder.
Native API
Native API associated with JNI API and it located into frameworks/av/media folder.
IPC
IPC provide the direct link between different processes. Its contain Icrypto.cpp and Imedia*.cpp
and its located in to frameworks/av/include/media directory.
Media Service
Media service providers interface with HAL it contains in Crypto.cpp. It is located in
frameworks/av/media.
When users insert new storage media (such as an SD card) in an adaptable location, Android
asks them how they want to use the media. They can choose to adopt the media, which formats
and encrypts it.
Native Libraries
Native Libraries is a most important layer in this architecture. Native Libraries provide the
interface between java lib android IPC because both IPC and java lib used this layer.
IPC
IPC provide communication between native lib and different Applications.
Service
This layer contains Mount Services which provide declare memory related all Information about
the device.
HAL
HAL layer is a most important layer in this architecture which provides communication between
android driver part and application part.
Driver
Driver layer contains many android drivers which provide the interface between hardware part
and low-Level application part.
Device drivers are software modules which plugged with an OS to handle a particular device.
Operating System takes use device drivers to handle all I/O devices. Device drivers are low-
level programming t code and implement a standard interface in such a way that code contains
device-specific register reads/writes. The device driver is generally written by the device's
manufacturer.
android ROM I/O Architecture
Application Layer
Application Layer is a most upper layer in android I/O Architecture. This Layer Contain much
Application for input Declaration like that touch screen or game, Key layout mostly all
applications.
JNI
Java native libraries are java libraries which support to android libraries like 2D and 3D
graphics, OpenGL.
Native Libraries
Next Level is native libraries which support to java or we can say that access by java native
library.
Services
This layer contains all services to related devices it may be system services or server services
depend on the talk which does you want to be executed.
HAL
HAL layer performs linking between to layer or we can say that its associated hardware and
low-level software layer.
I/O Layer
This layer provides input to the device by software. We may provide input by touch screen or
key layout we will learn about key layout later.
Chapter 5 Android ADB Command
ADB (android debug bridge) are the command which provides communication with the android
device or emulator or we can control the whole device with commands. We can interact with
ROM through ADB commands. Like In PC we can interact with kernel level through cmd
commands as at same we can interact at kernel level by ADB commands. Some commands
may work or not because of all device control through by providing root and devices read-write
permission. We can provide root in our device by two types first by externally and second by
internally we will learn deep later about rooting. This command may work on some device and
may be not in some device the reason behind this because we can see there is lots of different-
different ROM available in currently in the market like stock ROM, Rockchip ROM, MTK ROM
etc. Each ROM directory structure is different.There are two types of commands we find in
android ADB command and shell command.
ADB Command
ADB (android debug bridge) are the command which provides communication with the android
device or emulator or we can control the whole device with commands. We can interact with
ROM through ADB commands.
ADB, Android Debug Bridge, is a command-line utility included with Google's Android SDK.
ADB can control your whole device using USB from a computer, copy files, install and uninstall
apps, run shell commands.
1) For ADB commands firstly you will have to connect your device through USB debugging
mode or you will have to on USB debugging to going developer option in setting application in
the device.
2) Next, connect your device with the system by USB cable.
3) and check USB debugging check box.This Step provides authorization to the user for
debugging.
4) Go to the platform-tools folder in SDK and press ctrl+shift and right click there.
Their lots of ADB commands available in android which shows information about the android
device and we can change android device internal file, data, and setting. It means we can break
manufacture device limitations.
If you want to go in device recovery mode you will have to use ADB recovery command. With
help of this command, you can change your device setting like reboot or if you want to install
any shell script or flashing Rom.
8) Fastboot command
Fastboot command uses to unlock your device and modify your it.
ADB sideload command to use to push and flash the android custom ROM and zip file in your
device. With help of this command, we can put your ROM zip file into your device and starts to
flash it.
If you want to push an apk on your device and install it so we use install apk command.
We can unstill also an apk file using unstill apk adb commands.
This command use to take all data backup in database file .db
adb restore command use to restore all backup data reverse in your device.
2) Su Command
Ex: adb shell su
Su command indicates that this device provides super user permission to the user. If the device
uses a super user we can do anything with device or we can modify device according to our
requirement.
From above picture, we can see clearly that su file not found in /system/bin directory this
indicate that device has no power permission to the super user.
3) ls shell Command
ls command uses to find all folder and files in the directory.
Ex: adb shell ls
From this picture, we can see that these are all directories and files in root directory.
4) cd shell command
cd command uses to switch from one directory to another directory or from current directory to
another directory.
cp command uses to copy data from one directory to other or we can say that its copy data from
system to device or device to system.
8) rm Command
rm command uses to remove any directory or ant file from the device.
Mount file system command use to mount the partition to read/write to the file in the device we
can say that it provides read/write permission to the device.
Ex: exit
Chapter 7 Activity Manager Commands in android
In this Chapter, we will learn about different activity manager command. For this commands, we
can know all information about any device application activities.
Activity manager commands start with am the syntax. The may include intent specification.
am start<intent>
1) open menu
1) open menu
This is command will open complete action menu of your device. For this, we pass access intent
and start will initiate intent. We just need to know what kind of intent we need.
am startservice <Intent>
7) Kill package
Kill package command use to kill the whole package including all activity and service. This
command kills all process in a package in safe mode and does not affect other processes.
Ex: am kill-all
9) Broadcast
This command use to access our device any broadcast receiver class.
am broadcast <Intent>
11) Instrument
Instrument commands use to start monitoring with an instrument instance. These commands use to testing
purpose of the device.
Ex: am instrument -w <test_package_name>/<runner_class>
Ex: am clear-debug-app
14) Monitor
Sometimes we may be got error in our programs like unfortunately crash or ANR (application
not responding )
To check this command we use monitor command to resolve it.
Ex: am display-density<dpi>
Chapter 8 Package Manager Commands in android
Package manager (pm) command apply to all android package it may be system application or
third-party application packages. We can perform actions and queries on application packages
installed on the device.
1) List package
This command use to view all android application packages on your device.
3) list instrumentation
This command shows the list of all test packages.
Ex: pm list instrumentation f
4) System features
It shows all features of the device just like the camera, Bluetooth, network, and map etc.
5) list of libraries
This command use to show all android libraries in which are use in device currently.
6) List users
This command show list of all users currently uses in the device.
7) apk Path
Through this command, we can find apk full path in the device.
8) Install application
From this command, we can install any apk in any specific location in our device.
This pm command uses to clear all data associated with the package.
In the early days of Android taking a screenshot on a phone or tablet was a painful activity, but
now the ability to take a screenshot is built into the OS. In this Blog, we show you how to take a
screenshot on an Android smartphone or tablet, including the Samsung Galaxy S7, HTC 10,
Sony Xperia XZ, LG G5, Google Pixel and other Android phones and tablets.
There are lots of new features in android. The main important features Screenshot, in android
kit-kat. Screenshot available in all versions of android but screen recording feature is available
on kit-kat or higher level versions.
To make the Android phone screen video capture easy. There are lots of android application
have been build for android Screen capture and-and screen Recording or we can capture and
recording using and command too.
Screenshot
We can take the screenshot of many types in android like using the hard button or using android
ADB command android programming and it is saved in screenshot directory in sd card. To take
the screenshot using the hard button we will have to press and hold home power and volume
button at same time.
Screenshot file in the android device located in /system/bin directory.
In below picture, we can see screencap and screenshot files in the device.
Screen Recording
There are lots of improvements done in KitKat and one of the features is screen recording.
Screen recording is the shell command use to record device screen in video presentation form.
We get screen record achieved in form of MPEG. Screen recording feature available in KitKat
(API level 19) or higher version.
This is also shell command use to testing purpose of any device and application or in another
word we can say that use to debug app or device. This application test system event like click,
volume, touch, gestures.
Ex: adb shell monkey v -p <app package name> 500
dumpsys Commands
Dumpsys is the tool to get various information from the android device and show to the user,
this means we can find device information by dumpsys program and these commands also use
for testing of the android device.
2) Device battery
We can find information about device battery from this program like battery manufacturer name
and status and the other information.
4) CPU
From this command, we can also show all information about device CPU.
6) Disk Memory
This command provides information about disk space like total disk space, cache space,
available space.
Ex: adb shell dumpsys diskstats
7) Network
This command provides full information about your device network.
8) Provider
This command provides information about our device content providers full information like
phone contact information or message or WhatsApp contact information.
9) User Permission
This command provides information about all permission which uses by in all applications in the
device.
10) Process and PID
This command provides all information about all processes and all process id's about of device.
11) Account
This command provides all information about all account of the device like Google account or
another application account like WhatsApp account link dean account and yahoo account.
13) Window
This dumpsys command use to show window display information like keyboard and z-order.
15) GFX
This command shows all information about gfx use in the device just like OpenGL lib and
classes.
16) Surface Flinger
This command also shows storage manager like internal, external and cache memory.
18) Network Management
This command shows all information about device network management.
19) Notification
This command shows all information about all notification received to the device.
21) Audio
This command provides information about audio like audio recorder, audio player, audio types,
and audio volume.
23) Clipboard
This command provides information about clipboard like clipboard manager.
27) Storage
This command explains about storage method of the device just like that storage type, storage
path, storage partition and other information.
31) Sensor
This command full explains about sensors just like accelerometer and sensor services.
33) Gesture
This command provides information about gesture application and gesture classes.
In this Chapter, we will learn about key layout, key layout structure, storage location, types of
key layout and description about keys.
Key layout
Key layouts are files in the format of .kl which use to run key event by Linux device. There are
no of the specific predefined key used in the android device like home, back, menu and other
keys. There are two types of keys in android one is hard to button keys and other is soft button
keys.
Around all key layout files are located in key layout folder which path is
/system/user/keylayout/ and some files are may be located in
/data/system/device/keylayout/ folder in android device.
You can understand better with the picture.
The main file of the key layout is genric.kl which content all key of keyboard and joystick.
Key Declaration
There is an each key has the specific role and performs the specific action when press it in
android device and each key assign a specific role just like that key 102 will be referred to home
button so each key has some specific reason to use.
Some files are using some specific sentence. There is some sentences use with some key.
WAKE: wake mean that this key use when the device will be wake or screen will be in on
mode.
WAKE_DROPED: wake mean that this key use when the device will be wake or screen will be
in off mode.
SHIF: use for the shift.
CAPS_LOCK: use for Capital Letter.
ALT: use for alt key press.
ALT_GR: use for right alt key press.
FUNCTION: use for function key press.
VIRTUAL: use for the softkey press.
Joystick Keys
Joy stick key use for play games just like that screen axis.
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x03 RX
axis 0x04 RY
axis 0x05 RZ
axis 0x06 THROTTLE
axis 0x07 RUDDER
axis 0x08 WHEEL
axis 0x09 GAS
axis 0x0a BRAKE
axis 0x10 HAT_X
Here we are activating home button with help of ADB shell command.
There some other key which you can see in below picture.
from above picture you can do run all key event means you can perform any key event in your
device using the command in android device.
Chapter 12 android Testing and Monkey Testing
In this Chapter, we will learn about testing, testing modules, android testing, types of testing and
Monkey testing.
Android testing
From above picture, we can easily understand that testing contains with part one is JVM from
java and other is the android library.
Unit Testing
In unit testing, test runs on a local JVM on the development machine rather than android
runtime.
Unit testing is done by the android.jar library, all exception methods include in android.jar and
execute by default.
JUnit Testing
You can use the JUnit TestCase class to do unit testing on a class that doesn't call Android
APIs.
Testcase class is the super class for androidTestCase. You can easily understand with given
code.
Public class Testapp extends TestCase
{
Int a;
Int b;
}
Protectd void testMethod()
{
a=10;
b=10;
}
Monkey testing
MonkeyTalk is tools which use to test any android or I-Phone application or test and device. In
android SDK include these testing tools. We can test any device or any application with two
types first Junit testing and second is monkey testing. Junit test any application by test classes
and the monkey is a command line tool which tests with device action like touch screen, gesture
and other.
Where v represent verbose method and 500 represents no. of the event to be sent for testing.
Monkey testing
MonkeyTalk is tools which use to test any android or I-Phone application or test and device. In
android SDK include these testing tools. We can test any device or any application with two
types first Junit testing and second is monkey testing. Junit test any application by test classes
and the monkey is a command line tool which tests with device action like touch screen, gesture
and other.
Where v represent verbose method and 500 represents no. of event to be sent for testing
Where -p represent package and v represent verbose method and 500 represents no. of the
event to be sent for testing.
3) Run the same event sequence again in monkey testing
Sometimes you want to check an application on the same sequence or randomly again so you
will have to test exact same sequence with monkey tool.
android ROM
Rom is an operating system run on your device. It is stored in read only memory in hardware
segment where your firmware and all application store and all device come with a ROM which
installs by the manufacturer. Android ROM contains all flash files like system, boot, and
recovery. It is stored in read only memory part on hardware.
Custom ROM
Android is open source which allows the developer to customize it and we can edit or update
some new feature in it and build the own new ROM image for android phone or tablet or another
word we can say that it is the standard version of the android operating system.
Boot
Boot file contains ramdisk and kernel.This is the boot partition of your Android device. It includes
the android kernel and the ramdisk. The device will not boot without this partition. Wiping this
partition from recovery should only be done if absolutely required and once done, the device
must NOT be rebooted before installing a new one, which can be done by installing a ROM that
includes a /boot partition.
Recovery
It provides advanced recovery, installation, restoration, and maintenance operation for the
device.
This is specially designed for backup. The recovery partition can be considered as an
alternative boot partition.
System
This partition contains the entire Android OS, other than the kernel and the ramdisk. This
includes the Android GUI and all the system applications that come pre-installed on the device.
System partition contains the entire Android OS, other than the kernel and the ramdisk. This
includes the Android GUI and all the system applications that come pre-installed on the device.
you will still be able to put the phone into recovery or bootloader mode to install a new ROM.
Data
This partition contains the users data like your contacts, SMS, settings and all android
applications that you have installed.
It is called user data partition. This partition contains the users data like your contacts, SMS,
settings and all android applications that you have installed. when you used for the first time or
the way it was the last official or custom ROM installation.
Cache
This is the partition where Android stores accessed data and app components.
This is the partition where Android stores frequently accessed data and app components.
Wiping the cache doesnt affect your personal data but simply gets rid of the existing data there,
which gets automatically rebuilt as you continue using the device.
Misc
This partition contains miscellaneous system settings in form of on/off switches. These settings
may include CID (Carrier or Region ID), USB configuration and certain hardware settings etc.
sd card
This is not a partition on the internal memory of the device but rather the SD card. In terms of
usage, this is your storage space to use as you see fit, to store your media, documents, ROMs
etc. on it. Wiping it is perfectly safe as long as you backup all the data you require from it to your
computer first. Though several user-installed apps save their data and settings on the SD card
and wiping this partition will make you lose all that data.
And we can check system partition by df command
Chapter 14 Types of android Rom and Their Structure
android ROM
Rom is an operating system run on your device. It is stored in read-only
memory in hardware segment where your firmware and all application store
and all device come with a ROM which installs by the manufacturer. Android
ROM contains all flash files like system, boot, and recovery. It is stored in
read-only memory part on hardware.
Types of ROM
There are many android ROM available in currently in the market and mostly ROM internal
structure is same. We will discuss only a few android ROM but from the help of this book, you
can customize around all ROM. There are follow.
1) Stock ROM
2) Rockchip ROM
3) MT ROM
4) Cyanogenmod ROM
This Rom is mostly currently used by most of the manufacture.
Stock Rom
It is a cd Image file which builds in Linux operating system. This ROM generally uses in Chinese
device like all winner devices.
Supported firmware images:
1) Sochip SC8600/SC9800
2) Boxchip F10/F15/F16/F20
3)Teclast T7200/T8100
4) Allwinner F10/F13/F18
5) Allwinner F1C100/F1E200
6) Allwinner A10/A13/A10s
7) Allwinner A20/A31/A31s
8) Allwinner A80 (Phoenix Suit)
4) Bootloader.fex- this file contains the script for boot, battery images, and first boot logo file.
MTK ROM
This ROM is called media tech ROM and its get in many versions like MT6577, MT6572,
MT6575 and this is called MT65XX series.
5) userdata.img-The userdata.img file is a blank partition. It is used to reset the user data
partition to its factory state. ramdisk.img is a small partition image that is mounted read-only by
the kernel at boot time. It only contains /init and a few config files.
Rockchip ROM
Rockchip ROM also look like stock ROM but structure is different and there are lots of versions
of rock chip ROM are available in market
Structure and Extract Rockchip ROM
We can see it file structure in below figure. It contains four main files like system, boot, recovery
and kernel images.
1) Boot.img- boot file contain all files which are necessary for the boot like all boot script, boot
logo, boot animation.
android ROM
Rom is an operating system run on your device. It is stored in read-only memory in hardware
segment where your firmware and all application store and all device come with a ROM which
installs by the manufacturer. Android ROM contains all flash files like system, boot, and
recovery. It is stored in read-only memory part on hardware.
Stock Rom
It is a cd Image file which builds in Linux operating system. This ROM generally uses in Chinese
device like all winner devices.
Supported firmware images:
1) Sochip SC8600/SC9800
2) Boxchip F10/F15/F16/F20
3)Teclast T7200/T8100
4) Allwinner F10/F13/F18
5) Allwinner F1C100/F1E200
6) Allwinner A10/A13/A10s
7) Allwinner A20/A31/A31s
8) Allwinner A80 (Phoenix Suit)
4) Bootloader.fex- this file contains the script for boot, battery images, and first boot logo file.
There lot of tools available in the market to extract stock ROM like imagerepacker tools. When
we extract this image file with imagerepacker we will get many .fex files.
It provides advanced
2) Recovery.img- recovery file contains all back and restores files.
recovery, installation, restoration, and maintenance operation for the device.
This is specially designed for backup. The recovery partition can be considered as an
alternative boot partition.
5) userdata.img-The userdata.img file is a blank partition. It is used to reset the user data
partition to its factory state. ramdisk.img is a small partition image that is mounted read-only by
the kernel at boot time. It only contains /init and a few config files.
Chapter 16 Rock Chip and Cyanogen ROM
Rockchip ROM
Rockchip ROM also looks like stock ROM but the structure is different and there are lots of
versions of rock chip ROM are available in the market.
1) Boot.img- boot file contain all files which are necessary for the boot like all boot script, boot
logo, boot animation.
Boot file contains ramdisk and kernel.This is the boot partition of your Android device. It includes
the android kernel and the ramdisk. The device will not boot without this partition. Wiping this
partition from recovery should only be done if absolutely required and once done, the device
must NOT be rebooted before installing a new one, which can be done by installing a ROM that
includes a /boot partition.
Many of the specific customization settings available with Cyanogen OS come from the Theme
Engine, which is exactly as it sounds. Its a powerful app built into Cyanogen OS that lets you
download free and premium themes that can be applied to change the look of your phones
operating system. Currently, there are more than 100 themes available on the Theme Engine
with more added regularly.
CyanogenMod is a custom ROM for Android devices. Its free, and it extends the capabilities of
your device with themes, dramatically improved privacy functionality. If you have a rooted
device, installing CyanogenMod is incredibly easy. The CM team created an app called
CyanogenMod Installer that lets you download and flash the ROM with minimal technical
knowledge. Be sure to backup your data before you proceed.
Step 1: Download CyanogenMod Installer
Visit get.cm by your Android device and download the .apk file.
Boot file
Boot file contains ramdisk and kernel. This file is necessary to boot from any android device.
The boot.img is part of the Android ROM you flash onto your device.
This is the boot partition of your Android device. It includes the android kernel and the ramdisk.
The device will not boot without this partition. Wiping this partition from recovery should only be
done if absolutely required and once done, the device must NOT be rebooted before installing a
new one, which can be done by installing a ROM that includes a /boot partition.
BIOS
-BIOS include basic input-out system.
-It executes the bootloader program.
-Its look bootloader in floppy, cd-ROM, and hard drive.
-Once boot loader program loaded in memory BIOS given full control to it.
MBR
-MBR stands for master boot Record.
-It is store in the bootable disk.
-It's size less than 512.
GRUB
-GRUB stand for the grand Unified Bootloader.
-If you install more than one kernel you can choose one of them.
-GRUB display splash screen.
-GRUB Configuration file located in /boot/grub/grub.conf.
Kernel
-Mounts the root file system.
-Kernel executes the /sbin/init program.
Init
-Its decide kernel run level.
-Run level
0-halt.
1-single user mode.
2-multiuser.
3-full multiuser mode.
4-unused.
5-X11
6-reboot
-Identified the default init level and load all associate programs.
Runlevel Program
-it contains all runlevel programs.
-Runlevel depend on default init level setting
Run level 0-/ete/rc.d/rc0.d/
Run level 1-/ete/rc.d/rc1.d/
Run level 2-/ete/rc.d/rc2.d/
Run level 3-/ete/rc.d/rc3.d/
Run level 4-/ete/rc.d/rc4.d/
Run level 5-/ete/rc.d/rc5.d/
2) now go in the test folder and click Ctrl+Shift and right click and choose Open command
window here.
3) And write command bootimg.exe unpack-bootimg boot.img and press enter.
4) After edit file and folder in boot file, we can Repack boot.img.
For repack boot file run this command boot.img --repack-booting And press enter.
Recovery File
Recovery file is an android flash memory partition that use to perform the factory reset or
restore the original os and it provides clockwork mode to custom recovery for android
Smartphone and tablet or we can say that it provide advanced recovery, installation, restoration,
and maintenance operation for the device.
This is specially designed for backup. The recovery partition can be considered as an
alternative boot partition.
Recovery File Structure
Recovery.img file contains many parts like install, Wipe, backup, restore and setting. Each part
has an own different role in android device. We will discuss later in on each part.
We can run recovery mode by ADB command (ADB recovery reboot) or with hard code button
(by volume+ and power).
There are the main functions of recovery file to manage the android device.
Install- Install function contains to install any android device script to install any library or
application.
3) Select recovery file and press Extract then it will start automatically extract recovery file.
4) Here we can see extracted recovery file in the temp folder.
5) After the edit, we can also repack recovery file using press build button. we can see it in the
root directory.
Extract and repack System files in ubuntu
Required tools
Stock firmware - as a starting base.
Linux image tools - for extracting and building the partitions of the image.
A text editor that supports Unix line endings, do not use Notepad.
$ mkdir ramdisk
Go to ramdisk folder using command
$ cd ramdisk
Now we will extract ramdisk.zip file using command
$ gunzip c ../boot.img-ramdisk.gz | cpio i
And check ramdisk files using ls command
$ ls
$ cd ..
$ ls
Chapter 18 Structure Extract and Repack System and Bootloader
file in android
System File
many of the Android users are using their Android phone for calls, SMS, browsing and basic
apps, But from the development perspective, we should know first about Android internal
structure.
Android has several partitions (like boot, system, recovery, data etc) to organize files and
folders on the device just like Windows OS. Each of these partitions has its own working
functionality, But most of the user dont know the significance of each partition and its contents.
In this article, we will take you on a tour of Android partitions. So let's start the android file
system tutorial.
The system file is the main file in android os system and most of the work of any Rom depend
on it. Rooted android phones provide many additional benefits when compared to a non-rooted
phone and thats because we can read and modify system files.
This file contains the entire Android OS, other than the kernel and the ramdisk. This includes
the Android
GUI and all the system applications that come pre-installed on the device.
This partition includes all Android OS, other than the kernel and the ramdisk. This includes the
Android GUI and all the system applications that come pre-installed on the device. you will be
able to put the phone into recovery or bootloader mode to install a new ROM.
This partition contains the entire Android OS, other than the kernel and the ramdisk. This
includes the Android GUI and all the system applications that come pre-installed on the device.
System partition contains the entire Android OS, other than the kernel and the ramdisk. This
includes the Android GUI and all the system applications that come pre-installed on the device.
you will still be able to put the phone into recovery or bootloader mode to install a new ROM.
Extract and repack system File
Here we will extract and repack system file using Rk Firmware
tools here there is some step to extract it.
3) Select system file and press Extract then it will start automatically extract system file.
4) Here we can see extracted system file in the temp folder.
Bootloader file
the bootloader is code that is executed before any Operating System starts to run. Bootloaders
basically package the instructions to boot operating system kernel and most of them also have
their own debugging and modification environment.
Structure of Bootloader file
Extract and repack bootloader file
Here there is some step to extract and repack bootloader file.
1) Firstly install PowerISO software and copy bootloader.img file in the separate folder.
2) Right click and select PowerIso and then select extract here.
$ mkdir ramdisk
Go to ramdisk folder using command
$ cd ramdisk
Now we will extract ramdisk.zip file using command
$ gunzip c ../boot.img-ramdisk.gz | cpio i
And check ramdisk files using ls command
$ ls
$ cd ..
$ ls
Chapter 19 android Rooting
Android rooting is a process which breaks manufacture device limitation or in other work, it is
like a jell break. After rooting process user can edit, delete or update system files or directory.
This process provides super user permission to the user. It is same like Sudo command in Linux
and root word come from Unix/Linux.
Root Advantages
There are following advantage of android rooting.
1)custom ROM/Firmware
ROM is a software which runs on your device so after root we can do anything in ROM just like
we can edit, delete or update ROM files and we can also flash ROM. we can also change
device boot processes like boot logo and boot animation.
2)Custom Theme
We can also change android launcher or we can change Device theme.
4)Backup/Restore
We can also back device data and applications of our device.
We can unlock other feature like we can add or delete system application or some application
which require root permission may be perfectly run in rooted device.
Root Disadvantages
There are following Disadvantages of rooting
1) Break Device Warranty
After root, you may be lost your device warranty because many manufacturer or developer does
not allow device rooting.
2) Security
After rooting process, you lost your security because it may be the unwanted person can
change your device files any one can modify your ROM.
How To Root
From the above picture it clear that We can root a device in types by internally or Externally.
Internally Means if we have device original firmware we can root or Device ROM we can root
whole Operating system by changing some files and in externally root we can root device by
applying some command or by some tools. In externally root It may be root or no because you
already know that in currently market there are lot of android ROM available in market like stock
ROM, rock chip ROM, MTK ROM, and each ROM has different structure or file format or it may
be it require some additional user permission so that why It may be root or not by commands or
tools.
In the last picture, you can see that there is line ro.secure=1. If this is 1 means that it's secure
or unroot but if its value is 0 it means is unsecured or root. So we will have to change this value
for root.
We can change this value by ADB command
From this pull command, we copy the default.prop file into the desktop.
Now we can edit this value using not paid and again insert into the device by push command.
Other for root by ADB command we will have need three files.
1)su
2)busybox
3)superuser.apk
Now copy busybox, su and superuser.apk to /data/local/tmp/ using adb command
Now run ADB shell command it still shows $ sign means it is unrooted still.
Now run other command like
Chmod 6755 /data/local/tmp/su
Chmod 755 /data/local/tmp/bustbox
Turn off your device and again connect with window device and run adb shell su command
now your device must be rooted.
Boot animation
The boot animation is the first screen that you see when power on your Android phone or tablet.
It may be a zip file or video file. It shows manufacturer logo on boot screen and its run after the
boot logo.The boot animation is the first screen that you see when power on your Android
phone or tablet. It may be a zip file or video file. It shows manufacturer logo on boot screen and
its run after the boot logo.
The Android boot animation is contained an uncompressed zip file as bootanimation.zip that
can be found in the media folder of the system /system/media on the device.
This single file contains all the information about to run the boot animation and is loaded
automatically when the device boots.
.
Folder
These contain PNG or Jpeg images in order, starting from like 0000.jpg or 00001.jpg and
proceeding with increments one by one. There should minimum at least one folder in
bootanimation.zip
Desc.txt file
This file defines how the images in the folder are displayed in during the boot time.
You can see the format of desc.txt file format in below picture.
As you can see, in the first line, 600 and 1024 define the width and height of the boot animation
in pixels and
It depends on device screen resolution 6 is the frame rate in fps (frames per second)
number of images to display per second.
The second and line p represent part of animation and end with part0 or part1 and 0
represent how many times this part
will loop before switching to the next part (if exist) and here 0 number represent it will run
infinite till boot complete and
1 represents it will run the single time and hang in the last image till boot. Send number 0
is for pause and it represent in frame
A pause of 5 for example, would mean pausing for the time it takes 5 frames to play and
since the frame rate is 6
frames per second.
2) Copy all image in a folder as name part 0 in order format then create desc.txt and write
according to device configuration and user requirement as the previous topic structure of boot
animation.
when we open this desc.txt file we get.
3) Then select part0 folder and desc.txt file and right click here according to below picture.
4) Then choose to add to archive and check zip & select store in compression method then ok
5) Here we will get a uncompressed zip file.
If you have original ROM of your device then we can easily replace custom boot animation with
original boot animation of your device. For this process Extract system.img file of android ROM
and open system folder and then select media folder you put this zip file in this directory then
again compress system.img file.
Change boot animation using ADB command
We can also replace your custom boot animation with ADB command if your device is rooted.
Boot logo
The boot animation is the first screen that you see when power on your Android phone or tablet.
It may be a .bmp file or .rle file. It shows manufacturer logo on boot screen and its run after the
boot logo.
It may be the different structure in different ROM and it may one or two boot logo exist in ROM.
In each ROM boot logo location and existing form are different and it depends on types of ROM.
First boot log in stock ROM exists in bootloader file in form .bmp format.
second boot logo in stock ROM exist in boot file in form of .rle format.
boot logo in MTK ROM
First boot log in MTK ROM exists in root inform logo.bin format.
second boot logo in MTK ROM
second boot log in MTK rom exist in isboot.img and path is /system/media/images in form
boot_logo format.
1) Extract stock ROM according to the previous chapter and change its name from
bootloader.fex to bootloader.img.
2) Create a folder bootloader and copy bootloader.img file here
3) Install PowerISO software and right on bootloader.img file and select PowerISO then Extract
To.
4) Here you can see file structure of the bootloader.img file.
Create a .bmp file for boot logo and Click the add button to replace new boot logo then save.
4) Press convert button it will create a .rle file for boot logo with name initlogo.rle.
Change second boot logo in stock ROM
Here there are following steps to create .rle boot logo file.
1) Extract stock ROM according to the previous chapter and change its name from boot.fex to
boot.img.
For repack boot file run this command boot.img --repack-bootimg And press enter.
Here we get two files boot-new.img as edited boot file and boot-old.img old file.
Create and change First Boot logo in MTK ROM
We already know that First boot logo in MTK ROM exists in root inform logo.bin format.
So there are some steps to create and change first boot logo in android MTK ROM
1) extract Logo Builder tools and copy the original logo.bin file here.
2) run logobuilder.exe.
3) press create new project button and provide the path of the original logo.bin file and extract it
into a new folder as name logo here.
4) so create an edited logo image and replace with the original image. here we replacing img1
and img39 images with the new logo image.
5) After replacing now we can again create the logo.bin file using press make the button. And
you can see it in logo folder.
6) Replace this new logo.bin file with the original logo.bin file.
We already know that second boot log in MTK ROM exists in is boot.img and path are
/system/media/images in form boot_logo format.
So there are some steps to create and change second boot logo in android MTK ROM
1) Extract Image_Search_Editor.zip to a folder.
6) Now resize the image according to your device size by the press : Size --> 'Set image Size'.
7) Press ok Now you should see the full default boot logo image.
8) Now, select Edit-->Replace by new boot logo BMP image. Select the BMP image that you
saved then press apply.
2) run FWFactoryTool
Now at this time lot of ROM available in the market and many time we will need those drivers to
connect with computer for installation ROM or may other reason.
Here the following the step to install the device driver on your computer.
1) Download and extract USB diver.zip
Here you can see that if your device does not install in the computer it show the unknown
device.
3) Right, click on the unknown device.
We can install android stock ROM with mainly two tools like live suit and phoenix but both are
the platform or operating system dependent.now we will see how to install android ROM in any
device using different tools.
5) Now we can connect android Smartphone or tablet to the computer using USB cable and it
should be power off.
Before connecting your device press volume down button and connect your device to the
computer with USB cable while holding volume down button press power button around 10
times.
6) After successfully reorganization to your device we get a window to format your device and
press yes.
7) Again we will get another window, press yes again it will automatically start to installation
ROM in your device.
8) After successfully installation software we will get upgrade window.
Install with phoenix card dependent on os platform. it may install software on window 7 or may
be on window XP by phoenix card tools. It depends on the version of phoenix card version.
here below there are following the step to install stock ROM in android device.
1) Download and install android ADB drivers on your computer.
2) Download and extract the phoenixCard.zip file on your computer.
3) Insert TF Card /MicroSD Card in the Card reader and attach Card Reader with PC. Use
minimum 1GB memory card.
4) format MicroSD card to make sure it does not have any other file or it's not corrupted.
5) Open PhoenixCard.exe
6) click on Disk check.Disk Check will detect TF Card port Like J Drive, K drive.
7) Now click on Img File button and browse the stock ROM file from the above-extracted
directory.
8) Then click on Format to the Normal button to format the sd card using this application.
9) Finally, click Burn button to start burning an image to Micro-SD card.
10) Wait until the Burn End.. message appears on the screen.
11) Switch off your device and insert the memory card in it and switch on the device. ROM will
start installation automatically and after 100% complete remove your memory card in and start
your device.
here below there are following the step to install MTK ROM in android device.
1) Download and install android ADB drivers on your computer.
here below there are following the step to install Rockchip ROM in android device.
1) Download and install android ADB drivers on your computer.
We already know that how we can extract any ROM and how we can customize it because
customize ROM improve android ROM performance. In this chapter, we will discuss ROM
performance improvement by editing some ROM files like build.prop file, default .prop file and
some other customization.
Build.prop file
Basically, build.prop is system or firmware properties file which is located in /system folder.
System Directory consists of all necessary information for your ROM specific build.
We are going to edit this file and many custom ROM developers edit these files to free up
existing RAM. Editing should be carefully done and once small changes can be harmful to your
mobile device. Backup all your data before you make any changes.
Fast Reboot
persist.sys.purgeable_assets=1
Faster boot
ro.config.hw_quickpoweron=true
Increasing Video Recording Quality
ro.media.enc.hprof.vid.bps=8000000
Change Screen Rotate To 270 degree
windowsmgr.support_rotation_270=true;
change Heap Size
dalvik.vm.heapsize=64m
Render UI With GPU
debug.sf.hw=1
Make device much Smoother
windowsmgr.max_events_per_sec=150
Video Acceleration Enabled And HW debugging.
video.accelerate.hw=1
debug.sf.hw=1
debug.performance.tuning=1
debug.egl.profiler=1 ( Measure rendering time in adb shell dumpsys gfxinfo)
debug.egl.hw=1
debug.composition.type=gpu (Disable hardware overlays)
Increase Performance
debug.performance.tuning=1
Disable Sending Usage Data
ro.config.nocheckin=1
Deeper Sleep/Better battery life
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
Ringing Will Start Immediately
ro.telephony.call_ring.delay=0
ring.delay=0
Enable/Disable Error Checking
ro.kernel.android.checkjni=0
change Media Streaming Quality
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-rtsp=true
media.stagefright.enable-record=false
15) Enable/Disable Boot Animation
debug.sf.nobootanimation=1
Force To Remain Launcher In Memory
ro.HOME_APP_ADJ=1
Enable/Disable Waking by Volume Buttons
ro.config.hwfeature_wakeupkey=0
Off The Proximity Quickly After Call
mot.proximity.delay=25
ro.lge.proximity.delay=25
Better Signal Tweaks
ro.ril.hsxpa=2
ro.ril.gprsclass=10
ro.ril.hep=1
ro.ril.enable.dtm=1
ro.ril.hsdpa.category=10
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=14449
ro.ril.hsupa.category=5
persist.cust.tel.eons=1
ro.config.hw_fast_dormancy=1
NetSpeed Tweaks
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
Google DNS Tweak
net.rmnet0.dns1=8.8.8.8
net.rmnet0.dns2=8.8.4.4
net.dns1=8.8.8.8
net.dns2=8.8.4.4
Photo And Video Quality
ro.media.enc.jpeg.quality=100
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
ro.media.capture.maxres=8m
ro.media.panorama.defres=3264x1840
ro.media.panorama.frameres=1280x720
ro.camcorder.videoModes=true
ro.media.enc.hprof.vid.fps=65
change Touch Responsiveness
debug.performance.tuning=1
video.accelerate.hw=1
Scrolling Responsiveness
windowsmgr.max_events_per_sec=500
Power Save Tweaks
pm.sleep_mode=1
ro.ril.power_collapse=1
wifi.supplicant_scan_interval=180
ro.mot.eri.losalert.delay=1000 (could brake tethering)
Enable/Disables Debug Icon On Status Bar
persist.adb.notify=0
Faster Scrolling
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
windowsmgr.max_events_per_sec=150
ro.min_pointer_dur=8
wifi to scan less frequently
wifi.supplicant_scan_interval=180
improve battery under no signal
ro.mot.eri.losalert.delay=1000
makes apps load faster and frees ram
dalvik.vm.dexopt-flags=m=v,o=y
Off The Proximity Quickly After Call
ro.lge.proximity.delay=25
mot.proximity.delay=25
Enable/Disables built in error reporting
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
3G Network tweaks.
ro.ril.hep=0
ro.ril.hsxpa=2
ro.ril.gprsclass=12
ro.ril.enable.dtm=1
ro.ril.hsdpa.category=8
ro.ril.enable.a53=1
ro.ril.enable.3g.prefix=1
ro.ril.htcmaskw1.bitmask=4294967295
ro.ril.htcmaskw1=14449
ro.ril.hsupa.category=6
Enable/Disables logcat
logcat.live=disable
Screen recognizes only two fingers.
ro.product.multi_touch_enabled=true
ro.product.max_num_touch=2
Support for ipv4 and ipv6.
persist.telephony.support.ipv6=1
persist.telephony.support.ipv4=1
Enable/Disables blackscreen issue after a call.
ro.lge.proximity.delay=25
mot.proximity.delay=25
Better call voice quality.
ro.ril.enable.amr.wideband=1
Smooth UI
persist.service.lgospd.enable=0
persist.service.pcsync.enable=0
Wireless Tweaks
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.route.flush=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fack=1
net.ipv4.tcp_mem=187000 187000 187000
net.ipv4.tcp_moderate_rcvbuf=1
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_rfc1337=1
net.ipv4.tcp_rmem=4096 39000 187000
net.ipv4.tcp_sack=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_wmem=4096 39000 18700
wifi.supplicant_scan_interval=180
Change android device name and version
ro.build.display.id=Your ROM name
ro.build.version.release=4.4.2 (Android version)
Defalt.prop
Default.prop file is also specified android ROM properties and it is located in init folder both
boot.img as well as recovery.img file. This also consists of all necessary information for your
ROM specific build.
ro.secure=0 it means adbd running as root by default. ro.debuggable=1 and service.adb.root=1
will allow you to run adbd as root via the ADB root command.
Once you are able to run ADB as root via ADB root, you will be able to remount the /system/
directory as writable and can install anything which you want.
USB Enable/Disable
This line indicated that device is USB enable by default or not. 0 indicate the device by default
USB debugging and 1 not.
ro.debuggable=0
Storage
persist.sys.usb.config=mass_storage
Adb enable/disable
persist.service.adb.enable=1( 1 enable, o desable ).
Chapter 24 android app libraries and system permissions
System apps
A System application is NOT an application which is signed by the OSs platform signatures.
/system is read-only without root so it prevents uninstalling applications from /system/app and
/system/priv-app. Applications that are critical are put there so that they can't be uninstalled.
/system/priv-app also allows apps installed there to use signatureOrSystem and other privileged
permissions.
As for why apps might be critical, that depends on the ROM. HTC's Sense is heavily dependent
on their built-in apps from what I hear, for example. They simply didn't design their UI such that
it would work natively with third party apps.Updates for some system apps can be downloaded
via the Play Store, such as Google Maps.
All System applications are stored in system/app directory. We from this folder we can add any
application as system application and also remove.
Some application may be in system/private app or system/vendor/app directory.
when we open this app folder we get as
System Libraries
Android.mk
This page describes the syntax of the Android.mk build file, which glues your C and C++ source
files to the Android NDK.
The Android.mk file resides in a subdirectory of your project's jni/ directory, and describes your
sources and shared libraries to the build system
The syntax of the Android.mk allows you to group your sources into modules. A module is either
a static library, a shared library, or a standalone executable.
All system libraries are stored in system/lib directory in form of. so files are.
System Permission
All system permission files are located in system/etc/permission directory. Here we can mention
all system permission like wifi, camera etc.
Break pattern and password lock
}
Chapter 25 Create and change boot animation programmatically in
android
In given below example here will create bootanimation.zip file programmatically. In this example
are first will create many jpeg files from a video file then will create part0 folder and desc.txt file
again we will convert these part0 folders and desc.txt file in a bootanimation.zip file.
package com.create.bootaminmationcreater;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.CRC32;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.jcodec.api.FrameGrab.MediaInfo;
import org.jcodec.api.JCodecException;
import org.jcodec.api.android.FrameGrab;
import org.jcodec.common.FileChannelWrapper;
import org.jcodec.common.NIOUtils;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.create.bootaminmationcreater.FileChooserDialog.OnFileSelectedListener;
try {
filesListInDir = new ArrayList<String>();
zipDirectory(dir, zipDirName);
} catch (Exception e1) {
}
populateFilesList(dir);
}
}
For change boot animation we will create ADB command programmatically. We can change
boot animation two types because the bootanimation.zip file may exist in two location first one in
/system/media/bootanimation.zip or in second /data/local/bootanimation.zip.
First method
for change in first location /system/we will have to needed rooted device.
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime()
.exec(new String[] {"su","-c","cat "+ f + " > /system/media/bootanimation.zip" });
Toast.makeText(getApplicationContext(),"You Suceesfully Change
Bootanimation",Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), "Wait till boot.....",Toast.LENGTH_LONG).show();
new Handler().postDelayed(new Runnable() {
public void run() {
Runtime.getRuntime().exec(
new String[] { "su", "-c", "reboot" });
}
}, 20000);
}
second method
}
Chapter 26 android OS programmatically
We can also reboot any android device with programmatically so here we will reboot android
device via ADB command by android programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
Toast.makeText(getBaseContext(), "Reguler Reboot", Toast.LENGTH_LONG) .show();
} catch (IOException e) {
e.printStackTrace();
}
We can also do the reboot to recovery any android device with programmatically so here we will
reboot to recovery android device via ADB command by android programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot recovery" });
Toast.makeText(getBaseContext(), "Reboot to Recovery", Toast.LENGTH_LONG) .show();
} catch (IOException e) {
e.printStackTrace();
}
We can also do reboot to bootloader any android device with programmatically so here we will
reboot to bootloader android device via adb command by android programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot bootloader" });
Toast.makeText(getBaseContext(), "Reboot to bootloader ", Toast.LENGTH_LONG) .show();
} catch (IOException e) {
e.printStackTrace();
}
Here we are creating adb command for set default data storage as system programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "pm set-install-location 0" });
} catch (IOException e) {
}
Here we are creating adb command for set default data storage as internal memory
programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "pm set-install-location 1" });
} catch (IOException e) {
}
Here we are creating adb command for set default data storage as internal memory
programmatically.
try {
Runtime.getRuntime().exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2
/dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "pm set-install-location 2" });
} catch (IOException e) {
If our android device is rooted then We can customize our android ROM with android
programming. In this chapter will study about rooting, boot animation maker, boot animation
checker and other some programming. Here we are implementing ADB commands in android
programming.
Root Checker
We already know that how we can check root status but ADB commands But here we will check
root status by android programming. Here we have two conditions that device is rooted
externally or internally.
First method
For check externally we will have to check that su file executes or not.
private boolean canExecuteSuCommand()
{
try
{
Runtime.getRuntime().exec("su");
i = 1;
return i;
}
catch (IOException localIOException)
{
while (true)
int i = 0;
}
}
Or either su file exist or not in xbin folder.
private boolean hassufile()
{
return new File("/system/sbin/su").exists();
}
Second method
The second method we are checking for superuser.apk file exist in app folder or not.
For check root status we will have findtest_kesys string exist in buid.prop file which exist in
/system/ directory.
private boolean isTestKeyBuild()
{
String str = Build.TAGS;
if ((str != null) && (str.contains("test-keys")));
for (int i = 1; ; i = 0)
return i;
All system application are located in /system/app/ directory in android rom so if want create our
application as system application we will have to insert this application into app directory.
try {
Runtime.getRuntime()
.exec(new String[] { "su", "-c","mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system/" });
Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/" });
Runtime.getRuntime().exec(new String[] {"su","-c","cat "+ f + " > /system/app/"+name });
Toast.makeText(getApplicationContext(),"You Suceesfully set"+" "+name+" "+"system
app",Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(),"You need to root access",
Toast.LENGTH_LONG).show();
}