title: What is the most elegant way of striping AOSP of its pre-installed packages?
body: <p>I am trying to gradually stripe AOSP out of its default apps. But I wonder if the method I am going to apply is <strong>correct</strong> and is the most <strong>effective</strong>.</p>
  
  <p>After looking through ways of doing that I have come to the following <strong>method:</strong>(example app - "package_name")</p>
  
  <pre><code>1. Pick particular app and find out its "LOCAL_PACKAGE_NAME"
  2. Use "envsetup.sh" provided command "mgrep package_name"
  3. Look at the output to determine where package_name is mentioned
  4. Remove lines of code containing package_name from makefiles
  </code></pre>
  
  <p><strong>I have also stumbled upon this solution:</strong></p>
  
  <blockquote>
    <p>Instead of modifying bunch of .mk files in AOSP in many folders, you
    can add a <strong>new module, a stub</strong>, and disable modules in its
    Android.mk using LOCAL_OVERRIDES_PACKAGES. If a module still appear in
    target, you'll probably need to add to LOCAL_OVERRIDES_PACKAGES
    another modules which added undesired packages via
    LOCAL_REQUIRED_MODULES.</p>
  </blockquote>
  
  <p>But sadly I am not aware yet how one builds a new "module, a stub" so I can't apply this method as of now.</p>
  
  <p>Are there any steps I can take to make sure a particular app is <strong>removed</strong> from my build completely without <strong>harming</strong> anything. What do you think is the <strong>most elegant</strong> solution to this specific task if there is one? What(literature/docs/website)would be useful for me to get familiar with making "scratch-surface" changes to AOSP code like the abovementioned case?</p>
  
  <p>If that matters what I am trying to remove at the moment: Calculator; Calendar; Camera; Clock; Contacts; Files; Gallery; Messaging; Music; Phone; Search; WebView</p>
  
  <p>Thanks in advance for your responses!</p>