OSDN Git Service

Automatically grant URI permission as needed.
authorYohei Yukawa <yukawa@google.com>
Thu, 30 Jun 2016 23:27:46 +0000 (16:27 -0700)
committerYohei Yukawa <yukawa@google.com>
Thu, 30 Jun 2016 23:27:46 +0000 (16:27 -0700)
commitf3806f57a59ede663f3fa2ad1f5080bdbf20e372
tree2321c0da2589e0a72cd1d430d9e605a7d7a9831b
parent8acb1a7570f797b387f08af166085008291d4d4b
Automatically grant URI permission as needed.

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.  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.

If we do not do this and there is an application that forgot to call
that method then there is no way for IME developers to prevent
permission denial from happening in the application except for relaxing
the default permission of the ContentProvider just because of such an
application.

Although application developers are still expected to explicitly call
InputContentInfo#{request,release}Permission(), forgetting to call
InputContentInfo#requestPermission() does not hurt the user anymore.

With this CL, calling InputContentInfo#requestPermission() after calling
InputContentInfo#releasePermission() is also allowed.

Bug: 29892936
Change-Id: Id955435dd2e72549ee7134f46b3c6951581694ad
core/java/android/view/inputmethod/InputContentInfo.java
core/java/com/android/internal/view/IInputConnectionWrapper.java