• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.accessibilityservice.cts.utils;
18 
19 import android.os.Bundle;
20 import android.os.Handler;
21 import android.view.KeyEvent;
22 import android.view.inputmethod.CompletionInfo;
23 import android.view.inputmethod.CorrectionInfo;
24 import android.view.inputmethod.ExtractedText;
25 import android.view.inputmethod.ExtractedTextRequest;
26 import android.view.inputmethod.InputConnection;
27 import android.view.inputmethod.InputContentInfo;
28 
29 /**
30  * A no-op implementation of {@link InputConnection}.
31  *
32  * <p>Useful for mocking/spying.</p>
33  */
34 public class NoOpInputConnection implements InputConnection {
35 
36     @Override
getTextBeforeCursor(int n, int flags)37     public CharSequence getTextBeforeCursor(int n, int flags) {
38         return null;
39     }
40 
41     @Override
getTextAfterCursor(int n, int flags)42     public CharSequence getTextAfterCursor(int n, int flags) {
43         return null;
44     }
45 
46     @Override
getSelectedText(int flags)47     public CharSequence getSelectedText(int flags) {
48         return null;
49     }
50 
51     @Override
getCursorCapsMode(int reqModes)52     public int getCursorCapsMode(int reqModes) {
53         return 0;
54     }
55 
56     @Override
getExtractedText(ExtractedTextRequest request, int flags)57     public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
58         return null;
59     }
60 
61     @Override
deleteSurroundingText(int beforeLength, int afterLength)62     public boolean deleteSurroundingText(int beforeLength, int afterLength) {
63         return false;
64     }
65 
66     @Override
deleteSurroundingTextInCodePoints(int beforeLength, int afterLength)67     public boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) {
68         return false;
69     }
70 
71     @Override
setComposingText(CharSequence text, int newCursorPosition)72     public boolean setComposingText(CharSequence text, int newCursorPosition) {
73         return false;
74     }
75 
76     @Override
setComposingRegion(int start, int end)77     public boolean setComposingRegion(int start, int end) {
78         return false;
79     }
80 
81     @Override
finishComposingText()82     public boolean finishComposingText() {
83         return false;
84     }
85 
86     @Override
commitText(CharSequence text, int newCursorPosition)87     public boolean commitText(CharSequence text, int newCursorPosition) {
88         return false;
89     }
90 
91     @Override
commitCompletion(CompletionInfo text)92     public boolean commitCompletion(CompletionInfo text) {
93         return false;
94     }
95 
96     @Override
commitCorrection(CorrectionInfo correctionInfo)97     public boolean commitCorrection(CorrectionInfo correctionInfo) {
98         return false;
99     }
100 
101     @Override
setSelection(int start, int end)102     public boolean setSelection(int start, int end) {
103         return false;
104     }
105 
106     @Override
performEditorAction(int editorAction)107     public boolean performEditorAction(int editorAction) {
108         return false;
109     }
110 
111     @Override
performContextMenuAction(int id)112     public boolean performContextMenuAction(int id) {
113         return false;
114     }
115 
116     @Override
beginBatchEdit()117     public boolean beginBatchEdit() {
118         return false;
119     }
120 
121     @Override
endBatchEdit()122     public boolean endBatchEdit() {
123         return false;
124     }
125 
126     @Override
sendKeyEvent(KeyEvent event)127     public boolean sendKeyEvent(KeyEvent event) {
128         return false;
129     }
130 
131     @Override
clearMetaKeyStates(int states)132     public boolean clearMetaKeyStates(int states) {
133         return false;
134     }
135 
136     @Override
reportFullscreenMode(boolean enabled)137     public boolean reportFullscreenMode(boolean enabled) {
138         return false;
139     }
140 
141     @Override
performPrivateCommand(String action, Bundle data)142     public boolean performPrivateCommand(String action, Bundle data) {
143         return false;
144     }
145 
146     @Override
requestCursorUpdates(int cursorUpdateMode)147     public boolean requestCursorUpdates(int cursorUpdateMode) {
148         return false;
149     }
150 
151     @Override
requestCursorUpdates(int cursorUpdateMode, int cursorUpdateFilter)152     public boolean requestCursorUpdates(int cursorUpdateMode, int cursorUpdateFilter) {
153         return false;
154     }
155 
156     @Override
getHandler()157     public Handler getHandler() {
158         return null;
159     }
160 
161     @Override
closeConnection()162     public void closeConnection() {
163     }
164 
165     @Override
commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts)166     public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
167         return false;
168     }
169 }
170