summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/binder/CursorWindow.h200
-rw-r--r--include/surfaceflinger/ISurfaceComposer.h1
-rw-r--r--include/surfaceflinger/Surface.h6
-rw-r--r--include/ui/EventHub.h23
-rw-r--r--include/ui/GraphicBuffer.h7
-rw-r--r--include/ui/Input.h3
-rw-r--r--include/ui/InputDispatcher.h14
-rw-r--r--include/ui/InputReader.h23
-rwxr-xr-xinclude/ui/KeycodeLabels.h56
-rw-r--r--include/utils/Singleton.h5
-rw-r--r--include/utils/String8.h8
11 files changed, 337 insertions, 9 deletions
diff --git a/include/binder/CursorWindow.h b/include/binder/CursorWindow.h
new file mode 100644
index 0000000000..4fbff2ac94
--- /dev/null
+++ b/include/binder/CursorWindow.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ANDROID__DATABASE_WINDOW_H
+#define _ANDROID__DATABASE_WINDOW_H
+
+#include <cutils/log.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <binder/IMemory.h>
+#include <utils/RefBase.h>
+
+#define DEFAULT_WINDOW_SIZE 4096
+#define MAX_WINDOW_SIZE (1024 * 1024)
+#define WINDOW_ALLOCATION_SIZE 4096
+
+#define ROW_SLOT_CHUNK_NUM_ROWS 16
+
+// Row slots are allocated in chunks of ROW_SLOT_CHUNK_NUM_ROWS,
+// with an offset after the rows that points to the next chunk
+#define ROW_SLOT_CHUNK_SIZE ((ROW_SLOT_CHUNK_NUM_ROWS * sizeof(row_slot_t)) + sizeof(uint32_t))
+
+
+#if LOG_NDEBUG
+
+#define IF_LOG_WINDOW() if (false)
+#define LOG_WINDOW(...)
+
+#else
+
+#define IF_LOG_WINDOW() IF_LOG(LOG_DEBUG, "CursorWindow")
+#define LOG_WINDOW(...) LOG(LOG_DEBUG, "CursorWindow", __VA_ARGS__)
+
+#endif
+
+
+// When defined to true strings are stored as UTF8, otherwise they're UTF16
+#define WINDOW_STORAGE_UTF8 1
+
+// When defined to true numberic values are stored inline in the field_slot_t, otherwise they're allocated in the window
+#define WINDOW_STORAGE_INLINE_NUMERICS 1
+
+namespace android {
+
+typedef struct
+{
+ uint32_t numRows;
+ uint32_t numColumns;
+} window_header_t;
+
+typedef struct
+{
+ uint32_t offset;
+} row_slot_t;
+
+typedef struct
+{
+ uint8_t type;
+ union {
+ double d;
+ int64_t l;
+ struct {
+ uint32_t offset;
+ uint32_t size;
+ } buffer;
+ } data;
+} __attribute__((packed)) field_slot_t;
+
+#define FIELD_TYPE_NULL 0
+#define FIELD_TYPE_INTEGER 1
+#define FIELD_TYPE_FLOAT 2
+#define FIELD_TYPE_STRING 3
+#define FIELD_TYPE_BLOB 4
+
+/**
+ * This class stores a set of rows from a database in a buffer. The begining of the
+ * window has first chunk of row_slot_ts, which are offsets to the row directory, followed by
+ * an offset to the next chunk in a linked-list of additional chunk of row_slot_ts in case
+ * the pre-allocated chunk isn't big enough to refer to all rows. Each row directory has a
+ * field_slot_t per column, which has the size, offset, and type of the data for that field.
+ * Note that the data types come from sqlite3.h.
+ */
+class CursorWindow
+{
+public:
+ CursorWindow(size_t maxSize);
+ CursorWindow(){}
+ bool setMemory(const sp<IMemory>&);
+ ~CursorWindow();
+
+ bool initBuffer(bool localOnly);
+ sp<IMemory> getMemory() {return mMemory;}
+
+ size_t size() {return mSize;}
+ uint8_t * data() {return mData;}
+ uint32_t getNumRows() {return mHeader->numRows;}
+ uint32_t getNumColumns() {return mHeader->numColumns;}
+ void freeLastRow() {
+ if (mHeader->numRows > 0) {
+ mHeader->numRows--;
+ }
+ }
+ bool setNumColumns(uint32_t numColumns)
+ {
+ uint32_t cur = mHeader->numColumns;
+ if (cur > 0 && cur != numColumns) {
+ LOGE("Trying to go from %d columns to %d", cur, numColumns);
+ return false;
+ }
+ mHeader->numColumns = numColumns;
+ return true;
+ }
+
+ int32_t freeSpace();
+
+ void clear();
+
+ /**
+ * Allocate a row slot and its directory. The returned
+ * pointer points to the begining of the row's directory
+ * or NULL if there wasn't room. The directory is
+ * initialied with NULL entries for each field.
+ */
+ field_slot_t * allocRow();
+
+ /**
+ * Allocate a portion of the window. Returns the offset
+ * of the allocation, or 0 if there isn't enough space.
+ * If aligned is true, the allocation gets 4 byte alignment.
+ */
+ uint32_t alloc(size_t size, bool aligned = false);
+
+ uint32_t read_field_slot(int row, int column, field_slot_t * slot);
+
+ /**
+ * Copy data into the window at the given offset.
+ */
+ void copyIn(uint32_t offset, uint8_t const * data, size_t size);
+ void copyIn(uint32_t offset, int64_t data);
+ void copyIn(uint32_t offset, double data);
+
+ void copyOut(uint32_t offset, uint8_t * data, size_t size);
+ int64_t copyOutLong(uint32_t offset);
+ double copyOutDouble(uint32_t offset);
+
+ bool putLong(unsigned int row, unsigned int col, int64_t value);
+ bool putDouble(unsigned int row, unsigned int col, double value);
+ bool putNull(unsigned int row, unsigned int col);
+
+ bool getLong(unsigned int row, unsigned int col, int64_t * valueOut);
+ bool getDouble(unsigned int row, unsigned int col, double * valueOut);
+ bool getNull(unsigned int row, unsigned int col, bool * valueOut);
+
+ uint8_t * offsetToPtr(uint32_t offset) {return mData + offset;}
+
+ row_slot_t * allocRowSlot();
+
+ row_slot_t * getRowSlot(int row);
+
+ /**
+ * return NULL if Failed to find rowSlot or
+ * Invalid rowSlot
+ */
+ field_slot_t * getFieldSlotWithCheck(int row, int column);
+ field_slot_t * getFieldSlot(int row, int column)
+ {
+ int fieldDirOffset = getRowSlot(row)->offset;
+ return ((field_slot_t *)offsetToPtr(fieldDirOffset)) + column;
+ }
+
+private:
+ uint8_t * mData;
+ size_t mSize;
+ size_t mMaxSize;
+ window_header_t * mHeader;
+ sp<IMemory> mMemory;
+
+ /**
+ * Offset of the lowest unused data byte in the array.
+ */
+ uint32_t mFreeOffset;
+};
+
+}; // namespace android
+
+#endif
diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h
index da4d56f99f..db57859895 100644
--- a/include/surfaceflinger/ISurfaceComposer.h
+++ b/include/surfaceflinger/ISurfaceComposer.h
@@ -43,6 +43,7 @@ public:
eSecure = 0x00000080,
eNonPremultiplied = 0x00000100,
ePushBuffers = 0x00000200,
+ eOpaque = 0x00000400,
eFXSurfaceNormal = 0x00000000,
eFXSurfaceBlur = 0x00010000,
diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h
index 22684db8f2..cef439c170 100644
--- a/include/surfaceflinger/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -94,7 +94,7 @@ private:
friend class SurfaceComposerClient;
// camera and camcorder need access to the ISurface binder interface for preview
- friend class Camera;
+ friend class CameraService;
friend class MediaRecorder;
// mediaplayer needs access to ISurface for display
friend class MediaPlayer;
@@ -173,11 +173,12 @@ private:
* (eventually this should go away and be replaced by proper APIs)
*/
// camera and camcorder need access to the ISurface binder interface for preview
- friend class Camera;
+ friend class CameraService;
friend class MediaRecorder;
// MediaPlayer needs access to ISurface for display
friend class MediaPlayer;
friend class IOMX;
+ friend class SoftwareRenderer;
// this is just to be able to write some unit tests
friend class Test;
@@ -314,4 +315,3 @@ private:
}; // namespace android
#endif // ANDROID_SF_SURFACE_H
-
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h
index d78e35fbfa..1431964865 100644
--- a/include/ui/EventHub.h
+++ b/include/ui/EventHub.h
@@ -187,6 +187,9 @@ public:
virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, const int32_t* keyCodes,
uint8_t* outFlags) const = 0;
+ virtual bool hasLed(int32_t deviceId, int32_t led) const = 0;
+ virtual void setLedState(int32_t deviceId, int32_t led, bool on) = 0;
+
virtual void dump(String8& dump) = 0;
};
@@ -198,9 +201,9 @@ public:
status_t errorCheck() const;
virtual uint32_t getDeviceClasses(int32_t deviceId) const;
-
+
virtual String8 getDeviceName(int32_t deviceId) const;
-
+
virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis,
RawAbsoluteAxisInfo* outAxisInfo) const;
@@ -218,6 +221,9 @@ public:
virtual bool getEvent(RawEvent* outEvent);
+ virtual bool hasLed(int32_t deviceId, int32_t led) const;
+ virtual void setLedState(int32_t deviceId, int32_t led, bool on);
+
virtual void dump(String8& dump);
protected:
@@ -240,7 +246,10 @@ private:
uint32_t classes;
uint8_t* keyBitmask;
KeyLayoutMap* layoutMap;
- String8 keylayoutFilename;
+ String8 keyMapName;
+ bool defaultKeyMap;
+ String8 keyLayoutFilename;
+ String8 keyCharacterMapFilename;
int fd;
device_t* next;
@@ -250,13 +259,19 @@ private:
device_t* getDeviceLocked(int32_t deviceId) const;
bool hasKeycodeLocked(device_t* device, int keycode) const;
-
+
int32_t getScanCodeStateLocked(device_t* device, int32_t scanCode) const;
int32_t getKeyCodeStateLocked(device_t* device, int32_t keyCode) const;
int32_t getSwitchStateLocked(device_t* device, int32_t sw) const;
bool markSupportedKeyCodesLocked(device_t* device, size_t numCodes,
const int32_t* keyCodes, uint8_t* outFlags) const;
+ void configureKeyMap(device_t* device);
+ bool probeKeyMap(device_t* device, const String8& keyMapName, bool defaultKeyMap);
+ void selectKeyMap(device_t* device, const String8& keyMapName, bool defaultKeyMap);
+ void setKeyboardProperties(device_t* device, bool firstKeyboard);
+ void clearKeyboardProperties(device_t* device, bool firstKeyboard);
+
// Protect all internal state.
mutable Mutex mLock;
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index a3e85a96aa..c446633bc4 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -72,6 +72,9 @@ public:
GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
uint32_t stride, native_handle_t* handle, bool keepOwnership);
+ // create a buffer from an existing android_native_buffer_t
+ GraphicBuffer(android_native_buffer_t* buffer, bool keepOwnership);
+
// return status
status_t initCheck() const;
@@ -137,6 +140,10 @@ private:
GraphicBufferMapper& mBufferMapper;
ssize_t mInitCheck;
int mIndex;
+
+ // If we're wrapping another buffer then this reference will make sure it
+ // doesn't get freed.
+ sp<android_native_buffer_t> mWrappedBuffer;
};
}; // namespace android
diff --git a/include/ui/Input.h b/include/ui/Input.h
index 8c6018bfee..1355bab31c 100644
--- a/include/ui/Input.h
+++ b/include/ui/Input.h
@@ -76,7 +76,7 @@ namespace android {
*/
enum {
/* These flags originate in RawEvents and are generally set in the key map.
- * See also labels for policy flags in KeycodeLabels.h. */
+ * NOTE: If you edit these flags, also edit labels in KeycodeLabels.h. */
POLICY_FLAG_WAKE = 0x00000001,
POLICY_FLAG_WAKE_DROPPED = 0x00000002,
@@ -87,6 +87,7 @@ enum {
POLICY_FLAG_MENU = 0x00000040,
POLICY_FLAG_LAUNCHER = 0x00000080,
POLICY_FLAG_VIRTUAL = 0x00000100,
+ POLICY_FLAG_FUNCTION = 0x00000200,
POLICY_FLAG_RAW_MASK = 0x0000ffff,
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h
index b0b855edb0..738f62a284 100644
--- a/include/ui/InputDispatcher.h
+++ b/include/ui/InputDispatcher.h
@@ -387,6 +387,14 @@ public:
*/
virtual void setInputDispatchMode(bool enabled, bool frozen) = 0;
+ /* Transfers touch focus from the window associated with one channel to the
+ * window associated with the other channel.
+ *
+ * Returns true on success. False if the window did not actually have touch focus.
+ */
+ virtual bool transferTouchFocus(const sp<InputChannel>& fromChannel,
+ const sp<InputChannel>& toChannel) = 0;
+
/* Registers or unregister input channels that may be used as targets for input events.
* If monitor is true, the channel will receive a copy of all input events.
*
@@ -443,6 +451,9 @@ public:
virtual void setFocusedApplication(const InputApplication* inputApplication);
virtual void setInputDispatchMode(bool enabled, bool frozen);
+ virtual bool transferTouchFocus(const sp<InputChannel>& fromChannel,
+ const sp<InputChannel>& toChannel);
+
virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel, bool monitor);
virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel);
@@ -744,6 +755,9 @@ private:
// Clears the current state.
void clear();
+ // Copies pointer-related parts of the input state to another instance.
+ void copyPointerStateTo(InputState& other) const;
+
private:
struct KeyMemento {
int32_t deviceId;
diff --git a/include/ui/InputReader.h b/include/ui/InputReader.h
index 49351b0ca5..f3a2dd269e 100644
--- a/include/ui/InputReader.h
+++ b/include/ui/InputReader.h
@@ -422,9 +422,18 @@ private:
Vector<KeyDown> keyDowns; // keys that are down
int32_t metaState;
nsecs_t downTime; // time of most recent key down
+
+ struct LedState {
+ bool avail; // led is available
+ bool on; // we think the led is currently on
+ };
+ LedState capsLockLedState;
+ LedState numLockLedState;
+ LedState scrollLockLedState;
} mLocked;
void initializeLocked();
+ void initializeLedStateLocked(LockedState::LedState& ledState, int32_t led);
bool isKeyboardOrGamepadKey(int32_t scanCode);
@@ -432,6 +441,10 @@ private:
uint32_t policyFlags);
ssize_t findKeyDownLocked(int32_t scanCode);
+
+ void updateLedStateLocked(bool reset);
+ void updateLedStateForModifierLocked(LockedState::LedState& ledState, int32_t led,
+ int32_t modifier, bool reset);
};
@@ -589,6 +602,16 @@ protected:
// Immutable calibration parameters in parsed form.
struct Calibration {
+ // Position
+ bool haveXOrigin;
+ int32_t xOrigin;
+ bool haveYOrigin;
+ int32_t yOrigin;
+ bool haveXScale;
+ float xScale;
+ bool haveYScale;
+ float yScale;
+
// Touch Size
enum TouchSizeCalibration {
TOUCH_SIZE_CALIBRATION_DEFAULT,
diff --git a/include/ui/KeycodeLabels.h b/include/ui/KeycodeLabels.h
index f71d9cdf4d..ef2b6b33d3 100755
--- a/include/ui/KeycodeLabels.h
+++ b/include/ui/KeycodeLabels.h
@@ -135,6 +135,59 @@ static const KeycodeLabel KEYCODES[] = {
{ "BUTTON_START", 108 },
{ "BUTTON_SELECT", 109 },
{ "BUTTON_MODE", 110 },
+ { "ESCAPE", 111 },
+ { "FORWARD_DEL", 112 },
+ { "CTRL_LEFT", 113 },
+ { "CTRL_RIGHT", 114 },
+ { "CAPS_LOCK", 115 },
+ { "SCROLL_LOCK", 116 },
+ { "META_LEFT", 117 },
+ { "META_RIGHT", 118 },
+ { "FUNCTION", 119 },
+ { "SYSRQ", 120 },
+ { "BREAK", 121 },
+ { "MOVE_HOME", 122 },
+ { "MOVE_END", 123 },
+ { "INSERT", 124 },
+ { "FORWARD", 125 },
+ { "MEDIA_PLAY", 126 },
+ { "MEDIA_PAUSE", 127 },
+ { "MEDIA_CLOSE", 128 },
+ { "MEDIA_EJECT", 129 },
+ { "MEDIA_RECORD", 130 },
+ { "F1", 131 },
+ { "F2", 132 },
+ { "F3", 133 },
+ { "F4", 134 },
+ { "F5", 135 },
+ { "F6", 136 },
+ { "F7", 137 },
+ { "F8", 138 },
+ { "F9", 139 },
+ { "F10", 140 },
+ { "F11", 141 },
+ { "F12", 142 },
+ { "NUM_LOCK", 143 },
+ { "NUMPAD_0", 144 },
+ { "NUMPAD_1", 145 },
+ { "NUMPAD_2", 146 },
+ { "NUMPAD_3", 147 },
+ { "NUMPAD_4", 148 },
+ { "NUMPAD_5", 149 },
+ { "NUMPAD_6", 150 },
+ { "NUMPAD_7", 151 },
+ { "NUMPAD_8", 152 },
+ { "NUMPAD_9", 153 },
+ { "NUMPAD_DIVIDE", 154 },
+ { "NUMPAD_MULTIPLY", 155 },
+ { "NUMPAD_SUBTRACT", 156 },
+ { "NUMPAD_ADD", 157 },
+ { "NUMPAD_DOT", 158 },
+ { "NUMPAD_COMMA", 159 },
+ { "NUMPAD_ENTER", 160 },
+ { "NUMPAD_EQUALS", 161 },
+ { "NUMPAD_LEFT_PAREN", 162 },
+ { "NUMPAD_RIGHT_PAREN", 163 },
// NOTE: If you add a new keycode here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
@@ -142,7 +195,7 @@ static const KeycodeLabel KEYCODES[] = {
{ NULL, 0 }
};
-// See also policy flags in Input.h.
+// NOTE: If you edit these flags, also edit policy flags in Input.h.
static const KeycodeLabel FLAGS[] = {
{ "WAKE", 0x00000001 },
{ "WAKE_DROPPED", 0x00000002 },
@@ -153,6 +206,7 @@ static const KeycodeLabel FLAGS[] = {
{ "MENU", 0x00000040 },
{ "LAUNCHER", 0x00000080 },
{ "VIRTUAL", 0x00000100 },
+ { "FUNCTION", 0x00000200 },
{ NULL, 0 }
};
diff --git a/include/utils/Singleton.h b/include/utils/Singleton.h
index 3b975b4c44..e1ee8eb068 100644
--- a/include/utils/Singleton.h
+++ b/include/utils/Singleton.h
@@ -37,6 +37,11 @@ public:
}
return *instance;
}
+
+ static bool hasInstance() {
+ Mutex::Autolock _l(sLock);
+ return sInstance != 0;
+ }
protected:
~Singleton() { };
diff --git a/include/utils/String8.h b/include/utils/String8.h
index ef0b51a443..cef8ecab96 100644
--- a/include/utils/String8.h
+++ b/include/utils/String8.h
@@ -157,9 +157,12 @@ public:
inline size_t size() const;
inline size_t length() const;
inline size_t bytes() const;
+ inline bool isEmpty() const;
inline const SharedBuffer* sharedBuffer() const;
+ void clear();
+
void setTo(const String8& other);
status_t setTo(const char* other);
status_t setTo(const char* other, size_t numChars);
@@ -345,6 +348,11 @@ inline size_t String8::size() const
return length();
}
+inline bool String8::isEmpty() const
+{
+ return length() == 0;
+}
+
inline size_t String8::bytes() const
{
return SharedBuffer::sizeFromData(mString)-1;