[Android Software Development] CosmicDan:
Hey, thanks for the detailed docs on this. I have followed your guide, and have had to do some other things too, but now I'm completely stuck. My build script uses CM9-RC2 and MIUI 2.7.20 for LT18i (Xperia Arc S) porting to Xperia Play. Here are the details of where things started to get a bit different/unsure with me.

OK, so I copy these files from CM9 to MIUI:

Overwrite:
InputManager.smali
InputManager$InputFilterHost.smali
InputManager$Callbacks.smali
InputManager$2.smali
NEW files:
InputManager$3.smali
InputManager$4.smali

Correct?

PowerManagerService.smali was not too difficult, seems to work well. Though the differences in line numbers concern me.

After all that, I got the same error as someone else did before:

java.lang.NoSuchMethodError: com.android.server.wm.InputManager.hasExternalAlphakey

..this method is part of libinput.so for MIUI but not CM9, but MIUI's WindowManagerServive.smali relies on it - I could hack it out but I decided to first try swapping MIUI libinput.so back in, and adding the hasExternalAlphakey method (and it's native static) back into the InputManager.

That failed, since it turns out that nativeHasExternalAlphakey is part of MIUI's libandroid_servers.so (which we can't replace without replacing half of the other libs with MIUI ones). OK, so we revert that InputManager method addition, put libinput.so from CM9 back, and comment out all the following code from WindowManagerServive.smali (CM9's doesn't have any of this):

#move-object/from16 v0, p0

#iget-object v1, v0, Lcom/android/server/wm/WindowManagerService;->mInputManager:Lcom/android/server/wm/InputManager;

#invoke-virtual {v1}, Lcom/android/server/wm/InputManager;->hasExternalAlphakey()Z

#move-result v1

#if-eqz v1, :cond_6

#.line 6114
#const/4 v1, 0x1

#move-object/from16 v0, p1

#iput v1, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I

#.line 6115
#:cond_6

OK all good, now we have this:

W/dalvikvm( 232): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Landroid/graphics/BlockLayout;
W/dalvikvm( 232): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Landroid/text/Layout;
(*blah blah blah*)
Caused by: java.lang.UnsatisfiedLinkError: Library textrendering not found; tried [/vendor/lib/libtextrendering.so, /system/lib/libtextrendering.so

Alright that's an easy one, it's a new lib from MIUI but not in CM9. Copied it over... it also depends on another MIUI unique lib:

"Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1965]: 144 could not load needed library 'libwtle.so' for 'libtextrendering.so'

Copied that too, but here is where I'm completely stuck at. I've been googling for hours to no avail.

W/dalvikvm( 230): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Landroid/graphics/BlockLayout;
W/dalvikvm( 230): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Landroid/text/Layout;
(*blah blah blah*)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1314]: 144 cannot locate '_ZN10SkFontHost12GetTableDataEP8SkStreamjPPv'...

What the heck is that? A full text search on that _ZN10SkFontHost string finds it inside libtextrendering.so which I already copied over, though it's also in MIUI's libskia.so (not in CM9) which results in the infamous Netd starting loop if I copy it over.

....So what can I do? Looks like I need to replace CM9's libskia but then I need to spend hours finding/replacing all other CM9's libs, and then I'll have an unclean port. android/graphics/BlockLayout is only in MIUI and not CM9, so I guess I just have to spend a lot of time digging into the logcat dump to merge code from CM9 over to MIUI in order to remove the dependency on this libtextrendering and libwtle, but then things might be broken....

:(

Full logcat attached.

EDIT: OK, here is some more info for educational purposes.... in my logcat we see this:

?: E/AndroidRuntime(310): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1314]: 144 cannot locate '_ZN10SkFontHost12GetTableDataEP8SkStreamjPPv'...
: W/UNKNOWN_FORMAT(): E/AndroidRuntime( 310):
?: E/AndroidRuntime(310): at java.lang.Runtime.loadLibrary(Runtime.java:391)
?: E/AndroidRuntime(310): at java.lang.System.loadLibrary(System.java:535)
?: E/AndroidRuntime(310): at android.graphics.BlockLayout.<clinit>(BlockLayout.java:124)
?: E/AndroidRuntime(310): ... 18 more

BlockLayout.java:124.... opened BlockLayout.smali and did a search for ".line 124" and found this:

.line 124
:goto_0
const-string/jumbo v3, "textrendering"

invoke-static {v3}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

So it's crashing out when trying to load that new libtextrendering.so. The original error I'm assuming says it can't find that long method in the library file for some strange reason... I have no idea how to fix it, so for now I'm going to strip all this out and replace the Layout.smali with CM9. It'll probably completely screw everything up at the most, at the least it looks like Emoji will be broken.