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

Commit 621e376c authored by Xin Li's avatar Xin Li
Browse files

Merge QQ3A.200605.002 into master

Bug: 158095402
Merged-In: Iacddb8afef9729cb7096e3247178b87409942437
Change-Id: Id15f117612b53582388dd2e0d6978521ed6c565d
parents d1626984 4622782c
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -83,4 +83,12 @@ interface ICameraServiceListener
     * can retry after receiving this callback.
     * can retry after receiving this callback.
     */
     */
    oneway void onCameraAccessPrioritiesChanged();
    oneway void onCameraAccessPrioritiesChanged();

    /**
     * Notify registered clients about cameras being opened/closed.
     * Only clients with android.permission.CAMERA_OPEN_CLOSE_LISTENER permission
     * will receive such callbacks.
     */
    oneway void onCameraOpened(String cameraId, String clientPackageId);
    oneway void onCameraClosed(String cameraId);
}
}
+6 −0
Original line number Original line Diff line number Diff line
@@ -92,6 +92,12 @@ class CameraManagerGlobal final : public RefBase {
        }
        }


        virtual binder::Status onCameraAccessPrioritiesChanged();
        virtual binder::Status onCameraAccessPrioritiesChanged();
        virtual binder::Status onCameraOpened(const String16&, const String16&) {
            return binder::Status::ok();
        }
        virtual binder::Status onCameraClosed(const String16&) {
            return binder::Status::ok();
        }


      private:
      private:
        const wp<CameraManagerGlobal> mCameraManager;
        const wp<CameraManagerGlobal> mCameraManager;
+11 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,17 @@ public:
        return binder::Status::ok();
        return binder::Status::ok();
    }
    }


    virtual binder::Status onCameraOpened(const String16& /*cameraId*/,
            const String16& /*clientPackageName*/) {
        // No op
        return binder::Status::ok();
    }

    virtual binder::Status onCameraClosed(const String16& /*cameraId*/) {
        // No op
        return binder::Status::ok();
    }

    bool waitForNumCameras(size_t num) const {
    bool waitForNumCameras(size_t num) const {
        Mutex::Autolock l(mLock);
        Mutex::Autolock l(mLock);


+1 −0
Original line number Original line Diff line number Diff line
@@ -1071,6 +1071,7 @@ status_t BnDrm::onTransact(
            Vector<uint8_t> keySetId;
            Vector<uint8_t> keySetId;
            readVector(data, keySetId);
            readVector(data, keySetId);
            DrmPlugin::OfflineLicenseState state;
            DrmPlugin::OfflineLicenseState state;
            state = DrmPlugin::OfflineLicenseState::kOfflineLicenseStateUnknown;
            status_t result = getOfflineLicenseState(keySetId, &state);
            status_t result = getOfflineLicenseState(keySetId, &state);
            reply->writeInt32(static_cast<DrmPlugin::OfflineLicenseState>(state));
            reply->writeInt32(static_cast<DrmPlugin::OfflineLicenseState>(state));
            reply->writeInt32(result);
            reply->writeInt32(result);
+17 −6
Original line number Original line Diff line number Diff line
@@ -76,10 +76,21 @@ android::status_t InitDataParser::parse(const Vector<uint8_t>& initData,


android::status_t InitDataParser::parsePssh(const Vector<uint8_t>& initData,
android::status_t InitDataParser::parsePssh(const Vector<uint8_t>& initData,
        Vector<const uint8_t*>* keyIds) {
        Vector<const uint8_t*>* keyIds) {
    // Description of PSSH format:
    // https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html
    size_t readPosition = 0;
    size_t readPosition = 0;


    // Validate size field
    uint32_t expectedSize = initData.size();
    uint32_t expectedSize = initData.size();
    const char psshIdentifier[4] = {'p', 's', 's', 'h'};
    const uint8_t psshVersion1[4] = {1, 0, 0, 0};
    uint32_t keyIdCount = 0;
    size_t headerSize = sizeof(expectedSize) + sizeof(psshIdentifier) +
                        sizeof(psshVersion1) + kSystemIdSize + sizeof(keyIdCount);
    if (initData.size() < headerSize) {
        return android::ERROR_DRM_CANNOT_HANDLE;
    }

    // Validate size field
    expectedSize = htonl(expectedSize);
    expectedSize = htonl(expectedSize);
    if (memcmp(&initData[readPosition], &expectedSize,
    if (memcmp(&initData[readPosition], &expectedSize,
               sizeof(expectedSize)) != 0) {
               sizeof(expectedSize)) != 0) {
@@ -88,7 +99,6 @@ android::status_t InitDataParser::parsePssh(const Vector<uint8_t>& initData,
    readPosition += sizeof(expectedSize);
    readPosition += sizeof(expectedSize);


    // Validate PSSH box identifier
    // Validate PSSH box identifier
    const char psshIdentifier[4] = {'p', 's', 's', 'h'};
    if (memcmp(&initData[readPosition], psshIdentifier,
    if (memcmp(&initData[readPosition], psshIdentifier,
               sizeof(psshIdentifier)) != 0) {
               sizeof(psshIdentifier)) != 0) {
        return android::ERROR_DRM_CANNOT_HANDLE;
        return android::ERROR_DRM_CANNOT_HANDLE;
@@ -96,7 +106,6 @@ android::status_t InitDataParser::parsePssh(const Vector<uint8_t>& initData,
    readPosition += sizeof(psshIdentifier);
    readPosition += sizeof(psshIdentifier);


    // Validate EME version number
    // Validate EME version number
    const uint8_t psshVersion1[4] = {1, 0, 0, 0};
    if (memcmp(&initData[readPosition], psshVersion1,
    if (memcmp(&initData[readPosition], psshVersion1,
               sizeof(psshVersion1)) != 0) {
               sizeof(psshVersion1)) != 0) {
        return android::ERROR_DRM_CANNOT_HANDLE;
        return android::ERROR_DRM_CANNOT_HANDLE;
@@ -110,12 +119,14 @@ android::status_t InitDataParser::parsePssh(const Vector<uint8_t>& initData,
    readPosition += kSystemIdSize;
    readPosition += kSystemIdSize;


    // Read key ID count
    // Read key ID count
    uint32_t keyIdCount;
    memcpy(&keyIdCount, &initData[readPosition], sizeof(keyIdCount));
    memcpy(&keyIdCount, &initData[readPosition], sizeof(keyIdCount));
    keyIdCount = ntohl(keyIdCount);
    keyIdCount = ntohl(keyIdCount);
    readPosition += sizeof(keyIdCount);
    readPosition += sizeof(keyIdCount);
    if (readPosition + ((uint64_t)keyIdCount * kKeyIdSize) !=

            initData.size() - sizeof(uint32_t)) {
    uint64_t psshSize = 0;
    if (__builtin_mul_overflow(keyIdCount, kKeyIdSize, &psshSize) ||
        __builtin_add_overflow(readPosition, psshSize, &psshSize) ||
        psshSize != initData.size() - sizeof(uint32_t) /* DataSize(0) */) {
        return android::ERROR_DRM_CANNOT_HANDLE;
        return android::ERROR_DRM_CANNOT_HANDLE;
    }
    }


Loading