Ubuntu may switch to Android technologies to keep the Linux desktop competitive

With the recent introduction of Ubuntu Touch a very interesting change of strategy is emerging for Canonical.

As Phoronix and others have discovered, Ubuntu Phone and Touch are using SurfaceFlinger as their compositor. SurfaceFlinger uses OpenGL ES to render applications screens/windows in a hardware accelerated way using the OpenGL driver of the GPU directly.

Now, Canonical is promising a completely integrated experience for Ubuntu 14.04 which will run Phone, Touch, TV and Desktop applications in one common GUI environment. How will they be able to fulfill their promise for Linux desktop applications currently running on Xorg?

So far, everyone has believed that the Ubuntu desktop is migrating from Xorg to Wayland. This migration has been going so slow that there is actually no visible sign of happening any time soon. It seems that Canonical has slightly changed the “to” part of their migration plans. They are not moving to Wayland, they are moving to SurfaceFlinger.

I, for one, think that this is a brilliant idea.

Compared to Android’s SurfaceFlinger, Wayland has not much appeal from the “possible benefits” point of view. SurfaceFlinger is developed by Google and is already deployed on countless Android devices. It has a sizable amount of developers working on it and its future is certain as long as Android is with us (which is pretty likely given its current market share and trends). Migration to Wayland hasn’t started in earnest so there would not be much effort thrown out of the window.

With the recent merging of the Android and the mainline Linux kernels, porting Linux desktops to Android hardware has already become somewhat easier. Wifi, Bluetooth and other hardware components can be accessed through the Android kernel released by the producer of the SOC/board. The biggest remaining problems are making Xorg and audio working. Xorg is used by all desktop applications while audio is used by only some (media players, screen-capture apps…etc). Xorg seems to be a fairly big problem because Android hw producers usually don’t provide X drivers at all and that makes the porting effort a show-stopper for hardware which otherwise run Android very well.

An Ubuntu desktop running on SurfaceFlinger would be a much easier subject for porting to common Android hardware compared to the current situation (as the quickly growing number of devices supporting Ubuntu Touch demonstrates this spectacularly). OpenGL ES driver comes with the Android kernel, released by the hw manufacturer, so SurfaceFlinger works right-away.

The most important part of the migration to Wayland has been the GTK and Qt backend implementations. These can also be created relatively quickly for SurfaceFlinger so 90% of the standard Linux apps would display on it right away (Qt may already has Android/SurfaceFlinger support based on their Git repository)

OK, but SurfaceFlinger is only one part of the problem, what about the rest?

It is very much possible that Canonical/Ubuntu is planning to migrate heavily to Android backend services (not only SurfaceFlinger) in order to take advantage of the huge popularity of Android among the hardware manufacturers.

Possibly, a wrapper may be created for the PulseAudio API to execute sound services with AudioFlinger. The opposite was deemed possible by one of the developers of PulseAudio, so it is certainly an option. This would make the typical audio-using Linux desktop application work on top of Android’s AudioFlinger on a stock Android kernel released by the SOC/board manufacturer.

Other Android services may also be targeted in a similar way. Hardware accelerated video playing would be a notable example but acceleration sensor, camera and GPS services would also become easy accessible for traditional Linux applications.

With such a services-migration completed, one could do a mostly complete Ubuntu port in a matter of days to Android hardware and the required skills would be way-fewer than they are now. As a result, Ubuntu would be available for almost every hardware which supports Android. Some of the ports would be done by Canonical (Nexus devices) and most of them by the community (with the Cyanogen community doing the heavy lifting in many cases).

I think this is a good strategy since it brings Linux desktop applications to commodity Android hardware. Personally, I don’t care what backend services allow my applications to run as long as they do it efficiently and without (many) bugs.

Closing the gap between Android technologies and the Linux desktop would allow the latter to stay competitive and make an integrated experience possible. Linux desktops would eventually become capable of running Android applications (Dalvik would be just another Java-like VM, next to OpenJDK and Snoracle Java) Also, Linux desktop applications may become able to run on Android as first-class citizens (by packaging the necessary wrapper libraries to SurfaceFlinger and others).

Why do I think this is a necessity?

