Deprecate InputMethodInterface methods

IME developers have no strong reason to override
InputMethodImpl and InputMethodSessionImpl methods.

Add deprecated annotation to these methods with
suggested alternatives.

Bug: 148086656
Test: presubmit
Change-Id: I4e970404a1cbf15d6b40760b7808825c0eb94736
This commit is contained in:
Wilson Wu
2022-09-14 11:27:07 +08:00
parent 63190cebf2
commit 0899552556
2 changed files with 19 additions and 2 deletions

View File

@@ -18919,8 +18919,8 @@ package android.inputmethodservice {
method public android.view.View onCreateCandidatesView();
method public android.view.View onCreateExtractTextView();
method @Nullable public android.view.inputmethod.InlineSuggestionsRequest onCreateInlineSuggestionsRequest(@NonNull android.os.Bundle);
method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface();
method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
method @Deprecated public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface();
method @Deprecated public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
method public android.view.View onCreateInputView();
method protected void onCurrentInputMethodSubtypeChanged(android.view.inputmethod.InputMethodSubtype);
method public void onDisplayCompletions(android.view.inputmethod.CompletionInfo[]);

View File

@@ -1744,7 +1744,16 @@ public class InputMethodService extends AbstractInputMethodService {
/**
* Implement to return our standard {@link InputMethodImpl}. Subclasses
* can override to provide their own customized version.
*
* @deprecated IME developers don't need to override this method to get callbacks information.
* Most methods in {@link InputMethodImpl} have corresponding callbacks.
* Use {@link InputMethodService#onBindInput()}, {@link InputMethodService#onUnbindInput()},
* {@link InputMethodService#onWindowShown()}, {@link InputMethodService#onWindowHidden()}, etc.
*
* <p>Starting from Android U and later, override this method won't guarantee that IME works
* as previous platform behavior.</p>
*/
@Deprecated
@Override
public AbstractInputMethodImpl onCreateInputMethodInterface() {
return new InputMethodImpl();
@@ -1753,7 +1762,15 @@ public class InputMethodService extends AbstractInputMethodService {
/**
* Implement to return our standard {@link InputMethodSessionImpl}. Subclasses
* can override to provide their own customized version.
*
* @deprecated IME developers don't need to override this method to get callbacks information.
* Most methods in {@link InputMethodSessionImpl} have corresponding callbacks.
* Use {@link InputMethodService#onFinishInput()},
* {@link InputMethodService#onDisplayCompletions(CompletionInfo[])},
* {@link InputMethodService#onUpdateExtractedText(int, ExtractedText)},
* {@link InputMethodService#onUpdateSelection(int, int, int, int, int, int)} instead.
*/
@Deprecated
@Override
public AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface() {
return new InputMethodSessionImpl();