guide hacking android

34
Post Reply Subscribe to Thread Email Thread 1 2 3 11 51 101 Last Search Thread Discussion Q&A FORUMS Android Software Development Android General Android Q&A, Help & Troubleshooting Android Software and Hacking General [Developers Only] Miscellaneous Android Development [More] XDA PORTAL POSTS Do You Agree with the Verge’s Best Keyboard Choices? The Verge did some testing of all the major Android keyboards and came to the more xda-developers Android Development and Hacking Android Software Development [GUIDE] [ICS/JB/common] Definitive FAQ for newest miui porting by Lens_flare ALL-TIME RECENT MOST THANKED 104 Stage 4 Last part. We recently ported miui, all is great and 2012-Jul-17 4:42 Lens_flare OP 96 Stage 2 Recently I had an Acer Liquid MT, which is Qualcomm S2 2012-Jul-17 1:16 Lens_flare OP 63 Stage 3 Third part mostly touches cases where tuto above didn't 2012-Jul-17 1:17 Lens_flare OP 6 New things on this release: etc/telocation.idf 2012-Nov-04 6:43 Lens_flare OP 4 (quote) what are you porting? MIUI V5 4.1 or 4.2 or MIUI V4? 2013-Jul-20 20:40 Notorious [GUIDE][ICS/JB/common] Definitive FAQ for newest miui porting I know there is a Proxuser's guide - "How to Port MIUI v4 for your device" and GREAT thread intended to eliminate porting quirks. My goal is to collect all the experience we got in that thread, which could be helpful for new users porting newest releases of miui. FAQ assumes questionaire, but my format will be more look like a guide but as collection, it could be treated as FAQ. Structure will be Stage-divided to ease of use. Stage 1. Initial port Let's start with first moment - bases choice. Under base I will mean rom which could be used to port miui and also miui release you choose. Let's assume - just "Base" will mean rom for your device with ICS/JellyBean, such as Cyanogen Mod or AOKP or AOSP and their variations(I don't know if it is possible to use stock rom for porting and wouldn't recommend it), when "MIUI base" means any miui rom you prefer (my preference and advice - MIUIandroid crespo [nexus S] or MIUIandroid maguro (Galaxy Nexus) release). You could use any miui base but results will be unpredictable and may very vary from guide stands, for those cases I prepared common debugging stage, which will help to eliminate bugs I haven't listed. MIUI for nexus S and Galaxy Nexus are now upgraded to Jelly Lens_flare 17th July 2012, 06:16 AM | #1 Account currently disabled OP Thanks: 2,467 MENU Register Login

Upload: homesman

Post on 10-Dec-2015

72 views

Category:

Documents


2 download

DESCRIPTION

Android

TRANSCRIPT

Page 1: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 134

Post Reply Subscribe to Thread Email Thread

1 2 3 11 51 101 Last

Search Thread

Discussion QampA

FORUMS

Android Software Development

Android General

Android QampA Help amp Troubleshooting

Android Software and Hacking General[Developers Only]

Miscellaneous Android Development

[More]

XDA PORTAL POSTS

Do You Agree with the Vergersquos Best KeyboardChoicesThe Verge did some testing of all the majorAndroid keyboards and came to the hellip more

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

ALL-TIME RECENT

MOST THANKED

104 Stage 4 Last part We recently ported miui allis great and hellip

2012-Jul-17 442Lens_flare OP

96 Stage 2 Recently I had an Acer Liquid MTwhich is Qualcomm S2 hellip

2012-Jul-17 116Lens_flare OP

63 Stage 3 Third part mostly touches cases wheretuto above didnt hellip

2012-Jul-17 117Lens_flare OP

6 New things on this release etctelocationidfhellip

2012-Nov-04 643Lens_flare OP

4 (quote) what are you porting MIUI V5 41 or 42or MIUI V4 hellip

2013-Jul-20 2040Notorious

[GUIDE][ICSJBcommon] Definitive FAQfor newest miui porting

I know there is a Proxusers guide - How to Port MIUI v4 foryour device and GREAT thread intended to eliminate portingquirks My goal is to collect all the experience we got in that threadwhich could be helpful for new users porting newest releasesof miuiFAQ assumes questionaire but my format will be more looklike a guide but as collection it could be treated as FAQStructure will be Stage-divided to ease of use

Stage 1 Initial portLets start with first moment - bases choiceUnder base I will mean rom which could be used to port miuiand also miui release you choose Lets assume - just Base will mean rom for your device withICSJellyBean such as Cyanogen Mod or AOKP or AOSP andtheir variations(I dont know if it is possible to use stock romfor porting and wouldnt recommend it) when MIUI basemeans any miui rom you prefer (my preference and advice -MIUIandroid crespo [nexus S] or MIUIandroid maguro (GalaxyNexus) release) You could use any miui base but results willbe unpredictable and may very vary from guide stands forthose cases I prepared common debugging stage which willhelp to eliminate bugs I havent listed MIUI for nexus S and Galaxy Nexus are now upgraded to Jelly

Lens_flare

17th July 2012 0616 AM | 1

Account currently disabledOP

Thanks 2467

MENU

Register Login

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 234

30 Apr 2015

30 Apr 2015

30 Apr 2015

30 Apr 2015

By Emil Kako

Samsung Galaxy Tab A HitsUSA but Is It CheapEnoughSamsungrsquos tablet repertoirekeeps growing this timeabandoning the S for hellip more

By Mario Tomaacutes Serrafero

Android Auto A BetterChoiceGooglersquos latest foray intomaking Android run everyfacet of our daily lives is theirpush into the hellip more

By Mike McCrary

LG G4rsquos EvolutionAbandoning Trends orStarting ThemThe LG G4 has met a lot ofpositive feedback since itsunveiling at this hellip more

By Mario Tomaacutes Serrafero

Bean That actually means - you couldnt use their miui basesto port ICS roms(which still under support) For those who stuck at ICS the situation is as followsIf version number is not crucial you might just stick at MIUI2810 httpweedycamiuiandroid and use old kind NexusSGalaxy Nexus roms In guide I will describe steps right foryou with mark ICS-onlyIf for you version number is crucial - stop reading this guideand just use PatchROM (though rom will be based on Stockrom)There is third variant but it needs a device with nearly samespecsyou might just replace some files in miui-supported devicerom with files from your stock rom For now that case is onlytested on xperia 2011 products (playlive with walkmanraymini pro mini pro etc) - arc s [lt18i] miui base and xperia 2012(up sola etc) - S miui base

When base choosen start to portCopy unpacked base rom (so set of folders) to any folder youprefer (lets name it MIUI) it usually contains

system - folder on which we will work more oftendata - may contain something necessary such as firstboot scripts config files etcMETA-INF - contains certificates and signature forsigncheck updater-script(we also will work on it)update-binary (updater-script command processor)bootimg kernel and ramdisk packed together touchonly if kernel should be changed to something morerecent or if your preference is not similar with base rommakers but keep in mind that you have to placemodules that provided with kernel to libmodules [or inplace where ko files are]

Starting with systemdelete

appframeworkmediafonts

then open miui archive and extract those folders to system

Dont close archive Open lib folder in system to add from the samearchive

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 334

content-typesproperties [for themes]liblbesecso [for LBE Guard - MIUI superuser]liblocSDK_22so [for baidu location service preventsnetwork location provider FC]JellyBean-onlylibjni_resource_drmso [themes DRM actually involvesdownload online themes screen]

Open etc folder in system to add from the samearchive

yellowpagedb [Phone calls ability]ICS-onlytelocationtd (as for nexus S and telocationdb in others)[location provider dependency]JellyBean-onlytelocationidf (possible new telocationdb)

go to permissions folder in etc to add

comnxpmifarexml [NFC]miui-frameworkxml [activates miui framework near allapps wont work without that]comgoogleandroidmediaeffectsxml [gallery]comgooglewidevinesoftwaredrmxml [something alsorelated to google may affect play market]comgoogleandroidmapsxml [gmaps]

Open xbin folder in system to add from thesame archive

