Loading core/java/android/view/inputmethod/InputMethodManager.java +16 −4 Original line number Diff line number Diff line Loading @@ -2926,7 +2926,10 @@ public final class InputMethodManager { ? SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES : SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES; try { mService.showInputMethodPickerFromSystem(mClient, mode, displayId); final Completable.Void value = Completable.createVoid(); mService.showInputMethodPickerFromSystem( mClient, mode, displayId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -2934,7 +2937,10 @@ public final class InputMethodManager { private void showInputMethodPickerLocked() { try { mService.showInputMethodPickerFromClient(mClient, SHOW_IM_PICKER_MODE_AUTO); final Completable.Void value = Completable.createVoid(); mService.showInputMethodPickerFromClient( mClient, SHOW_IM_PICKER_MODE_AUTO, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2970,7 +2976,10 @@ public final class InputMethodManager { */ public void showInputMethodAndSubtypeEnabler(String imiId) { try { mService.showInputMethodAndSubtypeEnablerFromClient(mClient, imiId); final Completable.Void value = Completable.createVoid(); mService.showInputMethodAndSubtypeEnablerFromClient( mClient, imiId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -3132,7 +3141,10 @@ public final class InputMethodManager { matrixValues = new float[9]; matrix.getValues(matrixValues); } mService.reportActivityView(mClient, childDisplayId, matrixValues); final Completable.Void value = Completable.createVoid(); mService.reportActivityView( mClient, childDisplayId, matrixValues, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading core/java/com/android/internal/inputmethod/CallbackUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -205,14 +205,14 @@ public final class CallbackUtils { * A utility method using given {@link IVoidResultCallback} to callback the result. * * @param callback {@link IVoidResultCallback} to be called back. * @param resultSupplier the supplier from which the result is provided. * @param runnable to execute the given method */ public static void onResult(@NonNull IVoidResultCallback callback, @NonNull Supplier<Void> resultSupplier) { @NonNull Runnable runnable) { Throwable exception = null; try { resultSupplier.get(); runnable.run(); } catch (Throwable throwable) { exception = throwable; } Loading core/java/com/android/internal/view/IInputMethodManager.aidl +6 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.internal.inputmethod.IInputMethodInfoListResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeListResultCallback; import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; /** * Public interface to the global input method manager, used by all client Loading Loading @@ -66,10 +67,11 @@ interface IInputMethodManager { in IInputBindResultResultCallback inputBindResult); void showInputMethodPickerFromClient(in IInputMethodClient client, int auxiliarySubtypeMode); int auxiliarySubtypeMode, in IVoidResultCallback resultCallback); void showInputMethodPickerFromSystem(in IInputMethodClient client, int auxiliarySubtypeMode, int displayId); void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId); int displayId, in IVoidResultCallback resultCallback); void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId, in IVoidResultCallback resultCallback); void isInputMethodPickerShownForTest(in IBooleanResultCallback resultCallback); void getCurrentInputMethodSubtype(in IInputMethodSubtypeResultCallback resultCallback); void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); Loading @@ -78,7 +80,7 @@ interface IInputMethodManager { void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback); void reportActivityView(in IInputMethodClient parentClient, int childDisplayId, in float[] matrixValues); in float[] matrixValues, in IVoidResultCallback resultCallback); oneway void reportPerceptible(in IBinder windowToken, boolean perceptible); /** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */ Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +111 −100 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; import com.android.internal.inputmethod.IInputMethodSubtypeListResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeResultCallback; import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; import com.android.internal.inputmethod.InputMethodDebug; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; Loading Loading @@ -3720,8 +3721,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @Override public void showInputMethodPickerFromClient( IInputMethodClient client, int auxiliarySubtypeMode) { public void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { synchronized (mMethodMap) { if (!calledFromValidUserLocked()) { return; Loading @@ -3738,20 +3740,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, (mCurClient != null) ? mCurClient.selfReportedDisplayId : DEFAULT_DISPLAY)); } }); } @Override public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode, int displayId) { int displayId, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { if (mContext.checkCallingPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( "showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS permission"); "showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS " + "permission"); } // Always call subtype picker, because subtype picker is a superset of input method // picker. mHandler.sendMessage(mCaller.obtainMessageII( MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, displayId)); }); } /** Loading Loading @@ -3795,7 +3801,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public void showInputMethodAndSubtypeEnablerFromClient( IInputMethodClient client, String inputMethodId) { IInputMethodClient client, String inputMethodId, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { synchronized (mMethodMap) { // TODO(yukawa): Should we verify the display ID? if (!calledFromValidUserLocked()) { Loading @@ -3804,6 +3811,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub executeOrSendMessage(mCurMethod, mCaller.obtainMessageO( MSG_SHOW_IM_SUBTYPE_ENABLER, inputMethodId)); } }); } @BinderThread Loading Loading @@ -4011,7 +4019,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public void reportActivityView(IInputMethodClient parentClient, int childDisplayId, float[] matrixValues) { float[] matrixValues, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { final DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(childDisplayId); if (displayInfo == null) { throw new IllegalArgumentException( Loading @@ -4030,7 +4039,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // null matrixValues means that the entry needs to be removed. if (matrixValues == null) { final ActivityViewInfo info = mActivityViewDisplayIdToParentMap.get(childDisplayId); final ActivityViewInfo info = mActivityViewDisplayIdToParentMap.get(childDisplayId); if (info == null) { return; } Loading Loading @@ -4089,6 +4099,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub displayId = info.mParentClient.selfReportedDisplayId; } } }); } @Override Loading services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +12 −7 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IMultiClientInputMethod; import com.android.internal.inputmethod.IMultiClientInputMethodPrivilegedOperations; import com.android.internal.inputmethod.IMultiClientInputMethodSession; import com.android.internal.inputmethod.IVoidResultCallback; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; Loading Loading @@ -1776,23 +1777,26 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public void showInputMethodPickerFromClient( IInputMethodClient client, int auxiliarySubtypeMode) { public void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread @Override public void showInputMethodPickerFromSystem( IInputMethodClient client, int auxiliarySubtypeMode, int displayId) { public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode, int displayId, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread @Override public void showInputMethodAndSubtypeEnablerFromClient( IInputMethodClient client, String inputMethodId) { public void showInputMethodAndSubtypeEnablerFromClient(IInputMethodClient client, String inputMethodId, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread Loading Loading @@ -1825,8 +1829,9 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public void reportActivityView(IInputMethodClient parentClient, int childDisplayId, float[] matrixValues) { float[] matrixValues, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +16 −4 Original line number Diff line number Diff line Loading @@ -2926,7 +2926,10 @@ public final class InputMethodManager { ? SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES : SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES; try { mService.showInputMethodPickerFromSystem(mClient, mode, displayId); final Completable.Void value = Completable.createVoid(); mService.showInputMethodPickerFromSystem( mClient, mode, displayId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -2934,7 +2937,10 @@ public final class InputMethodManager { private void showInputMethodPickerLocked() { try { mService.showInputMethodPickerFromClient(mClient, SHOW_IM_PICKER_MODE_AUTO); final Completable.Void value = Completable.createVoid(); mService.showInputMethodPickerFromClient( mClient, SHOW_IM_PICKER_MODE_AUTO, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2970,7 +2976,10 @@ public final class InputMethodManager { */ public void showInputMethodAndSubtypeEnabler(String imiId) { try { mService.showInputMethodAndSubtypeEnablerFromClient(mClient, imiId); final Completable.Void value = Completable.createVoid(); mService.showInputMethodAndSubtypeEnablerFromClient( mClient, imiId, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -3132,7 +3141,10 @@ public final class InputMethodManager { matrixValues = new float[9]; matrix.getValues(matrixValues); } mService.reportActivityView(mClient, childDisplayId, matrixValues); final Completable.Void value = Completable.createVoid(); mService.reportActivityView( mClient, childDisplayId, matrixValues, ResultCallbacks.of(value)); Completable.getResult(value); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
core/java/com/android/internal/inputmethod/CallbackUtils.java +3 −3 Original line number Diff line number Diff line Loading @@ -205,14 +205,14 @@ public final class CallbackUtils { * A utility method using given {@link IVoidResultCallback} to callback the result. * * @param callback {@link IVoidResultCallback} to be called back. * @param resultSupplier the supplier from which the result is provided. * @param runnable to execute the given method */ public static void onResult(@NonNull IVoidResultCallback callback, @NonNull Supplier<Void> resultSupplier) { @NonNull Runnable runnable) { Throwable exception = null; try { resultSupplier.get(); runnable.run(); } catch (Throwable throwable) { exception = throwable; } Loading
core/java/com/android/internal/view/IInputMethodManager.aidl +6 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.internal.inputmethod.IInputMethodInfoListResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeListResultCallback; import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; /** * Public interface to the global input method manager, used by all client Loading Loading @@ -66,10 +67,11 @@ interface IInputMethodManager { in IInputBindResultResultCallback inputBindResult); void showInputMethodPickerFromClient(in IInputMethodClient client, int auxiliarySubtypeMode); int auxiliarySubtypeMode, in IVoidResultCallback resultCallback); void showInputMethodPickerFromSystem(in IInputMethodClient client, int auxiliarySubtypeMode, int displayId); void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId); int displayId, in IVoidResultCallback resultCallback); void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId, in IVoidResultCallback resultCallback); void isInputMethodPickerShownForTest(in IBooleanResultCallback resultCallback); void getCurrentInputMethodSubtype(in IInputMethodSubtypeResultCallback resultCallback); void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); Loading @@ -78,7 +80,7 @@ interface IInputMethodManager { void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback); void reportActivityView(in IInputMethodClient parentClient, int childDisplayId, in float[] matrixValues); in float[] matrixValues, in IVoidResultCallback resultCallback); oneway void reportPerceptible(in IBinder windowToken, boolean perceptible); /** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */ Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +111 −100 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; import com.android.internal.inputmethod.IInputMethodSubtypeListResultCallback; import com.android.internal.inputmethod.IInputMethodSubtypeResultCallback; import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IVoidResultCallback; import com.android.internal.inputmethod.InputMethodDebug; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; Loading Loading @@ -3720,8 +3721,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @Override public void showInputMethodPickerFromClient( IInputMethodClient client, int auxiliarySubtypeMode) { public void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { synchronized (mMethodMap) { if (!calledFromValidUserLocked()) { return; Loading @@ -3738,20 +3740,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, (mCurClient != null) ? mCurClient.selfReportedDisplayId : DEFAULT_DISPLAY)); } }); } @Override public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode, int displayId) { int displayId, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { if (mContext.checkCallingPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( "showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS permission"); "showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS " + "permission"); } // Always call subtype picker, because subtype picker is a superset of input method // picker. mHandler.sendMessage(mCaller.obtainMessageII( MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, displayId)); }); } /** Loading Loading @@ -3795,7 +3801,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public void showInputMethodAndSubtypeEnablerFromClient( IInputMethodClient client, String inputMethodId) { IInputMethodClient client, String inputMethodId, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { synchronized (mMethodMap) { // TODO(yukawa): Should we verify the display ID? if (!calledFromValidUserLocked()) { Loading @@ -3804,6 +3811,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub executeOrSendMessage(mCurMethod, mCaller.obtainMessageO( MSG_SHOW_IM_SUBTYPE_ENABLER, inputMethodId)); } }); } @BinderThread Loading Loading @@ -4011,7 +4019,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public void reportActivityView(IInputMethodClient parentClient, int childDisplayId, float[] matrixValues) { float[] matrixValues, IVoidResultCallback resultCallback) { CallbackUtils.onResult(resultCallback, () -> { final DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(childDisplayId); if (displayInfo == null) { throw new IllegalArgumentException( Loading @@ -4030,7 +4039,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // null matrixValues means that the entry needs to be removed. if (matrixValues == null) { final ActivityViewInfo info = mActivityViewDisplayIdToParentMap.get(childDisplayId); final ActivityViewInfo info = mActivityViewDisplayIdToParentMap.get(childDisplayId); if (info == null) { return; } Loading Loading @@ -4089,6 +4099,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub displayId = info.mParentClient.selfReportedDisplayId; } } }); } @Override Loading
services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +12 −7 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ import com.android.internal.inputmethod.IIntResultCallback; import com.android.internal.inputmethod.IMultiClientInputMethod; import com.android.internal.inputmethod.IMultiClientInputMethodPrivilegedOperations; import com.android.internal.inputmethod.IMultiClientInputMethodSession; import com.android.internal.inputmethod.IVoidResultCallback; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; Loading Loading @@ -1776,23 +1777,26 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public void showInputMethodPickerFromClient( IInputMethodClient client, int auxiliarySubtypeMode) { public void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread @Override public void showInputMethodPickerFromSystem( IInputMethodClient client, int auxiliarySubtypeMode, int displayId) { public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode, int displayId, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread @Override public void showInputMethodAndSubtypeEnablerFromClient( IInputMethodClient client, String inputMethodId) { public void showInputMethodAndSubtypeEnablerFromClient(IInputMethodClient client, String inputMethodId, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread Loading Loading @@ -1825,8 +1829,9 @@ public final class MultiClientInputMethodManagerService { @BinderThread @Override public void reportActivityView(IInputMethodClient parentClient, int childDisplayId, float[] matrixValues) { float[] matrixValues, IVoidResultCallback resultCallback) { reportNotSupported(); CallbackUtils.onResult(resultCallback, () -> { }); } @BinderThread Loading