mekya

28Mar/120

Android initialization from init.rc to third party code

As known, android is based on Linux kernel however in this article, we wont deal with kernel. We will try to discover android initialization (particularly zygote)  step by step after the kernel is done.

  • init,  source can be found in /system/core/init/init.c, is started first after the kernel finished his job.(init’s pid is 1)
  • init process parces the init.rc file which has a specific format called the Android Init Language and sets up the system according to init.rc. There is a readme file that gives information about Android Init Language in the /system/core/init folder. Services are started and system properties are set according to init.rc file.  Also zygote, java and native services started.
  • This is the line about zygote in init.rc file

service zygote /system/bin/app_process -Xzygote /system/bin –zygote –start-system-server

  • “app_process” source code can be found in “frameworks/cmds/app_process/app_main.cpp”.  ”app_process” calls the static main function in ZygoteInit.java class(frameworks/core/java/com/android/internal/os/)

runtime.start(“com.android.internal.os.ZygoteInit”, startSystemServer);

  • ZygoteInit.java’s static main function starts the system server by calling “startSystemServer()” function if proper parameters given. Then “startSystemServer()” calls the static main function of SystemServer.java class(frameworks/base/services/java/com/android/server).
  • SystemServer.java’s static main function firstly call native “init1()” function. “init1()” is defined in “android_servers” library function and “init1()” is registered in “frameworks/base/services/jni/com_android_server_SystemServer.cpp” to call “system_init()”
  • “system_init()”  is defined in “/frameworks/base/cmds/system_server/library/system_init.cpp”. In “system_init()” function, native services(SurfaceFlinger, AudioFlinger, Camera, MediaPlayer),  Androidruntime is started and “init2()” function in SystemServer.java is called.
  • “init2()” function creates a thread that starts all critical services(PowerManager, ActivityManager, Battery, Vibrator,Connectivity, etc.). Lastly “ActivityManagerService”’s “systemReady()” function is called to run third party code.

Ahmet Oguz Mermerkaya - Olcay Ay

21Feb/120

Android Developer Days – Call for Submissions

VisitAndroidDevDayswebsite

 

Android Developer Days is an organization that people, interested in Android and mobile technologies, get together and share their knowledge and experiences. Android Developer Days will take place in METU Cultural and Convetion Center in Ankara, Turkey on May 21 / 22 . There will be parallel sessions in two halls and one workshop hall in the organization.

In Android Developer Days, there will be presentations, tutorials and workshops. If you want to share your knowledge and experience about the subjects below, we are inviting you to share them in Android Developer Days. Moreover we appreciate all different ideas and papers beyond subjects below. More information is available on web site

  • Mobile World
    • Future of Mobile World
    • Future Mobile Technologies
  • Android Open Source Project (AOSP)
    • Ice Cream Sandwich
    • Future Releases
    • Android in Different Architectures
    • Android in Different Areas(Industry, Defense, Home Electronics etc.)
  • Android App Development
    • Best Practices in Development
      • Efficient usage of System Resources
      • Development for different devices
      • User Interface Design
    • Android SDK
    • Tablet Apps
  • Cross Platform App Development Frameworks
  • Communication Solutions
  • Mobile Education
  • Mobile Payment
  • App Monetization
  • Security
  • NFC
  • Google TV
  • HTML5 (Mobile Web Applications)
  • Game Development

Android Developer Days - www.androiddeveloperdays.com

6Jan/120

Understanding Android Makefile (Android.mk)

Firstly, let me say that this document is an abstract information which is available in pdk documents. Secondly, you may want to look at the post that tells how to build Android source code.  And now, we can start, at a first glance to Android source codes, we see that applications, libraries, components in framework have Android.mk files in their specific directories. These Android.mk files defines how to build that source code. There are well defined specific rules for Android.mk files. Let me summarize them.

  • Name: We need to define a name for our build (LOCAL_MODULE := )
  • Local Variables: All builds may have some local variables so to start a new build it is good to clear all local variables (include $(CLEAR_VARS))
  • Files: We need to write all files we want it to be build (LOCAL_SRC_FILES := main.c)
  • Tags: Define tags for build. (LOCAL_MODULE_TAGS := eng development)
  • Libraries: If build needs to be linked to other libraries, we need to define them (LOCAL_SHARED_LIBRARIES := cutils)
  • Template file: We can define whether our build is executable,library or something else by including template file (include $(BUILD_EXECUTABLE))

BUILD_EXECUTABLE, CLEAR_VARS, etc. variables which are the absolute address of the template files are defined in build/core/config.mk.

