Introduction to Operating Systems: Unit V: Virtual Machines and Mobile OS

Android File Management

Virtual Machines and Mobile OS - Introduction to Operating Systems

Android uses a file system that's similar to disk-based file systems on other platforms. A file object is suited to reading or writing large amounts of data in start-to-finish order without skipping around.

Android File Management

• Android uses a file system that's similar to disk-based file systems on other platforms. A file object is suited to reading or writing large amounts of data in start-to-finish order without skipping around.

• All Android devices have two file storage areas: "Internal" and "external" storage.

• Android device may use an updated Linux file system, such as ext4 or a proprietary file system by a manufacturer, depending on who made the device and what has been done to it by the user.

File system is the collection place on disk device for files. Visualize the file system as consisting of a single node at the highest level (ROOT) and all other nodes descending from the root node in a tree-like fashion.

• Samsung Galaxy S phones use the Samsung RFS proprietary file system while the Samsung Nexus S with Android 2.3 uses the Linux Ext4 file system.

< /mnt>: This directory is used for mount points. The different physical storage devices (like the hard disk drives, floppies, CD-ROM's) must be attached to some au directory in the file system tree before they can be accessed. This attaching is no called mounting and the directory where the device is attached is called the mount bne point.

SDCard: The mounted SDCard is a storage device mounted to the file system in the typical Linux fashion. On the file system root the /sdcard is a symbolic link to /mnt/sdcard. /mnt/sdcard is where the SD card is actually mounted, but the same files can also be accessed in /sdcard.

• Fig. 7.8.1 shows typical directory structure of android file system.

• The superblock is the key to maintaining the file system. It is an 8 kB block of disk space that maintains the current status of the file system. Because of its importance, a copy is maintained in memory and at each cylinder group within the file system.

• The copy in main memory is updated as events transpire. The update daemon is the actual process that calls on the kernel to flush the cached superblocks, modified inode and cached data blocks to disk.

• Usually Linux system assumes all file systems are read and writable.

1. ODEX FILE

In Android file system, applications come in packages with the extension .apk. These application packages or APKs contain certain .odex files whose supposed function is to save space.

• These 'odex' files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application.

• On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.

2. DEODEX

• Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. All pieces of an application package are put fo together back in one place.

Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMS or APKs are always deodexed to ensure integrity.

7.8.1 SQLite

• SQlite is an open source embedded database. The resulting design goals of SQLite were to allow the program to be operated without a database installation or administration.

• It most widely deployed SQL database engine in the world. SQLite is based on the Structured Query Language (SQL). Android contains the SQLite database management classes that an application would use to manage its own private database.

• SQLite is open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features.

• It is designed to provide a streamlined SQL-based database management system suitable for embedded systems and other limited memory systems. The full SQLite mid library can be implemented in under 400 KB.

• In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application. The library is linked in and thus becomes an integral part of the application program.

Unique Features

1. No configuration is required.

2. No server process to administer or user accounts to manage.

3. Easy to backup and transmit database.

4. Dynamic typing for column values, variable lengths for column records.

5. Query can reference multiple database files.

6. A few non-standard SQL extensions.

• SQLiteDatabase allows methods to open the database connection, perform queries and query updates and close the database. You can define keys and values for queries via the ContentValues object. This is necessary for Insert and Update calls. Delete only requires the Row Number.

android.database.sqlite classes are as follows:

1. SQLiteCloseable - An object created from a SQLiteDatabase that can be closed.

2. SQLiteCursor - A cursor implementation that exposes results from a query on a SQLiteDatabase.

3. SQLiteDatabase - Exposes methods to manage a SQLite database.

4. SQLiteOpenHelper - A helper class to manage database creation and version management.

5. SQLiteProgram- A base class for compiled SQLite programs.

6. SQLiteQuery - A SQLite program that represents a query that reads the as resulting rows into a CursorWindow.

7. SQLiteQueryBuilder- A convenience class that helps build SQL queries to be sent to SQLiteDatabase objects.

8. SQLiteStatement - A pre-compiled statement against a SQLiteDatabase that can be reused.

Introduction to Operating Systems: Unit V: Virtual Machines and Mobile OS : Tag: : Virtual Machines and Mobile OS - Introduction to Operating Systems - Android File Management