Libraries are wri4en in C/C++ and compiled for the par>cular hardware.

Similar documents
Android Overview. Most of the material in this sec5on comes from h6p://developer.android.com/guide/

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

States of Activities. Active Pause Stop Inactive

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

COLLEGE OF ENGINEERING, NASHIK-4

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

UNIT V: CENTRAL PROCESSING UNIT

Android Fundamentals - Part 1

UNDERSTANDING ACTIVITIES

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

Lifecycle-Aware Components Live Data ViewModel Room Library

application components

Lab 1: Getting Started With Android Programming

G1 Development Environment and Applica4on Development. Adam C. Champion CSE 788X11 Prof. Dong Xuan

LECTURE NOTES OF APPLICATION ACTIVITIES

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

Android Application Development

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

Android Internals and the Dalvik VM!

Introduction to Android development

Android. (XKE Mars 2009) Erwan Alliaume.

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

Overview of Activities

Android Ecosystem and. Revised v4presenter. What s New

Activities. Repo:

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

Virtualization. Introduction. Why we interested? 11/28/15. Virtualiza5on provide an abstract environment to run applica5ons.

Application Fundamentals

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Programming Concepts and Skills. Creating an Android Project

Embedded Systems Programming - PA8001

Real-Time Embedded Systems

Minds-on: Android. Session 2

Principles of Programming Languages

Activities and Fragments

Mobile Computing. Introduction to Android

Introduction to Android

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Mobila applikationer och trådlösa nät, HI1033, HT2012

Compiler: Control Flow Optimization

Introduction to Android

CS260 Intro to Java & Android 04.Android Intro

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

Mul$media Techniques in Android. Some of the informa$on in this sec$on is adapted from WiseAndroid.com

Ways to implement a language

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

Lecture 2 Android SDK

Vienos veiklos būsena. Theory

SHWETANK KUMAR GUPTA Only For Education Purpose

Chapter 3: Instruc0on Level Parallelism and Its Exploita0on

Object Oriented Design (OOD): The Concept

Reconstructing DALVIK. Applications. Marc Schönefeld CANSECWEST 2009, MAR18

Con$nuous Integra$on Development Environment. Kovács Gábor

Android Programmierung leichtgemacht. Lars Vogel

CS 61C: Great Ideas in Computer Architecture Compilers and Floa-ng Point. Today s. Lecture

CSCU9YH Development with Android

IJRDTM Kailash ISBN No Vol.17 Issue

SD Module- Android Programming

Mobila applikationer och trådlösa nät, HI1033, HT2013

Design Principles & Prac4ces

Permissions. Lecture 18

Introduction To Android

2012 David Black- Schaffer 1

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

Compiling Techniques

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

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Research opportuni/es with me

AppSpear: Bytecode Decryp0ng and DEX Reassembling for Packed Android Malware

Understanding Application

Compiler Optimization Intermediate Representation

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

Confinement (Running Untrusted Programs)

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

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

Android Development Tutorial. Yi Huang

Dynamic Languages. CSE 501 Spring 15. With materials adopted from John Mitchell

Android Activities. Akhilesh Tyagi

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

BCA 6. Question Bank

Mobile Application Development - Android

Lecture 08. Android Permissions Demystified. Adrienne Porter Felt, Erika Chin, Steve Hanna, Dawn Song, David Wagner. Operating Systems Practical

Soft GPGPUs for Embedded FPGAS: An Architectural Evaluation

CSE Opera,ng System Principles

Android development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2.

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

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.

What is a VM? Categories of Virtual Machines. Process Virtual Machine 11/17/2010

Wirtschaftsinformatik Skiseminar ao. Prof. Dr. Rony G. Flatscher. Seminar paper presentation Dennis Robert Stöhr

Instruc(on Set Architecture. Computer Architecture Instruc(on Set Architecture Y86. Y86-64 Processor State. Assembly Programmer s View

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android

Lifecycle Callbacks and Intents

Search Engines. Informa1on Retrieval in Prac1ce. Annotations by Michael L. Nelson

Encapsula)on, cont d. Polymorphism, Inheritance part 1. COMP 401, Spring 2015 Lecture 7 1/29/2015

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ]

Programming Mobile Applications with Android Lab2

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved.

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer

Transcription:

marakana.com 1

marakana.com 2

marakana.com 3

marakana.com 4

Libraries are wri4en in C/C++ and compiled for the par>cular hardware. marakana.com 5

The Dalvik virtual machine is a major piece of Google's Android plaiorm for mobile devices. It runs Java plaiorm applica>ons which have been converted into a compact Dalvik Executable (.dex) format suitable for systems that are constrained in terms of memory and processor speed. It was wri4en by Dan Bornstein, who named it aser the fishing village of Dalvík in EyjaVörður, Iceland, where some of his ancestors lived. Unlike most virtual machines and true Java VMs which are stack machines, the Dalvik VM is a register based architecture. Like the CISC vs. RISC debate, the rela>ve merits of these two approaches is a subject of con>nuous argument but the underlying technology some>mes blurs the ideological boundaries. Moreover, the rela>ve advantages of the two approaches depend on the interpreta>on/compila>on strategy chosen. Generally, however, stack based machines must use instruc>ons to load data on the stack and manipulate that data and thus require more instruc>ons than register machines to implement the same high level code. However, the instruc>ons in a register machine must encode the source and des>na>on registers and therefore tend to be larger. This difference is primarily of importance to VM interpreters for whom opcode dispatch tends to be expensive and other factors are relevant for JIT compila>on. A tool called dx is used to convert Java.class files into the.dex format. Mul>ple classes are included in a single.dex file. Duplicate strings and other constants used in mul>ple class files are included only once in the.dex output to conserve space. Java bytecode is also converted into an alternate instruc>on set used by the Dalvik VM. An uncompressed.dex file is typically a few percent smaller in size than a compressed.jar (Java Archive) derived from the same.class files. The Dalvik executables may be modified again when they get installed onto a mobile device. In order to gain further op>miza>ons, byte order may be swapped in certain data, simple data structures and func>ons libraries may be linked inline, and empty class objects may be short circuited, for example. Being op>mized for low memory requirements, Dalvik has some specific characteris>cs that differen>ate it from other standard VMs[3]: * The VM was slimmed down to use less space. * Dalvik has no Just in >me compiler * The constant pool has been modified to use only 32 bit indexes to simplify the interpreter. * It uses its own bytecode, not Java bytecode. marakana.com 6

marakana.com 7

marakana.com 8

marakana.com 9

marakana.com 10

marakana.com 11

marakana.com 12

marakana.com 13

marakana.com 14

marakana.com 15

marakana.com 16

marakana.com 17

An ac>vity has essen>ally three states: * It is ac>ve or running when it is in the foreground of the screen (at the top of the ac>vity stack for the current task). This is the ac>vity that is the focus for the user's ac>ons. * It is paused if it has lost focus but is s>ll visible to the user. That is, another ac>vity lies on top of it and that ac>vity either is transparent or doesn't cover the full screen, so some of the paused ac>vity can show through. A paused ac>vity is completely alive (it maintains all state and member informa>on and remains a4ached to the window manager), but can be killed by the system in extreme low memory situa>ons. * It is stopped if it is completely obscured by another ac>vity. It s>ll retains all state and member informa>on. However, it is no longer visible to the user so its window is hidden and it will osen be killed by the system when memory is needed elsewhere. marakana.com 18

oncreate() Called when the ac>vity is first created. onrestart() Called aser the ac>vity has been stopped, just prior to it being started again. onstart() Called just before the ac>vity becomes visible to the user. onresume() Called just before the ac>vity starts interac>ng with the user. onpause() Called when the system is about to start resuming another ac>vity. onstop() Called when the ac>vity is no longer visible to the user. ondestroy() Called before the ac>vity is destroyed. marakana.com 19

Resources are an integral part of an Android applica>on. In general, these are external elements that you want to include and reference within your applica>on, like images, audio, video, text strings, layouts, themes, etc. Every Android applica>on contains a directory for resources (res/) and a directory for assets (assets/). Assets are used less osen, because their applica>ons are far fewer. You only need to save data as an asset when you need to read the raw bites. The directories for resources and assets both reside at the top of your project directory, alongside your source code directory (src/). The difference between "resources" and "assets" isn't much on the surface, but in general, you'll use resources to store your external content much more osen than you'll use assets. The real difference is that anything placed in the resources directory will be easily accessible from your applica>on from the R class, which is compiled by Android. Whereas, anything placed in the assets directory will maintain its raw file format and, in order to read it, you must use the AssetManager to read the file as a stream of bytes. So keeping files and data in resources (res/) makes them easily accessible. Example class: package com.android.samples; public final class R { public sta>c final class string { public sta>c final int gree>ng=0x0204000e; public sta>c final int start_bu4on_text=0x02040001; public sta>c final int submit_bu4on_text=0x02040008; public sta>c final int main_screen_>tle=0x0204000a; }; public sta>c final class layout { public sta>c final int start_screen=0x02070000; public sta>c final int new_user_pane=0x02070001; public sta>c final int select_user_list=0x02070002; }; public sta>c final class drawable { public sta>c final int company_logo=0x02020005; public sta>c final int smiling_cat=0x02020006; public sta>c final int yellow_fade_background=0x02020007; public sta>c final int stretch_bu4on_1=0x02020008; }; }; marakana.com 20

marakana.com 21

marakana.com 22

Android is a mul> process system, in which each applica>on (and parts of the system) runs in its own process. Most security between applica>ons and the system is enforced at the process level through standard Linux facili>es, such as user and group IDs that are assigned to applica>ons. Addi>onal finer grained security features are provided through a "permission" mechanism that enforces restric>ons on the specific opera>ons that a par>cular process can perform, and per URI permissions for gran>ng ad hoc access to specific pieces of data. Example of seung permissions in AndroidManifest.xml: <manifest xmlns:android="h4p://schemas.android.com/apk/res/android" package="com.android.app.myapp" > <uses permission android:name="android.permission.receive_sms" /> </manifest> marakana.com 23

marakana.com 24