su [replace dont even use base one]invoke-as [binary with near busybox and toolboxfunctionality need everywhere in system mostly inthemes and SU]

thats all about additional files Devices which dont haveNFC(Near Field Communication chip) also shouldnt haveNfcapk in app folder

Lets modify buildprop then to addCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 434

robuildid=MIUIrobuilddisplayid=MIUIrobuildversionincremental=2xx

roconfigringtone=MIoggroconfignotification_sound=FadeInoggroconfigalarm_alert=GoodMorningogg

robuildversionincremental points to MIUI you port sospecify itAt your base you will most likely see these lines

Code

roconfigringtone=roconfignotification_sound=roconfigalarm_alert=roconfigsms_received_sound=roconfigsms_delivered_sound=

are filled with ringtones that only base have soo just changethem as MIUI do have different ringtone set

Initial port done in system part lets talk aboutUpdater-scriptany release of miui you port should have that line

Code

set_perm(0 0 06755 systemxbininvoke‐as)

for example you have that bunch of code [which is mostlycommon for CM9 release]

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 534

set_perm_recursive(0 0 0755 0644 system)set_perm_recursive(0 2000 0755 0755 systembin)set_perm(0 3003 06755 systembinip)set_perm(0 3003 02750 systembinnetcfg)set_perm(0 3004 02755 systembinping)set_perm(0 2000 06750 systembinrun‐as)set_perm_recursive(1002 1002 0755 0440 systemetcbluetooth)set_perm(0 0 0755 systemetcbluetooth)set_perm(1000 1000 0640 systemetcbluetoothauto_pairingconf)set_perm(3002 3002 0444 systemetcbluetoothblacklistconf)set_perm(1002 1002 0440 systemetcdbusconf)set_perm(1014 2000 0550 systemetcdhcpcddhcpcd‐run‐hooks)set_perm(0 2000 0550 systemetcinitgoldfishsh)set_perm_recursive(0 0 0755 0555 systemetcppp)set_perm_recursive(0 2000 0755 0644 systemvendor)set_perm_recursive(0 2000 0755 0755 systemxbin)set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)

So line I pointed should be somewhere there for exampleCode

set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)set_perm(0 0 06755 systemxbinprocrank)set_perm(0 0 06755 systemxbinsu)set_perm(0 0 06755 systemxbininvoke‐as)

IF you have problems with SU that line mayhelp

Code

symlink(systemxbinsu systembinsu)

paste it somewhere after Code

symlink(busybox[later big code bunch like systemxbin[ etc]

but beforeCode

unmount(system)

Your own MIUI is now ready to be flashed but only if yourdevice is SOOO near on hardware part with MIUI base For those who didnt met that rule I prepared next parts -

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 2: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 234

30 Apr 2015

30 Apr 2015

30 Apr 2015

30 Apr 2015

By Emil Kako

Samsung Galaxy Tab A HitsUSA but Is It CheapEnoughSamsungrsquos tablet repertoirekeeps growing this timeabandoning the S for hellip more

By Mario Tomaacutes Serrafero

Android Auto A BetterChoiceGooglersquos latest foray intomaking Android run everyfacet of our daily lives is theirpush into the hellip more

By Mike McCrary

LG G4rsquos EvolutionAbandoning Trends orStarting ThemThe LG G4 has met a lot ofpositive feedback since itsunveiling at this hellip more

By Mario Tomaacutes Serrafero

Bean That actually means - you couldnt use their miui basesto port ICS roms(which still under support) For those who stuck at ICS the situation is as followsIf version number is not crucial you might just stick at MIUI2810 httpweedycamiuiandroid and use old kind NexusSGalaxy Nexus roms In guide I will describe steps right foryou with mark ICS-onlyIf for you version number is crucial - stop reading this guideand just use PatchROM (though rom will be based on Stockrom)There is third variant but it needs a device with nearly samespecsyou might just replace some files in miui-supported devicerom with files from your stock rom For now that case is onlytested on xperia 2011 products (playlive with walkmanraymini pro mini pro etc) - arc s [lt18i] miui base and xperia 2012(up sola etc) - S miui base

When base choosen start to portCopy unpacked base rom (so set of folders) to any folder youprefer (lets name it MIUI) it usually contains

system - folder on which we will work more oftendata - may contain something necessary such as firstboot scripts config files etcMETA-INF - contains certificates and signature forsigncheck updater-script(we also will work on it)update-binary (updater-script command processor)bootimg kernel and ramdisk packed together touchonly if kernel should be changed to something morerecent or if your preference is not similar with base rommakers but keep in mind that you have to placemodules that provided with kernel to libmodules [or inplace where ko files are]

Starting with systemdelete

appframeworkmediafonts

then open miui archive and extract those folders to system

Dont close archive Open lib folder in system to add from the samearchive

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 334

content-typesproperties [for themes]liblbesecso [for LBE Guard - MIUI superuser]liblocSDK_22so [for baidu location service preventsnetwork location provider FC]JellyBean-onlylibjni_resource_drmso [themes DRM actually involvesdownload online themes screen]

Open etc folder in system to add from the samearchive

yellowpagedb [Phone calls ability]ICS-onlytelocationtd (as for nexus S and telocationdb in others)[location provider dependency]JellyBean-onlytelocationidf (possible new telocationdb)

go to permissions folder in etc to add

comnxpmifarexml [NFC]miui-frameworkxml [activates miui framework near allapps wont work without that]comgoogleandroidmediaeffectsxml [gallery]comgooglewidevinesoftwaredrmxml [something alsorelated to google may affect play market]comgoogleandroidmapsxml [gmaps]

Open xbin folder in system to add from thesame archive

su [replace dont even use base one]invoke-as [binary with near busybox and toolboxfunctionality need everywhere in system mostly inthemes and SU]

thats all about additional files Devices which dont haveNFC(Near Field Communication chip) also shouldnt haveNfcapk in app folder

Lets modify buildprop then to addCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 434

robuildid=MIUIrobuilddisplayid=MIUIrobuildversionincremental=2xx

roconfigringtone=MIoggroconfignotification_sound=FadeInoggroconfigalarm_alert=GoodMorningogg

robuildversionincremental points to MIUI you port sospecify itAt your base you will most likely see these lines

Code

roconfigringtone=roconfignotification_sound=roconfigalarm_alert=roconfigsms_received_sound=roconfigsms_delivered_sound=

are filled with ringtones that only base have soo just changethem as MIUI do have different ringtone set

Initial port done in system part lets talk aboutUpdater-scriptany release of miui you port should have that line

Code

set_perm(0 0 06755 systemxbininvoke‐as)

for example you have that bunch of code [which is mostlycommon for CM9 release]

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 534

set_perm_recursive(0 0 0755 0644 system)set_perm_recursive(0 2000 0755 0755 systembin)set_perm(0 3003 06755 systembinip)set_perm(0 3003 02750 systembinnetcfg)set_perm(0 3004 02755 systembinping)set_perm(0 2000 06750 systembinrun‐as)set_perm_recursive(1002 1002 0755 0440 systemetcbluetooth)set_perm(0 0 0755 systemetcbluetooth)set_perm(1000 1000 0640 systemetcbluetoothauto_pairingconf)set_perm(3002 3002 0444 systemetcbluetoothblacklistconf)set_perm(1002 1002 0440 systemetcdbusconf)set_perm(1014 2000 0550 systemetcdhcpcddhcpcd‐run‐hooks)set_perm(0 2000 0550 systemetcinitgoldfishsh)set_perm_recursive(0 0 0755 0555 systemetcppp)set_perm_recursive(0 2000 0755 0644 systemvendor)set_perm_recursive(0 2000 0755 0755 systemxbin)set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)

So line I pointed should be somewhere there for exampleCode

set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)set_perm(0 0 06755 systemxbinprocrank)set_perm(0 0 06755 systemxbinsu)set_perm(0 0 06755 systemxbininvoke‐as)

IF you have problems with SU that line mayhelp

Code

symlink(systemxbinsu systembinsu)

paste it somewhere after Code

