Fix for breakText returning count of glyphs not chars.

Paint.breakText should return the number of characters measured to a given maxWidth, but it returns the number of glyphs instead. The solution loops through the advances and whenever if finds an advance with length bigger than 0 decrements it until reaching zero or the end of the advances. The advance has a zero when a glyphs is for more than on character, for the subsequent characters. The width of the glyphs is added at the first character.

Change-Id: If26fca3a08133d08572dfda1e33536cc0bd8b1e5
Remove possible leak when exception occurred.

nameUtf8 is not released after exception.
In addtion, Fix code going down after ThrowException.

Change-Id: Id46e8ed55acd98e982ae532f7da2c0c48847f010
Account malloc mmaped pages as native heap.

Currently when malloc uses a page rather than brk the heap gets accounted as
ashmem memory. Previously the memory would be accounted as unknown but since
[1] it gets accounted as ashmem. This change makes the accounting see this
memory as being native, ie the same kind of memory we associate with brk.

[1] https://android-review.googlesource.com/#/c/49583/3

Change-Id: I6f496cfeb590268d41d8e047b12cd5c90359e2b0
Recognize odex files in memory accounting.

Give odex files the same heap category as dex files.

Change-Id: I82539e20ac20a2b80c63c0cfceb266d9c59e22b7