yashsingh1/xdaforums huggingface dataset:
[Android Software Development] v1r0x:
use the libandroid_runtime.so of the base and have a look at ddms/logcat.

This should show you the smali files which are not correct. (In my rom basically PowerManagerService in services.jar).

baksmali the right jar-File of the base and port (try services.jar and framework.jar), copy the file from your base into the port and run smali.

Then put the output back in the port services.jar and push it on your phone and reboot.

It should throw new errors. So same procedure ;)

It's annoying, but if you changed the correct files it should boot.

The important output looks like this:

04-28 20:41:49.568: E/AndroidRuntime(1359): *** FATAL EXCEPTION IN SYSTEM PROCESS: PowerManagerService
04-28 20:41:49.568: E/AndroidRuntime(1359): java.lang.NoSuchMethodError: com.android.server.PowerManagerService.access$2602
04-28 20:41:49.568: E/AndroidRuntime(1359):	at com.android.server.PowerManagerService$TimeoutTask.run(PowerManagerService.java:1307)
04-28 20:41:49.568: E/AndroidRuntime(1359):	at android.os.Handler.handleCallback(Handler.java:605)
04-28 20:41:49.568: E/AndroidRuntime(1359):	at android.os.Handler.dispatchMessage(Handler.java:92)
04-28 20:41:49.568: E/AndroidRuntime(1359):	at android.os.Looper.loop(Looper.java:137)
04-28 20:41:49.568: E/AndroidRuntime(1359):	at android.os.HandlerThread.run(HandlerThread.java:60)

In this example I've copied PowerManagerService$TimeoutTask.smali of the base services.jar to the port services.jar.

File is located in out/com/android/
[Android Software Development] nasty007:
thanks for help, will try again and i hope that i will make it to boot
[Android Software Development] ---UFO---:
I'm trying to port MIUI v4 2.4.27 from Droid 2 to Milestone 2. My base is CM9 4.0.4. It has sucessfully booted after replacing smali files, but launcher is not working for me. It only shows black screen. Lockscreen is working properly.

Does anyone know how to solve this?

Thanks for help.
[Android Software Development] Lens_flare:
have the same when ported from desire Z/HD/S.

It is really about some native frameworks, coz I succeed on installing Trebushet by adb install, and I've seen that almost all miui apps are just gone (but root explorer stands they are on their places with sufficient rights), weird! All other apps seems are portable to CM9 :D

desire dev guys, plz help by remembering what else have you changed..

PS:

