220 Commits

Author SHA1 Message Date
Dan Saadati
bc776cb98a Merge "Update AppSearchManager to clarify features" into sc-dev 2021-04-19 17:05:06 +00:00
Dan Saadati
fddc1eb396 Update AppSearchManager to clarify features
Bug: 185595210
Change-Id: Idb2eae922bf208490f1c166a99bb8a1b0e05191c
2021-04-16 17:42:39 +00:00
Alexander Dorokhine
9e0828111f Merge "Remove remaining uses of Preconditions.checkNotNull." into sc-dev 2021-04-15 20:54:10 +00:00
TreeHugger Robot
96501c47e4 Merge "Change AppSearchManagerService's thread pool to use LinkedBlockingQueue." into sc-dev 2021-04-15 19:22:30 +00:00
Alexander Dorokhine
abf6490b24 Remove remaining uses of Preconditions.checkNotNull.
This is a hidden API and is not compatible with becoming a mainline
module.

Bug: 181787682
Bug: 181096312
Test: Builds
Change-Id: Ic59b8e62eb2e1852a820203b770e2483c3fe53f4
2021-04-15 10:59:55 -07:00
Alexander Dorokhine
10f4c55099 Merge "Remove ParcelableException from AppSearch." into sc-dev 2021-04-15 17:21:32 +00:00
Martijn Coenen
7c64d3164f Merge "Revert "Register PackageChangedReceiver to AppSearchManagerService."" into sc-dev 2021-04-15 13:31:41 +00:00
Alexander Dorokhine
2fe2039f94 Remove ParcelableException from AppSearch.
It is a hidden API and cannot be used in mainline.

Bug: 180460796
Bug: 181787682
Test: AppSearchSessionUnitTest#testPutDocument_throwsNullException
Change-Id: Ie0a91ca9fd37c5c7dabd046836ffa533a6edb4b0
2021-04-15 00:32:15 -07:00
Martijn Coenen
12dfd2253d Revert "Register PackageChangedReceiver to AppSearchManagerService."
Revert "Added package-remove test to AppSearch host test"

Revert submission 14095007-appsearch-package-remove

Reason for revert: b/185306078 - creates appSearch directory before user is unlocked
Reverted Changes:
Iaae64c4ec:Added package-remove test to AppSearch host test
I81a1f5cae:Register PackageChangedReceiver to AppSearchManage...

Change-Id: I95736090a4334daf2b2b10ec68411532a5233dfd
2021-04-15 07:18:26 +00:00
Alexander Dorokhine
1e258ecf1d Merge "Update framework from jetpack." into sc-dev 2021-04-15 05:52:11 +00:00
Terry Wang
ddf9718ead Change AppSearchManagerService's thread pool to use LinkedBlockingQueue.
If the service reaches the max pool size which is the number of
available processor, we should use LinkedBlockingQueue instead of
SynchronousQueue to queue the requests.

Bug: 185294190
Test: presubmit
Change-Id: I3a9a2f8a149f44fac7ddc01d61a6d1827a8d55bf
2021-04-14 20:39:53 +00:00
Alexander Dorokhine
e85e9ef246 Update framework from jetpack.
Changes included:
* 27ea02: Add cts API coverage for Migrator.onUpgrade and onDowngrade.
* 9961ca: Rewrite Preconditions.checkNotNull to Objects.requireNonNull.
* e62a4e: Add calls to persistToDisk(LITE)
* 15c06a6: Simplify an expected error message in AppSearchResultTest.
* d0cf93f: Sets a default empty value when converting DocumentProtos to GenericDocuments

Bug: 183239551
Bug: 181787682
Bug: 181096312
Bug: 180127220
Bug: 183550974
Bug: 177611968
Test: Presubmit
Change-Id: I4dd86bc1a1bd76d0b0f5e5da97f205e267841e94
2021-04-14 09:26:06 -07:00
Terry Wang
d8d85f4647 Register PackageChangedReceiver to AppSearchManagerService.
The Receiver could receive ACTION_PACKAGE_FULLY_REMOVED and
ACTION_PACKAGE_DATA_CLEARED broadcast and clean the package data.

