Cherry pick 92189d47f66c67e5fd92eafaa287e153197a454f. Reference https://source.android.com/devices/low-ram.html
Enable some optimizations
Fix build. Reference: https://bugs.launchpad.net/linaro-android/+bug/983496