symlink(busybox[later big code bunch like systemxbin[ etc]

but beforeCode

unmount(system)

Your own MIUI is now ready to be flashed but only if yourdevice is SOOO near on hardware part with MIUI base For those who didnt met that rule I prepared next parts -

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 3: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 334

content-typesproperties [for themes]liblbesecso [for LBE Guard - MIUI superuser]liblocSDK_22so [for baidu location service preventsnetwork location provider FC]JellyBean-onlylibjni_resource_drmso [themes DRM actually involvesdownload online themes screen]

Open etc folder in system to add from the samearchive

yellowpagedb [Phone calls ability]ICS-onlytelocationtd (as for nexus S and telocationdb in others)[location provider dependency]JellyBean-onlytelocationidf (possible new telocationdb)

go to permissions folder in etc to add

comnxpmifarexml [NFC]miui-frameworkxml [activates miui framework near allapps wont work without that]comgoogleandroidmediaeffectsxml [gallery]comgooglewidevinesoftwaredrmxml [something alsorelated to google may affect play market]comgoogleandroidmapsxml [gmaps]

Open xbin folder in system to add from thesame archive

su [replace dont even use base one]invoke-as [binary with near busybox and toolboxfunctionality need everywhere in system mostly inthemes and SU]

thats all about additional files Devices which dont haveNFC(Near Field Communication chip) also shouldnt haveNfcapk in app folder

Lets modify buildprop then to addCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 434

robuildid=MIUIrobuilddisplayid=MIUIrobuildversionincremental=2xx

roconfigringtone=MIoggroconfignotification_sound=FadeInoggroconfigalarm_alert=GoodMorningogg

robuildversionincremental points to MIUI you port sospecify itAt your base you will most likely see these lines

Code

roconfigringtone=roconfignotification_sound=roconfigalarm_alert=roconfigsms_received_sound=roconfigsms_delivered_sound=

are filled with ringtones that only base have soo just changethem as MIUI do have different ringtone set

Initial port done in system part lets talk aboutUpdater-scriptany release of miui you port should have that line

Code

set_perm(0 0 06755 systemxbininvoke‐as)

for example you have that bunch of code [which is mostlycommon for CM9 release]

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 534

set_perm_recursive(0 0 0755 0644 system)set_perm_recursive(0 2000 0755 0755 systembin)set_perm(0 3003 06755 systembinip)set_perm(0 3003 02750 systembinnetcfg)set_perm(0 3004 02755 systembinping)set_perm(0 2000 06750 systembinrun‐as)set_perm_recursive(1002 1002 0755 0440 systemetcbluetooth)set_perm(0 0 0755 systemetcbluetooth)set_perm(1000 1000 0640 systemetcbluetoothauto_pairingconf)set_perm(3002 3002 0444 systemetcbluetoothblacklistconf)set_perm(1002 1002 0440 systemetcdbusconf)set_perm(1014 2000 0550 systemetcdhcpcddhcpcd‐run‐hooks)set_perm(0 2000 0550 systemetcinitgoldfishsh)set_perm_recursive(0 0 0755 0555 systemetcppp)set_perm_recursive(0 2000 0755 0644 systemvendor)set_perm_recursive(0 2000 0755 0755 systemxbin)set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)

So line I pointed should be somewhere there for exampleCode

set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)set_perm(0 0 06755 systemxbinprocrank)set_perm(0 0 06755 systemxbinsu)set_perm(0 0 06755 systemxbininvoke‐as)

IF you have problems with SU that line mayhelp

Code

symlink(systemxbinsu systembinsu)

paste it somewhere after Code

symlink(busybox[later big code bunch like systemxbin[ etc]

but beforeCode

unmount(system)

Your own MIUI is now ready to be flashed but only if yourdevice is SOOO near on hardware part with MIUI base For those who didnt met that rule I prepared next parts -

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 4: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 434

robuildid=MIUIrobuilddisplayid=MIUIrobuildversionincremental=2xx

roconfigringtone=MIoggroconfignotification_sound=FadeInoggroconfigalarm_alert=GoodMorningogg

robuildversionincremental points to MIUI you port sospecify itAt your base you will most likely see these lines

Code

roconfigringtone=roconfignotification_sound=roconfigalarm_alert=roconfigsms_received_sound=roconfigsms_delivered_sound=

are filled with ringtones that only base have soo just changethem as MIUI do have different ringtone set

Initial port done in system part lets talk aboutUpdater-scriptany release of miui you port should have that line

Code

set_perm(0 0 06755 systemxbininvoke‐as)

for example you have that bunch of code [which is mostlycommon for CM9 release]

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 534

set_perm_recursive(0 0 0755 0644 system)set_perm_recursive(0 2000 0755 0755 systembin)set_perm(0 3003 06755 systembinip)set_perm(0 3003 02750 systembinnetcfg)set_perm(0 3004 02755 systembinping)set_perm(0 2000 06750 systembinrun‐as)set_perm_recursive(1002 1002 0755 0440 systemetcbluetooth)set_perm(0 0 0755 systemetcbluetooth)set_perm(1000 1000 0640 systemetcbluetoothauto_pairingconf)set_perm(3002 3002 0444 systemetcbluetoothblacklistconf)set_perm(1002 1002 0440 systemetcdbusconf)set_perm(1014 2000 0550 systemetcdhcpcddhcpcd‐run‐hooks)set_perm(0 2000 0550 systemetcinitgoldfishsh)set_perm_recursive(0 0 0755 0555 systemetcppp)set_perm_recursive(0 2000 0755 0644 systemvendor)set_perm_recursive(0 2000 0755 0755 systemxbin)set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)

So line I pointed should be somewhere there for exampleCode

set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)set_perm(0 0 06755 systemxbinprocrank)set_perm(0 0 06755 systemxbinsu)set_perm(0 0 06755 systemxbininvoke‐as)

IF you have problems with SU that line mayhelp

Code

symlink(systemxbinsu systembinsu)

paste it somewhere after Code