Bug: 145759910
Test: atest --rebuild-module-info CtsAppSearchHostTestCases
Change-Id: I81a1f5cae823ed4780374b434b7a6be43d040cde
2021-04-13 03:26:13 -07:00
Xiaoyu Jin
79119ac9b1 Use the PlatformLogger in the platform
1) Add LoggerInstanceManager (similar to ImplInstanceManager)
2) Call statsd api to log atoms in PlatformLogger
3) Added BinderCallStartMillis to calculate estimated binder latency
4) Log CallStats for putDocuments

Bug: b/173532925
Test: go/westworld-create-atom#step-3-test-your-atom, atest
CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:AppSearchImplTest
FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest

Change-Id: Ief158aee2d79008fecc9e1df52188765b8036c02
2021-04-08 22:47:27 -07:00
Terry Wang
f5042bcc1b Merge "Implement schema migration to another type in framework." into sc-dev 2021-04-08 02:36:51 +00:00
Terry Wang
fd900350cf Implement schema migration to another type in framework.
Changes included:
*05b7d39:Change schema version from per AppSearchSchema to overall.
*effe024:Support schema migration to another type.
*1be54dc:Minor fix for where we set version in schema.

Bug: 182620003
Test: AppSearchSchemaMigrationCtsTest
Change-Id: Ifabfaa65c32fc3684d7fc7a09dd021671ff3252d
2021-04-07 13:23:17 -07:00
Terry Wang
97844f3179 Add background executor to AppSearchManagerService.
The background executor could release binder thread earlier and
reduce work load of binder threads.

Bug: 173451571
Test: presubmit
Change-Id: I2ca247c8c396095f6975c335cf8327b0792ae956
2021-04-07 03:41:40 -07:00
Terry Wang
02841faaf6 Merge "Register UserActionReceiver to AppSearchManagerService." into sc-dev 2021-04-07 09:27:26 +00:00
Terry Wang
b9b7883609 Merge "Add appsearch multiuser test" into sc-dev 2021-04-07 09:27:00 +00:00
Terry Wang
19fe7d9aca Register UserActionReceiver to AppSearchManagerService.
The Receiver could receive ACTION_USER_REMOVED broadcast and wipe
the AppSearchImpl instance for the given user.

Bug: 179390369
Test: presubmit
Change-Id: I9a0f9e6cc41f89a098bc78146db1dccc48a173aa
2021-04-07 04:11:57 +00:00
Terry Wang
92b84671f8 Add appsearch multiuser test
Test: atest --rebuild-module-info CtsAppSearchHostTestCases
Bug: 173553485
Change-Id: Ifb11ce65aa5fc8fc27846f715976dc7af3f92e00
2021-04-06 21:09:26 -07:00
Alexander Dorokhine
647a555f9e Update framework from Jetpack.
Changes included:
* 5814e32: Improve the documentation for the SetSchemaRequest.setMigrator
* b9bf4a0: Add clearPackageData in AppSearchImpl.

Bug: 183942169
Bug: 145759910
Test: Presubmit
Change-Id: I0518f7e84cbe910a8172af58ba2462ad17afae42
2021-04-06 16:45:45 -07:00
Alexander Dorokhine
eea1716148 Update framework from jetpack.
Included changes:
* 1be54dc: Minor fix for where we set version in schema.
* 5c8a15d: Clean up deprecated methods after dogfood transition.
* 53407e5: Upstream fixes to storage info tests.

Bug: 182620003
Bug: 182909475
Bug: 181887768
Bug: 183395357
Test: Presubmit
Change-Id: Ie918c6c337c3943bc56909dc09eb75287a275487
2021-03-31 16:48:18 -07:00
Cassie Wang
c29724005b Switch to Binder.getCallingUid.
Since there are some AppSearch callers from system_server, we don't want
to throw.

Bug: 183986767
Test: presubmit
Change-Id: I4ee3640a71f2f0bc2758a0fb41667c55ef13296c
2021-03-30 12:39:21 -07:00
Cassie Wang
bc4504e5fd Merge "Implement getStorageInfo." into sc-dev 2021-03-30 01:13:57 +00:00
Cassie Wang
751415fb9f Implement getStorageInfo.
This retrieves storage info for a certain package and database.

