bug: 127499775 test: - adb shell lshal debug android.hardware.media.c2@1.0::IComponentStore/software check all software c2 codecs are still listed - clean-built image shouldn't have mediaswcodec in /system/bin - atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small - atest media_swcodec_e2e_tests Change-Id: I96df803c29aa595dfd2b51d5a68d6db2c08726f3gugelfrei
parent
28da31bbda
commit
9bda452cda
@ -0,0 +1,74 @@
|
||||
# Copyright (C) 2019 The Android Open Source Project
|
||||
#
|
||||
# Bionic loader config file for the media swcodec APEX.
|
||||
#
|
||||
# There are no versioned APEX paths here - this APEX module does not support
|
||||
# having several versions mounted.
|
||||
|
||||
dir.swcodec = /apex/com.android.media.swcodec/bin/
|
||||
|
||||
[swcodec]
|
||||
additional.namespaces = platform
|
||||
|
||||
###############################################################################
|
||||
# "default" namespace
|
||||
#
|
||||
# This namespace is for the binaries and libraries on the swcodec APEX.
|
||||
###############################################################################
|
||||
|
||||
namespace.default.isolated = true
|
||||
namespace.default.visible = true
|
||||
|
||||
namespace.default.search.paths = /apex/com.android.media.swcodec/${LIB}
|
||||
namespace.default.asan.search.paths = /apex/com.android.media.swcodec/${LIB}
|
||||
|
||||
# Keep the below in sync with "sphal" namespace in system's /etc/ld.config.txt
|
||||
# Codec2 has dependencies on some SP-hals (eg. android.hardware.graphics.mapper@2.0)
|
||||
# These are dlopen'ed by libvndksupport.so.
|
||||
namespace.default.search.paths += /odm/${LIB}
|
||||
namespace.default.search.paths += /vendor/${LIB}
|
||||
|
||||
namespace.default.permitted.paths = /odm/${LIB}
|
||||
namespace.default.permitted.paths += /vendor/${LIB}
|
||||
namespace.default.permitted.paths += /vendor/${LIB}/hw
|
||||
namespace.default.permitted.paths += /system/vendor/${LIB}
|
||||
|
||||
namespace.default.asan.search.paths += /data/asan/odm/${LIB}
|
||||
namespace.default.asan.search.paths += /odm/${LIB}
|
||||
namespace.default.asan.search.paths += /data/asan/vendor/${LIB}
|
||||
namespace.default.asan.search.paths += /vendor/${LIB}
|
||||
|
||||
namespace.default.asan.permitted.paths = /data/asan/odm/${LIB}
|
||||
namespace.default.asan.permitted.paths += /odm/${LIB}
|
||||
namespace.default.asan.permitted.paths += /data/asan/vendor/${LIB}
|
||||
namespace.default.asan.permitted.paths += /vendor/${LIB}
|
||||
|
||||
namespace.default.links = platform
|
||||
|
||||
# TODO: replace the following when apex has a way to auto-generate this list
|
||||
# namespace.default.link.platform.shared_libs = %LLNDK_LIBRARIES%
|
||||
# namespace.default.link.platform.shared_libs += %SANITIZER_RUNTIME_LIBRARIES%
|
||||
namespace.default.link.platform.shared_libs = libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libRS.so:libandroid_net.so:libc.so:libclang_rt.asan-aarch64-android.so:libclang_rt.asan-arm-android.so:libclang_rt.hwasan-aarch64-android.so:libclang_rt.asan-i686-android.so:libclang_rt.asan-x86_64-android.so:libdl.so:libft2.so:liblog.so:libm.so:libmediandk.so:libnativewindow.so:libneuralnetworks.so:libsync.so:libvndksupport.so:libvulkan.so
|
||||
|
||||
###############################################################################
|
||||
# "platform" namespace
|
||||
#
|
||||
# This namespace is for linking to LLNDK and ASAN libraries on the system.
|
||||
###############################################################################
|
||||
|
||||
namespace.platform.isolated = true
|
||||
|
||||
namespace.platform.search.paths = /system/${LIB}
|
||||
namespace.platform.asan.search.paths = /data/asan/system/${LIB}
|
||||
|
||||
# /system/lib/libc.so, etc are symlinks to /bionic/lib/libc.so, etc.
|
||||
# Add /bionic/lib to the permitted paths because linker uses realpath(3)
|
||||
# to check the accessibility of the lib. We could add this to search.paths
|
||||
# instead but that makes the resolution of bionic libs be dependent on
|
||||
# the order of /system/lib and /bionic/lib in search.paths. If /bionic/lib
|
||||
# is after /system/lib, then /bionic/lib is never tried because libc.so
|
||||
# is always found in /system/lib but fails to pass the accessibility test
|
||||
# because of its realpath. It's better to not depend on the ordering if
|
||||
# possible.
|
||||
namespace.platform.permitted.paths = /bionic/${LIB}
|
||||
namespace.platform.asan.permitted.paths = /bionic/${LIB}
|
@ -0,0 +1,7 @@
|
||||
service media.swcodec /apex/com.android.media.swcodec/bin/mediaswcodec
|
||||
class main
|
||||
user mediacodec
|
||||
group camera drmrpc mediadrm
|
||||
override
|
||||
ioprio rt 4
|
||||
writepid /dev/cpuset/foreground/tasks
|
@ -0,0 +1,62 @@
|
||||
cc_binary {
|
||||
name: "mediaswcodec",
|
||||
vendor_available: true,
|
||||
|
||||
srcs: [
|
||||
"main_swcodecservice.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libavservices_minijail",
|
||||
"libbase",
|
||||
"libhidltransport",
|
||||
"libhwbinder",
|
||||
"liblog",
|
||||
"libmedia_codecserviceregistrant",
|
||||
],
|
||||
|
||||
target: {
|
||||
vendor: {
|
||||
exclude_shared_libs: ["libavservices_minijail"],
|
||||
shared_libs: ["libavservices_minijail_vendor"],
|
||||
},
|
||||
},
|
||||
|
||||
header_libs: [
|
||||
"libmedia_headers",
|
||||
],
|
||||
|
||||
init_rc: ["mediaswcodec.rc"],
|
||||
|
||||
required: ["mediaswcodec.policy"],
|
||||
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wno-error=deprecated-declarations",
|
||||
],
|
||||
|
||||
sanitize: {
|
||||
scudo: true,
|
||||
},
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "mediaswcodec.policy",
|
||||
sub_dir: "seccomp_policy",
|
||||
arch: {
|
||||
arm: {
|
||||
src: "seccomp_policy/mediaswcodec-arm.policy",
|
||||
},
|
||||
arm64: {
|
||||
src: "seccomp_policy/mediaswcodec-arm64.policy",
|
||||
},
|
||||
x86: {
|
||||
src: "seccomp_policy/mediacodec-x86.policy",
|
||||
},
|
||||
x86_64: {
|
||||
src: "seccomp_policy/mediacodec-x86.policy",
|
||||
},
|
||||
},
|
||||
required: ["crash_dump.policy"],
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "MediaCodecUpdateService"
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
#include <android/dlext.h>
|
||||
#include <dlfcn.h>
|
||||
#include <media/CodecServiceRegistrant.h>
|
||||
#include <nativeloader/dlext_namespaces.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/String8.h>
|
||||
|
||||
#include "MediaCodecUpdateService.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
void loadFromApex(const char *libDirPath) {
|
||||
ALOGV("loadFromApex: path=%s", libDirPath);
|
||||
|
||||
String8 libPath = String8(libDirPath) + "/libmedia_codecserviceregistrant.so";
|
||||
|
||||
android_namespace_t *codecNs = android_create_namespace("codecs",
|
||||
nullptr, // ld_library_path
|
||||
libDirPath,
|
||||
ANDROID_NAMESPACE_TYPE_ISOLATED,
|
||||
nullptr, // permitted_when_isolated_path
|
||||
nullptr); // parent
|
||||
|
||||
if (codecNs == nullptr) {
|
||||
ALOGE("Failed to create codec namespace");
|
||||
return;
|
||||
}
|
||||
|
||||
String8 linked_libraries(LINKED_LIBRARIES);
|
||||
if (!android_link_namespaces(codecNs, nullptr, linked_libraries.c_str())) {
|
||||
ALOGE("Failed to link namespace");
|
||||
return;
|
||||
}
|
||||
|
||||
const android_dlextinfo dlextinfo = {
|
||||
.flags = ANDROID_DLEXT_USE_NAMESPACE,
|
||||
.library_namespace = codecNs,
|
||||
};
|
||||
|
||||
void *registrantLib = android_dlopen_ext(
|
||||
libPath.string(),
|
||||
RTLD_NOW | RTLD_LOCAL, &dlextinfo);
|
||||
|
||||
if (registrantLib == nullptr) {
|
||||
ALOGE("Failed to load lib from archive: %s", dlerror());
|
||||
}
|
||||
|
||||
RegisterCodecServicesFunc registerCodecServices =
|
||||
reinterpret_cast<RegisterCodecServicesFunc>(
|
||||
dlsym(registrantLib, "RegisterCodecServices"));
|
||||
|
||||
if (registerCodecServices == nullptr) {
|
||||
ALOGE("Cannot register codec services -- corrupted library.");
|
||||
return;
|
||||
}
|
||||
|
||||
registerCodecServices();
|
||||
}
|
||||
|
||||
} // namespace android
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_MEDIA_CODEC_UPDATE_SERVICE_H
|
||||
#define ANDROID_MEDIA_CODEC_UPDATE_SERVICE_H
|
||||
|
||||
namespace android {
|
||||
|
||||
void loadFromApex(const char *libDirPath);
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_MEDIA_CODEC_UPDATE_SERVICE_H
|
Loading…
Reference in new issue