am c3cee19c: fix version number for older security features

* commit 'c3cee19c8059fcfb5d41c6d6c1e28e834daf4efe':
  fix version number for older security features
diff --git a/scripts/build.py b/scripts/build.py
index 12bcb98..33a1e33 100755
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -14,21 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os
+import codecs
 import glob
+import markdown
+import os
 import shutil
 import string
 import subprocess
 
 
-# call markdown as a subprocess, and capture the output
-def markdown(raw_file):
-  extensions = '-x tables -x "toc(title=In This Document)" -x def_list'
-  command = 'markdown' + ' ' + extensions + ' ' + raw_file
-  p = subprocess.Popen(command, stdout = subprocess.PIPE, shell = True)
-  return p.communicate()[0]
-
-
 # read just the title (first heading) from a source page
 def get_title(raw_file):
   for line in open(raw_file, 'r'):
@@ -63,6 +57,11 @@
 category = 'home'
 parents = {}
 for curdir, subdirs, files in os.walk(SRC_DIR):
+  def md(path):
+    text = codecs.open(path, encoding='utf8').read()
+    extensions = ['tables', 'def_list', 'toc(title=In This Document)']
+    return markdown.markdown(text, extensions)
+
   print 'Processing %s...'  % (curdir,),
   # Step A: split path, and update cached category name if needed
   curdir = os.path.normpath(curdir)
@@ -86,19 +85,19 @@
     parent = ('', '', '')
 
   if 'sidebar.md' in files:
-    sidebar = markdown(os.path.join(curdir, 'sidebar.md'))
+    sidebar = md(os.path.join(curdir, 'sidebar.md'))
     del files[files.index('sidebar.md')]
   else:
     sidebar = parent[0]
 
   if 'sidebar2.md' in files:
-    sidebar2 = markdown(os.path.join(curdir, 'sidebar2.md'))
+    sidebar2 = md(os.path.join(curdir, 'sidebar2.md'))
     del files[files.index('sidebar2.md')]
   else:
     sidebar2 = parent[1]
 
   if 'sidebar3.md' in files:
-    sidebar3 = markdown(os.path.join(curdir, 'sidebar3.md'))
+    sidebar3 = md(os.path.join(curdir, 'sidebar3.md'))
     del files[files.index('sidebar3.md')]
   else:
     sidebar3 = parent[2]
@@ -112,15 +111,14 @@
     absfilename = os.path.join(curdir, f)
 
     if f.endswith('.md'):
-      main = markdown(absfilename)
+      main = md(absfilename)
       final = template.safe_substitute(main=main, sidebar=sidebar, sidebar2=sidebar2, \
           sidebar3=sidebar3, category=category, title=get_title(absfilename))
 
-      html = file(os.path.join(outdir, f.replace('.md', '.html')), 'w')
+      html = codecs.open(os.path.join(outdir, f.replace('.md', '.html')), 'w', encoding="utf8")
       html.write(final)
     else:
       shutil.copy(absfilename, os.path.join(outdir, f))
   print
 
 print 'Done.'
-
diff --git a/src/source/build-numbers.md b/src/source/build-numbers.md
index 07011aa..b0d581b 100644
--- a/src/source/build-numbers.md
+++ b/src/source/build-numbers.md
@@ -111,7 +111,8 @@
 IML74K | android-4.0.3_r1   | Nexus S
 IML77  | android-4.0.3_r1.1 |
 IMM76  | android-4.0.4_r1   |
-IMM76D | android-4.0.4_r1.1 | Nexus S, Nexus S 4G, Galaxy Nexus, latest IceCreamSandwich version
+IMM76D | android-4.0.4_r1.1 | Nexus S, Nexus S 4G, Galaxy Nexus
+IMM76I | android-4.0.4_r1.2 | Galaxy Nexus, latest IceCreamSandwich version
 
 The branches froyo, gingerbread, ics-mr0, ics-mr1, represent development
 branches that do not exactly match configurations that were tested
