Merge "ClipDescription no longer inherits from ClipData."
diff --git a/core/java/android/nfc/ErrorCodes.java b/core/java/android/nfc/ErrorCodes.java
index 5b76d84..69329df 100644
--- a/core/java/android/nfc/ErrorCodes.java
+++ b/core/java/android/nfc/ErrorCodes.java
@@ -33,6 +33,34 @@
}
}
+ public static String asString(int code) {
+ switch (code) {
+ case SUCCESS: return "SUCCESS";
+ case ERROR_IO: return "IO";
+ case ERROR_CANCELLED: return "CANCELLED";
+ case ERROR_TIMEOUT: return "TIMEOUT";
+ case ERROR_BUSY: return "BUSY";
+ case ERROR_CONNECT: return "CONNECT/DISCONNECT";
+// case ERROR_DISCONNECT: return "DISCONNECT";
+ case ERROR_READ: return "READ";
+ case ERROR_WRITE: return "WRITE";
+ case ERROR_INVALID_PARAM: return "INVALID_PARAM";
+ case ERROR_INSUFFICIENT_RESOURCES: return "INSUFFICIENT_RESOURCES";
+ case ERROR_SOCKET_CREATION: return "SOCKET_CREATION";
+ case ERROR_SOCKET_NOT_CONNECTED: return "SOCKET_NOT_CONNECTED";
+ case ERROR_BUFFER_TO_SMALL: return "BUFFER_TO_SMALL";
+ case ERROR_SAP_USED: return "SAP_USED";
+ case ERROR_SERVICE_NAME_USED: return "SERVICE_NAME_USED";
+ case ERROR_SOCKET_OPTIONS: return "SOCKET_OPTIONS";
+ case ERROR_NFC_ON: return "NFC_ON";
+ case ERROR_NOT_INITIALIZED: return "NOT_INITIALIZED";
+ case ERROR_SE_ALREADY_SELECTED: return "SE_ALREADY_SELECTED";
+ case ERROR_SE_CONNECTED: return "SE_CONNECTED";
+ case ERROR_NO_SE_CONNECTED: return "NO_SE_CONNECTED";
+ default: return "UNKNOWN ERROR";
+ }
+ }
+
public static final int SUCCESS = 0;
public static final int ERROR_IO = -1;
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index b6da308..b5e85a0 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -498,6 +498,7 @@
handleSinkPlayingStateChange(device, BluetoothA2dp.STATE_NOT_PLAYING,
BluetoothA2dp.STATE_PLAYING);
} else {
+ mPlayingA2dpDevice = null;
int prevState = mAudioDevices.get(device);
handleSinkStateChange(device, prevState, state);
}
@@ -512,7 +513,6 @@
mSinkCount--;
} else if (state == BluetoothA2dp.STATE_CONNECTED) {
mSinkCount ++;
- mPlayingA2dpDevice = null;
}
mAudioDevices.put(device, state);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0456463..87e03cf 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -7579,6 +7579,11 @@
* the auto scaling to true. Doing so, however, will generate a bitmap of a different
* size than the view. This implies that your application must be able to handle this
* size.</p>
+ *
+ * <p>You should avoid calling this method when hardware acceleration is enabled. If
+ * you do not need the drawing cache bitmap, calling this method will increase memory
+ * usage and cause the view to be rendered in software once, thus negatively impacting
+ * performance.</p>
*
* @see #getDrawingCache()
* @see #destroyDrawingCache()
@@ -7699,7 +7704,9 @@
canvas.translate(-mScrollX, -mScrollY);
mPrivateFlags |= DRAWN;
- mPrivateFlags |= DRAWING_CACHE_VALID;
+ if (mAttachInfo == null || !mAttachInfo.mHardwareAccelerated) {
+ mPrivateFlags |= DRAWING_CACHE_VALID;
+ }
// Fast path for layouts with no backgrounds
if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 7b2703b..b881bdd 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1867,12 +1867,15 @@
if ((mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE) {
final int count = mChildrenCount;
final View[] children = mChildren;
+ final boolean buildCache = !isHardwareAccelerated();
for (int i = 0; i < count; i++) {
final View child = children[i];
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
child.setDrawingCacheEnabled(true);
- child.buildDrawingCache(true);
+ if (buildCache) {
+ child.buildDrawingCache(true);
+ }
}
}
@@ -1933,6 +1936,7 @@
if ((flags & FLAG_RUN_ANIMATION) != 0 && canAnimate()) {
final boolean cache = (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE;
+ final boolean buildCache = !isHardwareAccelerated();
for (int i = 0; i < count; i++) {
final View child = children[i];
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
@@ -1941,7 +1945,9 @@
bindLayoutAnimation(child);
if (cache) {
child.setDrawingCacheEnabled(true);
- child.buildDrawingCache(true);
+ if (buildCache) {
+ child.buildDrawingCache(true);
+ }
}
}
}
@@ -2205,8 +2211,7 @@
if (!canvas.isHardwareAccelerated()) {
cache = child.getDrawingCache(true);
} else {
- // TODO: bring back
- // displayList = child.getDisplayList();
+ displayList = child.getDisplayList();
}
}
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 2e368b8..06261bb 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -561,6 +561,11 @@
scheduleTraversals();
}
}
+
+ void invalidate() {
+ mDirty.set(0, 0, mWidth, mHeight);
+ scheduleTraversals();
+ }
public ViewParent getParent() {
return null;
diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java
index 11d72de..bdeb5c2 100644
--- a/core/java/android/widget/SlidingDrawer.java
+++ b/core/java/android/widget/SlidingDrawer.java
@@ -652,7 +652,7 @@
// Try only once... we should really loop but it's not a big deal
// if the draw was cancelled, it will only be temporary anyway
content.getViewTreeObserver().dispatchOnPreDraw();
- content.buildDrawingCache();
+ if (!content.isHardwareAccelerated()) content.buildDrawingCache();
content.setVisibility(View.GONE);
}
diff --git a/core/jni/android/graphics/ColorFilter.cpp b/core/jni/android/graphics/ColorFilter.cpp
index f3be8b0..e2a959d 100644
--- a/core/jni/android/graphics/ColorFilter.cpp
+++ b/core/jni/android/graphics/ColorFilter.cpp
@@ -24,6 +24,7 @@
#include "SkPorterDuff.h"
#include <SkiaColorFilter.h>
+#include <Caches.h>
namespace android {
@@ -32,28 +33,37 @@
class SkColorFilterGlue {
public:
static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) {
- delete f;
obj->safeUnref();
+ // f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef
+#ifdef USE_OPENGL_RENDERER
+ if (android::uirenderer::Caches::hasInstance()) {
+ android::uirenderer::Caches::getInstance().resourceCache.destructor(f);
+ } else {
+ delete f;
+ }
+#endif
}
- static SkiaColorFilter* glCreatePorterDuffFilter(JNIEnv* env, jobject, jint srcColor,
- SkPorterDuff::Mode mode) {
+ static SkiaColorFilter* glCreatePorterDuffFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+ jint srcColor, SkPorterDuff::Mode mode) {
#ifdef USE_OPENGL_RENDERER
- return new SkiaBlendFilter(srcColor, SkPorterDuff::ToXfermodeMode(mode));
+ return new SkiaBlendFilter(skFilter, srcColor, SkPorterDuff::ToXfermodeMode(mode));
#else
return NULL;
#endif
}
- static SkiaColorFilter* glCreateLightingFilter(JNIEnv* env, jobject, jint mul, jint add) {
+ static SkiaColorFilter* glCreateLightingFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+ jint mul, jint add) {
#ifdef USE_OPENGL_RENDERER
- return new SkiaLightingFilter(mul, add);
+ return new SkiaLightingFilter(skFilter, mul, add);
#else
return NULL;
#endif
}
- static SkiaColorFilter* glCreateColorMatrixFilter(JNIEnv* env, jobject, jfloatArray jarray) {
+ static SkiaColorFilter* glCreateColorMatrixFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+ jfloatArray jarray) {
#ifdef USE_OPENGL_RENDERER
AutoJavaFloatArray autoArray(env, jarray, 20);
const float* src = autoArray.ptr();
@@ -70,7 +80,7 @@
colorVector[2] = src[14];
colorVector[3] = src[19];
- return new SkiaColorMatrixFilter(colorMatrix, colorVector);
+ return new SkiaColorMatrixFilter(skFilter, colorMatrix, colorVector);
#else
return NULL;
#endif
@@ -107,17 +117,17 @@
static JNINativeMethod porterduff_methods[] = {
{ "native_CreatePorterDuffFilter", "(II)I", (void*) SkColorFilterGlue::CreatePorterDuffFilter },
- { "nCreatePorterDuffFilter", "(II)I", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
+ { "nCreatePorterDuffFilter", "(III)I", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
};
static JNINativeMethod lighting_methods[] = {
{ "native_CreateLightingFilter", "(II)I", (void*) SkColorFilterGlue::CreateLightingFilter },
- { "nCreateLightingFilter", "(II)I", (void*) SkColorFilterGlue::glCreateLightingFilter },
+ { "nCreateLightingFilter", "(III)I", (void*) SkColorFilterGlue::glCreateLightingFilter },
};
static JNINativeMethod colormatrix_methods[] = {
{ "nativeColorMatrixFilter", "([F)I", (void*) SkColorFilterGlue::CreateColorMatrixFilter },
- { "nColorMatrixFilter", "([F)I", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
+ { "nColorMatrixFilter", "(I[F)I", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
};
#define REG(env, name, array) \
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 79051c2..4be1321 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -58,6 +58,8 @@
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
android::uirenderer::Caches::getInstance().resourceCache.destructor(skiaShader);
+ } else {
+ delete skiaShader;
}
#endif
}
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index 45fd5a0..a586f49 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -1029,7 +1029,7 @@
#define FIND_CLASS(var, className) \
var = env->FindClass(className); \
- LOG_FATAL_IF(! var, "Unable to find class " className); \
+ LOG_FATAL_IF(! var, "Unable to find class %s", className); \
var = jclass(env->NewGlobalRef(var));
#define GET_METHOD_ID(var, clazz, methodName, fieldDescriptor) \
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 843dddb..cf9bab1 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -28,25 +28,10 @@
using namespace android;
#define SUCCESS 0
-#define DRM_DIRECTORY_PERMISSION 0700
-#define DRM_PLUGINS_ROOT "/data/drm/plugins"
-#define DRM_PLUGINS_NATIVE "/data/drm/plugins/native"
-#define DRM_PLUGINS_NATIVE_DATABASES "/data/drm/plugins/native/databases"
void DrmManagerService::instantiate() {
LOGV("instantiate");
-
- int res = mkdir(DRM_PLUGINS_ROOT, DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- res = mkdir(DRM_PLUGINS_NATIVE, DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- res = mkdir(DRM_PLUGINS_NATIVE_DATABASES, DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- defaultServiceManager()
- ->addService(String16("drm.drmManager"), new DrmManagerService());
- }
- }
- }
+ defaultServiceManager()->addService(String16("drm.drmManager"), new DrmManagerService());
}
DrmManagerService::DrmManagerService() {
diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java
index 245c615..4f32342 100644
--- a/graphics/java/android/graphics/ColorMatrixColorFilter.java
+++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java
@@ -27,7 +27,7 @@
public ColorMatrixColorFilter(ColorMatrix matrix) {
final float[] colorMatrix = matrix.getArray();
native_instance = nativeColorMatrixFilter(colorMatrix);
- nativeColorFilter = nColorMatrixFilter(colorMatrix);
+ nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix);
}
/**
@@ -42,9 +42,9 @@
throw new ArrayIndexOutOfBoundsException();
}
native_instance = nativeColorMatrixFilter(array);
- nativeColorFilter = nColorMatrixFilter(array);
+ nativeColorFilter = nColorMatrixFilter(native_instance, array);
}
private static native int nativeColorMatrixFilter(float[] array);
- private static native int nColorMatrixFilter(float[] array);
+ private static native int nColorMatrixFilter(int nativeFilter, float[] array);
}
diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java
index 715ce86..c621de6 100644
--- a/graphics/java/android/graphics/LightingColorFilter.java
+++ b/graphics/java/android/graphics/LightingColorFilter.java
@@ -30,9 +30,9 @@
*/
public LightingColorFilter(int mul, int add) {
native_instance = native_CreateLightingFilter(mul, add);
- nativeColorFilter = nCreateLightingFilter(mul, add);
+ nativeColorFilter = nCreateLightingFilter(native_instance, mul, add);
}
private static native int native_CreateLightingFilter(int mul, int add);
- private static native int nCreateLightingFilter(int mul, int add);
+ private static native int nCreateLightingFilter(int nativeFilter, int mul, int add);
}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index b02dab1..ecc7c24 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -26,9 +26,10 @@
*/
public PorterDuffColorFilter(int srcColor, PorterDuff.Mode mode) {
native_instance = native_CreatePorterDuffFilter(srcColor, mode.nativeInt);
- nativeColorFilter = nCreatePorterDuffFilter(srcColor, mode.nativeInt);
+ nativeColorFilter = nCreatePorterDuffFilter(native_instance, srcColor, mode.nativeInt);
}
private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
- private static native int nCreatePorterDuffFilter(int srcColor, int porterDuffMode);
+ private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+ int porterDuffMode);
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index a9cd5be..0dd9c5a 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -288,7 +288,7 @@
}
break;
case SetupColorFilter: {
- // TODO: Implement
+ renderer.setupColorFilter(getColorFilter());
}
break;
case ResetShadow: {
@@ -512,7 +512,6 @@
void DisplayListRenderer::resetShader() {
addOp(DisplayList::ResetShader);
- OpenGLRenderer::resetShader();
}
void DisplayListRenderer::setupShader(SkiaShader* shader) {
@@ -522,17 +521,15 @@
void DisplayListRenderer::resetColorFilter() {
addOp(DisplayList::ResetColorFilter);
- OpenGLRenderer::resetColorFilter();
}
void DisplayListRenderer::setupColorFilter(SkiaColorFilter* filter) {
- // TODO: Implement
- OpenGLRenderer::setupColorFilter(filter);
+ addOp(DisplayList::SetupColorFilter);
+ addColorFilter(filter);
}
void DisplayListRenderer::resetShadow() {
addOp(DisplayList::ResetShadow);
- OpenGLRenderer::resetShadow();
}
void DisplayListRenderer::setupShadow(float radius, float dx, float dy, int color) {
@@ -540,7 +537,6 @@
addFloat(radius);
addPoint(dx, dy);
addInt(color);
- OpenGLRenderer::setupShadow(radius, dx, dy, color);
}
}; // namespace uirenderer
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index ce4cfc5..6636de6 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -135,6 +135,10 @@
return (SkiaShader*) getInt();
}
+ SkiaColorFilter* getColorFilter() {
+ return (SkiaColorFilter*) getInt();
+ }
+
inline int getIndex() {
return mReader.readInt();
}
@@ -183,6 +187,7 @@
Vector<SkBitmap*> mBitmapResources;
Vector<SkiaShader*> mShaderResources;
+ Vector<SkiaColorFilter*> mFilterResources;
Vector<SkPaint*> mPaints;
Vector<SkMatrix*> mMatrices;
@@ -276,6 +281,10 @@
return mMatrices;
}
+ const Vector<SkiaColorFilter*>& getFilterResources() const {
+ return mFilterResources;
+ }
+
private:
inline void addOp(DisplayList::Op drawOp) {
mWriter.writeInt(drawOp);
@@ -372,10 +381,18 @@
caches.resourceCache.incrementRefcount(shader);
}
+ inline void addColorFilter(SkiaColorFilter* colorFilter) {
+ addInt((int)colorFilter);
+ mFilterResources.add(colorFilter);
+ Caches& caches = Caches::getInstance();
+ caches.resourceCache.incrementRefcount(colorFilter);
+ }
+
SkChunkAlloc mHeap;
Vector<SkBitmap*> mBitmapResources;
Vector<SkiaShader*> mShaderResources;
+ Vector<SkiaColorFilter*> mFilterResources;
Vector<SkPaint*> mPaints;
DefaultKeyedVector<SkPaint *, SkPaint *> mPaintMap;
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index b0fbe65..47c5d48 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -67,6 +67,11 @@
incrementRefcount((void*)shaderResource, kShader);
}
+void ResourceCache::incrementRefcount(SkiaColorFilter* filterResource) {
+ filterResource->getSkColorFilter()->safeRef();
+ incrementRefcount((void*)filterResource, kColorFilter);
+}
+
void ResourceCache::decrementRefcount(void* resource) {
ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
if (ref == NULL) {
@@ -90,6 +95,11 @@
decrementRefcount((void*)shaderResource);
}
+void ResourceCache::decrementRefcount(SkiaColorFilter* filterResource) {
+ filterResource->getSkColorFilter()->safeUnref();
+ decrementRefcount((void*)filterResource);
+}
+
void ResourceCache::recycle(SkBitmap* resource) {
if (mCache->indexOfKey(resource) < 0) {
// not tracking this resource; just recycle the pixel data
@@ -145,6 +155,20 @@
}
}
+void ResourceCache::destructor(SkiaColorFilter* resource) {
+ ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ if (ref == NULL) {
+ // If we're not tracking this resource, just delete it
+ delete resource;
+ return;
+ }
+ ref->destroyed = true;
+ if (ref->refCount == 0) {
+ deleteResourceReference(resource, ref);
+ return;
+ }
+}
+
void ResourceCache::deleteResourceReference(void* resource, ResourceReference* ref) {
if (ref->recycled && ref->resourceType == kBitmap) {
((SkBitmap*) resource)->setPixels(NULL, NULL);
@@ -161,12 +185,20 @@
}
break;
case kShader:
+ {
SkiaShader* shader = (SkiaShader*)resource;
if (Caches::hasInstance()) {
Caches::getInstance().gradientCache.remove(shader->getSkShader());
}
delete shader;
- break;
+ }
+ break;
+ case kColorFilter:
+ {
+ SkiaColorFilter* filter = (SkiaColorFilter*)resource;
+ delete filter;
+ }
+ break;
}
}
mCache->removeItem(resource);
diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h
index b550367..d9b3718 100644
--- a/libs/hwui/ResourceCache.h
+++ b/libs/hwui/ResourceCache.h
@@ -18,6 +18,7 @@
#define ANDROID_UI_RESOURCE_CACHE_H
#include <SkBitmap.h>
+#include <SkiaColorFilter.h>
#include <SkiaShader.h>
#include <utils/KeyedVector.h>
@@ -30,6 +31,7 @@
enum ResourceType {
kBitmap,
kShader,
+ kColorFilter,
};
class ResourceReference {
@@ -53,14 +55,17 @@
~ResourceCache();
void incrementRefcount(SkBitmap* resource);
void incrementRefcount(SkiaShader* resource);
+ void incrementRefcount(SkiaColorFilter* resource);
void incrementRefcount(const void* resource, ResourceType resourceType);
void decrementRefcount(void* resource);
void decrementRefcount(SkBitmap* resource);
void decrementRefcount(SkiaShader* resource);
+ void decrementRefcount(SkiaColorFilter* resource);
void recycle(void* resource);
void recycle(SkBitmap* resource);
void destructor(SkBitmap* resource);
void destructor(SkiaShader* resource);
+ void destructor(SkiaColorFilter* resource);
private:
void deleteResourceReference(void* resource, ResourceReference* ref);
void incrementRefcount(void* resource, ResourceType resourceType);
diff --git a/libs/hwui/SkiaColorFilter.cpp b/libs/hwui/SkiaColorFilter.cpp
index fe57ae7..91b1c32 100644
--- a/libs/hwui/SkiaColorFilter.cpp
+++ b/libs/hwui/SkiaColorFilter.cpp
@@ -23,7 +23,8 @@
// Base color filter
///////////////////////////////////////////////////////////////////////////////
-SkiaColorFilter::SkiaColorFilter(Type type, bool blend): mType(type), mBlend(blend) {
+SkiaColorFilter::SkiaColorFilter(SkColorFilter *skFilter, Type type, bool blend):
+ mType(type), mBlend(blend), mSkFilter(skFilter) {
}
SkiaColorFilter::~SkiaColorFilter() {
@@ -33,8 +34,8 @@
// Color matrix filter
///////////////////////////////////////////////////////////////////////////////
-SkiaColorMatrixFilter::SkiaColorMatrixFilter(float* matrix, float* vector):
- SkiaColorFilter(kColorMatrix, true), mMatrix(matrix), mVector(vector) {
+SkiaColorMatrixFilter::SkiaColorMatrixFilter(SkColorFilter *skFilter, float* matrix, float* vector):
+ SkiaColorFilter(skFilter, kColorMatrix, true), mMatrix(matrix), mVector(vector) {
}
SkiaColorMatrixFilter::~SkiaColorMatrixFilter() {
@@ -56,8 +57,8 @@
// Lighting color filter
///////////////////////////////////////////////////////////////////////////////
-SkiaLightingFilter::SkiaLightingFilter(int multiply, int add):
- SkiaColorFilter(kLighting, true) {
+SkiaLightingFilter::SkiaLightingFilter(SkColorFilter *skFilter, int multiply, int add):
+ SkiaColorFilter(skFilter, kLighting, true) {
mMulR = ((multiply >> 16) & 0xFF) / 255.0f;
mMulG = ((multiply >> 8) & 0xFF) / 255.0f;
mMulB = ((multiply ) & 0xFF) / 255.0f;
@@ -80,8 +81,8 @@
// Blend color filter
///////////////////////////////////////////////////////////////////////////////
-SkiaBlendFilter::SkiaBlendFilter(int color, SkXfermode::Mode mode):
- SkiaColorFilter(kBlend, true), mMode(mode) {
+SkiaBlendFilter::SkiaBlendFilter(SkColorFilter *skFilter, int color, SkXfermode::Mode mode):
+ SkiaColorFilter(skFilter, kBlend, true), mMode(mode) {
const int alpha = (color >> 24) & 0xFF;
mA = alpha / 255.0f;
mR = mA * ((color >> 16) & 0xFF) / 255.0f;
diff --git a/libs/hwui/SkiaColorFilter.h b/libs/hwui/SkiaColorFilter.h
index 865b6f0..17f49f9 100644
--- a/libs/hwui/SkiaColorFilter.h
+++ b/libs/hwui/SkiaColorFilter.h
@@ -18,6 +18,7 @@
#define ANDROID_UI_SKIA_COLOR_FILTER_H
#include <GLES2/gl2.h>
+#include <SkColorFilter.h>
#include "ProgramCache.h"
#include "Extensions.h"
@@ -44,7 +45,7 @@
kBlend,
};
- SkiaColorFilter(Type type, bool blend);
+ SkiaColorFilter(SkColorFilter *skFilter, Type type, bool blend);
virtual ~SkiaColorFilter();
virtual void describe(ProgramDescription& description, const Extensions& extensions) = 0;
@@ -58,9 +59,16 @@
return mType;
}
+ SkColorFilter *getSkColorFilter() {
+ return mSkFilter;
+ }
+
protected:
Type mType;
bool mBlend;
+
+private:
+ SkColorFilter *mSkFilter;
}; // struct SkiaColorFilter
///////////////////////////////////////////////////////////////////////////////
@@ -71,7 +79,7 @@
* A color filter that multiplies the source color with a matrix and adds a vector.
*/
struct SkiaColorMatrixFilter: public SkiaColorFilter {
- SkiaColorMatrixFilter(float* matrix, float* vector);
+ SkiaColorMatrixFilter(SkColorFilter *skFilter, float* matrix, float* vector);
~SkiaColorMatrixFilter();
void describe(ProgramDescription& description, const Extensions& extensions);
@@ -87,7 +95,7 @@
* another fixed value. Ignores the alpha channel of both arguments.
*/
struct SkiaLightingFilter: public SkiaColorFilter {
- SkiaLightingFilter(int multiply, int add);
+ SkiaLightingFilter(SkColorFilter *skFilter, int multiply, int add);
void describe(ProgramDescription& description, const Extensions& extensions);
void setupProgram(Program* program);
@@ -102,7 +110,7 @@
* and PorterDuff blending mode.
*/
struct SkiaBlendFilter: public SkiaColorFilter {
- SkiaBlendFilter(int color, SkXfermode::Mode mode);
+ SkiaBlendFilter(SkColorFilter *skFilter, int color, SkXfermode::Mode mode);
void describe(ProgramDescription& description, const Extensions& extensions);
void setupProgram(Program* program);
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index 0994980..7af6ce8 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -867,7 +867,18 @@
return BAD_VALUE;
Mutex::Autolock _l(mSurfaceLock);
+ if (mConnected == NATIVE_WINDOW_API_EGL) {
+ return INVALID_OPERATION;
+ }
+
mBufferInfo.set(w, h, format);
+ if (format != 0) {
+ // we update the format of the surface as reported by query().
+ // this is to allow applications to change the format of a surface's
+ // buffer, and have it reflected in EGL; which is needed for
+ // EGLConfig validation.
+ mFormat = format;
+ }
return NO_ERROR;
}
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 68524c3..fcf6510 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -480,16 +480,6 @@
}
/**
- * Sets the level of the encoder. Call this before prepare().
- *
- * @param encoderLevel the video encoder level.
- * @hide
- */
- public void setVideoEncoderLevel(int encoderLevel) {
- setParameter(String.format("video-param-encoder-level=%d", encoderLevel));
- }
-
- /**
* Sets the auxiliary time lapse video's resolution and bitrate.
*
* The auxiliary video's resolution and bitrate are determined by the CamcorderProfile
diff --git a/media/java/android/media/videoeditor/MediaImageItem.java b/media/java/android/media/videoeditor/MediaImageItem.java
index df3c5fb..d2f3694 100755
--- a/media/java/android/media/videoeditor/MediaImageItem.java
+++ b/media/java/android/media/videoeditor/MediaImageItem.java
@@ -163,7 +163,9 @@
public void setDuration(long durationMs) {
mDurationMs = durationMs;
- adjustElementsDuration();
+ adjustTransitions();
+ adjustOverlays();
+ adjustEffects();
}
/*
diff --git a/media/java/android/media/videoeditor/MediaItem.java b/media/java/android/media/videoeditor/MediaItem.java
index d9c38af..40d3619 100755
--- a/media/java/android/media/videoeditor/MediaItem.java
+++ b/media/java/android/media/videoeditor/MediaItem.java
@@ -40,13 +40,21 @@
* clip are rendered black.
*/
public static final int RENDERING_MODE_BLACK_BORDER = 0;
+
/**
* When using the RENDERING_MODE_STRETCH rendering mode video frames are
* stretched horizontally or vertically to match the current aspect ratio of
- * the movie.
+ * the video editor.
*/
public static final int RENDERING_MODE_STRETCH = 1;
+ /**
+ * When using the RENDERING_MODE_CROPPING rendering mode video frames are
+ * scaled horizontally or vertically by preserving the original aspect
+ * ratio of the media item.
+ */
+ public static final int RENDERING_MODE_CROPPING = 2;
+
// The unique id of the MediaItem
private final String mUniqueId;
@@ -476,10 +484,9 @@
}
/**
- * Adjust the duration of effects, overlays and transitions.
- * This method will be called after a media item duration is changed.
+ * Adjust the duration transitions.
*/
- protected void adjustElementsDuration() {
+ protected void adjustTransitions() {
// Check if the duration of transitions need to be adjusted
if (mBeginTransition != null) {
final long maxDurationMs = mBeginTransition.getMaximumDuration();
@@ -494,31 +501,12 @@
mEndTransition.setDuration(maxDurationMs);
}
}
+ }
- final List<Overlay> overlays = getAllOverlays();
- for (Overlay overlay : overlays) {
- // Adjust the start time if necessary
- final long overlayStartTimeMs;
- if (overlay.getStartTime() > getTimelineDuration()) {
- overlayStartTimeMs = 0;
- } else {
- overlayStartTimeMs = overlay.getStartTime();
- }
-
- // Adjust the duration if necessary
- final long overlayDurationMs;
- if (overlayStartTimeMs + overlay.getDuration() > getTimelineDuration()) {
- overlayDurationMs = getTimelineDuration() - overlayStartTimeMs;
- } else {
- overlayDurationMs = overlay.getDuration();
- }
-
- if (overlayStartTimeMs != overlay.getStartTime() ||
- overlayDurationMs != overlay.getDuration()) {
- overlay.setStartTimeAndDuration(overlayStartTimeMs, overlayDurationMs);
- }
- }
-
+ /**
+ * Adjust the start time and/or duration of effects.
+ */
+ protected void adjustEffects() {
final List<Effect> effects = getAllEffects();
for (Effect effect : effects) {
// Adjust the start time if necessary
@@ -543,4 +531,33 @@
}
}
}
+
+ /**
+ * Adjust the start time and/or duration of overlays.
+ */
+ protected void adjustOverlays() {
+ final List<Overlay> overlays = getAllOverlays();
+ for (Overlay overlay : overlays) {
+ // Adjust the start time if necessary
+ final long overlayStartTimeMs;
+ if (overlay.getStartTime() > getTimelineDuration()) {
+ overlayStartTimeMs = 0;
+ } else {
+ overlayStartTimeMs = overlay.getStartTime();
+ }
+
+ // Adjust the duration if necessary
+ final long overlayDurationMs;
+ if (overlayStartTimeMs + overlay.getDuration() > getTimelineDuration()) {
+ overlayDurationMs = getTimelineDuration() - overlayStartTimeMs;
+ } else {
+ overlayDurationMs = overlay.getDuration();
+ }
+
+ if (overlayStartTimeMs != overlay.getStartTime() ||
+ overlayDurationMs != overlay.getDuration()) {
+ overlay.setStartTimeAndDuration(overlayStartTimeMs, overlayDurationMs);
+ }
+ }
+ }
}
diff --git a/media/java/android/media/videoeditor/MediaVideoItem.java b/media/java/android/media/videoeditor/MediaVideoItem.java
index f71f4f4..341bf8e 100755
--- a/media/java/android/media/videoeditor/MediaVideoItem.java
+++ b/media/java/android/media/videoeditor/MediaVideoItem.java
@@ -155,7 +155,11 @@
mBeginBoundaryTimeMs = beginMs;
mEndBoundaryTimeMs = endMs;
- adjustElementsDuration();
+ adjustTransitions();
+
+ // Note that the start and duration of any effects and overlays are
+ // not adjusted nor are they automatically removed if they fall
+ // outside the new boundaries.
}
/**
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp
index bada078..7f92eec 100644
--- a/native/android/native_window.cpp
+++ b/native/android/native_window.cpp
@@ -58,8 +58,8 @@
}
int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
- int32_t height) {
- native_window_set_buffers_geometry(window, width, height, 0);
+ int32_t height, int32_t format) {
+ native_window_set_buffers_geometry(window, width, height, format);
return 0;
}
diff --git a/native/include/android/native_window.h b/native/include/android/native_window.h
index ad03d0e..f3d7550 100644
--- a/native/include/android/native_window.h
+++ b/native/include/android/native_window.h
@@ -96,7 +96,7 @@
* For all of these parameters, if 0 is supplied then the window's base
* value will come back in force.
*/
-int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height);
+int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format);
/**
* Lock the window's next drawing surface for writing.
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index e38b9cc..e44c485 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -833,6 +833,9 @@
static bool mask(GLint reqValue, GLint confValue) {
return (confValue & reqValue) == reqValue;
}
+ static bool ignore(GLint reqValue, GLint confValue) {
+ return true;
+ }
};
// ----------------------------------------------------------------------------
@@ -1060,11 +1063,11 @@
{ EGL_CONFIG_CAVEAT, config_management_t::exact },
{ EGL_CONFIG_ID, config_management_t::exact },
{ EGL_LEVEL, config_management_t::exact },
- { EGL_MAX_PBUFFER_HEIGHT, config_management_t::exact },
- { EGL_MAX_PBUFFER_PIXELS, config_management_t::exact },
- { EGL_MAX_PBUFFER_WIDTH, config_management_t::exact },
+ { EGL_MAX_PBUFFER_HEIGHT, config_management_t::ignore },
+ { EGL_MAX_PBUFFER_PIXELS, config_management_t::ignore },
+ { EGL_MAX_PBUFFER_WIDTH, config_management_t::ignore },
{ EGL_NATIVE_RENDERABLE, config_management_t::exact },
- { EGL_NATIVE_VISUAL_ID, config_management_t::exact },
+ { EGL_NATIVE_VISUAL_ID, config_management_t::ignore },
{ EGL_NATIVE_VISUAL_TYPE, config_management_t::exact },
{ EGL_SAMPLES, config_management_t::exact },
{ EGL_SAMPLE_BUFFERS, config_management_t::exact },
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index 7234557..fff70bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -648,7 +648,6 @@
if (mVT == null) break;
mVT.addMovement(event);
mVT.computeCurrentVelocity(1000);
- Slog.d("ClockTouchListener", "dy=" + mVT.getYVelocity());
if (mVT.getYVelocity() < -200 && mSystemPanel.getVisibility() == View.GONE) {
mHandler.removeMessages(MSG_OPEN_SYSTEM_PANEL);
mHandler.sendEmptyMessage(MSG_OPEN_SYSTEM_PANEL);
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index cee8546..8551b0f 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -203,13 +203,9 @@
}
}
if (xliffDepth == 0 && pseudolocalize) {
-#ifdef ENABLE_PSEUDOLOCALIZE
std::string orig(String8(text).string());
std::string pseudo = pseudolocalize_string(orig);
curString.append(String16(String8(pseudo.c_str())));
-#else
- assert(false);
-#endif
} else {
if (isFormatted && hasSubstitutionErrors(fileName, inXml, text) != NO_ERROR) {
return UNKNOWN_ERROR;