| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.view.inputmethod; |
| 18 |
|
| 19 |
import android.annotation.AnyThread; |
| 20 |
import android.annotation.NonNull; |
| 21 |
import android.annotation.Nullable; |
| 22 |
import android.os.RemoteException; |
| 23 |
import android.util.Log; |
| 24 |
|
| 25 |
import com.android.internal.inputmethod.IAccessibilityInputMethodSession; |
| 26 |
import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; |
| 27 |
|
| 28 |
final class IAccessibilityInputMethodSessionInvoker { |
| 29 |
private static final String TAG = "IAccessibilityInputMethodSessionInvoker"; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
@NonNull |
| 35 |
private final IAccessibilityInputMethodSession mSession; |
| 36 |
|
| 37 |
private IAccessibilityInputMethodSessionInvoker( |
| 38 |
@NonNull IAccessibilityInputMethodSession session) { |
| 39 |
mSession = session; |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
@Nullable |
| 50 |
public static IAccessibilityInputMethodSessionInvoker createOrNull( |
| 51 |
@NonNull IAccessibilityInputMethodSession session) { |
| 52 |
return session == null ? null : new IAccessibilityInputMethodSessionInvoker(session); |
| 53 |
} |
| 54 |
|
| 55 |
@AnyThread |
| 56 |
void finishInput() { |
| 57 |
try { |
| 58 |
mSession.finishInput(); |
| 59 |
} catch (RemoteException e) { |
| 60 |
Log.w(TAG, "A11yIME died", e); |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
@AnyThread |
| 65 |
void updateSelection(int oldSelStart, int oldSelEnd, int selStart, int selEnd, |
| 66 |
int candidatesStart, int candidatesEnd) { |
| 67 |
try { |
| 68 |
mSession.updateSelection( |
| 69 |
oldSelStart, oldSelEnd, selStart, selEnd, candidatesStart, candidatesEnd); |
| 70 |
} catch (RemoteException e) { |
| 71 |
Log.w(TAG, "A11yIME died", e); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
@AnyThread |
| 76 |
void invalidateInput(EditorInfo editorInfo, IRemoteAccessibilityInputConnection connection, |
| 77 |
int sessionId) { |
| 78 |
try { |
| 79 |
mSession.invalidateInput(editorInfo, connection, sessionId); |
| 80 |
} catch (RemoteException e) { |
| 81 |
Log.w(TAG, "A11yIME died", e); |
| 82 |
} |
| 83 |
} |
| 84 |
} |