It is widely rumored that the next major version of Android will introduce some kind of desktop environment for keyboard/mouse work. This would allow Android to start shipping on desktop PCs. Given the weight of Google, I imagine that PC vendors would immediately start selling x86/PC hardware with Android. They already do it with ChromeOS which is much more limited than Android, so a desktop-toting Android version would easily beat that in functionality (huge number of apps and an ecosystem rapidly growing up to the weight that of Windows).

In an environment like that, desktop Linux would rapidly loose its remaining competitive advantage and very soon the desktop would be dominated by Android alone (only in the Linux camp, not meaning Windows, although I think that it would eventually become a strong Windows-competitor). If desktop Linux is as easy to port to any hardware as Android and runs Android apps next to traditional Linux apps, the competitive advantage remains.

It is way too early to tell if the above is the plan of Canonical but using SurfaceFlinger points to this direction. I would definitely like to see Ubuntu and other desktop Linuxes on every possible Android devices.

UPDATE:

Soon after the article had been published, Canonical announced the development of their own compositor (Mir) and declared SurfaceFlinger as a component to be removed from the Ubuntu phablet stack. This mostly invalidates the assumption on their strategy. If Mir will be able to work with binary OpenGL ES drivers of GPU producers, that will probably make Ubuntu easier to port but definitely not as easy as an OS heavily based on Android technologies.

Last night, I finally went through the Hangout explaining the plan for Ubuntu to move to a rolling release, and Rick Spencer was pretty clear in there that we “can expect full convergence of all aspects.” Ubuntu Rolling Release will be implemented ASAP and Raring will never be released because “any work on the current desktop will be wasted and put the convergence behind schedule.” (These are paraphrased from memory.) Obviously that means that the Ubuntu Touch stack is becoming the Desktop stack and not the other way. Compiz is going away. While Ubuntu won’t be limiting developer choice, all SDK work will be aimed at QT / QML, so that is the expected app long-term.

Because handing ownership of core Linux infrastructure to Google, who develop it specifically to suit their own needs for Android and no one else (and arbitrarily withgold sources for a full iteration,) is a great thing.

Frankly, I think Android on desktops would be terrible. Its entire internal environment is (deliberately) incompatible with everything already on the Desktop for the sole purpose of being redistributable while keeping the sources closed.

Everything about the way hardware adaptations and drivers are handled for Android is bad. I would hate, with seething rage, to see that appear on the desktop.

Desktop Linux is already trivially ported to other platforms. The problem is hardware manufacturers more interested in getting people to buy their next device rather than extended support for existing ones, and the chaos sewn by Android with drivers only compatible with that platform.

Canonical seems to be working on making SurfaceFlinger compatible with desktop Linux apps. (Half of the article was about this, sorry it didn’t come through)
Moreover, it wasn’t deliberately made incompatible. Google thought that Xorg was very cumbersome and inefficient so they built a completely different compositor based directly on OpenGL ES.

whatzit

March 4, 2013 at 13:22

It can only possibly be compatible with software targeting Qt or Gtk, both of which would need to ported.

Incidentally, my N9 is exceptionally fast and responsive despite running Xorg. I don’t believe “cumbersome” was why SurfaceFlinger was created. Rather, it (like almost everything else in Android) exists because originally being proprietary they felt they could reinvent the wheel and do it better. I don’t believe they have achieved that in the slightest.

But they’re not handing core ownership of Linux infrastructure to Google. Google simply make parts that – via users and developers – get made or removed in terms of the Linux ecosystem. Just remember what happened to X11 over X.org, or maybe even OSS3 with ALSA.

whatzit

March 4, 2013 at 13:25

Google does not operate in a remotely open manner. As it is anyone can involve themselves with the development of Wayland. And yes, Xorg is a great example of what happens when organizations get stuffy. The problem is that Google isn’t subject to a real fork as you can’t move its single biggest customer (Android) to it.

Separate these components from Android and Google-exclusive development and such a shift might be feasible.

that’s one of the finest example where people are refering to the GNU utilities, and a GNU OS, with the name linux and it doesn’t make sense at all. Desktop Linux (GNU) is mostly the same kernel as adroid’s Linux. there aren’t much differences.

