summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/android_runtime/android_app_NativeActivity.h72
-rw-r--r--include/binder/Parcel.h6
-rw-r--r--include/media/stagefright/MPEG4Writer.h2
-rw-r--r--include/media/stagefright/MetaData.h1
-rw-r--r--include/ui/EventHub.h26
-rw-r--r--include/ui/Input.h63
-rw-r--r--include/ui/InputDevice.h19
-rw-r--r--include/ui/InputDispatcher.h16
-rw-r--r--include/ui/InputTransport.h10
-rw-r--r--include/utils/AssetManager.h20
10 files changed, 201 insertions, 34 deletions
diff --git a/include/android_runtime/android_app_NativeActivity.h b/include/android_runtime/android_app_NativeActivity.h
index d7a9a2c..c388ba8 100644
--- a/include/android_runtime/android_app_NativeActivity.h
+++ b/include/android_runtime/android_app_NativeActivity.h
@@ -42,8 +42,26 @@ extern void android_NativeActivity_hideSoftInput(
/*
* NDK input queue API.
+ *
+ * Here is the event flow:
+ * 1. Event arrives in input consumer, and is returned by getEvent().
+ * 2. Application calls preDispatchEvent():
+ * a. Event is assigned a sequence ID and enqueued in mPreDispatchingKeys.
+ * b. Main thread picks up event, hands to input method.
+ * c. Input method eventually returns sequence # and whether it was handled.
+ * d. finishPreDispatch() is called to enqueue the information.
+ * e. next getEvent() call will:
+ * - finish any pre-dispatch events that the input method handled
+ * - return the next pre-dispatched event that the input method didn't handle.
+ * f. (A preDispatchEvent() call on this event will now return false).
+ * 3. Application calls finishEvent() with whether it was handled.
+ * - If handled is true, the event is finished.
+ * - If handled is false, the event is put on mUnhandledKeys, and:
+ * a. Main thread receives event from consumeUnhandledEvent().
+ * b. Java sends event through default key handler.
+ * c. event is finished.
*/
-struct AInputQueue {
+struct AInputQueue : public android::InputEventFactoryInterface {
public:
/* Creates a consumer associated with an input channel. */
explicit AInputQueue(const android::sp<android::InputChannel>& channel, int workWrite);
@@ -59,8 +77,9 @@ public:
int32_t getEvent(AInputEvent** outEvent);
- void finishEvent(AInputEvent* event, bool handled);
+ bool preDispatchEvent(AInputEvent* event);
+ void finishEvent(AInputEvent* event, bool handled);
// ----------------------------------------------------------
@@ -68,28 +87,63 @@ public:
void dispatchEvent(android::KeyEvent* event);
+ void finishPreDispatch(int seq, bool handled);
+
android::KeyEvent* consumeUnhandledEvent();
+ android::KeyEvent* consumePreDispatchingEvent(int* outSeq);
+
+ virtual android::KeyEvent* createKeyEvent();
+ virtual android::MotionEvent* createMotionEvent();
int mWorkWrite;
private:
- void doDefaultKey(android::KeyEvent* keyEvent);
+ void doUnhandledKey(android::KeyEvent* keyEvent);
+ bool preDispatchKey(android::KeyEvent* keyEvent);
+ void wakeupDispatch();
android::InputConsumer mConsumer;
- android::PreallocatedInputEventFactory mInputEventFactory;
android::sp<android::PollLoop> mPollLoop;
int mDispatchKeyRead;
int mDispatchKeyWrite;
- // This is only touched by the event reader thread. It is the current
- // key events that came out of the mDispatchingKeys list and are now
- //Êdelivered to the app.
- android::Vector<android::KeyEvent*> mDeliveringKeys;
+ struct in_flight_event {
+ android::InputEvent* event;
+ int seq;
+ bool doFinish;
+ };
+
+ struct finish_pre_dispatch {
+ int seq;
+ bool handled;
+ };
android::Mutex mLock;
- android::Vector<android::KeyEvent*> mPendingKeys;
+
+ int mSeq;
+
+ // Cache of previously allocated key events.
+ android::Vector<android::KeyEvent*> mAvailKeyEvents;
+ // Cache of previously allocated motion events.
+ android::Vector<android::MotionEvent*> mAvailMotionEvents;
+
+ // All input events that are actively being processed.
+ android::Vector<in_flight_event> mInFlightEvents;
+
+ // Key events that the app didn't handle, and are pending for
+ // delivery to the activity's default key handling.
+ android::Vector<android::KeyEvent*> mUnhandledKeys;
+
+ // Keys that arrived in the Java framework and need to be
+ // dispatched to the app.
android::Vector<android::KeyEvent*> mDispatchingKeys;
+
+ // Key events that are pending to be pre-dispatched to the IME.
+ android::Vector<in_flight_event> mPreDispatchingKeys;
+
+ // Event sequence numbers that we have finished pre-dispatching.
+ android::Vector<finish_pre_dispatch> mFinishPreDispatches;
};
#endif // _ANDROID_APP_NATIVEACTIVITY_H
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 3aba5f6..fd0fc1f 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -58,9 +58,13 @@ public:
// Writes the RPC header.
status_t writeInterfaceToken(const String16& interface);
+
// Parses the RPC header, returning true if the interface name
// in the header matches the expected interface from the caller.
- bool enforceInterface(const String16& interface) const;
+ // If strict_policy_out is non-NULL, the RPC header's StrictMode policy
+ // mask is returned.
+ bool enforceInterface(const String16& interface,
+ int32_t* strict_policy_out = NULL) const;
bool checkInterface(IBinder*) const;
void freeData();
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h
index 962b38b..232583a 100644
--- a/include/media/stagefright/MPEG4Writer.h
+++ b/include/media/stagefright/MPEG4Writer.h
@@ -52,6 +52,7 @@ public:
void endBox();
uint32_t interleaveDuration() const { return mInterleaveDurationUs; }
status_t setInterleaveDuration(uint32_t duration);
+ int32_t getTimeScale() const { return mTimeScale; }
protected:
virtual ~MPEG4Writer();
@@ -72,6 +73,7 @@ private:
bool mStreamableFile;
off_t mEstimatedMoovBoxSize;
uint32_t mInterleaveDurationUs;
+ int32_t mTimeScale;
int64_t mStartTimestampUs;
Mutex mLock;
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index 73f5547..cdbf483 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -68,6 +68,7 @@ enum {
kKeyDiscNumber = 'dnum', // cstring
kKeyDate = 'date', // cstring
kKeyWriter = 'writ', // cstring
+ kKeyTimeScale = 'tmsl', // int32_t
// video profile and level
kKeyVideoProfile = 'vprf', // int32_t
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h
index d322a34..5be17d3 100644
--- a/include/ui/EventHub.h
+++ b/include/ui/EventHub.h
@@ -60,6 +60,32 @@ namespace android {
class KeyLayoutMap;
/*
+ * Input device classes.
+ */
+enum {
+ /* The input device is a keyboard. */
+ INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001,
+
+ /* The input device is an alpha-numeric keyboard (not just a dial pad). */
+ INPUT_DEVICE_CLASS_ALPHAKEY = 0x00000002,
+
+ /* The input device is a touchscreen (either single-touch or multi-touch). */
+ INPUT_DEVICE_CLASS_TOUCHSCREEN = 0x00000004,
+
+ /* The input device is a trackball. */
+ INPUT_DEVICE_CLASS_TRACKBALL = 0x00000008,
+
+ /* The input device is a multi-touch touchscreen. */
+ INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010,
+
+ /* The input device is a directional pad. */
+ INPUT_DEVICE_CLASS_DPAD = 0x00000020,
+
+ /* The input device is a gamepad (implies keyboard). */
+ INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040
+};
+
+/*
* Grand Central Station for events.
*
* The event hub aggregates input events received across all known input
diff --git a/include/ui/Input.h b/include/ui/Input.h
index a7d23d4..d9b1091 100644
--- a/include/ui/Input.h
+++ b/include/ui/Input.h
@@ -32,7 +32,7 @@ enum {
/*
* Private control to determine when an app is tracking a key sequence.
*/
- KEY_EVENT_FLAG_START_TRACKING = 0x40000000
+ AKEY_EVENT_FLAG_START_TRACKING = 0x40000000
};
/*
@@ -130,6 +130,11 @@ struct PointerCoords {
float y;
float pressure;
float size;
+ float touchMajor;
+ float touchMinor;
+ float toolMajor;
+ float toolMinor;
+ float orientation;
};
/*
@@ -143,14 +148,15 @@ public:
inline int32_t getDeviceId() const { return mDeviceId; }
- inline int32_t getNature() const { return mNature; }
+ inline int32_t getSource() const { return mSource; }
protected:
- void initialize(int32_t deviceId, int32_t nature);
+ void initialize(int32_t deviceId, int32_t source);
+ void initialize(const InputEvent& from);
private:
int32_t mDeviceId;
- int32_t mNature;
+ int32_t mSource;
};
/*
@@ -160,7 +166,7 @@ class KeyEvent : public InputEvent {
public:
virtual ~KeyEvent() { }
- virtual int32_t getType() const { return INPUT_EVENT_TYPE_KEY; }
+ virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; }
inline int32_t getAction() const { return mAction; }
@@ -188,7 +194,7 @@ public:
void initialize(
int32_t deviceId,
- int32_t nature,
+ int32_t source,
int32_t action,
int32_t flags,
int32_t keyCode,
@@ -197,6 +203,7 @@ public:
int32_t repeatCount,
nsecs_t downTime,
nsecs_t eventTime);
+ void initialize(const KeyEvent& from);
private:
int32_t mAction;
@@ -216,7 +223,7 @@ class MotionEvent : public InputEvent {
public:
virtual ~MotionEvent() { }
- virtual int32_t getType() const { return INPUT_EVENT_TYPE_MOTION; }
+ virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }
inline int32_t getAction() const { return mAction; }
@@ -264,6 +271,26 @@ public:
return getCurrentPointerCoords(pointerIndex).size;
}
+ inline float getTouchMajor(size_t pointerIndex) const {
+ return getCurrentPointerCoords(pointerIndex).touchMajor;
+ }
+
+ inline float getTouchMinor(size_t pointerIndex) const {
+ return getCurrentPointerCoords(pointerIndex).touchMinor;
+ }
+
+ inline float getToolMajor(size_t pointerIndex) const {
+ return getCurrentPointerCoords(pointerIndex).toolMajor;
+ }
+
+ inline float getToolMinor(size_t pointerIndex) const {
+ return getCurrentPointerCoords(pointerIndex).toolMinor;
+ }
+
+ inline float getOrientation(size_t pointerIndex) const {
+ return getCurrentPointerCoords(pointerIndex).orientation;
+ }
+
inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }
inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
@@ -294,9 +321,29 @@ public:
return getHistoricalPointerCoords(pointerIndex, historicalIndex).size;
}
+ inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMajor;
+ }
+
+ inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMinor;
+ }
+
+ inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMajor;
+ }
+
+ inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMinor;
+ }
+
+ inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalPointerCoords(pointerIndex, historicalIndex).orientation;
+ }
+
void initialize(
int32_t deviceId,
- int32_t nature,
+ int32_t source,
int32_t action,
int32_t edgeFlags,
int32_t metaState,
diff --git a/include/ui/InputDevice.h b/include/ui/InputDevice.h
index 4420600..3b9c70e 100644
--- a/include/ui/InputDevice.h
+++ b/include/ui/InputDevice.h
@@ -42,6 +42,7 @@ namespace android {
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);
extern int32_t rotateKeyCode(int32_t keyCode, int32_t orientation);
+
/*
* An input device structure tracks the state of a single input device.
*
@@ -168,8 +169,11 @@ struct InputDevice {
FIELD_ABS_MT_POSITION_X = 1,
FIELD_ABS_MT_POSITION_Y = 2,
FIELD_ABS_MT_TOUCH_MAJOR = 4,
- FIELD_ABS_MT_WIDTH_MAJOR = 8,
- FIELD_ABS_MT_TRACKING_ID = 16
+ FIELD_ABS_MT_TOUCH_MINOR = 8,
+ FIELD_ABS_MT_WIDTH_MAJOR = 16,
+ FIELD_ABS_MT_WIDTH_MINOR = 32,
+ FIELD_ABS_MT_ORIENTATION = 64,
+ FIELD_ABS_MT_TRACKING_ID = 128
};
uint32_t pointerCount;
@@ -179,7 +183,10 @@ struct InputDevice {
int32_t absMTPositionX;
int32_t absMTPositionY;
int32_t absMTTouchMajor;
+ int32_t absMTTouchMinor;
int32_t absMTWidthMajor;
+ int32_t absMTWidthMinor;
+ int32_t absMTOrientation;
int32_t absMTTrackingId;
inline void clear() {
@@ -206,6 +213,11 @@ struct InputDevice {
int32_t y;
int32_t pressure;
int32_t size;
+ int32_t touchMajor;
+ int32_t touchMinor;
+ int32_t toolMajor;
+ int32_t toolMinor;
+ int32_t orientation;
};
struct TouchData {
@@ -236,6 +248,7 @@ struct InputDevice {
AbsoluteAxisInfo yAxis;
AbsoluteAxisInfo pressureAxis;
AbsoluteAxisInfo sizeAxis;
+ AbsoluteAxisInfo orientationAxis;
} parameters;
// The touch data of the current sample being processed.
@@ -290,6 +303,8 @@ struct InputDevice {
int32_t sizeOrigin;
float sizeScale;
+
+ float orientationScale;
} precalculated;
void reset();
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h
index eb8f820..674852a 100644
--- a/include/ui/InputDispatcher.h
+++ b/include/ui/InputDispatcher.h
@@ -167,10 +167,10 @@ public:
*/
virtual void notifyConfigurationChanged(nsecs_t eventTime) = 0;
virtual void notifyAppSwitchComing(nsecs_t eventTime) = 0;
- virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature,
+ virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
int32_t scanCode, int32_t metaState, nsecs_t downTime) = 0;
- virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature,
+ virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
float xPrecision, float yPrecision, nsecs_t downTime) = 0;
@@ -232,10 +232,10 @@ public:
virtual void notifyConfigurationChanged(nsecs_t eventTime);
virtual void notifyAppSwitchComing(nsecs_t eventTime);
- virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature,
+ virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
int32_t scanCode, int32_t metaState, nsecs_t downTime);
- virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature,
+ virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags,
uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
float xPrecision, float yPrecision, nsecs_t downTime);
@@ -281,7 +281,7 @@ private:
struct KeyEntry : EventEntry {
int32_t deviceId;
- int32_t nature;
+ int32_t source;
uint32_t policyFlags;
int32_t action;
int32_t flags;
@@ -301,7 +301,7 @@ private:
struct MotionEntry : EventEntry {
int32_t deviceId;
- int32_t nature;
+ int32_t source;
uint32_t policyFlags;
int32_t action;
int32_t metaState;
@@ -424,11 +424,11 @@ private:
ConfigurationChangedEntry* obtainConfigurationChangedEntry(nsecs_t eventTime);
KeyEntry* obtainKeyEntry(nsecs_t eventTime,
- int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action,
+ int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState,
int32_t repeatCount, nsecs_t downTime);
MotionEntry* obtainMotionEntry(nsecs_t eventTime,
- int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action,
+ int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
int32_t metaState, int32_t edgeFlags, float xPrecision, float yPrecision,
nsecs_t downTime, uint32_t pointerCount,
const int32_t* pointerIds, const PointerCoords* pointerCoords);
diff --git a/include/ui/InputTransport.h b/include/ui/InputTransport.h
index 226d1d5..31ec701 100644
--- a/include/ui/InputTransport.h
+++ b/include/ui/InputTransport.h
@@ -119,7 +119,7 @@ struct InputMessage {
};
int32_t deviceId;
- int32_t nature;
+ int32_t source;
union {
struct {
@@ -198,7 +198,7 @@ public:
*/
status_t publishKeyEvent(
int32_t deviceId,
- int32_t nature,
+ int32_t source,
int32_t action,
int32_t flags,
int32_t keyCode,
@@ -216,7 +216,7 @@ public:
*/
status_t publishMotionEvent(
int32_t deviceId,
- int32_t nature,
+ int32_t source,
int32_t action,
int32_t edgeFlags,
int32_t metaState,
@@ -233,7 +233,7 @@ public:
/* Appends a motion sample to a motion event unless already consumed.
*
* Returns OK on success.
- * Returns INVALID_OPERATION if the current event is not a MOTION_EVENT_ACTION_MOVE event.
+ * Returns INVALID_OPERATION if the current event is not a AMOTION_EVENT_ACTION_MOVE event.
* Returns FAILED_TRANSACTION if the current event has already been consumed.
* Returns NO_MEMORY if the buffer is full and no additional samples can be added.
*/
@@ -272,7 +272,7 @@ private:
status_t publishInputEvent(
int32_t type,
int32_t deviceId,
- int32_t nature);
+ int32_t source);
};
/*
diff --git a/include/utils/AssetManager.h b/include/utils/AssetManager.h
index d8994e0..97694ff 100644
--- a/include/utils/AssetManager.h
+++ b/include/utils/AssetManager.h
@@ -29,6 +29,24 @@
#include <utils/ZipFileRO.h>
#include <utils/threads.h>
+/*
+ * Native-app access is via the opaque typedef struct AAssetManager in the C namespace.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct AAssetManager { };
+
+#ifdef __cplusplus
+};
+#endif
+
+
+/*
+ * Now the proper C++ android-namespace definitions
+ */
+
namespace android {
class Asset; // fwd decl for things that include Asset.h first
@@ -48,7 +66,7 @@ struct ResTable_config;
* The asset hierarchy may be examined like a filesystem, using
* AssetDir objects to peruse a single directory.
*/
-class AssetManager {
+class AssetManager : public AAssetManager {
public:
typedef enum CacheMode {
CACHE_UNKNOWN = 0,