symlink(busybox[later big code bunch like systemxbin[ etc]

but beforeCode

unmount(system)

Your own MIUI is now ready to be flashed but only if yourdevice is SOOO near on hardware part with MIUI base For those who didnt met that rule I prepared next parts -

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 5: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 534

set_perm_recursive(0 0 0755 0644 system)set_perm_recursive(0 2000 0755 0755 systembin)set_perm(0 3003 06755 systembinip)set_perm(0 3003 02750 systembinnetcfg)set_perm(0 3004 02755 systembinping)set_perm(0 2000 06750 systembinrun‐as)set_perm_recursive(1002 1002 0755 0440 systemetcbluetooth)set_perm(0 0 0755 systemetcbluetooth)set_perm(1000 1000 0640 systemetcbluetoothauto_pairingconf)set_perm(3002 3002 0444 systemetcbluetoothblacklistconf)set_perm(1002 1002 0440 systemetcdbusconf)set_perm(1014 2000 0550 systemetcdhcpcddhcpcd‐run‐hooks)set_perm(0 2000 0550 systemetcinitgoldfishsh)set_perm_recursive(0 0 0755 0555 systemetcppp)set_perm_recursive(0 2000 0755 0644 systemvendor)set_perm_recursive(0 2000 0755 0755 systemxbin)set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)

So line I pointed should be somewhere there for exampleCode

set_perm(0 0 06755 systemxbinlibrank)set_perm(0 0 06755 systemxbinprocmem)set_perm(0 0 06755 systemxbinprocrank)set_perm(0 0 06755 systemxbinsu)set_perm(0 0 06755 systemxbininvoke‐as)

IF you have problems with SU that line mayhelp

Code

symlink(systemxbinsu systembinsu)

paste it somewhere after Code

symlink(busybox[later big code bunch like systemxbin[ etc]

but beforeCode

unmount(system)

Your own MIUI is now ready to be flashed but only if yourdevice is SOOO near on hardware part with MIUI base For those who didnt met that rule I prepared next parts -

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 6: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 634

[ View ]

framework mods and common debugging andtroubleshooting See next 2 posts

Last edited by Lens_flare 4th November 2012 at 1144 AM Reasonjellybean

The Following 143 Users Say Thank You to Lens_flare For This Useful Post

Stage 2

Recently I had an Acer Liquid MT[now bricked] which isQualcomm S2 device(msm7x30) and my guide defines alsoassume you have device with Qualcomm inside But some ofguide moments[first stage is not exception] are common formost devices with other chipsI also used Cyanogen Mod 9 as base so some of these defineswouldnt be applicable to your porting using AOSP baseThat was on ICS and I will count that in while describing forthose who dont care about miui version and portingsomething before MIUI 2810Now I have MIUI-supported Xperia Arc S But its MIUI is basedon stock rom (such a shame) So as FXP provides us CM 10 Istarted to port over it to bring latest and greatest of MIUIjellybean on that device So again Qualcomm but with stockICS which means lesser quirks on porting I again will assumeyou are on Qualcomm but I have to say that all defines of thisstage are nomore device-specific

Returning to guide

Stage 2 Framework mods to makeit bootRom not booting - that is most likely a framework issue thatis remained from Nexus SGalaxy Nexus But dont run to baseto grab all framework and paste it to base else you will havea base rom instead of miui My suggestion is portFor those who are new in apktool disassembling I suggest to

Lens_flare

17th July 2012 0616 AM | 2

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 7: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 734

read something like that httpforumxda-developerscomshowphpt=1511730 or thathttpforumxda-developerscomshowphpt=1752201 orgoogle it to understand common principles of work For framework-resapk mods we will use Connor-apktool andscripts for ease of use httpcodegooglecompandroid-apktooldownloadslist (choose only dependencies for yourplatform dont replace AAPT from them) Always chooselatest one

Lets assume again

disassemble something - usually means issuingCode

apktool d [full name of apk or jar]

command on file I specify if more info not specifiedassemble something - usually means issuing

Code

apktool b [disassembled apk or jar folder without apk in name or with out at the end for jars

command on file I specifybetter way to assemble is drag assembled classesdex(orresourcesarsc and xmls at rest folders in case ofassembling framework-resapk) from [file youmodified]buildapk to original file opened as archive (inwindows you also have to check out a compression rateto make it the same as there were before draggingwhich prompts to you as compression method likeNormal and Store)smali - piece of code on dalvik bytecode language arepart of nearly any disassembled filesmali treejust treesmali - usually means set of fileswith the same name in the beginning but with differentend(usually with $ before) for example

Code

RILsmali means

RILsmali

RIL$1smali

Lets start with framework modsAll frameworks are located at systemframework

frameworkjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 8: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 834

Mostly issues are produced there Disassemble frameworkjar from MIUI port you are working soyou will see frameworkjarout Go to smali folder in it Later allactions we will produce from there (except assembling)First replace some files from your base frameworkjar (fistdisassemble base roms frameworkjar and move all files I willspecify replace if asked)Listing all smali I had to replace in frameworkjarICS-only

Code

androidosPowersmaliorgcodeauroraPerformancesmaliandroidmediaMediaRecordersmaliandroidgraphicsPaintsmaliandroidosEnvironmentsmaliandroidviewHardwareCanvassmaliandroidnetwifiWifiNativesmali

CommonCode

androidviewGles20smali (not only canvas but all with gles20 at the beginning)androidhardwareCamerasmaliandroidserverBluetoothA2dpServicesmaliandroidcontentresPackageRedirectionMapsmali

JellyBean OnlyCode

androidbluetoothHeadsetBasesmalicomandroidinternalappActivityTriggersmaliandroidwebkitHTML5smaliandroidwebkitSelectActionModeCallback

I highlighted those could be common for all chips not only forQualcomm ones But some of smalis are not following common rules The weirdest exception of that - WebviewCore If you replaceonly WebViewCore tree Gmail Facebook Browser HTMLviewer and all that is using this class WONT WORK What wasmy solution is to replace Webviewsmali tree so I met alldependencies that class may work withICS-onlyThat class and Sound Recorder are in need of one propertyfrom SystemPropertiessmali which is located at androidos But dont run to base to take it and replace immediately asyou read It have to be patchedend of ICS-onlyI highlighted it as ICS-only as you will just replace it on

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 9: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 934

JellyBean - its now hard to patch but easy to replace

gtgtCommon Remark about patching smalisPatching (usually named diffing diff that means finddifferences and eliminate them) in our context is a process ofcomparing two files and adding contents of one of them toanother and not replacing anything Our diff process willconsist of base-gtmiui content addition so smali we modifycould live in dual life - for your base and for MIUI remainedframework For start of diff you should have both base andmiui files you want to modify and a diff tool (in windows -beyond comparetotal commander winmerge or notepad++)my preference - Meld diff viewer[really simple and visual-oriented] the only thing - its running on linux environmentand I dont know if there is a windows version Then just openfiles in tool and start adding Sometimes you have to add allentries are not present in miui one from base sometimes youshould be smart enough to mod only part which needed andnothing more and also sometimes to replace pieces of codewhich are actually safe to do so Thats a whole process

gtgtExample - our SystemPropertiessmaliActually after opening you see it is full of differences frombasehttpminuscommbmfprmG4Kyou see those green blocks Each of them signs a missing partof code you should add in Meld its just about of clicking littlearrow that represents that block As for windows tools theyshould have something like add all and many other thingscould do it in a batch way A little piece of smartnessthat file is the only one I discovered which allow replacingline with big code pieces see thathttpminuscommdnAholnLdo you see line 126 and HUGE code block against it youmay forget about line 126 and copy block against it with nodoubt Note that line numbers etc could change always checkbefore doing something That line also became a dealbreaker on JellyBean thats whywe decided it would be better to just replace it Ecample willgive you a clue just about common patch process

gtgtAnother file has to be modified in same way -AssetManagersmali which is located at androidcontentres Beware of replacing anything on it[only add as stand before]if something went wrong it might produce awful logcatnobody could understand so you have to re-port rom again tocatch a causer

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 10: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1034

Another interesting patch you should perform if you havedifferent than RIL telephony class To determine which ril class you have seek for following linein your buildprop

Code

rotelephonyril_class=

If you dont have such mostly it means you are using RIL classand dont need a patch in my case it was

Code

rotelephonyril_class=LGEQualcommRIL

so Ill describe a process for it pointing what is common All ril classes located at comandroidinternaltelephony sogo to it LGEqualcommRIL have a single smali so copy only that one[ifyour class also have another smali with the same name forexample LGEStarRIL$1smali copy them too] Also unlike mostclasses in CM LGEQualcommRIL have a dependency -QualcommSharedRIL which tree you should also move to thatfolder near LGE oneClasses that are also have that dependency

LGEQualcommUiccRILHTCQualcommRILSamsungQualcommUiccRIL

Others are dervied from RIL and dont have any dependencieslike that As CM involves more and more devices todetermine what dependencies you actually need ask sourcecode

Code

public class LGEQualcommRIL extends QualcommSharedRIL implements CommandsInterface

extends means your dependency you have to also add toMIUI if it is RIL go ahead and continue porting To make your class work instead of RIL you should modifyMIUI PhoneFactorysmali located at the same folder infollowing way

Code

line 136 new‐instance v8 LcomandroidinternaltelephonyRIL

invoke‐direct v8 p0 v4 v0 LcomandroidinternaltelephonyRIL‐gtltinitgt(LandroidcontentContextII)V

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 11: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1134

-gtCode

line 136 new‐instance v8 Lcomandroidinternaltelephony

invoke‐direct v8 p0 v4 v0 Lcomandroidinternaltelephony

it changes a constructor of RIL class to LGEQualcommRIL classIf my lines incorrect just type RIL in search in Phonefactory itwill show you exactly 2 defines with RIL involved

Another case for patching isandroidmediaAudioFormatsmali Copy all missing lines from base to miui it would be enough Ihave decide to not replacing it coz of constructor that is differand might one day turn into bomb The most complicated smali case WebSettingsClassic It docontains lines that should be added also lines that should beslightly modifiedLets try to make the process bit easier with these stepsfirst of all find those fields

Code

field private mMediaPreloadEnabled

field private mWebGLEnabledZ

they are at the beginning of file marked as green blocksAttention then there is a listing that asks you about defaultvalue like that

Code

line 91 iput‐boolean v2 p0 LandroidwebkitWebSettingsClassic‐gtmMediaPreloadEnabledZ

DONT EVEN TOUCH THEM Even if you know what are youdoing - it will fail on boot if you placed that lines in miui fileinteresting place here when you will search for webgl fromthe beginning you will hit such block marked as blue(incompatible)

Code

goto16 goto_1end method

method private native nativeIsWebGLAvailable()Z

while miui file will show just thatCode

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 12: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1234

goto goto_1

and end method after You fn kiddng - will you askyeah pure cheat Lets fix it uppaste only

Code

end method

method private native nativeIsWebGLAvailable()Z

before end_method but after goto goto_1 so that fullblock will be instantly turned to whie

Code

goto goto_1end method

method private native nativeIsWebGLAvailable()Z

except goto which will show as differ but who cares After searching webgl on base file you will possibly see acode block starting with

Code

method public declared‐synchronized isWebGLAvailable()Z

add it without any thought You should do the same withfollowing methods

Code

method public declared‐synchronized setMediaPreloadEnabled(Z)V

method public declared‐synchronized setWebGLEnabled(Z)V

btw those methods are so-called setters - methods in classthat intended to adjust value to class fieldDONT ADD ANYTHING ELSE IT WILL POSSIBLY BREAKBOOTING AGAIN Youve been warned

Frameworkjar port donethe only thing to do - assemble it

servicesjarUnlike frameworkjar there are lesser things to do But theyare also significant for porting processICS-onlyInputManagersmali - the only thing should be replaced [andlocated in comandroidserverwm]

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 13: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1334

On JellyBean it is located at comandroidserverInput andsalso have to be replacedYou may also replace usb folder but actually those who haveMTP(devices with kernel 30 or so that are having new USBgadget framework drivers consult with development branchfor details) are in no need to do so as for others (as of mineinstance on MT development) you have to replace it In stage4 I will present my ways to make usb subsystem work on miuiAlso there is a new smali on Jellybean watchdogsmali Justreplace whole tree of this in comandroidserverAs for diff files there is one PowerManagerServicesmali(mayI shorten its name to PMS)there is no matter to diff it like others as it have too muchdependencies to resolve and may cause your system crash ICS-onlySo it only asks about nativeStartSurfaceFlingerOffAnimationmethod but hey PMS do have such method but its name isnativeStartSurfaceFlingerAnimation so without Off mysolution is to add Off to it see that stackhttpminuscomlY4DiQfJ451Aqthats where you should find you first entry (there are 2)second entry showed therehttpminuscomlchMVcHtKe46Tafter editing you should see a huge block to addhttpminuscomlbmNygeJBs9klvadd it and that smali is portedend of ICS-onlyOn jellybean porting it more trivialnativeCPUBoost is missing You will have some defines in basefile Use search by keyword cpuboost in base file todetermine where they are and just add them to miui onedefines will be

Code

method private static native nativeCpuBoost(I)V

-method definitionCode

method public cpuBoost(I)V

-method code blockand nothing extraAssemble new servicesjarout to servicesjar when complete

Done those but still not boots or boots but functionsimproperly see next Stages- 3 and 4 I will enlighten allmoments of debugging whats wrong and also additional

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 14: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1434

[ View ]

tweaks for specific devices that faced problems with porting[Its just impossible to do that for each device so there is agreat thread you could always ask whats wrong if my advicesdidnt help]

Last edited by Lens_flare 4th November 2012 at 1015 AM Reasonjellybean

The Following 96 Users Say Thank You to Lens_flare For This Useful Post

Stage 3

Third part mostly touches cases where tuto above didntresolved boot problems also cases where there is noconfidence 2nd stage will workcases when people are tryingto investigate themselves but mostly not xperienced insuch(the most respectable case) To understand whats goingon with your build it would be better to be CMAOSPAOKPdev so you will most likely know where to find an answer Butif it is not about you let me point on some moments couldhelp

Stage 3 Understanding logs anddebuggingYes exactly understanding Most likely people are going toforum and just posting logcat (that might contain commonerror) My goal is show you - logcat is not shuch thing youshould fear to investigate

First of all lets assume something

adb - powerful tool in our case the must have thing tomake a log Article on android devs most likely describesall the moments about adb powerhttpdeveloperandroidcomtoolshelpadbhtmllogcatlog - one of the android advantages that allowsyou to debug whats going on with your system bymake log I will assume issuing

Code

adb logcat gtlogtxt

command last argument - logtxt is a text file with log

Lens_flare

17th July 2012 0617 AM | 3

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 15: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1534

system provided to you (you could use any name)sometimes we need an answer about things that aregoing on with baseband (so-called radio) In those casesI usually asking to take radiolog Thats how it could beproduced

Code

adb logcat ‐b radio gtlogtxt

reading it might be a pain as terms of it are too muchhardware-specific but it anyway complies withprinciples I will put belowdebugdebugging - process of analyzing code whichhelps to eliminate bugs (thats why de-bug)

Some people experiencing problems with log mostcommon are-wrong MIUI base which prevents usb subsytem to start(nexus S base most likely allows you to use log)-nocorruptedwrong usb drivers on PC-Windows most likely is about new usb subsystems etcso advice is the only one - try on ubuntu (not working withoutudev rules)-somewhat corruptedinconsistent usb port-lack of persistsysusbconfig= mass_storageadb inbuildprop specifically adb in this lineNote if your log only consists of

Code

link systembinsh failed no such file or directory

or something like that you should contact a CM dev else youare most likely know what happened ]Alright when we got a log it consist of many many lines thatare looping if your system not boots Thats why that kind ofsituation is sometimes called bootloop System may repeat aerror eternal time it lives so log might be huge

To parse whats going on there are someadvicekeywords search in log you got some keywords that might be useful ondebugging boot issuemost common keywords are

E - errorEdalvikvm - possibly crucial system error

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 16: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1634

No such file or directory - says it allcouldnt - android likes that mostly shows faultythingsfailfailed - mostly crucial errorWwarning - says it all but not always warn could bea boot failure causeexception(especially NullPointerException) - points youthat something went wrong in framework or applicationwork

I tags could be also useful at debugging but most helpful areerrors and warnings

Most common constructs couldnt find native method the most common reasonof a bootloop For instance

Code

Edalvikvm( 100) ERROR couldnt find native methodEdalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)VEJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

Lets parse that construct to extract parts we will fixFirst of all smali path might be extracted from that line

Code

EJNIHelp ( 100) RegisterNatives failed for androidviewGLES20Canvas aborting

-gtCode

androidviewGLES20Canvas

thats it smali we are looking for is GLES20Canvassmali Butandroidview where it is Answer comes from androidsource it took some time to analyze frameworks Just letsassume all that starting with android in path belongs toframeworkjar What if path doesnt contain android at the beginning Again the answer is in source Paths likeorg are belong toframeworkjar comandroidserver - servicesjar (there is the same folder atframeworkjar but most likely you dont need to touch it)another place we could be mixed upcomandroidinternal - frameworkjarcomandroidinternalpolicyimpl - androidpolicyjarfor frameworkjar path ends up on internal which representstelephony folder policyimpl is the only androidpolicyjar

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 17: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1734

folderOther frameworks are actually not used in port as theycontain core android functionality which is commonNote about smali you found

it might be not smali you are looking for most likelywhen code points you to android functionality andwidgets (control elements) like combobox or listviewits a sign to think twice what have you done on yoursystem to port itit might be tree of smali(remember 2nd stage assumes)to ease of use always replace smali with its tree andonly if error becomes worse think about single smali orabout diff(2nd stage assumes again )

fromCode

Edalvikvm( 100) Requested LandroidviewGLES20CanvasnStartTileRendering(IIIII)V

we could extract a method which is missing -nStartTileRendering In some cases only that method shouldbe added and nothing more

androidcontentresResources$NotFoundExceptionResource ID XXXExample

Code

EAndroidRuntime( 3047) FATAL EXCEPTION IN SYSTEM PROCESS WindowManagerPolicyEAndroidRuntime( 3047) androidcontentresResources$NotFoundException Resource ID 0x3060008EAndroidRuntime( 3047) at androidcontentresResourcesgetValue(Resourcesj ava1022)EAndroidRuntime( 3047) at androidcontentresMiuiResourcesgetValue(MiuiRes ourcesjava56)EAndroidRuntime( 3047) at miuiutilResourceMapperresolveReference(Resource Mapperjava9)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilupdateSettings(Haptic FeedbackUtiljava109)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtil$SettingsObserverobse rve(HapticFeedbackUtiljava92)EAndroidRuntime( 3047) at miuiutilHapticFeedbackUtilltinitgt(HapticFeedback Utiljava75)

Wrong MIUI base mostly Appear when something changedby previous porter (miui) which affects resources you wonthave banal link error

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)Hope all of you heared about C language That error is a formof C exceptional case(in other words - exception) You will see if it happen

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 18: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1834

Flibc ( 2698) Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)IDEBUG ( 130) IDEBUG ( 130) Build fingerprint tmoushtc_doubleshotdoubleshot403IML74K275847101userrelease‐keysIDEBUG ( 130) pid 2698 tid 2698 gtgtgt zygote ltltltIDEBUG ( 130) signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr deadbaadIDEBUG ( 130) r0 deadbaad r1 00000001 r2 a0000000 r3 00000000IDEBUG ( 130) r4 00000000 r5 00000027 r6 4086fbfd r7 00000036IDEBUG ( 130) r8 40253f04 r9 40233a7e 10 0000904c fp 00009062IDEBUG ( 130) ip 4028b240 sp befcfa60 lr 401043c1 pc 40100adc cpsr 60000030

