FORUMS

What Do You Think About Fingerprint Scanners?

More and more phones are featuring fingerprint scanners, and with many promising … more

What’s Next for Samsung and Its Flagships?

If we were to say that the Galaxy S6 was a leap of faith made by Samsung, we … more

The Ultimate Showcase of dBrand Skins

In the search for ways to protect, accessorize, and personalize; a user has many options. One … more

Huawei’s Rapid Rise to Third Place in the Smartphone Race

Huawei has quickly grown to become one of the world’s biggest … more

[GUIDE/TIPS] How to Port OEM Apps / Vendor Apps to Your Current ROM

1,485 posts
Thanks Meter: 15,368
 
Post Reply Subscribe to Thread Email Thread

INTRODUCING

Hello XDA Community
I just want to share TIPS how to port OEM/VENDOR Apps to your current ROM

Requirement :

1. Knowledge in decompile/recompile/sign/zipalign apk file (apps)
- If you don't know how to do this, visit this thread http://forum.xda-developers.com/show....php?t=2195680

2. Knowledge to find library file (*.so file) and framework file (*.jar) whats needed from apps
3. You should understand MANAGING APPLICTAIONS it help on making update into system like porting APPS
- if you don't know how to do this, visit this post http://forum.xda-developers.com/show...42&postcount=2
4. Knowledge to use LogCat
- if you don't know how to do this, visit this thread http://forum.xda-developers.com/show....php?t=2274119

What should i do now? :

1. First times you need download Full ROM is there already deodexed so you can take some file you need to ported or you make it by yourself
2. If you already understand what i said above, lets start to final section
3. If you already take all file what you need to port, collect all the files, and prepare update.zip updater, add the file to zip with right folder

*.Apk file must be in system>app or priv-app
*.So file must be in system>lib
*.jar file must be in system>framework
*.xml file permissions framework must be in system>etc>permissions

How can I know what's library is needed? :

1. Knowledge is in need if the library doesn't exist in apk file, locate the name of the library file (*.so file) that may be related to the application (the file name may be a bit the same with the application) you can search in system>lib or use using a logcat after installing apps, you will see a missing library like :
FATAL error can't find class blablabla something like that

2. If library file already exist in apk file /folder lib>armeabi (You just need to extract it from apk file and take the file *.so)


(Taking *.so files)
Example for all applications

NOTE For Lollipop : Google has change structure of an applications in system that every applications having lib folder itself, it make more easy to locate lib files

Quote:

- Open SemcAlbum.apk using winrar/rar and extract folder lib then remove folder lib from that app

- Rename com.sonyericsson.album.apk to SemcAlbum.apk
- Create folder with same name with apk name (SemcAlbum)
- Under that folder create folder lib
- Under lib folder create folder arm
- navigate to the extracted lib before, move *.so files from armeabi-v7a if exist or armeabi into SemcAlbum/lib/arm/

3. To see what's apps required library framework file :
- Decompile apps with using file framework-res.apk from that ROM apps (Also maybe need framework 2 like SemcGenericUxpRes.apk etc)
- Open AndroidManifest.xml using Text Editor (Like NotePad++) and see like this line

Quote:

<uses-library android:name="com.sony.device" android:required="true" />

Quote:

<uses-library android:name="com.sony.device" android:required="false" />

Leave file has been decompiled and Take it file name (In list AndroidManifest) from the ROM file that you want to ported from system>framework also take permission framework file (*.xml) from system>etc>permissions

Example :
com.sonyericsson.navigationbar < it mean jar file, so you should take the file from system/framework

framework files need xml file permissions
com.sonyericsson.navigationbar.xml file, so you should take the file from system/etc/permissions


Explaination :
What The different true & false?
true : the application is required that framework to work
false : the application is still required that framework but without that framework the application can still work but some feature that need framework files will not work.

