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

Commit f6d08b95 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge changes Ie06e73e5,I7ac6b5b0

* changes:
  free all buffers when ANativeWindow::disconnect is called
  return correct value from query after connecting a surface
parents 7466b0fd 43a3d91d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -111,7 +111,12 @@ protected:
    //
    // This method will fail if the connect was previously called on the
    // SurfaceTexture and no corresponding disconnect call was made.
    virtual status_t connect(int api) = 0;
    //
    // outWidth, outHeight and outTransform are filled with the default width
    // and height of the window and current transform applied to buffers,
    // respectively.
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0;

    // disconnect attempts to disconnect a client API from the SurfaceTexture.
    // Calling this method will cause any subsequent calls to other
+2 −1
Original line number Diff line number Diff line
@@ -106,7 +106,8 @@ public:
    //
    // This method will fail if the connect was previously called on the
    // SurfaceTexture and no corresponding disconnect call was made.
    virtual status_t connect(int api);
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);

    // disconnect attempts to disconnect a client API from the SurfaceTexture.
    // Calling this method will cause any subsequent calls to other
+2 −1
Original line number Diff line number Diff line
@@ -133,7 +133,8 @@ public:
    //
    // This method will fail if the connect was previously called on the
    // SurfaceMediaSource and no corresponding disconnect call was made.
    virtual status_t connect(int api);
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);

    // disconnect attempts to disconnect a client API from the SurfaceMediaSource.
    // Calling this method will cause any subsequent calls to other
+11 −2
Original line number Diff line number Diff line
@@ -162,11 +162,15 @@ public:
        return result;
    }

    virtual status_t connect(int api) {
    virtual status_t connect(int api,
            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
        data.writeInt32(api);
        remote()->transact(CONNECT, data, &reply);
        *outWidth = reply.readInt32();
        *outHeight = reply.readInt32();
        *outTransform = reply.readInt32();
        status_t result = reply.readInt32();
        return result;
    }
@@ -283,7 +287,12 @@ status_t BnSurfaceTexture::onTransact(
        case CONNECT: {
            CHECK_INTERFACE(ISurfaceTexture, data, reply);
            int api = data.readInt32();
            status_t res = connect(api);
            uint32_t outWidth, outHeight, outTransform;
            status_t res = connect(api,
                    &outWidth, &outHeight, &outTransform);
            reply->writeInt32(outWidth);
            reply->writeInt32(outHeight);
            reply->writeInt32(outTransform);
            reply->writeInt32(res);
            return NO_ERROR;
        } break;
+6 −1
Original line number Diff line number Diff line
@@ -548,7 +548,8 @@ status_t SurfaceTexture::setTransform(uint32_t transform) {
    return OK;
}

status_t SurfaceTexture::connect(int api) {
status_t SurfaceTexture::connect(int api,
        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
    LOGV("SurfaceTexture::connect(this=%p, %d)", this, api);
    Mutex::Autolock lock(mMutex);

@@ -569,6 +570,9 @@ status_t SurfaceTexture::connect(int api) {
                err = -EINVAL;
            } else {
                mConnectedApi = api;
                *outWidth = mDefaultWidth;
                *outHeight = mDefaultHeight;
                *outTransform = 0;
            }
            break;
        default:
@@ -595,6 +599,7 @@ status_t SurfaceTexture::disconnect(int api) {
        case NATIVE_WINDOW_API_CAMERA:
            if (mConnectedApi == api) {
                mConnectedApi = NO_CONNECTED_API;
                freeAllBuffers();
            } else {
                LOGE("disconnect: connected to another api (cur=%d, req=%d)",
                        mConnectedApi, api);
Loading