Porting modern TouchWiz: Notes from me - Sprint Galaxy Note 4 General

Today I wanted to talk about porting current versions of TouchWiz from one device to another. This will be focused primarily on the Sprint network capability since that is my current carrier. But these same basic steps will apply for all porting of TouchWiz.
I know several people have ported roms but I first want to point out one important fact. There is ABSOLUTELY no "guide" that can help you port TouchWiz roms successfully. Period. Any "guide" thread that you may find is completely useless and is isn't even close to touching on the key components of today's porting methods. So don't waste your time reading guides because they are very outdated and irrelevant today.
First things first... When deciding to port a Samsung Rom you need to understand that there are going to be different chipsets for the different device models used in other parts of the world. With this in mind you need to choose software that was originally designed for the same similar cpu whether it be Exynos or Qualcomm. This makes a huge difference when it comes to cpu configs that will best support your device's cpu. If you try to port an Exynos rom to work on a Qualcomm device then expect to have to do a lot more work in framework, etc.
GSM vs CDMA is another very important part of the porting process. When possible, ALWAYS choose software that supports your specific carrier and service type/technology!!! If you are on a GSM network then choose a GSM rom and same for CDMA. However CDMA technology here in the US is a bit different from other countries in regards to how it is setup in the software. Each CDMA carrier will have it's own unique code inside system files. Simply replacing csc and other files will do NOTHING to fix this, leaving you with either no data services or improper generic data services. The only way to do this right is to either start with software for your specific carrier or manually modify these values in multiple files throughout framework and system using the correct values from software specific for your carrier. No exceptions.
The other thing. You ideally want to port the same Android version that is currently available for your specific device because the original kernel and libraries, etc need to support the version of Android in which you want to port. When porting you will be using most of your original software's bin files, kernel, etc... so these files need to be compatible with the version of Android you want to port. Very important!
I will not go into great details with smali modifications, etc because that is a whole different animal. This thread is a general breakdown of what is involved in the whole process. Porting a ROM such as the Note 7 software is no simple task, especially with so many unknown obstacles that must be discovered then remedied. You will need the right tools for the job before you even take on such a task. I'm talking about ApkTool, smali/baksmali, mad genius mentality, etc. Without the proper tools forget about it.
The main things that must be done for the rom to even boot, reside internally inside a few framework jar files. There will also be incompatible system files which must be removed and/or replaced with compatible versions that support your specific device/model. You also may need to make the rom support 32bit such is the case with the Note 4, since it is only 32 bit compatible. There can be no traces of 64bit libraries either inside the system apps or the library folder or else you will have issues. 32 bit devices cannot process 64 bit libraries, whether external or imbedded inside system apps. The one exception to this rule is when an app is multi-arch compatible which means the app can be installed on either 32 or 64 bit devices. In this case the 64 bit libs can remain although they will not be used since the 32 bit libs will be detected by the os. Thankfully 64 bit TouchWiz contains 99.9% of the necessary 32 bit libraries! So use them instead if your device is only compatible with 32 bit architecture.
There are several key Android/Samsung services that are not going to be compatible with other Samsung devices therefore one must identify these incompatible services and other methods in smali and either remove them or recode them in order for the rom to function in a way that is compatible with the device for which you will be running the software on. Sometimes you can simply replace services from your original device's software as long as it is compatible and from the same Android version, but not always.
There is NEVER going to be a set of instructions that will apply to all ROMS. Period. This stuff is always ever-changing with each update that Samsung releases. This is why there can be no accurate "guide" to porting TouchWiz. Whoever says otherwise is not knowledgeable on this stuff at all.
Once the framework files are prepared and rebuilt properly then you will need to have knowledge of the stock system apps and what role they play in the software. Most system apps are cross compatible but some are device and/or carrier specific and must either be removed or replaced in order for the rom to boot and run without a complete meltdown with continuous FC's. Then you have CSC (customer service codes). This plays a major role in how the software will be setup on initial rom setup. Each specific device model will have it's own unique CSC, however most of Samsung's current CSC is identical between the current available top tier devices such as the N4, N5, S7 and N7. BUT each device will have it's own unique "values" within multiple files in CSC. Some Samsung devices are compatible with features that other Samsung devices do not support. Therefore you must have knowledge of this and make the necessary edits in order for the software features to be setup correctly without major malfunctions. One wrong value can actually cause the rom to not boot. You will need experience with this as well.
Next you may need to slightly modify the kernel's ramdisk to support a couple of additional framework files which is the case with the N7 software and probably the N5 as well. It's just a matter of adding a few file names to a text file, save, then recompile the zimage and place the modified kernel inside your rom zip. These types of things must be discovered by trial & error by people who are knowledgeable and have experience porting roms. But it goes to show that these little things can determine a successful or failed port. You never know what can cause the rom to not boot. There's so many pieces to the puzzle when porting.
Moving on to the build.prop and updater-script. There MUST be a lot of edits done to the build.prop and the same principal applies here. You MUST edit the build.prop in order for it to support the software AND your specific device model, cpu, security features, etc, etc. This is an art folks. Again... there is no "guide" for doing this properly. You must possess the mental aptitude to tackle this stuff. It's not for normal people The updater-script is a VERY VERY important part of the rom porting process because it contains the permissions and symbolic links for all of the critical system files and folders. You must manually edit the updater-script so that it sets the proper permissions and symbolic links for the files that are used in the current software you are going to run. You cannot simply use a stock device updater-script straight out of the kitchen for your specific device. It will not work due to other versions of TouchWiz will likely have additional or different files and folders in the rom. This will take a LOT of time to go over everything and make sure you covered everything and properly setup the updater-script.
Next there is the process of replacing critical and device specific libraries and bin files as well as kernel modules. Generally for Samsung devices, system/bin folder must contain all of the original files from the original stock software for your specific device. You might need to add additional files from the software you are porting. The same applies to the system/lib/modules. These modules MUST come from your device's original software. The libraries are very tricky because not all libraries can be from either your original stock software nor from the software you are porting. Simply put, this is going to be the single most time consuming process with a ton of trial and error. You must figure out which lib files must be used from your original software and which libs must come from the new ported software. Good luck figuring this out! :laugh:
This pretty much covers the initial areas of the system software that must be manually modified in order for the rom to actually boot.
As you can see, there's a lot of trial and error with porting roms. Believe me. Other people who ported the early N7 and S7 port ROMs have done a LOT of work and surely they have a lot of trial and error. These early port dev's deserve a lot of credit for these early discoveries without a doubt. Without their original trials and errors & hard work, there would be no other port roms. They shared their knowledge and it was a group effort in the beginning. You guys know who you are! :highfive: Much Thanks to all of you who figured out framework issues etc in the early stages of current TouchWiz. I learned a lot in this process in which I have never shared with the public simply because there's no point in giving information that others can't use due to lack of experience. Hopefully some people will read this and better understand what goes into porting these ROMs. At a later dat, I may write up a more detailed "guide" on current TouchWiz IF I feel there is a need and there is enough people willing to step up and help out the community in the future. This is the way XDA works. You have to pass the torch to win the race. No one person can conquer the world. Teamwork is the key to success in everything you do. Remember this. Thanks for reading.

