Loading core/java/com/android/internal/inputmethod/CallbackUtils.java +27 −0 Original line number Diff line number Diff line Loading @@ -225,4 +225,31 @@ public final class CallbackUtils { callback.onResult(); } catch (RemoteException ignored) { } } /** * A utility method using given {@link IIInputContentUriTokenResultCallback} to callback the * result. * * @param callback {@link IIInputContentUriTokenResultCallback} to be called back. * @param resultSupplier the supplier from which the result is provided. */ public static void onResult(@NonNull IIInputContentUriTokenResultCallback callback, @NonNull Supplier<IInputContentUriToken> resultSupplier) { IInputContentUriToken result = null; Throwable exception = null; try { result = resultSupplier.get(); } catch (Throwable throwable) { exception = throwable; } try { if (exception != null) { callback.onError(ThrowableHolder.of(exception)); return; } callback.onResult(result); } catch (RemoteException ignored) { } } } core/java/com/android/internal/inputmethod/Completable.java +13 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,13 @@ public final class Completable { return new Completable.InputMethodInfoList(); } /** * @return an instance of {@link Completable.IInputContentUriToken}. */ public static Completable.IInputContentUriToken createIInputContentUriToken() { return new Completable.IInputContentUriToken(); } /** * @return an instance of {@link Completable.Void}. */ Loading Loading @@ -496,6 +503,12 @@ public final class Completable { public static final class InputMethodInfoList extends Values<List<android.view.inputmethod.InputMethodInfo>> { } /** * Completable object of {@link IInputContentUriToken>}. */ public static final class IInputContentUriToken extends Values<com.android.internal.inputmethod.IInputContentUriToken> { } /** * Await the result by the {@link Completable.Values}. * Loading core/java/com/android/internal/inputmethod/IIInputContentUriTokenResultCallback.aidl 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.inputmethod; import com.android.internal.inputmethod.IInputContentUriToken; import com.android.internal.inputmethod.ThrowableHolder; oneway interface IIInputContentUriTokenResultCallback { void onResult(in IInputContentUriToken result); void onError(in ThrowableHolder exception); } No newline at end of file core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl +21 −15 Original line number Diff line number Diff line Loading @@ -19,25 +19,31 @@ package com.android.internal.inputmethod; import android.net.Uri; import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.IBooleanResultCallback; import com.android.internal.inputmethod.IInputContentUriToken; import com.android.internal.inputmethod.IIInputContentUriTokenResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; /** * Defines priviledged operations that only the current IME is allowed to call. * Actual operations are implemented and handled by InputMethodManagerService. */ interface IInputMethodPrivilegedOperations { void setImeWindowStatus(int vis, int backDisposition); void reportStartInput(in IBinder startInputToken); IInputContentUriToken createInputContentUriToken(in Uri contentUri, in String packageName); void reportFullscreenMode(boolean fullscreen); void setInputMethod(String id); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype); void hideMySoftInput(int flags); void showMySoftInput(int flags); void updateStatusIcon(String packageName, int iconId); boolean switchToPreviousInputMethod(); boolean switchToNextInputMethod(boolean onlyCurrentIme); boolean shouldOfferSwitchingToNextInputMethod(); void notifyUserAction(); void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible); oneway interface IInputMethodPrivilegedOperations { void setImeWindowStatus(int vis, int backDisposition, in IVoidResultCallback resultCallback); void reportStartInput(in IBinder startInputToken, in IVoidResultCallback resultCallback); void createInputContentUriToken(in Uri contentUri, in String packageName, in IIInputContentUriTokenResultCallback resultCallback); void reportFullscreenMode(boolean fullscreen, in IVoidResultCallback resultCallback); void setInputMethod(String id, in IVoidResultCallback resultCallback); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype, in IVoidResultCallback resultCallback); void hideMySoftInput(int flags, in IVoidResultCallback resultCallback); void showMySoftInput(int flags, in IVoidResultCallback resultCallback); void updateStatusIcon(String packageName, int iconId, in IVoidResultCallback resultCallback); void switchToPreviousInputMethod(in IBooleanResultCallback resultCallback); void switchToNextInputMethod(boolean onlyCurrentIme, in IBooleanResultCallback resultCallback); void shouldOfferSwitchingToNextInputMethod(in IBooleanResultCallback resultCallback); void notifyUserAction(in IVoidResultCallback resultCallback); void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible, in IVoidResultCallback resultCallback); } core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java +66 −28 Original line number Diff line number Diff line Loading @@ -95,7 +95,8 @@ public final class InputMethodPrivilegedOperations { } /** * Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatus(int, int)}. * Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatus(int, int, * IVoidResultCallback)}. * * @param vis visibility flags * @param backDisposition disposition flags Loading @@ -112,14 +113,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setImeWindowStatus(vis, backDisposition); final Completable.Void value = Completable.createVoid(); ops.setImeWindowStatus(vis, backDisposition, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#reportStartInput(IBinder)}. * Calls {@link IInputMethodPrivilegedOperations#reportStartInput(IBinder, * IVoidResultCallback)}. * * @param startInputToken {@link IBinder} token to distinguish startInput session */ Loading @@ -130,14 +134,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.reportStartInput(startInputToken); final Completable.Void value = Completable.createVoid(); ops.reportStartInput(startInputToken, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#createInputContentUriToken(Uri, String)}. * Calls {@link IInputMethodPrivilegedOperations#createInputContentUriToken(Uri, String, * IIInputContentUriTokenResultCallback)}. * * @param contentUri Content URI to which a temporary read permission should be granted * @param packageName Indicates what package needs to have a temporary read permission Loading @@ -151,7 +158,10 @@ public final class InputMethodPrivilegedOperations { return null; } try { return ops.createInputContentUriToken(contentUri, packageName); final Completable.IInputContentUriToken value = Completable.createIInputContentUriToken(); ops.createInputContentUriToken(contentUri, packageName, ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { // For historical reasons, this error was silently ignored. // Note that the caller already logs error so we do not need additional Log.e() here. Loading @@ -161,7 +171,8 @@ public final class InputMethodPrivilegedOperations { } /** * Calls {@link IInputMethodPrivilegedOperations#reportFullscreenMode(boolean)}. * Calls {@link IInputMethodPrivilegedOperations#reportFullscreenMode(boolean, * IVoidResultCallback)}. * * @param fullscreen {@code true} if the IME enters full screen mode */ Loading @@ -172,14 +183,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.reportFullscreenMode(fullscreen); final Completable.Void value = Completable.createVoid(); ops.reportFullscreenMode(fullscreen, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#updateStatusIcon(String, int)}. * Calls {@link IInputMethodPrivilegedOperations#updateStatusIcon(String, int, * IVoidResultCallback)}. * * @param packageName package name from which the status icon should be loaded * @param iconResId resource ID of the icon to be loaded Loading @@ -191,14 +205,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.updateStatusIcon(packageName, iconResId); final Completable.Void value = Completable.createVoid(); ops.updateStatusIcon(packageName, iconResId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#setInputMethod(String)}. * Calls {@link IInputMethodPrivilegedOperations#setInputMethod(String, IVoidResultCallback)}. * * @param id IME ID of the IME to switch to * @see android.view.inputmethod.InputMethodInfo#getId() Loading @@ -210,7 +226,9 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setInputMethod(id); final Completable.Void value = Completable.createVoid(); ops.setInputMethod(id, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -218,7 +236,7 @@ public final class InputMethodPrivilegedOperations { /** * Calls {@link IInputMethodPrivilegedOperations#setInputMethodAndSubtype(String, * InputMethodSubtype)} * InputMethodSubtype, IVoidResultCallback)} * * @param id IME ID of the IME to switch to * @param subtype {@link InputMethodSubtype} to switch to Loading @@ -231,14 +249,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setInputMethodAndSubtype(id, subtype); final Completable.Void value = Completable.createVoid(); ops.setInputMethodAndSubtype(id, subtype, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int)} * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @see android.view.inputmethod.InputMethodManager#HIDE_IMPLICIT_ONLY Loading @@ -251,14 +271,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.hideMySoftInput(flags); final Completable.Void value = Completable.createVoid(); ops.hideMySoftInput(flags, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#showMySoftInput(int)} * Calls {@link IInputMethodPrivilegedOperations#showMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @see android.view.inputmethod.InputMethodManager#SHOW_IMPLICIT Loading @@ -271,14 +293,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.showMySoftInput(flags); final Completable.Void value = Completable.createVoid(); ops.showMySoftInput(flags, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#switchToPreviousInputMethod()} * Calls {@link IInputMethodPrivilegedOperations#switchToPreviousInputMethod( * IBooleanResultCallback)} * * @return {@code true} if handled */ Loading @@ -289,14 +314,17 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.switchToPreviousInputMethod(); final Completable.Boolean value = Completable.createBoolean(); ops.switchToPreviousInputMethod(ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean)} * Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean, * IBooleanResultCallback)} * * @param onlyCurrentIme {@code true} to switch to a {@link InputMethodSubtype} within the same * IME Loading @@ -309,14 +337,17 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.switchToNextInputMethod(onlyCurrentIme); final Completable.Boolean value = Completable.createBoolean(); ops.switchToNextInputMethod(onlyCurrentIme, ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#shouldOfferSwitchingToNextInputMethod()} * Calls {@link IInputMethodPrivilegedOperations#shouldOfferSwitchingToNextInputMethod( * IBooleanResultCallback)} * * @return {@code true} if the IEM should offer a way to globally switch IME */ Loading @@ -327,14 +358,16 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.shouldOfferSwitchingToNextInputMethod(); final Completable.Boolean value = Completable.createBoolean(); ops.shouldOfferSwitchingToNextInputMethod(ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#notifyUserAction()} * Calls {@link IInputMethodPrivilegedOperations#notifyUserAction(IVoidResultCallback)} */ @AnyThread public void notifyUserAction() { Loading @@ -343,14 +376,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.notifyUserAction(); final Completable.Void value = Completable.createVoid(); ops.notifyUserAction(ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#applyImeVisibility(IBinder, boolean)}. * Calls {@link IInputMethodPrivilegedOperations#applyImeVisibility(IBinder, boolean, * IVoidResultCallback)}. * * @param showOrHideInputToken placeholder token that maps to window requesting * {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} or Loading @@ -365,7 +401,9 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.applyImeVisibility(showOrHideInputToken, setVisible); final Completable.Void value = Completable.createVoid(); ops.applyImeVisibility(showOrHideInputToken, setVisible, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading
core/java/com/android/internal/inputmethod/CallbackUtils.java +27 −0 Original line number Diff line number Diff line Loading @@ -225,4 +225,31 @@ public final class CallbackUtils { callback.onResult(); } catch (RemoteException ignored) { } } /** * A utility method using given {@link IIInputContentUriTokenResultCallback} to callback the * result. * * @param callback {@link IIInputContentUriTokenResultCallback} to be called back. * @param resultSupplier the supplier from which the result is provided. */ public static void onResult(@NonNull IIInputContentUriTokenResultCallback callback, @NonNull Supplier<IInputContentUriToken> resultSupplier) { IInputContentUriToken result = null; Throwable exception = null; try { result = resultSupplier.get(); } catch (Throwable throwable) { exception = throwable; } try { if (exception != null) { callback.onError(ThrowableHolder.of(exception)); return; } callback.onResult(result); } catch (RemoteException ignored) { } } }
core/java/com/android/internal/inputmethod/Completable.java +13 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,13 @@ public final class Completable { return new Completable.InputMethodInfoList(); } /** * @return an instance of {@link Completable.IInputContentUriToken}. */ public static Completable.IInputContentUriToken createIInputContentUriToken() { return new Completable.IInputContentUriToken(); } /** * @return an instance of {@link Completable.Void}. */ Loading Loading @@ -496,6 +503,12 @@ public final class Completable { public static final class InputMethodInfoList extends Values<List<android.view.inputmethod.InputMethodInfo>> { } /** * Completable object of {@link IInputContentUriToken>}. */ public static final class IInputContentUriToken extends Values<com.android.internal.inputmethod.IInputContentUriToken> { } /** * Await the result by the {@link Completable.Values}. * Loading
core/java/com/android/internal/inputmethod/IIInputContentUriTokenResultCallback.aidl 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.inputmethod; import com.android.internal.inputmethod.IInputContentUriToken; import com.android.internal.inputmethod.ThrowableHolder; oneway interface IIInputContentUriTokenResultCallback { void onResult(in IInputContentUriToken result); void onError(in ThrowableHolder exception); } No newline at end of file
core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl +21 −15 Original line number Diff line number Diff line Loading @@ -19,25 +19,31 @@ package com.android.internal.inputmethod; import android.net.Uri; import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.IBooleanResultCallback; import com.android.internal.inputmethod.IInputContentUriToken; import com.android.internal.inputmethod.IIInputContentUriTokenResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; /** * Defines priviledged operations that only the current IME is allowed to call. * Actual operations are implemented and handled by InputMethodManagerService. */ interface IInputMethodPrivilegedOperations { void setImeWindowStatus(int vis, int backDisposition); void reportStartInput(in IBinder startInputToken); IInputContentUriToken createInputContentUriToken(in Uri contentUri, in String packageName); void reportFullscreenMode(boolean fullscreen); void setInputMethod(String id); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype); void hideMySoftInput(int flags); void showMySoftInput(int flags); void updateStatusIcon(String packageName, int iconId); boolean switchToPreviousInputMethod(); boolean switchToNextInputMethod(boolean onlyCurrentIme); boolean shouldOfferSwitchingToNextInputMethod(); void notifyUserAction(); void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible); oneway interface IInputMethodPrivilegedOperations { void setImeWindowStatus(int vis, int backDisposition, in IVoidResultCallback resultCallback); void reportStartInput(in IBinder startInputToken, in IVoidResultCallback resultCallback); void createInputContentUriToken(in Uri contentUri, in String packageName, in IIInputContentUriTokenResultCallback resultCallback); void reportFullscreenMode(boolean fullscreen, in IVoidResultCallback resultCallback); void setInputMethod(String id, in IVoidResultCallback resultCallback); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype, in IVoidResultCallback resultCallback); void hideMySoftInput(int flags, in IVoidResultCallback resultCallback); void showMySoftInput(int flags, in IVoidResultCallback resultCallback); void updateStatusIcon(String packageName, int iconId, in IVoidResultCallback resultCallback); void switchToPreviousInputMethod(in IBooleanResultCallback resultCallback); void switchToNextInputMethod(boolean onlyCurrentIme, in IBooleanResultCallback resultCallback); void shouldOfferSwitchingToNextInputMethod(in IBooleanResultCallback resultCallback); void notifyUserAction(in IVoidResultCallback resultCallback); void applyImeVisibility(IBinder showOrHideInputToken, boolean setVisible, in IVoidResultCallback resultCallback); }
core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java +66 −28 Original line number Diff line number Diff line Loading @@ -95,7 +95,8 @@ public final class InputMethodPrivilegedOperations { } /** * Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatus(int, int)}. * Calls {@link IInputMethodPrivilegedOperations#setImeWindowStatus(int, int, * IVoidResultCallback)}. * * @param vis visibility flags * @param backDisposition disposition flags Loading @@ -112,14 +113,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setImeWindowStatus(vis, backDisposition); final Completable.Void value = Completable.createVoid(); ops.setImeWindowStatus(vis, backDisposition, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#reportStartInput(IBinder)}. * Calls {@link IInputMethodPrivilegedOperations#reportStartInput(IBinder, * IVoidResultCallback)}. * * @param startInputToken {@link IBinder} token to distinguish startInput session */ Loading @@ -130,14 +134,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.reportStartInput(startInputToken); final Completable.Void value = Completable.createVoid(); ops.reportStartInput(startInputToken, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#createInputContentUriToken(Uri, String)}. * Calls {@link IInputMethodPrivilegedOperations#createInputContentUriToken(Uri, String, * IIInputContentUriTokenResultCallback)}. * * @param contentUri Content URI to which a temporary read permission should be granted * @param packageName Indicates what package needs to have a temporary read permission Loading @@ -151,7 +158,10 @@ public final class InputMethodPrivilegedOperations { return null; } try { return ops.createInputContentUriToken(contentUri, packageName); final Completable.IInputContentUriToken value = Completable.createIInputContentUriToken(); ops.createInputContentUriToken(contentUri, packageName, ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { // For historical reasons, this error was silently ignored. // Note that the caller already logs error so we do not need additional Log.e() here. Loading @@ -161,7 +171,8 @@ public final class InputMethodPrivilegedOperations { } /** * Calls {@link IInputMethodPrivilegedOperations#reportFullscreenMode(boolean)}. * Calls {@link IInputMethodPrivilegedOperations#reportFullscreenMode(boolean, * IVoidResultCallback)}. * * @param fullscreen {@code true} if the IME enters full screen mode */ Loading @@ -172,14 +183,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.reportFullscreenMode(fullscreen); final Completable.Void value = Completable.createVoid(); ops.reportFullscreenMode(fullscreen, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#updateStatusIcon(String, int)}. * Calls {@link IInputMethodPrivilegedOperations#updateStatusIcon(String, int, * IVoidResultCallback)}. * * @param packageName package name from which the status icon should be loaded * @param iconResId resource ID of the icon to be loaded Loading @@ -191,14 +205,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.updateStatusIcon(packageName, iconResId); final Completable.Void value = Completable.createVoid(); ops.updateStatusIcon(packageName, iconResId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#setInputMethod(String)}. * Calls {@link IInputMethodPrivilegedOperations#setInputMethod(String, IVoidResultCallback)}. * * @param id IME ID of the IME to switch to * @see android.view.inputmethod.InputMethodInfo#getId() Loading @@ -210,7 +226,9 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setInputMethod(id); final Completable.Void value = Completable.createVoid(); ops.setInputMethod(id, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -218,7 +236,7 @@ public final class InputMethodPrivilegedOperations { /** * Calls {@link IInputMethodPrivilegedOperations#setInputMethodAndSubtype(String, * InputMethodSubtype)} * InputMethodSubtype, IVoidResultCallback)} * * @param id IME ID of the IME to switch to * @param subtype {@link InputMethodSubtype} to switch to Loading @@ -231,14 +249,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.setInputMethodAndSubtype(id, subtype); final Completable.Void value = Completable.createVoid(); ops.setInputMethodAndSubtype(id, subtype, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int)} * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @see android.view.inputmethod.InputMethodManager#HIDE_IMPLICIT_ONLY Loading @@ -251,14 +271,16 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.hideMySoftInput(flags); final Completable.Void value = Completable.createVoid(); ops.hideMySoftInput(flags, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#showMySoftInput(int)} * Calls {@link IInputMethodPrivilegedOperations#showMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @see android.view.inputmethod.InputMethodManager#SHOW_IMPLICIT Loading @@ -271,14 +293,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.showMySoftInput(flags); final Completable.Void value = Completable.createVoid(); ops.showMySoftInput(flags, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#switchToPreviousInputMethod()} * Calls {@link IInputMethodPrivilegedOperations#switchToPreviousInputMethod( * IBooleanResultCallback)} * * @return {@code true} if handled */ Loading @@ -289,14 +314,17 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.switchToPreviousInputMethod(); final Completable.Boolean value = Completable.createBoolean(); ops.switchToPreviousInputMethod(ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean)} * Calls {@link IInputMethodPrivilegedOperations#switchToNextInputMethod(boolean, * IBooleanResultCallback)} * * @param onlyCurrentIme {@code true} to switch to a {@link InputMethodSubtype} within the same * IME Loading @@ -309,14 +337,17 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.switchToNextInputMethod(onlyCurrentIme); final Completable.Boolean value = Completable.createBoolean(); ops.switchToNextInputMethod(onlyCurrentIme, ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#shouldOfferSwitchingToNextInputMethod()} * Calls {@link IInputMethodPrivilegedOperations#shouldOfferSwitchingToNextInputMethod( * IBooleanResultCallback)} * * @return {@code true} if the IEM should offer a way to globally switch IME */ Loading @@ -327,14 +358,16 @@ public final class InputMethodPrivilegedOperations { return false; } try { return ops.shouldOfferSwitchingToNextInputMethod(); final Completable.Boolean value = Completable.createBoolean(); ops.shouldOfferSwitchingToNextInputMethod(ResultCallbacks.of(value)); return Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#notifyUserAction()} * Calls {@link IInputMethodPrivilegedOperations#notifyUserAction(IVoidResultCallback)} */ @AnyThread public void notifyUserAction() { Loading @@ -343,14 +376,17 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.notifyUserAction(); final Completable.Void value = Completable.createVoid(); ops.notifyUserAction(ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Calls {@link IInputMethodPrivilegedOperations#applyImeVisibility(IBinder, boolean)}. * Calls {@link IInputMethodPrivilegedOperations#applyImeVisibility(IBinder, boolean, * IVoidResultCallback)}. * * @param showOrHideInputToken placeholder token that maps to window requesting * {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} or Loading @@ -365,7 +401,9 @@ public final class InputMethodPrivilegedOperations { return; } try { ops.applyImeVisibility(showOrHideInputToken, setVisible); final Completable.Void value = Completable.createVoid(); ops.applyImeVisibility(showOrHideInputToken, setVisible, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading