ANDROID PROGRAMMING - INTRODUCTION Roberto Beraldi
Web resources (android) • Code • https://developer.android.com/guide/index.html • http://www.vogella.com/tutorials/android.html • http://www.techotopia.com/index.php/Android_4_App_Develop ment_Essentials • http://www.html.it/guide/guida-android/ • https://github.com/aporter/coursera-android • Book and articles • https://androidgroup.googlecode.com/files/Unlocking%20Andro id.pdf • http://anatomyofandroid.com/ • http://css.csail.mit.edu/6.858/2015/readings/android.pdf • Blog of developers • http://stackoverflow.com/
Smartphone hw architecture • A system-on-chip architecture with three primary components: • An application processor executing the end-user’s application software with assistance from a middleware and operating system (i.e., Android, IOs) • A modem or baseband processor with its own operating system components responding to the baseband radio activities • A number of peripheral devices for interacting with the end-user
Smartphone hw architecture source:
Role of application processor • Application processor executes the user applications and the related OS services. • Applications include audio/video codec and players, games, image processing, speech processing, internet browsing, text editing, etc. • Application processor takes help from graphics accelerators as and when needed Most handheld applications are graphics-intensive • Smartphones come with reasonably large amount of storage in the form of volatile SDRAM (1-2 GB) as well as non-volatile compact storage (10+ GB)
Role of modem processor • Reception: The receiver hardware (part of the modem) senses incoming signals and generates interrupts for the radio interface logic of the operating system • The radio interface and the operating system software run on a baseband or modem processor • Once the reception begins (after a physical layer handshake), the incoming audio, video, and other data are processed by the modem processor • The radio OS components talk to the peripheral device drivers to present the incoming data to the user through appropriate devices (display, speaker, etc.)
Role of modem processor • Transmission: The data to be transmitted are collected by the radio OS components from memory regions populated by the device drivers. • For example, audio data captured by the microphone driver or an image or a video captured by the camera or a position information captured by the GPS device • A transmission is initiated by the radio interface logic through the modem transmitter hardware • The subscriber identification module (SIM) plays an important role in reception and transmission • For example it sends the user’s authentication key
Specific hardware issue • Overall, mobile device’s hw architecture is similar to desktop one, with some specific difference. In particular • System on Chip (SoC) • All the hw components are integrated (GPU,Wi-fi,etc) • Multicore with cores that can run at different speed, cores activated on demand • Rich set of sensors • Implemented as IC • Mainly RISC architecture (ARM is predominant) • One instruction at each clock cycle
Example of CPU • Qualcom • Snapdragon + GPU (Adreno) • Different families with different cores (2,4) • Nvidia • 4i,K1 • Intel • First 64 bits CPU • Mediatek • 8 cores • Samsung • HiSilicon • P8
HW: Sensors • Most devices have built-in sensors that measure motion, orientation, and various environmental conditions. • The Android platform supports three broad categories of sensors: • Motion sensors. These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors. • Environmental sensors. These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers. • Position sensors. These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.
GPS • Based on triangolaritazion • 24+3 satellites • Circular orbits on 6 circular planes at about 20 Km from the ground • The receiver computes the distance from the satellites using synchronized clocks • Computing the distance requires to know the delay (about 0,007 s) and start time of the received signal • Satellite clocks are atomic clocks, while gps receiver clocks are not, but their values are adjusted when the intersection of the spheres is not unique
HW location • Other location providers are based on cell-ID and wi-fi • Android uses these methods together (GPS, cell tower, Wi-Fi) to get an idea of where the device is, and make that available to apps via a "Location Services" API.
Communications • LTE 4G • Up to 326,4 Mbit/s dowload • Up to 86,4 Mbit/s upload • Wi-fi (with an Access Point) • 802.11a (54 mbps),802.b (11), 802.11g (54),802.11n (300) • Wi-fi Direct (p2p) • Same standard as wi-fi • Bluetooth • Latest version 4.1(24Mbps) • Make device discoverable...search for the device...enter passcode • Set-up times about 6 s • IEEE 802.15.1 • NFC
Communication: NFC • Active device (reader): generate a magnetic field • The reader emits a small electric current which creates a magnetic field that in turn bridges the physical space between the devices. • Passive device: react to the field emitting data • Like RFID NFC works in the 13.56MHz radiofrequency spectrum using less than 15mA of power to communicate data over distances that are usually far less than 10 cm. • Tags typically store between 96 and 512 bytes of data and transfer data using at speeds of 106Kb/s, 212Kb/s or 424Kb/s
Communication: NFC • NFC Card emulation mode: • enables NFC-enabled devices such as smartphones to act like smart cards, allowing users to perform transactions such as payment or ticketing. • NFC Reader/writer mode: • enables NFC-enabled devices to read information stored on inexpensive NFC tags embedded in labels or smart posters. • A tag contains a small amount of non-volatile memory (store text, web address, email, vCard, Trigger, e..g. turn on wifi and lunch this app) • NFC peer-to-peer mode: • enables two NFC-enabled devices to communicate with each other to exchange information in an ad hoc fashion. • Applications may use higher-layer, e.g., SSL to establish a secure channel • For android see: • http://developer.android.com/guide/topics/connectivity/nfc/nfc.html
Typical usage • contactless payments, • marketing and advertising, • security and access control, • product identification, • location identification, • mobile phone task launcher apps • ….
Touch screen technologies • Resistive touch screen • Capacitive touch screen ( � used in modern smartphones) • Single touch / multi-touch (pointers)
Touch screen: gesture
Some fact about Android • Android, Inc. was founded in Palo Alto, California in October 2003 • In July 2005, Google acquired Android Inc. • At Google, the team led by Andy Rubin developed a mobile device platform powered by the Linux kernel • Android is built on top of more than 100 open projects, including Linux kernel • To increase security, each application runs with a distinct system identity (Linux UID and GID) • Application are isolated from each other • Use a quite efficient IPC mechanism • To facilitate resource access from isolated application, android exploit a permission-based security mechanism • Each application needs permissions to access system resources • Permissions are granted at application installation time • There are 130 resources (android 4.2)
Global market Source: http://www.windows8core.com/windows-phone-losses-03- global-market-share-january-2015-increase-android/
Android versioning See also: https://en.wikipedia.org/wiki/Android_version_history
Android screen sizes
Some android feature • As new features were added (e.g., toolbar , actionbar , fragments ,…) support libraries were developed, so that such features were also available to older versions • Android API are very dynamic, so it can happen that some method or widget are deprecated (always take a look at the official documentation) • Support of multiple languages • For example: • Symbolic name given to a string in the code • Different values according to the nationality of the smartphone
Android architecture
Android architecture (kernel) The kernel provides preemptive multitasking ,low level core system services, like Hardware Abstraction Hardware Drivers Security Settings Support for Shared Libraries Network Stack
Android architecture (kernel) • Android-specific components • Binder – IPC • Android shared memory • Power management • Alarm driver • Kernel debugger & Logger
Android architecture, interacting with OS • The ADB tool (see SDK) allows to interact with the linux OS via a shell USB driver ADB Client ADB Server Developer option’s debug USB enabled RSA key sent to the device must be acknowledged
Recommend
More recommend