Wow, very nice write up. Thanks!
I would be interested in a more detailed guide if and when you get to it. I'm always looking to expand my know - how.
Many thanks! :highfive:

Thanks for the post....
but you did not go in to ROM porting much at all... I'd love to read a in depth view of the " copy and paste " dev .

tx_dbs_tx said:
This will be focused primarily on the Sprint network capability since that is my current carrier. But these same basic steps will apply for all porting of TouchWiz.
GSM vs CDMA is another very important part of the porting process. When possible, ALWAYS choose software that supports your specific carrier and service type/technology!!! If you are on a GSM network then choose a GSM rom and same for CDMA. However CDMA technology here in the US is a bit different from other countries in regards to how it is setup in the software. Each CDMA carrier will have it's own unique code inside system files. Simply replacing csc and other files will do NOTHING to fix this, leaving you with either no data services or improper generic data services. The only way to do this right is to either start with software for your specific carrier or manually modify these values in multiple files throughout framework and system using the correct values from software specific for your carrier. No exceptions.
The other thing. You ideally want to port the same Android version that is currently available for your specific device because the original kernel and libraries, etc need to support the version of Android in which you want to port. When porting you will be using most of your original software's bin files, kernel, etc... so these files need to be compatible with the version of Android you want to port. Very important!
Click to expand...
Click to collapse
This was great. It was exactly what I was looking for. Ive being working on porting a gsm rom to my device N900P. But the only thing Ive found is copy and paste. Trying to find something on cdma is even harder. Ive just download your Ultimate Hybrid N7 to see if can get a clue on where to start. Deodexing telephony-common should be enough? Where else should start looking? If you could point me a direction would be great. Thanks

