Revert "Update cas@1.0 hal to cas@1.1"
This reverts commit f9f0a25b26d93cf86ccb44c046f83b86ce962c3d.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I32657e10fa8ff58dd351aa8e0b611195c2826f07
diff --git a/cas/1.1/Android.bp b/cas/1.1/Android.bp
deleted file mode 100644
index bb0edb9..0000000
--- a/cas/1.1/Android.bp
+++ /dev/null
@@ -1,20 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-hidl_interface {
- name: "android.hardware.cas@1.1",
- root: "android.hardware",
- vndk: {
- enabled: true,
- },
- srcs: [
- "ICas.hal",
- "ICasListener.hal",
- "IMediaCasService.hal",
- ],
- interfaces: [
- "android.hardware.cas@1.0",
- "android.hidl.base@1.0",
- ],
- gen_java: true,
-}
-
diff --git a/cas/1.1/ICas.hal b/cas/1.1/ICas.hal
deleted file mode 100644
index 027968e..0000000
--- a/cas/1.1/ICas.hal
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2019 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.cas@1.1;
-
-import @1.0::HidlCasSessionId;
-import @1.0::ICas;
-import @1.0::Status;
-
-/**
- * ICas is the API to control the cas system and is accessible from both
- * Java and native level. It is used to manage sessions, provision/refresh
- * the cas system, and process the EMM/ECM messages. It also allows bi-directional,
- * scheme-specific communications between the client and the cas system.
- */
-
-interface ICas extends @1.0::ICas {
- /**
- * Send an scheme-specific session event to the CasPlugin.
- *
- * @param sessionId the id of an opened session.
- * @param event an integer denoting a scheme-specific event to be sent.
- * @param arg a scheme-specific integer argument for the event.
- * @param data a byte array containing scheme-specific data for the event.
- * @return status the status of the call.
- */
- sendSessionEvent(HidlCasSessionId sessionId, int32_t event, int32_t arg,
- vec<uint8_t> eventData)
- generates (Status status);
-};
diff --git a/cas/1.1/ICasListener.hal b/cas/1.1/ICasListener.hal
deleted file mode 100644
index 5ec1154..0000000
--- a/cas/1.1/ICasListener.hal
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2019 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.cas@1.1;
-
-import @1.0::ICasListener;
-import @1.0::HidlCasSessionId;
-
-interface ICasListener extends @1.0::ICasListener{
- /**
- * Notify the listener of a scheme-specific session event from CA system.
- *
- * @param sessionId the id of an opened session.
- * @param event an integer whose meaning is scheme-specific.
- * @param arg an integer whose meaning is scheme-specific.
- * @param data a byte array of data whose format and meaning are
- * scheme-specific.
- */
- onSessionEvent(HidlCasSessionId sessionId, int32_t event, int32_t arg,
- vec<uint8_t> data);
-};
diff --git a/cas/1.1/IMediaCasService.hal b/cas/1.1/IMediaCasService.hal
deleted file mode 100644
index e82b54c..0000000
--- a/cas/1.1/IMediaCasService.hal
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2019 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.cas@1.1;
-
-import @1.1::ICas;
-import @1.1::ICasListener;
-import @1.0::IMediaCasService;
-
-/**
- * IMediaCasService is the main entry point for interacting with a vendor's
- * cas HAL to create cas and descrambler plugin instances. A cas plugin instance
- * opens cas sessions which are used to obtain keys for a descrambler session,
- * which can in turn be used to descramble protected video content.
- */
-
-interface IMediaCasService extends @1.0::IMediaCasService {
- /**
- * Construct a new instance of a @1.1 ICAS CasPlugin given a CA_system_id.
- *
- * @param caSystemId the id of the CA system.
- * @param listener the event listener to receive events coming from the CasPlugin.
- * @return cas the newly created CasPlugin interface.
- */
- createPluginExt(int32_t caSystemId, ICasListener listener) generates (ICas cas);
-};
diff --git a/cas/1.1/default/Android.bp b/cas/1.1/default/Android.bp
deleted file mode 100644
index 68a49cf..0000000
--- a/cas/1.1/default/Android.bp
+++ /dev/null
@@ -1,49 +0,0 @@
-cc_defaults {
- name: "cas_service_defaults@1.1",
- defaults: ["hidl_defaults"],
- vendor: true,
- relative_install_path: "hw",
- srcs: [
- "CasImpl.cpp",
- "DescramblerImpl.cpp",
- "MediaCasService.cpp",
- "service.cpp",
- "SharedLibrary.cpp",
- "TypeConvert.cpp",
- ],
-
- compile_multilib: "32",
-
- shared_libs: [
- "android.hardware.cas@1.0",
- "android.hardware.cas@1.1",
- "android.hardware.cas.native@1.0",
- "android.hidl.memory@1.0",
- "libbinder",
- "libhidlbase",
- "libhidlmemory",
- "libhidltransport",
- "liblog",
- "libutils",
- ],
- header_libs: [
- "libstagefright_foundation_headers",
- "media_plugin_headers",
- ],
-}
-
-cc_binary {
- name: "android.hardware.cas@1.1-service",
- vintf_fragments: ["android.hardware.cas@1.1-service.xml"],
- defaults: ["cas_service_defaults@1.1"],
- init_rc: ["android.hardware.cas@1.1-service.rc"],
-}
-
-cc_binary {
- name: "android.hardware.cas@1.1-service-lazy",
- vintf_fragments: ["android.hardware.cas@1.1-service-lazy.xml"],
- overrides: ["android.hardware.cas@1.1-service"],
- defaults: ["cas_service_defaults@1.1"],
- init_rc: ["android.hardware.cas@1.1-service-lazy.rc"],
- cflags: ["-DLAZY_SERVICE"],
-}
diff --git a/cas/1.1/default/CasImpl.cpp b/cas/1.1/default/CasImpl.cpp
deleted file mode 100644
index 4cc6017..0000000
--- a/cas/1.1/default/CasImpl.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.cas@1.1-CasImpl"
-
-#include <android/hardware/cas/1.1/ICasListener.h>
-#include <media/cas/CasAPI.h>
-#include <utils/Log.h>
-
-#include "CasImpl.h"
-#include "SharedLibrary.h"
-#include "TypeConvert.h"
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-CasImpl::CasImpl(const sp<ICasListener>& listener) : mListener(listener) {
- ALOGV("CTOR");
-}
-
-CasImpl::~CasImpl() {
- ALOGV("DTOR");
- release();
-}
-
-// static
-void CasImpl::OnEvent(void* appData, int32_t event, int32_t arg, uint8_t* data, size_t size) {
- if (appData == NULL) {
- ALOGE("Invalid appData!");
- return;
- }
- CasImpl* casImpl = static_cast<CasImpl*>(appData);
- casImpl->onEvent(event, arg, data, size);
-}
-
-// static
-void CasImpl::CallBackExt(void* appData, int32_t event, int32_t arg, uint8_t* data, size_t size,
- const CasSessionId* sessionId) {
- if (appData == NULL) {
- ALOGE("Invalid appData!");
- return;
- }
- CasImpl* casImpl = static_cast<CasImpl*>(appData);
- casImpl->onEvent(sessionId, event, arg, data, size);
-}
-
-void CasImpl::init(const sp<SharedLibrary>& library, CasPlugin* plugin) {
- mLibrary = library;
- std::shared_ptr<CasPlugin> holder(plugin);
- std::atomic_store(&mPluginHolder, holder);
-}
-
-void CasImpl::onEvent(int32_t event, int32_t arg, uint8_t* data, size_t size) {
- if (mListener == NULL) {
- return;
- }
-
- HidlCasData eventData;
- if (data != NULL) {
- eventData.setToExternal(data, size);
- }
-
- mListener->onEvent(event, arg, eventData);
-}
-
-void CasImpl::onEvent(const CasSessionId* sessionId, int32_t event, int32_t arg, uint8_t* data,
- size_t size) {
- if (mListener == NULL) {
- return;
- }
-
- HidlCasData eventData;
- if (data != NULL) {
- eventData.setToExternal(data, size);
- }
-
- if (sessionId != NULL) {
- mListener->onSessionEvent(*sessionId, event, arg, eventData);
- } else {
- mListener->onEvent(event, arg, eventData);
- }
-}
-
-Return<Status> CasImpl::setPrivateData(const HidlCasData& pvtData) {
- ALOGV("%s", __FUNCTION__);
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
- return toStatus(holder->setPrivateData(pvtData));
-}
-
-Return<void> CasImpl::openSession(openSession_cb _hidl_cb) {
- ALOGV("%s", __FUNCTION__);
- CasSessionId sessionId;
-
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- status_t err = INVALID_OPERATION;
- if (holder.get() != nullptr) {
- err = holder->openSession(&sessionId);
- holder.reset();
- }
-
- _hidl_cb(toStatus(err), sessionId);
-
- return Void();
-}
-
-Return<Status> CasImpl::setSessionPrivateData(const HidlCasSessionId& sessionId,
- const HidlCasData& pvtData) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
- return toStatus(holder->setSessionPrivateData(sessionId, pvtData));
-}
-
-Return<Status> CasImpl::closeSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
- return toStatus(holder->closeSession(sessionId));
-}
-
-Return<Status> CasImpl::processEcm(const HidlCasSessionId& sessionId, const HidlCasData& ecm) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- return toStatus(holder->processEcm(sessionId, ecm));
-}
-
-Return<Status> CasImpl::processEmm(const HidlCasData& emm) {
- ALOGV("%s", __FUNCTION__);
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- return toStatus(holder->processEmm(emm));
-}
-
-Return<Status> CasImpl::sendEvent(int32_t event, int32_t arg, const HidlCasData& eventData) {
- ALOGV("%s", __FUNCTION__);
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- status_t err = holder->sendEvent(event, arg, eventData);
- return toStatus(err);
-}
-
-Return<Status> CasImpl::sendSessionEvent(const HidlCasSessionId& sessionId, int32_t event,
- int32_t arg, const HidlCasData& eventData) {
- ALOGV("%s", __FUNCTION__);
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- status_t err = holder->sendSessionEvent(sessionId, event, arg, eventData);
- return toStatus(err);
-}
-
-Return<Status> CasImpl::provision(const hidl_string& provisionString) {
- ALOGV("%s: provisionString=%s", __FUNCTION__, provisionString.c_str());
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- return toStatus(holder->provision(String8(provisionString.c_str())));
-}
-
-Return<Status> CasImpl::refreshEntitlements(int32_t refreshType, const HidlCasData& refreshData) {
- ALOGV("%s", __FUNCTION__);
- std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- status_t err = holder->refreshEntitlements(refreshType, refreshData);
- return toStatus(err);
-}
-
-Return<Status> CasImpl::release() {
- ALOGV("%s: plugin=%p", __FUNCTION__, mPluginHolder.get());
-
- std::shared_ptr<CasPlugin> holder(nullptr);
- std::atomic_store(&mPluginHolder, holder);
-
- return Status::OK;
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
diff --git a/cas/1.1/default/CasImpl.h b/cas/1.1/default/CasImpl.h
deleted file mode 100644
index 18aee9e..0000000
--- a/cas/1.1/default/CasImpl.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_CAS_IMPL_H_
-#define ANDROID_HARDWARE_CAS_V1_1_CAS_IMPL_H_
-
-#include <android/hardware/cas/1.1/ICas.h>
-#include <media/stagefright/foundation/ABase.h>
-
-namespace android {
-struct CasPlugin;
-
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-struct ICasListener;
-namespace implementation {
-
-using ::android::hardware::cas::V1_0::HidlCasData;
-using ::android::hardware::cas::V1_0::HidlCasSessionId;
-using ::android::hardware::cas::V1_0::Status;
-
-class SharedLibrary;
-
-class CasImpl : public ICas {
- public:
- CasImpl(const sp<ICasListener>& listener);
- virtual ~CasImpl();
-
- static void OnEvent(void* appData, int32_t event, int32_t arg, uint8_t* data, size_t size);
-
- static void CallBackExt(void* appData, int32_t event, int32_t arg, uint8_t* data, size_t size,
- const CasSessionId* sessionId);
-
- void init(const sp<SharedLibrary>& library, CasPlugin* plugin);
- void onEvent(int32_t event, int32_t arg, uint8_t* data, size_t size);
-
- void onEvent(const CasSessionId* sessionId, int32_t event, int32_t arg, uint8_t* data,
- size_t size);
-
- // ICas inherits
-
- virtual Return<Status> setPrivateData(const HidlCasData& pvtData) override;
-
- virtual Return<void> openSession(openSession_cb _hidl_cb) override;
-
- virtual Return<Status> closeSession(const HidlCasSessionId& sessionId) override;
-
- virtual Return<Status> setSessionPrivateData(const HidlCasSessionId& sessionId,
- const HidlCasData& pvtData) override;
-
- virtual Return<Status> processEcm(const HidlCasSessionId& sessionId,
- const HidlCasData& ecm) override;
-
- virtual Return<Status> processEmm(const HidlCasData& emm) override;
-
- virtual Return<Status> sendEvent(int32_t event, int32_t arg,
- const HidlCasData& eventData) override;
-
- virtual Return<Status> sendSessionEvent(const HidlCasSessionId& sessionId, int32_t event,
- int32_t arg, const HidlCasData& eventData) override;
-
- virtual Return<Status> provision(const hidl_string& provisionString) override;
-
- virtual Return<Status> refreshEntitlements(int32_t refreshType,
- const HidlCasData& refreshData) override;
-
- virtual Return<Status> release() override;
-
- private:
- struct PluginHolder;
- sp<SharedLibrary> mLibrary;
- std::shared_ptr<CasPlugin> mPluginHolder;
- sp<ICasListener> mListener;
-
- DISALLOW_EVIL_CONSTRUCTORS(CasImpl);
-};
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_CAS_IMPL_H_
diff --git a/cas/1.1/default/DescramblerImpl.cpp b/cas/1.1/default/DescramblerImpl.cpp
deleted file mode 100644
index 36dc1a5..0000000
--- a/cas/1.1/default/DescramblerImpl.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.cas@1.1-DescramblerImpl"
-
-#include <hidlmemory/mapping.h>
-#include <media/cas/DescramblerAPI.h>
-#include <media/hardware/CryptoAPI.h>
-#include <media/stagefright/foundation/AUtils.h>
-#include <utils/Log.h>
-
-#include "DescramblerImpl.h"
-#include "SharedLibrary.h"
-#include "TypeConvert.h"
-
-namespace android {
-using hidl::memory::V1_0::IMemory;
-
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-#define CHECK_SUBSAMPLE_DEF(type) \
- static_assert(sizeof(SubSample) == sizeof(type::SubSample), "SubSample: size doesn't match"); \
- static_assert(offsetof(SubSample, numBytesOfClearData) == \
- offsetof(type::SubSample, mNumBytesOfClearData), \
- "SubSample: numBytesOfClearData offset doesn't match"); \
- static_assert(offsetof(SubSample, numBytesOfEncryptedData) == \
- offsetof(type::SubSample, mNumBytesOfEncryptedData), \
- "SubSample: numBytesOfEncryptedData offset doesn't match")
-
-CHECK_SUBSAMPLE_DEF(DescramblerPlugin);
-CHECK_SUBSAMPLE_DEF(CryptoPlugin);
-
-DescramblerImpl::DescramblerImpl(const sp<SharedLibrary>& library, DescramblerPlugin* plugin)
- : mLibrary(library), mPluginHolder(plugin) {
- ALOGV("CTOR: plugin=%p", mPluginHolder.get());
-}
-
-DescramblerImpl::~DescramblerImpl() {
- ALOGV("DTOR: plugin=%p", mPluginHolder.get());
- release();
-}
-
-Return<Status> DescramblerImpl::setMediaCasSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
-
- std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return toStatus(INVALID_OPERATION);
- }
-
- return toStatus(holder->setMediaCasSession(sessionId));
-}
-
-Return<bool> DescramblerImpl::requiresSecureDecoderComponent(const hidl_string& mime) {
- std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- return false;
- }
-
- return holder->requiresSecureDecoderComponent(String8(mime.c_str()));
-}
-
-static inline bool validateRangeForSize(uint64_t offset, uint64_t length, uint64_t size) {
- return isInRange<uint64_t, uint64_t>(0, size, offset, length);
-}
-
-Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl,
- const hidl_vec<SubSample>& subSamples,
- const SharedBuffer& srcBuffer, uint64_t srcOffset,
- const DestinationBuffer& dstBuffer, uint64_t dstOffset,
- descramble_cb _hidl_cb) {
- ALOGV("%s", __FUNCTION__);
-
- // hidl_memory's size is stored in uint64_t, but mapMemory's mmap will map
- // size in size_t. If size is over SIZE_MAX, mapMemory mapMemory could succeed
- // but the mapped memory's actual size will be smaller than the reported size.
- if (srcBuffer.heapBase.size() > SIZE_MAX) {
- ALOGE("Invalid hidl_memory size: %llu", srcBuffer.heapBase.size());
- android_errorWriteLog(0x534e4554, "79376389");
- _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
- return Void();
- }
-
- sp<IMemory> srcMem = mapMemory(srcBuffer.heapBase);
-
- // Validate if the offset and size in the SharedBuffer is consistent with the
- // mapped ashmem, since the offset and size is controlled by client.
- if (srcMem == NULL) {
- ALOGE("Failed to map src buffer.");
- _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
- return Void();
- }
- if (!validateRangeForSize(srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize())) {
- ALOGE("Invalid src buffer range: offset %llu, size %llu, srcMem size %llu",
- srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize());
- android_errorWriteLog(0x534e4554, "67962232");
- _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
- return Void();
- }
-
- // use 64-bit here to catch bad subsample size that might be overflowing.
- uint64_t totalBytesInSubSamples = 0;
- for (size_t i = 0; i < subSamples.size(); i++) {
- totalBytesInSubSamples +=
- (uint64_t)subSamples[i].numBytesOfClearData + subSamples[i].numBytesOfEncryptedData;
- }
- // Further validate if the specified srcOffset and requested total subsample size
- // is consistent with the source shared buffer size.
- if (!validateRangeForSize(srcOffset, totalBytesInSubSamples, srcBuffer.size)) {
- ALOGE("Invalid srcOffset and subsample size: "
- "srcOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu",
- srcOffset, totalBytesInSubSamples, srcBuffer.size);
- android_errorWriteLog(0x534e4554, "67962232");
- _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
- return Void();
- }
-
- void* srcPtr = (uint8_t*)(void*)srcMem->getPointer() + srcBuffer.offset;
- void* dstPtr = NULL;
- if (dstBuffer.type == BufferType::SHARED_MEMORY) {
- // When using shared memory, src buffer is also used as dst,
- // we don't map it again here.
- dstPtr = srcPtr;
-
- // In this case the dst and src would be the same buffer, need to validate
- // dstOffset against the buffer size too.
- if (!validateRangeForSize(dstOffset, totalBytesInSubSamples, srcBuffer.size)) {
- ALOGE("Invalid dstOffset and subsample size: "
- "dstOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu",
- dstOffset, totalBytesInSubSamples, srcBuffer.size);
- android_errorWriteLog(0x534e4554, "67962232");
- _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
- return Void();
- }
- } else {
- native_handle_t* handle =
- const_cast<native_handle_t*>(dstBuffer.secureMemory.getNativeHandle());
- dstPtr = static_cast<void*>(handle);
- }
-
- // Get a local copy of the shared_ptr for the plugin. Note that before
- // calling the HIDL callback, this shared_ptr must be manually reset,
- // since the client side could proceed as soon as the callback is called
- // without waiting for this method to go out of scope.
- std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
- if (holder.get() == nullptr) {
- _hidl_cb(toStatus(INVALID_OPERATION), 0, NULL);
- return Void();
- }
-
- // Casting hidl SubSample to DescramblerPlugin::SubSample, but need
- // to ensure structs are actually idential
-
- int32_t result =
- holder->descramble(dstBuffer.type != BufferType::SHARED_MEMORY,
- (DescramblerPlugin::ScramblingControl)scramblingControl,
- subSamples.size(), (DescramblerPlugin::SubSample*)subSamples.data(),
- srcPtr, srcOffset, dstPtr, dstOffset, NULL);
-
- holder.reset();
- _hidl_cb(toStatus(result >= 0 ? OK : result), result, NULL);
- return Void();
-}
-
-Return<Status> DescramblerImpl::release() {
- ALOGV("%s: plugin=%p", __FUNCTION__, mPluginHolder.get());
-
- std::shared_ptr<DescramblerPlugin> holder(nullptr);
- std::atomic_store(&mPluginHolder, holder);
-
- return Status::OK;
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
diff --git a/cas/1.1/default/DescramblerImpl.h b/cas/1.1/default/DescramblerImpl.h
deleted file mode 100644
index a1f66ae..0000000
--- a/cas/1.1/default/DescramblerImpl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_
-#define ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_
-
-#include <android/hardware/cas/native/1.0/IDescrambler.h>
-#include <media/stagefright/foundation/ABase.h>
-
-namespace android {
-struct DescramblerPlugin;
-using namespace hardware::cas::native::V1_0;
-
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::cas::V1_0::HidlCasSessionId;
-using ::android::hardware::cas::V1_0::Status;
-
-class SharedLibrary;
-
-class DescramblerImpl : public IDescrambler {
- public:
- DescramblerImpl(const sp<SharedLibrary>& library, DescramblerPlugin* plugin);
- virtual ~DescramblerImpl();
-
- virtual Return<Status> setMediaCasSession(const HidlCasSessionId& sessionId) override;
-
- virtual Return<bool> requiresSecureDecoderComponent(const hidl_string& mime) override;
-
- virtual Return<void> descramble(ScramblingControl scramblingControl,
- const hidl_vec<SubSample>& subSamples,
- const SharedBuffer& srcBuffer, uint64_t srcOffset,
- const DestinationBuffer& dstBuffer, uint64_t dstOffset,
- descramble_cb _hidl_cb) override;
-
- virtual Return<Status> release() override;
-
- private:
- sp<SharedLibrary> mLibrary;
- std::shared_ptr<DescramblerPlugin> mPluginHolder;
-
- DISALLOW_EVIL_CONSTRUCTORS(DescramblerImpl);
-};
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_
diff --git a/cas/1.1/default/FactoryLoader.h b/cas/1.1/default/FactoryLoader.h
deleted file mode 100644
index c4a48e2..0000000
--- a/cas/1.1/default/FactoryLoader.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
-#define ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
-
-#include <dirent.h>
-#include <dlfcn.h>
-#include <media/cas/CasAPI.h>
-#include <utils/KeyedVector.h>
-#include <utils/Mutex.h>
-#include "SharedLibrary.h"
-
-using namespace std;
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::cas::V1_0::HidlCasPluginDescriptor;
-
-template <class T>
-class FactoryLoader {
- public:
- FactoryLoader(const char* name) : mFactory(NULL), mCreateFactoryFuncName(name) {}
-
- virtual ~FactoryLoader() { closeFactory(); }
-
- bool findFactoryForScheme(int32_t CA_system_id, sp<SharedLibrary>* library = NULL,
- T** factory = NULL);
-
- bool enumeratePlugins(vector<HidlCasPluginDescriptor>* results);
-
- private:
- typedef T* (*CreateFactoryFunc)();
-
- Mutex mMapLock;
- T* mFactory;
- const char* mCreateFactoryFuncName;
- sp<SharedLibrary> mLibrary;
- KeyedVector<int32_t, String8> mCASystemIdToLibraryPathMap;
- KeyedVector<String8, wp<SharedLibrary> > mLibraryPathToOpenLibraryMap;
-
- bool loadFactoryForSchemeFromPath(const String8& path, int32_t CA_system_id,
- sp<SharedLibrary>* library, T** factory);
-
- bool queryPluginsFromPath(const String8& path, vector<HidlCasPluginDescriptor>* results);
-
- bool openFactory(const String8& path);
- void closeFactory();
-};
-
-template <class T>
-bool FactoryLoader<T>::findFactoryForScheme(int32_t CA_system_id, sp<SharedLibrary>* library,
- T** factory) {
- if (library != NULL) {
- library->clear();
- }
- if (factory != NULL) {
- *factory = NULL;
- }
-
- Mutex::Autolock autoLock(mMapLock);
-
- // first check cache
- ssize_t index = mCASystemIdToLibraryPathMap.indexOfKey(CA_system_id);
- if (index >= 0) {
- return loadFactoryForSchemeFromPath(mCASystemIdToLibraryPathMap[index], CA_system_id,
- library, factory);
- }
-
- // no luck, have to search
- String8 dirPath("/vendor/lib/mediacas");
- DIR* pDir = opendir(dirPath.string());
-
- if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
- return false;
- }
-
- struct dirent* pEntry;
- while ((pEntry = readdir(pDir))) {
- String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
- if (loadFactoryForSchemeFromPath(pluginPath, CA_system_id, library, factory)) {
- mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
- closedir(pDir);
-
- return true;
- }
- }
- }
-
- closedir(pDir);
-
- ALOGE("Failed to find plugin");
- return false;
-}
-
-template <class T>
-bool FactoryLoader<T>::enumeratePlugins(vector<HidlCasPluginDescriptor>* results) {
- ALOGI("enumeratePlugins");
-
- results->clear();
-
- String8 dirPath("/vendor/lib/mediacas");
- DIR* pDir = opendir(dirPath.string());
-
- if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
- return false;
- }
-
- Mutex::Autolock autoLock(mMapLock);
-
- struct dirent* pEntry;
- while ((pEntry = readdir(pDir))) {
- String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
- queryPluginsFromPath(pluginPath, results);
- }
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::loadFactoryForSchemeFromPath(const String8& path, int32_t CA_system_id,
- sp<SharedLibrary>* library, T** factory) {
- closeFactory();
-
- if (!openFactory(path) || !mFactory->isSystemIdSupported(CA_system_id)) {
- closeFactory();
- return false;
- }
-
- if (library != NULL) {
- *library = mLibrary;
- }
- if (factory != NULL) {
- *factory = mFactory;
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::queryPluginsFromPath(const String8& path,
- vector<HidlCasPluginDescriptor>* results) {
- closeFactory();
-
- vector<CasPluginDescriptor> descriptors;
- if (!openFactory(path) || mFactory->queryPlugins(&descriptors) != OK) {
- closeFactory();
- return false;
- }
-
- for (auto it = descriptors.begin(); it != descriptors.end(); it++) {
- results->push_back(
- HidlCasPluginDescriptor{.caSystemId = it->CA_system_id, .name = it->name.c_str()});
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::openFactory(const String8& path) {
- // get strong pointer to open shared library
- ssize_t index = mLibraryPathToOpenLibraryMap.indexOfKey(path);
- if (index >= 0) {
- mLibrary = mLibraryPathToOpenLibraryMap[index].promote();
- } else {
- index = mLibraryPathToOpenLibraryMap.add(path, NULL);
- }
-
- if (!mLibrary.get()) {
- mLibrary = new SharedLibrary(path);
- if (!*mLibrary) {
- return false;
- }
-
- mLibraryPathToOpenLibraryMap.replaceValueAt(index, mLibrary);
- }
-
- CreateFactoryFunc createFactory = (CreateFactoryFunc)mLibrary->lookup(mCreateFactoryFuncName);
- if (createFactory == NULL || (mFactory = createFactory()) == NULL) {
- return false;
- }
- return true;
-}
-
-template <class T>
-void FactoryLoader<T>::closeFactory() {
- delete mFactory;
- mFactory = NULL;
- mLibrary.clear();
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
diff --git a/cas/1.1/default/MediaCasService.cpp b/cas/1.1/default/MediaCasService.cpp
deleted file mode 100644
index e2d3357..0000000
--- a/cas/1.1/default/MediaCasService.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.cas@1.1-MediaCasService"
-
-#include <android/hardware/cas/1.1/ICasListener.h>
-#include <media/cas/CasAPI.h>
-#include <media/cas/DescramblerAPI.h>
-#include <utils/Log.h>
-
-#include "CasImpl.h"
-#include "DescramblerImpl.h"
-#include "MediaCasService.h"
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-MediaCasService::MediaCasService()
- : mCasLoader("createCasFactory"), mDescramblerLoader("createDescramblerFactory") {}
-
-MediaCasService::~MediaCasService() {}
-
-Return<void> MediaCasService::enumeratePlugins(enumeratePlugins_cb _hidl_cb) {
- ALOGV("%s", __FUNCTION__);
-
- vector<HidlCasPluginDescriptor> results;
- mCasLoader.enumeratePlugins(&results);
-
- _hidl_cb(results);
- return Void();
-}
-
-Return<bool> MediaCasService::isSystemIdSupported(int32_t CA_system_id) {
- ALOGV("isSystemIdSupported: CA_system_id=%d", CA_system_id);
-
- return mCasLoader.findFactoryForScheme(CA_system_id);
-}
-
-Return<sp<V1_0::ICas>> MediaCasService::createPlugin(int32_t /* CA_system_id */,
- const sp<V1_0::ICasListener>& /* listener */) {
- ALOGE("%s:Use createPluginExt to create plugin with cas@1.1", __FUNCTION__);
-
- sp<V1_0::ICas> result;
- /*
- CasFactory *factory;
- sp<SharedLibrary> library;
- if (mCasLoader.findFactoryForScheme(CA_system_id, &library, &factory)) {
- CasPlugin *plugin = NULL;
- sp<CasImpl> casImpl = new CasImpl(listener);
- if (factory->createPlugin(CA_system_id, casImpl.get(),
- CasImpl::OnEvent, &plugin) == OK && plugin != NULL) {
- casImpl->init(library, plugin);
- result = casImpl;
- }
- }
- */
- return result;
-}
-
-Return<sp<ICas>> MediaCasService::createPluginExt(int32_t CA_system_id,
- const sp<ICasListener>& listener) {
- ALOGV("%s: CA_system_id=%d", __FUNCTION__, CA_system_id);
-
- sp<ICas> result;
-
- CasFactory* factory;
- sp<SharedLibrary> library;
- if (mCasLoader.findFactoryForScheme(CA_system_id, &library, &factory)) {
- CasPlugin* plugin = NULL;
- sp<CasImpl> casImpl = new CasImpl(listener);
- if (factory->createPlugin(CA_system_id, casImpl.get(), &CasImpl::CallBackExt, &plugin) ==
- OK &&
- plugin != NULL) {
- casImpl->init(library, plugin);
- result = casImpl;
- }
- }
-
- return result;
-}
-
-Return<bool> MediaCasService::isDescramblerSupported(int32_t CA_system_id) {
- ALOGV("%s: CA_system_id=%d", __FUNCTION__, CA_system_id);
-
- return mDescramblerLoader.findFactoryForScheme(CA_system_id);
-}
-
-Return<sp<IDescramblerBase>> MediaCasService::createDescrambler(int32_t CA_system_id) {
- ALOGV("%s: CA_system_id=%d", __FUNCTION__, CA_system_id);
-
- sp<IDescrambler> result;
-
- DescramblerFactory* factory;
- sp<SharedLibrary> library;
- if (mDescramblerLoader.findFactoryForScheme(CA_system_id, &library, &factory)) {
- DescramblerPlugin* plugin = NULL;
- if (factory->createPlugin(CA_system_id, &plugin) == OK && plugin != NULL) {
- result = new DescramblerImpl(library, plugin);
- }
- }
-
- return result;
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
diff --git a/cas/1.1/default/MediaCasService.h b/cas/1.1/default/MediaCasService.h
deleted file mode 100644
index ec5a86d..0000000
--- a/cas/1.1/default/MediaCasService.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
-#define ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
-
-#include <android/hardware/cas/1.1/IMediaCasService.h>
-
-#include "FactoryLoader.h"
-
-namespace android {
-struct CasFactory;
-struct DescramblerFactory;
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::cas::V1_0::HidlCasPluginDescriptor;
-using ::android::hardware::cas::V1_0::IDescramblerBase;
-
-class MediaCasService : public IMediaCasService {
- public:
- MediaCasService();
-
- virtual Return<void> enumeratePlugins(enumeratePlugins_cb _hidl_cb) override;
-
- virtual Return<bool> isSystemIdSupported(int32_t CA_system_id) override;
-
- virtual Return<sp<V1_0::ICas>> createPlugin(int32_t CA_system_id,
- const sp<V1_0::ICasListener>& listener) override;
-
- virtual Return<sp<ICas>> createPluginExt(int32_t CA_system_id,
- const sp<ICasListener>& listener) override;
-
- virtual Return<bool> isDescramblerSupported(int32_t CA_system_id) override;
-
- virtual Return<sp<IDescramblerBase>> createDescrambler(int32_t CA_system_id) override;
-
- private:
- FactoryLoader<CasFactory> mCasLoader;
- FactoryLoader<DescramblerFactory> mDescramblerLoader;
-
- virtual ~MediaCasService();
-};
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
diff --git a/cas/1.1/default/SharedLibrary.cpp b/cas/1.1/default/SharedLibrary.cpp
deleted file mode 100644
index ffe4bb9..0000000
--- a/cas/1.1/default/SharedLibrary.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.cas@1.1-SharedLibrary"
-
-#include "SharedLibrary.h"
-#include <dlfcn.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <utils/Log.h>
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-SharedLibrary::SharedLibrary(const String8& path) {
- mLibHandle = dlopen(path.string(), RTLD_NOW);
-}
-
-SharedLibrary::~SharedLibrary() {
- if (mLibHandle != NULL) {
- dlclose(mLibHandle);
- mLibHandle = NULL;
- }
-}
-
-bool SharedLibrary::operator!() const {
- return mLibHandle == NULL;
-}
-
-void* SharedLibrary::lookup(const char* symbol) const {
- if (!mLibHandle) {
- return NULL;
- }
- // Clear last error before we load the symbol again,
- // in case the caller didn't retrieve it.
- (void)dlerror();
- return dlsym(mLibHandle, symbol);
-}
-
-const char* SharedLibrary::lastError() const {
- const char* error = dlerror();
- return error ? error : "No errors or unknown error";
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
diff --git a/cas/1.1/default/SharedLibrary.h b/cas/1.1/default/SharedLibrary.h
deleted file mode 100644
index f4d2ff6..0000000
--- a/cas/1.1/default/SharedLibrary.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_SHARED_LIBRARY_H_
-#define ANDROID_HARDWARE_CAS_V1_1_SHARED_LIBRARY_H_
-
-#include <media/stagefright/foundation/ABase.h>
-#include <utils/RefBase.h>
-#include <utils/String8.h>
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-class SharedLibrary : public RefBase {
- public:
- explicit SharedLibrary(const String8& path);
- ~SharedLibrary();
-
- bool operator!() const;
- void* lookup(const char* symbol) const;
- const char* lastError() const;
-
- private:
- void* mLibHandle;
- DISALLOW_EVIL_CONSTRUCTORS(SharedLibrary);
-};
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_SHARED_LIBRARY_H_
diff --git a/cas/1.1/default/TypeConvert.cpp b/cas/1.1/default/TypeConvert.cpp
deleted file mode 100644
index 09ef41a..0000000
--- a/cas/1.1/default/TypeConvert.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.cas@1.1-TypeConvert"
-
-#include "TypeConvert.h"
-#include <utils/Log.h>
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-Status toStatus(status_t legacyStatus) {
- Status status;
- switch (legacyStatus) {
- case android::OK:
- status = Status::OK;
- break;
- case android::ERROR_CAS_NO_LICENSE:
- status = Status::ERROR_CAS_NO_LICENSE;
- break;
- case android::ERROR_CAS_LICENSE_EXPIRED:
- status = Status::ERROR_CAS_LICENSE_EXPIRED;
- break;
- case android::ERROR_CAS_SESSION_NOT_OPENED:
- status = Status::ERROR_CAS_SESSION_NOT_OPENED;
- break;
- case android::ERROR_CAS_CANNOT_HANDLE:
- status = Status::ERROR_CAS_CANNOT_HANDLE;
- break;
- case android::ERROR_CAS_TAMPER_DETECTED:
- status = Status::ERROR_CAS_INVALID_STATE;
- break;
- case android::BAD_VALUE:
- status = Status::BAD_VALUE;
- break;
- case android::ERROR_CAS_NOT_PROVISIONED:
- status = Status::ERROR_CAS_NOT_PROVISIONED;
- break;
- case android::ERROR_CAS_RESOURCE_BUSY:
- status = Status::ERROR_CAS_RESOURCE_BUSY;
- break;
- case android::ERROR_CAS_INSUFFICIENT_OUTPUT_PROTECTION:
- status = Status::ERROR_CAS_INSUFFICIENT_OUTPUT_PROTECTION;
- break;
- case android::ERROR_CAS_DEVICE_REVOKED:
- status = Status::ERROR_CAS_DEVICE_REVOKED;
- break;
- case android::ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED:
- status = Status::ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED;
- break;
- case android::ERROR_CAS_DECRYPT:
- status = Status::ERROR_CAS_DECRYPT;
- break;
- default:
- ALOGW("Unable to convert legacy status: %d, defaulting to UNKNOWN", legacyStatus);
- status = Status::ERROR_CAS_UNKNOWN;
- break;
- }
- return status;
-}
-
-String8 sessionIdToString(const CasSessionId& sessionId) {
- String8 result;
- for (size_t i = 0; i < sessionId.size(); i++) {
- result.appendFormat("%02x ", sessionId[i]);
- }
- if (result.isEmpty()) {
- result.append("(null)");
- }
- return result;
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
diff --git a/cas/1.1/default/TypeConvert.h b/cas/1.1/default/TypeConvert.h
deleted file mode 100644
index c4a0119..0000000
--- a/cas/1.1/default/TypeConvert.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAS_V1_1_TYPE_CONVERT_H
-#define ANDROID_HARDWARE_CAS_V1_1_TYPE_CONVERT_H
-
-#include <android/hardware/cas/1.0/types.h>
-#include <media/cas/CasAPI.h>
-#include <media/stagefright/MediaErrors.h>
-#include <utils/String8.h>
-
-namespace android {
-namespace hardware {
-namespace cas {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::cas::V1_0::Status;
-
-Status toStatus(status_t legacyStatus);
-
-String8 sessionIdToString(const CasSessionId& sessionId);
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace cas
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_CAS_V1_1_TYPE_CONVERT_H
diff --git a/cas/1.1/default/android.hardware.cas@1.1-service-lazy.rc b/cas/1.1/default/android.hardware.cas@1.1-service-lazy.rc
deleted file mode 100644
index 9227b6f..0000000
--- a/cas/1.1/default/android.hardware.cas@1.1-service-lazy.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-service vendor.cas-hal-1-1 /vendor/bin/hw/android.hardware.cas@1.1-service-lazy
- interface android.hardware.cas@1.1::IMediaCasService default
- oneshot
- disabled
- class hal
- user media
- group mediadrm drmrpc
- ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
diff --git a/cas/1.1/default/android.hardware.cas@1.1-service-lazy.xml b/cas/1.1/default/android.hardware.cas@1.1-service-lazy.xml
deleted file mode 100644
index c9f13ba..0000000
--- a/cas/1.1/default/android.hardware.cas@1.1-service-lazy.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="hidl">
- <name>android.hardware.cas</name>
- <transport>hwbinder</transport>
- <version>1.1</version>
- <interface>
- <name>IMediaCasService</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/cas/1.1/default/android.hardware.cas@1.1-service.rc b/cas/1.1/default/android.hardware.cas@1.1-service.rc
deleted file mode 100644
index 4081fe1..0000000
--- a/cas/1.1/default/android.hardware.cas@1.1-service.rc
+++ /dev/null
@@ -1,6 +0,0 @@
-service vendor.cas-hal-1-1 /vendor/bin/hw/android.hardware.cas@1.1-service
- class hal
- user media
- group mediadrm drmrpc
- ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
diff --git a/cas/1.1/default/android.hardware.cas@1.1-service.xml b/cas/1.1/default/android.hardware.cas@1.1-service.xml
deleted file mode 100644
index c9f13ba..0000000
--- a/cas/1.1/default/android.hardware.cas@1.1-service.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="hidl">
- <name>android.hardware.cas</name>
- <transport>hwbinder</transport>
- <version>1.1</version>
- <interface>
- <name>IMediaCasService</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/cas/1.1/default/service.cpp b/cas/1.1/default/service.cpp
deleted file mode 100644
index 9625303..0000000
--- a/cas/1.1/default/service.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 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.
- */
-
-//#define LOG_NDEBUG 0
-#ifdef LAZY_SERVICE
-#define LOG_TAG "android.hardware.cas@1.1-service-lazy"
-#else
-#define LOG_TAG "android.hardware.cas@1.1-service"
-#endif
-
-#include <binder/ProcessState.h>
-#include <hidl/HidlTransportSupport.h>
-#include <hidl/LegacySupport.h>
-
-#include "MediaCasService.h"
-
-using android::hardware::configureRpcThreadpool;
-using android::hardware::joinRpcThreadpool;
-using android::hardware::LazyServiceRegistrar;
-using android::hardware::cas::V1_1::IMediaCasService;
-using android::hardware::cas::V1_1::implementation::MediaCasService;
-
-#ifdef LAZY_SERVICE
-const bool kLazyService = true;
-#else
-const bool kLazyService = false;
-#endif
-
-int main() {
- configureRpcThreadpool(8, true /* callerWillJoin */);
-
- // Setup hwbinder service
- android::sp<IMediaCasService> service = new MediaCasService();
- android::status_t status;
- if (kLazyService) {
- auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
- status = serviceRegistrar->registerService(service);
- } else {
- status = service->registerAsService();
- }
- LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering cas service: %d", status);
-
- joinRpcThreadpool();
- return 0;
-}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 89855a0..94ffe80 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -121,7 +121,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.cas</name>
- <version>1.0-1</version>
+ <version>1.0</version>
<interface>
<name>IMediaCasService</name>
<instance>default</instance>