Re-enable cross-profile use of spell checker APIs
Recently we successfully removed the restriction that up to one
SpellCheckerService can be active at the same time [1]. This still
makes much sense at high level, but at the ecosystem level there are
still some products / components that depend on the previous behavior
that child profile users can use parent profile's spell checker
service, which was originally introduced as a stopgap solution for
Android N MR1 [2].
Our decision for Android P for now is to revert back to the previous
behavior only when the calling process is running under work
profile.
At the implementation level, we can summarize the new behavior as
follows:
* When TextServicesManager APIs are called from work-profile
processes, those API calls will be evaluated with parent-profile's
user ID to match the previous behavior [2].
* If the currently selected spell checker is not a pre-installed
one, then API calls from work profile will fail to match the
previous behavior [2].
* When TextServicesManager APIs are called from non work-profile
processes, those API calls will continue being evaluated with
calling user ID, as we planned for Android P [1].
* TextServicesData will not be created for child profile users.
[1]: I06c27ef834203a21cc445dc126602c799384527b
06a2624049f09e1ad68f8ab74fdb525aacd5c1e5
[2]: Iae9045ba5baccd04ed68906e7afb9160677ec4a5
095fa371643b1d8e829067ea4ed93c357b39e773
Bug: 63041121
Bug: 64718412
Bug: 70922751
Bug: 73609140
Fix: 73862883
Test: atest FrameworksCoreTests:com.android.internal.textservice.LazyIntToIntMapTest
Test: Manually tested with Test DPC as follows:
* When AOSP Spell Checker is pre-installed and the current spell
checker, both main profile and work profile can use AOSP spell
checker.
* When SampleSpellCheckerService is side-loaded and the current
spell checker, only main profile can use
SampleSpellCheckerService.
Change-Id: Ic046f832f203115106409a53418a5746eb6d4939
5 files changed