triskaw said:
This was great. It was exactly what I was looking for. Ive being working on porting a gsm rom to my device N900P. But the only thing Ive found is copy and paste. Trying to find something on cdma is even harder. Ive just download your Ultimate Hybrid N7 to see if can get a clue on where to start. Deodexing telephony-common should be enough? Where else should start looking? If you could point me a direction would be great. Thanks
Click to expand...
Click to collapse
Sorry for the late reply. To be honest, porting a gsm rom to work on a U.S. cdma carrier is going to require massive work. Forget about it. Start your rom project with cdma compatible software and save yourself the trouble. You'll win the lottery before you get a gsm rom ported over to cdma. Copy and paste isn't going to scratch the surface. Why not port a factory Sprint ROM for your Sprint note 3? Such as the Sprint N7, N5, S7 edge? It is already setup to work on the sprint network. It would save you a lot of time and effort.

Related

encrypted drivers/kernel?

All - following up on a post in AndroidForums which referenced a comment on the root story here. The comment (from Gee):
Correct me if I’m wrong, but I remember hearing that the drivers/kernel are either encrypted, unusable, or simply unavailable. Meaning that while you can root the Galaxy S and put custom ROMs, you still can’t put unofficial ROMs (like Cyanogen) on it without expecting to break a lot of functionality.
That means that you WONT be putting Froyo on it until Samsung officially releases the ROM which can then later be modified. And if Samsung moves away from the Galaxy S after that update, you’ll never see a fully functioning Gingerbread ROM. Ever. That’s a hard pill for me to swallow.
Click to expand...
Click to collapse
Can anyone shed further light on this?
Sounds counter productive. I heard they will be releasing source code. Would be odd if they kept the rest under wraps or took extra measures to prevent access....
Methinks this is definitely worth further investigation. Need some experienced SGS modders to find this thread...
From what I have seen, the drivers are provided in binary form only (which is basically the same as how drivers are provided on Windows). So long as there isn't some code written into the drivers that would prohibit their running on non-official ROMs, there shouldn't be any problem using the drivers in custom ROMs.
I downloaded the entire sourcecode from the samsung website. Its a 150MB zip file and everything is in there in binary form. It must be compiled. I'm certainly not a linux or android dev but it seems like thats what you need. There's even readme.txt files in there to tell you how to build new versions of software.
I'm wondering how long it'll take for someone to put out a custom ROM for the captivate based on 2.2?

Flash Stock Android Kernel (or Emulator ROM)

