Android cutting system

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. Be sure to add reprint reprint https://blog.csdn.net/qq_23327993 https://blog.csdn.net/qq_23327993/article/details/90768627

1 Introduction

Probably a few months ago, I received some information, said many companies out Android industrial system redundancy, want to do some streamlining, but no matter the time of the author or the author now. Is a big rookie ah, hear the system to streamline the operation, ignorant moment to force the first time to perform this task, represents pear big ~

2. The text

But in this work, we had to do, after a series of Baidu, Google. emmm ..., we have some idea, summed up what most of this is to streamline the way.
Android system architecture can follow to carry out some action.
1. The driver layer clipping
cut 2.Android native layer services.
Crop 3.Android frameworks layer services.
Crop 4.Android APP layer.
Because I experience in this area is not very full, choose the simplest one kind of crop -APP layer, first get rid of the excess of APP, four inside but the easiest is to me a rookie and made a serious accident flow, ah, to say what a difficult journey. . .

First of all, we have to know if Android APP involved in compiling and compiling a variable has a direct relationship. This variable compared PRODUCT_PACKAGES we have seen, the Android source mk born in, or vendors will have a custom mk assignment to this variable. What variables to the variable assignment is it?
Let's just find the APP mk look.
Here Insert Picture Description
This is a system application of mk Music files: packages / apps / Music / Android.mk
can see my red mark a variable: LOCAL_PACKAGE_NAME This is the module name for each module, corresponding to the name of APP APP is
so, see here, I sprouted a few ideas can be "cut APP system layer"
1. the name of this variable is assigned to the LOCAL_PACKAGE_NAME get rid of.
2. Locate the module name PRODUCT_PACKAGES variable LOCAL_PACKAGE_NAME corresponding deletion.
3. violence point, the APP directly to the source code to delete.
I thought one by one to verify the above can be, the effect is very good, I have reached the goal of cutting, but calm down and think about it, this really appropriate?
This is a cutting of APP, then ten, one hundred, N a it? Each such operation, it is not will be exhausted? And overall management is also not very convenient?

The answer is, that several treatment methods to achieve the results we want, but! ! ! For the raw source code structure, management, and even artificial workload is extremely hostile.
So, what other way? Here come back to think, since the system is involved in the control module is compiled according to PRODUCT_PACKAGES to control this variable, then we might as well talk to with this thing in the end done?
Here is a blog, write well:
after reading it, is not want to see the Android source code structure build on this piece. I also would like to see, but I have already done so, to see build / core / main.mk the main core compile file for PRODUCT_PACKAGES this is how to do.
Here Insert Picture Description
Here you can see the control compile statement, if it is a full compilation. Which in turn will PRODUCT_PACKAGES variables involved in the compilation.
So the idea is not to come? We may use this variable, get yourself a deletion of APP variables: PRODUCT_DEL_PACKAGES
Haha, the first test is fast!
Step 1:
Since coming here Starting point: adding filters APP involved in compiling operation
Here Insert Picture Description
so do not forget this one thing, mentioned at the beginning of PRODUCT_PACKAGES assigned to another variable, then we have to get the appropriate place add.
Here Insert Picture Description
Do it here, we can happily be tailored Android APP layer with this PRODUCT_DEL_PACKAGES variables.
Since it is a customized product, we will be unified in device.mk operate it in.
To find the deletion of APP, APP here for how to find what they have to cut, where to APP, the author would not elaborate, I believe that secretly sent special easy to use a search command:. Grep -rn "xxx" This command means that all files that contain the search xxx in the current directory.
I make the final cut are as follows:
Device / qcom / msm8953_64 / msm8953_64.mk
Here Insert Picture Description
After this, we make clean -> make
the final burning mirror. Observation, flattered ah! APP want to delete all gone.
Well, Cipian end. We have a better way, or this blog inadequate, please let me know -

Ps we will be back deeper streamlined system through continuous learning, after I verified will continue to share other crop - also mentioned above, and we have not done it, ashamed. . . In addition, the system cut need to be cautious, and sometimes some very important things deleted uncomfortable, but I eat a lot of losses, he said it is tears ah

Guess you like

Origin blog.csdn.net/qq_23327993/article/details/90768627