OSDN Git Service

Remove InputContentInfo#requestPermission()
authorYohei Yukawa <yukawa@google.com>
Thu, 30 Jun 2016 16:32:54 +0000 (09:32 -0700)
committerYohei Yukawa <yukawa@google.com>
Thu, 30 Jun 2016 16:32:54 +0000 (09:32 -0700)
commitc4b8f36de5523366e354fc01b6cba81ad72f6423
treed412808b7ce7a9e695a9d19452febe109a9e222b
parent8e3b57aad55a06f05ae55c7a01667d1be35c34d7
Remove InputContentInfo#requestPermission()

It turns out that requiring editor authors to call
InputContentInfo#requestPermission() as needed is just confusing and can
cause compatibility issues, because if an editor author forgot to call
that method then there would be no way for IME developers to prevent
permission denial except for relaxing the default permission of the
ContentProvider just because of such an application. This is not what we
want to see.

My conclusion is that the system should automatically call
InputContentInfo#requestPermission() (or do any equivalent operation)
when InputConnection#INPUT_CONTENT_GRANT_READ_URI_PERMISSION is
specified, like we have done in Context#startActivity().

With this CL, the system automatically grants a temporary URI permission
to the target application when the IME calls
InputConnection#commitContent() with
InputConnection#INPUT_CONTENT_GRANT_READ_URI_PERMISSION, and the
temporary permission will be revoked by any of the following events:
 - InputContentInfo#releasePermission() is explicitly called by the
   target application.
 - The target application returned false in
   InputConnection#commitContent().
 - All the InputContentInfo instances copied from the original one are
   GC-ed.

Bug: 29450031
Bug: 29892936
Change-Id: I37fb744e4d3d1c59177fb0a9be4ef5c325c9a39f
api/current.txt
api/system-current.txt
api/test-current.txt
core/java/android/view/inputmethod/InputConnection.java
core/java/android/view/inputmethod/InputContentInfo.java
core/java/com/android/internal/inputmethod/IInputContentUriToken.aidl
core/java/com/android/internal/view/InputConnectionWrapper.java
services/core/java/com/android/server/InputContentUriTokenHandler.java
services/core/java/com/android/server/InputMethodManagerService.java