diff --git a/src/source/building-devices.md b/src/source/building-devices.md
index bbc0962..bf3132a 100644
--- a/src/source/building-devices.md
+++ b/src/source/building-devices.md
@@ -145,10 +145,10 @@
 
 Device   | Branch                       | Build configuration
 ---------|------------------------------|------------------------
-maguro   | android-4.0.4_r1.1 or master | full_maguro-userdebug
+maguro   | android-4.0.4_r1.2 or master | full_maguro-userdebug
 panda    | master                       | full_panda-userdebug
-wingray  | android-4.0.4_r1.1 or master | full_wingray-userdebug
-crespo   | android-4.0.4_r1.1 or master | full_crespo-userdebug
+wingray  | android-4.0.4_r1.2 or master | full_wingray-userdebug
+crespo   | android-4.0.4_r1.2 or master | full_crespo-userdebug
 passion  | android-2.3.7_r1             | full_passion-userdebug
 sapphire | android-2.2.3_r1             | full_sapphire-userdebug
 dream    | android-2.2.3_r1             | full_dream-userdebug
@@ -204,6 +204,7 @@
 2.3.6 (GRK39F)  | I9020XXKA3           | I9020XXKF1      | All previous versions
 4.0.3 (IML74K)  | I9020XXKL1           | I9020XXKI1      | All previous versions
 4.0.4 (IMM76D)  | I9020XXKL1           | I9020XXKI1
+4.0.4 (IMM76I)  | I9020XXKL1           | I9020XXKI1
 
 Nexus S (850MHz version "UC", i9020a):
 
@@ -216,6 +217,7 @@
 2.3.6 (GRK39F)  | I9020XXKA3           | I9020UCKF1      | All previous versions
 4.0.3 (IML74K)  | I9020XXKL1           | I9020UCKF1      | All previous versions
 4.0.4 (IMM76D)  | I9020XXKL1           | I9020UCKJ1
+4.0.4 (IMM76I)  | I9020XXKL1           | I9020UCKJ1
 
 Nexus S (Korea version "KR", m200):
 
@@ -227,6 +229,7 @@
 2.3.6 (GRK39F)  | I9020XXKA3           | M200KRKC1       | All previous versions
 4.0.3 (IML74K)  | I9020XXKL1           | M200KRKC1       | All previous versions
 4.0.4 (IMM76D)  | I9020XXKL1           | M200KRKC1       | Versions from 2.3.6
+4.0.4 (IMM76I)  | I9020XXKL1           | M200KRKC1       | Versions from 2.3.6
 
 Galaxy Nexus (GSM/HSPA+):
 
@@ -236,6 +239,7 @@
 4.0.2 (ICL53F)  | PRIMEKK15            | I9250XXKK6      | All previous versions
 4.0.3 (IML74K)  | PRIMEKL01            | I9250XXKK6      | All previous versions
 4.0.4 (IMM76D)  | PRIMEKL03            | I9250XXLA02
+4.0.4 (IMM76I)  | PRIMEKL03            | I9250XXLA02
 
 If you're building a new version of Android, if your Nexus S or
 Galaxy Nexus has
diff --git a/src/source/building-kernels.md b/src/source/building-kernels.md
index 8eb9639..4987654 100644
--- a/src/source/building-kernels.md
+++ b/src/source/building-kernels.md
@@ -45,12 +45,17 @@
 Depending on which kernel you want,
 
     $ git clone https://android.googlesource.com/kernel/common.git
+    $ git clone https://android.googlesource.com/kernel/exynos.git
     $ git clone https://android.googlesource.com/kernel/goldfish.git
     $ git clone https://android.googlesource.com/kernel/msm.git
     $ git clone https://android.googlesource.com/kernel/omap.git
     $ git clone https://android.googlesource.com/kernel/samsung.git
     $ git clone https://android.googlesource.com/kernel/tegra.git
 
