History log of /packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fcd5f0f1aae7a8b3145b9a37e46c7c200408318c 20-Apr-2018 Jason Monk <jmonk@google.com> Push full slice index to device index

Test: make RunSettingsRoboTests
Bug: 74555610
Change-Id: I3f0aa1218e1d7e736dc918d83e76423fa81ac6ab
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
d75baf7e85605b9ca0d9747506f911159c11e072 08-Feb-2018 Fan Zhang <zhfan@google.com> Remove some dead code from search

Test: rebuild
Change-Id: If736f58c546fa9eafc405525c11640ca2576d446
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
74706b6ed1ba82f992478852f63c8aa8bca4c47a 18-Jan-2018 Fan Zhang <zhfan@google.com> Remove more things from search v1

Test: robotests
Change-Id: Ide54d1cec69ae3a6782a979d3eeb7f3fc44f09b3
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
518e648acf5e6c53c3f941949f8f5f02b1d75e9f 28-Nov-2017 Fan Zhang <zhfan@google.com> Implement querySiteMapPairs for indexableProvider.

Query sitemap will return a list of pairs [parent class name, child
class name]. It's up to consumer to figure out the display name later
so the provider doesn't have dependency on localizing any display names.

- Removed SiteMapManagerTest. We will perform the test in
SettingsIntelligence instead.
- Added test for the new provider in instrumentation test (robolectric
doesn't recognize the new constants in framework yet)

Bug: 67359411
Bug: 64938328
Test: atest
Change-Id: Ia973115320e6b7c8cf84d4756db1763ae7010aed
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
fb772248b153dcf7e940a0d0705ca38b421fd8f8 06-Oct-2017 Matthew Fritze <mfritze@google.com> Move search querying into a single API

Settings now collects search results from a single
loader which fetches from an aggregator. This is to
facilitate the separation of search functionalitiy,
where "query" becomes a single synchronous call.
In this case, the aggregator will move to the
unbundled app and would be called on the
other end of the Query call. i.e. the new search
result loader will just call query, and unbundled
search will handle everything else.

An important implication is that the results will
be returned in a ranked order. Thus the ranking and
merging logic has been moved out of the RecyclerView
adapter (which is a good clean-up, anyway).

The SearchResultAggregator starts a Future for each
of the data sources:
- Static Results
- Installed Apps
- Input Devices
- Accessibility Services

We allow up to 500ms to collect the static results,
and then an additional 150ms for each subsequent
loader. In my quick tests, the static results take
about 20-30ms to load. The longest loader is installed
apps which takes roughly 50-60ms seconds (note that
this will be improved with dynamic result caching).

To handle the ranking in DatabaseResultLoader,
we start a Future to collect the dynamic ranking before
we start the SQL queries. When the SQL is done, we
wait the same timeout as before. Then we merge the
results, as before.

For now we have not changed how the Dynamic results
are collected, but eventually they will be a cache
of dynamic results.

Bug: 33577327
Bug: 67360547
Test: robotests
Change-Id: I91fb03f9fd059672a970f48bea21c8d655007fa3
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
cb4b3857949f67613e66c69b41936b36ebfbc601 28-Oct-2017 Matthew Fritze <mfritze@google.com> Remove locale checking for indexing.

Remove the the indexing check for the
index data's locale to match the locale of
the device. We don't require locale for
indexables, and we reindex on locale change.

It had introduced a bug where when locale
changed, the default us-en results would
not be added to the db.

Change-Id: I43a4284f5c23bc51ee3efdfcabe511eac2d3317d
Fixes: 66916397
Fixes: 68380443
Test: robotests
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
823dde54c72ec8b7ea59abe63d71a1b36d1e678e 27-Oct-2017 Fan Zhang <zhfan@google.com> Misc clean up in search

- Remove updateFromClassNameResource() because it's just a no-op method.
- Simplify SearchIndexResources
- Update some pref pages to have unique keys.

Change-Id: I51e542d9947aafd046861ce7be0b4c7213fcd01d
Fixes: 64951285
Test: UniquePreferenceKeyTest
Test: robotest
Bug: 67852637
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
ab741bb62756e27457632c841460f2d5b05957c3 05-Sep-2017 Matthew Fritze <mfritze@google.com> Refactor IndexData conversion flow

This is entirely implementation detail, the public
interface and tests get to stay the same.

- The Raw, Resource and Provider methods now return single
or lists of IndexData rather than adding to a member var.
- Some code duplication was removed for Raw IndexData.
- Extra methods were squashed or removed

The only remaining refactoring in IndexDataConverter is
moving work done on IndexProviders to get the raw and
resources into PreIndexDataCollector.

Bug: 33577327
Test: make RunSettingsRoboTests, Database dump before & after
Change-Id: If6011046955f242ba2614400cfeca3bea5b683cb
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
80e54df83337be5fd37f2fc85f274c7442784740 31-Aug-2017 Matthew Fritze <mfritze@google.com> Move the indexing back into DatabaseIndexingManager

For the sake of incremental updates, we moved all of the
conversion from PreIndexData to IndexData, and the
insertion of the rows into the SQLite DB into a new class,
IndexDataConverter. However, it's real role is just to
convert PreIndexData into IndexData.

So this CL moves the insertion of the rows back into
DatabaseIndexingManager.

Again, for the sake of simplicity, I did not change the
conversion flow. Rather, instead of inserting a row at the
end of the conversion, I just put it into a list which is
then returned. This lets me move the tests to appropriate
locations, without having to change them too much.

In the tests, the references to real xml layouts are
changed to fake references. Hooray for being less brittle.
IndexDataConverter now just tests that the IndexData
has the appropriate data from PreIndexdData.

Independently, we test that IndexData gets inserted in
DatabaseIndexingManager.

In the next CL, I'll refactor the conversion
flow for readability.

Bug: 33577327
Test: make RunSettingsRoboTests
Test: Took a database dump before and after change,
and they were the same. Cool.

Change-Id: I39cc812d1f736e13a0a51af50984c239961ecf7a
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
6bbc459f24c9d1da148a02cc3a5154c65154417f 23-Aug-2017 Matthew Fritze <mfritze@google.com> Simplify IndexData builder

This is a small refactor in the large game of refactoring
DatabeseIndexingManager, and the general indexing pipeline
for Settings search.

This change is centered around hiding the normalization of
data (title, summary, keywords) from the data collector,
and putting that responsibility into the IndexData object.

In a future CL, we may move this again to the controller
that actually indexes the data.

Note, the conversion from PreIndexData to IndexData is
still messy, but until I can write a CL that just
rearranges the code, we must stay patient and vigilant.

Bug: 33577327
Test: make RunSettingsRoboTests
Change-Id: I53543d3d9c74a61380601297c55b6e4fea13031a
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
80d3ea2a734cd89c873d6b3dfb740e32e909baef 23-Aug-2017 Matthew Fritze <mfritze@google.com> Move search indexing into a separate class

Step 2 in refactoring DatabaseIndexingManager.

This step moves the insertion of data into the database
into a new class. This removes the remaining bulk of the
code outside of DIM, but it does not fix the actual issue
with the indexing code.

The indexing code still chains functions together to
insert data into the database at the end of the functions.

It is exceedingly hard to read, and hard to track down bugs.

I would like the converter to eventually return a list of
IndexData objects, which lets us dissociate the database
from the data collection. I.e. we can store the database
in the Search app, and just pass IndexData objects via
IPC.Fixing this requires more of a refactor, and will be
done in a subsquent CL.

Bug: 33577327
Test: make RunSettingsRoboTests
Test: Took a database dump before and after change,
and they were the same. Cool.
Change-Id: Ia9bb815657b76f6cb9163014e746ec5eb6db8c5e
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
bdc8fe6da9a57b7ca544194a0d0535602ab4b119 23-Aug-2017 Matthew Fritze <mfritze@google.com> 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
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
f8d95fa35da90e7ea796521a199c290fb2e3f101 21-Jul-2017 Fan Zhang <zhfan@google.com> Reindex db when package w/ searchIndexProvider changes

We do this by tracking a list of package/version that provides search
indexing data. When they change, we do a full reindex.

Change-Id: I906a1524f5b1292932f63727d605283ddb7d6ee2
Bug: 63903835
Test: robotests
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
465d79776f0e731b04e1976d736eda7036a27c5f 17-Jul-2017 Fan Zhang <zhfan@google.com> Improve search indexing time.

- Some import clean up.
- Add timing log to track indexing time breakdown.
- Remove isAvailable() from UserDictionaryPreferenceController.

Bug: 36391685
Test: rebuild
Change-Id: If154c5dafba5d21cb1020497c44fbf67f03ad820
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
636e18c6594148abec086825f866ab8a3bc35543 08-Jul-2017 Matthew Fritze <mfritze@google.com> Merge "Add public intent filters to indexing" into oc-dr1-dev am: 50535da16d
am: 01ee9b3cc7

Change-Id: I2a5063324b21e2a77ba10d9e4be9dcbc4aadd2c9
50535da16d0c1fd21e15dd93534bc7409a7756b0 08-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add public intent filters to indexing" into oc-dr1-dev
473b6b45de00dbb24423747173cbcf09737d53ff 29-Jun-2017 Matthew Fritze <mfritze@google.com> Add public intent filters to indexing

Adds a public intent action to the index so that intents
can be created for callers outside of settings.

Change-Id: I9f87263f213b6de40542e8735c931ee1f0d82094
Fixes: 63136008
Test: make RunSettingsRoboTests
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
aadd26e335f872545f1f19e6897ba412721cd67d 06-Jul-2017 Matthew Fritze <mfritze@google.com> Merge "Check non-indexable keys for raw data" into oc-dr1-dev am: 24ba2fbdb9
am: dc2005eb6a

Change-Id: Ibcefe758e9524ae810234212ac83d385bd03d09e
bdd57aad3eb4ffeb106feb7b3d300ac6680def0d 06-Jul-2017 Matthew Fritze <mfritze@google.com> Check non-indexable keys for raw data

Change-Id: I182f6757cae0ccdd07c2c38ea0f02bd4998f79be
Fixes: 63360455
Test: make RunSettingsRoboTests
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
f050ab93d1e73085af82b5b71bc0f27f951d6d0a 28-Jun-2017 Matthew Fritze <mfritze@google.com> Merge "Add synchronous indexing api to SearchFeatureProvider" into oc-dr1-dev am: e2e54e17c7
am: d4075ea983

Change-Id: Ie93718a9af3b3bb4e53dfbf7f43da31c1ee9404a
98a9e42c93deaf5bb5f3028971065cc910e8d51f 25-Jun-2017 Matthew Fritze <mfritze@google.com> Add synchronous indexing api to SearchFeatureProvider

- Opens the database indexing to be synchronous for the
external settings api.
- Adds logging to track synchronous and async indexing
times.

Bug: 62826872
Test: make RunSettingsRoboTests
Change-Id: I28b69f3952946c0ae5dd7ea7da66f7a5fd485637
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
1d583e125faf3ae4c9cd82636d8f3ecf1cdec3aa 13-Jun-2017 Tony Mantler <nicoya@google.com> Make PreferenceController a mixin

Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
2b1a88da3df42e4ec1cb2fb9814f7a440b3735f2 23-May-2017 Matthew Fritze <mfritze@google.com> Simplify InlineSwitchPayloads and generalize get/set method

InlineSwitchPayload now assumes that all switches will be
stored as 1 or 0, which simplifies the code.

Moves Availability into ResultPayload, so that custom
payloads can be created to set/get values which are more
complicated than stotring ints (like bluetooth or DnD),
and give more expressive reasons when unavailable.

Bug: 62022517
Test: make RunSettingsRoboTests
Change-Id: I87e6fc041bfd398e7daf6e6e479d502930d36f0f
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
6efea1e624bb4b48290000cfdb82df224a31b81d 13-May-2017 Matthew Fritze <mfritze@google.com> Update Settings search result unique ids

- SearchResult stableIds are now DocIds from the database
- DocIds are data reference key's hash, when the key is not
empty or null
- Otherwise, DocIds are a hashcode from a set of fields.

Change-Id: Id36f7bf4ceaaa3a2bd326ecafbfe97fd0b247df2
Fixes: 37327194
Test: make RunSettingsRoboTest
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java
2078bc2358031ef3a191900d9036daf4251911c1 22-May-2017 Matthew Fritze <mfritze@google.com> Remove search2 package and put everything into search

Change-Id: Ie8651c79ef023f154cd7120a88a20f3481abce2b
Fixes: 38502743
Test: make RunSettingsRoboTests
/packages/apps/Settings/src/com/android/settings/search/DatabaseIndexingManager.java