Hey,
I've just recently started Android development and I'm keen to learn as much as I can about the whole system, not just about SDK app development. As such I'm interested in attempting to build my own ROM completely from scratch. I've downloaded the Android Source (and Galaxy S source) and would like to try my luck.
First I've been mucking around creating custom ROMs with the emulator, moving apps from the Galaxy S ROM I dumped from my device onto the stock emulator ROM and testing things out.
Anyway I'm at the point where I'm wondering if it's possible to flash the stock emulator ROM onto a Galaxy S phone? I know the Galaxy S source includes a lot of device specific stuff however I'm not interested in getting the camera, bluetooth or anything hardware specific working just yet.
If I flash a ROM with a stock kernel, drivers etc. onto my phone will it work? Has anyone done this? Will it just brick my phone?
Any help would be appreciated.
Cheers,
Ben
Anyone?
Also, I know people have flashed AOSP ROMs on other phones, does anyone know if they required modifications or whether they are in fact stock ROMs?
nje, can't work. why?
1) different bootloaders
2) different partition layout
3) different (kernel)drivers
4) different vendor setup
etc.
it is possible to flash the emulator image onto a dev device (dream/sapphire) but even then a lot will not work properly!
if you want to learn about the android architecture you should start with building a kernel (there is already a thread about that here) and playing around with stuff like the (file)system and utilities...
Thanks jodue.
Yeah my long term intentions were definitely to build the Galaxy S kernel and any necessary libraries and drivers specifically necessary for the apps I decide to include in a custom ROM.
I was hoping that I'd be able to start out by tweaking a minimalistic/generic ROM (the AOSP default ROM) on my Galaxy S. However, as you've pointed out I'll have to start out with the kernel and all the device specific stuff first.
I've got quite a bit of information on building an Android/linux kernel both from the thread you mentioned and also the official AOSP page. However information on putting together a complete working ROM seems a bit sparse. Does anyone know where I can find some information on the topic?
I'm also curious to learn about the list of things jodue mentioned i.e. Android bootloaders, partition layouts and drivers (generic and Galaxy S specific). I assume detailed information about particular devices and drivers probably isn't available but if anyone even knows where I can learn detailed information about default AOSP ROMs I'd be extremely interested know.

[Q] Galaxy s4 I9505 with Google edition andriod

