summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/content/ContentProviderOperation.java11
-rw-r--r--core/java/android/provider/ContactsContract.java132
-rw-r--r--include/ui/EGLUtils.h51
-rw-r--r--include/ui/EventHub.h2
-rw-r--r--include/ui/egl/android_natives.h3
-rw-r--r--libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp32
-rw-r--r--libs/ui/Android.mk2
-rw-r--r--libs/ui/EGLUtils.cpp104
-rw-r--r--libs/ui/EventHub.cpp19
-rw-r--r--libs/ui/FramebufferNativeWindow.cpp3
-rw-r--r--libs/ui/Surface.cpp3
-rw-r--r--opengl/tests/angeles/Android.mk2
-rw-r--r--opengl/tests/angeles/app-linux.cpp (renamed from opengl/tests/angeles/app-linux.c)77
-rw-r--r--opengl/tests/fillrate/fillrate.cpp42
-rw-r--r--opengl/tests/filter/Android.mk4
-rw-r--r--opengl/tests/filter/filter.cpp (renamed from opengl/tests/filter/filter.c)13
-rw-r--r--opengl/tests/finish/Android.mk4
-rw-r--r--opengl/tests/finish/finish.cpp (renamed from opengl/tests/finish/finish.c)40
-rw-r--r--opengl/tests/swapinterval/swapinterval.cpp42
-rw-r--r--opengl/tests/textures/Android.mk4
-rw-r--r--opengl/tests/textures/textures.cpp (renamed from opengl/tests/textures/textures.c)54
-rw-r--r--services/java/com/android/server/KeyInputQueue.java8
-rwxr-xr-xtests/backup/test_backup.sh22
-rwxr-xr-xtests/backup/test_restore.sh5
24 files changed, 439 insertions, 240 deletions
diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java
index c0db01a7db56..70ea5d00d42f 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -301,7 +301,8 @@ public class ContentProviderOperation implements Parcelable {
: mSelectionArgsBackReferences.entrySet()) {
final Integer selectionArgIndex = selectionArgBackRef.getKey();
final int backRefIndex = selectionArgBackRef.getValue();
- newArgs[selectionArgIndex] = backRefToValue(backRefs, numBackRefs, backRefIndex);
+ newArgs[selectionArgIndex] =
+ String.valueOf(backRefToValue(backRefs, numBackRefs, backRefIndex));
}
return newArgs;
}
@@ -315,18 +316,18 @@ public class ContentProviderOperation implements Parcelable {
* the numBackRefs
* @return the string representation of the requested back reference.
*/
- private static String backRefToValue(ContentProviderResult[] backRefs, int numBackRefs,
+ private static long backRefToValue(ContentProviderResult[] backRefs, int numBackRefs,
Integer backRefIndex) {
if (backRefIndex >= numBackRefs) {
throw new ArrayIndexOutOfBoundsException("asked for back ref " + backRefIndex
+ " but there are only " + numBackRefs + " back refs");
}
ContentProviderResult backRef = backRefs[backRefIndex];
- String backRefValue;
+ long backRefValue;
if (backRef.uri != null) {
- backRefValue = backRef.uri.getLastPathSegment();
+ backRefValue = ContentUris.parseId(backRef.uri);
} else {
- backRefValue = String.valueOf(backRef.count);
+ backRefValue = backRef.count;
}
return backRefValue;
}
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 66912f1c42e3..8cf4a77b2175 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -292,7 +292,7 @@ public final class ContactsContract {
* A sub-directory of a single contact that contains all of the constituent raw contact
* {@link Data} rows.
*/
- public static final class Data implements BaseColumns, DataColumns, BaseSyncColumns {
+ public static final class Data implements BaseColumns, DataColumns {
/**
* no public constructor since this is a utility class
*/
@@ -523,6 +523,15 @@ public final class ContactsContract {
/** Generic data column, the meaning is {@link #MIMETYPE} specific */
public static final String DATA15 = "data15";
+ /** Generic column for use by sync adapters. */
+ public static final String SYNC1 = "data_sync1";
+ /** Generic column for use by sync adapters. */
+ public static final String SYNC2 = "data_sync2";
+ /** Generic column for use by sync adapters. */
+ public static final String SYNC3 = "data_sync3";
+ /** Generic column for use by sync adapters. */
+ public static final String SYNC4 = "data_sync4";
+
/**
* An optional update or insert URI parameter that determines if the
* corresponding raw contact should be marked as dirty. The default
@@ -537,7 +546,7 @@ public final class ContactsContract {
* definition and some generic columns. Each data type can define the meaning for each of
* the generic columns.
*/
- public static final class Data implements BaseColumns, DataColumns, BaseSyncColumns {
+ public static final class Data implements BaseColumns, DataColumns {
/**
* This utility class cannot be instantiated
*/
@@ -905,6 +914,12 @@ public final class ContactsContract {
public static final int TYPE_HOME = 1;
public static final int TYPE_WORK = 2;
public static final int TYPE_OTHER = 3;
+
+ /**
+ * The display name for the email address
+ * <P>Type: TEXT</P>
+ */
+ public static final String DISPLAY_NAME = "data4";
}
/**
@@ -1024,9 +1039,9 @@ public final class ContactsContract {
public static final String COUNTRY = "data13";
}
- /**
- * Common data definition for IM addresses.
- */
+ /**
+ * Common data definition for IM addresses.
+ */
public static final class Im implements BaseCommonColumns, CommonColumns {
private Im() {}
@@ -1060,6 +1075,7 @@ public final class ContactsContract {
public static final int PROTOCOL_GOOGLE_TALK = 5;
public static final int PROTOCOL_ICQ = 6;
public static final int PROTOCOL_JABBER = 7;
+ public static final int PROTOCOL_NETMEETING = 8;
}
/**
@@ -1085,6 +1101,102 @@ public final class ContactsContract {
* <P>Type: TEXT</P>
*/
public static final String TITLE = "data4";
+
+ /**
+ * The department at this company as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String DEPARTMENT = "data5";
+
+ /**
+ * The job description at this company as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String JOB_DESCRIPTION = "data6";
+
+ /**
+ * The symbol of this company as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String SYMBOL = "data7";
+
+ /**
+ * The phonetic name of this company as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String PHONETIC_NAME = "data8";
+ }
+
+ /**
+ * Common data definition for miscellaneous information.
+ */
+ public static final class Miscellaneous implements BaseCommonColumns {
+ private Miscellaneous() {}
+
+ /** MIME type used when storing this in data table. */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc";
+
+ /**
+ * The birthday as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String BIRTHDAY = "data1";
+
+ /**
+ * The nickname as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String NICKNAME = "data2";
+ }
+
+ /**
+ * Common data definition for relations.
+ */
+ public static final class Relation implements BaseCommonColumns, CommonColumns {
+ private Relation() {}
+
+ /** MIME type used when storing this in data table. */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation";
+
+ public static final int TYPE_ASSISTANT = 1;
+ public static final int TYPE_BROTHER = 2;
+ public static final int TYPE_CHILD = 3;
+ public static final int TYPE_DOMESTIC_PARTNER = 4;
+ public static final int TYPE_FATHER = 5;
+ public static final int TYPE_FRIEND = 6;
+ public static final int TYPE_MANAGER = 7;
+ public static final int TYPE_MOTHER = 8;
+ public static final int TYPE_PARENT = 9;
+ public static final int TYPE_PARTNER = 10;
+ public static final int TYPE_REFERRED_BY = 11;
+ public static final int TYPE_RELATIVE = 12;
+ public static final int TYPE_SISTER = 13;
+ public static final int TYPE_SPOUSE = 14;
+
+ /**
+ * The name of the relative as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String NAME = DATA;
+ }
+
+ /**
+ * Common data definition for events.
+ */
+ public static final class Event implements BaseCommonColumns, CommonColumns {
+ private Event() {}
+
+ /** MIME type used when storing this in data table. */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
+
+ public static final int TYPE_ANNIVERSARY = 1;
+ public static final int TYPE_OTHER = 2;
+
+ /**
+ * The event start date as the user entered it.
+ * <P>Type: TEXT</P>
+ */
+ public static final String START_DATE = DATA;
}
/**
@@ -1149,12 +1261,20 @@ public final class ContactsContract {
/**
* Website related to the contact.
*/
- public static final class Website implements BaseCommonColumns {
+ public static final class Website implements BaseCommonColumns, CommonColumns {
private Website() {}
/** MIME type used when storing this in data table. */
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
+ public static final int TYPE_HOMEPAGE = 1;
+ public static final int TYPE_BLOG = 2;
+ public static final int TYPE_PROFILE = 3;
+ public static final int TYPE_HOME = 4;
+ public static final int TYPE_WORK = 5;
+ public static final int TYPE_FTP = 6;
+ public static final int TYPE_OTHER = 7;
+
/**
* The website URL string.
* <P>Type: TEXT</P>
diff --git a/include/ui/EGLUtils.h b/include/ui/EGLUtils.h
new file mode 100644
index 000000000000..48777b6f8635
--- /dev/null
+++ b/include/ui/EGLUtils.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 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_UI_EGLUTILS_H
+#define ANDROID_UI_EGLUTILS_H
+
+#include <utils/Errors.h>
+#include <ui/PixelFormat.h>
+#include <EGL/egl.h>
+
+
+// ----------------------------------------------------------------------------
+namespace android {
+// ----------------------------------------------------------------------------
+
+class EGLUtils
+{
+public:
+
+ static status_t selectConfigForPixelFormat(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ PixelFormat format,
+ EGLConfig* outConfig);
+
+ static status_t selectConfigForNativeWindow(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ EGLNativeWindowType window,
+ EGLConfig* outConfig);
+};
+
+// ----------------------------------------------------------------------------
+}; // namespace android
+// ----------------------------------------------------------------------------
+
+#endif /* ANDROID_UI_EGLUTILS_H */
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h
index bffba076ee86..3b18c7774575 100644
--- a/include/ui/EventHub.h
+++ b/include/ui/EventHub.h
@@ -119,7 +119,7 @@ private:
String8 keylayoutFilename;
device_t* next;
- device_t(int32_t _id, const char* _path);
+ device_t(int32_t _id, const char* _path, const char* name);
~device_t();
};
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h
index a3a1316fa504..7da69b144a49 100644
--- a/include/ui/egl/android_natives.h
+++ b/include/ui/egl/android_natives.h
@@ -63,7 +63,8 @@ struct android_native_base_t
/* attributes queriable with query() */
enum {
NATIVE_WINDOW_WIDTH = 0,
- NATIVE_WINDOW_HEIGHT = 1
+ NATIVE_WINDOW_HEIGHT = 1,
+ NATIVE_WINDOW_FORMAT = 2,
};
struct android_native_window_t
diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index f0615f0bd906..002a3ab7e780 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -26,6 +26,7 @@
#include <ui/PixelFormat.h>
#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
#include <GLES/gl.h>
#include <EGL/egl.h>
@@ -144,32 +145,11 @@ void DisplayHardware::init(uint32_t dpy)
eglInitialize(display, NULL, NULL);
eglGetConfigs(display, NULL, 0, &numConfigs);
- // Get all the "potential match" configs...
- EGLConfig* const configs = new EGLConfig[numConfigs];
- eglChooseConfig(display, attribs, configs, numConfigs, &n);
- LOGE_IF(n<=0, "no EGLConfig available!");
- EGLConfig config = configs[0];
- if (n > 1) {
- // if there is more than one candidate, go through the list
- // and pick one that matches our framebuffer format
- int fbSzA = fbFormatInfo.getSize(PixelFormatInfo::INDEX_ALPHA);
- int fbSzR = fbFormatInfo.getSize(PixelFormatInfo::INDEX_RED);
- int fbSzG = fbFormatInfo.getSize(PixelFormatInfo::INDEX_GREEN);
- int fbSzB = fbFormatInfo.getSize(PixelFormatInfo::INDEX_BLUE);
- for (int i=0 ; i<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(display, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(display, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(display, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(display, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
- }
- delete [] configs;
-
+ EGLConfig config;
+ status_t err = EGLUtils::selectConfigForPixelFormat(
+ display, attribs, fbDev->format, &config);
+ LOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
+
/*
* Gather EGL extensions
*/
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk
index 49939ca6950c..93c7263502bc 100644
--- a/libs/ui/Android.mk
+++ b/libs/ui/Android.mk
@@ -5,6 +5,7 @@ LOCAL_SRC_FILES:= \
BufferMapper.cpp \
Camera.cpp \
CameraParameters.cpp \
+ EGLUtils.cpp \
EventHub.cpp \
EventRecurrence.cpp \
FramebufferNativeWindow.cpp \
@@ -29,6 +30,7 @@ LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
+ libEGL \
libbinder \
libpixelflinger \
libhardware \
diff --git a/libs/ui/EGLUtils.cpp b/libs/ui/EGLUtils.cpp
new file mode 100644
index 000000000000..9b2839d25282
--- /dev/null
+++ b/libs/ui/EGLUtils.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+
+#define LOG_TAG "EGLUtils"
+
+#include <utils/Errors.h>
+
+#include <ui/EGLUtils.h>
+
+#include <EGL/egl.h>
+
+#include <private/ui/android_natives_priv.h>
+
+// ----------------------------------------------------------------------------
+namespace android {
+// ----------------------------------------------------------------------------
+
+status_t EGLUtils::selectConfigForPixelFormat(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ PixelFormat format,
+ EGLConfig* outConfig)
+{
+ EGLint numConfigs = -1, n=0;
+
+ if (outConfig == NULL)
+ return BAD_VALUE;
+
+ int err;
+ PixelFormatInfo fbFormatInfo;
+ if ((err = getPixelFormatInfo(PixelFormat(format), &fbFormatInfo)) < 0) {
+ return err;
+ }
+
+ // Get all the "potential match" configs...
+ if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
+ return BAD_VALUE;
+
+ EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
+ if (eglChooseConfig(dpy, attrs, configs, numConfigs, &n) == EGL_FALSE) {
+ free(configs);
+ return BAD_VALUE;
+ }
+
+ const int fbSzA = fbFormatInfo.getSize(PixelFormatInfo::INDEX_ALPHA);
+ const int fbSzR = fbFormatInfo.getSize(PixelFormatInfo::INDEX_RED);
+ const int fbSzG = fbFormatInfo.getSize(PixelFormatInfo::INDEX_GREEN);
+ const int fbSzB = fbFormatInfo.getSize(PixelFormatInfo::INDEX_BLUE);
+
+ EGLConfig config = NULL;
+ for (int i=0 ; i<n ; i++) {
+ EGLint r,g,b,a;
+ eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
+ eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
+ eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
+ eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
+ if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
+ config = configs[i];
+ break;
+ }
+ }
+
+ free(configs);
+
+ if (config) {
+ *outConfig = config;
+ return NO_ERROR;
+ }
+
+ return NAME_NOT_FOUND;
+}
+
+status_t EGLUtils::selectConfigForNativeWindow(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ EGLNativeWindowType window,
+ EGLConfig* outConfig)
+{
+ int err;
+ int format;
+ if ((err = window->query(window, NATIVE_WINDOW_FORMAT, &format)) < 0) {
+ return err;
+ }
+
+ return selectConfigForPixelFormat(dpy, attrs, format, outConfig);
+}
+
+// ----------------------------------------------------------------------------
+}; // namespace android
+// ----------------------------------------------------------------------------
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 27334b7b85d8..df713cbc9c38 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -82,8 +82,8 @@ static inline int max(int v1, int v2)
return (v1 > v2) ? v1 : v2;
}
-EventHub::device_t::device_t(int32_t _id, const char* _path)
- : id(_id), path(_path), classes(0)
+EventHub::device_t::device_t(int32_t _id, const char* _path, const char* name)
+ : id(_id), path(_path), name(name), classes(0)
, keyBitmask(NULL), layoutMap(new KeyLayoutMap()), next(NULL) {
}
@@ -593,7 +593,7 @@ int EventHub::open_device(const char *deviceName)
version >> 16, (version >> 8) & 0xff, version & 0xff);
#endif
- device_t* device = new device_t(devid|mDevicesById[devid].seq, deviceName);
+ device_t* device = new device_t(devid|mDevicesById[devid].seq, deviceName, name);
if (device == NULL) {
LOGE("out of memory");
return -1;
@@ -678,17 +678,14 @@ int EventHub::open_device(const char *deviceName)
#endif
if ((device->classes&CLASS_KEYBOARD) != 0) {
- char devname[101];
- char tmpfn[101];
+ char tmpfn[sizeof(name)];
char keylayoutFilename[300];
// a more descriptive name
- ioctl(mFDs[mFDCount].fd, EVIOCGNAME(sizeof(devname)-1), devname);
- devname[sizeof(devname)-1] = 0;
- device->name = devname;
+ device->name = name;
// replace all the spaces with underscores
- strcpy(tmpfn, devname);
+ strcpy(tmpfn, name);
for (char *p = strchr(tmpfn, ' '); p && *p; p = strchr(tmpfn, ' '))
*p = '_';
@@ -721,7 +718,7 @@ int EventHub::open_device(const char *deviceName)
}
char propName[100];
sprintf(propName, "hw.keyboards.%u.devname", publicID);
- property_set(propName, devname);
+ property_set(propName, name);
// 'Q' key support = cheap test of whether this is an alpha-capable kbd
if (hasKeycode(device, kKeyCodeQ)) {
@@ -738,7 +735,7 @@ int EventHub::open_device(const char *deviceName)
}
LOGI("New keyboard: publicID=%d device->id=0x%x devname='%s' propName='%s' keylayout='%s'\n",
- publicID, device->id, devname, propName, keylayoutFilename);
+ publicID, device->id, name, propName, keylayoutFilename);
}
LOGI("New device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n",
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index 8b7ea21d7322..7b85c7fbab15 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -212,6 +212,9 @@ int FramebufferNativeWindow::query(android_native_window_t* window,
case NATIVE_WINDOW_HEIGHT:
*value = fb->height;
return NO_ERROR;
+ case NATIVE_WINDOW_FORMAT:
+ *value = fb->format;
+ return NO_ERROR;
}
return BAD_VALUE;
}
diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp
index c73909f0cd89..4abb7f62ad44 100644
--- a/libs/ui/Surface.cpp
+++ b/libs/ui/Surface.cpp
@@ -620,6 +620,9 @@ int Surface::query(int what, int* value)
case NATIVE_WINDOW_HEIGHT:
*value = int(mHeight);
return NO_ERROR;
+ case NATIVE_WINDOW_FORMAT:
+ *value = int(mFormat);
+ return NO_ERROR;
}
return BAD_VALUE;
}
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk
index e193483f5d69..d0c3221cfba4 100644
--- a/opengl/tests/angeles/Android.mk
+++ b/opengl/tests/angeles/Android.mk
@@ -2,7 +2,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= app-linux.c demo.c.arm
+LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui
LOCAL_MODULE:= angeles
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/angeles/app-linux.c b/opengl/tests/angeles/app-linux.cpp
index 6be4876cc8df..9c71693f6d6d 100644
--- a/opengl/tests/angeles/app-linux.c
+++ b/opengl/tests/angeles/app-linux.cpp
@@ -52,6 +52,11 @@
#include <EGL/egl.h>
#include <GLES/gl.h>
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
+
+using namespace android;
+
#include "app.h"
@@ -115,76 +120,32 @@ static void checkEGLErrors()
static int initGraphics()
{
- EGLint s_configAttribs[] = {
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
- #if 1
- EGL_DEPTH_SIZE, 16,
- EGL_STENCIL_SIZE, 0,
- #else
- EGL_ALPHA_SIZE, EGL_DONT_CARE,
- EGL_DEPTH_SIZE, EGL_DONT_CARE,
- EGL_STENCIL_SIZE, EGL_DONT_CARE,
- EGL_SURFACE_TYPE, EGL_DONT_CARE,
- #endif
+ EGLint configAttribs[] = {
+ EGL_DEPTH_SIZE, 16,
EGL_NONE
};
- EGLint numConfigs = -1;
- EGLint n = 0;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
-
+ EGLint w, h;
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- egl_error("eglGetDisplay");
- fprintf(stderr,"dpy = 0x%08x\n", (unsigned) dpy);
-
eglInitialize(dpy, &majorVersion, &minorVersion);
- egl_error("eglInitialize");
-
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
-
- // Get all the "potential match" configs...
- EGLConfig* const configs = malloc(sizeof(EGLConfig)*numConfigs);
- eglChooseConfig(dpy, s_configAttribs, configs, numConfigs, &n);
- config = configs[0];
- if (n > 1) {
- // if there is more than one candidate, go through the list
- // and pick one that matches our framebuffer format
- int fbSzA = 0; // should not hardcode
- int fbSzR = 5; // should not hardcode
- int fbSzG = 6; // should not hardcode
- int fbSzB = 5; // should not hardcode
- int i;
- for (i=0 ; i<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
- }
- free(configs);
-
+
+ EGLNativeWindowType window = android_createDisplaySurface();
- //eglGetConfigs(dpy, NULL, 0, &numConfigs);
- //egl_error("eglGetConfigs");
- //fprintf(stderr,"num configs %d\n", numConfigs);
- //eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
- //egl_error("eglChooseConfig");
-
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
+ }
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
egl_error("eglCreateWindowSurface");
fprintf(stderr,"surface = %p\n", surface);
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
index 108a87c9f273..4ffbc8b3ef99 100644
--- a/opengl/tests/fillrate/fillrate.cpp
+++ b/opengl/tests/fillrate/fillrate.cpp
@@ -26,6 +26,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
using namespace android;
@@ -36,48 +37,27 @@ int main(int argc, char** argv)
EGL_NONE
};
- EGLint numConfigs = -1, n=0;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
EGLint w, h;
-
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
+
+ EGLNativeWindowType window = android_createDisplaySurface();
- // Get all the "potential match" configs...
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
- EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
- eglChooseConfig(dpy, configAttribs, configs, numConfigs, &n);
- config = configs[0];
- if (n > 1) {
- // if there is more than one candidate, go through the list
- // and pick one that matches our framebuffer format
- int fbSzA = 0; // should not hardcode
- int fbSzR = 5; // should not hardcode
- int fbSzG = 6; // should not hardcode
- int fbSzB = 5; // should not hardcode
- int i;
- for (i=0 ; i<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
}
- free(configs);
-
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
context = eglCreateContext(dpy, config, NULL, NULL);
eglMakeCurrent(dpy, surface, surface, context);
eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
diff --git a/opengl/tests/filter/Android.mk b/opengl/tests/filter/Android.mk
index 31b7d9a48703..a254127e7846 100644
--- a/opengl/tests/filter/Android.mk
+++ b/opengl/tests/filter/Android.mk
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- filter.c
+ filter.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
@@ -14,4 +14,6 @@ LOCAL_MODULE:= test-opengl-filter
LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
+
include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/filter/filter.c b/opengl/tests/filter/filter.cpp
index de9711963e65..e82b12d301c6 100644
--- a/opengl/tests/filter/filter.c
+++ b/opengl/tests/filter/filter.cpp
@@ -5,6 +5,11 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
+
+using namespace android;
+
int main(int argc, char** argv)
{
if (argc!=2 && argc!=3) {
@@ -34,12 +39,14 @@ int main(int argc, char** argv)
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
- eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
if (!usePbuffer) {
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+ EGLNativeWindowType window = android_createDisplaySurface();
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
+ EGLUtils::selectConfigForNativeWindow(
+ dpy, s_configAttribs, window, &config);
} else {
printf("using pbuffer\n");
+ eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
EGLint attribs[] = { EGL_WIDTH, 320, EGL_HEIGHT, 480, EGL_NONE };
surface = eglCreatePbufferSurface(dpy, config, attribs);
if (surface == EGL_NO_SURFACE) {
diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk
index 8b46cd7f1773..56208147da01 100644
--- a/opengl/tests/finish/Android.mk
+++ b/opengl/tests/finish/Android.mk
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- finish.c
+ finish.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
@@ -14,4 +14,6 @@ LOCAL_MODULE:= test-opengl-finish
LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
+
include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/finish/finish.c b/opengl/tests/finish/finish.cpp
index 45fc7587befb..b5b8142f6cad 100644
--- a/opengl/tests/finish/finish.c
+++ b/opengl/tests/finish/finish.cpp
@@ -24,39 +24,41 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+#include <utils/Timers.h>
-long long systemTime()
-{
- struct timespec t;
- t.tv_sec = t.tv_nsec = 0;
- clock_gettime(CLOCK_MONOTONIC, &t);
- return (long long)(t.tv_sec)*1000000000LL + t.tv_nsec;
-}
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
+
+using namespace android;
int main(int argc, char** argv)
{
- EGLint s_configAttribs[] = {
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
+ EGLint configAttribs[] = {
+ EGL_DEPTH_SIZE, 0,
EGL_NONE
};
- EGLint numConfigs = -1;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
EGLint w, h;
-
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
- eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+
+ EGLNativeWindowType window = android_createDisplaySurface();
+
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
+ }
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
context = eglCreateContext(dpy, config, NULL, NULL);
eglMakeCurrent(dpy, surface, surface, context);
eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
@@ -75,13 +77,13 @@ int main(int argc, char** argv)
long long now, t;
int i;
- char* texels = malloc(512*512*2);
+ char* texels = (char*)malloc(512*512*2);
memset(texels,0xFF,512*512*2);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
512, 512, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, texels);
- char* dst = malloc(320*480*2);
+ char* dst = (char*)malloc(320*480*2);
memset(dst, 0, 320*480*2);
printf("307200 bytes memcpy\n");
for (i=0 ; i<4 ; i++) {
diff --git a/opengl/tests/swapinterval/swapinterval.cpp b/opengl/tests/swapinterval/swapinterval.cpp
index f51d882a5ae3..cf908a0d97f7 100644
--- a/opengl/tests/swapinterval/swapinterval.cpp
+++ b/opengl/tests/swapinterval/swapinterval.cpp
@@ -26,6 +26,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
using namespace android;
@@ -36,48 +37,27 @@ int main(int argc, char** argv)
EGL_NONE
};
- EGLint numConfigs = -1, n=0;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
EGLint w, h;
-
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
+
+ EGLNativeWindowType window = android_createDisplaySurface();
- // Get all the "potential match" configs...
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
- EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
- eglChooseConfig(dpy, configAttribs, configs, numConfigs, &n);
- config = configs[0];
- if (n > 1) {
- // if there is more than one candidate, go through the list
- // and pick one that matches our framebuffer format
- int fbSzA = 0; // should not hardcode
- int fbSzR = 5; // should not hardcode
- int fbSzG = 6; // should not hardcode
- int fbSzB = 5; // should not hardcode
- int i;
- for (i=0 ; i<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
}
- free(configs);
-
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
context = eglCreateContext(dpy, config, NULL, NULL);
eglMakeCurrent(dpy, surface, surface, context);
eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
diff --git a/opengl/tests/textures/Android.mk b/opengl/tests/textures/Android.mk
index 8d5f56de2bba..b2fa18557744 100644
--- a/opengl/tests/textures/Android.mk
+++ b/opengl/tests/textures/Android.mk
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- textures.c
+ textures.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
@@ -14,4 +14,6 @@ LOCAL_MODULE:= test-opengl-textures
LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
+
include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/textures/textures.c b/opengl/tests/textures/textures.cpp
index d877e740b409..ee92e7922dcb 100644
--- a/opengl/tests/textures/textures.c
+++ b/opengl/tests/textures/textures.cpp
@@ -22,59 +22,39 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
+
+using namespace android;
+
int main(int argc, char** argv)
{
- EGLint s_configAttribs[] = {
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
+ EGLint configAttribs[] = {
+ EGL_DEPTH_SIZE, 0,
EGL_NONE
};
- EGLint numConfigs = -1, n=0;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
EGLint w, h;
-
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
+
+ EGLNativeWindowType window = android_createDisplaySurface();
- // Get all the "potential match" configs...
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
- EGLConfig* const configs = malloc(sizeof(EGLConfig)*numConfigs);
- eglChooseConfig(dpy, s_configAttribs, configs, numConfigs, &n);
- config = configs[0];
- if (n > 1) {
- // if there is more than one candidate, go through the list
- // and pick one that matches our framebuffer format
- int fbSzA = 0; // should not hardcode
- int fbSzR = 5; // should not hardcode
- int fbSzG = 6; // should not hardcode
- int fbSzB = 5; // should not hardcode
- int i;
- for (i=0 ; i<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
}
- free(configs);
-
-
-
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
context = eglCreateContext(dpy, config, NULL, NULL);
eglMakeCurrent(dpy, surface, surface, context);
eglQuerySurface(dpy, surface, EGL_WIDTH, &w);
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index cfb3e35bec54..dc7d22bca31e 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -194,10 +194,10 @@ public abstract class KeyInputQueue {
}
}
- private void readVirtualKeys() {
+ private void readVirtualKeys(String deviceName) {
try {
FileInputStream fis = new FileInputStream(
- "/sys/board_properties/virtualkeys.synaptics-rmi-touchscreen");
+ "/sys/board_properties/virtualkeys." + deviceName);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String str = br.readLine();
@@ -276,7 +276,6 @@ public abstract class KeyInputQueue {
mHapticFeedbackCallback = hapticFeedbackCallback;
- readVirtualKeys();
readExcludedDevices();
PowerManager pm = (PowerManager)context.getSystemService(
@@ -393,6 +392,9 @@ public abstract class KeyInputQueue {
synchronized (mFirst) {
di = newInputDevice(ev.deviceId);
mDevices.put(ev.deviceId, di);
+ if ((di.classes & RawInputEvent.CLASS_TOUCHSCREEN) != 0) {
+ readVirtualKeys(di.name);
+ }
configChanged = true;
}
} else if (ev.type == RawInputEvent.EV_DEVICE_REMOVED) {
diff --git a/tests/backup/test_backup.sh b/tests/backup/test_backup.sh
index dd3907cbde91..f50d03f111a1 100755
--- a/tests/backup/test_backup.sh
+++ b/tests/backup/test_backup.sh
@@ -20,6 +20,18 @@ ADB_OPTS="$@"
#FIXME: what was this for?
#adb kill-server
+b_pkgs=$(adb $ADB_OPTS shell dumpsys backup | \
+ ruby -ne 'print($1+" ") if $_ =~ /^\s*ApplicationInfo\{\S+ (.+?)\}/')
+
+# wipe prior backup data for packages, including the metadata package @pm@
+for pkg in $b_pkgs '@pm@'; do
+ adb $ADB_OPTS shell bmgr wipe "$pkg"
+done
+
+# who knows?
+echo 'Waiting 5 seconds for things to settle...'
+sleep 5
+
# run adb as root so we can poke at com.android.backuptest's data
root_status=$(adb $ADB_OPTS root)
if [ "x$root_status" != "xadbd is already running as root" ]; then
@@ -35,16 +47,20 @@ adb $ADB_OPTS shell bmgr transport com.google.android.backup/.BackupTransportSer
# load up the three files
adb $ADB_OPTS shell \
- "rm /data/data/com.android.backuptest/files/* ; \
+ "rm /data/data/com.android.backuptest/files/file.txt ; \
+ rm /data/data/com.android.backuptest/files/another_file.txt ; \
+ rm /data/data/com.android.backuptest/files/empty.txt ; \
mkdir /data/data/com.android.backuptest ; \
mkdir /data/data/com.android.backuptest/files ; \
mkdir /data/data/com.android.backuptest/shared_prefs ; \
- echo -n \"<map><int name=\\\"pref\\\" value=\\\"1\\\" /></map>\" > /data/data com.android.backuptest/shared_prefs/raw.xml ; \
+ echo -n \"<map><int name=\\\"pref\\\" value=\\\"1\\\" /></map>\" \
+ > /data/data/com.android.backuptest/shared_prefs/raw.xml ; \
echo -n first file > /data/data/com.android.backuptest/files/file.txt ; \
echo -n asdf > /data/data/com.android.backuptest/files/another_file.txt ; \
- echo -n 3 > /data/data/com.android.backuptest/files/3.txt ; \
echo -n "" > /data/data/com.android.backuptest/files/empty.txt ; \
+ date >> /data/data/com.android.backuptest/files/3.txt ; \
"
+# echo -n 3 > /data/data/com.android.backuptest/files/3.txt ; \
# say that the data has changed
adb $ADB_OPTS shell bmgr backup com.android.backuptest
diff --git a/tests/backup/test_restore.sh b/tests/backup/test_restore.sh
index 8de70cb2a7f8..44b3a289c3b4 100755
--- a/tests/backup/test_restore.sh
+++ b/tests/backup/test_restore.sh
@@ -70,7 +70,7 @@ echo
# check the results
check_file files/file.txt "first file"
check_file files/another_file.txt "asdf"
-check_file files/3.txt "3"
+#check_file files/3.txt "3"
check_file files/empty.txt ""
check_file shared_prefs/raw.xml '<map><int name="pref" value="1" /></map>'
@@ -84,3 +84,6 @@ adb $ADB_OPTS shell "ls -l /data/data/com.android.backuptest/shared_prefs"
echo ---
echo
+echo "Last 3 timestamps in 3.txt:"
+adb $ADB_OPTS shell cat /data/data/com.android.backuptest/files/3.txt | tail -n 3
+