Add a sprite controller.
Refactored PointerController to extract the surface management
code to a new component called a SpriteController so that it can
be used to move finger tracking spots around the screen as well.
The SpriteController is designed to fully decouple the client from
any latency introduced by surface transactions and drawing.
All sprite updates are performed asynchronously on the Looper using
a copy of the sprite state.
Added a stub SpotController implementation for touch pad UX.
It will be implemented in a subsequent patch.
Fixed a little bug in pointer orientation changes when entering
DISPLAY_ORIENTATION_90 the x offset was clobbered.
Change-Id: Ib25d162d577c9b354cb74d5d761c3c9f9f438d42
diff --git a/services/input/PointerController.h b/services/input/PointerController.h
index e1dab5c..d467a5a 100644
--- a/services/input/PointerController.h
+++ b/services/input/PointerController.h
@@ -17,16 +17,14 @@
#ifndef _UI_POINTER_CONTROLLER_H
#define _UI_POINTER_CONTROLLER_H
+#include "SpriteController.h"
+
#include <ui/DisplayInfo.h>
#include <ui/Input.h>
#include <utils/RefBase.h>
#include <utils/Looper.h>
#include <utils/String8.h>
-#include <surfaceflinger/Surface.h>
-#include <surfaceflinger/SurfaceComposerClient.h>
-#include <surfaceflinger/ISurfaceComposer.h>
-
#include <SkBitmap.h>
namespace android {
@@ -86,7 +84,7 @@
INACTIVITY_FADE_DELAY_SHORT = 1,
};
- PointerController(const sp<Looper>& looper, int32_t pointerLayer);
+ PointerController(const sp<Looper>& looper, const sp<SpriteController>& spriteController);
virtual bool getBounds(float* outMinX, float* outMinY,
float* outMaxX, float* outMaxY) const;
@@ -111,9 +109,8 @@
mutable Mutex mLock;
sp<Looper> mLooper;
- int32_t mPointerLayer;
- sp<SurfaceComposerClient> mSurfaceComposerClient;
- sp<SurfaceControl> mSurfaceControl;
+ sp<SpriteController> mSpriteController;
+ sp<WeakMessageHandler> mHandler;
struct Locked {
int32_t displayWidth;
@@ -124,26 +121,17 @@
float pointerY;
uint32_t buttonState;
- SkBitmap* iconBitmap;
- float iconHotSpotX;
- float iconHotSpotY;
-
float fadeAlpha;
InactivityFadeDelay inactivityFadeDelay;
- bool wantVisible;
bool visible;
- bool drawn;
- } mLocked;
- sp<WeakMessageHandler> mHandler;
+ sp<Sprite> sprite;
+ } mLocked;
bool getBoundsLocked(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const;
void setPositionLocked(float x, float y);
void updateLocked();
- bool createSurfaceIfNeededLocked();
- bool drawPointerIfNeededLocked();
- bool resizeSurfaceLocked(int32_t width, int32_t height);
void handleMessage(const Message& message);
bool unfadeBeforeUpdateLocked();