OSDN Git Service

Separate collection of indexable data from indexing
authorMatthew Fritze <mfritze@google.com>
Tue, 22 Aug 2017 22:51:50 +0000 (15:51 -0700)
committerMatthew Fritze <mfritze@google.com>
Thu, 7 Sep 2017 15:53:41 +0000 (08:53 -0700)
commitbdc8fe6da9a57b7ca544194a0d0535602ab4b119
treebece8fff6728f7c8bf9e8252cc7e215dea11039a
parentf4dc03184b9f8d9f7a141652a020bd1372cdcb1a
Separate collection of indexable data from indexing

The first step in refactoring the god class,
DatabaseIndexingManager.

The class has one major entry point: indexDatabase
which begins a chain of calls that first collects all the
data from the fragments, and then massages that data into
the SQLite database. Unfortunately, most of the methods
do not return data, and just pass along some mutated
form of the data until it can be insterted.

Reading and testing this class is very difficult.

This first step moves the collection of the indexable data
into a new class which has a few benefits:
- The data can be easily mocked in tests
- Reduces complexity of D.I.M.
- Separates data collection from indexing, which allows the
indexable data to be piped into a new API that unbundled
search can consume.

Bug:33577327
Test: make RunSettingsRoboTests
Test: Grabbed a DB dump before change, compared to DB dump after change
to make sure everything is still indexed.
Change-Id: Ibc91e3d75ff5dcf5274b93b29bf3544f90b2194d
src/com/android/settings/search/DatabaseIndexingManager.java
src/com/android/settings/search/DatabaseIndexingUtils.java
src/com/android/settings/search/DatabaseResultLoader.java
src/com/android/settings/search/IndexDatabaseHelper.java
src/com/android/settings/search/SearchFeatureProviderImpl.java
src/com/android/settings/search/indexing/IndexableDataCollector.java [new file with mode: 0644]
src/com/android/settings/search/indexing/PreIndexData.java [new file with mode: 0644]
tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
tests/robotests/src/com/android/settings/search/indexing/IndexableDataCollectorTest.java [new file with mode: 0644]