list of miui "native" apps I got (maybe somebody liked to try to install'em on cm) :

-shoutbox

-sms client

-compass

-gallery

-browser

-monitor

-mitalk

-bugreport

-antispam

-settings and system ui(-__-)

-notes

-torch (WOOT at last no build.prop checking and native flashlight via camera support!)

ADD:

got it worked with miui-framework.xml permission (etc/permissions), thx OP again for the great guide :D
[Android Software Development] ---UFO---:
Thank you very much. It really works. I have only copied miui-framework.xml to my base. Thanks
[Android Software Development] Lens_flare:
Strange trouble:

gapps are just crashing without FC message.. and no google account choice, log also very strange:

W/Gmail ( 857): Unexpected exception trying to get accounts.
W/Gmail ( 857): android.accounts.AuthenticatorException: bind failure
W/Gmail ( 857):	at android.accounts.AccountManager.convertErrorToException(AccountManager.java:1563)
W/Gmail ( 857):	at android.accounts.AccountManager.access$400(AccountManager.java:140)
W/Gmail ( 857):	at android.accounts.AccountManager$BaseFutureTask$Response.onError(AccountManager.java:1468)
W/Gmail ( 857):	at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
W/Gmail ( 857):	at android.os.Binder.execTransact(Binder.java:338)
W/Gmail ( 857):	at dalvik.system.NativeStart.run(Native Method)
D/AccountManagerService( 214): bind attempt failed for Session: expectLaunch true, connected false, stats (0/0/0), lifetime 0.0, addAccount, accountType com.google, requiredFeatures null

all google permissions/frameworks are there :(
[Android Software Development] ---UFO---:
try to replace smali files in framework.jar from your base framework.jar.

AccountManager.smali is located in android\accounts\ when you decompress your classes.dex
[Android Software Development] kmelkon:
i did everything in the tutorial but i was stuck at the galaxy s2 logo in the boot screen .... can anybody help me please ??

btw i used galaxy s2 cm9 as a base and miui v4 latest as a port
[Android Software Development] Lens_flare:
I'm curious, why people keep trying to port something that is officially ported? oO

strange, why I have to modify something for accounts? I saw that miuiandroid promised to add google apps on each release, so they should be also responsible for proper work..

ok, let's try.. to modify'em ;/
[Android Software Development] dhk.-:
How can I get a logcat with a infinite boot animation? I'm trying to port miui 2.4.27 from desire to optimus one... With miui Lib_Androidruntime.so stuck at lg boot logo and with the cm9 one never pass the boot animation
[Android Software Development] v1r0x:
Connect your phone via usb. Now you have two options:

1. open a terminal/cmd and cd to the platform-tools folder of the android sdk.

then type

adb logcat > log.txt

After a while press ctrl+c. Open the log.txt file (located in the platform-tools folder)

2. open a terminal/cmd and cd to the tools folder of the android sdk

then type(windows):

ddms.bat

or (linux):

ddms

I recommend to use ddms, because you can stop logging, delete previous logs and change between warnings, error messages, etc.
[Android Software Development] kmelkon:
So is there an official miui port based on cm9 ??! Where ?? And I wanna learn about these stuff ,its my first time .. so be patient :o
[Android Software Development] v1r0x:
Which libandroid_runtime.so is in your port?

and what's the logcat/ddms output?
[Android Software Development] kmelkon:
the miui one ... how can i get the logcat of the booting ?? i never used it .. sorry

thanks :o
[Android Software Development] v1r0x:
important: You need to have the android sdk installed.

connect your phone via usb to your pc.

Open a terminal/command line (on windows press "start" and type "cmd", on ubuntu press strg+alt+t) and change directory to the tools-folder of the sdk (e.g. C:\Android\SDK\tools) and type "ddms.bat".

It should open a window. Click on the left side on your connected phone and you should see the log-output
[Android Software Development] dhk.-:
The problem is that the phone don't start so adb don't connect... And I have no logcat
[Android Software Development] Lens_flare:
it will be the same as AOSP-based port, that now is officially miui-providen

strange, try another miui device then..

no success.. eh.. again burrying into permissions...
[Android Software Development] kmelkon:
i did that but its saying that ddms.bat is not recognized as internal or external command
[Android Software Development] Lens_flare:
cd to folder that contains it.

so type something like:

cd C:\\android-sdk/tools

where arg1 is path to your ddms. you could also execute ddms.bat directly from where it is to not deal with cmd.
[Android Software Development] v1r0x:
you said it stuck at the splash screen. So adb should work.

Did you try to check your device with adb?

With the following command:

adb devices

edit: if you're using a linux just type "ddms" instead of "ddms.bat"
[Android Software Development] dhk.-:
now i get logcat..... but cant understand anything.... i search for an error like the posted few pages back but dont find it... here is the logcat...
[Android Software Development] Lens_flare:
about first log:

here you are.. I have mentioned about missing smali-s, you just haven't read hard -__-

So nobody had issue with gapps? damnit ;[
[Android Software Development] dhk.-:
THANKS MAN!!!!

in wich jar i can find it? º
[Android Software Development] Lens_flare:
framework.jar .

when unpacked, path to power.smali will be: android/os/
[Android Software Development] Kaze105:
Hoping to try this myself. Finished the steps in the OP, but have a question regarding after that. As this is my first test, I wanted to see if it was possible to test the rom via emulator. There are some instructions out there on how to do this, but those require a system image which is acquired by a nandroid backup. Unless there is a way to create a system image on linux (which i didnt find by google), is there any other way to possibly test the rom before I try flashing it to my phone?
[Android Software Development] Lens_flare:
the only emulator available is your device :p

UPD: at last I resolved gapps issue :D just ported right from nexus S..

maybe was about missing com.google.android.maps.xml..
[Android Software Development] :
Okay, I started continuing porting MIUI.

After copying some smalis to the framework.jar, I've encountered another problem.

I get bootloops now, caused by an IPv6 error and maybe other things.

Someone has an idea here?
[Android Software Development] v1r0x:
Looks like a permission problem.

Did you copied the "miui-framework.xml" into

system/etc/permissions

?
[Android Software Development] :
Yes, I did

Maybe a sidenote, I'm porting from MIUI sources on github.
[Android Software Development] KennyG9:
Hi, thanks for this short tutorial.

It does not work here. I use last CM9 ROM nightly kernel for Desire S and I tried last MIUIv4 for Desire HD (RD version), Nexus S and Sensation.

Take a look at my logcat.

I/ServiceManager( 1204): service 'media.audio_flinger' died
I/ServiceManager( 1204): service 'media.player' died
I/ServiceManager( 1204): service 'media.camera' died
I/ServiceManager( 1204): service 'media.audio_policy' died

KennyG9
[Android Software Development] KaranKapoor:
Guys, I've successfully booted with MIUI on the Note however I'm facing a problem. When somebody calls, there isn't any Incoming Call Notification -- so, I never know if anybody is calling or not. The person at the other end can hear the ringing though. There isn't any logcat to post since nothing happens in the logcat when the call comes in. If my understanding is right, the event is not being handled. I'm using the Galaxy Nexus MIUI ROM as base. Any help is appreciated. Thanks!

---------- Post added at 02:13 AM ---------- Previous post was at 02:08 AM ----------

Your logcat shows this... RegisterNatives failed for 'android/graphics/Paint', aborting

You'll need to extract all the Paint*.smali from the ICS framework.jar and copy then over to the MIUI framework.jar -- check the last couple of pages -- the solution was mentioned there.
[Android Software Development] azzledazzle:
Another attempted port that failed :(

i used to miui v4 from htc sensation onto cm9 for one s... it didnt boot. i followed the method 100%

its late, so ill try again tomorrow..
[Android Software Development] v1r0x:
post your log/ddms, so someone can help you ;)
[Android Software Development] azzledazzle:
i will tmorrow.. I started restoring the nandroid before i remembered to get log cat lol...
[Android Software Development] dhk.-:
i get that error and dont know what smali file port....
[Android Software Development] v1r0x:
wrong...
[Android Software Development] KennyG9:
Thank you. It fixed the issue and I used the same method for a lot of errors next. But I can't anymore because I get :

E/dalvikvm( 1335): Requested: Lcom/android/server/PowerManagerService;.nativeStartSurfaceFlingerOffAnimation:(I)V
E/JNIHelp ( 1335): RegisterNatives failed for 'com/android/server/PowerManagerService', aborting

But there's no com/android/server/PowerManagerService File. There is folder com/android/server/, but no "PowerManagerService" in it.

Moreover, I got some "Zygote" errors which I don't understand :

W/Zygote ( 1207): Class not found for preloading: android.media.IRemoteControlClientDispatcher
W/Zygote ( 1207): Class not found for preloading: android.media.IRemoteControlClientDispatcher$Stub

(media/IRemoteControlClientDispatcher does not exist).

OR

W/Zygote ( 1207): Class not found for preloading: android.text.TextDirectionHeuristics$CharCount
W/Zygote ( 1207): Class not found for preloading: android.text.method.WordIterator$1

which exists but changes nothing

OR

E/PhonePolicy( 1207): Could not preload class for phone policy: com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback

does not exist

I don't know if I found the real good method to update framework.jar as you said.

Thank you :) .

KennyG9
[Android Software Development] Lens_flare:
powermanager service is located at services.jar, not framework.jar.

for not preloading just nevermind, something of that won't preload for some reasons -__-

check out android.policy.jar for phonewindowmanager, maybe it should be somewhat patched..
[Android Software Development] alphadog32:
Guys, I always get the "Waiting for Service AtCmdFwd" whenever I try to port it ... why? Any fix.. I've tried installing radios & different rild's.
[Android Software Development] KaranKapoor:
Even I get these in my logcat. My phone boots without any problems though. So, it shouldn't be a problem -- for booting at least.
[Android Software Development] dhk.-:
HELP!!!!!!!!! again... so sorry....

can somebody help me with that?
[Android Software Development] Lens_flare:
\

ehhhehe.. you again got a problem with phonewindowmanager...

E/AndroidRuntime( 190): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManager
E/AndroidRuntime( 190): java.lang.IllegalAccessError: tried to access field com.android.internal.policy.impl.MiuiPhoneWindowManager.mPowerLongPress from class com.android.internal.policy.impl.MiuiPhoneWindowManager
E/AndroidRuntime( 190):	at com.android.internal.policy.impl.MiuiPhoneWindowManager.<init>(MiuiPhoneWindowManager.java:70)
E/AndroidRuntime( 190):	at com.android.internal.policy.impl.MiuiClassFactory.createPhoneWindowManager(MiuiClassFactory.java:32)
E/AndroidRuntime( 190):	at com.android.internal.policy.impl.Policy.makeNewWindowManager(Policy.java)
E/AndroidRuntime( 190):	at com.android.internal.policy.PolicyManager.makeNewWindowManager(PolicyManager.java:67)
E/AndroidRuntime( 190):	at com.android.server.wm.WindowManagerService.<init>(WindowManagerService.java:306)
E/AndroidRuntime( 190):	at com.android.server.wm.WindowManagerService.<init>(WindowManagerService.java:145)
E/AndroidRuntime( 190):	at com.android.server.wm.WindowManagerService$WMThread.run(WindowManagerService.java:689)

I guess it should be modified instead of replacing whole.. dunno how..
[Android Software Development] dhk.-:
any idea somebody?
[Android Software Development] alphadog32:
Has anyone gotten the "Waiting for Service AtCmdFwd" Issue?
[Android Software Development] Lens_flare:
if it is real service, and you guided by OP, the only thing remaining to add that service code to services.jar to others.
[Android Software Development] ldiomedi:
Hi. trying to make the fmradio work in my port for defy, does anybody know what the error above means?? thanks for any help!!.

05-06 02:01:44.100: W/ActivityManager(2257): Unable to start service Intent { act=com.motorola.android.fmradio.FMRADIO_SERVICE }: not found
[Android Software Development] Lens_flare:
as above: try to add that service to services.jar.
[Android Software Development] ronak.super:
KEYBOARD NOT WORKING

miui port to galaxy tab

please help!!????
[Android Software Development] Lens_flare:
what su binary do you use? also should be mkshrc on etc, liblbesec at libs and proper permissions for them.

something about bitmap source, search getpixels and place it in right framework smali.
[Android Software Development] jbbandos:
I was using the Evervolv /system/xbin/su, with the miui /system/xbin/su it now works. Thanks, I should have thought of that.

As for miui settings crashing, the only places I found reference to getPixels besides android/graphics/Bitmap.smali (which I replaced) are in android/media/videoeditor/, and since that one is working it doesn't seem to be related. Maybe it is in another jar, not in framework.jar?
[Android Software Development] Lens_flare:
let's try to revert to miui version of that smali, coz for qualcomm gpu the only paint.smali needed from that dir.

or was it failed for register(which I doubt not happen)
[Android Software Development] KaranKapoor:
Any idea what could cause this issue? I have no clue as to what to do and where to look for the solution.
[Android Software Development] jbbandos:
Ok, I'll start from scratch on the framework.jar with only the GLES20* and ListFragment* copied from the original jar. In the meantime I think I found another problem, while wifi works, the GSM/3G radio isn't detecting any networks, even if there are no related errors in the logcat output. I'll have to look at that after fixing the settings problem.
[Android Software Development] Lens_flare:
it could be rilj-related, so try to replace ril.smali with yours, I assume you have only ril.smali without any side class like samsunghcril.
[Android Software Development] jbbandos:
Well, it still fails the same way "Can't call getPixels() on a recycled bitmap" if I only copy paint.smali.

I've also found out that video play is broken - I get a bunch of coloured diagonal lines and sound. Images show quite well in the gallery.

Looks like porting is being more complicated that I expected... :)
[Android Software Development] KaranKapoor:
I probably forgot to mention this but I can make calls. Thank you for the direction -- I'll try what you suggested.

This is what I have...

RIL$1.smali
RIL$RILReceiver.smali
RIL$RILSender.smali
RIL.smali
RILConstants.smali
RILRequest.smali
[I]SamsungHCRIL.smali
SamsungRIL$1.smali
SamsungRIL$ConnectivityHandler$ConnectivityBroadcastReceiver.smali
SamsungRIL$ConnectivityHandler.smali
SamsungRIL$SamsungDriverCall.smali
SamsungRIL.smali[/I]

UPDATE - I replaced all of the above but still the same. Can make calls but can't receive them.
[Android Software Development] IdeosDev:
Anyone can help me with this camera.apk which i uses from the stock on CM9 That work but not it's not working :(
[Android Software Development] Lens_flare:
the standart camera fail.. make sure you have all camera libraries from cm9 installed on ur miui port.. if camera.apk needs to be modified somehow, do that..

nono, there should be ONE ril.smali, by merging I meant replace all ril methods that was overriden by samsung class. that merged ril should replace miui one. It's work with source and could require additional knowledge of course.
[Android Software Development] KaranKapoor:
I checked for the Samsung RIL smali files in a previous working build and they weren't there at all. Shouldn't this mean that I don't need them? They are in the CM9 ROM though.

PS - Thanks for being so patient and helpful with everybody's queries!
[Android Software Development] KennyG9:
Well, thanks for answer. I patched services.jar and android.policy.jar as you previously said, but now, I got this about PhoneWindowManager :

D/dalvikvm( 1207): DexOpt: --- BEGIN 'android.policy.jar' (bootstrap=1) ---
I/dalvikvm( 1330): DexOpt: access denied from Lcom/android/internal/policy/impl/MiuiPhoneWindowManager$5; to field Lcom/android/internal/policy/impl/PhoneWindowManager;.mScreenshotChordLongPress
I/dalvikvm( 1330): DexOpt: access denied from Lcom/android/internal/policy/impl/MiuiPhoneWindowManager; to field Lcom/android/internal/policy/impl/PhoneWindowManager;.mPowerLongPress

Okay, I'm taking note of this. Thank you.

Edit : Finally, I let the original "android.policy.jar" and got a boot :) . But "Service NFC" crashes and reloads and crashes, etc....