Hello guys, i just have a (few) question(s)
So, last week i installed Google Edition Andriod Kitkat 4.4.4 on my galaxy S4 I9505.
This rom is till now, still amazing, fast and better than touchwiz in any way. But i can't seem to find on the internet how and which version of xposed framework i need to install, since it is per model (i think?) which model do i choose?
since i have a Galay S4 but my rom is not from a galaxy S4, i get confused which one i have to install.
Some links to downloads would be great!
Thanks in advance
Dylan
dylanbos1996 said:
Hello guys, i just have a (few) question(s)
So, last week i installed Google Edition Andriod Kitkat 4.4.4 on my galaxy S4 I9505.
This rom is till now, still amazing, fast and better than touchwiz in any way. But i can't seem to find on the internet how and which version of xposed framework i need to install, since it is per model (i think?) which model do i choose?
since i have a Galay S4 but my rom is not from a galaxy S4, i get confused which one i have to install.
Some links to downloads would be great!
Thanks in advance
Dylan
Click to expand...
Click to collapse
Hi mate
Basically it works in any android 4.0 + base rom device see from one of his threads
For which devices/ROMs does it work?
I develop the Xposed framework based on the AOSP sources. I'm personally using CM10.2 on an I9100 (Samsung Galaxy S2, bought in Germany). Basically, it should work on any phone which with a ROM based on Android 4.0 or later and an ARM or x86 processor (this is the processor architecture, almost all smart phones and tablets have either of those). Exceptions might be ROMs which are different from the original Android code in some very internal, central code parts (which don't need to be touched for most theming and enhancement modifications). But this is related to the ROM, not the phone itself.
The modules target higher-level code, so they are more likely to be incompatible with your ROM. Basically, the question is whether the methods and resources which the module modifies are similar on your ROM and on the developer's ROM. Let's say a module needs to modify the result of a certain method call. For this, it needs to specify the exact name and parameters that identify that method. If the in your ROM, an additional parameter has been added, the module can't find the method anymore and won't work. If the method can still be found, it will probably work (unless the rest of the app/ROM has changed too much).
There is not definite answer whether it will work. Just try it (of course, making a nandroid backup before is never a bad idea). If it doesn't work, just disable the module. You might want to inform the module developer (not me!) about this fact and provide details (e.g. a logcat and/or the content of /data/data/de.robv.android.xposed.installer/log/debug.log).
Try with latest 2.6.1
http://forum.xda-developers.com/xposed/xposed-faq-issues-t2735540
http://forum.xda-developers.com/xposed/xposed-installer-versions-changelog-t2714053
Thank You!
MAX 404 said:
Hi mate
Basically it works in any android 4.0 + base rom device see from one of his threads
For which devices/ROMs does it work?
I develop the Xposed framework based on the AOSP sources. I'm personally using CM10.2 on an I9100 (Samsung Galaxy S2, bought in Germany). Basically, it should work on any phone which with a ROM based on Android 4.0 or later and an ARM or x86 processor (this is the processor architecture, almost all smart phones and tablets have either of those). Exceptions might be ROMs which are different from the original Android code in some very internal, central code parts (which don't need to be touched for most theming and enhancement modifications). But this is related to the ROM, not the phone itself.
The modules target higher-level code, so they are more likely to be incompatible with your ROM. Basically, the question is whether the methods and resources which the module modifies are similar on your ROM and on the developer's ROM. Let's say a module needs to modify the result of a certain method call. For this, it needs to specify the exact name and parameters that identify that method. If the in your ROM, an additional parameter has been added, the module can't find the method anymore and won't work. If the method can still be found, it will probably work (unless the rest of the app/ROM has changed too much).
There is not definite answer whether it will work. Just try it (of course, making a nandroid backup before is never a bad idea). If it doesn't work, just disable the module. You might want to inform the module developer (not me!) about this fact and provide details (e.g. a logcat and/or the content of /data/data/de.robv.android.xposed.installer/log/debug.log).
Try with latest 2.6.1
http://forum.xda-developers.com/xposed/xposed-faq-issues-t2735540
http://forum.xda-developers.com/xposed/xposed-installer-versions-changelog-t2714053
Click to expand...
Click to collapse
Thank you so much for your help. I think it is pretty clear for me now.
Dylan
dylanbos1996 said:
Thank you so much for your help. I think it is pretty clear for me now.
Dylan
Click to expand...
Click to collapse
Any time mate.

How to have official DocumentFile restrictions on Roms?

