summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2016-06-23 01:29:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-23 01:29:58 +0000
commitd02470f5a89a4e4a94dda371ab472e9cedd1130d (patch)
tree5978c18edcb28d383a877debcaf482da3df668c9 /core/java/android/inputmethodservice/InputMethodService.java
parentd630384cf38e3aa805259f4f62dbbf1f971455a3 (diff)
parentdc42d7dd135460701435a8f925eae9c7b47d14ba (diff)
Merge \"Add InputMethodService#exposeContent()\" into nyc-mr1-dev
am: dc42d7dd13 Change-Id: Icf3ca0403c7dee26a3083ca98ca1239887d471bc
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 4799773d9ed6..8e0e0b0e4b9a 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -23,6 +23,7 @@ import android.annotation.CallSuper;
import android.annotation.DrawableRes;
import android.annotation.IntDef;
import android.annotation.MainThread;
+import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.Dialog;
import android.content.Context;
@@ -65,6 +66,7 @@ import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
+import android.view.inputmethod.InputContentInfo;
import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
@@ -2598,6 +2600,39 @@ public class InputMethodService extends AbstractInputMethodService {
}
/**
+ * Allow the receiver of {@link InputContentInfo} to obtain a temporary read-only access
+ * permission to the content.
+ *
+ * <p>Make sure that the content provider owning the Uri sets the
+ * {@link android.R.styleable#AndroidManifestProvider_grantUriPermissions
+ * grantUriPermissions} attribute in its manifest or included the
+ * {@link android.R.styleable#AndroidManifestGrantUriPermission
+ * &lt;grant-uri-permissions&gt;} tag. Otherwise {@link InputContentInfo#requestPermission()}
+ * can fail.</p>
+ *
+ * <p>Although calling this API is allowed only for the IME that is currently selected, the
+ * client is able to request a temporary read-only access even after the current IME is switched
+ * to any other IME as long as the client keeps {@link InputContentInfo} object.</p>
+ *
+ * @param inputContentInfo Content to be temporarily exposed from the input method to the
+ * application.
+ * This cannot be {@code null}.
+ * @param editorInfo The editor that receives {@link InputContentInfo}.
+ * @return {@code false} if we cannot allow a temporary access permission.
+ */
+ public final boolean exposeContent(@NonNull InputContentInfo inputContentInfo,
+ @NonNull EditorInfo editorInfo) {
+ if (inputContentInfo == null) {
+ throw new NullPointerException("inputContentInfo");
+ }
+ if (editorInfo == null) {
+ throw new NullPointerException("editorInfo");
+ }
+
+ return mImm.exposeContent(mToken, inputContentInfo, editorInfo);
+ }
+
+ /**
* Performs a dump of the InputMethodService's internal state. Override
* to add your own information to the dump.
*/