try attached. And let me know if it works. If it is ok, then I will upload it.
BTW--- you need to make sure that your kernel has wake_lock enabled otherwise, current cursor patch will not work. Yi On Sun, 2009-05-03 at 23:45 -0700, adhi wrote: > Hi ! > > I am following the steps mentioned in this forum and I am the stage of > applying patches. All the patches namely, > alarm.patch, boot_able_img.patch, cursor.patch, e2fsprogs.patch and > frameworks.patch are okay except the cursor.patch. > > Following is the output , > > varadara...@thinteknix:~/Desktop/mydroid/frameworks/base$ git apply -- > reject --whitespace=fix ~/Desktop/x86-patches/cursor.patch > /home/varadarajan/Desktop/x86-patches/cursor.patch:38: trailing > whitespace. > if (test_bit(BTN_LEFT,key_bitmask) && > /home/varadarajan/Desktop/x86-patches/cursor.patch:78: trailing > whitespace. > (di, di.mDownTime, curTime, > /home/varadarajan/Desktop/x86-patches/cursor.patch:80: trailing > whitespace. > ((ev.flags & > /home/varadarajan/Desktop/x86-patches/cursor.patch:81: trailing > whitespace. > > WindowManagerPolicy.FLAG_WOKE_HERE) > /home/varadarajan/Desktop/x86-patches/cursor.patch:92: trailing > whitespace. > ((classes&RawInputEvent.CLASS_MOUSE) ! > = 0))) { > Checking patch core/java/android/view/RawInputEvent.java... > Checking patch include/ui/EventHub.h... > Checking patch libs/ui/EventHub.cpp... > Checking patch services/java/com/android/server/KeyInputQueue.java... > Checking patch services/java/com/android/server/ > WindowManagerService.java... > error: while searching for: > int eventType; > if (ev.classType == > RawInputEvent.CLASS_TOUCHSCREEN) { > eventType = eventType((MotionEvent) > ev.event); > } else if (ev.clas > error: patch failed: services/java/com/android/server/ > WindowManagerService.java:5079 > Applied patch core/java/android/view/RawInputEvent.java cleanly. > Applied patch include/ui/EventHub.h cleanly. > Applied patch libs/ui/EventHub.cpp cleanly. > Applied patch services/java/com/android/server/KeyInputQueue.java > cleanly. > Applying patch services/java/com/android/server/ > WindowManagerService.java with 1 rejects... > Hunk #1 applied cleanly. > Hunk #2 applied cleanly. > Hunk #3 applied cleanly. > Hunk #4 applied cleanly. > Hunk #5 applied cleanly. > Hunk #6 applied cleanly. > Hunk #7 applied cleanly. > Hunk #8 applied cleanly. > Hunk #9 applied cleanly. > Rejected hunk #10. > Hunk #11 applied cleanly. > varadara...@thinteknix:~/Desktop/mydroid/frameworks/base$ > > Any idea why this is happening ? Is this okay or to be ignored ? > > Cheers > Varadarajan > Ottawa > www.thinteknix.com > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
>From f4a2e330101cce7ee2e13a6b0a82c24f93923130 Mon Sep 17 00:00:00 2001 From: Yi Sun <beyo...@gmail.com> Date: Fri, 1 May 2009 17:46:54 -0700 Subject: [PATCH] 1. added mouse cursor --- core/java/android/view/RawInputEvent.java | 3 +- include/ui/EventHub.h | 3 +- libs/ui/EventHub.cpp | 4 + .../java/com/android/server/KeyInputQueue.java | 45 +++++--- .../com/android/server/WindowManagerService.java | 120 ++++++++++++++++++-- 5 files changed, 150 insertions(+), 25 deletions(-) diff --git a/core/java/android/view/RawInputEvent.java b/core/java/android/view/RawInputEvent.java index 30da83e..4d9a11a 100644 --- a/core/java/android/view/RawInputEvent.java +++ b/core/java/android/view/RawInputEvent.java @@ -13,7 +13,8 @@ public class RawInputEvent { public static final int CLASS_ALPHAKEY = 0x00000002; public static final int CLASS_TOUCHSCREEN = 0x00000004; public static final int CLASS_TRACKBALL = 0x00000008; - + public static final int CLASS_MOUSE= 0x00000010; + // More special classes for QueuedEvent below. public static final int CLASS_CONFIGURATION_CHANGED = 0x10000000; diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index 3848d8c..280959c 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -52,7 +52,8 @@ public: CLASS_KEYBOARD = 0x00000001, CLASS_ALPHAKEY = 0x00000002, CLASS_TOUCHSCREEN = 0x00000004, - CLASS_TRACKBALL = 0x00000008 + CLASS_TRACKBALL = 0x00000008, + CLASS_MOUSE = 0x00000010 }; uint32_t getDeviceClasses(int32_t deviceId) const; diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp index 7c2fc8e..c065bf0 100644 --- a/libs/ui/EventHub.cpp +++ b/libs/ui/EventHub.cpp @@ -577,6 +577,10 @@ int EventHub::open_device(const char *deviceName) if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask) >= 0) { if (test_bit(REL_X, rel_bitmask) && test_bit(REL_Y, rel_bitmask)) { + if (test_bit(BTN_LEFT,key_bitmask) && + test_bit(BTN_RIGHT,key_bitmask)) + device->classes |= CLASS_MOUSE; + else device->classes |= CLASS_TRACKBALL; } } diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java index 411cd6b..415f81b 100644 --- a/services/java/com/android/server/KeyInputQueue.java +++ b/services/java/com/android/server/KeyInputQueue.java @@ -42,6 +42,7 @@ public abstract class KeyInputQueue { QueuedEvent mCache; int mCacheCount; + Display mDisplay = null; int mOrientation = Surface.ROTATION_0; @@ -256,11 +257,10 @@ public abstract class KeyInputQueue { // timebase as SystemClock.uptimeMillis(). //curTime = gotOne ? ev.when : SystemClock.uptimeMillis(); final long curTime = SystemClock.uptimeMillis(); - //Log.i(TAG, "curTime=" + curTime + ", systemClock=" + SystemClock.uptimeMillis()); - final int classes = di.classes; final int type = ev.type; final int scancode = ev.scancode; + send = false; // Is it a key event? @@ -278,9 +278,12 @@ public abstract class KeyInputQueue { int keycode = rotateKeyCodeLocked(ev.keycode); addLocked(di, curTime, ev.flags, RawInputEvent.CLASS_KEYBOARD, - newKeyEvent(di, di.mDownTime, curTime, down, - keycode, 0, scancode, - ((ev.flags & WindowManagerPolicy.FLAG_WOKE_HERE) != 0) + newKeyEvent + (di, di.mDownTime, curTime, + down,keycode, 0, scancode, + ((ev.flags & + WindowManagerPolicy.FLAG_WOKE_HERE) + != 0) ? KeyEvent.FLAG_WOKE_HERE : 0)); } else if (ev.type == RawInputEvent.EV_KEY) { if (ev.scancode == RawInputEvent.BTN_TOUCH && @@ -289,10 +292,10 @@ public abstract class KeyInputQueue { di.mAbs.down = ev.value != 0; } if (ev.scancode == RawInputEvent.BTN_MOUSE && - (classes&RawInputEvent.CLASS_TRACKBALL) != 0) { + (((classes&RawInputEvent.CLASS_TRACKBALL) != 0) || + ((classes&RawInputEvent.CLASS_MOUSE) != 0))) { di.mRel.changed = true; di.mRel.down = ev.value != 0; - send = true; } } else if (ev.type == RawInputEvent.EV_ABS && @@ -312,7 +315,8 @@ public abstract class KeyInputQueue { } } else if (ev.type == RawInputEvent.EV_REL && - (classes&RawInputEvent.CLASS_TRACKBALL) != 0) { + (((classes&RawInputEvent.CLASS_TRACKBALL) != 0) || + ((classes&RawInputEvent.CLASS_MOUSE) != 0))) { // Add this relative movement into our totals. if (ev.scancode == RawInputEvent.REL_X) { di.mRel.changed = true; @@ -332,22 +336,33 @@ public abstract class KeyInputQueue { MotionEvent me; me = di.mAbs.generateMotion(di, curTime, true, mDisplay, mOrientation, mGlobalMetaState); - if (false) Log.v(TAG, "Absolute: x=" + di.mAbs.x - + " y=" + di.mAbs.y + " ev=" + me); + if (false) + Log.v(TAG, "Absolute: x=" + di.mAbs.x + + " y=" + di.mAbs.y + " ev=" + me); if (me != null) { if (WindowManagerPolicy.WATCH_POINTER) { Log.i(TAG, "Enqueueing: " + me); } addLocked(di, curTime, ev.flags, - RawInputEvent.CLASS_TOUCHSCREEN, me); + RawInputEvent.CLASS_TOUCHSCREEN, + me); } + me = di.mRel.generateMotion(di, curTime, false, mDisplay, mOrientation, mGlobalMetaState); - if (false) Log.v(TAG, "Relative: x=" + di.mRel.x - + " y=" + di.mRel.y + " ev=" + me); + if (false) + Log.v(TAG, "Relative: x=" + di.mRel.x + + " y=" + di.mRel.y + " ev=" + me); if (me != null) { - addLocked(di, curTime, ev.flags, - RawInputEvent.CLASS_TRACKBALL, me); + if ((classes & RawInputEvent.CLASS_TRACKBALL) != 0) { + addLocked(di, curTime, ev.flags, + RawInputEvent.CLASS_TRACKBALL, me); + } else { + addLocked + (di, curTime, ev.flags, + RawInputEvent.CLASS_MOUSE, + me); + } } } } diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 0b1ddc8..fd4725f 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -119,6 +119,9 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; +import android.graphics.Canvas; +import android.graphics.Path; + /** {...@hide} */ public class WindowManagerService extends IWindowManager.Stub implements Watchdog.Monitor { static final String TAG = "WindowManager"; @@ -308,6 +311,13 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo long mLastDimAnimTime; Surface mBlurSurface; boolean mBlurShown; + Surface mMouseSurface; + int mShowMouse = 0; + int mMlx; + int mMly; + int mMlw; + int mMlh; + int mTransactionSequence = 0; @@ -4525,7 +4535,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo final Rect tmpRect = mTempRect; for (int i=N-1; i>=0; i--) { WindowState child = (WindowState)windows.get(i); - //Log.i(TAG, "Checking dispatch to: " + child); + Log.i(TAG, "Checking dispatch to: " + child); final int flags = child.mAttrs.flags; if ((flags & WindowManager.LayoutParams.FLAG_SYSTEM_ERROR) != 0) { if (topErrWindow == null) { @@ -4533,11 +4543,11 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } } if (!child.isVisibleLw()) { - //Log.i(TAG, "Not visible!"); + Log.i(TAG, "Not visible!"); continue; } if ((flags & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0) { - //Log.i(TAG, "Not touchable!"); + Log.i(TAG, "Not touchable!"); if ((flags & WindowManager.LayoutParams .FLAG_WATCH_OUTSIDE_TOUCH) != 0) { child.mNextOutsideTouch = mOutsideTouchTargets; @@ -4568,10 +4578,11 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo final int touchFlags = flags & (WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); + Log.i(TAG, "tmpRect.left " + tmpRect.left + " top " + tmpRect.top + + " right " + tmpRect.right + " bottom " + tmpRect.bottom); if (tmpRect.contains(x, y) || touchFlags == 0) { - //Log.i(TAG, "Using this target!"); if (!screenWasOff || (flags & - WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING) != 0) { + WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING) != 0) { mMotionTarget = child; } else { //Log.i(TAG, "Waking, skip!"); @@ -4946,7 +4957,8 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo if (screenIsOff) { if (!mPolicy.isWakeRelMovementTq(event.deviceId, device.classes, event)) { - //Log.i(TAG, "dropping because screenIsOff and !isWakeKey"); + if (DEBUG_INPUT) + Log.i(TAG, "dropping because screenIsOff and !isWakeKey"); return false; } event.flags |= WindowManagerPolicy.FLAG_WOKE_HERE; @@ -5079,8 +5091,11 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo int eventType; if (ev.classType == RawInputEvent.CLASS_TOUCHSCREEN) { eventType = eventType((MotionEvent)ev.event); - } else if (ev.classType == RawInputEvent.CLASS_KEYBOARD || - ev.classType == RawInputEvent.CLASS_TRACKBALL) { + } else if (ev.classType == + RawInputEvent.CLASS_KEYBOARD || + ev.classType == + RawInputEvent.CLASS_TRACKBALL || + ev.classType == RawInputEvent.CLASS_MOUSE) { eventType = LocalPowerManager.BUTTON_EVENT; } else { eventType = LocalPowerManager.OTHER_EVENT; @@ -5119,6 +5134,44 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo //Log.i(TAG, "Read next event " + ev); dispatchPointer(ev, (MotionEvent)ev.event, 0, 0); break; + case RawInputEvent.CLASS_MOUSE: + MotionEvent mmev = (MotionEvent)ev.event; + int mcx = mMlx + (int)(mmev.getX()* mmev.getXPrecision()); + int mcy = mMly + (int)(mmev.getY()* mmev.getYPrecision()); + mcx = ((mcx < 0) ? 0 :(mcx >= mDisplay.getWidth() ?(mDisplay.getWidth()-1):mcx)); + mcy = ((mcy < 0) ? 0 :(mcy >= mDisplay.getHeight()?(mDisplay.getHeight() - 1):mcy)); + + mmev.setLocation((float) mcx, (float) mcy); + dispatchPointer(ev, mmev, 0, 0); + if (mMouseSurface != null && (mMlx != mcx || mMly != mcy)) { + // Should we use lock? synchronized(mWindowMap) { + Surface.openTransaction(); + if (DEBUG_INPUT) + Log.i(TAG, + "Open transaction for the mouse surface"); + WindowState top = + (WindowState)mWindows.get(mWindows.size() - 1); + try { + if (DEBUG_INPUT) + Log.i(TAG, "Move surf, x: " + + Integer.toString(mcx) + " y:" + + Integer.toString(mcy)); + + mMouseSurface.setPosition(mcx,mcy); + mMouseSurface.setLayer(top.mAnimLayer + 1); + if (mShowMouse != 1) { + mMouseSurface.show(); + mShowMouse = 1; + } + mMlx = mcx; + mMly = mcy; + } catch ( RuntimeException e) { + Log.e(TAG, "Failure showing mouse surface",e); + } + Surface.closeTransaction(); + } + + break; case RawInputEvent.CLASS_TRACKBALL: dispatchTrackball(ev, (MotionEvent)ev.event, 0, 0); break; @@ -7572,6 +7625,57 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo if (mFxSession == null) { mFxSession = new SurfaceSession(); } + + if (mMouseSurface == null) { + int mMx, mMy, mMw, mMh; + Canvas mCanvas; + Path mPath = new Path(); + + if (DEBUG_INPUT) + Log.i(TAG, "Create Mouse Surface"); + + mMw = 20; + mMh = 20; + mMx = (mDisplay.getWidth() - mMw) / 2; + mMy = (mDisplay.getHeight() - mMh) / 2; + + try { + + /* + *First Mouse event, create Surface + */ + + mMouseSurface = + new Surface(mFxSession, + 0,-1,mMw,mMy, + PixelFormat.TRANSPARENT, + Surface.FX_SURFACE_NORMAL); + mCanvas = mMouseSurface.lockCanvas(null); + mCanvas.drawColor(0x0); + + + + mPath.moveTo(0.0f,0.0f); + mPath.lineTo(16.0f, 0.0f); + mPath.lineTo(0.0f, 16.0f); + mPath.close(); + mCanvas.clipPath(mPath); + mCanvas.drawColor(0x66666666); + + mMouseSurface.unlockCanvasAndPost(mCanvas); + mMouseSurface.openTransaction(); + mMouseSurface.setSize(mMw,mMh); + mMouseSurface.closeTransaction(); + + } catch (Exception e) { + Log.e(TAG, "Exception creating mouse surface",e); + } + mMlx = mMx; + mMly = mMy; + mMlw = mMw; + mMlh = mMh; + } + if (SHOW_TRANSACTIONS) Log.i(TAG, ">>> OPEN TRANSACTION"); -- 1.6.0.4
>From 4925fc9e7c40f4bf4cbaab34382583b1fb4ace75 Mon Sep 17 00:00:00 2001 From: Yi Sun <beyo...@gmail.com> Date: Fri, 1 May 2009 17:44:35 -0700 Subject: [PATCH] 1. new kernel.config to enabled mouse and vesa fb driver 2. updated the init.rc to avoid boot time crash 3. updated the power sysfs path and permission so that the mouse cursor can run without any hacks --- init.rc | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/init.rc b/init.rc index 00aa93c..19566f6 100644 --- a/init.rc +++ b/init.rc @@ -108,15 +108,18 @@ on boot setprop ro.FOREGROUND_APP_ADJ 0 setprop ro.VISIBLE_APP_ADJ 1 setprop ro.SECONDARY_SERVER_ADJ 2 + setprop ro.HOME_APP_ADJ 4 setprop ro.HIDDEN_APP_MIN_ADJ 7 setprop ro.CONTENT_PROVIDER_ADJ 14 setprop ro.EMPTY_APP_ADJ 15 + # Define the memory thresholds at which the above process classes will # be killed. These numbers are in pages (4k). setprop ro.FOREGROUND_APP_MEM 1536 setprop ro.VISIBLE_APP_MEM 2048 setprop ro.SECONDARY_SERVER_MEM 4096 + setprop ro.HOME_APP_MEM 4096 setprop ro.HIDDEN_APP_MEM 8192 setprop ro.CONTENT_PROVIDER_MEM 8704 setprop ro.EMPTY_APP_MEM 16384 @@ -136,6 +139,12 @@ on boot chown radio system /sys/android_power/acquire_full_wake_lock chown radio system /sys/android_power/acquire_partial_wake_lock chown radio system /sys/android_power/release_wake_lock + chown radio system /sys/power/state + chown radio system /sys/power/wake_lock + chown radio system /sys/power/wake_unlock + chmod 0660 /sys/power/state + chmod 0660 /sys/power/wake_lock + chmod 0660 /sys/power/wake_unlock chown system system /sys/class/timed_output/vibrator/enable chown system system /sys/class/leds/keyboard-backlight/brightness chown system system /sys/class/leds/lcd-backlight/brightness @@ -179,7 +188,6 @@ service console /system/bin/sh # adbd is controlled by the persist.service.adb.enable system property service adbd /sbin/adbd - disabled on property:persist.service.adb.enable=1 start adbd @@ -193,12 +201,16 @@ service servicemanager /system/bin/servicemanager onrestart restart zygote onrestart restart media -service mountd /system/bin/mountd - socket mountd stream 0660 root mount +service vold /system/bin/vold + socket vold stream 0660 root mount + +#service mountd /system/bin/mountd +# socket mountd stream 0660 root mount service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server socket zygote stream 666 onrestart write /sys/android_power/request_state wake + onrestart write /sys/power/state on service media /system/bin/mediaserver user media -- 1.6.0.4