Skip to content
Commit 9f141ee8 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Plumb Context#mUser to TextServicesManager to TextServicesManagerService

This is a follow up CL to our previous CL [1], which enabled spell
checker for background users.  In that CL, we assumed that spell
checker user ID can and should always be determined by the calling
user ID.  This assumption is not valid at least for direct-reply
notifications on System UI, because System UI always runs as user 0 no
matter who is the current active user.

In order to allow TextServicesManagerService (TSMS) connect to the
right user for such a special use case, this CL introduces a hidden
parameter "userId" to each IPC so that clients that have
INTERACT_ACROSS_USERS_FULL can override the target user ID when
necessary.

For instance, to interact with user 10's spell checker services, you
can obrain a special instance of TextServicesManager as follows.

  TextServicesManager tsmForUser10 = context
          .createPackageContextAsUser("android", 0, 10 /* userId */)
          .getSystemService(TextServicesManager.class)

If the calling process does not belong to user 10, any operations on
that TextServicesManager will result in SecurityException unless the
calling package needs to have INTERACT_ACROSS_USERS_FULL.

This CL is just a preparation.  There should be no user-visible
behavior change yet.

 [1]: I06c27ef834203a21cc445dc126602c799384527b
      06a26240

Bug: 123043618
Test: spell checker still works
Change-Id: I31dda3ae8795190d44b0622b8335c34ddbc5dd48
parent 5daa3568
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