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

Commit a74fc163 authored by Presubmit Automerger Backend's avatar Presubmit Automerger Backend
Browse files

[automerge] aidl drm: independent min/max SecurityLevel for each supported mime 2p: 12030279

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/16957514

Bug: 219528925
Change-Id: I38837e96c397b988ca1ff2c9017c5d0d956fdc5e
Merged-In: I9dcd786fe921c6ed4ac49bba5a6dddf887404df3
parents 6b5da85a 12030279
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -35,7 +35,5 @@ package android.hardware.drm;
@VintfStability
@VintfStability
parcelable CryptoSchemes {
parcelable CryptoSchemes {
  List<android.hardware.drm.Uuid> uuids;
  List<android.hardware.drm.Uuid> uuids;
  android.hardware.drm.SecurityLevel minLevel;
  List<android.hardware.drm.SupportedContentType> mimeTypes;
  android.hardware.drm.SecurityLevel maxLevel;
  List<String> mimeTypes;
}
}
+40 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.drm;
@VintfStability
parcelable SupportedContentType {
  String mime;
  android.hardware.drm.SecurityLevel minLevel;
  android.hardware.drm.SecurityLevel maxLevel;
}
+3 −13
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@


package android.hardware.drm;
package android.hardware.drm;


import android.hardware.drm.SecurityLevel;
import android.hardware.drm.SupportedContentType;
import android.hardware.drm.Uuid;
import android.hardware.drm.Uuid;


@VintfStability
@VintfStability
@@ -28,18 +28,8 @@ parcelable CryptoSchemes {
    List<Uuid> uuids;
    List<Uuid> uuids;


    /**
    /**
     * Minimum supported security level (inclusive)
     * Supported mime types, and supported SecurityLevels for each mime
     */
     */
    SecurityLevel minLevel;
    List<SupportedContentType> mimeTypes;

    /**
     * Maximum supported security level (inclusive)
     */
    SecurityLevel maxLevel;

    /**
     * Supported mime types
     */
    List<String> mimeTypes;


}
}
+31 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.drm;

import android.hardware.drm.SecurityLevel;

@VintfStability
parcelable SupportedContentType {
    /** Supported mime type. E.g. cenc, video/mp4, etc */
    String mime;

    /** Minimum supported security level (inclusive) */
    SecurityLevel minLevel;

    /** Maximum supported security level (inclusive) */
    SecurityLevel maxLevel;
}
+14 −9
Original line number Original line Diff line number Diff line
@@ -256,7 +256,7 @@ std::vector<uint8_t> DrmHalTest::getUUID() {
std::vector<uint8_t> DrmHalTest::getVendorUUID() {
std::vector<uint8_t> DrmHalTest::getVendorUUID() {
    if (vendorModule == nullptr) {
    if (vendorModule == nullptr) {
        ALOGW("vendor module for %s not found", GetParamService().c_str());
        ALOGW("vendor module for %s not found", GetParamService().c_str());
        return {};
        return std::vector<uint8_t>(16);
    }
    }
    return vendorModule->getUUID();
    return vendorModule->getUUID();
}
}
@@ -268,18 +268,23 @@ bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::st
    if (!ret.isOk() || !std::count(schemes.uuids.begin(), schemes.uuids.end(), uuid)) {
    if (!ret.isOk() || !std::count(schemes.uuids.begin(), schemes.uuids.end(), uuid)) {
        return false;
        return false;
    }
    }
    if (level > schemes.maxLevel || level < schemes.minLevel) {
    if (mime.empty()) {
        if (level != SecurityLevel::DEFAULT && level != SecurityLevel::UNKNOWN) {
        EXPECT_THAT(level, AnyOf(Eq(SecurityLevel::DEFAULT), Eq(SecurityLevel::UNKNOWN)));
            return false;
        return true;
        }
    }
    }
    if (!mime.empty()) {
    for (auto ct : schemes.mimeTypes) {
        if (!std::count(schemes.mimeTypes.begin(), schemes.mimeTypes.end(), mime)) {
        if (ct.mime != mime) {
            return false;
            continue;
        }
        }
        if (level == SecurityLevel::DEFAULT || level == SecurityLevel::UNKNOWN) {
            return true;
        }
        }
        if (level <= ct.maxLevel && level >= ct.minLevel) {
            return true;
            return true;
        }
        }
    }
    return false;
}


void DrmHalTest::provision() {
void DrmHalTest::provision() {
    std::string certificateType;
    std::string certificateType;
Loading