check config for showing a stylus pointer (frameworks/base part)

On InputReader, get the configuration from config.xml
to decide whether to show a stylus pointer.

Test: Manual Test(hover pointer on handwriting area)
Bug: b/215436642
Change-Id: Ia08052f97e027c48d3bbc76ad03988722a7d9e2f
This commit is contained in:
Seunghwan Choi
2023-01-17 20:47:47 +09:00
committed by Prabir Pradhan
parent 670b33dd90
commit 492922a6e8
2 changed files with 17 additions and 0 deletions

View File

@@ -2974,6 +2974,13 @@ public class InputManagerService extends IInputManager.Stub
return null;
}
// Native callback.
@SuppressWarnings("unused")
private boolean isStylusPointerIconEnabled() {
return Objects.requireNonNull(mContext.getSystemService(InputManager.class))
.isStylusPointerIconEnabled();
}
private static class PointerDisplayIdChangedArgs {
final int mPointerDisplayId;
final float mXPosition;

View File

@@ -137,6 +137,7 @@ static struct {
jmethodID notifyDropWindow;
jmethodID getParentSurfaceForPointers;
jmethodID isPerDisplayTouchModeEnabled;
jmethodID isStylusPointerIconEnabled;
} gServiceClassInfo;
static struct {
@@ -660,6 +661,12 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
outConfig->pointerGestureTapSlop = hoverTapSlop;
}
jboolean stylusPointerIconEnabled =
env->CallBooleanMethod(mServiceObj, gServiceClassInfo.isStylusPointerIconEnabled);
if (!checkAndClearExceptionFromCallback(env, "isStylusPointerIconEnabled")) {
outConfig->stylusPointerIconEnabled = stylusPointerIconEnabled;
}
{ // acquire lock
AutoMutex _l(mLock);
@@ -2793,6 +2800,9 @@ int register_android_server_InputManager(JNIEnv* env) {
GET_METHOD_ID(gServiceClassInfo.isPerDisplayTouchModeEnabled, clazz,
"isPerDisplayTouchModeEnabled", "()Z");
GET_METHOD_ID(gServiceClassInfo.isStylusPointerIconEnabled, clazz, "isStylusPointerIconEnabled",
"()Z");
// InputDevice
FIND_CLASS(gInputDeviceClassInfo.clazz, "android/view/InputDevice");