Merge "Ignore unchecked IME show/hide when no root" into rvc-dev am: d74346b8cf am: c75c845e1b

Change-Id: I33b9667b8180f714b140309613128a8f2bda606f
This commit is contained in:
Automerger Merge Worker
2020-03-04 02:05:13 +00:00

View File

@@ -1634,14 +1634,20 @@ public final class InputMethodManager {
@Deprecated @Deprecated
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499)
public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) { public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) {
try { synchronized (mH) {
Log.w(TAG, "showSoftInputUnchecked() is a hidden method, which will be removed " try {
+ "soon. If you are using android.support.v7.widget.SearchView, please update " Log.w(TAG, "showSoftInputUnchecked() is a hidden method, which will be"
+ "to version 26.0 or newer version."); + " removed soon. If you are using android.support.v7.widget.SearchView,"
mService.showSoftInput( + " please update to version 26.0 or newer version.");
mClient, mCurRootView.getView().getWindowToken(), flags, resultReceiver); if (mCurRootView == null || mCurRootView.getView() == null) {
} catch (RemoteException e) { Log.w(TAG, "No current root view, ignoring showSoftInputUnchecked()");
throw e.rethrowFromSystemServer(); return;
}
mService.showSoftInput(
mClient, mCurRootView.getView().getWindowToken(), flags, resultReceiver);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} }
} }
@@ -1986,11 +1992,17 @@ public final class InputMethodManager {
@UnsupportedAppUsage @UnsupportedAppUsage
void closeCurrentInput() { void closeCurrentInput() {
try { synchronized (mH) {
mService.hideSoftInput( if (mCurRootView == null || mCurRootView.getView() == null) {
mClient, mCurRootView.getView().getWindowToken(), HIDE_NOT_ALWAYS, null); Log.w(TAG, "No current root view, ignoring closeCurrentInput()");
} catch (RemoteException e) { return;
throw e.rethrowFromSystemServer(); }
try {
mService.hideSoftInput(
mClient, mCurRootView.getView().getWindowToken(), HIDE_NOT_ALWAYS, null);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} }
} }