OSDN Git Service

Require InputContentInfo.requestPermission()
authorYohei Yukawa <yukawa@google.com>
Tue, 10 Jan 2017 22:32:46 +0000 (14:32 -0800)
committerYohei Yukawa <yukawa@google.com>
Tue, 10 Jan 2017 22:32:46 +0000 (14:32 -0800)
commit6b422e287c984c85f8c1406db7d127e82787826e
treea5bbb7de2ba7ce1bd27e70a07be2ba6fc08ae4ff
parent7cf986aba344c19559d83647db9bf8d41fc6f06c
Require InputContentInfo.requestPermission()

This CL logically reverts my previous CL [1], which allowed the system
automatically grant a temporary URI permission to the target
application when the IME calls InputConnection#commitContent() with
InputConnection#INPUT_CONTENT_GRANT_READ_URI_PERMISSION.

Based on conversations with application developers who have supported
Commit Content APIs, I concluded that my assumption that automatically
granting the permission without an explicit call of
InputContentInfo.requestPermission() would help application developers
was wrong.  They anyway need to take care of the situation where the
app fails to read the data from the given content URI.  Thus just
receiving SecurityException() because of not calling it is still one
of such cases that application developers cannot forget about.

Therefore with this CL InputContentInfo.requestPermission() becomes
mandatory when InputConnection#INPUT_CONTENT_GRANT_READ_URI_PERMISSION
is specified.

 [1]: Id955435dd2e72549ee7134f46b3c6951581694ad
      f3806f57a59ede663f3fa2ad1f5080bdbf20e372

Bug: 32315394
Test: By github.com/googlesamples/android-CommitContentSampleApp
Change-Id: I8a3cb79ae6d6c4113914734799b21bfc96e3ca3e
core/java/com/android/internal/view/IInputConnectionWrapper.java