yaa ENORMOUS code block build fingerprint fatal signal andstack trace welcome to hell One little thing error is right above that block dont even tryto parse its contents ignore it

WE ALL DIE111yaa series of died errors

Code

IServiceManager( 1478) service mediaaudio_flinger diedIServiceManager( 1478) service mediaplayer diedIServiceManager( 1478) service mediacamera diedIServiceManager( 1478) service mediaaudio_policy died

IGNORE them its a result of exception right above(no matterC exception or java one) its better to see it instead ofposting WE ALL DIE111

Unable to extract+optimize DEX fromsystemframeworkframeworkjar and other WTFcasesexamples

Code

Ddalvikvm( 103) DexOpt ‐‐‐ BEGIN frameworkjar (bootstrap=1) ‐‐‐Edalvikvm( 172) Duplicate class definition LandroidmediaMediaRecorderEdalvikvm( 172) Trouble with item 2900 offset 0x17a86cEdalvikvm( 172) Cross‐item verify of section type 0006 failedEdalvikvm( 172) ERROR Byte swap + verify failedEdalvikvm( 172) Optimization failedWdalvikvm( 103) DexOpt ‐‐‐ END frameworkjar ‐‐‐ status=0xff00 process failedEdalvikvm( 103) Unable to extract+optimize DEX from systemframeworkframeworkjar

