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

Commit 70e3f81d authored by Mathias Agopian's avatar Mathias Agopian
Browse files

make sure to re-initialize SurfaceTexture to its default state on disconnect

this caused problems where the NavigationBar would disapear or be
drawn in the wrong orientation.

Change-Id: I083c41338db83a4afd14f427caec2f31c180d734
parent b0610335
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -608,6 +608,9 @@ status_t SurfaceTexture::disconnect(int api) {
            if (mConnectedApi == api) {
            if (mConnectedApi == api) {
                drainQueueAndFreeBuffersLocked();
                drainQueueAndFreeBuffersLocked();
                mConnectedApi = NO_CONNECTED_API;
                mConnectedApi = NO_CONNECTED_API;
                mNextCrop.makeInvalid();
                mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
                mNextTransform = 0;
                mDequeueCondition.signal();
                mDequeueCondition.signal();
            } else {
            } else {
                LOGE("disconnect: connected to another api (cur=%d, req=%d)",
                LOGE("disconnect: connected to another api (cur=%d, req=%d)",
@@ -1022,7 +1025,7 @@ void SurfaceTexture::dump(String8& result, const char* prefix,
            mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
            mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
            mCurrentTransform, mCurrentTexture,
            mCurrentTransform, mCurrentTexture,
            prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom,
            prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom,
            mCurrentTransform, fifoSize, fifo.string()
            mNextTransform, fifoSize, fifo.string()
    );
    );
    result.append(buffer);
    result.append(buffer);


+9 −2
Original line number Original line Diff line number Diff line
@@ -407,9 +407,16 @@ int SurfaceTextureClient::disconnect(int api) {
    LOGV("SurfaceTextureClient::disconnect");
    LOGV("SurfaceTextureClient::disconnect");
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);
    int err = mSurfaceTexture->disconnect(api);
    int err = mSurfaceTexture->disconnect(api);
    if (!err && api == NATIVE_WINDOW_API_CPU) {
    if (!err) {
        freeAllBuffers();
        mReqFormat = 0;
        mReqWidth = 0;
        mReqHeight = 0;
        mReqUsage = 0;
        if (api == NATIVE_WINDOW_API_CPU) {
            mConnectedToCpu = false;
            mConnectedToCpu = false;
        }
        }
    }
    return err;
    return err;
}
}