Edit2 : Well. It used to boot boot... > http://expect-us.net/paste/?180a3b4fbc34d332#beX/PTir3NkdiIF9XW20hAb3ulBKLi2W3dpwlxmufY0=

KennyG9
[Android Software Development] ldiomedi:
I think nfc is not needed. I removed the nfc.apk from system/app and the crashes for that are gone
[Android Software Development] KaranKapoor:
You can just delete the NFC apk from /system to solve that -- I'm supposing that your device doesn't have NFC capability.

Edit - Sorry, didn't see the post above mine.
[Android Software Development] KennyG9:
Thanks :) . Before I post my previous message, I searched /system/app/Nfc.apk file for at least one hour and couldn't find it >_<" . Well, I finally found it :D . My logcat is looking way better now, but still no boot. I get stucked on "Boot" screen (after Application Optimization) with an ugly menu in the bottom. I don't understand what is wrong.

KennyG9
[Android Software Development] Lens_flare:
they shouldn't be there... you know, now MIUI is AOSP-based rom, not cm-based, AOSP only have ril.java ( that will compile int some ril$*.smali), Cyan have additional classes to support broad bunch of devices, samsungRIL class is derived from RIL class, it overrides some methods that represents ril events like setting up data, recieving and sending sms etc..that's why you should merge your device' ril class with samsungRIL or somewhat you are using (to see what class are you using there is a build.prop line: ro.ril.class or something like that). please read something about OOP if don't have a clue what I'm talking about :p

