Merge "Switch back to sync IInputMethodManager" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4e944d4634
@@ -27,8 +27,6 @@ import android.util.Log;
|
|||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.android.internal.inputmethod.Completable;
|
|
||||||
import com.android.internal.inputmethod.ResultCallbacks;
|
|
||||||
import com.android.internal.view.IInputMethodManager;
|
import com.android.internal.view.IInputMethodManager;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -92,9 +90,7 @@ public abstract class ImeTracing {
|
|||||||
* @param where
|
* @param where
|
||||||
*/
|
*/
|
||||||
public void sendToService(byte[] protoDump, int source, String where) throws RemoteException {
|
public void sendToService(byte[] protoDump, int source, String where) throws RemoteException {
|
||||||
final Completable.Void value = Completable.createVoid();
|
mService.startProtoDump(protoDump, source, where);
|
||||||
mService.startProtoDump(protoDump, source, where, ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ import android.util.Log;
|
|||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.android.internal.inputmethod.Completable;
|
|
||||||
import com.android.internal.inputmethod.ResultCallbacks;
|
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,9 +31,7 @@ import java.io.PrintWriter;
|
|||||||
*/
|
*/
|
||||||
class ImeTracingClientImpl extends ImeTracing {
|
class ImeTracingClientImpl extends ImeTracing {
|
||||||
ImeTracingClientImpl() throws ServiceNotFoundException, RemoteException {
|
ImeTracingClientImpl() throws ServiceNotFoundException, RemoteException {
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
sEnabled = mService.isImeTraceEnabled();
|
||||||
mService.isImeTraceEnabled(ResultCallbacks.of(value));
|
|
||||||
sEnabled = Completable.getResult(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -88,10 +88,8 @@ import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
|
|||||||
import android.view.autofill.AutofillManager;
|
import android.view.autofill.AutofillManager;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.inputmethod.Completable;
|
|
||||||
import com.android.internal.inputmethod.InputMethodDebug;
|
import com.android.internal.inputmethod.InputMethodDebug;
|
||||||
import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry;
|
import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry;
|
||||||
import com.android.internal.inputmethod.ResultCallbacks;
|
|
||||||
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
||||||
import com.android.internal.inputmethod.StartInputFlags;
|
import com.android.internal.inputmethod.StartInputFlags;
|
||||||
import com.android.internal.inputmethod.StartInputReason;
|
import com.android.internal.inputmethod.StartInputReason;
|
||||||
@@ -265,14 +263,6 @@ public final class InputMethodManager {
|
|||||||
|
|
||||||
private static final int NOT_A_SUBTYPE_ID = -1;
|
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.
|
* A constant that represents Voice IME.
|
||||||
*
|
*
|
||||||
@@ -686,28 +676,18 @@ public final class InputMethodManager {
|
|||||||
+ ", nextFocusIsServedView=" + nextFocusHasConnection);
|
+ ", nextFocusIsServedView=" + nextFocusHasConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (USE_REPORT_WINDOW_GAINED_FOCUS_ASYNC) {
|
final int startInputReason = nextFocusHasConnection
|
||||||
mService.reportWindowGainedFocusAsync(
|
? WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
|
||||||
nextFocusHasConnection, mClient, focusedView.getWindowToken(),
|
: WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
|
||||||
startInputFlags, softInputMode, windowFlags,
|
// ignore the result
|
||||||
mCurRootView.mContext.getApplicationInfo().targetSdkVersion);
|
mService.startInputOrWindowGainedFocus(
|
||||||
} else {
|
startInputReason, mClient,
|
||||||
final int startInputReason = nextFocusHasConnection
|
focusedView.getWindowToken(), startInputFlags, softInputMode,
|
||||||
? WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
|
windowFlags,
|
||||||
: WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
|
null,
|
||||||
final Completable.InputBindResult value =
|
null,
|
||||||
Completable.createInputBindResult();
|
0 /* missingMethodFlags */,
|
||||||
mService.startInputOrWindowGainedFocus(
|
mCurRootView.mContext.getApplicationInfo().targetSdkVersion);
|
||||||
startInputReason, mClient,
|
|
||||||
focusedView.getWindowToken(), startInputFlags, softInputMode,
|
|
||||||
windowFlags,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
0 /* missingMethodFlags */,
|
|
||||||
mCurRootView.mContext.getApplicationInfo().targetSdkVersion,
|
|
||||||
ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value); // ignore the result
|
|
||||||
}
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1249,9 +1229,7 @@ public final class InputMethodManager {
|
|||||||
// We intentionally do not use UserHandle.getCallingUserId() here because for system
|
// We intentionally do not use UserHandle.getCallingUserId() here because for system
|
||||||
// services InputMethodManagerInternal.getInputMethodListAsUser() should be used
|
// services InputMethodManagerInternal.getInputMethodListAsUser() should be used
|
||||||
// instead.
|
// instead.
|
||||||
final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
|
return mService.getInputMethodList(UserHandle.myUserId());
|
||||||
mService.getInputMethodList(UserHandle.myUserId(), ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1269,9 +1247,7 @@ public final class InputMethodManager {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) {
|
public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) {
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
|
return mService.getInputMethodList(userId);
|
||||||
mService.getInputMethodList(userId, ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1289,9 +1265,7 @@ public final class InputMethodManager {
|
|||||||
// We intentionally do not use UserHandle.getCallingUserId() here because for system
|
// We intentionally do not use UserHandle.getCallingUserId() here because for system
|
||||||
// services InputMethodManagerInternal.getEnabledInputMethodListAsUser() should be used
|
// services InputMethodManagerInternal.getEnabledInputMethodListAsUser() should be used
|
||||||
// instead.
|
// instead.
|
||||||
final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
|
return mService.getEnabledInputMethodList(UserHandle.myUserId());
|
||||||
mService.getEnabledInputMethodList(UserHandle.myUserId(), ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1307,9 +1281,7 @@ public final class InputMethodManager {
|
|||||||
@RequiresPermission(INTERACT_ACROSS_USERS_FULL)
|
@RequiresPermission(INTERACT_ACROSS_USERS_FULL)
|
||||||
public List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId) {
|
public List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId) {
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodInfoList value = Completable.createInputMethodInfoList();
|
return mService.getEnabledInputMethodList(userId);
|
||||||
mService.getEnabledInputMethodList(userId, ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1328,13 +1300,9 @@ public final class InputMethodManager {
|
|||||||
public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
|
public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
|
||||||
boolean allowsImplicitlySelectedSubtypes) {
|
boolean allowsImplicitlySelectedSubtypes) {
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodSubtypeList value =
|
return mService.getEnabledInputMethodSubtypeList(
|
||||||
Completable.createInputMethodSubtypeList();
|
|
||||||
mService.getEnabledInputMethodSubtypeList(
|
|
||||||
imi == null ? null : imi.getId(),
|
imi == null ? null : imi.getId(),
|
||||||
allowsImplicitlySelectedSubtypes,
|
allowsImplicitlySelectedSubtypes);
|
||||||
ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1669,15 +1637,12 @@ public final class InputMethodManager {
|
|||||||
try {
|
try {
|
||||||
Log.d(TAG, "showSoftInput() view=" + view + " flags=" + flags + " reason="
|
Log.d(TAG, "showSoftInput() view=" + view + " flags=" + flags + " reason="
|
||||||
+ InputMethodDebug.softInputDisplayReasonToString(reason));
|
+ InputMethodDebug.softInputDisplayReasonToString(reason));
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
return mService.showSoftInput(
|
||||||
mService.showSoftInput(
|
|
||||||
mClient,
|
mClient,
|
||||||
view.getWindowToken(),
|
view.getWindowToken(),
|
||||||
flags,
|
flags,
|
||||||
resultReceiver,
|
resultReceiver,
|
||||||
reason,
|
reason);
|
||||||
ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1704,15 +1669,12 @@ public final class InputMethodManager {
|
|||||||
Log.w(TAG, "No current root view, ignoring showSoftInputUnchecked()");
|
Log.w(TAG, "No current root view, ignoring showSoftInputUnchecked()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
|
||||||
mService.showSoftInput(
|
mService.showSoftInput(
|
||||||
mClient,
|
mClient,
|
||||||
mCurRootView.getView().getWindowToken(),
|
mCurRootView.getView().getWindowToken(),
|
||||||
flags,
|
flags,
|
||||||
resultReceiver,
|
resultReceiver,
|
||||||
SoftInputShowHideReason.SHOW_SOFT_INPUT,
|
SoftInputShowHideReason.SHOW_SOFT_INPUT);
|
||||||
ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value); // ignore the result
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -1791,10 +1753,7 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
return mService.hideSoftInput(mClient, windowToken, flags, resultReceiver, reason);
|
||||||
mService.hideSoftInput(mClient, windowToken, flags, resultReceiver, reason,
|
|
||||||
ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2030,13 +1989,10 @@ public final class InputMethodManager {
|
|||||||
+ InputMethodDebug.startInputFlagsToString(startInputFlags));
|
+ InputMethodDebug.startInputFlagsToString(startInputFlags));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final Completable.InputBindResult value = Completable.createInputBindResult();
|
res = mService.startInputOrWindowGainedFocus(
|
||||||
mService.startInputOrWindowGainedFocus(
|
|
||||||
startInputReason, mClient, windowGainingFocus, startInputFlags,
|
startInputReason, mClient, windowGainingFocus, startInputFlags,
|
||||||
softInputMode, windowFlags, tba, servedContext, missingMethodFlags,
|
softInputMode, windowFlags, tba, servedContext, missingMethodFlags,
|
||||||
view.getContext().getApplicationInfo().targetSdkVersion,
|
view.getContext().getApplicationInfo().targetSdkVersion);
|
||||||
ResultCallbacks.of(value));
|
|
||||||
res = Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2144,15 +2100,12 @@ public final class InputMethodManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
|
||||||
mService.hideSoftInput(
|
mService.hideSoftInput(
|
||||||
mClient,
|
mClient,
|
||||||
mCurRootView.getView().getWindowToken(),
|
mCurRootView.getView().getWindowToken(),
|
||||||
HIDE_NOT_ALWAYS,
|
HIDE_NOT_ALWAYS,
|
||||||
null,
|
null,
|
||||||
SoftInputShowHideReason.HIDE_SOFT_INPUT,
|
SoftInputShowHideReason.HIDE_SOFT_INPUT);
|
||||||
ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value); // ignore the result
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2832,10 +2785,7 @@ public final class InputMethodManager {
|
|||||||
? SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES
|
? SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES
|
||||||
: SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES;
|
: SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES;
|
||||||
try {
|
try {
|
||||||
final Completable.Void value = Completable.createVoid();
|
mService.showInputMethodPickerFromSystem(mClient, mode, displayId);
|
||||||
mService.showInputMethodPickerFromSystem(
|
|
||||||
mClient, mode, displayId, ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2843,10 +2793,7 @@ public final class InputMethodManager {
|
|||||||
|
|
||||||
private void showInputMethodPickerLocked() {
|
private void showInputMethodPickerLocked() {
|
||||||
try {
|
try {
|
||||||
final Completable.Void value = Completable.createVoid();
|
mService.showInputMethodPickerFromClient(mClient, SHOW_IM_PICKER_MODE_AUTO);
|
||||||
mService.showInputMethodPickerFromClient(
|
|
||||||
mClient, SHOW_IM_PICKER_MODE_AUTO, ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2866,9 +2813,7 @@ public final class InputMethodManager {
|
|||||||
@TestApi
|
@TestApi
|
||||||
public boolean isInputMethodPickerShown() {
|
public boolean isInputMethodPickerShown() {
|
||||||
try {
|
try {
|
||||||
final Completable.Boolean value = Completable.createBoolean();
|
return mService.isInputMethodPickerShownForTest();
|
||||||
mService.isInputMethodPickerShownForTest(ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2882,10 +2827,7 @@ public final class InputMethodManager {
|
|||||||
*/
|
*/
|
||||||
public void showInputMethodAndSubtypeEnabler(String imiId) {
|
public void showInputMethodAndSubtypeEnabler(String imiId) {
|
||||||
try {
|
try {
|
||||||
final Completable.Void value = Completable.createVoid();
|
mService.showInputMethodAndSubtypeEnablerFromClient(mClient, imiId);
|
||||||
mService.showInputMethodAndSubtypeEnablerFromClient(
|
|
||||||
mClient, imiId, ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2898,9 +2840,7 @@ public final class InputMethodManager {
|
|||||||
*/
|
*/
|
||||||
public InputMethodSubtype getCurrentInputMethodSubtype() {
|
public InputMethodSubtype getCurrentInputMethodSubtype() {
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodSubtype value = Completable.createInputMethodSubtype();
|
return mService.getCurrentInputMethodSubtype();
|
||||||
mService.getCurrentInputMethodSubtype(ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -2949,11 +2889,7 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
final List<InputMethodSubtype> enabledSubtypes;
|
final List<InputMethodSubtype> enabledSubtypes;
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodSubtypeList value =
|
enabledSubtypes = mService.getEnabledInputMethodSubtypeList(imeId, true);
|
||||||
Completable.createInputMethodSubtypeList();
|
|
||||||
mService.getEnabledInputMethodSubtypeList(
|
|
||||||
imeId, true, ResultCallbacks.of(value));
|
|
||||||
enabledSubtypes = Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3021,9 +2957,7 @@ public final class InputMethodManager {
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public int getInputMethodWindowVisibleHeight() {
|
public int getInputMethodWindowVisibleHeight() {
|
||||||
try {
|
try {
|
||||||
final Completable.Int value = Completable.createInt();
|
return mService.getInputMethodWindowVisibleHeight();
|
||||||
mService.getInputMethodWindowVisibleHeight(ResultCallbacks.of(value));
|
|
||||||
return Completable.getIntResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -3118,9 +3052,7 @@ public final class InputMethodManager {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
|
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
|
||||||
try {
|
try {
|
||||||
final Completable.Void value = Completable.createVoid();
|
mService.setAdditionalInputMethodSubtypes(imiId, subtypes);
|
||||||
mService.setAdditionalInputMethodSubtypes(imiId, subtypes, ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -3128,9 +3060,7 @@ public final class InputMethodManager {
|
|||||||
|
|
||||||
public InputMethodSubtype getLastInputMethodSubtype() {
|
public InputMethodSubtype getLastInputMethodSubtype() {
|
||||||
try {
|
try {
|
||||||
final Completable.InputMethodSubtype value = Completable.createInputMethodSubtype();
|
return mService.getLastInputMethodSubtype();
|
||||||
mService.getLastInputMethodSubtype(ResultCallbacks.of(value));
|
|
||||||
return Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,6 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import com.android.internal.view.InputBindResult;
|
import com.android.internal.view.InputBindResult;
|
||||||
import com.android.internal.view.IInputContext;
|
import com.android.internal.view.IInputContext;
|
||||||
import com.android.internal.view.IInputMethodClient;
|
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
|
* Public interface to the global input method manager, used by all client
|
||||||
@@ -41,64 +34,51 @@ interface IInputMethodManager {
|
|||||||
int untrustedDisplayId);
|
int untrustedDisplayId);
|
||||||
|
|
||||||
// TODO: Use ParceledListSlice instead
|
// TODO: Use ParceledListSlice instead
|
||||||
oneway void getInputMethodList(int userId,
|
List<InputMethodInfo> getInputMethodList(int userId);
|
||||||
in IInputMethodInfoListResultCallback resultCallback);
|
|
||||||
// TODO: Use ParceledListSlice instead
|
// TODO: Use ParceledListSlice instead
|
||||||
oneway void getEnabledInputMethodList(int userId,
|
List<InputMethodInfo> getEnabledInputMethodList(int userId);
|
||||||
in IInputMethodInfoListResultCallback resultCallback);
|
List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId,
|
||||||
oneway void getEnabledInputMethodSubtypeList(in String imiId,
|
boolean allowsImplicitlySelectedSubtypes);
|
||||||
boolean allowsImplicitlySelectedSubtypes,
|
InputMethodSubtype getLastInputMethodSubtype();
|
||||||
in IInputMethodSubtypeListResultCallback resultCallback);
|
|
||||||
oneway void getLastInputMethodSubtype(in IInputMethodSubtypeResultCallback resultCallback);
|
|
||||||
|
|
||||||
oneway void showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
|
boolean showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
|
||||||
in ResultReceiver resultReceiver, int reason, in IBooleanResultCallback resultCallback);
|
in ResultReceiver resultReceiver, int reason);
|
||||||
oneway void hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
|
boolean hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags,
|
||||||
in ResultReceiver resultReceiver, int reason, in IBooleanResultCallback resultCallback);
|
in ResultReceiver resultReceiver, int reason);
|
||||||
// If windowToken is null, this just does startInput(). Otherwise this reports that a window
|
// 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.
|
// has gained focus, and if 'attribute' is non-null then also does startInput.
|
||||||
// @NonNull
|
// @NonNull
|
||||||
oneway void startInputOrWindowGainedFocus(
|
InputBindResult startInputOrWindowGainedFocus(
|
||||||
/* @StartInputReason */ int startInputReason,
|
/* @StartInputReason */ int startInputReason,
|
||||||
in IInputMethodClient client, in IBinder windowToken,
|
in IInputMethodClient client, in IBinder windowToken,
|
||||||
/* @StartInputFlags */ int startInputFlags,
|
/* @StartInputFlags */ int startInputFlags,
|
||||||
/* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
|
/* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
|
||||||
int windowFlags, in EditorInfo attribute, IInputContext inputContext,
|
int windowFlags, in EditorInfo attribute, IInputContext inputContext,
|
||||||
/* @InputConnectionInspector.MissingMethodFlags */ int missingMethodFlags,
|
/* @InputConnectionInspector.MissingMethodFlags */ int missingMethodFlags,
|
||||||
int unverifiedTargetSdkVersion,
|
int unverifiedTargetSdkVersion);
|
||||||
in IInputBindResultResultCallback inputBindResult);
|
|
||||||
|
|
||||||
oneway void reportWindowGainedFocusAsync(
|
void showInputMethodPickerFromClient(in IInputMethodClient client,
|
||||||
boolean nextFocusHasConnection, in IInputMethodClient client, in IBinder windowToken,
|
int auxiliarySubtypeMode);
|
||||||
/* @StartInputFlags */ int startInputFlags,
|
void showInputMethodPickerFromSystem(in IInputMethodClient client,
|
||||||
/* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
|
int auxiliarySubtypeMode, int displayId);
|
||||||
int windowFlags, int unverifiedTargetSdkVersion);
|
void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
|
||||||
|
boolean isInputMethodPickerShownForTest();
|
||||||
oneway void showInputMethodPickerFromClient(in IInputMethodClient client,
|
InputMethodSubtype getCurrentInputMethodSubtype();
|
||||||
int auxiliarySubtypeMode, in IVoidResultCallback resultCallback);
|
void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
|
||||||
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);
|
|
||||||
// This is kept due to @UnsupportedAppUsage.
|
// This is kept due to @UnsupportedAppUsage.
|
||||||
// TODO(Bug 113914148): Consider removing this.
|
// TODO(Bug 113914148): Consider removing this.
|
||||||
oneway void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback);
|
int getInputMethodWindowVisibleHeight();
|
||||||
|
|
||||||
oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible);
|
oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible);
|
||||||
/** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */
|
/** 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. */
|
/** Remove the IME surface. Requires passing the currently focused window. */
|
||||||
oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
|
oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
|
||||||
oneway void startProtoDump(in byte[] protoDump, int source, String where,
|
void startProtoDump(in byte[] protoDump, int source, String where);
|
||||||
in IVoidResultCallback resultCallback);
|
boolean isImeTraceEnabled();
|
||||||
oneway void isImeTraceEnabled(in IBooleanResultCallback resultCallback);
|
|
||||||
|
|
||||||
// Starts an ime trace.
|
// Starts an ime trace.
|
||||||
oneway void startImeTrace(in IVoidResultCallback resultCallback);
|
void startImeTrace();
|
||||||
// Stops an ime trace.
|
// Stops an ime trace.
|
||||||
oneway void stopImeTrace(in IVoidResultCallback resultCallback);
|
void stopImeTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import android.view.animation.PathInterpolator;
|
|||||||
import androidx.annotation.BinderThread;
|
import androidx.annotation.BinderThread;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.inputmethod.Completable;
|
|
||||||
import com.android.internal.inputmethod.ResultCallbacks;
|
|
||||||
import com.android.internal.view.IInputMethodManager;
|
import com.android.internal.view.IInputMethodManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -540,9 +538,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
try {
|
try {
|
||||||
// Remove the IME surface to make the insets invisible for
|
// Remove the IME surface to make the insets invisible for
|
||||||
// non-client controlled insets.
|
// non-client controlled insets.
|
||||||
final Completable.Void value = Completable.createVoid();
|
imms.removeImeSurface();
|
||||||
imms.removeImeSurface(ResultCallbacks.of(value));
|
|
||||||
Completable.getResult(value);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Failed to remove IME surface.", e);
|
Slog.e(TAG, "Failed to remove IME surface.", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,13 +157,8 @@ import com.android.internal.content.PackageMonitor;
|
|||||||
import com.android.internal.inputmethod.CallbackUtils;
|
import com.android.internal.inputmethod.CallbackUtils;
|
||||||
import com.android.internal.inputmethod.IBooleanResultCallback;
|
import com.android.internal.inputmethod.IBooleanResultCallback;
|
||||||
import com.android.internal.inputmethod.IIInputContentUriTokenResultCallback;
|
import com.android.internal.inputmethod.IIInputContentUriTokenResultCallback;
|
||||||
import com.android.internal.inputmethod.IInputBindResultResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputContentUriToken;
|
import com.android.internal.inputmethod.IInputContentUriToken;
|
||||||
import com.android.internal.inputmethod.IInputMethodInfoListResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
|
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.IVoidResultCallback;
|
||||||
import com.android.internal.inputmethod.InputMethodDebug;
|
import com.android.internal.inputmethod.InputMethodDebug;
|
||||||
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
||||||
@@ -213,7 +208,6 @@ import java.util.Objects;
|
|||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a system service that manages input methods.
|
* This class provides a system service that manages input methods.
|
||||||
@@ -1895,51 +1889,45 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getInputMethodList(@UserIdInt int userId,
|
public List<InputMethodInfo> getInputMethodList(@UserIdInt int userId) {
|
||||||
IInputMethodInfoListResultCallback resultCallback) {
|
if (UserHandle.getCallingUserId() != userId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
mContext.enforceCallingPermission(
|
||||||
if (UserHandle.getCallingUserId() != userId) {
|
Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
|
||||||
mContext.enforceCallingPermission(
|
}
|
||||||
Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
|
synchronized (mMethodMap) {
|
||||||
|
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(userId,
|
||||||
|
mSettings.getCurrentUserId(), null);
|
||||||
|
if (resolvedUserIds.length != 1) {
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
synchronized (mMethodMap) {
|
final long ident = Binder.clearCallingIdentity();
|
||||||
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(userId,
|
try {
|
||||||
mSettings.getCurrentUserId(), null);
|
return getInputMethodListLocked(resolvedUserIds[0]);
|
||||||
if (resolvedUserIds.length != 1) {
|
} finally {
|
||||||
return Collections.emptyList();
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
return getInputMethodListLocked(resolvedUserIds[0]);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getEnabledInputMethodList(@UserIdInt int userId,
|
public List<InputMethodInfo> getEnabledInputMethodList(@UserIdInt int userId) {
|
||||||
IInputMethodInfoListResultCallback resultCallback) {
|
if (UserHandle.getCallingUserId() != userId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
mContext.enforceCallingPermission(
|
||||||
if (UserHandle.getCallingUserId() != userId) {
|
Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
|
||||||
mContext.enforceCallingPermission(
|
}
|
||||||
Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
|
synchronized (mMethodMap) {
|
||||||
|
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(userId,
|
||||||
|
mSettings.getCurrentUserId(), null);
|
||||||
|
if (resolvedUserIds.length != 1) {
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
synchronized (mMethodMap) {
|
final long ident = Binder.clearCallingIdentity();
|
||||||
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(userId,
|
try {
|
||||||
mSettings.getCurrentUserId(), null);
|
return getEnabledInputMethodListLocked(resolvedUserIds[0]);
|
||||||
if (resolvedUserIds.length != 1) {
|
} finally {
|
||||||
return Collections.emptyList();
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
return getEnabledInputMethodListLocked(resolvedUserIds[0]);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuardedBy("mMethodMap")
|
@GuardedBy("mMethodMap")
|
||||||
@@ -2097,29 +2085,25 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
* @param imiId if null, returns enabled subtypes for the current {@link InputMethodInfo}.
|
* @param imiId if null, returns enabled subtypes for the current {@link InputMethodInfo}.
|
||||||
* @param allowsImplicitlySelectedSubtypes {@code true} to return the implicitly selected
|
* @param allowsImplicitlySelectedSubtypes {@code true} to return the implicitly selected
|
||||||
* subtypes.
|
* subtypes.
|
||||||
* @param resultCallback to callback the result.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getEnabledInputMethodSubtypeList(String imiId,
|
public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
|
||||||
boolean allowsImplicitlySelectedSubtypes,
|
boolean allowsImplicitlySelectedSubtypes) {
|
||||||
IInputMethodSubtypeListResultCallback resultCallback) {
|
final int callingUserId = UserHandle.getCallingUserId();
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
synchronized (mMethodMap) {
|
||||||
final int callingUserId = UserHandle.getCallingUserId();
|
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(callingUserId,
|
||||||
synchronized (mMethodMap) {
|
mSettings.getCurrentUserId(), null);
|
||||||
final int[] resolvedUserIds = InputMethodUtils.resolveUserId(callingUserId,
|
if (resolvedUserIds.length != 1) {
|
||||||
mSettings.getCurrentUserId(), null);
|
return Collections.emptyList();
|
||||||
if (resolvedUserIds.length != 1) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
return getEnabledInputMethodSubtypeListLocked(imiId,
|
|
||||||
allowsImplicitlySelectedSubtypes, resolvedUserIds[0]);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
final long ident = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
return getEnabledInputMethodSubtypeListLocked(imiId,
|
||||||
|
allowsImplicitlySelectedSubtypes, resolvedUserIds[0]);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuardedBy("mMethodMap")
|
@GuardedBy("mMethodMap")
|
||||||
@@ -3067,44 +3051,41 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
|
public boolean showSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
|
||||||
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason,
|
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
|
||||||
IBooleanResultCallback resultCallback) {
|
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showSoftInput");
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
int uid = Binder.getCallingUid();
|
||||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showSoftInput");
|
ImeTracing.getInstance().triggerManagerServiceDump(
|
||||||
int uid = Binder.getCallingUid();
|
"InputMethodManagerService#showSoftInput");
|
||||||
ImeTracing.getInstance().triggerManagerServiceDump(
|
synchronized (mMethodMap) {
|
||||||
"InputMethodManagerService#showSoftInput");
|
if (!calledFromValidUserLocked()) {
|
||||||
synchronized (mMethodMap) {
|
return false;
|
||||||
if (!calledFromValidUserLocked()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
if (mCurClient == null || client == null
|
|
||||||
|| mCurClient.client.asBinder() != client.asBinder()) {
|
|
||||||
// We need to check if this is the current client with
|
|
||||||
// focus in the window manager, to allow this call to
|
|
||||||
// be made before input is started in it.
|
|
||||||
final ClientState cs = mClients.get(client.asBinder());
|
|
||||||
if (cs == null) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"unknown client " + client.asBinder());
|
|
||||||
}
|
|
||||||
if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid,
|
|
||||||
cs.selfReportedDisplayId)) {
|
|
||||||
Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
|
|
||||||
return showCurrentInputLocked(windowToken, flags, resultReceiver, reason);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
final long ident = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
if (mCurClient == null || client == null
|
||||||
|
|| mCurClient.client.asBinder() != client.asBinder()) {
|
||||||
|
// We need to check if this is the current client with
|
||||||
|
// focus in the window manager, to allow this call to
|
||||||
|
// be made before input is started in it.
|
||||||
|
final ClientState cs = mClients.get(client.asBinder());
|
||||||
|
if (cs == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"unknown client " + client.asBinder());
|
||||||
|
}
|
||||||
|
if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid,
|
||||||
|
cs.selfReportedDisplayId)) {
|
||||||
|
Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
|
||||||
|
return showCurrentInputLocked(windowToken, flags, resultReceiver, reason);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
|
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -3186,49 +3167,46 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
|
public boolean hideSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
|
||||||
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason,
|
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
|
||||||
IBooleanResultCallback resultCallback) {
|
int uid = Binder.getCallingUid();
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
ImeTracing.getInstance().triggerManagerServiceDump(
|
||||||
int uid = Binder.getCallingUid();
|
"InputMethodManagerService#hideSoftInput");
|
||||||
ImeTracing.getInstance().triggerManagerServiceDump(
|
synchronized (mMethodMap) {
|
||||||
"InputMethodManagerService#hideSoftInput");
|
if (!InputMethodManagerService.this.calledFromValidUserLocked()) {
|
||||||
synchronized (mMethodMap) {
|
return false;
|
||||||
if (!InputMethodManagerService.this.calledFromValidUserLocked()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideSoftInput");
|
|
||||||
if (mCurClient == null || client == null
|
|
||||||
|| mCurClient.client.asBinder() != client.asBinder()) {
|
|
||||||
// We need to check if this is the current client with
|
|
||||||
// focus in the window manager, to allow this call to
|
|
||||||
// be made before input is started in it.
|
|
||||||
final ClientState cs = mClients.get(client.asBinder());
|
|
||||||
if (cs == null) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"unknown client " + client.asBinder());
|
|
||||||
}
|
|
||||||
if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid,
|
|
||||||
cs.selfReportedDisplayId)) {
|
|
||||||
if (DEBUG) {
|
|
||||||
Slog.w(TAG,
|
|
||||||
"Ignoring hideSoftInput of uid " + uid + ": " + client);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DEBUG) Slog.v(TAG, "Client requesting input be hidden");
|
|
||||||
return InputMethodManagerService.this.hideCurrentInputLocked(windowToken,
|
|
||||||
flags, resultReceiver, reason);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
final long ident = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideSoftInput");
|
||||||
|
if (mCurClient == null || client == null
|
||||||
|
|| mCurClient.client.asBinder() != client.asBinder()) {
|
||||||
|
// We need to check if this is the current client with
|
||||||
|
// focus in the window manager, to allow this call to
|
||||||
|
// be made before input is started in it.
|
||||||
|
final ClientState cs = mClients.get(client.asBinder());
|
||||||
|
if (cs == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"unknown client " + client.asBinder());
|
||||||
|
}
|
||||||
|
if (!mWindowManagerInternal.isInputMethodClientFocus(cs.uid, cs.pid,
|
||||||
|
cs.selfReportedDisplayId)) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.w(TAG,
|
||||||
|
"Ignoring hideSoftInput of uid " + uid + ": " + client);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DEBUG) Slog.v(TAG, "Client requesting input be hidden");
|
||||||
|
return InputMethodManagerService.this.hideCurrentInputLocked(windowToken,
|
||||||
|
flags, resultReceiver, reason);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
|
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hideCurrentInputLocked(IBinder windowToken, int flags, ResultReceiver resultReceiver,
|
boolean hideCurrentInputLocked(IBinder windowToken, int flags, ResultReceiver resultReceiver,
|
||||||
@@ -3280,38 +3258,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public void reportWindowGainedFocusAsync(
|
public InputBindResult startInputOrWindowGainedFocus(
|
||||||
boolean nextFocusHasConnection, IInputMethodClient client, IBinder windowToken,
|
|
||||||
@StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode,
|
|
||||||
int windowFlags, int unverifiedTargetSdkVersion) {
|
|
||||||
final int startInputReason = nextFocusHasConnection
|
|
||||||
? StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
|
|
||||||
: StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
|
|
||||||
try {
|
|
||||||
startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
|
||||||
startInputFlags, softInputMode, windowFlags, null /* attribute */,
|
|
||||||
null /* inputContext */, 0 /* missingMethods */, unverifiedTargetSdkVersion);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
if (client != null) {
|
|
||||||
try {
|
|
||||||
client.throwExceptionFromSystem(t.getMessage());
|
|
||||||
} catch (RemoteException ignore) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public void startInputOrWindowGainedFocus(
|
|
||||||
@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken,
|
@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken,
|
||||||
@StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode,
|
@StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode,
|
||||||
int windowFlags, @Nullable EditorInfo attribute, IInputContext inputContext,
|
int windowFlags, @Nullable EditorInfo attribute, IInputContext inputContext,
|
||||||
@MissingMethodFlags int missingMethods, int unverifiedTargetSdkVersion,
|
@MissingMethodFlags int missingMethods, int unverifiedTargetSdkVersion) {
|
||||||
IInputBindResultResultCallback resultCallback) {
|
return startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
||||||
CallbackUtils.onResult(resultCallback, (Supplier<InputBindResult>) () ->
|
|
||||||
startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
|
||||||
startInputFlags, softInputMode, windowFlags, attribute, inputContext,
|
startInputFlags, softInputMode, windowFlags, attribute, inputContext,
|
||||||
missingMethods, unverifiedTargetSdkVersion));
|
missingMethods, unverifiedTargetSdkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -3671,54 +3625,47 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode,
|
public void showInputMethodPickerFromClient(IInputMethodClient client,
|
||||||
IVoidResultCallback resultCallback) {
|
int auxiliarySubtypeMode) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
if (!calledFromValidUserLocked()) {
|
||||||
if (!calledFromValidUserLocked()) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!canShowInputMethodPickerLocked(client)) {
|
|
||||||
Slog.w(TAG, "Ignoring showInputMethodPickerFromClient of uid "
|
|
||||||
+ Binder.getCallingUid() + ": " + client);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always call subtype picker, because subtype picker is a superset of input method
|
|
||||||
// picker.
|
|
||||||
mHandler.sendMessage(mCaller.obtainMessageII(
|
|
||||||
MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode,
|
|
||||||
(mCurClient != null) ? mCurClient.selfReportedDisplayId : DEFAULT_DISPLAY));
|
|
||||||
}
|
}
|
||||||
});
|
if (!canShowInputMethodPickerLocked(client)) {
|
||||||
|
Slog.w(TAG, "Ignoring showInputMethodPickerFromClient of uid "
|
||||||
|
+ Binder.getCallingUid() + ": " + client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always call subtype picker, because subtype picker is a superset of input method
|
||||||
|
// picker.
|
||||||
|
mHandler.sendMessage(mCaller.obtainMessageII(
|
||||||
|
MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode,
|
||||||
|
(mCurClient != null) ? mCurClient.selfReportedDisplayId : DEFAULT_DISPLAY));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode,
|
public void showInputMethodPickerFromSystem(IInputMethodClient client, int auxiliarySubtypeMode,
|
||||||
int displayId, IVoidResultCallback resultCallback) {
|
int displayId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
if (mContext.checkCallingPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
|
||||||
if (mContext.checkCallingPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
throw new SecurityException(
|
||||||
throw new SecurityException(
|
"showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS "
|
||||||
"showInputMethodPickerFromSystem requires WRITE_SECURE_SETTINGS "
|
+ "permission");
|
||||||
+ "permission");
|
}
|
||||||
}
|
// Always call subtype picker, because subtype picker is a superset of input method
|
||||||
// Always call subtype picker, because subtype picker is a superset of input method
|
// picker.
|
||||||
// picker.
|
mHandler.sendMessage(mCaller.obtainMessageII(
|
||||||
mHandler.sendMessage(mCaller.obtainMessageII(
|
MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, displayId));
|
||||||
MSG_SHOW_IM_SUBTYPE_PICKER, auxiliarySubtypeMode, displayId));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A test API for CTS to make sure that the input method menu is showing.
|
* A test API for CTS to make sure that the input method menu is showing.
|
||||||
*
|
|
||||||
* @param resultCallback {@code true} while the input method menu is showing UI.
|
|
||||||
*/
|
*/
|
||||||
public void isInputMethodPickerShownForTest(IBooleanResultCallback resultCallback) {
|
public boolean isInputMethodPickerShownForTest() {
|
||||||
synchronized(mMethodMap) {
|
synchronized(mMethodMap) {
|
||||||
CallbackUtils.onResult(
|
return mMenuController.isisInputMethodPickerShownForTestLocked();
|
||||||
resultCallback, mMenuController::isisInputMethodPickerShownForTestLocked);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3751,17 +3698,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodAndSubtypeEnablerFromClient(
|
public void showInputMethodAndSubtypeEnablerFromClient(
|
||||||
IInputMethodClient client, String inputMethodId, IVoidResultCallback resultCallback) {
|
IInputMethodClient client, String inputMethodId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
// TODO(yukawa): Should we verify the display ID?
|
||||||
// TODO(yukawa): Should we verify the display ID?
|
if (!calledFromValidUserLocked()) {
|
||||||
if (!calledFromValidUserLocked()) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
executeOrSendMessage(mCurMethod, mCaller.obtainMessageO(
|
|
||||||
MSG_SHOW_IM_SUBTYPE_ENABLER, inputMethodId));
|
|
||||||
}
|
}
|
||||||
});
|
executeOrSendMessage(mCurMethod, mCaller.obtainMessageO(
|
||||||
|
MSG_SHOW_IM_SUBTYPE_ENABLER, inputMethodId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -3869,89 +3814,83 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLastInputMethodSubtype(IInputMethodSubtypeResultCallback resultCallback) {
|
public InputMethodSubtype getLastInputMethodSubtype() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
if (!calledFromValidUserLocked()) {
|
||||||
if (!calledFromValidUserLocked()) {
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final Pair<String, String> lastIme = mSettings.getLastInputMethodAndSubtypeLocked();
|
|
||||||
// TODO: Handle the case of the last IME with no subtypes
|
|
||||||
if (lastIme == null || TextUtils.isEmpty(lastIme.first)
|
|
||||||
|| TextUtils.isEmpty(lastIme.second)) return null;
|
|
||||||
final InputMethodInfo lastImi = mMethodMap.get(lastIme.first);
|
|
||||||
if (lastImi == null) return null;
|
|
||||||
try {
|
|
||||||
final int lastSubtypeHash = Integer.parseInt(lastIme.second);
|
|
||||||
final int lastSubtypeId =
|
|
||||||
InputMethodUtils.getSubtypeIdFromHashCode(lastImi, lastSubtypeHash);
|
|
||||||
if (lastSubtypeId < 0 || lastSubtypeId >= lastImi.getSubtypeCount()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return lastImi.getSubtypeAt(lastSubtypeId);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
final Pair<String, String> lastIme = mSettings.getLastInputMethodAndSubtypeLocked();
|
||||||
|
// TODO: Handle the case of the last IME with no subtypes
|
||||||
|
if (lastIme == null || TextUtils.isEmpty(lastIme.first)
|
||||||
|
|| TextUtils.isEmpty(lastIme.second)) return null;
|
||||||
|
final InputMethodInfo lastImi = mMethodMap.get(lastIme.first);
|
||||||
|
if (lastImi == null) return null;
|
||||||
|
try {
|
||||||
|
final int lastSubtypeHash = Integer.parseInt(lastIme.second);
|
||||||
|
final int lastSubtypeId =
|
||||||
|
InputMethodUtils.getSubtypeIdFromHashCode(lastImi, lastSubtypeHash);
|
||||||
|
if (lastSubtypeId < 0 || lastSubtypeId >= lastImi.getSubtypeCount()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return lastImi.getSubtypeAt(lastSubtypeId);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes,
|
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
|
||||||
IVoidResultCallback resultCallback) {
|
// By this IPC call, only a process which shares the same uid with the IME can add
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
// additional input method subtypes to the IME.
|
||||||
// By this IPC call, only a process which shares the same uid with the IME can add
|
if (TextUtils.isEmpty(imiId) || subtypes == null) return;
|
||||||
// additional input method subtypes to the IME.
|
final ArrayList<InputMethodSubtype> toBeAdded = new ArrayList<>();
|
||||||
if (TextUtils.isEmpty(imiId) || subtypes == null) return;
|
for (InputMethodSubtype subtype : subtypes) {
|
||||||
final ArrayList<InputMethodSubtype> toBeAdded = new ArrayList<>();
|
if (!toBeAdded.contains(subtype)) {
|
||||||
for (InputMethodSubtype subtype : subtypes) {
|
toBeAdded.add(subtype);
|
||||||
if (!toBeAdded.contains(subtype)) {
|
} else {
|
||||||
toBeAdded.add(subtype);
|
Slog.w(TAG, "Duplicated subtype definition found: "
|
||||||
} else {
|
+ subtype.getLocale() + ", " + subtype.getMode());
|
||||||
Slog.w(TAG, "Duplicated subtype definition found: "
|
|
||||||
+ subtype.getLocale() + ", " + subtype.getMode());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
synchronized (mMethodMap) {
|
}
|
||||||
if (!calledFromValidUserLocked()) {
|
synchronized (mMethodMap) {
|
||||||
return;
|
if (!calledFromValidUserLocked()) {
|
||||||
}
|
return;
|
||||||
if (!mSystemReady) {
|
}
|
||||||
return;
|
if (!mSystemReady) {
|
||||||
}
|
return;
|
||||||
final InputMethodInfo imi = mMethodMap.get(imiId);
|
}
|
||||||
if (imi == null) return;
|
final InputMethodInfo imi = mMethodMap.get(imiId);
|
||||||
final String[] packageInfos;
|
if (imi == null) return;
|
||||||
try {
|
final String[] packageInfos;
|
||||||
packageInfos = mIPackageManager.getPackagesForUid(Binder.getCallingUid());
|
try {
|
||||||
} catch (RemoteException e) {
|
packageInfos = mIPackageManager.getPackagesForUid(Binder.getCallingUid());
|
||||||
Slog.e(TAG, "Failed to get package infos");
|
} catch (RemoteException e) {
|
||||||
return;
|
Slog.e(TAG, "Failed to get package infos");
|
||||||
}
|
return;
|
||||||
if (packageInfos != null) {
|
}
|
||||||
final int packageNum = packageInfos.length;
|
if (packageInfos != null) {
|
||||||
for (int i = 0; i < packageNum; ++i) {
|
final int packageNum = packageInfos.length;
|
||||||
if (packageInfos[i].equals(imi.getPackageName())) {
|
for (int i = 0; i < packageNum; ++i) {
|
||||||
if (subtypes.length > 0) {
|
if (packageInfos[i].equals(imi.getPackageName())) {
|
||||||
mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
|
if (subtypes.length > 0) {
|
||||||
} else {
|
mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
|
||||||
mAdditionalSubtypeMap.remove(imi.getId());
|
} else {
|
||||||
}
|
mAdditionalSubtypeMap.remove(imi.getId());
|
||||||
AdditionalSubtypeUtils.save(mAdditionalSubtypeMap, mMethodMap,
|
|
||||||
mSettings.getCurrentUserId());
|
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
buildInputMethodListLocked(false /* resetDefaultEnabledIme */);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
AdditionalSubtypeUtils.save(mAdditionalSubtypeMap, mMethodMap,
|
||||||
|
mSettings.getCurrentUserId());
|
||||||
|
final long ident = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
buildInputMethodListLocked(false /* resetDefaultEnabledIme */);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3963,19 +3902,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
* @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight(int)}
|
* @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight(int)}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback) {
|
public int getInputMethodWindowVisibleHeight() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
// TODO(yukawa): Should we verify the display ID?
|
||||||
// TODO(yukawa): Should we verify the display ID?
|
return mWindowManagerInternal.getInputMethodWindowVisibleHeight(mCurTokenDisplayId);
|
||||||
return mWindowManagerInternal.getInputMethodWindowVisibleHeight(mCurTokenDisplayId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeImeSurface(IVoidResultCallback resultCallback) {
|
public void removeImeSurface() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
mContext.enforceCallingPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW, null);
|
||||||
mContext.enforceCallingPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW, null);
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE));
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -3992,100 +3927,93 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
*/
|
*/
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void startProtoDump(byte[] protoDump, int source, String where,
|
public void startProtoDump(byte[] protoDump, int source, String where) {
|
||||||
IVoidResultCallback resultCallback) {
|
if (protoDump == null && source != IME_TRACING_FROM_IMMS) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
// Dump not triggered from IMMS, but no proto information provided.
|
||||||
if (protoDump == null && source != IME_TRACING_FROM_IMMS) {
|
return;
|
||||||
// Dump not triggered from IMMS, but no proto information provided.
|
}
|
||||||
return;
|
ImeTracing tracingInstance = ImeTracing.getInstance();
|
||||||
}
|
if (!tracingInstance.isAvailable() || !tracingInstance.isEnabled()) {
|
||||||
ImeTracing tracingInstance = ImeTracing.getInstance();
|
return;
|
||||||
if (!tracingInstance.isAvailable() || !tracingInstance.isEnabled()) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtoOutputStream proto = new ProtoOutputStream();
|
ProtoOutputStream proto = new ProtoOutputStream();
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case ImeTracing.IME_TRACING_FROM_CLIENT:
|
case ImeTracing.IME_TRACING_FROM_CLIENT:
|
||||||
final long client_token = proto.start(InputMethodClientsTraceFileProto.ENTRY);
|
final long client_token = proto.start(InputMethodClientsTraceFileProto.ENTRY);
|
||||||
proto.write(InputMethodClientsTraceProto.ELAPSED_REALTIME_NANOS,
|
proto.write(InputMethodClientsTraceProto.ELAPSED_REALTIME_NANOS,
|
||||||
SystemClock.elapsedRealtimeNanos());
|
SystemClock.elapsedRealtimeNanos());
|
||||||
proto.write(InputMethodClientsTraceProto.WHERE, where);
|
proto.write(InputMethodClientsTraceProto.WHERE, where);
|
||||||
proto.write(InputMethodClientsTraceProto.CLIENT, protoDump);
|
proto.write(InputMethodClientsTraceProto.CLIENT, protoDump);
|
||||||
proto.end(client_token);
|
proto.end(client_token);
|
||||||
break;
|
break;
|
||||||
case ImeTracing.IME_TRACING_FROM_IMS:
|
case ImeTracing.IME_TRACING_FROM_IMS:
|
||||||
final long service_token = proto.start(InputMethodServiceTraceFileProto.ENTRY);
|
final long service_token = proto.start(InputMethodServiceTraceFileProto.ENTRY);
|
||||||
proto.write(InputMethodServiceTraceProto.ELAPSED_REALTIME_NANOS,
|
proto.write(InputMethodServiceTraceProto.ELAPSED_REALTIME_NANOS,
|
||||||
SystemClock.elapsedRealtimeNanos());
|
SystemClock.elapsedRealtimeNanos());
|
||||||
proto.write(InputMethodServiceTraceProto.WHERE, where);
|
proto.write(InputMethodServiceTraceProto.WHERE, where);
|
||||||
proto.write(InputMethodServiceTraceProto.INPUT_METHOD_SERVICE, protoDump);
|
proto.write(InputMethodServiceTraceProto.INPUT_METHOD_SERVICE, protoDump);
|
||||||
proto.end(service_token);
|
proto.end(service_token);
|
||||||
break;
|
break;
|
||||||
case IME_TRACING_FROM_IMMS:
|
case IME_TRACING_FROM_IMMS:
|
||||||
final long managerservice_token =
|
final long managerservice_token =
|
||||||
proto.start(InputMethodManagerServiceTraceFileProto.ENTRY);
|
proto.start(InputMethodManagerServiceTraceFileProto.ENTRY);
|
||||||
proto.write(InputMethodManagerServiceTraceProto.ELAPSED_REALTIME_NANOS,
|
proto.write(InputMethodManagerServiceTraceProto.ELAPSED_REALTIME_NANOS,
|
||||||
SystemClock.elapsedRealtimeNanos());
|
SystemClock.elapsedRealtimeNanos());
|
||||||
proto.write(InputMethodManagerServiceTraceProto.WHERE, where);
|
proto.write(InputMethodManagerServiceTraceProto.WHERE, where);
|
||||||
dumpDebug(proto,
|
dumpDebug(proto,
|
||||||
InputMethodManagerServiceTraceProto.INPUT_METHOD_MANAGER_SERVICE);
|
InputMethodManagerServiceTraceProto.INPUT_METHOD_MANAGER_SERVICE);
|
||||||
proto.end(managerservice_token);
|
proto.end(managerservice_token);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Dump triggered by a source not recognised.
|
// Dump triggered by a source not recognised.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tracingInstance.addToBuffer(proto, source);
|
tracingInstance.addToBuffer(proto, source);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void isImeTraceEnabled(IBooleanResultCallback resultCallback) {
|
public boolean isImeTraceEnabled() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> ImeTracing.getInstance().isEnabled());
|
return ImeTracing.getInstance().isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void startImeTrace(IVoidResultCallback resultCallback) {
|
public void startImeTrace() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
ImeTracing.getInstance().startTrace(null /* printwriter */);
|
||||||
ImeTracing.getInstance().startTrace(null /* printwriter */);
|
ArrayMap<IBinder, ClientState> clients;
|
||||||
ArrayMap<IBinder, ClientState> clients;
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
clients = new ArrayMap<>(mClients);
|
||||||
clients = new ArrayMap<>(mClients);
|
}
|
||||||
}
|
for (ClientState state : clients.values()) {
|
||||||
for (ClientState state : clients.values()) {
|
if (state != null) {
|
||||||
if (state != null) {
|
try {
|
||||||
try {
|
state.client.setImeTraceEnabled(true /* enabled */);
|
||||||
state.client.setImeTraceEnabled(true /* enabled */);
|
} catch (RemoteException e) {
|
||||||
} catch (RemoteException e) {
|
Slog.e(TAG, "Error while trying to enable ime trace on client window", e);
|
||||||
Slog.e(TAG, "Error while trying to enable ime trace on client window", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void stopImeTrace(IVoidResultCallback resultCallback) {
|
public void stopImeTrace() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
ImeTracing.getInstance().stopTrace(null /* printwriter */);
|
||||||
ImeTracing.getInstance().stopTrace(null /* printwriter */);
|
ArrayMap<IBinder, ClientState> clients;
|
||||||
ArrayMap<IBinder, ClientState> clients;
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
clients = new ArrayMap<>(mClients);
|
||||||
clients = new ArrayMap<>(mClients);
|
}
|
||||||
}
|
for (ClientState state : clients.values()) {
|
||||||
for (ClientState state : clients.values()) {
|
if (state != null) {
|
||||||
if (state != null) {
|
try {
|
||||||
try {
|
state.client.setImeTraceEnabled(false /* enabled */);
|
||||||
state.client.setImeTraceEnabled(false /* enabled */);
|
} catch (RemoteException e) {
|
||||||
} catch (RemoteException e) {
|
Slog.e(TAG, "Error while trying to disable ime trace on client window", e);
|
||||||
Slog.e(TAG, "Error while trying to disable ime trace on client window", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dumpDebug(ProtoOutputStream proto, long fieldId) {
|
private void dumpDebug(ProtoOutputStream proto, long fieldId) {
|
||||||
@@ -4888,20 +4816,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current subtype of this input method.
|
* Gets the current subtype of this input method.
|
||||||
*
|
|
||||||
* @param resultCallback to callback the result.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getCurrentInputMethodSubtype(IInputMethodSubtypeResultCallback resultCallback) {
|
public InputMethodSubtype getCurrentInputMethodSubtype() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
synchronized (mMethodMap) {
|
||||||
synchronized (mMethodMap) {
|
// TODO: Make this work even for non-current users?
|
||||||
// TODO: Make this work even for non-current users?
|
if (!calledFromValidUserLocked()) {
|
||||||
if (!calledFromValidUserLocked()) {
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getCurrentInputMethodSubtypeLocked();
|
|
||||||
}
|
}
|
||||||
});
|
return getCurrentInputMethodSubtypeLocked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InputMethodSubtype getCurrentInputMethodSubtypeLocked() {
|
InputMethodSubtype getCurrentInputMethodSubtypeLocked() {
|
||||||
|
|||||||
@@ -72,17 +72,9 @@ import android.view.inputmethod.InputMethodSubtype;
|
|||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.inputmethod.CallbackUtils;
|
|
||||||
import com.android.internal.inputmethod.IBooleanResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputBindResultResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputMethodInfoListResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputMethodSubtypeListResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IInputMethodSubtypeResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IIntResultCallback;
|
|
||||||
import com.android.internal.inputmethod.IMultiClientInputMethod;
|
import com.android.internal.inputmethod.IMultiClientInputMethod;
|
||||||
import com.android.internal.inputmethod.IMultiClientInputMethodPrivilegedOperations;
|
import com.android.internal.inputmethod.IMultiClientInputMethodPrivilegedOperations;
|
||||||
import com.android.internal.inputmethod.IMultiClientInputMethodSession;
|
import com.android.internal.inputmethod.IMultiClientInputMethodSession;
|
||||||
import com.android.internal.inputmethod.IVoidResultCallback;
|
|
||||||
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
import com.android.internal.inputmethod.SoftInputShowHideReason;
|
||||||
import com.android.internal.inputmethod.StartInputFlags;
|
import com.android.internal.inputmethod.StartInputFlags;
|
||||||
import com.android.internal.inputmethod.StartInputReason;
|
import com.android.internal.inputmethod.StartInputReason;
|
||||||
@@ -112,7 +104,6 @@ import java.lang.annotation.Retention;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actual implementation of multi-client InputMethodManagerService.
|
* Actual implementation of multi-client InputMethodManagerService.
|
||||||
@@ -1467,49 +1458,41 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getInputMethodList(@UserIdInt int userId,
|
public List<InputMethodInfo> getInputMethodList(@UserIdInt int userId) {
|
||||||
IInputMethodInfoListResultCallback resultCallback) {
|
if (UserHandle.getCallingUserId() != userId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
mContext.enforceCallingPermission(INTERACT_ACROSS_USERS_FULL, null);
|
||||||
if (UserHandle.getCallingUserId() != userId) {
|
}
|
||||||
mContext.enforceCallingPermission(INTERACT_ACROSS_USERS_FULL, null);
|
return mInputMethodInfoMap.getAsList(userId);
|
||||||
}
|
|
||||||
return mInputMethodInfoMap.getAsList(userId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getEnabledInputMethodList(@UserIdInt int userId,
|
public List<InputMethodInfo> getEnabledInputMethodList(@UserIdInt int userId) {
|
||||||
IInputMethodInfoListResultCallback resultCallback) {
|
if (UserHandle.getCallingUserId() != userId) {
|
||||||
CallbackUtils.onResult(resultCallback, () -> {
|
mContext.enforceCallingPermission(INTERACT_ACROSS_USERS_FULL, null);
|
||||||
if (UserHandle.getCallingUserId() != userId) {
|
}
|
||||||
mContext.enforceCallingPermission(INTERACT_ACROSS_USERS_FULL, null);
|
return mInputMethodInfoMap.getAsList(userId);
|
||||||
}
|
|
||||||
return mInputMethodInfoMap.getAsList(userId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getEnabledInputMethodSubtypeList(String imiId,
|
public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
|
||||||
boolean allowsImplicitlySelectedSubtypes,
|
boolean allowsImplicitlySelectedSubtypes) {
|
||||||
IInputMethodSubtypeListResultCallback resultCallback) {
|
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, Collections::emptyList);
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getLastInputMethodSubtype(IInputMethodSubtypeResultCallback resultCallback) {
|
public InputMethodSubtype getLastInputMethodSubtype() {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> null);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void removeImeSurface(IVoidResultCallback resultCallback) {
|
public void removeImeSurface() {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -1520,11 +1503,10 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void showSoftInput(
|
public boolean showSoftInput(
|
||||||
IInputMethodClient client, IBinder token, int flags, ResultReceiver resultReceiver,
|
IInputMethodClient client, IBinder token, int flags, ResultReceiver resultReceiver,
|
||||||
@SoftInputShowHideReason int reason, IBooleanResultCallback resultCallback) {
|
@SoftInputShowHideReason int reason) {
|
||||||
CallbackUtils.onResult(resultCallback,
|
return showSoftInputInternal(client, token, flags, resultReceiver);
|
||||||
() -> showSoftInputInternal(client, token, flags, resultReceiver));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -1575,13 +1557,10 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void hideSoftInput(
|
public boolean hideSoftInput(
|
||||||
IInputMethodClient client, IBinder windowToken, int flags,
|
IInputMethodClient client, IBinder windowToken, int flags,
|
||||||
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason,
|
ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
|
||||||
IBooleanResultCallback resultCallback) {
|
return hideSoftInputInternal(client, windowToken, flags, resultReceiver);
|
||||||
CallbackUtils.onResult(resultCallback,
|
|
||||||
() -> hideSoftInputInternal(client, windowToken, flags, resultReceiver));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -1628,34 +1607,7 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void reportWindowGainedFocusAsync(
|
public InputBindResult startInputOrWindowGainedFocus(
|
||||||
boolean nextFocusHasConnection,
|
|
||||||
@Nullable IInputMethodClient client,
|
|
||||||
@Nullable IBinder windowToken,
|
|
||||||
@StartInputFlags int startInputFlags,
|
|
||||||
@SoftInputModeFlags int softInputMode,
|
|
||||||
int windowFlags,
|
|
||||||
int unverifiedTargetSdkVersion) {
|
|
||||||
final int startInputReason = nextFocusHasConnection
|
|
||||||
? StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITH_CONNECTION
|
|
||||||
: StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITHOUT_CONNECTION;
|
|
||||||
try {
|
|
||||||
startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
|
||||||
startInputFlags, softInputMode, windowFlags, null /* editorInfo */,
|
|
||||||
null /* inputContext */, 0 /* missingMethods */,
|
|
||||||
unverifiedTargetSdkVersion);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
if (client != null) {
|
|
||||||
try {
|
|
||||||
client.throwExceptionFromSystem(t.getMessage());
|
|
||||||
} catch (RemoteException ignore) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@BinderThread
|
|
||||||
@Override
|
|
||||||
public void startInputOrWindowGainedFocus(
|
|
||||||
@StartInputReason int startInputReason,
|
@StartInputReason int startInputReason,
|
||||||
@Nullable IInputMethodClient client,
|
@Nullable IInputMethodClient client,
|
||||||
@Nullable IBinder windowToken,
|
@Nullable IBinder windowToken,
|
||||||
@@ -1665,12 +1617,10 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
@Nullable EditorInfo editorInfo,
|
@Nullable EditorInfo editorInfo,
|
||||||
@Nullable IInputContext inputContext,
|
@Nullable IInputContext inputContext,
|
||||||
@MissingMethodFlags int missingMethods,
|
@MissingMethodFlags int missingMethods,
|
||||||
int unverifiedTargetSdkVersion,
|
int unverifiedTargetSdkVersion) {
|
||||||
IInputBindResultResultCallback resultCallback) {
|
return startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
||||||
CallbackUtils.onResult(resultCallback, (Supplier<InputBindResult>) () ->
|
|
||||||
startInputOrWindowGainedFocusInternal(startInputReason, client, windowToken,
|
|
||||||
startInputFlags, softInputMode, windowFlags, editorInfo, inputContext,
|
startInputFlags, softInputMode, windowFlags, editorInfo, inputContext,
|
||||||
missingMethods, unverifiedTargetSdkVersion));
|
missingMethods, unverifiedTargetSdkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -1812,54 +1762,49 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodPickerFromClient(IInputMethodClient client,
|
public void showInputMethodPickerFromClient(IInputMethodClient client,
|
||||||
int auxiliarySubtypeMode, IVoidResultCallback resultCallback) {
|
int auxiliarySubtypeMode) {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodPickerFromSystem(IInputMethodClient client,
|
public void showInputMethodPickerFromSystem(IInputMethodClient client,
|
||||||
int auxiliarySubtypeMode, int displayId, IVoidResultCallback resultCallback) {
|
int auxiliarySubtypeMode, int displayId) {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void showInputMethodAndSubtypeEnablerFromClient(IInputMethodClient client,
|
public void showInputMethodAndSubtypeEnablerFromClient(IInputMethodClient client,
|
||||||
String inputMethodId, IVoidResultCallback resultCallback) {
|
String inputMethodId) {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void isInputMethodPickerShownForTest(IBooleanResultCallback resultCallback) {
|
public boolean isInputMethodPickerShownForTest() {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getCurrentInputMethodSubtype(IInputMethodSubtypeResultCallback resultCallback) {
|
public InputMethodSubtype getCurrentInputMethodSubtype() {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> null);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes,
|
public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
|
||||||
IVoidResultCallback resultCallback) {
|
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void getInputMethodWindowVisibleHeight(IIntResultCallback resultCallback) {
|
public int getInputMethodWindowVisibleHeight() {
|
||||||
reportNotSupported();
|
reportNotSupported();
|
||||||
CallbackUtils.onResult(resultCallback, () -> 0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@@ -1891,27 +1836,23 @@ public final class MultiClientInputMethodManagerService {
|
|||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void startProtoDump(byte[] clientProtoDump, int source, String where,
|
public void startProtoDump(byte[] clientProtoDump, int source, String where) {
|
||||||
IVoidResultCallback resultCallback) {
|
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void isImeTraceEnabled(IBooleanResultCallback resultCallback) {
|
public boolean isImeTraceEnabled() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void startImeTrace(IVoidResultCallback resultCallback) {
|
public void startImeTrace() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void stopImeTrace(IVoidResultCallback resultCallback) {
|
public void stopImeTrace() {
|
||||||
CallbackUtils.onResult(resultCallback, () -> { });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user