Use DatabaseUtils method instead of query()

Use DatabaseUtils.longForQuery() method instead of SQLiteDatabase.query().
This reduces processing cost of database cursor.

Change-Id: Ibe53645b32a4de1ab6518f879e564ddf8f75d822