Dalvik patch for Facebook for Android
It's interesting to see the parallels between Android and Windows in this regard.<p>Here's a story from my past, copied from a blog post I wrote last year:<p>My first job at Microsoft was providing developer support for the early Windows SDKs. To do my job well, I spent hours studying the Windows SDK documentation, the Windows source code, and writing sample applications. I then spent hours poring over customers’ (such as Lotus, WordPerfect, and Computer Associates) code helping them figure out what was not working.<p>This gave me a deep appreciation for API design early in my career. I saw clear examples of elegant APIs as well as horrific monstrosities.  I once created a sample for selecting a font in GDI that I called “ReallyCreateFont” because both of the built-in Windows APIs (CreateFont() and CreateFontEx()) were basically broken.<p>The CreateFont case taught me first hand the pain resulting from exposing an API publicly, having customers use it in ways not expected, and then having to do unnatural acts to avoid breaking backwards compatibility.<p>I was supporting WordPerfect’s development of WordPerfect for Windows. This was sometime in early 1991 if I remember correctly. I had the WordPerfect engineer on the phone. He had given me access to the WordPerfect source code, but I couldn’t give him access to the Windows code.  So we were each stepping through WordPerfect in the debugger, him in Utah and me in Bellevue. I could see what his code was doing and what Windows was doing, but he could only see disassembly for Windows.<p>The problem he was seeing had to do with font rendering. In the debugger we stepped into CreateFontEx(), which calls into CreateFont(), which calls into some internal GDI function, which calls into the device driver’s Escape() function (I can’t believe I actually remember all this crap like it was yesterday). Somewhere in this call stack I came across a block of code in Windows with comments that read something like<p><pre><code>    // This is a hack to deal with Adobe’s Type Manager.
    // ATM *injects code* into GDI replacing our code with their own.
    // In order to retain backwards compatability we detect
    // ATM’s attempt to do this, let it do it, and then trick it
    // into thinking it actually hacked us this way.
</code></pre>
I am not making this up (although that comment is paraphrased from my memory).<p>It turns out that the way WordPerfect was using CreateFontEx() was reasonable, but pushing the envelope of what anyone had done before, effectively exposing a bug caused not by the original API design or implementation, but something the API provider had to do to ensure app compatibility because of something another 3rd party had done!<p>Holy-shit! Let me get this straight:<p>* A 3rd party app (Adobe Type Manager) used CreateFontEx() in a way the API designer failed to anticipate.<p>* The API designer needed to retain backwards compatibility so it had to resort to putting 3rd party app specific code in the API implementation.<p>* Another 3rd party comes along and the complexity of the ‘fix’ caused another bug to surface.<p>Welcome to the world of a true virtuous platform...