Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08995525 authored by Wilson Wu's avatar Wilson Wu
Browse files

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
parent 63190ceb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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[]);
+17 −0
Original line number Diff line number Diff line
@@ -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();