The thing that separates them is the user-space, not the kernel.

“Because handing ownership of core Linux infrastructure to Google” in theory that couldn’t happen, because it’s free (as in freedom) software. In reality, Google is pumping proprietary stuff in a free OS, and believe me they have a *big* pump.

I would not be bothered even if I’ll have to run pure android on my laptop, but what’s bothering me it’s that I don’t have the freedom to change it as I wish, and I don’t have choices. That’s why GNU+Linux (aka desktop linux) will never go away.

I’m not RMS, but I do support his ideas. I don’t know why people hate someone who fights for theyr freedom. Maybe ignorance? We owe a great deal to RMS and his ideas, yet there are people who bash him, and his ideas.

Isn’t that biting the hand that feeds you?
(not an English native speaker, but we have such expression in Romanian language)

If you don’t care about the future of our society, civilization and even your own freedom, that’s fine for you. However, you line yourself right in with the people that jinx the future of _our_ freedom by not just being blissfully ignorant, but actually speaking out against the idea of open IT ontop of it.

If the absolute only reason for you to use a Linux related platform is the cost and you have no interest in supporting open computing at least by speech, recommendation, election or vote, that’s one thing.
However, if you go as far as to actually voice in a hostile fashion against the supporters of open computing, then you aren’t just not giving anything back, you are actually hurting the software ecosystem you profit from.

To make it more understandable: The kind of mindset I am describing here is very similar to the way of thinking of people that think anti-terrorism laws jeopardizing civil rights would never backfire on them. Well, chances are that assertion is quite spot on. However, they _will_ backfire on other innocent people. The problem is that people with that kind of mentality either don’t care, or are simply blissfully ignorant.

Another thing to note is that, if our civilization should ultimately go the way of a locked down and completely corporate controlled infrastructure, the chance of you not being affected by the adversities resulting from such a system are considerably lower than in the anti-terrorism law example.

So we’re sticking with PulseAudio? Linux devices have had a hard time with audio latency thanks to PA, and Android devices suffer similarly. There’s been some breakthroughs in the Android environment which I ultimately hope will either make PA an A-class audio manager, or get it seperated from the Linux ecosystem permanently.

It can only possibly be compatible with software targeting Qt or Gtk, both of which would need to ported.

Incidentally, my N9 is exceptionally fast and responsive despite running Xorg. I don’t believe “cumbersome” was why SurfaceFlinger was created. Rather, it (like almost everything else in Android) exists because originally being proprietary they felt they could reinvent the wheel and do it better. I don’t believe they have achieved that in the slightest.

Yes, appropriate Qt and GTK backends need to be created but this is nothing new to them. They both have a lot of different backends. As I said, QT already has an Android/SurfaceFlinger backend.

> […] Ubuntu would be available for almost every hardware which supports Android.

Except that is not the point. Ubuntu phone is going to be shipped on dedicated hardware, drivers will be adapted accordingly.

IMHO, the Preview release use Android technologies because this is what is available *now* and that “bootstrapping” the app development process for Ubuntu phablet had to be done ASAP, so with existing consumer devices.

Qt has backends for SurfaceFlinger, X and Wayland. QML apps developed now will still work on the first Ubuntu Phone device, even if it turns out to use X/Wayland with or without Compiz.

Time will tell (UDS this week?), but I think it would be more logical for Ubuntu to adapt the phablet PoC to current desktop technologies than the other way around.

This makes sense if and only if Mark Shuttleworth and Larry Page and their two armies of lawyers and accountants have the paperwork in process for a Google acquisition of Canonical. This is *not* a “community project”, it’s a major strategic business move! That means meetings, contracts, etc.

And on this wiki page https://wiki.ubuntu.com/MirSpec#On_Android_Drivers (dated *AFTER* your publication of the article, so not your fault, just bad luck), they state that they want to get rid of SurfaceFlinger, even when using Android drivers. Maybe you should edit to say it has changed.

For the most aspect Android looks better on the Pixel’s high-resolution show than Ubuntu because most Android applications are developed to run on almost any display quality. So written text and design should instantly range.