1. NerdBoss's Avatar
    Meet the 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 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.


    Meet the BlackBerry wizardry that created its 'better Android than Android' The Register
    http://www.theregister.co.uk/2013/11/25/revealed_how_blackberry_made_its_better_android_th an_android/
    Last edited by NerdBoss; 11-26-13 at 03:14 PM. Reason: formatting
    pvphooman and ami.one like this.
    11-26-13 03:12 PM
  2. SCrid2000's Avatar
    11-26-13 03:13 PM

Similar Threads

  1. does 10.2 or 10.2.1 fix gmail issues
    By djdosage in forum BlackBerry Q10
    Replies: 8
    Last Post: 01-21-14, 09:32 PM
  2. Question about Playbook rapid charger
    By MrGlenn in forum BlackBerry PlayBook
    Replies: 18
    Last Post: 11-29-13, 05:05 PM
  3. Communicate between Blackberry native and Android runtime
    By KatrinaMobCov in forum BlackBerry 10 Apps
    Replies: 13
    Last Post: 11-28-13, 09:49 AM
  4. 10.2.1.1055 Accounts not loading
    By Joel Hill in forum BB10 Leaked/Beta OS
    Replies: 7
    Last Post: 11-26-13, 10:44 PM
  5. BBM Error after OS update to 10.2.0.429
    By noiurb in forum BlackBerry Q10
    Replies: 10
    Last Post: 11-26-13, 08:28 PM
LINK TO POST COPIED TO CLIPBOARD