Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04c0edc8 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

Create Codec2.0 service

Test: adb shell setenforce 0
adb shell /vendor/bin/hw/vendor.google.media.c2@1.0-service &
adb shell /vendor/bin/hw/vendor.google.media.c2@1.0-service-system &
adb shell lshal | grep media.c2

Test: Builds

Bug: 31973802
Bug: 64121714
Change-Id: I00037f33836821b61bdb4d8773eb68379903ffd3
parent 0706cb6c
Loading
Loading
Loading
Loading
+71 −0
Original line number Original line Diff line number Diff line
cc_binary {
    name: "vendor.google.media.c2@1.0-service",
    defaults: ["hidl_defaults"],
    soc_specific: true,
    relative_install_path: "hw",
    srcs: [
        "vendor.cpp",
    ],

    init_rc: ["vendor.google.media.c2@1.0-service.rc"],

    shared_libs: [
        "vendor.google.media.c2@1.0",
        "libavservices_minijail_vendor",
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "liblog",
        "libstagefright_codec2_hidl@1.0",
        "libstagefright_codec2_vndk",
        "libutils",
    ],

    arch: {
        arm: {
            required: ["codec2.vendor.base.policy"],
        },
        x86: {
            required: ["codec2.vendor.base.policy"],
        },
    },

    compile_multilib: "32",
}

cc_binary {
    name: "vendor.google.media.c2@1.0-service-system",
    defaults: ["hidl_defaults"],
    relative_install_path: "hw",
    srcs: [
        "system.cpp",
    ],

    init_rc: ["vendor.google.media.c2@1.0-service-system.rc"],

    shared_libs: [
        "vendor.google.media.c2@1.0",
        "libavservices_minijail",
        "libcutils",
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "liblog",
        "libstagefright_codec2_hidl@1.0",
        "libstagefright_codec2_vndk",
        "libutils",
        "libv4l2_c2componentstore",
    ],

    arch: {
        arm: {
            required: ["codec2.system.base.policy"],
        },
        x86: {
            required: ["codec2.system.base.policy"],
        },
    },

    compile_multilib: "32",
}
+43 −0
Original line number Original line Diff line number Diff line
LOCAL_PATH := $(call my-dir)

# vendor service seccomp policy
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), x86 x86_64 arm arm64))
include $(CLEAR_VARS)
LOCAL_MODULE := codec2.vendor.base.policy
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/seccomp_policy
LOCAL_REQUIRED_MODULES := crash_dump.policy
ifdef TARGET_2ND_ARCH
    ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
        LOCAL_SRC_FILES := seccomp_policy/codec2.vendor.base-$(TARGET_2ND_ARCH).policy
    else
        LOCAL_SRC_FILES := seccomp_policy/codec2.vendor.base-$(TARGET_ARCH).policy
    endif
else
    LOCAL_SRC_FILES := seccomp_policy/codec2.vendor.base-$(TARGET_ARCH).policy
endif
include $(BUILD_PREBUILT)
endif

# system service seccomp policy
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), x86 x86_64 arm arm64))
include $(CLEAR_VARS)
LOCAL_MODULE := codec2.system.base.policy
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/seccomp_policy
LOCAL_REQUIRED_MODULES := crash_dump.policy
ifdef TARGET_2ND_ARCH
    ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
        LOCAL_SRC_FILES := seccomp_policy/codec2.system.base-$(TARGET_2ND_ARCH).policy
    else
        LOCAL_SRC_FILES := seccomp_policy/codec2.system.base-$(TARGET_ARCH).policy
    endif
else
    LOCAL_SRC_FILES := seccomp_policy/codec2.system.base-$(TARGET_ARCH).policy
endif
include $(BUILD_PREBUILT)
endif

include $(call all-makefiles-under, $(LOCAL_PATH))
+73 −0
Original line number Original line Diff line number Diff line
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Organized by frequency of systemcall - in descending order for
# best performance.
futex: 1
ioctl: 1
write: 1
prctl: 1
clock_gettime: 1
getpriority: 1
read: 1
close: 1
writev: 1
dup: 1
ppoll: 1
mmap2: 1
getrandom: 1

# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
# parser support for '<' is in this needs to be modified to also prevent
# |old_address| and |new_address| from touching the exception vector page, which
# on ARM is statically loaded at 0xffff 0000. See
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
# for more details.
mremap: arg3 == 3
munmap: 1
mprotect: 1
madvise: 1
openat: 1
sigaltstack: 1
clone: 1
setpriority: 1
getuid32: 1
fstat64: 1
fstatfs64: 1
pread64: 1
faccessat: 1
readlinkat: 1
exit: 1
rt_sigprocmask: 1
set_tid_address: 1
restart_syscall: 1
exit_group: 1
rt_sigreturn: 1
pipe2: 1
gettimeofday: 1
sched_yield: 1
nanosleep: 1
lseek: 1
_llseek: 1
sched_get_priority_max: 1
sched_get_priority_min: 1
statfs64: 1
sched_setscheduler: 1
fstatat64: 1
ugetrlimit: 1
getdents64: 1
getrandom: 1

@include /system/etc/seccomp_policy/crash_dump.arm.policy
+57 −0
Original line number Original line Diff line number Diff line
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

read: 1
mprotect: 1
prctl: 1
openat: 1
getuid32: 1
writev: 1
ioctl: 1
close: 1
mmap2: 1
fstat64: 1
madvise: 1
fstatat64: 1
futex: 1
munmap: 1
faccessat: 1
_llseek: 1
lseek: 1
clone: 1
sigaltstack: 1
setpriority: 1
restart_syscall: 1
exit: 1
exit_group: 1
rt_sigreturn: 1
ugetrlimit: 1
readlinkat: 1
_llseek: 1
fstatfs64: 1
pread64: 1
mremap: 1
dup: 1
set_tid_address: 1
write: 1
nanosleep: 1

# Required by AddressSanitizer
gettid: 1
sched_yield: 1
getpid: 1
gettid: 1

@include /system/etc/seccomp_policy/crash_dump.x86.policy
+73 −0
Original line number Original line Diff line number Diff line
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Organized by frequency of systemcall - in descending order for
# best performance.
futex: 1
ioctl: 1
write: 1
prctl: 1
clock_gettime: 1
getpriority: 1
read: 1
close: 1
writev: 1
dup: 1
ppoll: 1
mmap2: 1
getrandom: 1

# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
# parser support for '<' is in this needs to be modified to also prevent
# |old_address| and |new_address| from touching the exception vector page, which
# on ARM is statically loaded at 0xffff 0000. See
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
# for more details.
mremap: arg3 == 3
munmap: 1
mprotect: 1
madvise: 1
openat: 1
sigaltstack: 1
clone: 1
setpriority: 1
getuid32: 1
fstat64: 1
fstatfs64: 1
pread64: 1
faccessat: 1
readlinkat: 1
exit: 1
rt_sigprocmask: 1
set_tid_address: 1
restart_syscall: 1
exit_group: 1
rt_sigreturn: 1
pipe2: 1
gettimeofday: 1
sched_yield: 1
nanosleep: 1
lseek: 1
_llseek: 1
sched_get_priority_max: 1
sched_get_priority_min: 1
statfs64: 1
sched_setscheduler: 1
fstatat64: 1
ugetrlimit: 1
getdents64: 1
getrandom: 1

@include /system/etc/seccomp_policy/crash_dump.arm.policy
Loading