Commit Graph

156 Commits

Author SHA1 Message Date
Cassie Wang
f98a5efba1 Merge "Prevent instant apps from using AppSearch." into sc-dev 2021-06-24 02:36:40 +00:00
Cassie Wang
8417a0f253 Prevent instant apps from using AppSearch.
Bug: 181875256
Test: atest -m -c --rebuild-module-info CtsAppSearchHostTestCases
CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:com.android.server.appsearch

Change-Id: I50fa222f51a9d10395bd6b5815580170561d96d0
2021-06-23 14:15:27 -07:00
Alexander Dorokhine
9a8625df25 Sync framework from jetpack.
Changes included:
* 131d852: Remove usages of hidden APIs in the CTS tests.
* c984c24: Change AppSearchSchema and PropertyConfig #toString()

Bug: 146218515
Bug: 179680545
Test: Presubmit
Change-Id: Ibcef982cfea95ede2ae8e6075a052a83b44298c4
2021-06-23 13:14:01 -07:00
Alexander Dorokhine
bb978dfe38 Update framework from jetpack.
Changes included:
* 79f2ffe: Fixes required for export.
* e1ca63a: Implement empty schema shouldn't have a version number.
* 8b76be4: Refactor VisibilityStore from a no-op implementation into an interface.
* 47ba533: Remove the max repeatable length limit for GenericDocument
* 52ca287: Add GetSchemaResponse cts test.
* 56585f5: Change PutDocumentsRequestTest to be a cts test.

Bug: 183050495
Bug: 180058203
Bug: 191592792
Bug: 189161227
Bug: 183239766
Test: Presubmit
Change-Id: I30f51a18d697d3a5e43d2c63549ab19a36bbe99e
2021-06-22 12:32:15 -07:00
Alexander Dorokhine
f9d86a4aeb Update framework from jetpack.
Included changes:
* a8c984: Add more tests for logging
* 501a51: Remove some deprecated TODOs.
* 639f25: Add SchemaMigrationStats.
* 0b8885: Use consistent terminology for 3p and system access.
* 064c36: Add a CTS test for snippeting window sizes and max match counts.

Bug: 173532925
Bug: 187879464
Bug: 180058203
Test: Presubmit
Change-Id: I878fd6c7a42cccb237898392aac8c615830eb564
2021-06-18 14:28:34 -07:00
Terry Wang
08c51052a5 Annotate AppSearchManager APIs with @UserHandleAware
This helps readers understand that the AppSearch APIs can operate
across users.

Bug: 179822197
Test: presubmit
Change-Id: I0be942f16d0211ea1ea68d72ac82c254b9dd6d02
2021-05-24 14:47:26 -07:00
Alexander Dorokhine
0f7f36d29a Update framework from jetpack.
Included changes:
* d953a83b: Minor Migration update to apply API Review feedback
* b5b73db0: Expand Javadoc around Tokenization
* 45ac5ac2: Make GenericDocument.Builder reusable.
* 6d55d6d6: Logging stats for remove (2)

Bug: 187419874
Bug: 184174886
Bug: 184575874
Bug: 173532925
Test: Presubmit
Change-Id: Id6509e939e9038e5ec56bde610e4af902888b9d6
2021-05-20 14:24:50 -07:00
Alexander Dorokhine
c9429f43e0 Merge "Remove PackageManagerInternal from AppSearchService." into sc-dev 2021-05-20 20:36:04 +00:00
Alexander Dorokhine
ad8a40a56f Remove PackageManagerInternal from AppSearchService.
Most public and system APIs use UserHandle instead of UserIdInt, so this
CL ports AppSearch to do so as well, so that there are less conversions
required.

Bug: 181787682
Test: Presubmit
Change-Id: I29e4ba6bc73b994f1ece077ce515e1465ce54b12
2021-05-19 13:59:45 -07:00
Alexander Dorokhine
cadaa8b892 Fix HiddenApiTest#testSignatureMethodsThroughReflection.
It could not parse the annotation.

