• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 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_NDEBUG 1
17 #define LOG_TAG "clearkey-main"
18 
19 #include "CreatePluginFactories.h"
20 
21 #include <android-base/logging.h>
22 
23 #include <android/binder_manager.h>
24 #include <android/binder_process.h>
25 
26 using ::android::base::InitLogging;
27 using ::android::base::LogdLogger;
28 
29 using ::aidl::android::hardware::drm::clearkey::createDrmFactory;
30 using ::aidl::android::hardware::drm::clearkey::DrmFactory;
31 
main(int,char * argv[])32 int main(int /*argc*/, char* argv[]) {
33     InitLogging(argv, LogdLogger());
34     ::android::base::SetMinimumLogSeverity(::android::base::VERBOSE);
35     ABinderProcess_setThreadPoolMaxThreadCount(8);
36 
37     std::shared_ptr<DrmFactory> drmFactory = createDrmFactory();
38     const std::string drmInstance = std::string() + DrmFactory::descriptor + "/clearkey";
39     binder_status_t status =
40             AServiceManager_addService(drmFactory->asBinder().get(), drmInstance.c_str());
41     CHECK(status == STATUS_OK);
42 
43     ABinderProcess_joinThreadPool();
44     return EXIT_FAILURE;  // should not reached
45 }
46