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

Commit 148cbe08 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Merge Android10 QPR1 into AOSP master"

parents cc825811 af57fae6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ int main(int argc __unused, char** argv __unused)
    sp<IServiceManager> sm = defaultServiceManager();
    ALOGI("ServiceManager: %p", sm.get());
    CameraService::instantiate();
    ALOGI("ServiceManager: %p done instantiate", sm.get());
    ProcessState::self()->startThreadPool();
    IPCThreadState::self()->joinThreadPool();
}
+31 −22
Original line number Diff line number Diff line
@@ -62,11 +62,9 @@ Return<void> CryptoPlugin::decrypt(
      secure, keyId, iv, mode, pattern, subSamples, source, offset, destination,
      [&](Status_V1_2 hStatus, uint32_t hBytesWritten, hidl_string hDetailedError) {
        status = toStatus_1_0(hStatus);
        if (status == Status::OK) {
        bytesWritten = hBytesWritten;
        detailedError = hDetailedError;
      }
      }
    );

  status = hResult.isOk() ? status : Status::ERROR_DRM_CANNOT_HANDLE;
@@ -109,6 +107,10 @@ Return<void> CryptoPlugin::decrypt_1_2(
                 "destination decrypt buffer base not set");
        return Void();
      }
    } else {
        _hidl_cb(Status_V1_2::ERROR_DRM_CANNOT_HANDLE, 0,
                 "destination type not supported");
        return Void();
    }

    sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId];
@@ -126,7 +128,7 @@ Return<void> CryptoPlugin::decrypt_1_2(
            (static_cast<void *>(sourceBase->getPointer()));
    uint8_t* srcPtr = static_cast<uint8_t *>(base + source.offset + offset);
    void* destPtr = NULL;
    if (destination.type == BufferType::SHARED_MEMORY) {
    // destination.type == BufferType::SHARED_MEMORY
    const SharedBuffer& destBuffer = destination.nonsecureMemory;
    sp<IMemory> destBase = mSharedBufferMap[destBuffer.bufferId];
    if (destBase == nullptr) {
@@ -139,11 +141,7 @@ Return<void> CryptoPlugin::decrypt_1_2(
        return Void();
    }
    destPtr = static_cast<void *>(base + destination.nonsecureMemory.offset);
    } else if (destination.type == BufferType::NATIVE_HANDLE) {
        native_handle_t *handle = const_cast<native_handle_t *>(
        destination.secureMemory.getNativeHandle());
        destPtr = static_cast<void *>(handle);
    }


    // Calculate the output buffer size and determine if any subsamples are
    // encrypted.
@@ -151,13 +149,24 @@ Return<void> CryptoPlugin::decrypt_1_2(
    bool haveEncryptedSubsamples = false;
    for (size_t i = 0; i < subSamples.size(); i++) {
        const SubSample &subSample = subSamples[i];
        destSize += subSample.numBytesOfClearData;
        destSize += subSample.numBytesOfEncryptedData;
        if (__builtin_add_overflow(destSize, subSample.numBytesOfClearData, &destSize)) {
            _hidl_cb(Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE, 0, "subsample clear size overflow");
            return Void();
        }
        if (__builtin_add_overflow(destSize, subSample.numBytesOfEncryptedData, &destSize)) {
            _hidl_cb(Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE, 0, "subsample encrypted size overflow");
            return Void();
        }
        if (subSample.numBytesOfEncryptedData > 0) {
        haveEncryptedSubsamples = true;
        }
    }

    if (destSize > destBuffer.size) {
        _hidl_cb(Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE, 0, "subsample sum too large");
        return Void();
    }

    if (mode == Mode::UNENCRYPTED) {
        if (haveEncryptedSubsamples) {
            _hidl_cb(Status_V1_2::ERROR_DRM_CANNOT_HANDLE, 0,
+22 −6
Original line number Diff line number Diff line
cc_library {
    name: "libstagefright_bufferpool@2.0",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
cc_defaults {
    name: "libstagefright_bufferpool@2.0-default",
    srcs: [
        "Accessor.cpp",
        "AccessorImpl.cpp",
@@ -29,3 +25,23 @@ cc_library {
        "android.hardware.media.bufferpool@2.0",
    ],
}

cc_library {
    name: "libstagefright_bufferpool@2.0.1",
    defaults: ["libstagefright_bufferpool@2.0-default"],
    vendor_available: true,
    cflags: [
        "-DBUFFERPOOL_CLONE_HANDLES",
    ],
}

// Deprecated. Do not use. Use libstagefright_bufferpool@2.0.1 instead.
cc_library {
    name: "libstagefright_bufferpool@2.0",
    defaults: ["libstagefright_bufferpool@2.0-default"],
    vendor_available: true,
    vndk: {
        enabled: true,
    },
}
+29 −0
Original line number Diff line number Diff line
@@ -351,7 +351,21 @@ ResultStatus ClientManager::Impl::allocate(
        }
        client = it->second;
    }
#ifdef BUFFERPOOL_CLONE_HANDLES
    native_handle_t *origHandle;
    ResultStatus res = client->allocate(params, &origHandle, buffer);
    if (res != ResultStatus::OK) {
        return res;
    }
    *handle = native_handle_clone(origHandle);
    if (handle == NULL) {
        buffer->reset();
        return ResultStatus::NO_MEMORY;
    }
    return ResultStatus::OK;
#else
    return client->allocate(params, handle, buffer);
#endif
}

ResultStatus ClientManager::Impl::receive(
@@ -367,7 +381,22 @@ ResultStatus ClientManager::Impl::receive(
        }
        client = it->second;
    }
#ifdef BUFFERPOOL_CLONE_HANDLES
    native_handle_t *origHandle;
    ResultStatus res = client->receive(
            transactionId, bufferId, timestampUs, &origHandle, buffer);
    if (res != ResultStatus::OK) {
        return res;
    }
    *handle = native_handle_clone(origHandle);
    if (handle == NULL) {
        buffer->reset();
        return ResultStatus::NO_MEMORY;
    }
    return ResultStatus::OK;
#else
    return client->receive(transactionId, bufferId, timestampUs, handle, buffer);
#endif
}

ResultStatus ClientManager::Impl::postSend(
+6 −2
Original line number Diff line number Diff line
@@ -104,7 +104,9 @@ struct ClientManager : public IClientManager {
    ResultStatus flush(ConnectionId connectionId);

    /**
     * Allocates a buffer from the specified connection.
     * Allocates a buffer from the specified connection. The output parameter
     * handle is cloned from the internal handle. So it is safe to use directly,
     * and it should be deleted and destroyed after use.
     *
     * @param connectionId  The id of the connection.
     * @param params        The allocation parameters.
@@ -123,7 +125,9 @@ struct ClientManager : public IClientManager {
                          std::shared_ptr<BufferPoolData> *buffer);

    /**
     * Receives a buffer for the transaction.
     * Receives a buffer for the transaction. The output parameter handle is
     * cloned from the internal handle. So it is safe to use directly, and it
     * should be deleted and destoyed after use.
     *
     * @param connectionId  The id of the receiving connection.
     * @param transactionId The id for the transaction.
Loading