Revealed: The amazing BlackBerry wizardry that created its 'better Android than Android'
>>> Source: Revealed: The amazing BlackBerry wizardry that created its 'better Android than Android' • The Register <<<
Exclusive Some remarkable technical wizardry lies behind BlackBerrys Android coup. When it was launched in January, BlackBerrys new OS was brand new BlackBerry 10 and largely app-less. But today it can execute Android apps at impressive speed. How did they do it? Thanks to some helpful inside knowledge, The Register will reveal it all.
Android runs Java applications on a JVM called Dalvik, which runs on a Linux kernel. As it's open source, Dalvik was straightforward to port to QNX, the sophisticated embedded Unix that RIM acquired in 2010, and which powered its PlayBook tablet (released the same year).
RIM promised that this Android Player would also appear on its first QNX-based phones. But not all apps could run, and there was an insurmountable stumbling block in the way. Android apps may also call native extensions, which are ARM Linux binary libraries. And there was no way of running these on the phones - so the apps couldnt run either.
At first, RIMs engineers attempted to support native extensions by making BB10 another build target for extensions developers. They would choose BB10 as a target at compile time. But this required persuasion. And unless the developer bought into the idea, Android apps that called these Linux ARM extensions wouldnt run. Even then, the BlackBerry system could not allow side-loading of native apps. It didnt look like the Android Player would ever be truly worthwhile.
'Binary blobs'? No probs
But one or two RIM engineers were convinced they could bridge this gap between native QNX and Linux code. They would attempt to run the Linux extensions natively on QNX, without recompilation or pre-processing. Nobody was quite sure it would work - one source says he was 90 per cent sure - but management supported the gamble, and the team set about their work in the summer of 2012.
While Linux and QNX are Unix like, that hardly helped. The Linux extensions looked like binary blobs, so the RIM engineers couldnt be sure what was code and what was data. Which meant they couldnt inspect and patch the Linux libraries on the fly, something called opcode substitution. It also ruled out pre-processing.
"We had to let the SWIs trigger live and discern whether it came from a Linux binary or a QNX binary at runtime, without sacrificing performance of QNX code," a source familiar with the work told us:
Our work used a wide, labour-intensive component: dynamic cross linking, validating and shimming of the Linux APIs on QNX, and a really deep and tricky hack: catching syscalls in apps that bypassed libs, or had libs statically linked.
"Linux and QNX used the same ARM SWI instruction, but passed the syscall number in different registers.
Surprisingly, perhaps, gaming applications proved the easiest to get running smoothly. There were more hurdles, however.
"Skype and Instagram were much more insinuated into Android services and required a lot more work. I believe one of Skype or Instagram even had self-modifying code as part of its security obfuscation, which would have killed any strategy that involved translating the binaries, our source told us.
Nevertheless the team could demonstrate unmodified Skype, Instagram and Angry Birds Android apps to management and got the green light to productise their work. In BB 10.2.1, which is currently in beta testing, we can start to see the benefits.
As I wrote here (incorrectly assuming that the Android runtime uses hardware acceleration - it doesnt) modern BlackBerry machines will be able run Android apps in place without side-loading. Users can download Instagram and it works. The miracle of compatibility is thanks to the extensions support.
Its an ambitious hack - in the old-school sense of the word, an ingenious piece of wizardry - that has thrown BlackBerry a lifeline. And just when it needs it. Heres hoping its a reminder to BlackBerrys new management to appreciate the talent of its engineers.
- 11-25-13, 05:12 AM #2
Interesting piece. Most of it is accurate but some of it just plain wrong.As I wrote here (incorrectly assuming that the Android runtime uses hardware acceleration - it doesn’t) modern BlackBerry machines will be able run Android apps in place without side-loading. Users can download Instagram and it works. The miracle of compatibility is thanks to the extensions support.
Also not sure why it's an 'exclusive' lol. Nothing they've done has been a secret and nothing that article says hasn't been documented already across numerous blogs including the BlackBerry Developer Blog itself., maybe they just have exclusive quotes or something.
- 11-25-13, 02:55 PM #8
But there is a lot of potential here... just don't expect that a version 10.2.1.1055 is going to change anything for average consumers. Maybe 10.3 will (along with better hardware) (along with marketing) (along with carriers actually carrying devices)....
- CrackBerry User
11-25-13, 03:41 PM #9
- 17 Posts
Hello everyone. I'm a BB10 user and I wrote the article at The Register.
Oh. And calling reporters "fools" who research and write stuff like this doesn't make you look cool. I hope you're not representative of the CrackBerry community.
- 11-25-13, 04:50 PM #14
Could have fooled me. You are correct in saying that your description of it has never been outlined but again, the information of its existence has been known for quite some time. As far back as June if not longer.
Prepare Yourself, an Android Runtime Update is Coming! «BlackBerry Developer BlogThe Android Runtime team has been hard at work this year, bringing many new improvements to the runtime, such as support for Jelly Bean 4.2.2, hardware acceleration and performance updates. The team is continuing the quest to improve the overall compatibility of the runtime and add support for many highly requested features and APIs.Hardware acceleration Support
Android applications built for API level 14 can access hardware acceleration by default. Hardware acceleration can improve the performance and smoothness of an app.
http://crackberry.com/talking-os-102...system-builderThat said, the deeper integration between BlackBerry 10 and Android in 10.2.1 is garnering a massive amount of attention from users, as with this update BlackBerry 10 owners can now install Android .apk files (actual Android apps) directly onto their phone.Q5. What are the requirements to get started with installing Android .apk files on my phone?
A5. Pretty straight forward here. You'll need a BlackBerry 10 phone (Z10, Z30, Q10, Q5, etc.) and BlackBerry OS version 10.2.1 or higher.
I enjoyed your article and appreciate the outlining of how it was all done but other than the exact breakdown explanation of it all, there wasn't anything relatively unknown in the article. Anyone who has actually been paying attention to the BlackBerry space, especially developers, has already known this and if you researched it as much as you imply to of have then surely you would have come across the developer blogs covering it, the developer documentation covering it and likely even CrackBerry's own interview with Alec Saunders outlining it.
But I digress, I'm not looking to have some sort epenis battle with you over it all, I have better things to do with my time and the information stands for itself. Anyone who genuinely cares can see that for themselves. I also apologize for calling you a 'fool, even though I didn't quite mean it to be a 'nasty' term.
- 11-25-13, 07:16 PM #16
how about approving my post, sitting there with the same correction about HW acceleration, since the afternoon...?Sorry Bla1ze, you've been misled about hardware acceleration. The article is accurate, it describes a very cool hack that allows native Linux extensions to run on QNX in 10.2.x. This which in turn increases compatibility so it allows the .apks to be run without conversion, . BlackBerry hasn't talked about this yet.Oh. And calling reporters "fools" who research and write stuff like this doesn't make you look cool.I hope you're not representative of the CrackBerry community.
As an El Reg regular I read more than enough "freetards" and all that stupid name-calling from you in every other piece of yours, mostly without even giving us, commentariat, a chance to react... stop acting like you are not a giant hammer half the time. :P
- 11-25-13, 07:20 PM #17
...that being said I think you should hold your horses with the name calling, at least with press folks who are BB10-friendly, let alone actual users - there are not too many left with such an open-minded approach toward BB, they are a rare species nowadays...
- CrackBerry Abuser
11-25-13, 07:46 PM #18
- 370 Posts
It's sad that negative BlackBerry articles get negative reactions here, and positive BlackBerry articles get negative reactions here....
Perhaps the community should have some "in the locker room" discussion, so that the soap opera plays out behind closed doors, and the readers can benefit from shared information without the rhetoric. After all, why is it bad that information that may be old, gets re-posted?? Don't you want good news being shared continuously? Spread the good side of the brand and all?
Posted via CB10
- CrackBerry Genius
11-25-13, 08:39 PM #21
- 3,054 Posts
@ reporter : please clarify the hardware acceleration support expected, given the road map said it was there months ago.
Reading your article, lots of people will remember seeing the road map months back and call shenanigans on you.
Posted via CB10
- By toc610 in forum General BlackBerry DiscussionReplies: 8Last Post: 12-03-13, 11:50 AM
- By Superfly_FR in forum News & RumorsReplies: 8Last Post: 11-25-13, 12:33 PM
- By Bugatti Veyron1 in forum BlackBerry Q5Replies: 1Last Post: 11-25-13, 05:17 AM
- By PaulPaul49 in forum BlackBerry 10 OSReplies: 1Last Post: 11-25-13, 03:45 AM