Here is a simple Android.mk file that builds an apk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Build all java files in the java subdirectory
LOCAL_SRC_FILES := $(call all-subdir-java-files)
# Name of the APK to build
LOCAL_PACKAGE_NAME := LocalPackage
# Tell it to build an APK
include $(BUILD_PACKAGE)

Last line in Android.mk file builds the APK file. Different source code types must be built differently so we can also use $(BUILD_EXECUTABLE), $(HOST_JAVA_LIBRARY), $(HOST_PREBUILT) etc. variables according to our source code. (Definitions like my-dir, all-subdir-java-files are in build/core/definitions.mk)

we can add LOCAL_MODULE_TAGS variable to Android.mk file to determine that module to be installed in that source code built. Here are the some defined tags and their meanings

  • eng
    • Default variant
    • Installs modules tagged with: eng, debug, user, and/or development
    • Installs non-apk modules that have no tags specified.
    • Installs APKs according to the product definition files.
    • adb is enabled by default.
  • user
    • Final release
    • Installs modules tagged with user
    • Installs non-apk modules that have no tags specified
    • Install APKs according to the product definition files
    • adb is disabled by default.
  • userdebug, Same as user except:
    • Also installs modules tagged with debug
    • adb is enabled by default

These tags is same as build variants that can be specified in “choosecombo” function. “choosecombo” function is available after “source build/envsetup.sh” command.  We can specify build variant in building source code like below

make -j4 PRODUCT-generic-eng

eng” is the build variant “generic” is the product. The command above will build and install modules according to attributes of “eng” tag mentioned above.

Ahmet Oğuz Mermerkaya

21Dec/110

118 Andro is available

118 Andro makes you easily access yellow and white pages for landlines in Turkey. In other words, people's and companies' landline numbers can be queried by 118 Andro. 118 Andro can be downloaded from Android Market

20Dec/110

Android Seminar @Kadir Has Univ.

Android Seminar on December 8 at Kadir Has University http://www.facebook.com/events/190509481036147/
Filed under: Android No Comments
19Dec/110

Key Features of HTML5

Lately, we have heard some many exciting things about HTML5 so we, the traceper team, decided to learn what the key features are in HTML5 and how we can use them in traceper.

So we are writing this document to help our project team and ankara gtug community members learn somethings about HTML5. This document doesn’t include every aspect of HTML5, it just consist of parts of HTML5 we find important for us.

Equation of HTML5:

HTML5 ~= HTML + CSS + JS

Filed under: web Continue reading
19Dec/110

Merhaba Android Extended 2 Edition

The extended second edition of the book “Merhaba Android” (Hello Android) has been published on November 2011. The book aims to be a fundamental resource for people who are willing to learn how to develop Android applications .

One feature of this book is that there is a web site with the same name; www.merhabaandroid.net. Readers can ask questions via this website to the writers about the points that they don’t understand.

Merhaba Android 2; is available  on book stores like D&R, Remzi, Inkılap and also it is available on 
pusula.com
hepsiburada.com (worldwide shipping),
idefix.com and
kitapyurdu.com.

We need to remind you that the book is written in Turkish languge.

19Jul/110

How to build Android GingerBread on fresh Ubuntu 10.10

You can download all required packages to build Android and run it in emulator. Having these packages, bundled in an archive, is a life saver for those whose ubuntu is offline.

You can learn how to download Android source codes by following instructions on http://source.android.com/source/downloading.html and now, let me give some instructions for how to build Android and run emulator on ubuntu 10.10

Filed under: Android Continue reading
27Apr/110

“Merhaba Android” is published…

One of my friend (Murat Onder) and I have written a book with name “Merhaba Android” (Hello Android) that is a fundamental resource for people who are willing to learn how to develop Android applications from a Turkish book.
 
Some of the chapters in “Merhaba Android”  are What is Android and what is the future of Android, How to install Android development environment, Hello Android application, Activites, User Interface elements, Services, Application Resources and Samples projects(Camera, GPS)
 
One of the other feature of this book is there is a web site with the same name; www.merhabaandroid.net. Readers can ask question via this website to us about the points that they don’t understand.
 
Merhaba Android; is available  on book stores like D&R, Remzi, Inkılap and also it is available on  pusula.comhepsiburada.com(worldwide shipping), idefix.com and kitapyurdu.com.
Filed under: Android No Comments
12Feb/110

Android Seminars and Workshops

These are the seminars we have given...

Android Konya Turkiye, Turkey

Android Seminar Ankara Turkiye Turkey