summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorJoanne Chung <joannechung@google.com>2020-01-02 19:03:16 +0800
committerJoanne Chung <joannechung@google.com>2020-01-06 16:43:45 +0800
commitd9a916fe4da8d91f7a1e0d36fb1bde7d333e76b9 (patch)
tree4fc0473b4dd1b1decdb0f46d296d462620554ad3 /core/java/android/inputmethodservice/InputMethodService.java
parentcdbf667823755388e99f20cab228b2d78be2ada0 (diff)
Finish autofill integration with keyboard cleanup tasks
1. Only print log when debug is on. 2. Callback be notified when input does not start. 3. Avoid using hard code tag in Log class. 4. onCreateInlineSuggestionsRequest() do nothing in NOP. 5. Add missing javadoc. Bug: 146525448 Test: manual verification Change-Id: I41e1de92ffcdb8020aef99acbfec274e0294bad3
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index fe4f860484cf..ffb97c09a905 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -517,7 +517,9 @@ public class InputMethodService extends AbstractInputMethodService {
@Override
public void onCreateInlineSuggestionsRequest(ComponentName componentName,
AutofillId autofillId, IInlineSuggestionsRequestCallback cb) {
- Log.d(TAG, "InputMethodService received onCreateInlineSuggestionsRequest()");
+ if (DEBUG) {
+ Log.d(TAG, "InputMethodService received onCreateInlineSuggestionsRequest()");
+ }
handleOnCreateInlineSuggestionsRequest(componentName, autofillId, cb);
}
@@ -755,7 +757,12 @@ public class InputMethodService extends AbstractInputMethodService {
private void handleOnCreateInlineSuggestionsRequest(@NonNull ComponentName componentName,
@NonNull AutofillId autofillId, @NonNull IInlineSuggestionsRequestCallback callback) {
if (!mInputStarted) {
- Log.w(TAG, "onStartInput() not called yet");
+ try {
+ Log.w(TAG, "onStartInput() not called yet");
+ callback.onInlineSuggestionsUnsupported();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to call onInlineSuggestionsUnsupported.", e);
+ }
return;
}
@@ -768,8 +775,12 @@ public class InputMethodService extends AbstractInputMethodService {
private void handleOnInlineSuggestionsResponse(@NonNull ComponentName componentName,
@NonNull AutofillId autofillId, @NonNull InlineSuggestionsResponse response) {
if (!mInlineSuggestionsRequestInfo.validate(componentName)) {
- Log.d(TAG, "Response component=" + componentName + " differs from request component="
- + mInlineSuggestionsRequestInfo.mComponentName + ", ignoring response");
+ if (DEBUG) {
+ Log.d(TAG,
+ "Response component=" + componentName + " differs from request component="
+ + mInlineSuggestionsRequestInfo.mComponentName
+ + ", ignoring response");
+ }
return;
}
onInlineSuggestionsResponse(response);
@@ -841,7 +852,7 @@ public class InputMethodService extends AbstractInputMethodService {
*/
public boolean validate(ComponentName componentName) {
final boolean result = componentName.equals(mComponentName);
- if (!result) {
+ if (DEBUG && !result) {
Log.d(TAG, "Cached request info ComponentName=" + mComponentName
+ " differs from received ComponentName=" + componentName);
}