Infrastructure Middleware (Part 3): Android Runtime Core & Native Libraries

Similar documents
Benefits of Concurrency in Java & Android: Program Structure

Overview of Java Threads (Part 2)

An Introduction to Android. Jason Chen Developer Advocate Google I/O 2008

Overview of Layered Architectures

Another difference is that the kernel includes only the suspend to memory mechanism, and not the suspend to hard disk, which is used on PCs.

Android Ecosystem and. Revised v4presenter. What s New

Infrastructure Middleware (Part 1): Hardware Abstraction Layer (HAL)

Introduction. Lecture 1. Operating Systems Practical. 5 October 2016

Mobile and Ubiquitous Computing: Android Programming (part 1)

Android Overview. Most of the material in this section comes from

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

Android App Development. Ahmad Tayeb

Overview of Java Threads (Part 3)

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Android App Development

The Java Executor (Part 1)

Overview of Frameworks: Part 3

Android Internals and the Dalvik VM!

Lecture 1 - Introduction to Android

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore

Android is a software stack for mobile devices and comprises middleware, operating system and core

Java 8 Parallel ImageStreamGang Example (Part 3)

Android Programming in Bluetooth Cochlea Group

Java Barrier Synchronizers: CountDownLatch (Part 1)

Android Software Development Kit (Part I)

Android Development Tutorial. Yi Huang

Software Development & Education Center ANDROID. Application Development

Introduction to Android Android Smartphone Programming. Outline University of Freiburg. What is Android? Background University of Freiburg.

ios vs Android By: Group 2

Lecture 4 Native libraries

Java Semaphore (Part 1)

SHWETANK KUMAR GUPTA Only For Education Purpose

Mobile Computing. Introduction to Android

Android App Development

ANDROID SYLLABUS. Advanced Android

Android OS and Power Architecture

Introduction to Android

Java Barrier Synchronizers: CyclicBarrier (Part 1)

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

Android. Operating System and Architecture. Android. Screens. Main features

Java ReentrantLock (Part 1)

Android on Tizen. Moscow State University

Introduction to Android Application Development. Mike Kvintus Principal Engineer JDSU

Android Overview. Francesco Mercaldo, PhD

The Java ExecutorService (Part 1)

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Porting mobile web application engine to the Android platform

Chapter 1 Hello, Android

ANDROID NATIVE APP: INTRODUCTION TO ANDROID. Roberto Beraldi

Android Fundamentals - Part 1

CS 450 Operating System Week 4 Lecture Notes

Efficient Android Threading

SD Module- Android Programming

ATC Android Application Development

Chapter 2. Operating-System Structures

Java 8 Parallel Stream Internals (Part 2)

Mobile and Wireless Systems Programming

Exploring Chrome Internals. Darin Fisher May 28, 2009

Android Services & Local IPC: The Command Processor Pattern (Part 1)

NDK OVERVIEW OF THE ANDROID NATIVE DEVELOPMENT KIT

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

Last Class: CPU Scheduling. Pre-emptive versus non-preemptive schedulers Goals for Scheduling: CS377: Operating Systems.

Introduction to Android

Abstract. 1. Introduction

Android Application Development Course Code: AND-401 Version 7 Duration: 05 days

Android Internals. Lecture 1. Android and Low-level Optimizations Summer School. 13 July 2015

Required Core Java for Android application development

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

Qt for Device Creation

Four Components of a Computer System

Overview of Advanced Java 8 CompletableFuture Features (Part 3)

CS420: Operating Systems

Chapter 2: System Structures

Overview of Java 8 Parallel Streams (Part 1)

Interoperation of tasks

Making use of Android

POSIX Abstractions in Modern Operating Systems: The Old, the New, and the Missing

Android framework. How to use it and extend it

April 4-7, 2016 Silicon Valley

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

UNIT:2 Introduction to Android

Overview of Advanced Java 8 CompletableFuture Features (Part 2)

Android PC Splash Brothers Design Specifications

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors.

Overview of Java s Support for Polymorphism

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

Android. (XKE Mars 2009) Erwan Alliaume.

Android - open source mobile platform

DROID. By S.Gokulakrishnan AP/CSE SCSVMV

Bringing it all together: The challenge in delivering a complete graphics system architecture. Chris Porthouse

