Merge "Input method manager method to check for active connection" into udc-qpr-dev
This commit is contained in:
@@ -116,6 +116,7 @@ import com.android.server.DisplayThread;
|
|||||||
import com.android.server.LocalServices;
|
import com.android.server.LocalServices;
|
||||||
import com.android.server.Watchdog;
|
import com.android.server.Watchdog;
|
||||||
import com.android.server.input.InputManagerInternal.LidSwitchCallback;
|
import com.android.server.input.InputManagerInternal.LidSwitchCallback;
|
||||||
|
import com.android.server.inputmethod.InputMethodManagerInternal;
|
||||||
import com.android.server.policy.WindowManagerPolicy;
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
@@ -165,6 +166,8 @@ public class InputManagerService extends IInputManager.Stub
|
|||||||
private final InputManagerHandler mHandler;
|
private final InputManagerHandler mHandler;
|
||||||
private DisplayManagerInternal mDisplayManagerInternal;
|
private DisplayManagerInternal mDisplayManagerInternal;
|
||||||
|
|
||||||
|
private InputMethodManagerInternal mInputMethodManagerInternal;
|
||||||
|
|
||||||
// Context cache used for loading pointer resources.
|
// Context cache used for loading pointer resources.
|
||||||
private Context mPointerIconDisplayContext;
|
private Context mPointerIconDisplayContext;
|
||||||
|
|
||||||
@@ -510,6 +513,8 @@ public class InputManagerService extends IInputManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
|
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
|
||||||
|
mInputMethodManagerInternal =
|
||||||
|
LocalServices.getService(InputMethodManagerInternal.class);
|
||||||
|
|
||||||
mSettingsObserver.registerAndUpdate();
|
mSettingsObserver.registerAndUpdate();
|
||||||
|
|
||||||
@@ -2790,6 +2795,13 @@ public class InputManagerService extends IInputManager.Stub
|
|||||||
yPosition)).sendToTarget();
|
yPosition)).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Native callback.
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
boolean isInputMethodConnectionActive() {
|
||||||
|
return mInputMethodManagerInternal != null
|
||||||
|
&& mInputMethodManagerInternal.isAnyInputConnectionActive();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback interface implemented by the Window Manager.
|
* Callback interface implemented by the Window Manager.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -185,6 +185,12 @@ public abstract class InputMethodManagerInternal {
|
|||||||
*/
|
*/
|
||||||
public abstract void switchKeyboardLayout(int direction);
|
public abstract void switchKeyboardLayout(int direction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if any InputConnection is currently active.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public abstract boolean isAnyInputConnectionActive();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing.
|
* Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing.
|
||||||
*/
|
*/
|
||||||
@@ -268,6 +274,11 @@ public abstract class InputMethodManagerInternal {
|
|||||||
@Override
|
@Override
|
||||||
public void switchKeyboardLayout(int direction) {
|
public void switchKeyboardLayout(int direction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAnyInputConnectionActive() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5937,6 +5937,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if any InputConnection is currently active.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAnyInputConnectionActive() {
|
||||||
|
return mCurInputConnection != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ static struct {
|
|||||||
jmethodID notifySensorEvent;
|
jmethodID notifySensorEvent;
|
||||||
jmethodID notifySensorAccuracy;
|
jmethodID notifySensorAccuracy;
|
||||||
jmethodID notifyStylusGestureStarted;
|
jmethodID notifyStylusGestureStarted;
|
||||||
|
jmethodID isInputMethodConnectionActive;
|
||||||
jmethodID notifyVibratorState;
|
jmethodID notifyVibratorState;
|
||||||
jmethodID filterInputEvent;
|
jmethodID filterInputEvent;
|
||||||
jmethodID interceptKeyBeforeQueueing;
|
jmethodID interceptKeyBeforeQueueing;
|
||||||
@@ -322,6 +323,7 @@ public:
|
|||||||
|
|
||||||
TouchAffineTransformation getTouchAffineTransformation(JNIEnv* env, jfloatArray matrixArr);
|
TouchAffineTransformation getTouchAffineTransformation(JNIEnv* env, jfloatArray matrixArr);
|
||||||
void notifyStylusGestureStarted(int32_t deviceId, nsecs_t eventTime) override;
|
void notifyStylusGestureStarted(int32_t deviceId, nsecs_t eventTime) override;
|
||||||
|
bool isInputMethodConnectionActive() override;
|
||||||
|
|
||||||
/* --- InputDispatcherPolicyInterface implementation --- */
|
/* --- InputDispatcherPolicyInterface implementation --- */
|
||||||
|
|
||||||
@@ -1306,6 +1308,14 @@ void NativeInputManager::notifyStylusGestureStarted(int32_t deviceId, nsecs_t ev
|
|||||||
checkAndClearExceptionFromCallback(env, "notifyStylusGestureStarted");
|
checkAndClearExceptionFromCallback(env, "notifyStylusGestureStarted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NativeInputManager::isInputMethodConnectionActive() {
|
||||||
|
JNIEnv* env = jniEnv();
|
||||||
|
const jboolean result =
|
||||||
|
env->CallBooleanMethod(mServiceObj, gServiceClassInfo.isInputMethodConnectionActive);
|
||||||
|
checkAndClearExceptionFromCallback(env, "isInputMethodConnectionActive");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool NativeInputManager::filterInputEvent(const InputEvent& inputEvent, uint32_t policyFlags) {
|
bool NativeInputManager::filterInputEvent(const InputEvent& inputEvent, uint32_t policyFlags) {
|
||||||
ATRACE_CALL();
|
ATRACE_CALL();
|
||||||
JNIEnv* env = jniEnv();
|
JNIEnv* env = jniEnv();
|
||||||
@@ -2743,6 +2753,9 @@ int register_android_server_InputManager(JNIEnv* env) {
|
|||||||
GET_METHOD_ID(gServiceClassInfo.notifyStylusGestureStarted, clazz, "notifyStylusGestureStarted",
|
GET_METHOD_ID(gServiceClassInfo.notifyStylusGestureStarted, clazz, "notifyStylusGestureStarted",
|
||||||
"(IJ)V");
|
"(IJ)V");
|
||||||
|
|
||||||
|
GET_METHOD_ID(gServiceClassInfo.isInputMethodConnectionActive, clazz,
|
||||||
|
"isInputMethodConnectionActive", "()Z");
|
||||||
|
|
||||||
GET_METHOD_ID(gServiceClassInfo.notifyVibratorState, clazz, "notifyVibratorState", "(IZ)V");
|
GET_METHOD_ID(gServiceClassInfo.notifyVibratorState, clazz, "notifyVibratorState", "(IZ)V");
|
||||||
|
|
||||||
GET_METHOD_ID(gServiceClassInfo.notifyNoFocusedWindowAnr, clazz, "notifyNoFocusedWindowAnr",
|
GET_METHOD_ID(gServiceClassInfo.notifyNoFocusedWindowAnr, clazz, "notifyNoFocusedWindowAnr",
|
||||||
|
|||||||
Reference in New Issue
Block a user