summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/android/graphics/Bitmap.cpp4
-rw-r--r--core/jni/android/graphics/Camera.cpp14
-rw-r--r--core/jni/android/graphics/Canvas.cpp2
-rw-r--r--core/jni/android/graphics/ColorFilter.cpp2
-rw-r--r--core/jni/android/graphics/DrawFilter.cpp2
-rw-r--r--core/jni/android/graphics/MaskFilter.cpp2
-rw-r--r--core/jni/android/graphics/PathEffect.cpp2
-rw-r--r--core/jni/android/graphics/Rasterizer.cpp2
-rw-r--r--core/jni/android/graphics/Shader.cpp2
-rw-r--r--core/jni/android/graphics/Xfermode.cpp2
-rw-r--r--core/jni/android_hardware_Camera.cpp240
-rw-r--r--core/jni/android_net_wifi_Wifi.cpp13
-rw-r--r--core/jni/android_view_Surface.cpp2
-rw-r--r--core/jni/com_google_android_gles_jni_EGLImpl.cpp6
15 files changed, 214 insertions, 82 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 41baca2..2ed938a 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -183,7 +183,6 @@ LOCAL_SHARED_LIBRARIES := \
libgui \
libsurfaceflinger_client \
libcamera_client \
- libskiagl \
libskia \
libsqlite \
libdvm \
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 1d961ec..4833df1 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -378,12 +378,12 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
jbyteArray buffer = GraphicsJNI::allocateJavaPixelRef(env, bitmap, ctable);
if (NULL == buffer) {
- ctable->safeUnref();
+ SkSafeUnref(ctable);
delete bitmap;
return NULL;
}
- ctable->safeUnref();
+ SkSafeUnref(ctable);
size_t size = bitmap->getSize();
bitmap->lockPixels();
diff --git a/core/jni/android/graphics/Camera.cpp b/core/jni/android/graphics/Camera.cpp
index 980003e..0d715fd 100644
--- a/core/jni/android/graphics/Camera.cpp
+++ b/core/jni/android/graphics/Camera.cpp
@@ -45,6 +45,18 @@ static void Camera_rotateZ(JNIEnv* env, jobject obj, float degrees) {
v->rotateZ(SkFloatToScalar(degrees));
}
+static void Camera_rotate(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
+ Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ v->rotateX(SkFloatToScalar(x));
+ v->rotateY(SkFloatToScalar(y));
+ v->rotateZ(SkFloatToScalar(z));
+}
+
+static void Camera_setLocation(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
+ Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ v->setCameraLocation(SkFloatToScalar(x), SkFloatToScalar(y), SkFloatToScalar(z));
+}
+
static void Camera_getMatrix(JNIEnv* env, jobject obj, int native_matrix) {
Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
v->getMatrix((SkMatrix*)native_matrix);
@@ -79,6 +91,8 @@ static JNINativeMethod gCameraMethods[] = {
{ "rotateX", "(F)V", (void*)Camera_rotateX },
{ "rotateY", "(F)V", (void*)Camera_rotateY },
{ "rotateZ", "(F)V", (void*)Camera_rotateZ },
+ { "rotate", "(FFF)V", (void*)Camera_rotate },
+ { "setLocation", "(FFF)V", (void*)Camera_setLocation },
{ "nativeGetMatrix", "(I)V", (void*)Camera_getMatrix },
{ "nativeApplyToCanvas", "(I)V", (void*)Camera_applyToCanvas },
{ "dotWithNormal", "(FFF)F", (void*)Camera_dotWithNormal }
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 8944d47..0cdb357 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -673,7 +673,7 @@ public:
}
SkShader* shader = SkShader::CreateBitmapShader(*bitmap,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
- tmpPaint.setShader(shader)->safeUnref();
+ SkSafeUnref(tmpPaint.setShader(shader));
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, ptCount, verts,
texs, (const SkColor*)colorA.ptr(), NULL, indices,
diff --git a/core/jni/android/graphics/ColorFilter.cpp b/core/jni/android/graphics/ColorFilter.cpp
index e2a959d..dd1177b 100644
--- a/core/jni/android/graphics/ColorFilter.cpp
+++ b/core/jni/android/graphics/ColorFilter.cpp
@@ -33,7 +33,7 @@ using namespace uirenderer;
class SkColorFilterGlue {
public:
static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) {
- obj->safeUnref();
+ SkSafeUnref(obj);
// f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
diff --git a/core/jni/android/graphics/DrawFilter.cpp b/core/jni/android/graphics/DrawFilter.cpp
index 496e712..2f9fe7e 100644
--- a/core/jni/android/graphics/DrawFilter.cpp
+++ b/core/jni/android/graphics/DrawFilter.cpp
@@ -34,7 +34,7 @@ class SkDrawFilterGlue {
public:
static void finalizer(JNIEnv* env, jobject clazz, SkDrawFilter* obj) {
- obj->safeUnref();
+ SkSafeUnref(obj);
}
static SkDrawFilter* CreatePaintFlagsDF(JNIEnv* env, jobject clazz,
diff --git a/core/jni/android/graphics/MaskFilter.cpp b/core/jni/android/graphics/MaskFilter.cpp
index 455449e..d3f9b78 100644
--- a/core/jni/android/graphics/MaskFilter.cpp
+++ b/core/jni/android/graphics/MaskFilter.cpp
@@ -14,7 +14,7 @@ static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) {
class SkMaskFilterGlue {
public:
static void destructor(JNIEnv* env, jobject, SkMaskFilter* filter) {
- filter->safeUnref();
+ SkSafeUnref(filter);
}
static SkMaskFilter* createBlur(JNIEnv* env, jobject, float radius, int blurStyle) {
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp
index 0ecb004..cfa9ce4 100644
--- a/core/jni/android/graphics/PathEffect.cpp
+++ b/core/jni/android/graphics/PathEffect.cpp
@@ -12,7 +12,7 @@ class SkPathEffectGlue {
public:
static void destructor(JNIEnv* env, jobject, SkPathEffect* effect) {
- effect->safeUnref();
+ SkSafeUnref(effect);
}
static SkPathEffect* Compose_constructor(JNIEnv* env, jobject,
diff --git a/core/jni/android/graphics/Rasterizer.cpp b/core/jni/android/graphics/Rasterizer.cpp
index db70b57..4e1b36a 100644
--- a/core/jni/android/graphics/Rasterizer.cpp
+++ b/core/jni/android/graphics/Rasterizer.cpp
@@ -32,7 +32,7 @@ class SkRasterizerGlue {
public:
static void finalizer(JNIEnv* env, jobject clazz, SkRasterizer* obj) {
- obj->safeUnref();
+ SkSafeUnref(obj);
}
};
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 3efc41d..0ea8225 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -53,7 +53,7 @@ static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArra
static void Shader_destructor(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader)
{
- shader->safeUnref();
+ SkSafeUnref(shader);
// skiaShader == NULL when not !USE_OPENGL_RENDERER, so no need to delete it outside the ifdef
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
diff --git a/core/jni/android/graphics/Xfermode.cpp b/core/jni/android/graphics/Xfermode.cpp
index 2b53d28..976a91f 100644
--- a/core/jni/android/graphics/Xfermode.cpp
+++ b/core/jni/android/graphics/Xfermode.cpp
@@ -28,7 +28,7 @@ public:
static void finalizer(JNIEnv* env, jobject, SkXfermode* obj)
{
- obj->safeUnref();
+ SkSafeUnref(obj);
}
static SkXfermode* avoid_create(JNIEnv* env, jobject, SkColor opColor,
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 9f70509..bfbfd37 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -53,25 +53,48 @@ public:
virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2);
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr);
virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
- void addCallbackBuffer(JNIEnv *env, jbyteArray cbb);
+ void addCallbackBuffer(JNIEnv *env, jbyteArray cbb, int msgType);
void setCallbackMode(JNIEnv *env, bool installed, bool manualMode);
sp<Camera> getCamera() { Mutex::Autolock _l(mLock); return mCamera; }
+ bool isRawImageCallbackBufferAvailable() const;
void release();
private:
void copyAndPost(JNIEnv* env, const sp<IMemory>& dataPtr, int msgType);
+ void clearCallbackBuffers_l(JNIEnv *env, Vector<jbyteArray> *buffers);
void clearCallbackBuffers_l(JNIEnv *env);
+ jbyteArray getCallbackBuffer(JNIEnv *env, Vector<jbyteArray> *buffers, size_t bufferSize);
jobject mCameraJObjectWeak; // weak reference to java object
jclass mCameraJClass; // strong reference to java class
sp<Camera> mCamera; // strong reference to native object
Mutex mLock;
+ /*
+ * Global reference application-managed raw image buffer queue.
+ *
+ * Manual-only mode is supported for raw image callbacks, which is
+ * set whenever method addCallbackBuffer() with msgType =
+ * CAMERA_MSG_RAW_IMAGE is called; otherwise, null is returned
+ * with raw image callbacks.
+ */
+ Vector<jbyteArray> mRawImageCallbackBuffers;
+
+ /*
+ * Application-managed preview buffer queue and the flags
+ * associated with the usage of the preview buffer callback.
+ */
Vector<jbyteArray> mCallbackBuffers; // Global reference application managed byte[]
bool mManualBufferMode; // Whether to use application managed buffers.
- bool mManualCameraCallbackSet; // Whether the callback has been set, used to reduce unnecessary calls to set the callback.
+ bool mManualCameraCallbackSet; // Whether the callback has been set, used to
+ // reduce unnecessary calls to set the callback.
};
+bool JNICameraContext::isRawImageCallbackBufferAvailable() const
+{
+ return !mRawImageCallbackBuffers.isEmpty();
+}
+
sp<Camera> get_native_camera(JNIEnv *env, jobject thiz, JNICameraContext** pContext)
{
sp<Camera> camera;
@@ -128,10 +151,48 @@ void JNICameraContext::notify(int32_t msgType, int32_t ext1, int32_t ext2)
return;
}
JNIEnv *env = AndroidRuntime::getJNIEnv();
+
+ /*
+ * If the notification or msgType is CAMERA_MSG_RAW_IMAGE_NOTIFY, change it
+ * to CAMERA_MSG_RAW_IMAGE since CAMERA_MSG_RAW_IMAGE_NOTIFY is not exposed
+ * to the Java app.
+ */
+ if (msgType == CAMERA_MSG_RAW_IMAGE_NOTIFY) {
+ msgType = CAMERA_MSG_RAW_IMAGE;
+ }
+
env->CallStaticVoidMethod(mCameraJClass, fields.post_event,
mCameraJObjectWeak, msgType, ext1, ext2, NULL);
}
+jbyteArray JNICameraContext::getCallbackBuffer(
+ JNIEnv* env, Vector<jbyteArray>* buffers, size_t bufferSize)
+{
+ jbyteArray obj = NULL;
+
+ // Vector access should be protected by lock in postData()
+ if (!buffers->isEmpty()) {
+ LOGV("Using callback buffer from queue of length %d", buffers->size());
+ jbyteArray globalBuffer = buffers->itemAt(0);
+ buffers->removeAt(0);
+
+ obj = (jbyteArray)env->NewLocalRef(globalBuffer);
+ env->DeleteGlobalRef(globalBuffer);
+
+ if (obj != NULL) {
+ jsize bufferLength = env->GetArrayLength(obj);
+ if ((int)bufferLength < (int)bufferSize) {
+ LOGE("Callback buffer was too small! Expected %d bytes, but got %d bytes!",
+ bufferSize, bufferLength);
+ env->DeleteLocalRef(obj);
+ return NULL;
+ }
+ }
+ }
+
+ return obj;
+}
+
void JNICameraContext::copyAndPost(JNIEnv* env, const sp<IMemory>& dataPtr, int msgType)
{
jbyteArray obj = NULL;
@@ -141,7 +202,7 @@ void JNICameraContext::copyAndPost(JNIEnv* env, const sp<IMemory>& dataPtr, int
ssize_t offset;
size_t size;
sp<IMemoryHeap> heap = dataPtr->getMemory(&offset, &size);
- LOGV("postData: off=%d, size=%d", offset, size);
+ LOGV("copyAndPost: off=%ld, size=%d", offset, size);
uint8_t *heapBase = (uint8_t*)heap->base();
if (heapBase != NULL) {
@@ -151,32 +212,28 @@ void JNICameraContext::copyAndPost(JNIEnv* env, const sp<IMemory>& dataPtr, int
LOGV("Allocating callback buffer");
obj = env->NewByteArray(size);
} else {
- // Vector access should be protected by lock in postData()
- if(!mCallbackBuffers.isEmpty()) {
- LOGV("Using callback buffer from queue of length %d", mCallbackBuffers.size());
- jbyteArray globalBuffer = mCallbackBuffers.itemAt(0);
- mCallbackBuffers.removeAt(0);
-
- obj = (jbyteArray)env->NewLocalRef(globalBuffer);
- env->DeleteGlobalRef(globalBuffer);
-
- if (obj != NULL) {
- jsize bufferLength = env->GetArrayLength(obj);
- if ((int)bufferLength < (int)size) {
- LOGE("Manually set buffer was too small! Expected %d bytes, but got %d!",
- size, bufferLength);
- env->DeleteLocalRef(obj);
- return;
+ switch (msgType) {
+ case CAMERA_MSG_PREVIEW_FRAME: {
+ obj = getCallbackBuffer(env, &mCallbackBuffers, size);
+
+ if (mCallbackBuffers.isEmpty()) {
+ LOGV("Out of buffers, clearing callback!");
+ mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_NOOP);
+ mManualCameraCallbackSet = false;
+
+ if (obj == NULL) {
+ return;
+ }
}
+ break;
}
- }
-
- if(mCallbackBuffers.isEmpty()) {
- LOGV("Out of buffers, clearing callback!");
- mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_NOOP);
- mManualCameraCallbackSet = false;
-
- if (obj == NULL) {
+ case CAMERA_MSG_RAW_IMAGE: {
+ obj = getCallbackBuffer(env, &mRawImageCallbackBuffers, size);
+ break;
+ }
+ default: {
+ jniThrowException(env,
+ "java/lang/RuntimeException", "Unsupported message type");
return;
}
}
@@ -212,21 +269,27 @@ void JNICameraContext::postData(int32_t msgType, const sp<IMemory>& dataPtr)
}
// return data based on callback type
- switch(msgType) {
- case CAMERA_MSG_VIDEO_FRAME:
- // should never happen
- break;
- // don't return raw data to Java
- case CAMERA_MSG_RAW_IMAGE:
- LOGV("rawCallback");
- env->CallStaticVoidMethod(mCameraJClass, fields.post_event,
- mCameraJObjectWeak, msgType, 0, 0, NULL);
- break;
- default:
- // TODO: Change to LOGV
- LOGV("dataCallback(%d, %p)", msgType, dataPtr.get());
- copyAndPost(env, dataPtr, msgType);
- break;
+ switch (msgType) {
+ case CAMERA_MSG_VIDEO_FRAME:
+ // should never happen
+ break;
+
+ // For backward-compatibility purpose, if there is no callback
+ // buffer for raw image, the callback returns null.
+ case CAMERA_MSG_RAW_IMAGE:
+ LOGV("rawCallback");
+ if (mRawImageCallbackBuffers.isEmpty()) {
+ env->CallStaticVoidMethod(mCameraJClass, fields.post_event,
+ mCameraJObjectWeak, msgType, 0, 0, NULL);
+ } else {
+ copyAndPost(env, dataPtr, msgType);
+ }
+ break;
+
+ default:
+ LOGV("dataCallback(%d, %p)", msgType, dataPtr.get());
+ copyAndPost(env, dataPtr, msgType);
+ break;
}
}
@@ -251,7 +314,7 @@ void JNICameraContext::setCallbackMode(JNIEnv *env, bool installed, bool manualM
if (!installed) {
mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_NOOP);
- clearCallbackBuffers_l(env);
+ clearCallbackBuffers_l(env, &mCallbackBuffers);
} else if (mManualBufferMode) {
if (!mCallbackBuffers.isEmpty()) {
mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_CAMERA);
@@ -259,24 +322,44 @@ void JNICameraContext::setCallbackMode(JNIEnv *env, bool installed, bool manualM
}
} else {
mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_BARCODE_SCANNER);
- clearCallbackBuffers_l(env);
+ clearCallbackBuffers_l(env, &mCallbackBuffers);
}
}
-void JNICameraContext::addCallbackBuffer(JNIEnv *env, jbyteArray cbb)
+void JNICameraContext::addCallbackBuffer(
+ JNIEnv *env, jbyteArray cbb, int msgType)
{
+ LOGV("addCallbackBuffer: 0x%x", msgType);
if (cbb != NULL) {
Mutex::Autolock _l(mLock);
- jbyteArray callbackBuffer = (jbyteArray)env->NewGlobalRef(cbb);
- mCallbackBuffers.push(cbb);
-
- LOGV("Adding callback buffer to queue, %d total", mCallbackBuffers.size());
-
- // We want to make sure the camera knows we're ready for the next frame.
- // This may have come unset had we not had a callbackbuffer ready for it last time.
- if (mManualBufferMode && !mManualCameraCallbackSet) {
- mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_CAMERA);
- mManualCameraCallbackSet = true;
+ switch (msgType) {
+ case CAMERA_MSG_PREVIEW_FRAME: {
+ jbyteArray callbackBuffer = (jbyteArray)env->NewGlobalRef(cbb);
+ mCallbackBuffers.push(callbackBuffer);
+
+ LOGV("Adding callback buffer to queue, %d total",
+ mCallbackBuffers.size());
+
+ // We want to make sure the camera knows we're ready for the
+ // next frame. This may have come unset had we not had a
+ // callbackbuffer ready for it last time.
+ if (mManualBufferMode && !mManualCameraCallbackSet) {
+ mCamera->setPreviewCallbackFlags(FRAME_CALLBACK_FLAG_CAMERA);
+ mManualCameraCallbackSet = true;
+ }
+ break;
+ }
+ case CAMERA_MSG_RAW_IMAGE: {
+ jbyteArray callbackBuffer = (jbyteArray)env->NewGlobalRef(cbb);
+ mRawImageCallbackBuffers.push(callbackBuffer);
+ break;
+ }
+ default: {
+ jniThrowException(env,
+ "java/lang/IllegalArgumentException",
+ "Unsupported message type");
+ return;
+ }
}
} else {
LOGE("Null byte array!");
@@ -285,10 +368,15 @@ void JNICameraContext::addCallbackBuffer(JNIEnv *env, jbyteArray cbb)
void JNICameraContext::clearCallbackBuffers_l(JNIEnv *env)
{
- LOGV("Clearing callback buffers, %d remained", mCallbackBuffers.size());
- while(!mCallbackBuffers.isEmpty()) {
- env->DeleteGlobalRef(mCallbackBuffers.top());
- mCallbackBuffers.pop();
+ clearCallbackBuffers_l(env, &mCallbackBuffers);
+ clearCallbackBuffers_l(env, &mRawImageCallbackBuffers);
+}
+
+void JNICameraContext::clearCallbackBuffers_l(JNIEnv *env, Vector<jbyteArray> *buffers) {
+ LOGV("Clearing callback buffers, %d remained", buffers->size());
+ while (!buffers->isEmpty()) {
+ env->DeleteGlobalRef(buffers->top());
+ buffers->pop();
}
}
@@ -458,13 +546,13 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t
context->setCallbackMode(env, installed, manualBuffer);
}
-static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes) {
- LOGV("addCallbackBuffer");
+static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) {
+ LOGV("addCallbackBuffer: 0x%x", msgType);
JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
if (context != NULL) {
- context->addCallbackBuffer(env, bytes);
+ context->addCallbackBuffer(env, bytes, msgType);
}
}
@@ -492,14 +580,32 @@ static void android_hardware_Camera_cancelAutoFocus(JNIEnv *env, jobject thiz)
}
}
-static void android_hardware_Camera_takePicture(JNIEnv *env, jobject thiz)
+static void android_hardware_Camera_takePicture(JNIEnv *env, jobject thiz, int msgType)
{
LOGV("takePicture");
JNICameraContext* context;
sp<Camera> camera = get_native_camera(env, thiz, &context);
if (camera == 0) return;
- if (camera->takePicture() != NO_ERROR) {
+ /*
+ * When CAMERA_MSG_RAW_IMAGE is requested, if the raw image callback
+ * buffer is available, CAMERA_MSG_RAW_IMAGE is enabled to get the
+ * notification _and_ the data; otherwise, CAMERA_MSG_RAW_IMAGE_NOTIFY
+ * is enabled to receive the callback notification but no data.
+ *
+ * Note that CAMERA_MSG_RAW_IMAGE_NOTIFY is not exposed to the
+ * Java application.
+ */
+ if (msgType & CAMERA_MSG_RAW_IMAGE) {
+ LOGV("Enable raw image callback buffer");
+ if (!context->isRawImageCallbackBufferAvailable()) {
+ LOGV("Enable raw image notification, since no callback buffer exists");
+ msgType &= ~CAMERA_MSG_RAW_IMAGE;
+ msgType |= CAMERA_MSG_RAW_IMAGE_NOTIFY;
+ }
+ }
+
+ if (camera->takePicture(msgType) != NO_ERROR) {
jniThrowException(env, "java/lang/RuntimeException", "takePicture failed");
return;
}
@@ -638,8 +744,8 @@ static JNINativeMethod camMethods[] = {
{ "setHasPreviewCallback",
"(ZZ)V",
(void *)android_hardware_Camera_setHasPreviewCallback },
- { "addCallbackBuffer",
- "([B)V",
+ { "_addCallbackBuffer",
+ "([BI)V",
(void *)android_hardware_Camera_addCallbackBuffer },
{ "native_autoFocus",
"()V",
@@ -648,7 +754,7 @@ static JNINativeMethod camMethods[] = {
"()V",
(void *)android_hardware_Camera_cancelAutoFocus },
{ "native_takePicture",
- "()V",
+ "(I)V",
(void *)android_hardware_Camera_takePicture },
{ "native_setParameters",
"(Ljava/lang/String;)V",
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp
index fc806a5..667ba75 100644
--- a/core/jni/android_net_wifi_Wifi.cpp
+++ b/core/jni/android_net_wifi_Wifi.cpp
@@ -556,6 +556,18 @@ static jboolean android_net_wifi_setSuspendOptimizationsCommand(JNIEnv* env, job
return doBooleanCommand(cmdstr, "OK");
}
+static void android_net_wifi_enableBackgroundScan(JNIEnv* env, jobject clazz, jboolean enable)
+{
+ //Note: BGSCAN-START and BGSCAN-STOP are documented in core/res/res/values/config.xml
+ //and will need an update if the names are changed
+ if (enable) {
+ doBooleanCommand("DRIVER BGSCAN-START", "OK");
+ }
+ else {
+ doBooleanCommand("DRIVER BGSCAN-STOP", "OK");
+ }
+}
+
// ----------------------------------------------------------------------------
/*
@@ -623,6 +635,7 @@ static JNINativeMethod gWifiMethods[] = {
(void*) android_net_wifi_setSuspendOptimizationsCommand},
{ "setCountryCodeCommand", "(Ljava/lang/String;)Z",
(void*) android_net_wifi_setCountryCodeCommand},
+ { "enableBackgroundScan", "(Z)V", (void*) android_net_wifi_enableBackgroundScan},
};
int register_android_net_wifi_WifiManager(JNIEnv* env)
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index aa9c107..be66e9c 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -451,7 +451,7 @@ class ScreenshotPixelRef : public SkPixelRef {
public:
ScreenshotPixelRef(SkColorTable* ctable) {
fCTable = ctable;
- ctable->safeRef();
+ SkSafeRef(ctable);
setImmutable();
}
virtual ~ScreenshotPixelRef() {
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 941ed63..e7ea8c8 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -290,7 +290,7 @@ static void jni_eglCreatePixmapSurface(JNIEnv *_env, jobject _this, jobject out_
return;
}
- ref->safeRef();
+ SkSafeRef(ref);
ref->lockPixels();
egl_native_pixmap_t pixmap;
@@ -310,7 +310,7 @@ static void jni_eglCreatePixmapSurface(JNIEnv *_env, jobject _this, jobject out_
_env->SetIntField(out_sur, gSurface_NativePixelRefFieldID, (int)ref);
} else {
ref->unlockPixels();
- ref->safeUnref();
+ SkSafeUnref(ref);
}
}
@@ -430,7 +430,7 @@ static jboolean jni_eglDestroySurface(JNIEnv *_env, jobject _this, jobject displ
gSurface_NativePixelRefFieldID));
if (ref) {
ref->unlockPixels();
- ref->safeUnref();
+ SkSafeUnref(ref);
}
}
return eglDestroySurface(dpy, sur);