+The goldfish project contains the kernel sources for the emulated
+platforms. The msm project has the sources for ADP1, ADP2 and
+Nexus One. The omap project is used for PandaBoard and Galaxy Nexus,
+the samsung project for Nexus S, and the tegra project for Xoom.
 
 ## Downloading a prebuilt gcc ##
 
diff --git a/src/source/building.md b/src/source/building.md
index 1cd13c9..a9837e2 100644
--- a/src/source/building.md
+++ b/src/source/building.md
@@ -145,14 +145,6 @@
 
     $ apt-get install python
 
-## Gmake Version 3.82 ##
-
-There is a bug in `make` version 3.82 on Mac OS that prevents building Android. 
-
-TODO: what the error looks like with GNU make 3.82 on older builds that don't explicitly detect it.
-
-Follow the instructions on the [Initializing](initializing.html) page for reverting GNU make from 3.82 to 3.81.
-
 ## Case Insensitive Filesystem ##
 
 If you are building on an HFS filesystem on Mac OS X, you may encounter an error such as
diff --git a/src/source/downloading.md b/src/source/downloading.md
index d76e86c..40e881b 100644
--- a/src/source/downloading.md
+++ b/src/source/downloading.md
@@ -32,11 +32,8 @@
         $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
         $ chmod a+x ~/bin/repo
 
- - For version 1.15, the SHA-1 checksum for repo is
- 8eb56d98b36d615c3efec51868e87bebe757feb1
-
  - For version 1.16, the SHA-1 checksum for repo is
- f3bfa7fd2d0a44aa40579bb0242cc20df37b5e17
+ 19ba8290344752da23e00cfb2b26afb43b463fe6
 
 
 ## Initializing a Repo client ##
diff --git a/src/source/initializing.md b/src/source/initializing.md
index 8893929..2967158 100644
--- a/src/source/initializing.md
+++ b/src/source/initializing.md
@@ -24,15 +24,31 @@
 
 For an overview of the entire code-review and code-update process, see [Life of a Patch](life-of-a-patch.html).
 
+# Choosing a Branch #
 
+Some of the requirements for your build environment are determined by which
+version of the source code you plan to compile. See
+[Build Numbers](build-numbers.html) for a full listing of branches you may
+choose from. You may also choose to download and build the latest source code
+(called "master"), in which case you will simply omit the branch specification
+when you initialize the repository.
+
+Once you have selected a branch, follow the appropriate instructions below to
+set up your build environment.
 
 # Setting up a Linux build environment #
 
+These instructions apply to all branches, including master.
+
 The Android build is routinely tested in house on recent versions of
 Ubuntu LTS (10.04), but most distributions should have the required
 build tools available. Reports of successes or failures on other
 distributions are welcome.
 
+For Gingerbread (2.3.x) and newer versions, including the master
+branch, a 64-bit environment is required. Older versions can be
+compiled on 32-bit systems.
+
 *Note: It is also possible to build Android in a virtual machine.
 If you are running Linux in a virtual machine, you will need at
 least 16GB of RAM/swap and 30GB or more of disk space in order to
@@ -97,9 +113,10 @@
 
     $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
       zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
-      libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \
-      g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \
-      libxml2-utils xsltproc zlib1g-dev:i386
+      libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
+      libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
+      python-markdown libxml2-utils xsltproc zlib1g-dev:i386
+    $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
 
 ## Configuring USB Access ##
 
@@ -109,7 +126,7 @@
 
 The recommended approach is to create a file
 `/etc/udev/rules.d/51-android.rules` (as the root user) and to copy
-the following lines in it. <username> must be replaced by the
+the following lines in it. `<username>` must be replaced by the
 actual username of the user who is authorized to access the phones
 over USB.
 
@@ -134,6 +151,8 @@
     # fastboot protocol on panda (PandaBoard)
     SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
     # usbboot protocol on panda (PandaBoard)
+    SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
+    # usbboot protocol on panda (PandaBoard ES)
     SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
 
 Those new rules take effect the next time a device is plugged in.
