Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9deede02 authored by Fedor Kudasov's avatar Fedor Kudasov Committed by Android (Google) Code Review
Browse files

Merge "Remove jni function that exposes native window"

parents bbd2a2b5 25b1884b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -131,13 +131,6 @@ sp<IGraphicBufferProducer> SurfaceTexture_getProducer(JNIEnv* env, jobject thiz)
    return (IGraphicBufferProducer*)env->GetLongField(thiz, fields.producer);
}

sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(JNIEnv* env, jobject thiz) {
    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    sp<IGraphicBufferProducer> producer(SurfaceTexture_getProducer(env, thiz));
    sp<Surface> surfaceTextureClient(surfaceTexture != NULL ? new Surface(producer) : NULL);
    return surfaceTextureClient;
}

bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz) {
    jclass surfaceTextureClass = env->FindClass(kSurfaceTextureClassPathName);
    return env->IsInstanceOf(thiz, surfaceTextureClass);
+9 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "core_jni_helpers.h"
#include "android_runtime/android_view_Surface.h"
#include "android_runtime/android_graphics_SurfaceTexture.h"
#include "surfacetexture/SurfaceTexture.h"

#include <gui/Surface.h>
#include <gui/IGraphicBufferProducer.h>
@@ -394,10 +395,17 @@ static sp<ANativeWindow> getNativeWindow(JNIEnv* env, jobject surface) {
    return anw;
}

static sp<ANativeWindow> getSurfaceTextureNativeWindow(JNIEnv* env, jobject thiz) {
    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    sp<IGraphicBufferProducer> producer(SurfaceTexture_getProducer(env, thiz));
    sp<Surface> surfaceTextureClient(surfaceTexture != NULL ? new Surface(producer) : NULL);
    return surfaceTextureClient;
}

static sp<ANativeWindow> getNativeWindowFromTexture(JNIEnv* env, jobject surfaceTexture) {
    sp<ANativeWindow> anw;
    if (surfaceTexture) {
        anw = android_SurfaceTexture_getNativeWindow(env, surfaceTexture);
        anw = getSurfaceTextureNativeWindow(env, surfaceTexture);
        if (env->ExceptionCheck()) {
            return NULL;
        }
+0 −3
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
#ifndef _ANDROID_GRAPHICS_SURFACETEXTURE_H
#define _ANDROID_GRAPHICS_SURFACETEXTURE_H

#include <android/native_window.h>

#include "jni.h"

namespace android {
@@ -26,7 +24,6 @@ namespace android {
class IGraphicBufferProducer;
class SurfaceTexture;

extern sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(JNIEnv* env, jobject thiz);
extern bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz);

/* Gets the underlying C++ SurfaceTexture object from a SurfaceTexture Java object. */