In this talk, we will explore some important internal components of the Android operating system. Also, we will see how the Android framework and other cross-platform frameworks work under the hood.
stacktraces and errors • how Android framework works internally • how cross-platform frameworks work internally ❖ To know the limitations of extensibility of Android ❖ To know why of everything you write ❖ Just because you like getting bored
Linux kernel. ❖ Highly modified version of Linux kernel. ❖ Modified kernel for the requirements of smartphones. ❖ Android uses kernel components from SE Linux(Security Enhanced Linux).
System. ❖ Download source code from https://source.android.com/. ❖ Browse source code - https://github.com/aosp-mirror ❖ Total more than 90 repositories. ❖ ~30 GB in size. ~50 GB after build. ❖ Takes ~2 hours to build first time. Avg ~30-40 min. ❖ Report bugs/request features at http://issuetracker.google.com/
developed for Android (similar to libc for ANSI C). • Small size. • Speed: Bionic was designed for CPUs at relatively low clock frequencies. • BSD Licence [patent free]
Machine (VM) for running Java bytecode. • ART stands for Android Runtime which is an extended VM that replaces Dalvik VM for 5.0 and above devices. • Unlike Dalvik, ART introduces the use of ahead-of-time (AOT) compilation by compiling entire applications into machine instructions upon their installation. • Dalvik only used Just In Time(JIT) compilation. • ART brings faster execution of applications, improved memory allocation and garbage collection (GC) mechanisms
to device fragmentation on Android. • Automated tests to be passed by device manufacturer. • Checks unified behaviour of most framework components. • Customized operating systems must have to pass CTS tests before they put devices built with that in the market.
Android OS. • A minimal Linux system that is started before the Dalvik VM and any java based services are enabled. • includes the source code for the init process.
computer program that is the core of a computer's operating system, with complete control over everything in the system. • Talks to the hardware layer and operating system. • Handles CPU, RAM, I/O and Device Drivers. • Linux kernel modified for Android • Two major modifications: ▪ WakeLocks ▪ Out of memory killer (OOM Killer)
of a computer program that is being executed. Depending on the operating system, a process may be made up of multiple threads of execution that execute instructions concurrently. • Service : A service is a program which responds to requests from other programs over some inter-process communication mechanism. • Daemon : A daemon is a background, non-interactive program. It runs as a background process, rather than being under the direct control of an interactive user.
programmatic way in which a program requests something from the kernel of the operating system. - fork() is a syscall whereby a process creates a copy of itself. - Fork is the primary (and historically, only) method of process creation on Unix-like operating systems.
a new organism is produced” . • a “Warmed-up” process, which means it’s a process that’s been initialized and has all the core libraries linked in. • Preloads all Android framework classes and resources for the application. • When you start an application, the Zygote is forked.
the Java system services. • Serves the entry point for framework, that’s why system server. • Includes are all the managers such as the Location Manager, Bluetooth Manager, Connectivity Manager, Activity Manager, Package Manager etc. • Once registered, clients in the application layer may request access to services in the System Server via the Service Manager. public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnectedOrConnecting(); }
(UID) to each Android application and runs it as that user in a separate process. • This sets up a kernel-level Application Sandbox. • Each user (Application) have some user privileges about what that can do with the rest of the system. • If application A tries to do something malicious like read application B's data or dial the phone without permission, then the operating system protects against this because application A does not have the appropriate user privileges.
to ART instructions using Just In Time (JIT) compiler. - JIT works better for dynamically typed languages (such as javascript or python) than Ahead of time compilation (AOT). - All javascript frameworks rely on JIT. They can’t take advantages of AOT. - Xamarin uses both as C# can be AOT/JIT compiled. - Flutter uses Dart AOT compiler which is bundled as runtime with the app.
developers but instead designed for the operating system. “Should you use MVC? Or MVP? Or MVVM? I have no idea. Heck, I only know about MVC from school and had to do a Google search to find other options to put here. This may be surprising, because Android could feel like it has strong opinions on how apps should be written. With its Java language APIs and fairly high-level concepts, it can look like a typical application framework that is there to say how applications should be doing their work. But for the most part, it is not. It is probably better to call the core Android APIs a "system framework." For the most part, the platform APIs we provide are there to define how an application interacts with the operating system; but for anything going on purely within the app, these APIs are often just not relevant.” - Dianne Hackborn, Android Framework Engineer at Google. [https://plus.google.com/+DianneHackborn/posts/FXCCYxepsDU ]
for security exploits, at the same time makes it robust over the time as bugs get fixed. - In closed-source systems, components can’t be seen and so bugs can’t be found by the community. At the end, software remains fragile. - Device fragmentation is still an issue. - After all, openness is hard.