π Lecture 20 β Core Application Services
π Overview: This lecture explores the core application services that form the backbone of the Android operating system. It details how hardware and software services are structured and provides a comprehensive walkthrough of the system startup process, from bootloader to the home screen. Understanding this architecture is crucial for developing efficient Android applications.
ποΈ Topics Covered
Core Application Services including Activity Manager, Package Manager, Window Manager, Resource Manager, Content Providers, View System, and Hardware Services. A detailed Runtime Walkthrough explains the system startup sequence from Bootloader through Kernel, Init, Zygote, System Server, Activity Manager, to Launcher. The lecture also covers the Zygote process, package and service management, and application runtime processes.
π Lecture Summary
Core Application Services
Android provides a rich set of core application services that applications can utilize. The Activity Manager manages the lifecycle of activities and tasks. The Package Manager handles the installation, uninstallation, and permissions of applications. The Window Manager is responsible for organizing the screen's window space, managing input focus, and handling window transitions. The Resource Manager provides access to non-code resources like strings, colors, and layouts embedded in the application. Content Providers enable data sharing between different applications by managing access to a structured set of data. The View System is the fundamental building block for user interfaces, handling event handling, drawing, and layout.
Hardware Services
Android provides Hardware Services to give applications access to lower-level hardware APIs. These services are typically accessed through a local Manager object rather than directly through the hardware driver. Key hardware services include Telephony Service (for phone calls and network information), Location Service (for GPS and network-based positioning), Bluetooth Service (for Bluetooth communication), WiFi Service (for wireless network management), USB Service (for USB peripheral management), and Sensor Service (for accessing device sensors like accelerometers and gyroscopes).
π‘ Why this matters: These hardware services abstract complex driver-level interactions, making it easier for developers to integrate device capabilities without needing deep hardware knowledge.
Runtime Walkthrough β System Startup
Android follows a specific boot sequence. First, the Bootloader loads and starts the Kernel (the Linux kernel). The Kernel then starts the Init process, which is the first user-space process. Init reads the init.rc script to start essential system services. A key service started is Zygote, a special process that preloads and initializes all the core Java classes and resources needed by Android applications. Zygote then starts the System Server, which runs the core Android services. The System Server starts the Activity Manager, which in turn launches the Launcher (the home screen application).
Runtime Walkthrough β Zygote
Zygote is a critical Android process. It starts early in the boot process and its main purpose is to preload all Java classes and resources. When a new application needs to run, instead of starting a completely new Dalvik/ART virtual machine from scratch, the system forks a copy of Zygote. This fork technique significantly speeds up application startup time because the new process inherits all the preloaded classes and resources. The diagram in the lecture illustrates Zygote as a central hub that spawns new application processes.
Package, Service and Process
Applications are packaged as APK (Android Package) files. An APK contains all the application's code (DEX files), resources, manifest, and certificates. When an application runs, it is assigned a Linux Process with a unique user ID (UID) for security isolation. A Service is an application component that can perform long-running operations in the background without a user interface. Services run in the main thread of the process that hosts them, unless explicitly specified to run in a separate process.
Runtime Walkthrough β Runtime Process
The runtime process diagram shows the application lifecycle from installation to execution. An installed application (as an APK) is launched through the Launcher. The Activity Manager creates a new process for the application by forking from Zygote. The new process then initializes the application's main thread and starts the requested Activity. The system manages multiple processes in memory, and may kill processes when additional resources are needed, following a priority-based order (foreground apps first, then visible apps, service apps, and finally cached apps).
β Key Takeaways
This lecture is critical for understanding Android's low-level architecture. The most important takeaway is the system startup sequence: Bootloader β Kernel β Init β Zygote β System Server β Activity Manager β Launcher, as this explains how the Android OS initializes. The Zygote process is uniquely important because its fork-based application launching mechanism is what makes Android apps start quickly. Understanding hardware services through Manager objects explains how applications safely access phone features. Finally, knowing the relationship between APK packages, processes (with UID isolation), and services is fundamental to Android application development and debugging.
π§ Quick Revision Questions
- What is the first user-space process started by the Linux kernel during Android boot?
- Explain the primary purpose of the Zygote process and why it uses the fork() system call.
- How does the Activity Manager participate in the application launch sequence?
- Name three hardware services and describe how they are typically accessed by applications.
- What is the difference between a Service component and a Process in Android?
π Lecture 21 β Layer Interaction
π Overview: This lecture explores how layers in mobile and pervasive computing architectures interact with each other, focusing on the overall system structure and communication patterns between different layers. Understanding layer interaction is crucial for designing efficient mobile systems that can handle real-time data processing and adaptive behavior.
ποΈ Topics Covered
The lecture covers the overall architecture of mobile and pervasive computing systems, examining how different layers (including physical, network, middleware, and application layers) communicate and coordinate. It emphasizes the importance of layer abstraction, service discovery, and context-awareness in enabling seamless mobile computing experiences.
π Lecture Summary
Overall Architecture
The overall architecture of mobile and pervasive computing systems is designed around a layered approach that separates concerns and enables modular development. Each layer provides specific services to the layer above and uses services from the layer below, creating a hierarchical structure for system organization.
π Definition β Layer Interaction: The process by which adjacent layers in a computing system communicate through well-defined interfaces, with each layer providing services to the higher layer while hiding implementation details from lower layers.
π Formula: No specific formula provided in this lecture.
π Example: When a mobile application requests location data, the application layer communicates with the middleware layer, which in turn interacts with the network layer to obtain GPS coordinates from the physical layer sensors.
The architecture typically includes:
- Physical layer: Hardware components like sensors, processors, and communication modules
- Network layer: Wireless communication protocols (e.g., WiFi, Bluetooth, 4G/5G)
- Middleware layer: Service discovery, context management, and adaptation mechanisms
- Application layer: User-facing apps that utilize lower-layer services
π‘ Why this matters: Proper layer interaction ensures that mobile applications can adapt to changing network conditions, battery levels, and user context without requiring application-level modifications.
The lecture emphasizes that service discovery is a critical function of the middleware layer, enabling applications to find and use available network services dynamically. This allows mobile devices to seamlessly connect to printers, displays, or cloud resources as users move between environments.
Additionally, context-awareness is built into the architecture through continuous monitoring of environmental factors (location, time, user activity) across layers. The middleware processes this raw data and provides meaningful context to applications.
β Key Takeaways
- Layer interaction in mobile pervasive computing follows a hierarchical model where each layer provides abstraction and services to adjacent layers, enabling modular system design and maintenance.
- Service discovery is a core middleware function that allows mobile devices to dynamically find and use network resources without manual configuration.
- Context-awareness requires cross-layer coordination, with lower layers collecting sensory data and higher layers interpreting it for adaptive application behavior.
- The overall architecture separates hardware concerns from software logic, making systems more flexible and easier to update.
- Understanding layer boundaries and interface definitions is essential for building robust mobile applications that can handle varying network conditions and user mobility.
π§ Quick Revision Questions
- What are the main layers in the mobile pervasive computing architecture described in this lecture?
- How does the middleware layer facilitate communication between applications and network services?
- Why is service discovery important for mobile computing systems?
- What role does context-awareness play in layer interaction?
- How does the hierarchical layering approach benefit mobile system design?
π Lecture 22 β Android
π Overview: This lecture provides an introduction to the Android mobile operating system and its software stack, followed by an overview of Windows Phone 7 as a competing mobile platform. It covers the history, architecture, and ecosystem of these two mobile OSes, highlighting their key differences and market strategies.
ποΈ Topics Covered
The lecture begins with an introduction to Android, describing it as an open source software stack acquired by Google and developed by the Open Handset Alliance, based on a modified Linux kernel. It then details the Android Software Stack composed of Java applications running on an application framework atop core libraries and the Dalvik virtual machine. The lecture transitions to Windows Phone 7, covering its development history as the successor to Windows Mobile, its launch timeline, its distinctive Metro design language, and its strategic partnership with Nokia.
π Lecture Summary
Android
Android is an open source software stack for mobile devices that includes an operating system, middleware and applications. Google, Inc. purchased the original developer of the software Android Inc. in 2005. Google and other members of the Open Handset Alliance collaborated on Androidβs development and release. The Android Open Source Project (AOSP) is tasked with the maintenance and further development of Android. Androidβs mobile operating system is based upon a modified version of the Linux kernel.
π Definition β Android Software Stack: The layered architecture of Android consisting of Java applications running on a Java-based, object-oriented application framework on top of Java core libraries running on a Dalvik virtual machine featuring a JIT (Just-In-Time) compilation.
π Formula: Android Stack (top to bottom) = Java Applications β Application Framework β Java Core Libraries β Dalvik Virtual Machine β Linux Kernel
π‘ Why this matters: The Dalvik VM with JIT compilation allows Android apps to be optimized for mobile devices with limited resources, improving performance over a standard Java VM.
Android Software Stack
The software stack is illustrated in the lecture with a diagram (not shown here) depicting the layered architecture. At the top are Java applications, followed by the Java-based, object-oriented application framework. Below that are the Java core libraries, which run on top of the Dalvik virtual machine featuring JIT compilation. At the very bottom is the Linux kernel.
Windows Phone 7
Windows Phone 7 is a mobile operating system developed by Microsoft and is the successor to its Windows Mobile platform. Unlike its predecessor, it is primarily aimed at the consumer market rather than the enterprise market. It was launched in Europe, Singapore, Australia and New Zealand on October 21, 2010, and in the US and Canada on November 8, 2010, Mexico on November 24, 2010, with Asia to follow in 2011. With Windows Phone 7, Microsoft offers a new user interface with its design language named Metro, integrates the operating system with 3rd party and other Microsoft services, and controls the hardware it runs on. Work on a major Windows Mobile update may have begun as early as 2004 under the codename "Photon", but work moved slowly and the project was ultimately cancelled. In 2008, Microsoft reorganized the Windows Mobile group and started work on a new mobile operating system. The product was to be released in 2009 as Windows Phone, but several delays prompted Microsoft to develop Windows Mobile 6.5 as an interim release. Windows Phone 7 was developed quickly. One result was that Windows Mobile applications do not run on it. On October 11, 2010, Microsoft's CEO announced 10 devices operating Windows Phone 7, made by HTC, Dell, Samsung and LG. Microsoft reported on December 21, 2010 that in the first 6 weeks phone manufacturers sold 1.5 million Windows Phone 7 devices to mobile operators and retailers. On 11 February 2011, at a press event in London, Microsoft CEO and Nokia CEO announced a partnership between their companies in which Windows Phone would become the primary smartphone operating system for Nokia. The event was largely focused on creating βa new global mobile ecosystemβ, suggesting competition with Android and iOS, by saying "It is now a three horse race." Integration of Microsoft services with Nokiaβs own services were announced specifically that Bing would power search across Nokia devices, and an integration of Nokia Maps with Bing Maps as well as Nokiaβs application store being integrated with the Windows Phone Marketplace.
π Definition β Metro design language: Microsoft's new user interface design language for Windows Phone 7, characterized by clean typography, flat icons, and a focus on content over chrome.
π Example: Windows Phone 7 launched with 10 devices from HTC, Dell, Samsung, and LG, with 1.5 million units sold in the first 6 weeks to operators and retailers, illustrating its initial market penetration against Android and iOS.
β Key Takeaways
This lecture introduces Android as an open-source, Linux-based software stack developed by the Open Handset Alliance, featuring Java applications on an application framework with a Dalvik VM using JIT compilation. In contrast, Windows Phone 7 is Microsoft's consumer-focused mobile OS with the Metro design language, developed quickly as a replacement for Windows Mobile but incompatible with its predecessor's apps. The key differences include Android's open-source model versus Windows Phone 7's controlled hardware ecosystem, and Android's Linux kernel versus Windows Phone 7's Microsoft stack. The partnership between Microsoft and Nokia in 2011 positioned Windows Phone as a third competitor alongside Android and iOS, aiming to create a new mobile ecosystem. Students must remember the core components of the Android software stack and the historical timeline and strategic moves of Windows Phone 7.
π§ Quick Revision Questions
- Who purchased Android Inc. in 2005, and what organization now maintains Android?
- What are the five layers of the Android Software Stack, from top to bottom?
- What is the Dalvik virtual machine, and what feature does it include to improve performance?
- What is the name of Microsoft's new user interface design language for Windows Phone 7?
- Why do Windows Mobile applications not run on Windows Phone 7, and what major partnership was announced in February 2011?