JS Ext

Monday, August 12, 2013

Android Compatibility Layer For Linux

Why isn't there an Android compatibility layer for Linux?  I'm thinking of something similar to Wine (Wine Is Not an Emulator).

The reason I want this is because I want a Laptop/Tablet combo.  I want something that runs a full OS.  It should run the full version of Ubuntu.  I should be able to close the lid or rotate the lid or do something to make it look like a tablet.  From there, Ubuntu should let go of the screen, and I should have a full Android install.  What would it take to get that to work?  I'm not talking about running Android in a VM, either.  I'm more talking about Ubuntu for Android, but in reverse.

Android runs on a Linux-based kernel, but it has been modified.  Most of the modifications have been merged back into the trunk, however.  What else is missing?  Control of the video card is an issue.  Only one "think" can control the GPU at a time.  In the Linux world, that "thing" is X Windows.  Every other program talks to X to talk to the video card.  I'm not as familiar with the under the hood parts of Android.  My understanding is that Android doesn't use X; there is some other layer that controls the video card.  For what I want, I think its ok that only one "OS" gets control of the video card at a time.  If X can "release" the hardware so that Android can "grab" the hardware, that would work.  This could be triggered by the keyboard or via a physical action like closing the lid.

Power consumption is an issue.  The Android kernel modifications that haven't been merged are specific to reducing the power consumption of the OS.  In sleep mode, Android will last a lot longer on battery than a regular Linux kernel.  For this effort, I feel like that bridge can be crossed, though.

Networking can get a bit weird.  In theory, you would want to have control over your Wireless network from Android and Linux.  This goes back to the only one "thing" can control a device at a time discussion.  If you won't allow network config from Android, then you can just use a virtual ethernet device using the tap module.  Alternatively, you could write a custom app that communicates with Linux to control the network config.  This is awkward, but would be functional.  This is one area that I don't know how to easily solve.  Optimally, you could create a virtual wireless card that runs in Linux userland.  Any "operations" like listing networks or connecting to networks would just translate to userland calls to the real hardware.  This would probably be a large effort, though.  The virtual networking would allow Linux to create firewall rules for Android, which would be a huge win for security.  Other devices might have this sharing problem.  The keyboard and mouse could probably be handled easily, but cameras probably would take effort.  Audio would probably need to be handled the same way video is handled, unless Android can use the same subsystem (ALSA) as Linux.

Some things are easily solved or are not even issues.  Contrary to popular believe, you can run Android on x86.  Any games that make use of the ARM NDK won't work, but Google discourages the use of the NDK specifically for this reason.  Things like the 'SD' card could easily be virtualized using the loopback module.

Ideally, I would want this Android compatibility layer, or Linux/Android Hybrid on a device like the ASUS Taichi 21.  When the laptop is open, its Ubuntu, but when the laptop is closed, its Android.  I don't think there needs to be any hardware changes to support this.  I feel like this is 100% software, and that software is 100% open source.  This seems like something that can actually be achieved.  The big question is, why hasn't anyone started doing this yet?

2 comments:

  1. Because the android SDK already does mostly this and takes care of pesky things like multi touch via emulation? Poke around the SDK, you might like the framework configuration stuff.

    ReplyDelete
  2. I don't want emulation. I want it to actually run. I want it to be usable.

    ReplyDelete

Note: Only a member of this blog may post a comment.