This section is not modified the apps, first you can try flash it with Recovery and see its working or not, if not working (FC) you need to see whats wrong in logcat (FATAL ERROR)

Or the problem apps parsing error because your Android Version is lower (e.g apps JB to ICS)

Now you need to decompile that apps

Go to smali folder and search whats wrong in logcat, if you already fix it (I will explain how to fix it in next post)

Then open AndroidManifest.xml try to change minimal sdk version from Android_manifest or in apktool.yml
Code:
minSdkVersion: '16'
targetSdkVersion: '17'
Change to this number
Code:
minSdkVersion: '14'
targetSdkVersion: '17'
save all changes
then recompile, sign and zipalign

NOTE :
1. Not any apps can be ported to lower Android Version by change minimal sdk
Last edited by Rizal Lovins; 20th May 2015 at 04:55 PM.
The Following 110 Users Say Thank You to Rizal Lovins For This Useful Post: [ View ]
 
 
9th October 2013, 03:24 AM |#2  
Rizal Lovins's Avatar
OP Recognized Developer / Recognized Themer / Recognized Contributor
Flag Bandung - One Lord To Rule Them All
Thanks Meter: 15,368
 
Donate to Me
More
Analizing app force close and how to fix it

Well in this post i will explain how to fix force close app that you are trying to port
Typically applications that do not work is because several factors:
Quote:

1. Missing library framework
2. Missing *.so files
3. Java Method or function that do not match with your current ROM

1. Missing library framework
Quote:

You should look at AndroidManifest.xml what app needed framework files, see screenshots!

take the file name like on AndroidManifest.xml in system/framework and take xml permissions files from system/etc/permissions

2. Missing *.so files
Quote:

This is really confused how to find what app is need *.so files
The solution is install the app and take a logcat!