Code

05‐30 141515970 ENetworkLocationRealOs(2304) no android ID cant access encrypted cache05‐30 141515970 ENetworkLocationRealOs(2304) javaioIOException no android ID cant access encrypted cache

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 19: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 1934

Code

1012 07‐03 032821350 ESystem(1538) Failure starting core service07‐03 032821350 ESystem(1538) javalangNullPointerException07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicegrantPermissionsLPw(PackageManagerServicejava4299)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceupdatePermissionsLPw(PackageManagerServicejava4247)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServiceltinitgt(PackageManagerServicejava1170)07‐03 032821350 ESystem(1538) at comandroidserverpmPackageManagerServicemain(PackageManagerServicejava858)07‐03 032821350 ESystem(1538) at comandroidserverServerThreadrun(SystemServerjava167)07‐03 032821350 ISystemServer(1538) Input Method Service07‐03 032821360 WSystemServer(1538) 1021 07‐03 032821370 ASystemServer(1538) BOOT FAILURE starting Input Manager Service1022 07‐03 032821370 ASystemServer(1538) javalangNullPointerException1023 07‐03 032821370 ASystemServer(1538) at androidappPendingIntentgetBroadcast(PendingIntentjava293)1024 07‐03 032821370 ASystemServer(1538) at comandroidserverInputMethodManagerServiceltinitgt(InputMethodManagerServicejava548)1025 07‐03 032821370 ASystemServer(1538) at comandroidserverServerThreadrun(SystemServerjava271)1026 07‐03 032821400 EAndroidRuntime(1538) Error reporting WTF1027 07‐03 032821400 EAndroidRuntime(1538) javalangNullPointerException

mostly likely is about way assembling framework files Alsosome of them might be just corrupted by accidentSometimes these errors caused by wrong smali replacementor wrong diff methodology Or it might be just banal reason -no place in system or cache partitions

English [ ]Most log parts are in mere not technician Englishlog mightbe read as little book with bright characters Find what youare looking for and fix it

Source code is your best friend in portingId recommend to have an android source code [from internetor on your local PC] to port something that outstands of rulesI listed For example CM frameworks source could be foundherehttpsgithubcomCyanogenModandroid_frameworks_baseThat mostly affect cases in which hardware that is notworkingworking but not perfectworking incorrect on MIUIbut worked like a charm on base Any log line represents a line of code in source that one couldsearch and debug from there (as source is mostly commonthat miui ports possibility proove) Each smali represents ajava source code or its part(- subclass which signed by $)each java is in frameworks folder on source (mostlyframeworksbase) Log line is a message which formed with Crules about these rules so you have to avoid ciphers or guesshow could code represent that message You may searchguessed line in source to locate java file or locate it manually

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 20: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2034

[ View ]

according to smali location and my advice and search in it

Happy debugging

Last edited by Lens_flare 4th November 2012 at 1008 AM ReasonWE ALL DIE

The Following 63 Users Say Thank You to Lens_flare For This Useful Post

Stage 4

Last part We recently ported miui all is great and mostlyfunctions But am I the only one or that one looksincomplete One could make its port complete by followingnext stage

Stage 4 Advanced tweaks andspecific hardware fixesUSB subsystem(massstoragetetherdebugging sign)First of all little self - check you have to be on old USB Gadget framework kernel sourceThose you could clarify by talking with cm dev Also Im notrejecting it could work for others but in slightly modifiedsequence

Starting from framework-resapkYou have to disassemble it first but before you use actualapktool d you should also issue

Code

apktool if framework‐resapk

that is necessary for decoding internal resources correctly Disassemble base and MIUI frameworks and leave base one aswe will work with MIUI one and will use base as a referenceAfter disassembling lets go to resvalues in itAs old usb gadget needs old mass storage path which wasapplicable to gingerbread we should add that path tostringsxml If you only disassembled that file you should see somethinglike that

Lens_flare

17th July 2012 0942 AM | 4

Account currently disabledOP

Thanks 2467

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 21: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2134

Code

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgtltresourcesgt

exact line to add at the near endCode

ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgt

so that you will get something like thatCode

ltstring name=launchBrowserDefaultgtLaunch Browserltstringgt ltstring name=SetupCallDefaultgtAccept Callltstringgt ltstring name=config_legacyUmsLunFilegtsysdevicesplatformusb_mass_storagelun0fileltstringgtltresourcesgt

Remarkthat case is the only applicable to devices which have old kindSD card only Look at the framework-res on your device italso might have different LUN file path(actually it is a filewhich collects all your SD data to be mounted as usb drive)that you should always replace in mind my defines with yoursto make actual usb workDevices with flash memory(also called EMMC or embeddedSD on flash) and SD[or without SD support at all] should betreat in custom way unfortunately I dont know consult withyour device CM devs for more details And hey most of thesedevices are on new usb gadget so dont need my guide at all

