summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/wallpaper
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-07-02 15:37:36 -0700
committerJeff Brown <jeffbrown@google.com>2010-07-03 19:23:01 -0700
commit00fa7bdd69f0868fd17ea7c881c771d785b2fbbd (patch)
tree6fff8ad404e57af316c6ce5a20020dc209eb3cc6 /core/java/android/service/wallpaper
parent8ecfb60a8e74dfcd51bbf3f236d5f414a4d5ac7d (diff)
downloadframeworks_base-00fa7bdd69f0868fd17ea7c881c771d785b2fbbd.zip
frameworks_base-00fa7bdd69f0868fd17ea7c881c771d785b2fbbd.tar.gz
frameworks_base-00fa7bdd69f0868fd17ea7c881c771d785b2fbbd.tar.bz2
More native input dispatch work.
Removed old input dispatch code. Refactored the policy callbacks. Pushed a tiny bit of the power manager state down to native. Fixed long press on MENU. Made the virtual key detection and cancelation a bit more precise. Change-Id: I5d8c1062f7ea0ab3b54c6fadb058c4d5f5a9e02e
Diffstat (limited to 'core/java/android/service/wallpaper')
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java77
1 files changed, 27 insertions, 50 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 249ad62..6f12f19 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -216,20 +216,7 @@ public abstract class WallpaperService extends Service {
@Override
public void handleTouch(MotionEvent event, Runnable finishedCallback) {
try {
- synchronized (mLock) {
- if (event.getAction() == MotionEvent.ACTION_MOVE) {
- if (mPendingMove != null) {
- mCaller.removeMessages(MSG_TOUCH_EVENT, mPendingMove);
- mPendingMove.recycle();
- }
- mPendingMove = event;
- } else {
- mPendingMove = null;
- }
- Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT,
- event);
- mCaller.sendMessage(msg);
- }
+ dispatchPointer(event);
} finally {
finishedCallback.run();
}
@@ -238,26 +225,6 @@ public abstract class WallpaperService extends Service {
final BaseIWindow mWindow = new BaseIWindow() {
@Override
- public boolean onDispatchPointer(MotionEvent event, long eventTime,
- boolean callWhenDone) {
- synchronized (mLock) {
- if (event.getAction() == MotionEvent.ACTION_MOVE) {
- if (mPendingMove != null) {
- mCaller.removeMessages(MSG_TOUCH_EVENT, mPendingMove);
- mPendingMove.recycle();
- }
- mPendingMove = event;
- } else {
- mPendingMove = null;
- }
- Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT,
- event);
- mCaller.sendMessage(msg);
- }
- return false;
- }
-
- @Override
public void resized(int w, int h, Rect coveredInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
@@ -466,6 +433,22 @@ public abstract class WallpaperService extends Service {
*/
public void onSurfaceDestroyed(SurfaceHolder holder) {
}
+
+ private void dispatchPointer(MotionEvent event) {
+ synchronized (mLock) {
+ if (event.getAction() == MotionEvent.ACTION_MOVE) {
+ if (mPendingMove != null) {
+ mCaller.removeMessages(MSG_TOUCH_EVENT, mPendingMove);
+ mPendingMove.recycle();
+ }
+ mPendingMove = event;
+ } else {
+ mPendingMove = null;
+ }
+ Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT, event);
+ mCaller.sendMessage(msg);
+ }
+ }
void updateSurface(boolean forceRelayout, boolean forceReport) {
if (mDestroyed) {
@@ -523,10 +506,8 @@ public abstract class WallpaperService extends Service {
mInputChannel);
mCreated = true;
- if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
- InputQueue.registerInputChannel(mInputChannel, mInputHandler,
- Looper.myQueue());
- }
+ InputQueue.registerInputChannel(mInputChannel, mInputHandler,
+ Looper.myQueue());
}
mSurfaceHolder.mSurfaceLock.lock();
@@ -770,10 +751,8 @@ public abstract class WallpaperService extends Service {
if (DEBUG) Log.v(TAG, "Removing window and destroying surface "
+ mSurfaceHolder.getSurface() + " of: " + this);
- if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
- if (mInputChannel != null) {
- InputQueue.unregisterInputChannel(mInputChannel);
- }
+ if (mInputChannel != null) {
+ InputQueue.unregisterInputChannel(mInputChannel);
}
mSession.remove(mWindow);
@@ -782,13 +761,11 @@ public abstract class WallpaperService extends Service {
mSurfaceHolder.mSurface.release();
mCreated = false;
- if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
- // Dispose the input channel after removing the window so the Window Manager
- // doesn't interpret the input channel being closed as an abnormal termination.
- if (mInputChannel != null) {
- mInputChannel.dispose();
- mInputChannel = null;
- }
+ // Dispose the input channel after removing the window so the Window Manager
+ // doesn't interpret the input channel being closed as an abnormal termination.
+ if (mInputChannel != null) {
+ mInputChannel.dispose();
+ mInputChannel = null;
}
}
}
@@ -841,7 +818,7 @@ public abstract class WallpaperService extends Service {
public void dispatchPointer(MotionEvent event) {
if (mEngine != null) {
- mEngine.mWindow.onDispatchPointer(event, event.getEventTime(), false);
+ mEngine.dispatchPointer(event);
}
}