Merge "atrace: add the 'dalvik' trace category" into jb-mr2-dev
diff --git a/build/tablet-7in-xhdpi-2048-dalvik-heap.mk b/build/tablet-7in-xhdpi-2048-dalvik-heap.mk
new file mode 100644
index 0000000..e0f20c1
--- /dev/null
+++ b/build/tablet-7in-xhdpi-2048-dalvik-heap.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2013 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.
+#
+
+# Provides overrides to configure the Dalvik heap for a 320dpi 7" tablet device.
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ dalvik.vm.heapstartsize=16m \
+ dalvik.vm.heapgrowthlimit=192m \
+ dalvik.vm.heapsize=512m \
+ dalvik.vm.heaptargetutilization=0.75 \
+ dalvik.vm.heapminfree=512k \
+ dalvik.vm.heapmaxfree=8m
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index e544be7..8e14a2c 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -421,7 +421,7 @@
}
int get_size(const char *pkgname, int persona, const char *apkpath,
- const char *fwdlock_apkpath, const char *asecpath,
+ const char *libdirpath, const char *fwdlock_apkpath, const char *asecpath,
int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
int64_t* _asecsize)
{
@@ -460,8 +460,8 @@
}
/* add in size of any libraries */
- if (!create_pkg_path_in_dir(path, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) {
- d = opendir(path);
+ if (libdirpath != NULL && libdirpath[0] != '!') {
+ d = opendir(libdirpath);
if (d != NULL) {
dfd = dirfd(d);
codesize += calculate_dir_size(dfd);
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 230899b..c918633 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -84,7 +84,7 @@
int res = 0;
/* pkgdir, persona, apkpath */
- res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4],
+ res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4], arg[5],
&codesize, &datasize, &cachesize, &asecsize);
/*
@@ -138,7 +138,7 @@
{ "fixuid", 3, do_fixuid },
{ "freecache", 1, do_free_cache },
{ "rmcache", 2, do_rm_cache },
- { "getsize", 5, do_get_size },
+ { "getsize", 6, do_get_size },
{ "rmuserdata", 2, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
{ "linklib", 3, do_linklib },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 033d5a3..fbfc876 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -203,9 +203,9 @@
int move_dex(const char *src, const char *dst);
int rm_dex(const char *path);
int protect(char *pkgname, gid_t gid);
-int get_size(const char *pkgname, int persona, const char *apkpath, const char *fwdlock_apkpath,
- const char *asecpath, int64_t *codesize, int64_t *datasize, int64_t *cachesize,
- int64_t *asecsize);
+int get_size(const char *pkgname, int persona, const char *apkpath, const char *libdirpath,
+ const char *fwdlock_apkpath, const char *asecpath, int64_t *codesize,
+ int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
int free_cache(int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, int is_public);
int movefiles();
diff --git a/include/media/drm/DrmAPI.h b/include/media/drm/DrmAPI.h
index c89f2d6..fbf93bc 100644
--- a/include/media/drm/DrmAPI.h
+++ b/include/media/drm/DrmAPI.h
@@ -80,10 +80,12 @@
// Drm keys can be for offline content or for online streaming.
// Offline keys are persisted on the device and may be used when the device
- // is disconnected from the network.
+ // is disconnected from the network. The Release type is used to request
+ // that offline keys be no longer restricted to offline use.
enum KeyType {
kKeyType_Offline,
- kKeyType_Streaming
+ kKeyType_Streaming,
+ kKeyType_Release
};
DrmPlugin() {}
@@ -101,35 +103,55 @@
// is used to obtain an opaque key request blob that is delivered to the
// license server.
//
+ // The scope parameter may be a sessionId or a keySetId, depending on the
+ // specified keyType. When the keyType is kKeyType_Offline or
+ // kKeyType_Streaming, scope should be set to the sessionId the keys will be
+ // provided to. When the keyType is kKeyType_Release, scope should be set to
+ // the keySetId of the keys being released. Releasing keys from a device
+ // invalidates them for all sessions.
+ //
// The init data passed to getKeyRequest is container-specific and its
// meaning is interpreted based on the mime type provided in the mimeType
// parameter to getKeyRequest. It could contain, for example, the content
// ID, key ID or other data obtained from the content metadata that is required
- // in generating the key request.
+ // in generating the key request. Init may be null when keyType is
+ // kKeyType_Release.
//
- // keyType specifes if the keys are to be used for streaming or offline content
+ // mimeType identifies the mime type of the content
+ //
+ // keyType specifies if the keys are to be used for streaming or offline content
//
// optionalParameters are included in the key request message to allow a
// client application to provide additional message parameters to the server.
//
// If successful, the opaque key request blob is returned to the caller.
virtual status_t
- getKeyRequest(Vector<uint8_t> const &sessionId,
+ getKeyRequest(Vector<uint8_t> const &scope,
Vector<uint8_t> const &initData,
String8 const &mimeType, KeyType keyType,
KeyedVector<String8, String8> const &optionalParameters,
Vector<uint8_t> &request, String8 &defaultUrl) = 0;
+ //
// After a key response is received by the app, it is provided to the
- // Drm plugin using provideKeyResponse. Returns the id of the key set
- // in keySetId. The keySetId can be used by removeKeys or restoreKeys
- // when the keys are used for offline content.
- virtual status_t provideKeyResponse(Vector<uint8_t> const &sessionId,
+ // Drm plugin using provideKeyResponse.
+ //
+ // scope may be a sessionId or a keySetId depending on the type of the
+ // response. Scope should be set to the sessionId when the response is
+ // for either streaming or offline key requests. Scope should be set to the
+ // keySetId when the response is for a release request.
+ //
+ // When the response is for an offline key request, a keySetId is returned
+ // in the keySetId vector parameter that can be used to later restore the
+ // keys to a new session with the method restoreKeys. When the response is
+ // for a streaming or release request, no keySetId is returned.
+ //
+ virtual status_t provideKeyResponse(Vector<uint8_t> const &scope,
Vector<uint8_t> const &response,
Vector<uint8_t> &keySetId) = 0;
- // Remove the persisted keys associated with an offline license for a session.
- virtual status_t removeKeys(Vector<uint8_t> const &keySetId) = 0;
+ // Remove the current keys from a session
+ virtual status_t removeKeys(Vector<uint8_t> const &sessionId) = 0;
// Restore persisted offline keys into a new session. keySetId identifies
// the keys to load, obtained from a prior call to provideKeyResponse().
diff --git a/libs/diskusage/dirsize.c b/libs/diskusage/dirsize.c
index 6703783..24e5af0 100644
--- a/libs/diskusage/dirsize.c
+++ b/libs/diskusage/dirsize.c
@@ -24,7 +24,8 @@
int64_t stat_size(struct stat *s)
{
int64_t blksize = s->st_blksize;
- int64_t size = s->st_size;
+ // count actual blocks used instead of nominal file size
+ int64_t size = s->st_blocks * 512;
if (blksize) {
/* round up to filesystem block size */
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 9a214c2..74d3973 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -78,6 +78,7 @@
"EGL_KHR_gl_renderbuffer_image "
"EGL_KHR_reusable_sync "
"EGL_KHR_fence_sync "
+ "EGL_KHR_create_context "
"EGL_EXT_create_context_robustness "
"EGL_NV_system_time "
"EGL_ANDROID_image_native_buffer " // mandatory
diff --git a/opengl/specs/EGL_ANDROID_presentation_time.txt b/opengl/specs/EGL_ANDROID_presentation_time.txt
index 03370ed..09b3938 100644
--- a/opengl/specs/EGL_ANDROID_presentation_time.txt
+++ b/opengl/specs/EGL_ANDROID_presentation_time.txt
@@ -107,8 +107,8 @@
presentation time when an absolute time is needed be queried on Android?
RESOLVED: The current clock value can be queried from the Java
- SystemClock#uptimeMillis() method or from the native clock_gettime
- function by passing CLOCK_MONOTONIC as the clock identifier.
+ System.nanoTime() method, or from the native clock_gettime function by
+ passing CLOCK_MONOTONIC as the clock identifier.
Revision History
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
index 29212c0..d236c1e 100755
--- a/opengl/tools/glgen/gen
+++ b/opengl/tools/glgen/gen
@@ -96,6 +96,7 @@
pushd out > /dev/null
mkdir classes
javac -d classes android/opengl/EGL14.java \
+ android/opengl/EGLExt.java \
com/google/android/gles_jni/GLImpl.java \
javax/microedition/khronos/opengles/GL10.java \
javax/microedition/khronos/opengles/GL10Ext.java \
@@ -154,7 +155,7 @@
compareGenerated ../../../../base/opengl/java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
done
-for x in EGL14 GLES10 GLES10Ext GLES11 GLES11Ext GLES20 GLES30
+for x in EGL14 EGLExt GLES10 GLES10Ext GLES11 GLES11Ext GLES20 GLES30
do
compareGenerated ../../../../base/opengl/java/android/opengl generated/android/opengl ${x}.java
compareGenerated ../../../../base/core/jni generated/C android_opengl_${x}.cpp
diff --git a/opengl/tools/glgen/specs/egl/EGL14.spec b/opengl/tools/glgen/specs/egl/EGL14.spec
index aef0bcb..828e114 100644
--- a/opengl/tools/glgen/specs/egl/EGL14.spec
+++ b/opengl/tools/glgen/specs/egl/EGL14.spec
@@ -31,4 +31,3 @@
EGLBoolean eglWaitNative ( EGLint engine )
EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface )
EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target )
-EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time )
diff --git a/opengl/tools/glgen/specs/egl/EGLExt.spec b/opengl/tools/glgen/specs/egl/EGLExt.spec
new file mode 100644
index 0000000..e4fc337
--- /dev/null
+++ b/opengl/tools/glgen/specs/egl/EGLExt.spec
@@ -0,0 +1 @@
+EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time )
diff --git a/opengl/tools/glgen/src/GenerateEGL.java b/opengl/tools/glgen/src/GenerateEGL.java
index aaa748c..2ef3970 100644
--- a/opengl/tools/glgen/src/GenerateEGL.java
+++ b/opengl/tools/glgen/src/GenerateEGL.java
@@ -84,26 +84,26 @@
ParameterChecker checker = new ParameterChecker(checksReader);
- BufferedReader specReader =
- new BufferedReader(new FileReader("specs/egl/EGL14.spec"));
-
- String egljFilename = "android/opengl/EGL14.java";
- String eglcFilename = "android_opengl_EGL14.cpp";
- PrintStream egljStream =
- new PrintStream(new FileOutputStream("out/" + egljFilename));
- PrintStream eglcStream =
- new PrintStream(new FileOutputStream("out/" + eglcFilename));
- egljStream.println("/*");
- eglcStream.println("/*");
- copy("stubs/egl/EGL14Header.java-if", egljStream);
- copy("stubs/egl/EGL14cHeader.cpp", eglcStream);
- EGLCodeEmitter emitter = new EGLCodeEmitter(
- "android/opengl/EGL14",
- checker, egljStream, eglcStream);
- emit(emitter, specReader, egljStream, eglcStream);
- emitter.emitNativeRegistration("register_android_opengl_jni_EGL14");
- egljStream.println("}");
- egljStream.close();
- eglcStream.close();
+ for(String suffix: new String[] {"EGL14", "EGLExt"}) {
+ BufferedReader specReader = new BufferedReader(new FileReader(
+ "specs/egl/" + suffix + ".spec"));
+ String egljFilename = "android/opengl/" + suffix + ".java";
+ String eglcFilename = "android_opengl_" + suffix + ".cpp";
+ PrintStream egljStream =
+ new PrintStream(new FileOutputStream("out/" + egljFilename));
+ PrintStream eglcStream =
+ new PrintStream(new FileOutputStream("out/" + eglcFilename));
+ copy("stubs/egl/" + suffix + "Header.java-if", egljStream);
+ copy("stubs/egl/" + suffix + "cHeader.cpp", eglcStream);
+ EGLCodeEmitter emitter = new EGLCodeEmitter(
+ "android/opengl/" + suffix,
+ checker, egljStream, eglcStream);
+ emit(emitter, specReader, egljStream, eglcStream);
+ emitter.emitNativeRegistration(
+ "register_android_opengl_jni_" + suffix);
+ egljStream.println("}");
+ egljStream.close();
+ eglcStream.close();
+ }
}
}
diff --git a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
index 0c29d5c..f3bf220 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
+++ b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
@@ -1,4 +1,4 @@
-**
+/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
index 5fda9f8..54de1e7 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
+++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
@@ -1,3 +1,4 @@
+/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if
new file mode 100644
index 0000000..a5a8968
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if
@@ -0,0 +1,36 @@
+/*
+** Copyright 2013, 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.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/**
+ * EGL Extensions
+ */
+public class EGLExt {
+
+ // EGL_KHR_create_context
+ public static final int EGL_CONTEXT_MAJOR_VERSION_KHR = 0x3098;
+ public static final int EGL_CONTEXT_MINOR_VERSION_KHR = 0x30FB;
+ public static final int EGL_CONTEXT_FLAGS_KHR = 0x30FC;
+ public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040;
+
+ native private static void _nativeClassInit();
+ static {
+ _nativeClassInit();
+ }
+
diff --git a/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
new file mode 100644
index 0000000..5e1ffa1
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
@@ -0,0 +1,133 @@
+/*
+** Copyright 2013, 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.
+*/
+
+// This source file is automatically generated
+
+#include "jni.h"
+#include "JNIHelp.h"
+#include <android_runtime/AndroidRuntime.h>
+#include <android_runtime/android_view_Surface.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <gui/Surface.h>
+#include <gui/GLConsumer.h>
+#include <gui/Surface.h>
+
+#include <ui/ANativeObjectBase.h>
+
+static int initialized = 0;
+
+static jclass egldisplayClass;
+static jclass eglcontextClass;
+static jclass eglsurfaceClass;
+static jclass eglconfigClass;
+
+static jmethodID egldisplayGetHandleID;
+static jmethodID eglcontextGetHandleID;
+static jmethodID eglsurfaceGetHandleID;
+static jmethodID eglconfigGetHandleID;
+
+static jmethodID egldisplayConstructor;
+static jmethodID eglcontextConstructor;
+static jmethodID eglsurfaceConstructor;
+static jmethodID eglconfigConstructor;
+
+static jobject eglNoContextObject;
+static jobject eglNoDisplayObject;
+static jobject eglNoSurfaceObject;
+
+
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+ jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay");
+ egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal);
+ jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext");
+ eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal);
+ jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface");
+ eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal);
+ jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
+ eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
+
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+
+
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
+
+
+ jclass eglClass = _env->FindClass("android/opengl/EGL14");
+ jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;");
+ _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject);
+
+ jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;");
+ _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject);
+
+ jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;");
+ _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject);
+}
+
+static void *
+fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
+ if (obj == NULL){
+ jniThrowException(_env, "java/lang/IllegalArgumentException",
+ "Object is set to null.");
+ }
+
+ return (void*) (_env->CallIntMethod(obj, mid));
+}
+
+static jobject
+toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
+ if (cls == eglcontextClass &&
+ (EGLContext)handle == EGL_NO_CONTEXT) {
+ return eglNoContextObject;
+ }
+
+ if (cls == egldisplayClass &&
+ (EGLDisplay)handle == EGL_NO_DISPLAY) {
+ return eglNoDisplayObject;
+ }
+
+ if (cls == eglsurfaceClass &&
+ (EGLSurface)handle == EGL_NO_SURFACE) {
+ return eglNoSurfaceObject;
+ }
+
+ return _env->NewObject(cls, con, (jint)handle);
+}
+
+// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg
index c711307..6e72c31 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg
+++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg
@@ -1,2 +1,2 @@
{"glGetUniformIndices", "(I[Ljava/lang/String;[II)V", (void *) android_glGetUniformIndices_array },
-{"glGetUniformIndices", "(I[Ljava/lang/String;[Ljava/nio/IntBuffer)V", (void *) android_glGetUniformIndices_buffer },
+{"glGetUniformIndices", "(I[Ljava/lang/String;Ljava/nio/IntBuffer;)V", (void *) android_glGetUniformIndices_buffer },