@@ -170,18 +189,56 @@
 
 This setting is stored in the CCACHE_DIR and is persistent.
 
+## Using a separate output directory ##
+
+By default, the output of each build is stored in the out/
+subdirectory of the matching source tree.
+
+On some machines with multiple storage devices, builds are
+faster when storing the source files and the output on
+separate volumes. For additional performance, the output
+can be stored on a filesystem optimized for speed instead
+of crash robustness, since all files can be re-generated
+in case of filesystem corruption.
+
+To set this up, export the `OUT_DIR_COMMON_BASE` variable
+to point to the location where your output directories
+will be stored.
+
+    export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>
+
+The output directory for each separate source tree will be
+named after the directory holding the source tree.
+
+For instance, if you have source trees as `/source/master1`
+and `/source/master2` and `OUT_DIR_COMMON_BASE` is set to
+`/output`, the output directories will be `/output/master1`
+and `/output/master2`.
+
+It's important in that case to not have multiple source
+trees stored in directories that have the same name,
+as those would end up sharing an output directory, with
+unpredictable results.
+
+This is only supported on branches newer than 4.0.x
+(IceCreamSandwich).
 
 # Setting up a Mac OS X build environment #
 
-To build the Android files in a Mac OS environment, you need an
-Intel/x86 machine running MacOS 10.6 (Snow Leopard).
+In a default installation, OS X runs on a case-preserving but case-insensitive
+filesystem. This type of filesystem is not supported by git and will cause some
+git commands (such as "git status") to behave abnormally. Because of this, we
+recommend that you always work with the AOSP source files on a case-sensitive
+filesystem. This can be done fairly easily using a disk image, discussed below.
 
-Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+.  HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.
+Once the proper filesystem is available, building the master branch in a modern
+OS X environment is very straightforward. Earlier branches, including ICS,
+require some additional tools and SDKs.
 
-## Creating a case sensitive disk image ##
+### Creating a case-sensitive disk image ###
 
-If you want to avoid partitioning/formatting your hard drive, you can use
-a case-sensitive disk image instead. To create the image, launch Disk
+You can create a case-sensitive filesystem within your existing OS X environment
+using a disk image. To create the image, launch Disk
 Utility and select "New Image".  A size of 25GB is the minimum to
 complete the build, larger numbers are more future-proof. Using sparse images
 saves space while allowing to grow later as the need arises. Be sure to select
@@ -198,9 +255,25 @@
 
 Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.
 
-## Installing required packages ##
+## Master branch ##
 