the main exception is seems :

E/NetworkLocationRealOs( 1617): no android ID; can't access encrypted cache
E/NetworkLocationRealOs( 1617): java.io.IOException: no android ID; can't access encrypted cache
E/NetworkLocationRealOs( 1617):	at com.google.android.location.os.real.RealOs.getEncryptionKey(RealOs.java:157)
E/NetworkLocationRealOs( 1617):	at com.google.android.location.os.real.RealOs.loadState(RealOs.java:121)
E/NetworkLocationRealOs( 1617):	at com.google.android.location.internal.server.ServiceThread.updateState(ServiceThread.java:225)
E/NetworkLocationRealOs( 1617):	at com.google.android.location.internal.server.ServiceThread.handleMessage(ServiceThread.java:168)
E/NetworkLocationRealOs( 1617):	at android.os.Handler.dispatchMessage(Handler.java:99)
E/NetworkLocationRealOs( 1617):	at android.os.Looper.loop(Looper.java:137)
E/NetworkLocationRealOs( 1617):	at android.os.HandlerThread.run(HandlerThread.java:60)

check out your permissions.. it's not a location service itself.. it's just first which faced wrong permissions..
[Android Software Development] KennyG9:
Thanks. Some permissions were wrong, I corrected chmod from every system/framework/ files to 0644. But I still have the same issue.
[Android Software Development] dhk.-:
Now I have a problem with Bluetootha2sdservice.smali, already changed with the base one but continue giving me the error... Before this error I get an error with java but can't know how to solve it... can't post a logcat now cz I'm on phone.... But if someone have a idea would be great
[Android Software Development] jbbandos:
:( I am at odds on what to do. I've copied all android/*smali from the original framework.jar to the miui framework.jar, and miuisettings still aborts with "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.MiuiSettings}: java.lang.IllegalStateException: Can't call getPixels() on a recycled bitmap".

I have no idea where to look next.
[Android Software Development] v1r0x:
same problem for me :(

But wifi-settings, etc. via statusbar>toggles>long press on icon works :confused:
[Android Software Development] jbbandos:
It does, but at least on mine searching for networks fails, even if it registers on the network.
[Android Software Development] KaranKapoor:
I do know OOP and do get what you're saying. It's just that I haven't done Java in depth. I'll go through the methods and will try what you said. Again, thanks for all that information -- it was very helpful!

EDIT

[B]ro.telephony.ril_class=Smdk4210RIL[/B]

rild.libpath=/system/lib/libsec-ril.so
rild.libargs=-d /dev/ttyS0

I'll have a look into Smdk4210RIL.
[Android Software Development] KennyG9:
Okay. I did the work again and it booted on the first time. I still had the NS menu on the bottom and some issues (no wallpapers, can't access to the main menu, graphic issues such as disorganised big squares everywhere on the screen for example just after entering the PIN).

Then it does not boot anymore. For the same permission problems. How to set the right permission and where ? Thank you :) .

KennyG9