Change method to determine if the table is empty

queryNumEntries API perform "COUNT(*)" query.
It is slower than New API that perform "EXISTS".
If the goal is to determine if the table is empty,
using new API is better.

[+] https://android-review.googlesource.com/52750

Change-Id: Idcc2633d0a5349c59f41e125cf34c9dc6622cdbe
Use MemoryCursor code in framework.

That way, we need to fix bugs only once.

Change-Id: Iae3df411462b7adc12aa09a5ea7ec6f01834ac0d