Mobile Computing. Juha-Matti Liukkonen, Nov 17, 2010

Kick Start your Embedded Development with Qt

CS260 Intro to Java & Android 04.Android Intro

Processes and Threads. Processes: Review

Understanding Storage I/O Behaviors of Mobile Applications. Louisiana State University Department of Computer Science and Engineering

Introduction to bada 2.0

Java Monitor Objects: Synchronization (Part 1)

Android. Lesson 1. Introduction. Android Developer Fundamentals. Android Developer Fundamentals. to Android 1

External vs. Internal Iteration in Java 8

Transcription:

Infrastructure Middleware (Part 3): Android Runtime Core & Native Libraries Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA

Learning Objectives in this Part of the Lesson Recognize key core Java libraries that are part of the Android platform 2

Learning Objectives in this Part of the Lesson Recognize key core Java libraries that are part of the Android platform Recognize key core Android libraries that are part of the Android platform 3

Learning Objectives in this Part of the Lesson Recognize key core Java libraries that are part of the Android platform Recognize key core Android libraries that are part of the Android platform Recognize key native libraries that are part of the Android platform C++/C 4

Learning Objectives in this Part of the Lesson Recognize key core Java libraries that are part of the Android platform Recognize key core Android libraries that are part of the Android platform Recognize key native libraries that are part of the Android platform ART Dalvik Virtual Machine Apps use core Java/Android libraries extensively; 5 native libraries not as much

Overview of the Android Runtime: Core Java Libraries 6

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages C/Java/ JNI ART Dalvik Virtual Machine java lang util io Integer String Thread ArrayList HashMap Vector File FileInputStream FileOutputStream See en.wikipedia.org/wiki/comparison_of_java_and_android_api 7

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread C/Java/ JNI ART Dalvik Virtual Machine See developer.android.com/reference/java/lang/thread.html 8

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C A Java thread is a unit of computation that runs in the context of a process See developer.android.com/reference/java/lang/thread.html 9

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C Java threads running in a process can communicate with each other via shared objects or message passing See en.wikipedia.org/wiki/thread_(computing) 10

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C Each Java thread leverages unique state from the underlying Linux kernel thread, e.g., a stack, a program counter, & other registers See en.wikipedia.org/wiki/thread_(computing)#processes. 2C_kernel_threads.2C_user_threads.2C_and_fibers 11

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C Java dynamic & static objects can be shared across Java threads (i.e., this state is common) See en.wikipedia.org/wiki/thread_(computing)#processes. 2C_kernel_threads.2C_user_threads.2C_and_fibers 12

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread Java synchronizers C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C e.g., reentrant locks, stamped locks, semaphores, condition objects, phasers, etc. See developer.android.com/reference/java/util/concurrent/package-summary.html 13

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread Java synchronizers Java synchronizers are used to prevent race conditions C/Java/ JNI ART Dalvik Virtual Machine Process A Process B Process C See en.wikipedia.org/wiki/race_condition 14

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread Java synchronizers Java networking C/Java/ JNI Java network programming mechanisms can exchange data between Android devices & remote servers ART Dalvik Virtual Machine Network See developer.android.com/reference/java/net/httpurlconnection.html 15

Android Runtime: Core Java Libraries Android contains many (but not all) core Java libraries in the java.* & javax.* packages, e.g. Java Thread Java synchronizers Java networking Java I/O & files C/Java/ JNI ART Dalvik Virtual Machine Java file mechanisms can store data persistently on Android devices See docs.oracle.com/javase/8/docs/api/java/nio/file/files.html 16

