1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #define LOG_TAG "android.hardware.drm@1.1-service.clearkey" 17 18 #include <CryptoFactory.h> 19 #include <DrmFactory.h> 20 21 #include <android-base/logging.h> 22 #include <binder/ProcessState.h> 23 #include <hidl/HidlTransportSupport.h> 24 25 using ::android::hardware::configureRpcThreadpool; 26 using ::android::hardware::joinRpcThreadpool; 27 using ::android::sp; 28 29 using android::hardware::drm::V1_1::ICryptoFactory; 30 using android::hardware::drm::V1_1::IDrmFactory; 31 using android::hardware::drm::V1_1::clearkey::CryptoFactory; 32 using android::hardware::drm::V1_1::clearkey::DrmFactory; 33 34 main(int,char **)35int main(int /* argc */, char** /* argv */) { 36 ALOGD("android.hardware.drm@1.1-service.clearkey starting..."); 37 38 // The DRM HAL may communicate to other vendor components via 39 // /dev/vndbinder 40 android::ProcessState::initWithDriver("/dev/vndbinder"); 41 42 sp<IDrmFactory> drmFactory = new DrmFactory; 43 sp<ICryptoFactory> cryptoFactory = new CryptoFactory; 44 45 configureRpcThreadpool(8, true /* callerWillJoin */); 46 47 // Setup hwbinder service 48 CHECK_EQ(drmFactory->registerAsService("clearkey"), android::NO_ERROR) 49 << "Failed to register Clearkey Factory HAL"; 50 CHECK_EQ(cryptoFactory->registerAsService("clearkey"), android::NO_ERROR) 51 << "Failed to register Clearkey Crypto HAL"; 52 53 joinRpcThreadpool(); 54 } 55