ltltAfter addition save stringsxml and go to resxml in the sameframework-resThats where you also should use baseframework-rescopy from base to miui storage_listxml and replace whenprompted That file provides only your device-specific SDsupport not nexus S or whatever miui base you use Assemble miui framework-resapk and attention disassembleit again That action allows you to see resource ID-s for eachline exactly in manner they will be used in living rom

RemarkEach resource-drawable string boolean switcher etc istreated by its ID - personal identificator Resources are used inother frameworks and APK to identify something necessaryfor them framework-resapk is a resource storage whichhandled by androidcontentres package classes likeResourceManager

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 22: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2234

USB subsystem also uses some resource to provide to useractual USB status and right mass storage

ltltMake sure you have both base and miui framework-res thenopen both resvaluespublicxml

Now we could start the main part - servicesjar modAfter adding line config_legacyUmsLunFile there will be itsid in publicxml after compiling Thats why I stand you shoulddisassemble assembled framework-res again Remember bothID-s from base and from miuiAlso you need ID-s from both base and miui for followingresources

stat_sys_adb - usb debugging iconadb_active_notification_title - usb debugging shortmessageadb_active_notification_message - usb debugginglong messageJellyBean-specificconfig_oemUsbModeOverride - usb mode override flag

Remarkpublicxml is a resource dictionary example of line

Code

ltpublic type=drawable name=stat_sys_adb id=0x010804f8 gt

means as follows public type=drawable drawable - merepicture for different resolution drawn on the screen publictype subsequently is a type of resource name=stat_sys_adb- name of resource that may be name of acual file or string orbool define etc id=0x010804f8 - hexadecimal resourceidentifier Important note most resource users are treatresource name without leading zero for example 0x010804f8in usb smalis presented as 0x10804f8 that fact will benecessary on finding and replacing resources(Id call itmatching process) exactly what we are going to do with USBfolder smalis

ltltOpen USB folder in miui servicesjar(smalicomandroidserverusb) you will see smalis as usualReplace its contents with those in base servicesjar usb folderThen we are going to match resources each ID you found inpublicxml should be bound to resource call in smali Letsstartwe will work with miui usb folder smalis OpenUsbServicesmali now remember what id was bound to

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 23: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2334

config_legacyUmsLunFile in base publicxml for example itwas 0x01040029 eliminate leading zero and search filecontents for resource 0x1040029 so you will find its entryReplace that entry with resource you got from publicxml inmiui again without leading zero Search for the same ID inLegacyUsbDeviceManagersmali and replace it to miui oneIf you got how that process work remaining task is matchother resource id-s that listed above (usb debugging iconlong and short message) They will be in following files

LegacyUsbDeviceManager$LegacyUsbHandlerUsbDeviceManager$UsbHandler

JellyBean-specificUsbDeviceManagersmali also contains necessary switch -config_oemUsbModeOverride also match ID-s with miuiframework and here you go

USB debugging message is not so necessary as mass storage[coz if resource of mass storage file not found you wont getusb subsystem to work]After matching is done assemble servicesjarDone USB subsystem now worksAnother moment could be necessary is to change USB tetherinterface device to usb0 (as Nexus S is using rndis0 insteadand base whatever you choosed may also have anothertether interface)To change it you again need a disassembled framework-resapk(dont forget apktool if) In it navigate toresvaluesarraysxmlfind the following

Code

ltstring‐array name=config_tether_usb_regexsgt

in nexus S full block will look like thatCode

ltstring‐array name=config_tether_usb_regexsgt ltitemgtrndis0ltitemgt ltstring‐arraygt

Look I highlighted interface name for you So the only partyou should do it is just replace it to yours Example for usb0

Code

ltstring‐array name=config_tether_usb_regexsgt ltitemgtusb0ltitemgt ltstring‐arraygt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 24: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2434

Interface name could be seen in the same file but in base romBy The Way do you see

Code

ltstring‐array name=config_tether_wifi_regexsgt ltitemgtwl01ltitemgt ltstring‐arraygt

right after usb one That is the interface for wifi tetherthat you also should change to yours (one your base needed)and that is it I saw somewhere following interface variant

Code

ltstring‐array name=config_tether_wifi_regex[B]gt ltitemgttiapdltitemgt ltstring‐arraygt

which is for Sony [Ericsson] devices with Texas Instrumentswifi chip just see yours in base to check this out

in the same file you may also fix Autobrightness levelsI mean those ones

Code

ltinteger‐array name=config_autoBrightnessLevelsgt ltinteger‐array name=config_autoBrightnessLcdBacklightValuesgt ltinteger‐array name=config_autoBrightnessButtonBacklightValuesgt ltinteger‐array name=config_autoBrightnessKeyboardBacklightValuesgt

MIUI doesnt have autobrightness tweaks so that is the onlyway those levels could be applied

To fully close framework-res and dont come back no morelets see other things you could do with it

Minimal brightness too lowThere is a bug with brightness when you regulating it tominmal screen comes black and wont come back until wipeReason is banal - screen highlight couldnt handle so low value(in nexus S its 10) first of all find a line atresvaluesintegersxml

Code

ltinteger name=config_screenBrightnessDimgt10ltintegergt

in most cases value 20 will be reliable so change 10 to 20Code

ltinteger name=config_screenBrightnessDimgt20ltintegergt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 25: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2534

Fix Network wont automatically picks upThe problem on some devices like HTC on 7x30 QCarchitecture is in one little switch [resvaluesboolsxml]

Code

ltbool name=skip_restoring_network_selectiongt

just change it to falseCode

ltbool name=skip_restoring_network_selectiongt

and network will come up

Fix Deep sleep issue on some devicesProblem reported Wildfire S users resolved by that littledefine [resvaluesboolsxml]

Code

ltbool name=config_bluetooth_adapter_quick_switchgt

change it to falseCode

ltbool name=config_bluetooth_adapter_quick_switchgt

and issue will be resolved

Also it might be interesting to check out all boolsxml definesto see if something should be changed

Fixing wrong hardware-software keyboardrelationship [auto-rotate and showing issues](also for galaxy tab 7)Those with built-in hardware keyboard may experiencingfollowing issue when hardware keyboard opened you alsosee a software keyboard and when you just need a softwarekeyboard it wont show Also auto-rotate wont workproperly when keyboard is activated Seems on Galaxy Tab 7 Samsung(or maybe Cyanogen Mod)handles software keyboard in relation of some kind of dummyhardware keyboard so its our case too ICS-onlyTo fix that issue disassemble miui androidpolicyjar andnavigate tosmalicomandroidinternalpolicyimplPhoneWindowManagersmalithere are three constants according to the source 0(0x0) - lid

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 26: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2634

closed 1(0x1) - lid open and -1(-0x1) - lid absentthey are located after a function GetSwitchStateOriginal idea was to swap these constants so that system getsfooled about your keyboard statecode that exists

Code

const4 v1 0x1

-gt code that you will get after modCode

const4 v1 0x0

the same you should proceed with zeroCode

const4 v1 0x0

-gtCode

const4 v1 0x1

you might also have to change Code

const4 v1 ‐0x1

-gtCode

const4 v1 0x1

to get rid of absent state

another ways to fix this upresvaluesboolsxmlchange

Code

ltbool name=config_forceDisableHardwareKeyboardgt

-gtCode

ltbool name=config_forceDisableHardwareKeyboardgt

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 27: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2734

as we see it force-disables hardware keyboard so that onlysoft one will show upfor devices with hardware keyboard that might also be a dealresvaluesintegersxmlchange the following two line

Code

ltinteger name=config_lidOpenRotationgt90ltintegergtltinteger name=config_lidKeyboardAccessibilitygt1ltintegergt

Next questions will be related to various APK fixesbefore we start you need to know that all apk are depend onframework-res resources so before you start disassemblingthem lets clarify steps apktool if each framework withresources you have in miui in stock there are two

Code

apktool if framework‐resapk

Code

apktool if framework‐miui‐resapk

then each apk could be disassembled as usual

