Only increase the counter when we do take a wakelock

We keep track on how many wakelocks we have taken. We always
just take one real wakelock but increase / decrease the
counter every time we try to acquire / release a wakelock.
The counter is always increased even if the power manager is
not ready, leading to an incorrect counter that could cause a
crash when we try to release it.
Make sure we only increase the counter when a wakelock, real
or counted, is taken.

Change-Id: Iad940e052694932f1dad8a1a71fa63601d289d6a
(cherry picked from commit e878766c65aa6107cabcc49315f1949d714e0354)
Do partial reads in MemoryLeakTrackUtil

Do partial read in MemoryLeakTrackUtil dumpMemoryAddresses
to avoid using more memory than what is allocated.

Change-Id: I94feb4e00647407f938571167b981c7371f39e3d
(cherry picked from commit 27a7e705a82ea470a413857f5eb3cd7506b1c4c5)