Hello all,
Starting of Android Lollipop (5.x), Google presented an official API for accessing the SD-card (among other things) called "DocumentFile" or SAF.
It's quite a restricted API compared to File, but that's the official way to use files.
Yet, up until now, because the File API was used for all apps, rom developers always chose to allow File API to be used and work even for SD-cards.
While this is nice for power users and maybe people who don't care about it, this is bad for me as a developer, because I need to have those restrictions (of forcing me to use the DocumentFile instead of File) as they exist on real stock roms.
It's not just me, but I've found a lot of apps out there that don't use the official API at all. Even "Total Commander", an app I'm still using, can't fully use it, as when I ask to send multiple files to it using DocumentFile, it fails.
Sadly, other than the real stock rom of Samsung (and not those based on them, or of course those like CM) , I can't find any rom that when using File API - it won't let me modify the sd-card files.
Now that Android 6 is coming, I think it might get even weirder, as there will be a new permission mechanism for storage.
My question:
Is there any rom or anything I can easily do (i'm not a rom developer) to have near-stock experience in terms of accessing the SD-card?
I hope I'm clear on this. English isn't my main language, so I've tried to find alternative ways to express what I want to talk about.
Maybe one of the GPE roms around here. But those are only for the GT-I9505 model.

help to edit Rom

What files do not change in the rom ?? Or what files can you change ?? For example , I have a phone version android 4,4 and want to become like 6.0 without downloading a new ROM just change some files until the interface change and statut bar and menu parametrs Plzz help me And what is the role of each files of system file
etc
Usr
Media
App
Framwark
Vondor
...
:crying:
This may or may not be relevant, but should be sufficient to describe the amount of work involved in theming.
The Dell Streak ran Android 2.3.x when it reached its end of life. At the time I had gotten my S4 I was the last person doing any actual work on the device. One of the things I made for that device was a theme named "Traveller ICS". Its goal was to port elements of the new (at the time) Holo styling in Android 4.0 to the older version of Android. A LOT of files were edited to make this happen, as all of them had drawable elements that needed changing.
F:\system\app\Browser.apk
F:\system\app\Contacts.apk
F:\system\app\DellSettingsProvider.apk
F:\system\app\DeskClock.apk
F:\system\app\Email.apk
F:\system\app\Gallery3D.apk
F:\system\app\Mms.apk
F:\system\app\Phone.apk
F:\system\app\Settings.apk
F:\system\app\SettingsProvider.apk
F:\system\app\SystemUI.apk
F:\system\framework\framework-res.apk
The included text file below lists all the files in just one of the apps listed above. Not every file will need to be altered, but virtually all the images will need to be changed, and more than a few XML files. The point of the matter here is that it is not an easy task to re-theme the whole of Android to look like Android 6.x. It's a lot of work, and given the existence of substratum, not worth the effort.
Change ROMs. Hard-coded theming of Android is a *****, and you don't want to do it if you don't have to.
EDIT: Please note, if you are attempting to modify a Touchwiz ROM to look like later versions, I don't know whether it's possible or not, but I seriously wouldn't try it with the Touchwiz framework either.
Strephon Alkhalikoi said:
This may or may not be relevant, but should be sufficient to describe the amount of work involved in theming.
The Dell Streak ran Android 2.3.x when it reached its end of life. At the time I had gotten my S4 I was the last person doing any actual work on the device. One of the things I made for that device was a theme named "Traveller ICS". Its goal was to port elements of the new (at the time) Holo styling in Android 4.0 to the older version of Android. A LOT of files were edited to make this happen, as all of them had drawable elements that needed changing.
F:\system\app\Browser.apk
F:\system\app\Contacts.apk
F:\system\app\DellSettingsProvider.apk
F:\system\app\DeskClock.apk
F:\system\app\Email.apk
F:\system\app\Gallery3D.apk
F:\system\app\Mms.apk
F:\system\app\Phone.apk
F:\system\app\Settings.apk
F:\system\app\SettingsProvider.apk
F:\system\app\SystemUI.apk
F:\system\framework\framework-res.apk
The included text file below lists all the files in just one of the apps listed above. Not every file will need to be altered, but virtually all the images will need to be changed, and more than a few XML files. The point of the matter here is that it is not an easy task to re-theme the whole of Android to look like Android 6.x. It's a lot of work, and given the existence of substratum, not worth the effort.
Change ROMs. Hard-coded theming of Android is a *****, and you don't want to do it if you don't have to.
EDIT: Please note, if you are attempting to modify a Touchwiz ROM to look like later versions, I don't know whether it's possible or not, but I seriously wouldn't try it with the Touchwiz framework either.
Click to expand...
Click to collapse
First thank you for helping me I downloaded the ROM S8 and installed it on the S4 by adding the files after the ROM S4 I understood my intention. But if there was a danger on the phone, tell me before spoiling the concert Change CPU values
Sorry, but you're going to have to figure that out on your own, because I don't have an answer to that question.
Strephon Alkhalikoi said:
Sorry, but you're going to have to figure that out on your own, because I don't have an answer to that question.
Click to expand...
Click to collapse
I am randomly asked because when I search I find edits on ROM cyanogenmod but I want to modify the ROM on an official
For example, I already have S4 on Android 6.0.1
Port ROM note7
I meant to download rom note7 edit to fit my phone

Categories

Resources