Merge "MountService: Add API call for getting a list of pids currently using the specified mountpoint"
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 86a6fac..f66a2d3 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -29,6 +29,8 @@
#include <surfaceflinger/ISurface.h>
#include <ui/Overlay.h>
+#include <hardware/hardware.h>
+
#include <media/mediaplayer.h>
#include <media/AudioSystem.h>
#include "CameraService.h"
@@ -606,7 +608,7 @@
params.getPreviewSize(&w, &h);
ISurface::BufferHeap buffers(w, h, w, h,
- PIXEL_FORMAT_YCbCr_420_SP,
+ HAL_PIXEL_FORMAT_YCbCr_420_SP,
mOrientation,
0,
mHardware->getPreviewHeap());
@@ -927,7 +929,8 @@
LOGV("Snapshot image width=%d, height=%d", w, h);
}
ISurface::BufferHeap buffers(w, h, w, h,
- PIXEL_FORMAT_YCbCr_420_SP, mOrientation, 0, mHardware->getRawHeap());
+ HAL_PIXEL_FORMAT_YCbCr_420_SP, mOrientation, 0,
+ mHardware->getRawHeap());
mSurface->registerBuffers(buffers);
}
diff --git a/common/java/com/android/common/speech/Recognition.java b/common/java/com/android/common/speech/Recognition.java
new file mode 100644
index 0000000..6f164a9
--- /dev/null
+++ b/common/java/com/android/common/speech/Recognition.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+package com.android.common.speech;
+
+/**
+ * Utilities for voice recognition implementations.
+ *
+ * @see android.app.RecognitionService
+ */
+public class Recognition {
+
+ /**
+ * The extra key used in an intent to the speech recognizer for voice search. Not
+ * generally to be used by developers. The system search dialog uses this, for example,
+ * to set a calling package for identification by a voice search API. If this extra
+ * is set by anyone but the system process, it should be overridden by the voice search
+ * implementation.
+ */
+ public final static String EXTRA_CALLING_PACKAGE = "calling_package";
+
+ private Recognition() { } // don't instantiate
+}
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
index 6d87321b..607155c 100644
--- a/include/ui/PixelFormat.h
+++ b/include/ui/PixelFormat.h
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <utils/Errors.h>
#include <pixelflinger/format.h>
+#include <hardware/hardware.h>
namespace android {
@@ -57,25 +58,18 @@
// real pixel formats supported for rendering -----------------------------
- PIXEL_FORMAT_RGBA_8888 = GGL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
- PIXEL_FORMAT_RGBX_8888 = GGL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
- PIXEL_FORMAT_RGB_888 = GGL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
- PIXEL_FORMAT_RGB_565 = GGL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
- PIXEL_FORMAT_BGRA_8888 = GGL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
- PIXEL_FORMAT_RGBA_5551 = GGL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
- PIXEL_FORMAT_RGBA_4444 = GGL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
+ PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
+ PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
+ PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
+ PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
+ PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
PIXEL_FORMAT_A_8 = GGL_PIXEL_FORMAT_A_8, // 8-bit A
PIXEL_FORMAT_L_8 = GGL_PIXEL_FORMAT_L_8, // 8-bit L (R=G=B=L)
PIXEL_FORMAT_LA_88 = GGL_PIXEL_FORMAT_LA_88, // 16-bit LA
PIXEL_FORMAT_RGB_332 = GGL_PIXEL_FORMAT_RGB_332, // 8-bit RGB
- PIXEL_FORMAT_YCbCr_422_SP= GGL_PIXEL_FORMAT_YCbCr_422_SP,
- PIXEL_FORMAT_YCbCr_420_SP= GGL_PIXEL_FORMAT_YCbCr_420_SP,
- PIXEL_FORMAT_YCbCr_422_P = GGL_PIXEL_FORMAT_YCbCr_422_P,
- PIXEL_FORMAT_YCbCr_420_P = GGL_PIXEL_FORMAT_YCbCr_420_P,
- PIXEL_FORMAT_YCbCr_422_I = GGL_PIXEL_FORMAT_YCbCr_422_I,
- PIXEL_FORMAT_YCbCr_420_I = GGL_PIXEL_FORMAT_YCbCr_420_I,
-
// New formats can be added if they're also defined in
// pixelflinger/format.h
};
@@ -96,10 +90,7 @@
RGB = 2,
RGBA = 3,
LUMINANCE = 4,
- LUMINANCE_ALPHA = 5,
- Y_CB_CR_SP = 6,
- Y_CB_CR_P = 7,
- Y_CB_CR_I = 8,
+ LUMINANCE_ALPHA = 5
};
struct szinfo {
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index f38efab..c080513 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -185,20 +185,20 @@
if (res == NO_ERROR) {
int bpp = 0;
switch (t.format) {
- case GGL_PIXEL_FORMAT_RGB_565:
- case GGL_PIXEL_FORMAT_RGBA_4444:
+ case HAL_PIXEL_FORMAT_RGB_565:
+ case HAL_PIXEL_FORMAT_RGBA_4444:
bpp = 2;
break;
- case GGL_PIXEL_FORMAT_RGBA_8888:
- case GGL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
bpp = 4;
break;
- case GGL_PIXEL_FORMAT_YCbCr_422_SP:
- case GGL_PIXEL_FORMAT_YCbCr_420_SP:
- // just show the Y plane of YUV buffers
- bpp = 1;
- break;
default:
+ if (isSupportedYuvFormat(t.format)) {
+ // just show the Y plane of YUV buffers
+ bpp = 1;
+ break;
+ }
// oops, we don't handle this format!
LOGE("layer %p, texture=%d, using format %d, which is not "
"supported by the GL", this, texture->name, t.format);
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 4d7bef8..5b96e9d 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -509,6 +509,21 @@
}
}
+bool LayerBase::isSupportedYuvFormat(int format) const
+{
+ switch (format) {
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_422_P:
+ case HAL_PIXEL_FORMAT_YCbCr_420_P:
+ case HAL_PIXEL_FORMAT_YCbCr_422_I:
+ case HAL_PIXEL_FORMAT_YCbCr_420_I:
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ return true;
+ }
+ return false;
+}
+
void LayerBase::loadTexture(Texture* texture,
const Region& dirty, const GGLSurface& t) const
{
@@ -573,21 +588,20 @@
data = t.data;
}
- if (t.format == GGL_PIXEL_FORMAT_RGB_565) {
+ if (t.format == HAL_PIXEL_FORMAT_RGB_565) {
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGB, texture->potWidth, texture->potHeight, 0,
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, data);
- } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) {
+ } else if (t.format == HAL_PIXEL_FORMAT_RGBA_4444) {
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA, texture->potWidth, texture->potHeight, 0,
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, data);
- } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 ||
- t.format == GGL_PIXEL_FORMAT_RGBX_8888) {
+ } else if (t.format == HAL_PIXEL_FORMAT_RGBA_8888 ||
+ t.format == HAL_PIXEL_FORMAT_RGBX_8888) {
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA, texture->potWidth, texture->potHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data);
- } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP ||
- t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) {
+ } else if (isSupportedYuvFormat(t.format)) {
// just show the Y plane of YUV buffers
glTexImage2D(GL_TEXTURE_2D, 0,
GL_LUMINANCE, texture->potWidth, texture->potHeight, 0,
@@ -599,24 +613,23 @@
}
}
if (!data) {
- if (t.format == GGL_PIXEL_FORMAT_RGB_565) {
+ if (t.format == HAL_PIXEL_FORMAT_RGB_565) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, bounds.top, t.width, bounds.height(),
GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
t.data + bounds.top*t.stride*2);
- } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) {
+ } else if (t.format == HAL_PIXEL_FORMAT_RGBA_4444) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, bounds.top, t.width, bounds.height(),
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4,
t.data + bounds.top*t.stride*2);
- } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 ||
- t.format == GGL_PIXEL_FORMAT_RGBX_8888) {
+ } else if (t.format == HAL_PIXEL_FORMAT_RGBA_8888 ||
+ t.format == HAL_PIXEL_FORMAT_RGBX_8888) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, bounds.top, t.width, bounds.height(),
GL_RGBA, GL_UNSIGNED_BYTE,
t.data + bounds.top*t.stride*4);
- } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP ||
- t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) {
+ } else if (isSupportedYuvFormat(t.format)) {
// just show the Y plane of YUV buffers
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, bounds.top, t.width, bounds.height(),
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index a49faf7..d1bbd04 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -265,6 +265,7 @@
status_t initializeEglImage(
const sp<GraphicBuffer>& buffer, Texture* texture);
+ bool isSupportedYuvFormat(int format) const;
sp<SurfaceFlinger> mFlinger;
uint32_t mFlags;
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index bd3113b..6d1685b 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -472,10 +472,12 @@
// First, try to use the buffer as an EGLImage directly
if (mUseEGLImageDirectly) {
// NOTE: Assume the buffer is allocated with the proper USAGE flags
+
sp<GraphicBuffer> buffer = new GraphicBuffer(
src.img.w, src.img.h, src.img.format,
GraphicBuffer::USAGE_HW_TEXTURE,
src.img.w, src.img.handle, false);
+
err = mLayer.initializeEglImage(buffer, &mTexture);
if (err != NO_ERROR) {
mUseEGLImageDirectly = false;
@@ -563,33 +565,27 @@
}
// Allocate a temporary buffer and create the corresponding EGLImageKHR
-
- status_t err;
- mTempGraphicBuffer.clear();
- mTempGraphicBuffer = new GraphicBuffer(
+ // once the EGLImage has been created we don't need the
+ // graphic buffer reference anymore.
+ sp<GraphicBuffer> buffer = new GraphicBuffer(
w, h, HAL_PIXEL_FORMAT_RGB_565,
GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_HW_2D);
- err = mTempGraphicBuffer->initCheck();
+ status_t err = buffer->initCheck();
if (err == NO_ERROR) {
NativeBuffer& dst(mTempBuffer);
- dst.img.w = mTempGraphicBuffer->getStride();
+ dst.img.w = buffer->getStride();
dst.img.h = h;
- dst.img.format = mTempGraphicBuffer->getPixelFormat();
- dst.img.handle = (native_handle_t *)mTempGraphicBuffer->handle;
+ dst.img.format = buffer->getPixelFormat();
+ dst.img.handle = (native_handle_t *)buffer->handle;
dst.img.base = 0;
dst.crop.l = 0;
dst.crop.t = 0;
dst.crop.r = w;
dst.crop.b = h;
- err = mLayer.initializeEglImage(
- mTempGraphicBuffer, &mTexture);
- // once the EGLImage has been created (whether it fails
- // or not) we don't need the graphic buffer reference
- // anymore.
- mTempGraphicBuffer.clear();
+ err = mLayer.initializeEglImage(buffer, &mTexture);
}
return err;
@@ -606,9 +602,6 @@
Texture defaultTexture;
mTexture = defaultTexture;
mTexture.name = mLayer.createTexture();
-
- // and the associated buffer
- mTempGraphicBuffer.clear();
}
// ---------------------------------------------------------------------------
diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h
index 3257b76..eb5b8eb 100644
--- a/libs/surfaceflinger/LayerBuffer.h
+++ b/libs/surfaceflinger/LayerBuffer.h
@@ -144,7 +144,6 @@
size_t mBufferSize;
mutable LayerBase::Texture mTexture;
mutable NativeBuffer mTempBuffer;
- mutable sp<GraphicBuffer> mTempGraphicBuffer;
mutable bool mUseEGLImageDirectly;
};
diff --git a/libs/ui/PixelFormat.cpp b/libs/ui/PixelFormat.cpp
index b65ed97..3f76e1a 100644
--- a/libs/ui/PixelFormat.cpp
+++ b/libs/ui/PixelFormat.cpp
@@ -69,9 +69,6 @@
COMPONENT(RGBA)
COMPONENT(LUMINANCE)
COMPONENT(LUMINANCE_ALPHA)
- COMPONENT(Y_CB_CR_SP)
- COMPONENT(Y_CB_CR_P)
- COMPONENT(Y_CB_CR_I)
default:
return BAD_INDEX;
}
diff --git a/opengl/libagl/copybit.cpp b/opengl/libagl/copybit.cpp
index 4cacc11..67d1ce7 100644
--- a/opengl/libagl/copybit.cpp
+++ b/opengl/libagl/copybit.cpp
@@ -48,19 +48,8 @@
const GGLSurface* surface, int32_t opFormat,
android_native_buffer_t* buffer, copybit_image_t* img)
{
- uint32_t vstride = 0;
- if (opFormat == COPYBIT_FORMAT_YCbCr_422_SP ||
- opFormat == COPYBIT_FORMAT_YCbCr_420_SP) {
- // NOTE: this static_cast is really not safe b/c we can't know for
- // sure the buffer passed is of the right type.
- // However, since we do this only for YUV formats, we should be safe
- // since only SurfaceFlinger makes use of them.
- GraphicBuffer* graphicBuffer = static_cast<GraphicBuffer*>(buffer);
- vstride = graphicBuffer->getVerticalStride();
- }
-
img->w = surface->stride;
- img->h = vstride ? vstride : surface->height;
+ img->h = surface->height;
img->format = opFormat;
img->base = surface->data;
img->handle = (native_handle_t *)buffer->handle;
@@ -98,8 +87,6 @@
case COPYBIT_FORMAT_BGRA_8888:
case COPYBIT_FORMAT_RGBA_5551:
case COPYBIT_FORMAT_RGBA_4444:
- case COPYBIT_FORMAT_YCbCr_422_SP:
- case COPYBIT_FORMAT_YCbCr_420_SP:
return true;
default:
return false;