1. Add the resource to the corresponding directory in frameworks/base/CORE/RES/. Assume that the resource to be added is of the drawable type, if the file name is test (the suffix may be XML or PNG), put the file under frameworks/base/CORE/RES/drawable.
2. Modify framework/base/CORE/RES/values/public based on existing system resources of the same type. XML, public. there are two types of resource descriptions in XML, one is <Java-symbol/> system private resources (not public to the app ), the other is <public/> public resources (which can be accessed in the app ).
If the resource to be added is private, add <Java-symbol type = "drawable" name = "test"/> (no ID is required ), if it is public, first find the public item whose last type is drawable, and 4.1.2 The last item in the system is <public type = "drawable" name = "dialog_holo_light_frame" id = "0x010800b3"
/>, And then add <public type = "drawable" name = "test" id = "0x010800b4"/>, that is, ID is the last Id + 1 (to avoid ID conflict)
3. Execute mmin frameworks/base/CORE/RES/, compile and generate framework-res.apk, and update COM. android. internal. r. The file corresponding to this R is/out/target/common/R/COM/Android/Internal/R. java, you can check whether your resources have been added in this file. (If a mm error occurs, run the "Touch resource file" command first)
4. If a public resource is added, run make Update-API in the source code directory to update the frameworks/base/API/current.txt file.
5. Make in the source code root directory.
In addition, if you want to add a new ID in the system, for example, myid, the first step is in frameworks/base/CORE/RES/values/ids. add a column <item type = "ID" name = "myid"/> in XML. The subsequent steps are the same.
Note: in source code 4.2, the system private resources are separated into separate files symbols. XML, and public resources are still in public. xml.
Original translated from: http://blog.csdn.net/june5253/article/details/8351448