Skip to content
Commit 9b26c3c9 authored by Alexander Dorokhine's avatar Alexander Dorokhine
Browse files

Guard system usage reporting by checking the caller has system access.

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
parent 5c86c0c1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment