Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 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 | |
| 18 | #include <android-base/logging.h> |
| 19 | |
| 20 | // from LOCAL_C_INCLUDES |
| 21 | #include "minijail.h" |
| 22 | |
Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 23 | #include <hidl/HidlTransportSupport.h> |
Chong Zhang | ea788f7 | 2018-10-12 14:44:24 -0700 | [diff] [blame] | 24 | |
| 25 | #include "MediaCodecUpdateService.h" |
Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 26 | |
| 27 | using namespace android; |
| 28 | |
| 29 | // TODO: replace policy with software codec-only policies |
| 30 | // Must match location in Android.mk. |
| 31 | static const char kSystemSeccompPolicyPath[] = |
| 32 | "/system/etc/seccomp_policy/mediacodec.policy"; |
| 33 | static const char kVendorSeccompPolicyPath[] = |
| 34 | "/vendor/etc/seccomp_policy/mediacodec.policy"; |
| 35 | |
Kostya Kortchinsky | 21f0854 | 2018-12-18 07:39:15 -0800 | [diff] [blame] | 36 | // Disable Scudo's mismatch allocation check, as it is being triggered |
| 37 | // by some third party code. |
| 38 | extern "C" const char *__scudo_default_options() { |
| 39 | return "DeallocationTypeMismatch=false"; |
| 40 | } |
| 41 | |
Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 42 | int main(int argc __unused, char** /*argv*/) |
| 43 | { |
| 44 | LOG(INFO) << "media swcodec service starting"; |
| 45 | signal(SIGPIPE, SIG_IGN); |
| 46 | SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath); |
| 47 | |
Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 48 | ::android::hardware::configureRpcThreadpool(64, false); |
| 49 | |
Chong Zhang | d9cf3a2 | 2019-01-09 13:12:00 -0800 | [diff] [blame^] | 50 | // codec libs are currently 32-bit only |
| 51 | loadFromApex("/apex/com.android.media.swcodec/lib"); |
Chong Zhang | 8f91543 | 2018-09-05 11:17:17 -0700 | [diff] [blame] | 52 | |
| 53 | ::android::hardware::joinRpcThreadpool(); |
| 54 | } |