Overview of the Android Runtime: Core Android Libraries 17

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages C/Java/ JNI ART Dalvik Virtual Machine See www.makelinux.net/android/classes 18

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency C/Java/ JNI ART Dalvik Virtual Machine See www.vogella.com/tutorials/androidbackgroundprocessing/article.html 19

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency Handlers, Messages, & Runnables (HaMeR) Operations run in one or more threads & publish their results to the UI thread Looper Message C/Java/ JNI Message Queue Message Message Message Message Message UI Thread (main thread) ART Dalvik Virtual Machine Message Handler Handler Runnable Background Thread A Background Thread B See developer.android.com/training/multiple-threads/communicate-ui.html 20

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency Handlers, Messages, & Runnables (HaMeR) AsyncTask Looper C/Java/ JNI Message Queue Message Message Message Message ART Dalvik Virtual Machine Similar to HaMeR framework, but without using threads, handlers, messages, or runnables directly Message Message UI Thread (main thread) Async Task See developer.android.com/reference/android/os/asynctask.html 21

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency App components C/Java/ JNI ART Dalvik Virtual Machine 22

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency App components Building blocks of mobile apps that provide hooks that Android uses to control an app s lifecycle C/Java/ JNI Activity ART Dalvik Virtual Machine Service Broadcast Receiver Content Provider See developer.android.com/guide/components/fundamentals.html#components 23

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency App components Binder IPC framework C/Java/ JNI ART Dalvik Virtual Machine 24

Android Runtime: Core Android Libraries Android contains thousands of classes in the android.* packages, e.g. Concurrency App components Binder IPC framework Enables sync & async communication between components on a device C/Java/ JNI ART Dalvik Virtual Machine See elinux.org/android_binder 25

Android Runtime: Core Android Libraries The source code for all the core Java & Android libraries is available online See source.android.com 26

Overview of Android Native C/C++ Libraries 27

Android Native C/C++ Libraries C++/C Although Android apps are written using Java APIs, implementations of these APIs are often written in C/C++ Performance Productivity Goal is to enhance system performance 28w/out sacrificing developer productivity

Android Native C/C++ Libraries C++/C Although Android apps are written using Java APIs, implementations of these APIs are often written in C/C++ Java & C/C++ are combined via the Java Native Interface (JNI) See developer.android.com/training/articles/perf-jni.html 29

Android Native C/C++ Libraries C++/C Although Android apps are written using Java APIs, implementations of these APIs are often written in C/C++ Java & C/C++ are combined via the Java Native Interface (JNI) JNI defines a standard way for managed Java code to interact with native code written in C/C++ 30

Android Native C/C++ Libraries C++/C Android s Native Development Kit (NDK) allows the implementation of apps & services using native C/C++ code See developer.android.com/ndk 31

Android Native C/C++ Libraries C++/C Android s Native Development Kit (NDK) allows the implementation of apps & services using native C/C++ code Using the NDK on portions of code can help enhance performance by minimizing latency, maximizing throughput, & conserving key system resources Resist the urge to develop all 32of your apps using the NDK!

Android Native C/C++ Libraries C++/C Android s Native Development Kit (NDK) allows the implementation of apps & services using native C/C++ code Using the NDK on portions of code can help enhance performance by minimizing latency, maximizing throughput, & conserving key system resources It can also be used to integrate existing C/C++ libraries into Android apps 33

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Android native libraries are open source 34 & often have Java wrapper facades

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Enables developers to write native 35 system services for Android

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Composites 2D & 3D graphic 36 layers from multiple apps

Android Native C/C++ Libraries C++/C System C library bionic libc Surface Manager display management Media Framework audio/video streaming FreeType library for rendering fonts Webkit web browser engine OpenGL ES, SGL graphics engines SQLite relational database engine SSL secure sockets layer Supports audio-video streaming 37 in the background

Android Native C/C++ Libraries C++/C System C library bionic libc Surface Manager display management Media Framework audio/video streaming FreeType library for rendering fonts Webkit web browser engine OpenGL ES, SGL graphics engines SQLite relational database engine SSL secure sockets layer Renders bitmap 38& vector fonts

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Framework used on mobile & non-mobile 39 platforms for web browsing

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Supports 2D & 3D vector graphics, 40e.g., often used for gaming apps

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Relational database engine that performs 41 CRUD operations on persistent data

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Ensures confidentiality & integrity for 42web interactions (e.g., e-commerce)

Android Native C/C++ Libraries C++/C System C library Webkit bionic libc web browser engine Surface Manager OpenGL ES, SGL display management graphics engines Media Framework SQLite audio/video streaming relational database engine FreeType SSL library for rendering fonts secure sockets layer Native C/C++ libraries use non-java concurrency 43 libraries, e.g., POSIX pthreads

End of Infrastructure Middleware (Part 3): the Android Runtime Core & Native Libraries 44