Android->frameworks: add touch one
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManag
index 8545402..5a2303a 100644
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3267,6 +3267,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mstate.equals("on") && ((keyCode == KeyEvent.KEYCODE_ENTER)
||(keyCode == KeyEvent.KEYCODE_DPAD_CENTER))) {
+ String x = SystemProperties.get("tchip.pointer.x");
+ String y = SystemProperties.get("tchip.pointer.y");
+ tchipTap(x, y);
return -1;
}
@@ -3713,6 +3716,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Let the application handle the key.
return 0;
}
+
+ private void tchipTap(String x, String y) { // adb shell input tap 540 1104
+ android.util.Log.i("AZ", "tchipTap.X=" + x + ";Y=" + y);
+ try {
+ Runtime.getRuntime().exec("input tap " + x + " " + y + "\n");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
/** {@inheritDoc} */
@Override
diff --git a/frameworks/native/services/inputflinger/InputReader.cpp b/frameworks/native/services/inputflinger/InputReader.cpp
index a925ac9..45781bd 100644
--- a/frameworks/native/services/inputflinger/InputReader.cpp
+++ b/frameworks/native/services/inputflinger/InputReader.cpp
@@ -3038,6 +3038,16 @@ void KeyMouseInputMapper::sync(nsecs_t when) {
mPointerController->getPosition(&x, &y);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y);
+
+ ALOGW("KeyMouseInputMapper:x=%f;y=%f", x, y);
+
+ char *posX = new char[PROPERTY_VALUE_MAX];
+ sprintf(posX,"%d", (int)x);
+ char *posY = new char[PROPERTY_VALUE_MAX];
+ sprintf(posY,"%d", (int)y);
+
+ property_set("tchip.pointer.x", posX);
+ property_set("tchip.pointer.y", posY);
displayId = ADISPLAY_ID_DEFAULT;
}
// Moving an external trackball or mouse should wake the device.
Android鼠標模式下按確認鍵,獲取鼠標光標位置,然後模擬input tap
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.