Bug: 188503851
Test: atest HiddenApiTest#testSignatureMethodsThroughReflection
Test: flash image, remove jetpack @SdkSuppress, and run jetpack tests
Change-Id: I05093b61b8658ad95db4f7e49c2f64bc314aa4b1
2021-05-18 16:54:25 -07:00
Alexander Dorokhine
a6d8d8e66c Update framework from jetpack
Included changes:
* b692f37: Rename `Int64` in annotation processor to `Long`.
* 05fe08c: Get QueryLength from Native
* 8f46606: Logging stats for remove (1)
* 237c134: Alter inheritance of LongProperty for backwards compatibility.

Bug: 187820569
Bug: 173532925
Bug: 173532925
Bug: 187820569
Test: Presubmit
Change-Id: Ia27e00250e7aa7c7a1acc974f24c63cc456739be
2021-05-17 15:13:40 -07:00
Xiaoyu Jin
05e3aca989 Merge "Log CallStats for more api calls" into sc-dev 2021-05-14 05:26:58 +00:00
Xiaoyu Jin
193cbf3c74 Merge "Log InitializeStats in the platform" into sc-dev 2021-05-14 02:25:22 +00:00
Xiaoyu Jin
0c59d91acc Merge "Log SearchStats in the platform" into sc-dev 2021-05-14 00:27:37 +00:00
Xiaoyu Jin
2830ace18c Log CallStats for more api calls
+ CALL_TYPE_SET_SCHEMA
+ CALL_TYPE_GET_DOCUMENTS
+ CALL_TYPE_REMOVE_DOCUMENTS
+ CALL_TYPE_FLUSH

Bug: b/173532925
Test: ./gradlew  -Pandroidx.allWarningsAsErrors
appsearch: appsearch:build appsearch:appsearch-compiler:build
appsearch: appsearch-local-storage:build  icing:build
icing: nativeLib:build appsearch:appsearch:connectedCheck
appsearch: appsearch-local-storage:connectedCheck
appsearch: appsearch:lintDebug
appsearch: appsearch-local-storage:lintDebug
Change-Id: Ib1521b0920d40828f30a7ee00e6996ab032c9ef6
2021-05-13 14:36:49 -07:00
Xiaoyu Jin
3a95c180c7 Log InitializeStats in the platform
Bug: b/173532925
Test: atest
CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:AppSearchImplTest
FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest

Change-Id: Ib2f1b13addbd8ec2fe95db38313b870672370910
2021-05-13 13:21:38 -07:00
Alexander Dorokhine
c09e57ce61 Merge "Link framework-appsearch against the module_current SDK." into sc-dev 2021-05-13 20:03:08 +00:00
Xiaoyu Jin
d6d22f0ecf Log SearchStats in the platform
Bug: b/173532925
Test: atest
CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:AppSearchImplTest
FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest

Change-Id: I6545cb6722ad6f4680e6b0f7800e1833ecc80e0e
2021-05-13 12:51:29 -07:00
Alexander Dorokhine
0777c474cf Update framework from jetpack.
Changes included:
* 8acc04a: Remove unnecessary clones in some builders.
* d3ad52e: Build-gated trace logs for AppSearchImpl.
* 6ff6bd3: Reimplement AppSearchImpl's initialization flow.
* 02658df: Minor fixes to AppSearchImpl.
* 15aa2a1: Clarify docs around AppSearchBatchResult.Builder.
* 3041027: Document how to get an AppSearchSession for developers.
* 6cf5f78: Document parameters of report usage requests.
* ad3f9fa: Implement MagrationFailure.toString()
* dc74c99: Add coverage to the public api MigrationFailure.
* 755bf36: Add API coverage for SetSchemaRequest.

Bug: 184575938
Bug: 184575880
Bug: 175430168
Bug: 187849451
Bug: 187351264
Bug: 187351084
Bug: 186242890
Bug: 187420294
Bug: 187880094
Bug: 183239679
Bug: 183239898
Test: Presubmit
Change-Id: Ibe1a6422326c8d19b18f49dac6b8826617cd2bc2
2021-05-13 11:55:09 -07:00
Alexander Dorokhine
c0bf81a526 Link framework-appsearch against the module_current SDK.
This requires removal of all hidden APIs from the framework code.

