summaryrefslogtreecommitdiff
path: root/apex/appsearch
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-07-22Merge "Fix validation crash for nextPageToken." into sc-devTerry Wang
2021-07-22Merge "Log stats for Optimize" into sc-devXiaoyu Jin
2021-07-22Merge "Remove deprecated, hidden versions of changed public APIs." into sc-devTreeHugger Robot
2021-07-21Fix validation crash for nextPageToken.Terry Wang
We are caching nextPageToken in query(), and validate it in getNextPage(). But when it reach to the end, the token will be changed to 0. And it will crash if user is trying to fetch next page since 0 is not cached and won't passed the validation. This change fix the issue. Without it, users maybe crashed if they are trying to retrieve all documents in all result pages. Bug: 187972715 Test: AppSearchSessionUnitTest Change-Id: Ia95feb52f2a37348e11afdf0b320c61bfce22d40
2021-07-21Merge "Allow GenericDocument accept a String property longer than 20_000." ↵TreeHugger Robot
into sc-dev
2021-07-19Ensure calling user is the same as requested user.Cassie Wang
This prevents any cross-user requests. Cross-user requests are already not allowed, but due to a bug elsewhere in the code. This intentionally handles the case and also throws a SecurityException. Bug: 193903221 Test: presubmit Test: manually checked cross-user requests get an exception. Change-Id: I5bd867b86b972452daa2d8253f3c19f059a8a4b3
2021-07-16Allow GenericDocument accept a String property longer than 20_000.Terry Wang
This limit was removed from the AppSearch Jetpack API meaning that a client could construct a GenericDocument successfully, but then have a PutDocuments call fail when converting from androidx.appsearch.GenericDocument to android.appsearch.GenericDocument. Icing still has a total document size limit which is 16 MiB. The put call will fail if it trying to write such document. Bug: 192909904 Test: GenericDocumentTest Change-Id: I86f97acc3a8e0f1c25fadf597aed9f42a2c493eb
2021-07-15Log stats for OptimizeAlexander Dorokhine
OptimizeStats is crucial for us to tune our configuration for optimization, which might affect the health of AppSearch and system overall. Details can be found in Ib7ae475cc035d1b69969df1e22ac409895e0e3fa. Also add sampling parameters in AppSearchConfig for: 1) initializeStats 2) searchStats 3) globalSearchStats 4) optimizeStats Bug: 173532925 Bug: 175255572 Test: AppSearchStatsTest, FrameworksMockingServicesTests:AppSearchConfigTest, CtsAppSearchTestCases Ignore-AOSP-First: AppSearch is not available on AOSP yet Change-Id: Id61704407bdb40707cb8fa46b556024aea9f9083
2021-07-15Merge "Cache nextPageTokens that a package can use." into sc-devCassie Wang
2021-07-12Remove deprecated, hidden versions of changed public APIs.Alexander Dorokhine
These versions were kept around to facilitate dogfooder transition during the API council review process. Our dogfooders' apps have updated to versions that use the finalized sdk, so these are no longer required. Bug: 181887768 Test: Presubmit Test: Flash device, run jetpack platform backend tests Change-Id: I4852b1ecc25254ffb781926ca799d0c8128339ab
2021-07-10Merge "Register callback to statsD for AppSearchStorageInfo" into sc-devXiaoyu Jin
2021-07-09Register callback to statsD for AppSearchStorageInfoXiaoyu Jin
Bug: b/173532925, b/193254235 Test: statsd_testdrive 10116 atom { app_search_storage_info { user: 0 total_storage_size_bytes: 3929088 document_storage_info { num_alive_documents: 1116 num_deleted_documents: 4933 num_expired_documents: 0 document_store_size_bytes: 3637760 document_log_size_bytes: 2928640 key_mapper_size_bytes: 49152 document_id_mapper_size_bytes: 49152 score_cache_size_bytes: 122880 filter_cache_size_bytes: 73728 corpus_mapper_size_bytes: 20480 corpus_score_cache_size_bytes: 4096 namespace_id_mapper_size_bytes: 20480 num_namespaces: 21 } schema_store_storage_info { schema_store_size_bytes: 39424 num_schema_types: 4 num_total_sections: 9 num_schema_types_sections_exhausted: 0 } index_storage_info { index_size_bytes: 248320 lite_index_lexicon_size_bytes: 155648 lite_index_hit_buffer_size_bytes: 262144 main_index_lexicon_size_bytes: 0 main_index_storage_size_bytes: 0 main_index_block_size_bytes: 4096 num_blocks: 1 min_free_fraction: 0.99999905 } } } appsearch cts tests Change-Id: I009c0932e36afb467c93013215d1e67dfae5a28a
2021-07-09Merge "Add check for optimize after each mutation operation." into sc-devTerry Wang
2021-07-09Add check for optimize after each mutation operation.Terry Wang
Optimize is an important job for AppSearch to work properly. It could collect garbage and release resources. Without it, the garbage resource will last forever and the device's space will be fulled up by zombie documents. The algorithm to trigger optimize is: 1: Query garbage resource info after a batch of mutation operations. 2: Only trigger optimize if there are enough resource could be released. The behavior exists in AppSearch Jetpack for a while and working properly for our Jetpack dogfooders. Bug: 175255572 Test: FrameworkOptimizeStrategyTest Test: AppSearchConfigTest Test: AppSearchImplTest Change-Id: Ib7ae475cc035d1b69969df1e22ac409895e0e3fa
2021-07-08Cleanup appsearch platform loggerTej Singh
Test: TH Bug: 192684294 Change-Id: I8e6828b9cbcbd30d06370ad19f2d36290298da25
2021-07-07Merge "Cleanup AcitivityManagerConstants and AppSearch" into sc-devTej Singh
2021-07-02Cleanup AcitivityManagerConstants and AppSearchTej Singh
Test: TH Bug: 192684294 Change-Id: Iaf4d7893214297408f609ce58573846f2b6adf5e
2021-07-02Cache nextPageTokens that a package can use.Alexander Dorokhine
A user-package can only manipulate their own nextPageTokens (i.e. advance or invalidate it) otherwise some other package could affect the search results of a package. Because we check at the user-package level, this still allows a package to manipulate nextPageTokens that were returned for different databases. This isn't recommended, but not a security risk since it's the package's own data. Note that manipulating nextPageTokens isn't available through AppSearch's public API. This would be if someone were circumventing the normal AppSearchSession. Bug: 187972715 Test: AppSearchImplTest Change-Id: I67a22f3ae171ea2886eb89dcf493286a8421408d
2021-07-02Merge "Add ability to enforce limits on docs per package and size of doc." ↵Alexander Dorokhine
into sc-dev
2021-07-01Merge "Move libicing.so out of /usr/lib, into the appsearch apex." into sc-devAlexander Dorokhine
2021-07-01Add ability to enforce limits on docs per package and size of doc.Alexander Dorokhine
This is needed to prevent abuse of our service and to share icing docids in framework, which are the resource we are most likely to run out of. Without this change, an app could use the platform backend to index a very high number of documents and exhaust the docid limit, thereby preventing any other app from using AppSearch. Bug: 170371356 Test: New testcases added to AppSearchImplTest Change-Id: I03ade35072bc69b84f8fcefed72b3c3bc2b8ee68
2021-06-29Merge "Enable appsearch to perform its own hidden API processing" into sc-devPaul Duffin
2021-06-28Move libicing.so out of /usr/lib, into the appsearch apex.Alexander Dorokhine
Bug: 169826971 Test: Presubmit Change-Id: Ibe5dd5014c5a70cb5b0fcf3eb33db9911047bdc8
2021-06-29Enable appsearch to perform its own hidden API processingPaul Duffin
Previously, the hidden API encoding of the appsearch boot dex jars, i.e. those dex jars that appsearch contributes to the bootclasspath were done as part of the monolithic hidden API processing. This change causes the encoding to be done by the appsearch's bootclasspath_fragment. This change involves the following: * Addition of the fragments property to the appsearch's bootclasspath_fragment module to list all the other bootclasspath_fragment modules on which this depends. * Addition of the additional_stubs property to add stubs for APIs that are not provided by another bootclasspath_fragment. The build automatically checks that the hidden API flags which are computed by appsearch and encoded into its boot dex jars match those that are generated by the monolithic processing so this is guaranteed to be safe. Bug: 179354495 Test: m com.android.appsearch - ensure that the generated APEX is byte-for-byte identical before and after these changes. m out/soong/hiddenapi/hiddenapi-flags.csv - make sure that they are not changed by this. Change-Id: I8e5a60d64d3e147535e11a4ad30404f9888f53d2
2021-06-28Merge "Port appsearch-service to the system_server_current sdk." into sc-devAlexander Dorokhine
2021-06-24Port appsearch-service to the system_server_current sdk.Alexander Dorokhine
The hidden APIs have already been fixed, so this CL mostly changes build rules. Bug: 181787682 Bug: 146218515 Test: Presubmit Change-Id: I5d68d68ce8f39753f62c5e3680216877b7d7f819
2021-06-24Merge "Prevent instant apps from using AppSearch." into sc-devCassie Wang
2021-06-23Prevent instant apps from using AppSearch.Cassie Wang
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-23Sync framework from jetpack.Alexander Dorokhine
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-22Update framework from jetpack.Alexander Dorokhine
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-18Update framework from jetpack.Alexander Dorokhine
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-18Guard system usage reporting by checking the caller has system access.Alexander Dorokhine
Adding this check in a testable way requires refactoring VisibilityStore to pull it out of management by the AppSearchImpl object. It is now initialized as a sibling of AppSearchImpl, managed by AppSearchUserInstanceManager. This has several benefits: * Breaks the complicated initialization inter-dependency between AppSearchImpl and VisibilityStore * Reduces duplicative singleton managers * Allows AppSearchImpl to be tested more easily by accepting a "hasSystemSurfaceable" boolean that can be set in tests * Reduces the number of times we have to call into VisStore; we can determine whether the caller has system access in advance instead of repeating the check for every schema type Bug: 180058203 Bug: 183031844 Test: GlobalSearchSessionCtsTest#testReportSystemUsage_ForbiddenFromNonSystem Test: GlobalSearchSessionPlatformCtsTest#testReportSystemUsage Test: VisibilityStoreTest Change-Id: I84c84819f287628ccf8af369f5481a8e90255f62
2021-06-18Merge "Clear the uninstalled package data in AppSearch." into sc-devTerry Wang
2021-06-16Merge "Explicitly set generate_hashtree: false" into sc-devNikita Ioffe
2021-06-16Clear the uninstalled package data in AppSearch.Terry Wang
Since we cannot access locked user's data and clear it when a package got removed. When a user is unlocking, we should prune their data and remove all data that doesn't belong to any of installed packages. This will also help in handling the case where device gets rebooted before the data is cleared for an uninstalled package. Bug: 186151459 Test: atest --rebuild-module-info CtsAppSearchHostTestCases Change-Id: Ic6d151621a88df7806901781d3edfec65700c35d
2021-06-15Switch to a non-hidden way to compute data path and switch to subdir.Alexander Dorokhine
We need to store other things in the appsearch data dir other than what Icing stores, such as the storage info cache. Bug: 177685938 Bug: 181787682 Test: Presubmit Change-Id: I903c34a2c891d617217d44f5126d0d31c8c6bf39
2021-06-15Merge "Update framework from jetpack." into sc-devAlexander Dorokhine
2021-06-15Merge "Close AppSearchImpl in handling user removed broadcast." into sc-devTerry Wang
2021-06-14Explicitly set generate_hashtree: falseNikita Ioffe
Non-updatable APEXes are going to be only present on a dm-verity protected read-only partition. For such APEXes there is no need in embedding a hashtree. This is a no-op change in preparation of switching default value of generate_hashtree to true. Bug: 190621617 Test: m Change-Id: I0283fb03908a87490e5e29b803553977b8b6729f
2021-06-10Fix some incorrect annotations in AppSearch.Alexander Dorokhine
Bug: 180763772 Test: Builds Change-Id: I9f5dd9af8e3f3715be58004bb70bee5c5692b721
2021-06-09Close AppSearchImpl in handling user removed broadcast.Terry Wang
Flushing takes a few ms, it seems like a pretty good trade off compared to keeping an icing instance in memory forever. Bug: 179390369 Test: presubmit Change-Id: Ic0493137dc8c33d44bd074bbd9ca4ae442049513
2021-06-09Update framework from jetpack.Alexander Dorokhine
Changes included: * 9b55e76: Remove GeneralStats * b467803: Upstream fixes for UserHandle and VisibilityStore. * 47d8dca: Allow FrameworkOptimizeStrategy to be export to Framework. Bug: 173532925 Bug: 181787682 Bug: 175255572 Test: Presubmit Change-Id: I1aec9cb824f8ef64df98f252ed5a6338abc9e152
2021-06-09Merge "Use AppSearchConfig in PlatformLogger" into sc-devXiaoyu Jin
2021-06-08Use AppSearchConfig in PlatformLoggerXiaoyu Jin
bug: 173532925 Test: atest CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch FrameworksServicesTests:AppSearchImplTest FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest FrameworksMockingServicesTests:com.android.server.appsearch.AppSearchConfigTest Change-Id: I3589f0071d456e2167cd207e83acaf1d884f9992
2021-06-08Log two new fields for initializeStatsXiaoyu Jin
Test: it builds bug: b/173532925 Change-Id: Ia31fc1fb54827efa140e16eb654e0ddfeeb28a07
2021-06-04Move to non-hidden APIs for handleUser and broadcast registration.Alexander Dorokhine
The implementation of handleIncomingUser is copied from ag/13200660 (1d1547b). Bug: 181787682 Test: Presubmit Change-Id: I946199a8844e7fd6ea5574b873da56d8b8630f62
2021-06-03Merge "Update VisibilityStore to handle role-based system visibility." into ↵Cassie Wang
sc-dev
2021-06-03Update VisibilityStore to handle role-based system visibility.Alexander Dorokhine
Bug: 187113133 Test: VisibilityStoreTest Change-Id: Ic28110fba4a3639b087869d6b3af90e4f3f6c207
2021-06-02Merge "Add AppSearchConfig in AppSearch" into sc-devXiaoyu Jin