流川枫 发表于 2017-7-10 14:16:58

RK3288实现TP双屏触摸

diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
old mode 100644
new mode 100755
index 4d70d5f..5325bd5
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -999,7 +999,7 @@ static const int32_t GAMEPAD_KEYCODES[] = {

status_t EventHub::openDeviceLocked(const char *devicePath) {
   char buffer;
-
+    static intTouchDevDisplayID = 1;
   ALOGV("Opening device: %s", devicePath);

   int fd = open(devicePath, O_RDWR | O_CLOEXEC);
@@ -1132,6 +1132,11 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
         // a touch screen.
         if (test_bit(BTN_TOUCH, device->keyBitmask) || !haveGamepadButtons) {
             device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT;
+            if(TouchDevDisplayID == 1){               
+                device->classes |= INPUT_DEVICE_CLASS_EXTERNAL;
+                ALOGD(" %dname:       \"%s\"\n",__LINE__, device->identifier.name.string());
+                TouchDevDisplayID = 0;
+            }   
         }
   // Is this an old style single-touch driver?
   } else if (test_bit(BTN_TOUCH, device->keyBitmask)
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 8d89fcb..b35e497 100755
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -829,6 +829,7 @@ void InputDispatcher::logOutboundKeyDetailsLocked(const char* prefix, const KeyE
bool InputDispatcher::dispatchMotionLocked(
         nsecs_t currentTime, MotionEntry* entry, DropReason* dropReason, nsecs_t* nextWakeupTime) {
   // Preprocessing.
+   
   if (! entry->dispatchInProgress) {
         entry->dispatchInProgress = true;

@@ -891,9 +892,9 @@ bool InputDispatcher::dispatchMotionLocked(
   }

   // TODO: support sending secondary display events to input monitors
-    if (isMainDisplay(entry->displayId)) {
+   // if (isMainDisplay(entry->displayId)) {
         addMonitoringTargetsLocked(inputTargets);
-    }
+//}

   // Dispatch the motion.
   if (conflictingPointerActions) {
@@ -911,13 +912,13 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M
   ALOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "
             "action=0x%x, flags=0x%x, "
             "metaState=0x%x, buttonState=0x%x, "
-            "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld",
+            "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld,displayId = %d",
             prefix,
             entry->eventTime, entry->deviceId, entry->source, entry->policyFlags,
             entry->action, entry->flags,
             entry->metaState, entry->buttonState,
             entry->edgeFlags, entry->xPrecision, entry->yPrecision,
-            entry->downTime);
+            entry->downTime,entry->displayId);

   for (uint32_t i = 0; i < entry->pointerCount; i++) {
         ALOGD("Pointer %d: id=%d, toolType=%d, "
@@ -1141,8 +1142,8 @@ Unresponsive:
             injectionResult, timeSpentWaitingForApplication);
#if DEBUG_FOCUS
   ALOGD("findFocusedWindow finished: injectionResult=%d, "
-            "timeSpentWaitingForApplication=%0.1fms",
-            injectionResult, timeSpentWaitingForApplication / 1000000.0);
+            "timeSpentWaitingForApplication=%0.1fms,mFocusedWindowHandle->name = %s",
+            injectionResult, timeSpentWaitingForApplication / 1000000.0,mFocusedWindowHandle->getName().string());
#endif
   return injectionResult;
}
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
old mode 100644
new mode 100755
diff --git a/services/java/com/android/server/input/InputWindowHandle.java b/services/java/com/android/server/input/InputWindowHandle.java
index 2903779..cee8733 100755
--- a/services/java/com/android/server/input/InputWindowHandle.java
+++ b/services/java/com/android/server/input/InputWindowHandle.java
@@ -92,7 +92,8 @@ public final class InputWindowHandle {
   public int inputFeatures;

   // Display this input is on.
-    public final int displayId;
+    //public final int displayId;
+    publicint displayId;

   private native void nativeDispose();

diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index c587da0..529af5f 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -13215,6 +13215,7 @@ if(mCurConfiguration.enableMultiWindow()){
                                if(mGroupId == groupId){
                                        windows.remove(win);
                                        win.mDisplayContent = secondDisplayContent;
+                                                win.mInputWindowHandle.displayId = displayId;                     
                                        if(win.mWinAnimator != null){
                                                int layerStack = secondDisplayContent.getDisplay().getLayerStack();
                                                if(win.mWinAnimator.mSurfaceControl!= null){

loading 发表于 2017-7-10 15:51:59

赞一个,有机会试试

Younix 发表于 2017-7-10 15:56:52

佩服。先马后看。

小艹 发表于 2017-7-28 16:23:46

楼主可以研究下双USB异触,I2c和USB异触
页: [1]
查看完整版本: RK3288实现TP双屏触摸