OS virtualization and emulation on Android
Just like in computers, Android (operating system) devices have the ability to run virtual machines or emulate other operating systems. It does this either via platform virtualization or emulation via compatibility layer.
Platform virtualization
Platform based virtualization allows more leverage to the developer as anything that relates to the guest operating system only afects the guest operating system, and not the host operating system. Due to this it is possible for the guest operating system to be rooted, where as the host operating system remains unrooted.
Emulation
Emulation of other Operating Systems
Terminal Emulation of Internal Operating System
Terminal emulation of the Android device itself is done via either an actual local loopback to the device, or an emulation that seems to be a local loopback. Most of these terminal emulation of the device itself utilize the native terminal Toybox library and functions that come with every android device. However due to the fact that the majority of the functions that are readily available without utilizing a compatibility layer, means that Toybox functions can only be utilized. In order for a user to add any other functions or libraries would require the user to root their own device and add the functions or libraries manually.
Limitations
The majority of limitations are seen in emulation based apps rather than the platform virtualization based apps, as the emulation apps must utilize a compatibility layer. Thus for libraries and packages to work as expected like in a real OS, the compatibility layer must work properly and must be able to provide the acurate information. However, this requires that the comapatibility layer to have access many system related and device related information, which can either be done via utilization of Toybox, or via programing language libararies that Android apps can be made form like, Java, C#, and ect. Although starting from Android 8, many new security restrictions have been placed on apps, and due to these restrictions some API libraries/classes are no longer available or have been replaced by a more restrictive API libraries/classes.
One of the known limitations that were implemented was that apps can only natively access only their own app sandbox root directory or subdirectories on an SD card. Apps wanting to access files or folders outside that on the SD card, are required to use Android's own system file selector. Due to this guest OSes running on, emulation, platform virtualization, or compatibility apps are no longer allowed to access files outside of their own sandbox.
OS Internal Security Enhancements
More modern versions of Android have been seen having more internal system security enhancments, such that some system folders and files are no longer accessible or even viewable for that directories existance. Versions of Android before 9, allowed terminal apps to view Androids root "/" directory (although not allowing modifications or execution).
SELinux
Android utilizes SELinux, and due to this a majority if not all, system configuration files are not editbable, as well as some are not even readable. Thus apps can only utilize Android API's to learn about the device or system's configuration or settings. However, not all information are avaible to apps, and due to this many OS complatibility layer or emulation apps are not able to run every package or application.
Some known applications or packages that are unable to run are the following :
- Udisks2
- Snort
- Open vSwitch
- mininet (requires open vSwitch to run)
See Also