Getting rid of MIUI start screenHave you mentioned it Ya that annoying setup wizard Inthe end it suggests you to input your XIAOMI account whichsome users may never had and wont create Keep them outof stress - get rid of that wizardLet me show howthere are 2 ways one - fully infiltrate that wizard from userseye second - will let you choose a language(useful inmultilanguage releases) and setup wifi then go right tohomescreenCommon moment disassemble Provisionapk and go to smalicontents - comandroidprovision and chooseDefaultActivitysmaliFirst method - codename infiltrationwe will modify contents of isProvisioned method Kill all except const4 v1 and return v1 in it change const4v1 to 0x1 so you will get something like that

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 28: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2834

method private deviceIsProvisioned()Z locals 3

prologue const4 v1 0x1

return v1

actually we are just saying to setup wizard that device isalready passed its steps and dont need them anymore Sothat setup wizard wont even be showedSecond method - codename multilangit is based on exploit which is as follows one could bypassxiaomi account prompt if before flashing miui he pull off simcard and then on setupwizard wont set up wifi Wizard willsend you to sim not found dialog which then will allow oneto dismiss account requestLine which asks about SIM state is as follows

Code

invoke‐virtual v1 LandroidtelephonyTelephonyManager‐gtgetSimState()I

then Code

move‐result v1 const4 v2 0x5

some variable now consists of returned value To initialte that value to fail a check Ive just changedconstant value to one that telephony manager will neverreturn -0x5

Code

const4 v2 ‐0x5

Now its time to point fail to logical end of wizard we aregoing to change label

Code

if‐ne v1 v2 cond_5

if not equals v1 v2 (if (v1=v2) in С manner ) go to labelcond_5 As we stated v1 wont be equal v2so it will go tocond_5 which is not a place we wish to go (coz ofunbelieveable hardcode) But there is a wishable place -cond_6

Code

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 29: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 2934

invoke‐direct p0 LcomandroidprovisionDefaultActivity‐gtfinishSetup()V

yyyyeah right to finish so we are changing cond_5 to cond_6

Code

if‐ne v1 v2 cond_6

thats it In the end you will get language selection-gtwifisetup-gthomescreen almost briliant

Whether you choosed first or second method - assemble apkyou got after all things done

Fixing not working mic in callsDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=send_mic_mute_to_AudioManagergt

-gtCode

ltbool name=send_mic_mute_to_AudioManagergt

Fixing pin code prompt on xperia devicesDisassemble Phoneapk and navigate to resvaluesboolsxmlto change

Code

ltbool name=ignore_sim_network_locked_eventsgt

-gtCode

ltbool name=ignore_sim_network_locked_eventsgt

Enabling hidden settingsDid you know that you may activate LEDs settings Or maybeuse camera key to trigger some useful functions If notfollow the next little tutoDisassemble Settingsapk navigate to boolsxml in resvalues

Activating LED settingsIt would be enough to change

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 30: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3034

Code

ltbool name=has_ledgtfalseltboolgt

-gtCode

ltbool name=has_ledgttrueltboolgt

As you may got other hidden settings are also there Ill justlist them and assume all of them needs just replacement falseto true to make them activated

Multitouch gesturesStill didnt mentioned how they works but xiaomi wouldntmake something just for its appearence in settings

Code

ltbool name=has_multi_touchgtfalseltboolgt

MI buttonMi button on any device that has camera button What is MI button Its a tweak that allows dedicated buttonto do something instead of its mere function (for example-issuing camera app as for cam button) You may adjust anyapp in rom to be executed any switch from miui switchersand also trigger some actions like menu call screen offtoggle(allows you to switch screen on and off so possiblyreplace power button which is mostly weak) and screenshothow to activate it - the same

Code

ltbool name=has_camera_keygtfalseltboolgt

change to true

Dock settingsmere dock station settings dialog

Code

ltbool name=has_dock_settingsgtfalseltboolgt

Trackball settingsfor devices such as nexus one with active trackball

Code

ltbool name=has_track_ballgtfalseltboolgt

Black bar fix

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 31: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3134

[ View ]

more details - httpswwwdropboxcoms6u63tozthm7-09-49-09pngLets get MiuiSystemUIapk and disassemble itLocate to resvaluesdrawablesxml and delete first line

Code

ltitem type=drawable name=notification_header_bggtff000000ltitemgt

it might vary but always contains black colour (ff000000)Recompile modified systemUI

Least but hope not last define for that guide hope it will fillup with latest and greatest from MIUI devices users andporters around the world Cheers L_F

Last edited by Lens_flare 4th November 2012 at 1108 AM ReasonJellyBean

The Following 104 Users Say Thank You to Lens_flare For This Useful Post

Finally Come up with great Tut Thanks Alot Brother

resac

17th July 2012 0129 PM | 5

Senior Member

Very detailed and good written tutorial Thanks and good job

milad407

17th July 2012 0935 PM | 6

Guest

Thanks

Duarte777

17th July 2012 1147 PM | 7

Recognized Contributor

Thanks 119

Thanks 0

Thanks 2019

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 32: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3234

[ View ]The Following User Says Thank You to Duarte777 For This Useful Post

[ View ]

AS my device bricked you could always tell me what toreplaceadd on my guide so it will look up-to-date

ADD added Stage 3

Last edited by Lens_flare 18th July 2012 at 0803 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

18th July 2012 0310 AM | 8

Account currently disabledOP

[ View ]

Done Have something to add Write here Ill form a newguide branch for you Found a mistake Contact me BTW if somebody have more time than I It would be greatyou could support that guide to keep it up-to-date

Last edited by Lens_flare 19th July 2012 at 0841 AM

The Following 3 Users Say Thank You to Lens_flare For This Useful Post

Lens_flare

19th July 2012 0838 AM | 9

Account currently disabledOP

Thanks for the detailed guide I just started porting for mydevice I have one question though Once I successfully portto one version what are the files I need to consider for nextversion I think some files I can just use from the previousport (like hardware related files) If you have any suggestionson the files I have to look for while porting next version ofmiui it will be very helpful Not sure whether I am asking theright question Looks like once I do this I can reuse all the filesfor next port

Last edited by raj_k_r 19th July 2012 at 0716 PM

raj_k_r

19th July 2012 0644 PM | 10

Senior Member

Thanks 2467

Thanks 2467

Thanks 92

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 33: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3334

[GAPPS] The Gapps Central - Consolidated Gapps [Updated 3hellip 26th March 2015 Android Software Development

[ARMARM64] Android 50 Lollipop bootanimation memory lehellip 16th February 2015 Android Software Development

[UNIVERSAL] QuickBoot for CyanogenMod 120 121 14th April 2015 Android Software Development

[WiFi] DHCP accelerator 6th February 2015

Android Software Development

[MOD][42+51][BeatsAudio]+[Dolby Digital]+[BraviaEngine3]hellip 13th February 2015 Android Software Development

[APP][ROOT] Change lock Screen on CM12 V26 19th March 2015

Android Software Development

[ROM] [KERNEL] [KitKat 442] BQ Aquaris 45 (MT6577) | Malahellip 11th February 2015 Android Software Development

[KITCHEN][WINDOWS] Android (Tyrancy) Kitchen for Windowhellip 15th March 2015 Android Software Development

Previous Thread Next Thread

xda-developers Android Development and Hacking Android Software Development [GUIDE][ICSJBcommon] Definitive FAQ for newest miui porting by Lens_flare

Post Reply Subscribe to Thread

Page 1 of 282 1 2 3 11 51 101

Last

Top Threads in Android Software Developmentby ThreadRank

XDA Developers was founded by developers for developers It is now avaluable resource for people who want to make the most of their mobiledevices from customizing the look and feel to adding new functionalityAre you a developer

Were Social

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb

Page 34: GUIDE Hacking Android

152015 [GUIDE][ICSJBcommon] Definitive FAQ for nehellip | Android Development and Hacking | XDA Forums

httpforumxdashydeveloperscomshowthreadphpt=1777999 3434

-- XDA 2015

Sitemap

Contact Rules Change Log Suggest Content Privacy Policy XDA App Root Any Device

More info

Copyright copy xda-developers Hosted by Leaseweb