summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff DeCew <jeffdq@google.com> 2020-12-03 19:13:34 +0000
committer Jeff DeCew <jeffdq@google.com> 2020-12-03 19:13:34 +0000
commit3d62f739a869c97a265506ac1e1ab58f93fa3b34 (patch)
tree5328dfb42fba86965fb9fe782eac4089cb9f3406
parent152eacec4f5e1c78eafd42abbcf62fc12b0eee33 (diff)
Revert "Let IME#onFinishInput called without dup onStartInput wh..."
Revert "Verify lifecycle test when screen on/off" Revert submission 12716106-ims_screenstate_lifecycle Reason for revert: b/174512702 Reverted Changes: Iba0332ed3:Verify lifecycle test when screen on/off I8a657e75e:Let IME#onFinishInput called without dup onStartIn... Change-Id: I16f4a34360a2f64b69978724648a9be741f140b5
-rw-r--r--core/api/test-current.txt8
-rw-r--r--core/java/android/inputmethodservice/IInputMethodSessionWrapper.java10
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java29
-rw-r--r--core/java/android/inputmethodservice/MultiClientInputMethodClientCallbackAdaptor.java9
-rw-r--r--core/java/android/view/ImeFocusController.java20
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java37
-rw-r--r--core/java/com/android/internal/view/IInputMethodClient.aidl2
-rw-r--r--core/java/com/android/internal/view/IInputMethodSession.aidl2
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java43
-rw-r--r--services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java4
10 files changed, 18 insertions, 146 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 52d61420b631..52a79bae6324 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -832,14 +832,6 @@ package android.hardware.soundtrigger {
}
-package android.inputmethodservice {
-
- public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService {
- field public static final long FINISH_INPUT_NO_FALLBACK_CONNECTION = 156215187L; // 0x94fa793L
- }
-
-}
-
package android.location {
public final class GnssClock implements android.os.Parcelable {
diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
index 0766917642e8..e9de27456f97 100644
--- a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
@@ -54,8 +54,6 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
private static final int DO_VIEW_CLICKED = 115;
private static final int DO_NOTIFY_IME_HIDDEN = 120;
private static final int DO_REMOVE_IME_SURFACE = 130;
- private static final int DO_FINISH_INPUT = 140;
-
@UnsupportedAppUsage
HandlerCaller mCaller;
@@ -143,10 +141,6 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
mInputMethodSession.removeImeSurface();
return;
}
- case DO_FINISH_INPUT: {
- mInputMethodSession.finishInput();
- return;
- }
}
Log.w(TAG, "Unhandled message code: " + msg.what);
}
@@ -228,10 +222,6 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_SESSION));
}
- @Override
- public void finishInput() {
- mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_INPUT));
- }
private final class ImeInputEventReceiver extends InputEventReceiver
implements InputMethodSession.EventCallback {
private final SparseArray<InputEvent> mPendingEvents = new SparseArray<InputEvent>();
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 4a5d831cd705..ae260e16806f 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -61,12 +61,9 @@ import android.annotation.IntDef;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.annotation.TestApi;
import android.annotation.UiContext;
import android.app.ActivityManager;
import android.app.Dialog;
-import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -414,29 +411,7 @@ public class InputMethodService extends AbstractInputMethodService {
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
int mTheme = 0;
-
- /**
- * Finish the {@link InputConnection} when the device becomes
- * {@link android.os.PowerManager#isInteractive non-interactive}.
- *
- * <p>
- * If enabled by the current {@link InputMethodService input method}, the current input
- * connection will be {@link InputMethodService#onFinishInput finished} whenever the devices
- * becomes non-interactive.
- *
- * <p>
- * If not enabled, the current input connection will instead be silently deactivated when the
- * devices becomes non-interactive, and an {@link InputMethodService#onFinishInput
- * onFinishInput()} {@link InputMethodService#onStartInput onStartInput()} pair is dispatched
- * when the device becomes interactive again.
- *
- * @hide
- */
- @TestApi
- @ChangeId
- @EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
- public static final long FINISH_INPUT_NO_FALLBACK_CONNECTION = 156215187L; // This is a bug id.
-
+
LayoutInflater mInflater;
TypedArray mThemeAttrs;
@UnsupportedAppUsage
@@ -2350,7 +2325,7 @@ public class InputMethodService extends AbstractInputMethodService {
}
void doStartInput(InputConnection ic, EditorInfo attribute, boolean restarting) {
- if (!restarting && mInputStarted) {
+ if (!restarting) {
doFinishInput();
}
ImeTracing.getInstance().triggerServiceDump("InputMethodService#doStartInput", this);
diff --git a/core/java/android/inputmethodservice/MultiClientInputMethodClientCallbackAdaptor.java b/core/java/android/inputmethodservice/MultiClientInputMethodClientCallbackAdaptor.java
index 2db9ed1103fa..dbb669be1402 100644
--- a/core/java/android/inputmethodservice/MultiClientInputMethodClientCallbackAdaptor.java
+++ b/core/java/android/inputmethodservice/MultiClientInputMethodClientCallbackAdaptor.java
@@ -23,7 +23,6 @@ import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
-import android.os.RemoteException;
import android.os.ResultReceiver;
import android.util.Log;
import android.view.InputChannel;
@@ -39,8 +38,8 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.inputmethod.CancellationGroup;
import com.android.internal.inputmethod.IMultiClientInputMethodSession;
+import com.android.internal.inputmethod.CancellationGroup;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.internal.view.IInputContext;
@@ -304,12 +303,6 @@ final class MultiClientInputMethodClientCallbackAdaptor {
// no-op for multi-session
reportNotSupported();
}
-
- @Override
- public void finishInput() throws RemoteException {
- // no-op for multi-session
- reportNotSupported();
- }
}
private static final class MultiClientInputMethodSessionImpl
diff --git a/core/java/android/view/ImeFocusController.java b/core/java/android/view/ImeFocusController.java
index 4a5c95f43d46..efc0bd2785f4 100644
--- a/core/java/android/view/ImeFocusController.java
+++ b/core/java/android/view/ImeFocusController.java
@@ -222,25 +222,6 @@ public final class ImeFocusController {
}
/**
- * To handle the lifecycle of the input connection when the device interactivity state changed.
- * (i.e. Calling IMS#onFinishInput when the device screen-off and Calling IMS#onStartInput
- * when the device screen-on again).
- */
- @UiThread
- public void onInteractiveChanged(boolean interactive) {
- final InputMethodManagerDelegate immDelegate = getImmDelegate();
- if (!immDelegate.isCurrentRootView(mViewRootImpl)) {
- return;
- }
- if (interactive) {
- final View focusedView = mViewRootImpl.mView.findFocus();
- onViewFocusChanged(focusedView, focusedView != null);
- } else {
- mDelegate.finishInputAndReportToIme();
- }
- }
-
- /**
* @param windowAttribute {@link WindowManager.LayoutParams} to be checked.
* @return Whether the window is in local focus mode or not.
*/
@@ -275,7 +256,6 @@ public final class ImeFocusController {
@WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags,
boolean forceNewFocus);
void finishInput();
- void finishInputAndReportToIme();
void closeCurrentIme();
void finishComposingText();
void setCurrentRootView(ViewRootImpl rootView);
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 315d4461692c..3c89a4bfad59 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -599,27 +599,6 @@ public final class InputMethodManager {
}
/**
- * Used by {@link ImeFocusController} to finish input connection and callback
- * {@link InputMethodService#onFinishInput()}.
- *
- * This method is especially for when ImeFocusController received device screen-off event to
- * ensure the entire finish input connection and the connection lifecycle callback to
- * IME can be done for security concern.
- */
- @Override
- public void finishInputAndReportToIme() {
- synchronized (mH) {
- finishInputLocked();
- if (mCurMethod != null) {
- try {
- mCurMethod.finishInput();
- } catch (RemoteException e) {
- }
- }
- }
- }
-
- /**
* Used by {@link ImeFocusController} to hide current input method editor.
*/
@Override
@@ -870,23 +849,12 @@ public final class InputMethodManager {
case MSG_SET_ACTIVE: {
final boolean active = msg.arg1 != 0;
final boolean fullscreen = msg.arg2 != 0;
- final boolean reportToImeController = msg.obj != null && (boolean) msg.obj;
if (DEBUG) {
Log.i(TAG, "handleMessage: MSG_SET_ACTIVE " + active + ", was " + mActive);
}
synchronized (mH) {
mActive = active;
mFullscreenMode = fullscreen;
-
- // Report active state to ImeFocusController to handle IME input
- // connection lifecycle callback when it allowed.
- final ImeFocusController controller = getFocusController();
- final View rootView = mCurRootView != null ? mCurRootView.getView() : null;
- if (controller != null && rootView != null && reportToImeController) {
- rootView.post(() -> controller.onInteractiveChanged(active));
- return;
- }
-
if (!active) {
// Some other client has starting using the IME, so note
// that this happened and make sure our own editor's
@@ -1093,9 +1061,8 @@ public final class InputMethodManager {
}
@Override
- public void setActive(boolean active, boolean fullscreen, boolean reportToImeController) {
- mH.obtainMessage(MSG_SET_ACTIVE, active ? 1 : 0, fullscreen ? 1 : 0,
- reportToImeController).sendToTarget();
+ public void setActive(boolean active, boolean fullscreen) {
+ mH.obtainMessage(MSG_SET_ACTIVE, active ? 1 : 0, fullscreen ? 1 : 0).sendToTarget();
}
@Override
diff --git a/core/java/com/android/internal/view/IInputMethodClient.aidl b/core/java/com/android/internal/view/IInputMethodClient.aidl
index ec9a0a2f4801..1145f5183206 100644
--- a/core/java/com/android/internal/view/IInputMethodClient.aidl
+++ b/core/java/com/android/internal/view/IInputMethodClient.aidl
@@ -25,7 +25,7 @@ import com.android.internal.view.InputBindResult;
oneway interface IInputMethodClient {
void onBindMethod(in InputBindResult res);
void onUnbindMethod(int sequence, int unbindReason);
- void setActive(boolean active, boolean fullscreen, boolean reportToImeController);
+ void setActive(boolean active, boolean fullscreen);
void scheduleStartInputIfNecessary(boolean fullscreen);
void reportFullscreenMode(boolean fullscreen);
void applyImeVisibility(boolean setVisible);
diff --git a/core/java/com/android/internal/view/IInputMethodSession.aidl b/core/java/com/android/internal/view/IInputMethodSession.aidl
index c6afd78ec04b..0319e3637384 100644
--- a/core/java/com/android/internal/view/IInputMethodSession.aidl
+++ b/core/java/com/android/internal/view/IInputMethodSession.aidl
@@ -52,6 +52,4 @@ oneway interface IInputMethodSession {
void notifyImeHidden();
void removeImeSurface();
-
- void finishInput();
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 4331198daacf..cfb5116c47f3 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -15,7 +15,6 @@
package com.android.server.inputmethod;
-import static android.inputmethodservice.InputMethodService.FINISH_INPUT_NO_FALLBACK_CONNECTION;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
import static android.os.IServiceManager.DUMP_FLAG_PROTO;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
@@ -153,7 +152,6 @@ import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.compat.IPlatformCompat;
import com.android.internal.content.PackageMonitor;
import com.android.internal.inputmethod.IInputContentUriToken;
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
@@ -711,8 +709,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
*/
boolean mIsInteractive = true;
- private IPlatformCompat mPlatformCompat;
-
int mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT;
/**
@@ -1674,8 +1670,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mUserManagerInternal = LocalServices.getService(UserManagerInternal.class);
mHasFeature = context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_INPUT_METHODS);
- mPlatformCompat = IPlatformCompat.Stub.asInterface(
- ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
mSlotIme = mContext.getString(com.android.internal.R.string.status_bar_ime);
mIsLowRam = ActivityManager.isLowRamDeviceStatic();
@@ -2312,8 +2306,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
- scheduleSetActiveToClient(mCurClient, false /* active */, false /* fullscreen */,
- false /* reportToImeController */);
+ executeOrSendMessage(mCurClient.client, mCaller.obtainMessageIIO(
+ MSG_SET_ACTIVE, 0, 0, mCurClient));
executeOrSendMessage(mCurClient.client, mCaller.obtainMessageIIO(
MSG_UNBIND_CLIENT, mCurSeq, unbindClientReason, mCurClient.client));
mCurClient.sessionRequested = false;
@@ -2455,8 +2449,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// If the screen is on, inform the new client it is active
if (mIsInteractive) {
- scheduleSetActiveToClient(cs, true /* active */, false /* fullscreen */,
- false /* reportToImeController */);
+ executeOrSendMessage(cs.client, mCaller.obtainMessageIO(MSG_SET_ACTIVE, 1, cs));
}
}
@@ -4459,20 +4452,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
args.recycle();
return true;
}
- case MSG_SET_ACTIVE: {
- args = (SomeArgs) msg.obj;
- final ClientState clientState = (ClientState) args.arg1;
+ case MSG_SET_ACTIVE:
try {
- clientState.client.setActive(args.argi1 != 0 /* active */,
- args.argi2 != 0 /* fullScreen */,
- args.argi3 != 0 /* reportToImeController */);
+ ((ClientState)msg.obj).client.setActive(msg.arg1 != 0, msg.arg2 != 0);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid "
- + clientState.pid + " uid " + clientState.uid);
+ + ((ClientState)msg.obj).pid + " uid "
+ + ((ClientState)msg.obj).uid);
}
- args.recycle();
return true;
- }
case MSG_SET_INTERACTIVE:
handleSetInteractive(msg.arg1 != 0);
return true;
@@ -4558,24 +4546,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// Inform the current client of the change in active status
if (mCurClient != null && mCurClient.client != null) {
- boolean reportToImeController = false;
- try {
- reportToImeController = mPlatformCompat.isChangeEnabledByUid(
- FINISH_INPUT_NO_FALLBACK_CONNECTION, mCurMethodUid);
- } catch (RemoteException e) {
- }
- scheduleSetActiveToClient(mCurClient, mIsInteractive, mInFullscreenMode,
- reportToImeController);
+ executeOrSendMessage(mCurClient.client, mCaller.obtainMessageIIO(
+ MSG_SET_ACTIVE, mIsInteractive ? 1 : 0, mInFullscreenMode ? 1 : 0,
+ mCurClient));
}
}
}
- private void scheduleSetActiveToClient(ClientState state, boolean active, boolean fullscreen,
- boolean reportToImeController) {
- executeOrSendMessage(state.client, mCaller.obtainMessageIIIIO(MSG_SET_ACTIVE,
- active ? 1 : 0, fullscreen ? 1 : 0, reportToImeController ? 1 : 0, 0, state));
- }
-
private boolean chooseNewDefaultIMELocked() {
final InputMethodInfo imi = InputMethodUtils.getMostApplicableDefaultIME(
mSettings.getEnabledInputMethodListLocked());
diff --git a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
index a3fb13593209..7af27ca46f68 100644
--- a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
@@ -1338,7 +1338,7 @@ public final class MultiClientInputMethodManagerService {
switch (clientInfo.mState) {
case InputMethodClientState.WAITING_FOR_IME_SESSION:
try {
- clientInfo.mClient.setActive(true, false, false);
+ clientInfo.mClient.setActive(true, false);
} catch (RemoteException e) {
// TODO(yukawa): Remove this client.
return;
@@ -1400,7 +1400,7 @@ public final class MultiClientInputMethodManagerService {
return;
}
try {
- clientInfo.mClient.setActive(active, false /* fullscreen */, false);
+ clientInfo.mClient.setActive(active, false /* fullscreen */);
} catch (RemoteException e) {
return;
}