From 4513699583d26d5f6d68079e53d5bdbffa772cf4 Mon Sep 17 00:00:00 2001 From: Tarandeep Singh Date: Thu, 8 Mar 2018 10:52:03 -0800 Subject: [PATCH] Make few of the new IMS API methods final d8d03a8e1b5b7f4b05d7f99a19d356ffd95edb58 added new methods to InputMethodService. Allowing IME developers to override some of these methods would introduce unnecessary complexity. Making these methods final makes sure developers cannot inject some unexpected behavior when called by system. Bug: 73701052 Test: atest InputMethodServiceTest Test: atest CtsInputMethodServiceHostTestCases Change-Id: I1af4ed05a0b7306d840a21129e921a57b4a5fc33 --- api/current.txt | 10 +++++----- .../android/inputmethodservice/InputMethodService.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/current.txt b/api/current.txt index b2a6ba6251076..dd46eef132c1c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -21209,7 +21209,7 @@ package android.inputmethodservice { method public void onWindowHidden(); method public void onWindowShown(); method public void requestHideSelf(int); - method public void requestShowSelf(int); + method public final void requestShowSelf(int); method public boolean sendDefaultEditorAction(boolean); method public void sendDownUpKeyEvents(int); method public void sendKeyChar(char); @@ -21219,13 +21219,13 @@ package android.inputmethodservice { method public void setExtractView(android.view.View); method public void setExtractViewShown(boolean); method public void setInputView(android.view.View); - method public boolean shouldOfferSwitchingToNextInputMethod(); + method public final boolean shouldOfferSwitchingToNextInputMethod(); method public void showStatusIcon(int); method public void showWindow(boolean); method public void switchInputMethod(java.lang.String); - method public void switchInputMethod(java.lang.String, android.view.inputmethod.InputMethodSubtype); - method public boolean switchToNextInputMethod(boolean); - method public boolean switchToPreviousInputMethod(); + method public final void switchInputMethod(java.lang.String, android.view.inputmethod.InputMethodSubtype); + method public final boolean switchToNextInputMethod(boolean); + method public final boolean switchToPreviousInputMethod(); method public void updateFullscreenMode(); method public void updateInputViewShown(); field public static final int BACK_DISPOSITION_DEFAULT = 0; // 0x0 diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index f38c37a2fb70a..b3bf092aeffeb 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -1081,7 +1081,7 @@ public class InputMethodService extends AbstractInputMethodService { * @return true if the current input method and subtype was successfully switched to the last * used input method and subtype. */ - public boolean switchToPreviousInputMethod() { + public final boolean switchToPreviousInputMethod() { return mImm.switchToPreviousInputMethodInternal(mToken); } @@ -1093,7 +1093,7 @@ public class InputMethodService extends AbstractInputMethodService { * @return true if the current input method and subtype was successfully switched to the next * input method and subtype. */ - public boolean switchToNextInputMethod(boolean onlyCurrentIme) { + public final boolean switchToNextInputMethod(boolean onlyCurrentIme) { return mImm.switchToNextInputMethodInternal(mToken, onlyCurrentIme); } @@ -1106,7 +1106,7 @@ public class InputMethodService extends AbstractInputMethodService { * and subtype in order to provide the consistent user experience in switching * between IMEs and subtypes. */ - public boolean shouldOfferSwitchingToNextInputMethod() { + public final boolean shouldOfferSwitchingToNextInputMethod() { return mImm.shouldOfferSwitchingToNextInputMethodInternal(mToken); } @@ -1450,7 +1450,7 @@ public class InputMethodService extends AbstractInputMethodService { * @param id Unique identifier of the new input method to start. * @param subtype The new subtype of the new input method to be switched to. */ - public void switchInputMethod(String id, InputMethodSubtype subtype) { + public final void switchInputMethod(String id, InputMethodSubtype subtype) { mImm.setInputMethodAndSubtypeInternal(mToken, id, subtype); } @@ -2059,7 +2059,7 @@ public class InputMethodService extends AbstractInputMethodService { * @see InputMethodManager#SHOW_FORCED * @param flags Provides additional operating flags. */ - public void requestShowSelf(int flags) { + public final void requestShowSelf(int flags) { mImm.showSoftInputFromInputMethodInternal(mToken, flags); }