Fix detectSpecialFormat in onIdleMaintenance to separate query/update

detectSpecialFormat iterates over database rows with
_SPECIAL_FORMAT=NULL, we then update the value to an integer
indicating the special format.

If the number of database rows with _SPECIAL_FORMAT as NULL exceeds the
cursor window size, we may run into issue where next cursor window will
see the new database updates and may miscalculate the database row for
next cursor window.
This will finally result in an exception and we will not be able to
update _SPECIAL_FORMAT column for all rows.

To fix the issue, we now separate query and update logic. We also query
and update in batches of 100 rows. This is because onIdleMaintenance can
be stopped any time, and we don't want to accumulate a lot of values
that we want to update at a later point in time.

Bug: 219621178
Bug: 219894107
Test: atest IdleServiceTest
Change-Id: I5ff2b15000a331f1c9b31e5e37afc43964486db0
1 file changed