-- Install XCode from [the Apple developer site](http://developer.apple.com/).
+To build the latest source in a Mac OS environment, you will need an Intel/x86
+machine running MacOS 10.6 (Snow Leopard) or MacOS 10.7 (Lion), along with Xcode
+4.2 (Apple's Developer Tools). Although Lion does not come with a JDK, it should
+install automatically when you attempt to build the source.
+
+The remaining sections for Mac OS X only apply to those who wish to build
+earlier branches.
+
+## Branch 4.0.x and all earlier branches ##
+
+To build android-4.0.x and earlier branches in a Mac OS environment, you need an
+Intel/x86 machine running MacOS 10.5 (Leopard) or MacOS 10.6 (Snow Leopard). You
+will need the MacOS 10.5 SDK.
+
+### Installing required packages ###
+
+- Install Xcode from [the Apple developer site](http://developer.apple.com/).
 We recommend version 3.1.4 or newer, i.e. gcc 4.2.
 Version 4.x could cause difficulties.
 If you are not already registered as an Apple developer, you will have to
@@ -222,7 +295,7 @@
 
         $ POSIXLY_CORRECT=1 sudo port install bison
 
-## Reverting from make 3.82 ##
+### Reverting from make 3.82 ###
 
 For versions of Android before ICS, there is a bug in gmake 3.82 that prevents android from building.  You can install version 3.81 using MacPorts by taking the following steps:
 
@@ -246,7 +319,7 @@
 
         $ sudo port install gmake @3.81
 
-## Setting a file descriptor limit ##
+### Setting a file descriptor limit ###
 
 On MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.  
 
diff --git a/src/source/known-issues.md b/src/source/known-issues.md
index 4fa1bea..74579de 100644
--- a/src/source/known-issues.md
+++ b/src/source/known-issues.md
@@ -194,3 +194,43 @@
 
 **Fix**: Build Android in an environment that has as few
 customizations as possible.
+
+## Build error with 4.0.x and earlier on MacOS 10.7. ##
+
+**Symptom**: Building IceCreamSandwich 4.0.x (and older
+versions) fails on MacOS 10.7 with errors similar to this:
+`Undefined symbols for architecture i386: "_SDL_Init"`
+
+**Cause**: 4.0.x is not compatible with MacOS 10.7.
+
+**Fix**: Either downgrade to MacOS 10.6, or use the master
+branch, which can be built on MacOS 10.7.
+
+    $ repo init -b master
+    $ repo sync
+
+## Build error on MacOS with XCode 4.3. ##
+
+**Symptom**: All builds fail when using XCode 4.3.
+
+**Cause**: XCode 4.3 switched the default compiler from
+gcc to llvm, and llvm rejects code that used to be
+accepted by gcc.
+
+**Fix**: Use XCode 4.2.
+
+## Build error with 4.0.x and earlier on Ubuntu 11.10. ##
+
+**Symptom**: Building IceCreamSandwich 4.0.x (and older
+versions) on Ubuntu 11.10 and newer fails with errors similar to this:
+`<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]`
+
+**Cause**: Ubuntu 11.10 uses a version of gcc where that symbol
+is defined by default, and Android also defines that symbol,
+which causes a conflict.
+
+**Fix**: Either downgrade to Ubuntu 10.04, or use the master
+branch, which can be compiled on Ubuntu 11.10 and newer.
+
+    $ repo init -b master
+    $ repo sync
diff --git a/src/source/submit-patches.md b/src/source/submit-patches.md
index 72531c3..0ea530d 100644
--- a/src/source/submit-patches.md
+++ b/src/source/submit-patches.md
@@ -38,6 +38,18 @@
 
 # For contributors #
 
+## Authenticate with the server ##
+
+Before you can upload to Gerrit, you need to establish a password that
+will identify you with the server. You only need to do this once.
+
+- Sign in on the [AOSP Gerrit Server](https://android-review.googlesource.com/).
+
+- Go to Settings -> HTTP Password -> Obtain Password
+
+- Follow the instructions on the subsquent pages, and copy-paste your
+password in `~/.netrc`. If there are two password lines, copy both.
+
 ## Start a repo branch ##
 
 For each change you intend to make, start a new branch within the relevant git repository:
diff --git a/src/source/using-repo.md b/src/source/using-repo.md
index b3bf9bb..b62f693 100644
--- a/src/source/using-repo.md
+++ b/src/source/using-repo.md
@@ -39,7 +39,7 @@
 
 Options:
 
-* `-u`: specify a URL from which to retrieve a manifest repository. The common manifest can be found at `git://android.git.kernel.org/platform/manifest.git`
+* `-u`: specify a URL from which to retrieve a manifest repository. The common manifest can be found at `https://android.googlesource.com/platform/manifest`
 
 * `-m`: select a manifest file within the repository. If no manifest name is selected, the default is default.xml. 
 
diff --git a/src/tech/input/input-device-configuration-files.md b/src/tech/input/input-device-configuration-files.md
index 0a477d0..be6900a 100644
--- a/src/tech/input/input-device-configuration-files.md
+++ b/src/tech/input/input-device-configuration-files.md
@@ -62,7 +62,7 @@
 *   `/data/system/devices/idc/DEVICE_NAME.idc`
 
 When constructing a file path that contains the device name, all characters
-in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '_' are replaced by '_'.
+in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '\_' are replaced by '\_'.
 
 ## Syntax ##