Merge v4.0.0 from aosp/upstream-master

Now this module compiles cleanly with both gcc and clang.

* git merge aed6d85
* Minor changes to Android.mk files to compile the new source.
* Add Android specific changes after merge of 4.0.0.
  Some old Android changes to 3.4.0 are not needed anymore.

Bug: 18513435

Change-Id: I903f4ea78a96c4e55efdcb0db160f269fdb12da2