[Android] Calin:
Extra Features

​

This last part of the guide will be dedicated to the..... "hard features modifications", Yes let's call it in this way ! :)

I called it in this way because by meaning hard modifications i mean that we will gonna modify more files from not just one repo but more than one.

So i will start it with some minor modifications, but mainly this part will be left to the users, because if you got talent and made some cool modifications and want to share it on the thread, i will add them to the post by including also a propper guide to it ;)

In this post i will also include a difficulty level because as the modifications are not at the same level of all, i will include also a difficulty level in order to make it know to the Developer what he is dealing with.

As always if you got trouble just write in the thread the problem by following the schema written in the OP

That's all ;)

Manage and add new strings to Settings and override them in the compilation process

​

Difficulty level: (**°°°)

So, first of all here are the repos which we will gonna modify:

android_vendor_files

Settings (Repo)

Before continue let me give you a basic intro about what we are talking about.

For example when you are seeing a string in Settings (About phone for example) like the Version of the ROM, in order to display the version of the ROM the files beeing modified weren't just one but more than one.

So if you want to add a new string which you know that is gonna to be modified many times like the version of the ROM to display something in Settings here is what you gonna need to do:

At first let's take the Settings repo:

Now go to res/values

Now, here you have two options:

Or you take the default Strings xml and you will add there your new strings

Or you create a new xml file exactly as the Strings one is and you start adding yours there (Better this one in my opinion)

Now open Strings xml (The one created or the default one)

And create a new entry as the other ones

For example i made a string for the Revisions of my ROM.

Now you have to decide where to display this string.

In my opinion the better place is in About phone

So now go to the xml folder and search for:

device_info_settings.xml

Open it, and now create also here a new entry exactly as the others .

The only thing you need to modify is the android:title and the android:summary

If you don't need a summary of it you can just write only the android:title string as i did:

So after, we move to the Java part.

Go to src/com/android/settings

And search for:

DeviceInfoSettings.java

Open it, now you will need to create also here an entry for the new string so right after the last private static final String create another one like i did:

Now we will need to assign the value we are gonna override from the vendor files more exactly,

Find this string:

setValueSummary(KEY_MOD_VERSION,"ro.cm.display.version");

In this string for example we assign the value for the mod version which is the version of the ROM and we are assigning the value coming from the ro.cm.display.version which you all know that is coming from the build.prop but actually is coming from the vendor files :p

So do the same also for you string (Make sure that the string which the Settings one will read the value from build.prop to start with ro.)

Ok, so done that we can switch repo and go to the vendor files.

Now take the common.mk file which is located inside the config folder.

As i did an entry for the Revision number earlier in Settings, i will made an entry here:

I put it together with the build type because also this string offer informations regarding the ROM, thats' why, but you can put yours anywhere you want (But read always when you write something if it is in the right place)

Now the last thing to do is to Overrride the new value assigned in the common.mk to the desired String, as stated here:

So that's it you finally created a new string which it will gonna change in Settings everytime you change the value here in the Common.mk file.

To modify an existing one just follow the steps made earlier and you should be fine ;)

Add a device to your Organization and add dependencies

​

Difficulty level: (*°°°°)

Another thing to be added here is the one about how to add a device to your organization and to add also propper dependencies for your device.

As you remember when we worked on Android Build i told you to change this file:

roomservice.py

This file is very important if you want to add dependencies to your device when you want to build the ROM because if you don't have the Device sources cloned to your Main Repo folder the build environment will automatically go and download them all from the Organization.

These dependencies are very useful because avoid confusions and allow also to organize better your Organization.

So what you need to do ?

First go and clone your device tree for example (Not the vendor one) to your Organization

Image

I choosed the ariesve one which is mine.

Clone it to your desktop in order to work on it.

Now before to continue you need to think what dependencies to add i mean to be downloaded, usually the common ones are:

Kernel

Vendor (propietary)

But if you will need to add more repo, just need to follow the schema that i will show you now:

[
{
"repository": "android_device_samsung_ariesve",
"target_path": "device/samsung/ariesve"
"branch": "lollipop5.1"
}
{
"repository": "android_vendor_samsung",
"target_path": "vendor/samsung"
"branch": "lollipop5.1"
}
{
"repository": "android_kernel_samsung_msm7x30",
"target_path": "kernel/samsung/msm7x30"
"branch": "lollipop5.1"
}
]

This schema is just an example and is made for my device.

As you can see the schema is very simple and you can add as many repo as you want, the only thing to do when you save is to save it in this way: yourromname.dependenicies (all lower case).

We use this syntax to save the file, in order to make i t recognize to the build environment.

So if it's all good then when you will need to build for your device then the build environment will download all the dependencies needed by the device.

Note.

Make sure also to include all the repos needed in the dependencies because if the repo isn't located in the Organization then it will not be downloaded and it will be skipped automatically.