Preconditions are jarjar'd into the jar.
Other APIs are replaced with system-visible equivalents.

Bug: 181787682
Bug: 146218515
Test: Presubmit
Change-Id: I6649bed3260ac08a0f66abd7a8ec545c401761fe
2021-05-12 11:34:51 -07:00
Alexander Dorokhine
ffa64b6009 Update framework from jetpack.
Changes included:
* 25ca4ff: Sync AppSearch with google3 update ag/14473436 (f13a174)
* a1ad7b4: Make GenericDocument#toString print results in a deterministic order.
* bf3051b: Sync AppSearchResult and AppSearchBatchResult to framework.
* dd3c05f: Add more call types
* fb27537: Add API coverage for SearchSpec.getProjections

Bug: 185445694
Bug: 187424629
Bug: 146218515
Bug: 173532925
Bug: 183239965
Test: Presubmit
Change-Id: I5392a10fe03451a895136cdbc75d5bf0df081aa3
2021-05-11 12:42:17 -07:00
Alexander Dorokhine
e3eea0e2a5 Merge "Delete deprecated methods after dogfood transition." into sc-dev 2021-05-11 17:29:35 +00:00
TreeHugger Robot
111df38202 Merge "Refactor how AppSearchResult and AppSearchBatchResult are parcelled." into sc-dev 2021-05-11 17:06:08 +00:00
Alexander Dorokhine
7de178b090 Delete deprecated methods after dogfood transition.
Bug: 181887768
Test: Presubmit
Change-Id: I729f6cc0acb15cfc78b4c39be165d72443c26879
2021-05-10 23:20:10 -07:00
Alexander Dorokhine
a0553f4d59 Update framework from Jetpack.
Changes included:
* 8b28ee6: Adds cts test to verify that CJK search.
* 96876cf: Display a single document selected from the documents list
* 8acd6a2: Add PackageIdentifier CTS test.
* 7e6f029: Add SearchSpec.Builder CTS tests.
* 7a545c8: Add CTS tests for AppSearchSchema property config builders.
* 9224f38: Add RemoveByDocumentIdRequest CTS tests.
* 6dadb66: Add tests for ReportUsageRequest and ReportSystemUsageRequest.
* 08b6b0a: Add StorageInfo.Builder Cts Tests
* b178f79: Add cts test for SearchResult, MatchInfo and MatchRange
* 158a0fa: Add GetByDocumentIdRequestCtsTest CTS tests.
* b3d5fb0: Logging stats for SetSchema.
* 7605e1e: Add test coverage for SetSchemaRequest.
* 55e10b2: Add test coverage for GenericDocument.
* 0038649: Allow reuse of SearchSpec.Builder.
* 1a309db: Mark testDocument_toString test as @Ignore
* d682ee2: Add test coverage to androidx.appsearch.exceptions
* 9dce38b: Refactor SetSchemaResponseCtsTest to unit test
* c24fd88: Prevent SearchSpec.Builder from copying members unless reused.
* 0b3b84f: Allow reuse of SearchResult.Builder.
* 56d897c: Allow reuse of builders related to AppSearchSchema.
* 27c774a: Allow reuse of remaining builders except GenericDocument.
* ffffb62: Add test coverage for SetSchemaResponse.
* 8b61217: Refactor CTS package to put 'cts' at the highest level.

Bug: 183574903
Bug: 179680545
Bug: 183239895
Bug: 183239507
Bug: 183239552
Bug: 183239611
Bug: 183239665
Bug: 183239677
Bug: 183239702
Bug: 183239768
Bug: 183239769
Bug: 183240150
Bug: 183239894
Bug: 183239741
Bug: 183239511
Bug: 183239590
Bug: 184396610
Bug: 182958600
Bug: 184396708
Bug: 183239760
Bug: 183239899
Bug: 183239508
Bug: 183239762
Bug: 183239705
Bug: 183240098
Bug: 173532925
Bug: 183239669
Bug: 183239682
Bug: 187424629
Bug: 183239509
Bug: 183151637
Bug: 178060626
Bug: 184575547
Bug: 184575981
Bug: 184575930
Bug: 184175556
Bug: 180481315
Bug: 183239740
Test: Presubmit
Change-Id: I5a119d5c779ac48601f88e28867fd5bc3e373065
2021-05-10 16:34:29 -07:00
Alexander Dorokhine
2ee7641af7 Refactor how AppSearchResult and AppSearchBatchResult are parcelled.
Mainline modules seem to be metalava'd differently, causing the CREATOR,
describeContents(), and other parcelling methods to become part of the
public API.

