summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-07-02 16:40:08 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-07-02 16:40:08 +0000
commitcd4b57ab32bd46f211e818e5db15aaa3c390d03a (patch)
tree29916dc8ca9f3b0837724c81fb433ff68073741b /core/java
parent832599280908e8a9b9e71ef7e6ab389cdd8f90ff (diff)
parent4e944d463474804cfbaeb49cd05ffeaf47de98f0 (diff)
Merge "Switch back to sync IInputMethodManager" into sc-dev am: 4e944d4634
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15176334 Change-Id: Ia3216ae5707e981d1e2543dd5192e9bc6e5a8cc0
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/util/imetracing/ImeTracing.java6
-rw-r--r--core/java/android/util/imetracing/ImeTracingClientImpl.java7
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java138
-rw-r--r--core/java/com/android/internal/view/IInputMethodManager.aidl70
4 files changed, 61 insertions, 160 deletions
diff --git a/core/java/android/util/imetracing/ImeTracing.java b/core/java/android/util/imetracing/ImeTracing.java
index 2fcaec91833d..4696ae325e7b 100644
--- a/core/java/android/util/imetracing/ImeTracing.java
+++ b/core/java/android/util/imetracing/ImeTracing.java
@@ -27,8 +27,6 @@ import android.util.Log;
import android.util.proto.ProtoOutputStream;
import android.view.inputmethod.InputMethodManager;
-import com.android.internal.inputmethod.Completable;
-import com.android.internal.inputmethod.ResultCallbacks;
import com.android.internal.view.IInputMethodManager;
import java.io.PrintWriter;
@@ -92,9 +90,7 @@ public abstract class ImeTracing {
* @param where
*/
public void sendToService(byte[] protoDump, int source, String where) throws RemoteException {
- final Completable.Void value = Completable.createVoid();
- mService.startProtoDump(protoDump, source, where, ResultCallbacks.of(value));
- Completable.getResult(value);
+ mService.startProtoDump(protoDump, source, where);
}
/**
diff --git a/core/java/android/util/imetracing/ImeTracingClientImpl.java b/core/java/android/util/imetracing/ImeTracingClientImpl.java
index 17cdc4687660..5a57a6ade98b 100644
--- a/core/java/android/util/imetracing/ImeTracingClientImpl.java
+++ b/core/java/android/util/imetracing/ImeTracingClientImpl.java
@@ -24,9 +24,6 @@ import android.util.Log;
import android.util.proto.ProtoOutputStream;
import android.view.inputmethod.InputMethodManager;
-import com.android.internal.inputmethod.Completable;
-import com.android.internal.inputmethod.ResultCallbacks;
-
import java.io.PrintWriter;
/**
@@ -34,9 +31,7 @@ import java.io.PrintWriter;
*/
class ImeTracingClientImpl extends ImeTracing {
ImeTracingClientImpl() throws ServiceNotFoundException, RemoteException {
- final Completable.Boolean value = Completable.createBoolean();
- mService.isImeTraceEnabled(ResultCallbacks.of(value));
- sEnabled = Completable.getResult(value);
+ sEnabled = mService.isImeTraceEnabled();
}
@Override
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index b572d0871f12..42d77cd09689 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -88,10 +88,8 @@ import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.autofill.AutofillManager;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.inputmethod.Completable;
import com.android.internal.inputmethod.InputMethodDebug;
import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry;
-import com.android.internal.inputmethod.ResultCallbacks;
import com.android.internal.inputmethod.SoftInputShowHideReason;
import com.android.internal.inputmethod.StartInputFlags;
import com.android.internal.inputmethod.StartInputReason;
@@ -266,14 +264,6 @@ public final class InputMethodManager {
private static final int NOT_A_SUBTYPE_ID = -1;
/**
- * {@code true} to try to avoid blocking apps' UI thread by sending
- * {@link StartInputReason#WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION} and
- * {@link StartInputReason#WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION} in a truly asynchronous
- * way. {@code false} to go back to the previous synchronous semantics.
- */
- private static final boolean USE_REPORT_WINDOW_GAINED_FOCUS_ASYNC = true;
-
- /**
* A constant that represents Voice IME.
*
* @see InputMethodSubtype#getMode()
@@ -686,28 +676,18 @@ public final class InputMethodManager {
+ ", nextFocusIsServedView=" + nextFocusHasConnection);
}
- if (USE_REPORT_WINDOW_GAINED_FOCUS_ASYNC) {
- mService.reportWindowGainedFocusAsync(
- nextFocusHasConnection, mClient, focusedView.getWindowToken(),
- startInputFlags, softInputMode, windowFlags,
- mCurRootView.mContext.getApplicationInfo().targetSdkVersion);
- } else {
- final int startInputReason = nextFocusHasConnection
- ? WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
- : WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
- final Completable.InputBindResult value =
- Completable.createInputBindResult();
- mService.startInputOrWindowGainedFocus(
- startInputReason, mClient,
- focusedView.getWindowToken(), startInputFlags, softInputMode,
- windowFlags,
- null,
- null,
- 0 /* missingMethodFlags */,
- mCurRootView.mContext.getApplicationInfo().targetSdkVersion,
- ResultCallbacks.of(value));
- Completable.getResult(value); // ignore the result
- }
+ final int startInputReason = nextFocusHasConnection
+ ? WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
+ : WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
+ // ignore the result
+ mService.startInputOrWindowGainedFocus(
+ startInputReason, mClient,
+ focusedView.getWindowToken(), startInputFlags, softInputMode,
+ windowFlags,
+ null,
+ null,
+ 0 /* missingMethodFlags */,
+ mCurRootView.mContext.getApplicationInfo().targetSdkVersion);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1249,9 +1229,7 @@ public final class InputMethodManager {
// We intentionally do not use UserHandle.getCallingUserId() here because for system
// services InputMethodManagerInternal.getInputMethodListAsUser() should be used
// instead.
- final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
- mService.getInputMethodList(UserHandle.myUserId(), ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getInputMethodList(UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1269,9 +1247,7 @@ public final class InputMethodManager {
@NonNull
public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) {
try {
- final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
- mService.getInputMethodList(userId, ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getInputMethodList(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1289,9 +1265,7 @@ public final class InputMethodManager {
// We intentionally do not use UserHandle.getCallingUserId() here because for system
// services InputMethodManagerInternal.getEnabledInputMethodListAsUser() should be used
// instead.
- final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
- mService.getEnabledInputMethodList(UserHandle.myUserId(), ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getEnabledInputMethodList(UserHandle.myUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1307,9 +1281,7 @@ public final class InputMethodManager {
@RequiresPermission(INTERACT_ACROSS_USERS_FULL)
public List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId) {
try {
- final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
- mService.getEnabledInputMethodList(userId, ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getEnabledInputMethodList(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1328,13 +1300,9 @@ public final class InputMethodManager {
public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
boolean allowsImplicitlySelectedSubtypes) {
try {
- final Completable.InputMethodSubtypeList value =
- Completable.createInputMethodSubtypeList();
- mService.getEnabledInputMethodSubtypeList(
+ return mService.getEnabledInputMethodSubtypeList(
imi == null ? null : imi.getId(),
- allowsImplicitlySelectedSubtypes,
- ResultCallbacks.of(value));
- return Completable.getResult(value);
+ allowsImplicitlySelectedSubtypes);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1669,15 +1637,12 @@ public final class InputMethodManager {
try {
Log.d(TAG, "showSoftInput() view=" + view + " flags=" + flags + " reason="
+ InputMethodDebug.softInputDisplayReasonToString(reason));
- final Completable.Boolean value = Completable.createBoolean();
- mService.showSoftInput(
+ return mService.showSoftInput(
mClient,
view.getWindowToken(),
flags,
resultReceiver,
- reason,
- ResultCallbacks.of(value));
- return Completable.getResult(value);
+ reason);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1704,15 +1669,12 @@ public final class InputMethodManager {
Log.w(TAG, "No current root view, ignoring showSoftInputUnchecked()");
return;
}
- final Completable.Boolean value = Completable.createBoolean();
mService.showSoftInput(
mClient,
mCurRootView.getView().getWindowToken(),
flags,
resultReceiver,
- SoftInputShowHideReason.SHOW_SOFT_INPUT,
- ResultCallbacks.of(value));
- Completable.getResult(value); // ignore the result
+ SoftInputShowHideReason.SHOW_SOFT_INPUT);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1791,10 +1753,7 @@ public final class InputMethodManager {
}
try {
- final Completable.Boolean value = Completable.createBoolean();
- mService.hideSoftInput(mClient, windowToken, flags, resultReceiver, reason,
- ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.hideSoftInput(mClient, windowToken, flags, resultReceiver, reason);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2030,13 +1989,10 @@ public final class InputMethodManager {
+ InputMethodDebug.startInputFlagsToString(startInputFlags));
}
try {
- final Completable.InputBindResult value = Completable.createInputBindResult();
- mService.startInputOrWindowGainedFocus(
+ res = mService.startInputOrWindowGainedFocus(
startInputReason, mClient, windowGainingFocus, startInputFlags,
softInputMode, windowFlags, tba, servedContext, missingMethodFlags,
- view.getContext().getApplicationInfo().targetSdkVersion,
- ResultCallbacks.of(value));
- res = Completable.getResult(value);
+ view.getContext().getApplicationInfo().targetSdkVersion);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2144,15 +2100,12 @@ public final class InputMethodManager {
return;
}
try {
- final Completable.Boolean value = Completable.createBoolean();
mService.hideSoftInput(
mClient,
mCurRootView.getView().getWindowToken(),
HIDE_NOT_ALWAYS,
null,
- SoftInputShowHideReason.HIDE_SOFT_INPUT,
- ResultCallbacks.of(value));
- Completable.getResult(value); // ignore the result
+ SoftInputShowHideReason.HIDE_SOFT_INPUT);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2832,10 +2785,7 @@ public final class InputMethodManager {
? SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES
: SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES;
try {
- final Completable.Void value = Completable.createVoid();
- mService.showInputMethodPickerFromSystem(
- mClient, mode, displayId, ResultCallbacks.of(value));
- Completable.getResult(value);
+ mService.showInputMethodPickerFromSystem(mClient, mode, displayId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2843,10 +2793,7 @@ public final class InputMethodManager {
private void showInputMethodPickerLocked() {
try {
- final Completable.Void value = Completable.createVoid();
- mService.showInputMethodPickerFromClient(
- mClient, SHOW_IM_PICKER_MODE_AUTO, ResultCallbacks.of(value));
- Completable.getResult(value);
+ mService.showInputMethodPickerFromClient(mClient, SHOW_IM_PICKER_MODE_AUTO);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2866,9 +2813,7 @@ public final class InputMethodManager {
@TestApi
public boolean isInputMethodPickerShown() {
try {
- final Completable.Boolean value = Completable.createBoolean();
- mService.isInputMethodPickerShownForTest(ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.isInputMethodPickerShownForTest();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2882,10 +2827,7 @@ public final class InputMethodManager {
*/
public void showInputMethodAndSubtypeEnabler(String imiId) {
try {
- final Completable.Void value = Completable.createVoid();
- mService.showInputMethodAndSubtypeEnablerFromClient(
- mClient, imiId, ResultCallbacks.of(value));
- Completable.getResult(value);
+ mService.showInputMethodAndSubtypeEnablerFromClient(mClient, imiId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2898,9 +2840,7 @@ public final class InputMethodManager {
*/
public InputMethodSubtype getCurrentInputMethodSubtype() {
try {
- final Completable.InputMethodSubtype value = Completable.createInputMethodSubtype();
- mService.getCurrentInputMethodSubtype(ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getCurrentInputMethodSubtype();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2949,11 +2889,7 @@ public final class InputMethodManager {
}
final List<InputMethodSubtype> enabledSubtypes;
try {
- final Completable.InputMethodSubtypeList value =
- Completable.createInputMethodSubtypeList();
- mService.getEnabledInputMethodSubtypeList(
- imeId, true, ResultCallbacks.of(value));
- enabledSubtypes = Completable.getResult(value);
+ enabledSubtypes = mService.getEnabledInputMethodSubtypeList(imeId, true);
} catch (RemoteException e) {
return false;
}
@@ -3021,9 +2957,7 @@ public final class InputMethodManager {
@UnsupportedAppUsage
public int getInputMethodWindowVisibleHeight() {
try {
- final Completable.Int value = Completable.createInt();
- mService.getInputMethodWindowVisibleHeight(ResultCallbacks.of(value));
- return Completable.getIntResult(value);
+ return mService.getInputMethodWindowVisibleHeight();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3118,9 +3052,7 @@ public final class InputMethodManager {
@Deprecated
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
try {
- final Completable.Void value = Completable.createVoid();
- mService.setAdditionalInputMethodSubtypes(imiId, subtypes, ResultCallbacks.of(value));
- Completable.getResult(value);
+ mService.setAdditionalInputMethodSubtypes(imiId, subtypes);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3128,9 +3060,7 @@ public final class InputMethodManager {
public InputMethodSubtype getLastInputMethodSubtype() {
try {
- final Completable.InputMethodSubtype value = Completable.createInputMethodSubtype();
- mService.getLastInputMethodSubtype(ResultCallbacks.of(value));
- return Completable.getResult(value);
+ return mService.getLastInputMethodSubtype();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl
index 4891ce97f05d..d40c064c62e6 100644
--- a/core/java/com/android/internal/view/IInputMethodManager.aidl
+++ b/core/java/com/android/internal/view/IInputMethodManager.aidl
@@ -24,13 +24,6 @@ import android.view.inputmethod.EditorInfo;
import com.android.internal.view.InputBindResult;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethodClient;
-import com.android.internal.inputmethod.IBooleanResultCallback;
-import com.android.internal.inputmethod.IInputBindResultResultCallback;
-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
@@ -41,64 +34,51 @@ interface IInputMethodManager {
int untrustedDisplayId);
// TODO: Use ParceledListSlice instead
- oneway void getInputMethodList(int userId,
- in IInputMethodInfoListResultCallback resultCallback);
+ List<InputMethodInfo> getInputMethodList(int userId);
// TODO: Use ParceledListSlice instead
- oneway void getEnabledInputMethodList(int userId,
- in IInputMethodInfoListResultCallback resultCallback);
- oneway void getEnabledInputMethodSubtypeList(in String imiId,
- boolean allowsImplicitlySelectedSubtypes,
- in IInputMethodSubtypeListResultCallback resultCallback);
- oneway void getLastInputMethodSubtype(in IInputMethodSubtypeResultCallback resultCallback);
+ List<InputMethodInfo> getEnabledInputMethodList(int userId);
+ List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId,
+ boolean allowsImplicitlySelectedSubtypes);
+ InputMethodSubtype getLastInputMethodSubtype();
- oneway void showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
- in ResultReceiver resultReceiver, int reason, in IBooleanResultCallback resultCallback);
- oneway void hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
- in ResultReceiver resultReceiver, int reason, in IBooleanResultCallback resultCallback);
+ boolean showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
+ in ResultReceiver resultReceiver, int reason);
+ boolean hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
+ in ResultReceiver resultReceiver, int reason);
// If windowToken is null, this just does startInput(). Otherwise this reports that a window
// has gained focus, and if 'attribute' is non-null then also does startInput.
// @NonNull
- oneway void startInputOrWindowGainedFocus(
+ InputBindResult startInputOrWindowGainedFocus(
/* @StartInputReason */ int startInputReason,
in IInputMethodClient client, in IBinder windowToken,
/* @StartInputFlags */ int startInputFlags,
/* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
int windowFlags, in EditorInfo attribute, IInputContext inputContext,
/* @InputConnectionInspector.MissingMethodFlags */ int missingMethodFlags,
- int unverifiedTargetSdkVersion,
- in IInputBindResultResultCallback inputBindResult);
+ int unverifiedTargetSdkVersion);
- oneway void reportWindowGainedFocusAsync(
- boolean nextFocusHasConnection, in IInputMethodClient client, in IBinder windowToken,
- /* @StartInputFlags */ int startInputFlags,
- /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
- int windowFlags, int unverifiedTargetSdkVersion);
-
- oneway void showInputMethodPickerFromClient(in IInputMethodClient client,
- int auxiliarySubtypeMode, in IVoidResultCallback resultCallback);
- oneway void showInputMethodPickerFromSystem(in IInputMethodClient client,
- int auxiliarySubtypeMode, int displayId, in IVoidResultCallback resultCallback);
- oneway void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client,
- String topId, in IVoidResultCallback resultCallback);
- oneway void isInputMethodPickerShownForTest(in IBooleanResultCallback resultCallback);
- oneway void getCurrentInputMethodSubtype(in IInputMethodSubtypeResultCallback resultCallback);
- oneway void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes,
- in IVoidResultCallback resultCallback);
+ void showInputMethodPickerFromClient(in IInputMethodClient client,
+ int auxiliarySubtypeMode);
+ void showInputMethodPickerFromSystem(in IInputMethodClient client,
+ int auxiliarySubtypeMode, int displayId);
+ void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
+ boolean isInputMethodPickerShownForTest();
+ InputMethodSubtype getCurrentInputMethodSubtype();
+ void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
// This is kept due to @UnsupportedAppUsage.
// TODO(Bug 113914148): Consider removing this.
- oneway void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback);
+ int getInputMethodWindowVisibleHeight();
oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible);
/** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */
- oneway void removeImeSurface(in IVoidResultCallback resultCallback);
+ void removeImeSurface();
/** Remove the IME surface. Requires passing the currently focused window. */
oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
- oneway void startProtoDump(in byte[] protoDump, int source, String where,
- in IVoidResultCallback resultCallback);
- oneway void isImeTraceEnabled(in IBooleanResultCallback resultCallback);
+ void startProtoDump(in byte[] protoDump, int source, String where);
+ boolean isImeTraceEnabled();
// Starts an ime trace.
- oneway void startImeTrace(in IVoidResultCallback resultCallback);
+ void startImeTrace();
// Stops an ime trace.
- oneway void stopImeTrace(in IVoidResultCallback resultCallback);
+ void stopImeTrace();
}