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

Commit de8c8069 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

Merge commit '1ee45c2d' into HEAD

parents 708602cc 1ee45c2d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public:
    status_t            writeString16(const char16_t* str, size_t len);
    status_t            writeStrongBinder(const sp<IBinder>& val);
    status_t            writeWeakBinder(const wp<IBinder>& val);
    status_t            writeInt32Array(size_t len, const int32_t *val);

    template<typename T>
    status_t            write(const Flattenable<T>& val);
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public:
    virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag,
            const String16& packageName, int uid) = 0;
    virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) = 0;
    virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids) = 0;
};

// ----------------------------------------------------------------------------
+10 −0
Original line number Diff line number Diff line
@@ -617,6 +617,16 @@ status_t Parcel::writeInt32(int32_t val)
{
    return writeAligned(val);
}
status_t Parcel::writeInt32Array(size_t len, const int32_t *val) {
    if (!val) {
        return writeAligned(-1);
    }
    status_t ret = writeAligned(len);
    if (ret == NO_ERROR) {
        ret = write(val, len * sizeof(*val));
    }
    return ret;
}

status_t Parcel::writeInt64(int64_t val)
{
+30 −17
Original line number Diff line number Diff line
@@ -644,6 +644,7 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
            producerControlledByApp ? "true" : "false");
    Mutex::Autolock lock(mMutex);

retry:
    if (mAbandoned) {
        ST_LOGE("connect: BufferQueue has been abandoned!");
        return NO_INIT;
@@ -654,17 +655,30 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
        return NO_INIT;
    }

    if (mConnectedApi != NO_CONNECTED_API) {
        ST_LOGE("connect: already connected (cur=%d, req=%d)",
                mConnectedApi, api);
        return -EINVAL;
    }

    // If we disconnect and reconnect quickly, we can be in a state where our slots are
    // empty but we have many buffers in the queue.  This can cause us to run out of
    // memory if we outrun the consumer.  Wait here if it looks like we have too many
    // buffers queued up.
    int maxBufferCount = getMaxBufferCountLocked(false);    // worst-case, i.e. largest value
    if (mQueue.size() > (size_t) maxBufferCount) {
        // TODO: make this bound tighter?
        ST_LOGV("queue size is %d, waiting", mQueue.size());
        mDequeueCondition.wait(mMutex);
        goto retry;
    }

    int err = NO_ERROR;
    switch (api) {
        case NATIVE_WINDOW_API_EGL:
        case NATIVE_WINDOW_API_CPU:
        case NATIVE_WINDOW_API_MEDIA:
        case NATIVE_WINDOW_API_CAMERA:
            if (mConnectedApi != NO_CONNECTED_API) {
                ST_LOGE("connect: already connected (cur=%d, req=%d)",
                        mConnectedApi, api);
                err = -EINVAL;
            } else {
            mConnectedApi = api;
            output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, mQueue.size());

@@ -678,7 +692,6 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
                    ALOGE("linkToDeath failed: %s (%d)", strerror(-err), err);
                }
            }
            }
            break;
        default:
            err = -EINVAL;
+6 −3
Original line number Diff line number Diff line
@@ -511,14 +511,17 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
    status_t result;
    for (size_t i = mBatches.size(); i-- > 0; ) {
        Batch& batch = mBatches.editItemAt(i);
        if (frameTime < 0 || !mResampleTouch) {
        if (frameTime < 0) {
            result = consumeSamples(factory, batch, batch.samples.size(),
                    outSeq, outEvent);
            mBatches.removeAt(i);
            return result;
        }

        nsecs_t sampleTime = frameTime - RESAMPLE_LATENCY;
        nsecs_t sampleTime = frameTime;
        if (mResampleTouch) {
            sampleTime -= RESAMPLE_LATENCY;
        }
        ssize_t split = findSampleNoLaterThan(batch, sampleTime);
        if (split < 0) {
            continue;
@@ -532,7 +535,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
        } else {
            next = &batch.samples.itemAt(0);
        }
        if (!result) {
        if (!result && mResampleTouch) {
            resampleTouchState(sampleTime, static_cast<MotionEvent*>(*outEvent), next);
        }
        return result;
Loading