main_swcodecservice.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. **
  3. ** Copyright 2018, The Android Open Source Project
  4. **
  5. ** Licensed under the Apache License, Version 2.0 (the "License");
  6. ** you may not use this file except in compliance with the License.
  7. ** You may obtain a copy of the License at
  8. **
  9. ** http://www.apache.org/licenses/LICENSE-2.0
  10. **
  11. ** Unless required by applicable law or agreed to in writing, software
  12. ** distributed under the License is distributed on an "AS IS" BASIS,
  13. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ** See the License for the specific language governing permissions and
  15. ** limitations under the License.
  16. */
  17. #include <android-base/logging.h>
  18. // from LOCAL_C_INCLUDES
  19. #include "minijail.h"
  20. #include <hidl/HidlTransportSupport.h>
  21. using namespace android;
  22. // kSystemSeccompPolicyPath points to the policy for the swcodecs themselves and
  23. // is part of the updates. kVendorSeccompPolicyPath points to any additional
  24. // policies that the vendor may need for the device.
  25. static const char kSystemSeccompPolicyPath[] =
  26. "/apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy";
  27. static const char kVendorSeccompPolicyPath[] =
  28. "/vendor/etc/seccomp_policy/mediaswcodec.policy";
  29. extern "C" void RegisterCodecServices();
  30. int main(int argc __unused, char** argv)
  31. {
  32. LOG(INFO) << "media swcodec service starting";
  33. signal(SIGPIPE, SIG_IGN);
  34. SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath);
  35. strcpy(argv[0], "media.swcodec");
  36. ::android::hardware::configureRpcThreadpool(64, false);
  37. RegisterCodecServices();
  38. ::android::hardware::joinRpcThreadpool();
  39. }