Home | History | Annotate | Download | only in hidl
      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 #include <CryptoFactory.h>
     17 #include <DrmFactory.h>
     18 
     19 #include <android-base/logging.h>
     20 #include <binder/ProcessState.h>
     21 #include <hidl/HidlLazyUtils.h>
     22 #include <hidl/HidlTransportSupport.h>
     23 
     24 using ::android::hardware::configureRpcThreadpool;
     25 using ::android::hardware::joinRpcThreadpool;
     26 using ::android::sp;
     27 
     28 using android::hardware::drm::V1_2::ICryptoFactory;
     29 using android::hardware::drm::V1_2::IDrmFactory;
     30 using android::hardware::drm::V1_2::clearkey::CryptoFactory;
     31 using android::hardware::drm::V1_2::clearkey::DrmFactory;
     32 
     33 int main(int /* argc */, char** /* argv */) {
     34     sp<IDrmFactory> drmFactory = new DrmFactory;
     35     sp<ICryptoFactory> cryptoFactory = new CryptoFactory;
     36 
     37     configureRpcThreadpool(8, true /* callerWillJoin */);
     38 
     39     // Setup hwbinder service
     40     CHECK_EQ(drmFactory->registerAsService("clearkey"), android::NO_ERROR)
     41         << "Failed to register Clearkey Factory HAL";
     42     CHECK_EQ(cryptoFactory->registerAsService("clearkey"), android::NO_ERROR)
     43         << "Failed to register Clearkey Crypto  HAL";
     44 
     45     joinRpcThreadpool();
     46 }
     47