Bug: 182909475
Test: atest -m -c --rebuild-module-info CtsAppSearchTestCases
FrameworksCoreTests: android.app.appsearch
FrameworksServicesTests: com.android.server.appsearch
Change-Id: I524e0b2ada919981f50722f01ecd3f62b2ae4f43
2021-03-29 23:01:32 +00:00
Alexander Dorokhine
4b063daf5d Run framework migration on a background thread.
Bug: 183177268
Test: AppSearchSchemaMigrationCtsTest
Change-Id: Ie0566ebf1e669cacc0e1a37f5131d49b0256dde6
2021-03-24 23:09:51 -07:00
Alexander Dorokhine
30ccdcd621 Merge "Remove deprecated methods from AppSearch APIs." into sc-dev 2021-03-25 05:34:38 +00:00
Alexander Dorokhine
65c4fd881e Remove deprecated methods from AppSearch APIs.
These methods were only available for dogfooder transition.
None of these methods shipped in a stable SDK.

Bug: 181887768
Bug: 183395357
Test: Build, presubmit
Change-Id: I74feebd2721208c97475df9b74f734a17a41d5e2
2021-03-24 22:14:38 -07:00
Pinyao Ting
b3c71c2f97 Merge "Move from getDataUserCePackageDirectory to getDataSystemCeDirectory." into sc-dev 2021-03-25 04:48:40 +00:00
Alexander Dorokhine
75962baf8e Move from getDataUserCePackageDirectory to getDataSystemCeDirectory.
The other folder doesn't seem to work for non-primary users.

Bug: 177685938
Test: Presubmit
Change-Id: I31cd3a9b98d3205bb06c3339404a176b8c2fe6c5
2021-03-24 16:59:48 -07:00
Terry Wang
17ea05b2a3 Implement schema migration in framework.
Changes included:
* 9d1cf52:Supports schema migration in AppSearch

Bug: 177266929
Test: AppSearchSchemaMigrationCtsTest
Change-Id: Ia5b964baeb413ec7d176bb12c9e4c2af26cf2bf3
2021-03-24 14:06:48 -07:00
Alexander Dorokhine
ff9b4dfc5e Add another executor to setSchema() for running framework migrations.
The advice to add a second executor is based on API council guidance,
who do not recommend reusing the callback executor.

The executor is not yet used but will be used once schema migration is
implemented in framework.

Bug: 183177268
Test: Builds
Change-Id: Ic6735e696bc868884adffddd1433a198a005cad6
2021-03-24 01:57:45 -07:00
Alexander Dorokhine
ffb44f506f Update framework from jetpack.
Changes included:
* 4d36ab: Rename AppSearchSession in test message to avoid export bug.
* 0b2126: Update AppSearch to be in sync google3 update ag/13878956.
* e79e74: Add getRankingSignal method to SearchResult.
* 2c2383: Add a getNamespaces() API.
* 712009: Add getStorageInfo API.
* 81e601: Add resut grouping flags and limits.
* f23105: Support usage reporting by the system in AppSearchImpl.
* 05b7d3: Change schema version from per AppSearchSchema to overall.
* effe02: Support schema migration to another type.
* a0db44: Some minor fix for GetSchemaResponse
* 66a1c3: Support AppSearchResult to convert a failure result to another type.

Bug: 177266929
Bug: 182620003
Bug: 183031844
Bug: 180429302
Bug: 182909475
Bug: 179160886
Bug: 183042276
Bug: 181179404
Test: Presubmit
Change-Id: I091b25a78093d0c8c193903a58122d09788e31ff
2021-03-23 22:06:59 -07:00
TreeHugger Robot
2cea467f9b Merge "Fix a timing issue in unlock signal propagation in AppSearch" into sc-dev 2021-03-19 18:20:06 +00:00
Pinyao Ting
46e734cae9 Fix a timing issue in unlock signal propagation in AppSearch
There is a tiny gap between user unlock and when the unlock event
reaches AppSearch. The fact that unlock event haven't reach AppSearch
isn't suffice to say user is not unlocked. This CL added the logic to
check with UM when cache misses.

Bug: 151359749
Test: manual
Change-Id: I49f0754d53fc4d391245917bb35b726a305e4e30
2021-03-19 09:49:47 -07:00
Alexander Dorokhine
bda2ada6da Update Framework from Jetpack.
Changes included:
* 517c1ee: Schema Migration API updates to match API council recommendations.
* 407144d: Refactor some migration helper methods to Utils class.
* 2297b3a: Add a test for migrate to a nonexistent schema.
* 16a38d0: Log the PutDocumentStats in AppSearchImpl

