Home » Android » Android vs Linux for embedded touchscreen application

Android vs Linux for embedded touchscreen application

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m look at a embedded project that needs a LCD multitouch screen, LCD driver, a webkit browser, Avahi, a web server, and our engine written in C++.

Android on first glance looks like it has most of the right components out of the box with the least modification… But the use of a JVM seems to be heavyweight for a small memory footprint embedded device (128-196MB min) and besides our code is C++. It looks like you can’t yank the JVM out because major OS components are running in Java (true?).

Linux appears to have most of the pieces that can be put together, without the unnecessary cruft. Here are the major questions:

  • Once the GUI pieces are put together, is linux still a significantly smaller memory footprint than Android assuming the the JVM and application components in Android aren’t useful to the project (right now our GUI-less linux build is around 24MB)?
  • Can Android be run without the JVM components to reduce memory footprint if you don’t need any user applications running in Java?
  • Can you write first class C++ applications in Android?
  • Does linux have a mature multitouch interface with system-wide touch keyboard, touch GUI, touchable broswer gestures (scroll, zoom, etc). Or does it require a lot of custom UI coding?
How to&Answers:

There are a number of misconceptions in your post. I’m going to start by enumerating your questions and answers:

  • Once the GUI pieces are put together, is linux still a significantly smaller memory footprint than Android assuming the the JVM and application components in Android aren’t useful to the project (right now our GUI-less linux build is around 24MB)?

That all depends on what window manager you choose to use. My instinct here is anything with close to mature touch support at this point is going to be as heavy or heavier than android.

  • Can Android be run without the JVM components to reduce memory footprint if you don’t need any user applications running in Java?

Android does not use JVM. Android uses the java language, but uses the dalvik virtual machine which is designed for embedded devices. The commonality ends at the fact that they’re virtual machines.

  • Can you write first class C++ applications in Android?

You can write large portions of your app in C or C++ using the NDK, however, any module written that way needs to be called through an android written using the java/dalvik SDK. That way, any performance critical module such as doing extensive calculations can be native, but the gui layer would not be (although usually with a GUI layer performance is less likely to be a concern). The native android windowing and UI libraries are written in Java, you would have to redo much of the work to get usable UI elements in the NDK as Google didn’t intend the NDK for that.

My advice here is to prototype the app using the normal SDK, leave stubs for anything that would benefit from hardware acceleration (Keep it modular so it’s not too interdependent)

  • Does linux have a mature multitouch interface with system-wide touch keyboard, touch GUI, touchable broswer gestures (scroll, zoom, etc). Or does it require a lot of custom UI coding?

Depends on the window manager you use. No matter what you choose you’ll likely need to fool around until you find viable combinations of everything. There is no one great integrated distro solution that I know of (although others may). My impression of the lay of the land is that there’s not a lot done on this front.

The final thing I want to add is well written java code executing in Dalvik (or even JVM) can run close to the speed of native code. If you know what you’re doing and understand when something is a reference, what collection types to use for what purpose (hint: Not everything is an array), and aren’t replicating objects all over the place, Java is pretty good.

Answer:

I’m not talking from experience, but take a look at http://www.omgubuntu.co.uk/2012/02/kde-spark-tablet-opens-pre-order-registration/ or even easier at https://www.google.com/search?q=ubuntu+touch+interface

So yes, Linux has support for touch. Not sure about multi-touch though, as far as i know its there(but i have 0 experience).

As for scrolling and zooming, i guess it will all depend on what you use in the back. The real question should be if webkit supports smooth-scrolling and zooming(if you plan to run your application in a browser as i understand).