• SQLite This is the database engine used by android in storage of all data Webkit
  • Process Management Android provides several means on different layers to compose, execute and manage applications. Processes
  • Android Operating System




    Download 344.97 Kb.
    bet3/3
    Sana22.12.2019
    Hajmi344.97 Kb.
    1   2   3

    Kernel


    The kernel is the core of the operating system. Androids kernel is built off of the Linux 2.6 kernel with some architectural modifications which are implemented by google outside the usual linux kernel development cycle. Linux kernel is a monolithic kernel, meaning that most of the operating system is found in the kernel space, such as device drivers, kernel extensions. This result in very large source code.

    The Linux Kernel is what interacts with the hardware and contains all device drivers used by higher levels of the software stack to control and communicate with the hardware. Such drivers are the Display Driver, Camera Driver, Flash Memory Driver, Audio Driver e.t.c

    The kernel is modified for special needs in mobile devices such as power management, memory management and the runtime management.

      1. Shell


    The shell is the user space of the operating system. It acts as the intermediary between the user and the operating system. The Android shell is divided into the following parts
        1. Libraries


    This is the layer that enables the device to handle different types of data. These libraries are written in C or C++ language and are specific to a particular hardware. Androids standard C library is optimized for devices with low power consumption and little memory.

    The libraries used by Linux ,GNU libs (glibc), are too big and complicated for mobile devices and so Android implements its own version of libc – Bionic libc. The benefits of using Bionic are its smaller footprint and optimization for low frequency CPUs, used by mobile devices.

    Some native libraries implemented in Bionic are:

          1. Surface Manager


    This handles screen access for the window manager from the framework layer. It composites screens using off screen buffering meaning that apps can’t directly draw into the screen, but instead the drawings go into the off screen buffer. In the off screen buffer, drawings are combined to form the final output to screen which the user will see, including the status bar at the top and navigation buttons at the bottom of the screen. The off screen buffer is also responsible for the transparency of windows
          1. Media Framework


    This includes audio and video codecs which are heavily optimized for mobile devices. They allow for recording and playback of various formats of audio and video such as mp3, mp4, avi, wav e.t.c
          1. SQLite


    This is the database engine used by android in storage of all data
          1. Webkit


    The browser engine used in rendering HTML webpages
          1. OpenGL


    Used to render 3D images on screen
        1. Android Runtime


    The Android Runtime consists of the Dalvik Virtual Machine (DVM) or Android RunTime (ART) and core Java libraries.

    The Dalvik Virtual Machine is an interpreter for bytecode that has been transformed by Java code to Dalvik bytecode. It is an optimized Java Virtual Machine optimized for low processing power and low memory requirements. The DVM runs .dex files ­(Dalvik executable files) instead of .class files which the JVM runs. Dalvik is compiled into native code whereas the core libraries are written in Java thus interpreted by Dalvik.

    Android Runtime (ART) is a newer virtual machine introduced by Google in their newer releases of Android. ART works similarly to Dalvik with many advantages such as AOT (Ahead Of Time) complitation and improved garbage collection which boosts performance significantly.

    The Core Java Libraries provide most of the functionalities defined in the Java SE libraries


        1. Application Framework


    These are frameworks written in Java that provide abstractions of the underlying native libraries and Dalvik capabilities. The frameworks are blocks which the applications directly interact with. They provide the basic functions of phones like resource management, voice call management e.t.c. They are the basic tools used to build applications. Some important blocks in the application framework layer are:

    • Activity Manager: Manages activity life of applications

    • Content Providers: Manages data sharing between applications

    • Telephone Manager: Manages all voice calls

    • Location Manager: Uses GPS or cell towers for location management

    • Resource Manager: Managers many types of resources used in applications
        1. Applications


    This is the top most layer of the operating system containing all the apps that users interact with. Android applications run in their own Dalvik Virtual Machine and consist of many components such as activities, services, broadcast receivers and content providers. Components interact with each other in the same or different application via intents.

    Various apps come pre-installed with android devices such as SMS client app, dialer, web browser, file explorer etc. There is a large community of developers who have come up with various types of applications such as games, document readers, social networks and various others


    1. Process Management


    Android provides several means on different layers to compose, execute and manage applications.
      1. Processes


    A process is an instance of a program that is being executed. In Android, there are five different stages a process goes through in its lifecycle. The various types have different importance levels which are strictly ordered. The importance hierarchy is (descending from highest importance)

    1. Foreground Process: This is the app currently in use by the user. Other processes can be considered foreground processes if theyre interacting with the process that’s currently in the foreground. There are a few foreground processes at any given time



    1. Visible Process: This is a process that isn’t in the foreground but is still affecting what is seen on the screen. For example, a foreground process maybe a diaplog but the visible process is the app in the background of the screen which triggered the dialog.



    1. Service Process: This is a process that isn’t tied to any app on screen but is still doing something in the background such as playing music or downloading files



    1. Background Process: These are processes that are currently not visible to the user and therefore do not have any impact on the user experience. These are apps that are paused and are kept in memory for quick access in the future. They do not use valuable CPU time and other resources apart from memory



    1. Empty Process: This does not contain any app data anymore. They are kept around for caching purposes to speed launch later but maybe killed by the system if necessary.

    Usually only background and empty processes are killed by the system and so the user experience stays unaffected. Android only kills apps when the memory usage goes too high but usually Android does not kill apps

    Processes can contain multiple threads such as in Linux based systems. Most Android applications implement thread to separate the UI from inout handling and I/O operations or long running calculations.


      1. Applications and Tasks


    Android applications are made up of processes and their included threads. Tasks are a series of activities of possibly multiple applications. A task is basically a history of a user’s actions. E.g. When a user reads their mail and opens a link which uses the browser application. In this case, the task is made up of two applications (mail and browser) and many activities. The importance of the task concept is that it allows users to navigate backwards like popping elements of a stack.
      1. Application Internals


    The structure of an Android applications is based on four different components which are Activity, Service, Broadcast Receiver and Content Provider. An application doesn’t necessarily have all these components but it should at least have an Activity in order to present a graphical user interface.

    Services and broadcast receivers allow applications to perform jobs in the background. Services usually run for a long time but broadcast receivers can be triggered by events and run for a short time.


      1. Application Life Cycle


    Figure 2: Activity Life Cycle

    An activity is a single screen of an application. It contains visual elements that allow user interaction. An application caontains many activities. The state of an android applications processes is determined by the state of the application’s components, such as its activities. As the application components alter their states the underlying type of the process is changed. All activities are subclasses from android.app.Activity and their life cycle is controlled by the On…() functions.

    As an application starts, the following functions are called sequentially OnCreate(), OnStart() and OnResume(). OnCreate() is called only one in the lifetime of a process but OnStart() and OnResume() are called more often. If an activity loses focus then the OnPause() function is called. If the activity is no longer visible then the OnStop() function is called. Before deleting the activity OnDestroy() function is called which end the activity lifetime



    The following describes the functions in detail:

    • OnCreate(): The initial functions that initialized the activity.





    • OnResume(): The process is is set to foreground. The application gets focus and can get user input.



    • OnPause(): When the device goes to sleep or the application loses focus the process is set to visible. From here, the process may be resumed or stopped



    • OnStop(): The activity is not visible and the process type is set to background and the application can be killed at any time



    • OnDestroy(): This method is called right before the system kills the process and the application deletes the activity


    Bibliography





    Download 344.97 Kb.
    1   2   3




    Download 344.97 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Android Operating System

    Download 344.97 Kb.