Additionally, AppSearchResult and AppSearchBatchResult were forked from
Jetpack with parcelling added, and manually maintained.

Additionally, the parcelling wouldn't work properly if the keys and
values are not themselves parcelable, but this was not clearly
documented or called out.

This CL fixes these problems by creating parcelable wrappers around the
upstream Jetpack AppSearchResult and AppSearchBatchResult, usable only
when they contain parcelable keys and values.

Bug: 146218515
Test: Presubmit
Change-Id: I828a22dc6dae3e46f5d167f1a9d12627ba15d9fd
2021-05-04 13:24:47 -07:00
Alexander Dorokhine
b10c5162c4 Temporarily re-add methods and classes removed in ag/1420175.
The methods and classes are hidden and marked with @UnsupportedAppUsage.
This fixes broken dogfooders while the new SDK is being propagated.

Bug: 181887768
Test: Jetpack unit tests against old SDK
Change-Id: Ibc8aaed6ffa751b75bf5b23e04547eba2a4cda86
2021-04-30 19:05:16 -07:00
Alexander Dorokhine
45bb21c98d Update Framework from Jetpack.
Included changes:
* 4c1b251: Sync AppSearch with google3 update ag/14342999 (8f8b43)
* cdf1913: Add a GenericDocument#toBuilder API.
* 64f80f3: Improve snippeting and matching per API feedback.
* 23dd35c: Move AppSearchEmail out of the prod tree into the test utils.

Bug: 171882200
Bug: 186520196
Bug: 186717514
Test: Presubmit
Change-Id: I9d8e1fb87e6e74c57a38f3a27cdd04a1a3ccf90b
2021-04-29 18:00:32 -07:00
Alexander Dorokhine
91568a6dfa Remove AndroidFuture from AppSearch.
It is a hidden API and cannot be used in mainline.

Bug: 181787682
Test: Presubmit
Change-Id: I74a1aafdad8dec110b19ecc61a0668ae380196e7
2021-04-28 23:10:42 -07:00
Alexander Dorokhine
1b690b4540 Update framework from jetpack.
Changes included:
* 07eea57: Log stats for Initialize
* 52b744b: Document all of AppSearchException's parameters.
* 5d4b494: Improve the java document for migrated, deleted and incompatible type.
* 63b8650: Log stats for Query

Bug: 173532925
Bug: 183395357
Test: Presubmit
Change-Id: I9279eae9d44f48a7c855f28066d21c7a1454a00d
2021-04-27 14:47:39 -07:00
Alexander Dorokhine
ca083d96de Update framework from jetpack.
Included changes:
* b7122be: Update Builders to comply with API council requirements.
* 60b34cd: Changes to AppSearchSchema builders to comply with API requirements.
* c6f7eee: Support property paths in GenericDocument.
* cbee331: Update documentation to distinguish between AppSearchSession and GlobalSearchSession
* cbdd3b9: Rename ReportUsage#usageTimeMillis to #usageTimestampMillis.
* cc09d3a: Implement value indices in GenericDocument.
* e7faa03: Rename isIndexNestedProperties to shouldIndexNestedProperties.
* aaa6e81: Support @CurrentTimeMillisLong in export.
* 388c2b4: Rename GenericDocument's "uri" to "id" everywhere.

Bug: 184576792
Bug: 184576806
Bug: 184174844
Bug: 180481315
Bug: 179797058
Bug: 175146044
Bug: 184175636
Bug: 185492298
Test: Presubmit
Change-Id: I81e396c1d4770479654a3a69ea598e23de88ac9a
2021-04-21 11:23:09 -07:00
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
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
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
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
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
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
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
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
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
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
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