Merge change 7490
* changes:
Fix master build errors post merge with master_gl branch.
diff --git a/include/private/ui/SharedState.h b/include/private/ui/SharedState.h
index 3bc7979..c9f6b5e 100644
--- a/include/private/ui/SharedState.h
+++ b/include/private/ui/SharedState.h
@@ -98,6 +98,8 @@
struct per_client_cblk_t // 4KB max
{
+ per_client_cblk_t() : lock(Mutex::SHARED) { }
+
Mutex lock;
Condition cv;
layer_cblk_t layers[NUM_LAYERS_MAX] __attribute__((aligned(32)));
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h
index e12c4f1..d9c0af2 100644
--- a/include/ui/EventHub.h
+++ b/include/ui/EventHub.h
@@ -73,6 +73,9 @@
int getKeycodeState(int key) const;
int getKeycodeState(int32_t deviceId, int key) const;
+ status_t scancodeToKeycode(int32_t deviceId, int scancode,
+ int32_t* outKeycode, uint32_t* outFlags) const;
+
// special type codes when devices are added/removed.
enum {
DEVICE_ADDED = 0x10000000,
@@ -121,7 +124,7 @@
mutable Mutex mLock;
bool mHaveFirstKeyboard;
- int32_t mFirstKeyboardId; // the API is that the build in keyboard is id 0, so map it
+ int32_t mFirstKeyboardId; // the API is that the built-in keyboard is id 0, so map it
struct device_ent {
device_t* device;
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 5c03965..e9b0788 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -190,8 +190,14 @@
*/
class Mutex {
public:
+ enum {
+ NORMAL = 0,
+ SHARED = 1
+ };
+
Mutex();
Mutex(const char* name);
+ Mutex(int type, const char* name = NULL);
~Mutex();
// lock or unlock the mutex
@@ -235,6 +241,17 @@
inline Mutex::Mutex(const char* name) {
pthread_mutex_init(&mMutex, NULL);
}
+inline Mutex::Mutex(int type, const char* name) {
+ if (type == SHARED) {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&mMutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+ } else {
+ pthread_mutex_init(&mMutex, NULL);
+ }
+}
inline Mutex::~Mutex() {
pthread_mutex_destroy(&mMutex);
}
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 598a356..ffc0278 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -212,6 +212,7 @@
} else {
mA2dpMixerThread->getTracks_l(tracks, activeTracks);
mHardwareMixerThread->putTracks_l(tracks, activeTracks);
+ mA2dpMixerThread->mOutput->standby();
}
mA2dpEnabled = enable;
mNotifyA2dpChange = true;
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 13c30a7..a72f055 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -240,6 +240,35 @@
return 0;
}
+status_t EventHub::scancodeToKeycode(int32_t deviceId, int scancode,
+ int32_t* outKeycode, uint32_t* outFlags) const
+{
+ AutoMutex _l(mLock);
+ device_t* device = getDevice(deviceId);
+
+ if (device != NULL && device->layoutMap != NULL) {
+ status_t err = device->layoutMap->map(scancode, outKeycode, outFlags);
+ if (err == NO_ERROR) {
+ return NO_ERROR;
+ }
+ }
+
+ if (mHaveFirstKeyboard) {
+ device = getDevice(mFirstKeyboardId);
+
+ if (device != NULL && device->layoutMap != NULL) {
+ status_t err = device->layoutMap->map(scancode, outKeycode, outFlags);
+ if (err == NO_ERROR) {
+ return NO_ERROR;
+ }
+ }
+ }
+
+ *outKeycode = 0;
+ *outFlags = 0;
+ return NAME_NOT_FOUND;
+}
+
EventHub::device_t* EventHub::getDevice(int32_t deviceId) const
{
if (deviceId == 0) deviceId = mFirstKeyboardId;
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index cce754a..be04777 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -298,10 +298,12 @@
}
if (m_header.entity.dataSize > 0) {
int pos = lseek(m_fd, m_dataEndPos, SEEK_SET);
- return pos == -1 ? (int)errno : (int)NO_ERROR;
- } else {
- return NO_ERROR;
+ if (pos == -1) {
+ return errno;
+ }
}
+ SKIP_PADDING();
+ return NO_ERROR;
}
ssize_t
diff --git a/opengl/include/EGL/eglnatives.h b/opengl/include/EGL/eglnatives.h
deleted file mode 100644
index 21622dc..0000000
--- a/opengl/include/EGL/eglnatives.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2007 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_EGLNATIVES_H
-#define ANDROID_EGLNATIVES_H
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*****************************************************************************/
-
-/* flags returned from swapBuffer */
-#define EGL_NATIVES_FLAG_SIZE_CHANGED 0x00000001
-
-/* surface flags */
-#define EGL_NATIVES_FLAG_DESTROY_BACKBUFFER 0x00000001
-
-enum native_pixel_format_t
-{
- NATIVE_PIXEL_FORMAT_RGBA_8888 = 1,
- NATIVE_PIXEL_FORMAT_RGB_565 = 4,
- NATIVE_PIXEL_FORMAT_BGRA_8888 = 5,
- NATIVE_PIXEL_FORMAT_RGBA_5551 = 6,
- NATIVE_PIXEL_FORMAT_RGBA_4444 = 7,
- NATIVE_PIXEL_FORMAT_YCbCr_422_SP= 0x10,
- NATIVE_PIXEL_FORMAT_YCbCr_420_SP= 0x11,
-};
-
-enum native_memory_type_t
-{
- NATIVE_MEMORY_TYPE_PMEM = 0,
- NATIVE_MEMORY_TYPE_GPU = 1,
- NATIVE_MEMORY_TYPE_FB = 2,
- NATIVE_MEMORY_TYPE_HEAP = 128
-};
-
-
-struct egl_native_window_t
-{
- /*
- * magic must be set to 0x600913
- */
- uint32_t magic;
-
- /*
- * must be sizeof(egl_native_window_t)
- */
- uint32_t version;
-
- /*
- * ident is reserved for the Android platform
- */
- uint32_t ident;
-
- /*
- * width, height and stride of the window in pixels
- * Any of these value can be nul in which case GL commands are
- * accepted and processed as usual, but not rendering occurs.
- */
- int width; // w=h=0 is legal
- int height;
- int stride;
-
- /*
- * format of the native window (see ui/PixelFormat.h)
- */
- int format;
-
- /*
- * Offset of the bits in the VRAM
- */
- intptr_t offset;
-
- /*
- * flags describing some attributes of this surface
- * EGL_NATIVES_FLAG_DESTROY_BACKBUFFER: backbuffer not preserved after
- * eglSwapBuffers
- */
- uint32_t flags;
-
- /*
- * horizontal and vertical resolution in DPI
- */
- float xdpi;
- float ydpi;
-
- /*
- * refresh rate in frames per second (Hz)
- */
- float fps;
-
-
- /*
- * Base memory virtual address of the surface in the CPU side
- */
- intptr_t base;
-
- /*
- * Heap the offset above is based from
- */
- int fd;
-
- /*
- * Memory type the surface resides into
- */
- uint8_t memory_type;
-
- /*
- * Reserved for future use. MUST BE ZERO.
- */
- uint8_t reserved_pad[3];
- int reserved[8];
-
- /*
- * Vertical stride (only relevant with planar formats)
- */
-
- int vstride;
-
- /*
- * Hook called by EGL to hold a reference on this structure
- */
- void (*incRef)(struct egl_native_window_t* window);
-
- /*
- * Hook called by EGL to release a reference on this structure
- */
- void (*decRef)(struct egl_native_window_t* window);
-
- /*
- * Hook called by EGL to perform a page flip. This function
- * may update the size attributes above, in which case it returns
- * the EGL_NATIVES_FLAG_SIZE_CHANGED bit set.
- */
- uint32_t (*swapBuffers)(struct egl_native_window_t* window);
-
- /*
- * Reserved for future use. MUST BE ZERO.
- */
- void (*reserved_proc_0)(void);
-
- /*
- * Reserved for future use. MUST BE ZERO.
- */
- void (*reserved_proc_1)(void);
-
- /*
- * Reserved for future use. MUST BE ZERO.
- */
- void (*reserved_proc_2)(void);
-
-
- /*
- * Hook called by EGL when the native surface is associated to EGL
- * (eglCreateWindowSurface). Can be NULL.
- */
- void (*connect)(struct egl_native_window_t* window);
-
- /*
- * Hook called by EGL when eglDestroySurface is called. Can be NULL.
- */
- void (*disconnect)(struct egl_native_window_t* window);
-
- /*
- * Reserved for future use. MUST BE ZERO.
- */
- void (*reserved_proc[11])(void);
-
- /*
- * Some storage reserved for the oem driver.
- */
- intptr_t oem[4];
-};
-
-
-struct egl_native_pixmap_t
-{
- int32_t version; /* must be 32 */
- int32_t width;
- int32_t height;
- int32_t stride;
- uint8_t* data;
- uint8_t format;
- uint8_t rfu[3];
- union {
- uint32_t compressedFormat;
- int32_t vstride;
- };
- int32_t reserved;
-};
-
-/*****************************************************************************/
-
-/*
- * This a convenience function to create a NativeWindowType surface
- * that maps to the whole screen
- * This function is actually implemented in libui.so
- */
-
-struct egl_native_window_t* android_createDisplaySurface();
-
-/*****************************************************************************/
-
-
-/*
- * OEM's egl's library (libhgl.so) must imlement these hooks to allocate
- * the GPU memory they need
- */
-
-
-typedef struct
-{
- // for internal use
- void* user;
- // virtual address of this area
- void* base;
- // size of this area in bytes
- size_t size;
- // physical address of this area
- void* phys;
- // offset in this area available to the GPU
- size_t offset;
- // fd of this area
- int fd;
-} gpu_area_t;
-
-typedef struct
-{
- // area where GPU registers are mapped
- gpu_area_t regs;
- // number of extra areas (currently limited to 2)
- int32_t count;
- // extra GPU areas (currently limited to 2)
- gpu_area_t gpu[2];
-} request_gpu_t;
-
-
-typedef request_gpu_t* (*OEM_EGL_acquire_gpu_t)(void* user);
-typedef int (*OEM_EGL_release_gpu_t)(void* user, request_gpu_t* handle);
-typedef void (*register_gpu_t)
- (void* user, OEM_EGL_acquire_gpu_t, OEM_EGL_release_gpu_t);
-
-void oem_register_gpu(
- void* user,
- OEM_EGL_acquire_gpu_t acquire,
- OEM_EGL_release_gpu_t release);
-
-
-/*****************************************************************************/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ANDROID_EGLNATIVES_H */