Bug: 178060626
Bug: 179804862
Bug: 173532925
Test: Presubmit
Change-Id: I8b879bc9a5f30f9be3ce08d07dc60f4b177fb11b
2021-03-16 23:57:49 -07:00
Alexander Dorokhine
61897f07b2 Merge "Update Framework from Jetpack." into sc-dev 2021-03-15 23:02:25 +00:00
Alexander Dorokhine
64bc77cfec Merge "Update platform from Jetpack." into sc-dev 2021-03-15 23:02:02 +00:00
Cassie Wang
a7ee1a9a49 Merge "Require database name when creating session." into sc-dev 2021-03-15 03:13:34 +00:00
Xiaoyu Jin
4c1020ccb8 Add Logger Implementation for WestWorld
1) Implement sampling and rate limiting
2) Caching packageUid for the packages

Bug: 173532925
Test: atest
FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest

Change-Id: Ic6ca1cc0b0da8a0188a152037b6ae240293d9756
2021-03-15 01:25:40 +00:00
Alexander Dorokhine
c153efec4f Update Framework from Jetpack.
Included changes:
* b7eb43a: Require a namespace across APIs.
* 4e92597: Require databaseName when creating session.

Bug: 180460765
Bug: 181364730
Test: Presubmit

Change-Id: I22a0f4a2bd38d9b2e4e70258184800d281e579f1
2021-03-14 10:00:06 +00:00
Cassie Wang
1c2fa255b6 Require database name when creating session.
Deprecates the old constructor and setDatabaseName.

Bug: 180460765
Test: presubmit
Change-Id: I927159e39006c8c6ee6b89aed43245d62252f651
2021-03-12 13:03:17 -08:00
Alexander Dorokhine
c02dcf75f4 Update platform from Jetpack.
Included changes:
* b2c0825: Unhide builders for AppSearch objects to facilitate testing.
* dde789a: Expose Builders for SearchResult and MatchInfo.

Bug: 180143983
Bug: 177954902
Test: Presubmit

Change-Id: I3307cb5fd52b99bcbd72216bb4afbc7b58dd8650
2021-03-12 20:14:46 +00:00
Terry Wang
cfba1031c1 Delete depracated method in AppSearchManager.
Test: presubmit
Bug: 162450968
Change-Id: I423e3a25bb986ca6cc0a87c74ce97becb59ed25b
2021-03-08 20:29:06 +00:00
Alexander Dorokhine
db7aecbc3a Merge "Update Framework from Jetpack." into sc-dev 2021-03-05 22:01:56 +00:00
Alexander Dorokhine
73fb4da96d Update Framework from Jetpack.
Included changes:
* 509ebe: Rename getSchemasNotVisibleToSystemUi to setSchemaTypeDisplayedBySystem
* a532fe: Resolve merge conflicts from upstream sync.

Bug: 179143575
Bug: 175146044
Bug: 179160886
Bug: 175255572
Bug: 181887768
Test: Presubmit

Change-Id: I977baf47f6188e4c182a5cf96af4873d0e5284e0
2021-03-05 22:01:32 +00:00
Terry Wang
9bcf7462e3 Split getAppSearchImpl and createAppSearchImpl in AppSearchImpl
User could never call an uninitialized SearchSession, so convert and
propagate the initialize error in getAppSearchImpl to user
for every call is unnecessary.

Test: presubmit
Bug: 162450968
Change-Id: Ie2b3c7c0a56852d7e517c616960c19b7b9e9ad35
2021-03-04 22:29:02 -08:00
Alexander Dorokhine
ad71d8301a Move Executor parameter into SearchResult#getNextPage.
Bug: 180460795
Test: AppSearchSessionCtsTest
Change-Id: Iaf8ef970222801bf097a6b83643909d48ad44844
2021-02-25 13:05:25 -08:00
Alexander Dorokhine
8bddbddb88 Update framework from jetpack.
Included changes:
* aef5cff2: Remove hasSchemaTypeLocked.
* b2acdaae: Update documentation for setSchema and SetSchemaRequest

Bug: 180058203
Test: Presubmit
Change-Id: Id2b38bad5eb9240d514310b8122043edf35d11b5
2021-02-24 14:44:14 -08:00