blob: 12397fb4c54f672761b580d4596f139869f15295 [file] [log] [blame]
Chong Zhang8f915432018-09-05 11:17:17 -07001/*
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
18#include <android-base/logging.h>
19
20// from LOCAL_C_INCLUDES
21#include "minijail.h"
22
Chong Zhang8f915432018-09-05 11:17:17 -070023#include <hidl/HidlTransportSupport.h>
Chong Zhangea788f72018-10-12 14:44:24 -070024
25#include "MediaCodecUpdateService.h"
Chong Zhang8f915432018-09-05 11:17:17 -070026
27using namespace android;
28
Chong Zhang8f915432018-09-05 11:17:17 -070029static const char kSystemSeccompPolicyPath[] =
Ivan Lozanofffc2282019-01-10 15:18:12 -080030 "/system/etc/seccomp_policy/mediaswcodec.policy";
Chong Zhang8f915432018-09-05 11:17:17 -070031static const char kVendorSeccompPolicyPath[] =
Ivan Lozanofffc2282019-01-10 15:18:12 -080032 "/vendor/etc/seccomp_policy/mediaswcodec.policy";
Chong Zhang8f915432018-09-05 11:17:17 -070033
Kostya Kortchinsky21f08542018-12-18 07:39:15 -080034// Disable Scudo's mismatch allocation check, as it is being triggered
35// by some third party code.
36extern "C" const char *__scudo_default_options() {
37 return "DeallocationTypeMismatch=false";
38}
39
Chong Zhang8f915432018-09-05 11:17:17 -070040int main(int argc __unused, char** /*argv*/)
41{
42 LOG(INFO) << "media swcodec service starting";
43 signal(SIGPIPE, SIG_IGN);
44 SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath);
45
Chong Zhang8f915432018-09-05 11:17:17 -070046 ::android::hardware::configureRpcThreadpool(64, false);
47
Chong Zhangd9cf3a22019-01-09 13:12:00 -080048 // codec libs are currently 32-bit only
49 loadFromApex("/apex/com.android.media.swcodec/lib");
Chong Zhang8f915432018-09-05 11:17:17 -070050
51 ::android::hardware::joinRpcThreadpool();
52}