The log will say something like this :
example (can't find class libUXVisualizer blablabla)

then you just search on system/lib for libUXVisualizer.so from the ROM you want to port and take it!

3. Java Method or function that do not match with your current ROM
Quote:

There is many factors that make app force close, but in SONY Apps usually only error "GetString". if you are trying to port SONY Apps to your current ROM (E.g. CM Based ROM) you will face same issue like this.


What should i do now after i see this log?

Ok let's start!!!
1. Decompile apps with using file framework-res.apk from that ROM apps (Also maybe need framework 2 like SemcGenericUxpRes.apk etc)
2. Go to folder smali/com/sonyericsson/metadatacleanup/util/
3. Open StorageManagerIf.smali using text editor
- Find .line 262 and see like this!

4. Decompile your framework-res.apk
- Go to folder res/value/
- Open Public.xml using text editor
- Following StorageManagerIf.smali in .line 262 there is code look like this

Code:
const-string v2, "storage_internal"
RIGHT?
- SO Search storage_internal in Public.xml in your framework-res.apk

copy the code and change the code look like this!
Code:
    const-string v2, "storage_internal"

    invoke-direct {p0, v1, v2}, Lcom/sonyericsson/metadatacleanup/util/StorageManagerIf;->getString(Landroid/content/res/Resources;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_0
Shrink code to
Code:
const v2, 0x10405ad
So it will look like this
Code:
 .line 262
    .local v0, "description":Ljava/lang/String;
    const v2, 0x10405ad

    if-eqz v2, :cond_0

In screenshot logcat say there is many error, you should search similar code like before "storage_sdcard" & "storage_usb" and follow changing code guide like before!!! also search in other smali that same error like that.

If you are done, save all change then recompile apk and sign apk

CONGRATZ YOU ARE DONE.
Last edited by Rizal Lovins; 20th May 2015 at 04:19 PM.
The Following 28 Users Say Thank You to Rizal Lovins For This Useful Post: [ View ]
9th October 2013, 03:25 AM |#3  
Rizal Lovins's Avatar
OP Recognized Developer / Recognized Themer / Recognized Contributor
Flag Bandung - One Lord To Rule Them All
Thanks Meter: 15,368
 
Donate to Me
More
CREDITS :

Thanks to @Lasan for the trick @ibanez7 for always helping me if i stuck
Last edited by Rizal Lovins; 20th May 2015 at 03:55 PM.
The Following 30 Users Say Thank You to Rizal Lovins For This Useful Post: [ View ]
9th October 2013, 04:37 AM |#4  
vanitea's Avatar
Senior Member
Flag bandung
Thanks Meter: 60
 
More
Thumbs up nice thread
Thanks for it......
but still waiting for more detil tuttor, give some example to port apk from sony to all android device
because i wana be RC-RD like you

you are realy great RC-RD here
The Following User Says Thank You to vanitea For This Useful Post: [ View ]
12th October 2013, 10:28 AM |#5  
Rizal Lovins's Avatar
OP Recognized Developer / Recognized Themer / Recognized Contributor
Flag Bandung - One Lord To Rule Them All
Thanks Meter: 15,368
 
Donate to Me
More
Quote:
Originally Posted by vanitea

Thanks for it......
but still waiting for more detil tuttor, give some example to port apk from sony to all android device
because i wana be RC-RD like you

you are realy great RC-RD here

you are welcome my friend

Yeah i will post with all detail later, now just uploaded some screenshots

No!!! i'm not developer
The Following 5 Users Say Thank You to Rizal Lovins For This Useful Post: [ View ]
15th October 2013, 04:28 PM |#6  
vanitea's Avatar
Senior Member
Flag bandung
Thanks Meter: 60
 
More
Talking nice update
Quote:
Originally Posted by Rizal Lovins

you are welcome my friend

Yeah i will post with all detail later, now just uploaded some screenshots

No!!! i'm not developer


yeah more understod with screenshot, thanks my bro

and i'm sorry about RD-RC........
i should write RT-RC
21st October 2013, 06:36 AM |#7  
TitaniumZERO's Avatar
Senior Member
Flag Johor Bahru
Thanks Meter: 90
 
More
Quote:
Originally Posted by Rizal Lovins

1. You must be right with signing the apps, because some apps from platform can't be sign with TESKEYS, you will get FC if you wrong signing mode

There is some signing key ;
- Auto testkey
- Platform
- Media
- Testkeys
- etc i forgot

Choose right signing with apps you want to ported

Sorry to ask, how do I determine the signing key?
22nd October 2013, 12:26 AM |#8  
Rizal Lovins's Avatar
OP Recognized Developer / Recognized Themer / Recognized Contributor
Flag Bandung - One Lord To Rule Them All
Thanks Meter: 15,368
 
Donate to Me
More
Quote:
Originally Posted by TitaniumZERO

Sorry to ask, how do I determine the signing key?

just try all signed tool for PC, like signing with private key etc, search at google to xda, or you can download zip signer in google play store in your phone, it's easy to use
The Following User Says Thank You to Rizal Lovins For This Useful Post: [ View ]
22nd October 2013, 09:39 AM |#9  
Junior Member
Thanks Meter: 0
 
More
Thanks!
25th October 2013, 05:52 PM |#10  
hard91's Avatar
Senior Member
Flag PATIALA
Thanks Meter: 204
 
More
Any tutorial for round switches in settings like homani framework
And xperia u phone book port to tipo ????
The Following User Says Thank You to hard91 For This Useful Post: [ View ]
30th October 2013, 06:19 PM |#11  
abo hani's Avatar
Recognized Contributor
Flag Latakia
Thanks Meter: 2,709
 
More
If i want to port Z1 Task Switcher ... or Z1 small apps like Calculator ...

EX ! should i edit jar files ? like services and framework.jar ....
Or just follow your method ?[COLOR="Silver"]

---------- Post added at 06:19 PM ---------- Previous post was at 06:19 PM ----------
@Rizal Lovins
Last edited by abo hani; 31st October 2013 at 01:52 PM.

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes