Closed rinigus closed 3 years ago
Fix:
add to external/droidmedia/env.mk
MINIMEDIA_AUDIOPOLICYSERVICE_ENABLE:=1
and rebuild droidmedia and images.
As some libs are missing, add after booting
cd /system/lib
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicyservice.so
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicymanager.so
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicymanagerdefault.so
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicyenginedefault.so
now camera doesn't start with Waiting for service 'media.camera' on '/dev/binder'
in syslog
To avoid that, as suggested by mal, we need to fix droidmedia further by pushing AudioPolicyService registration to the end:
diff --git a/Android.mk b/Android.mk
index 32570d6..4a22aaa 100644
--- a/Android.mk
+++ b/Android.mk
@@ -136,7 +136,8 @@ LOCAL_C_INCLUDES += frameworks/av/services/audiopolicy \
frameworks/av/services/audiopolicy/common/managerdefinitions/include \
frameworks/av/services/audiopolicy/engine/interface \
frameworks/av/services/audiopolicy/managerdefault \
- frameworks/av/services/audiopolicy/service
+ frameworks/av/services/audiopolicy/service \
+ frameworks/av/media/utils/include
endif
LOCAL_SHARED_LIBRARIES += libaudiopolicyservice
endif
diff --git a/env.mk b/env.mk
index e69de29..13102ed 100644
--- a/env.mk
+++ b/env.mk
@@ -0,0 +1 @@
+MINIMEDIA_AUDIOPOLICYSERVICE_ENABLE:=1
diff --git a/minimedia.cpp b/minimedia.cpp
index bd3da6b..472dcdd 100644
--- a/minimedia.cpp
+++ b/minimedia.cpp
@@ -64,9 +64,9 @@ main(int, char**)
FakeActivityManager::instantiate();
#endif
MediaPlayerService::instantiate();
-#ifdef AUDIOPOLICYSERVICE_ENABLE
- AudioPolicyService::instantiate();
-#endif
// PermissionController and AppOps are needed on Android 4, but aren't allowed to be run here.
#if ANDROID_MAJOR >= 5
@@ -115,6 +115,10 @@ main(int, char**)
#endif
#endif
+#ifdef AUDIOPOLICYSERVICE_ENABLE
+ AudioPolicyService::instantiate();
+#endif
+
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
On AOSP10, we have running:
Comparing logcat with droidmedia separately built and without audiopolicyservice
02-26 18:26:37.341 3444 6065 E /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64: open() failed for /dev/cgroup_info/cgroup.rc: No such file or directory
but otherwise all is similar. Audiopolicy files are in lib64, opposed to the ones searched in lib by audiopolicymanager from droidmedia:
apollo:/ $ ls -l /system/lib64/libaudiopolicy*
-rw-r--r-- 1 root root 24128 2021-02-08 11:48 /system/lib64/libaudiopolicy.so
-rw-r--r-- 1 root root 460216 2021-02-08 11:49 /system/lib64/libaudiopolicyenginedefault.so
-rw-r--r-- 1 root root 19128 2021-02-08 11:49 /system/lib64/libaudiopolicymanager.so
-rw-r--r-- 1 root root 835920 2021-02-08 11:49 /system/lib64/libaudiopolicymanagerdefault.so
-rw-r--r-- 1 root root 242064 2021-02-08 11:49 /system/lib64/libaudiopolicyservice.so
On SFOS, we have
Media services running on AOSP10:
61 audio: [android.media.IAudioService]
119 media.aaudio: [IAAudioService]
163 media.audio_flinger: [android.media.IAudioFlinger]
120 media.audio_policy: [android.media.IAudioPolicyService]
28 media.camera.proxy: [android.hardware.ICameraServiceProxy]
0 media.camera: [android.hardware.ICameraService]
158 media.drm: [android.media.IMediaDrmService]
155 media.extractor: [android.media.IMediaExtractorService]
153 media.metrics: [android.media.IMediaAnalyticsService]
148 media.player: [android.media.IMediaPlayerService]
147 media.resource_manager: [android.media.IResourceManagerService]
118 media.sound_trigger_hw: [android.hardware.ISoundTriggerHwService]
30 media_projection: [android.media.projection.IMediaProjectionManager]
37 media_resource_monitor: [android.media.IMediaResourceMonitor]
36 media_router: [android.media.IMediaRouterService]
38 media_session: [android.media.session.ISessionManager]
59 midi: [android.media.midi.IMidiManager]
When using separate miniaudiopolicyserver, some extra symlinks are needed in /system/lib64:
/apex/com.android.runtime/lib64/libicui18n.so
/apex/com.android.runtime/lib64/libicuuc.so
miniaudiopolicyserver:
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <AudioPolicyService.h>
#undef LOG_TAG
#define LOG_TAG "MinimediaServiceAPolicy"
using namespace android;
int
main(int, char**)
{
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm = defaultServiceManager();
AudioPolicyService::instantiate();
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
return 0;
}
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
miniaudiopolicy.cpp \
LOCAL_SHARED_LIBRARIES := \
libaaudioservice \
libaudioflinger \
libaudiopolicyservice \
libbinder \
libcutils \
liblog \
libhidlbase \
libhidltransport \
libhwbinder \
libmedia \
libmedialogservice \
libmediautils \
libnbaio \
libnblog \
libsoundtriggerservice \
libutils \
libvibrator
# TODO oboeservice is the old folder name for aaudioservice. It will be changed.
LOCAL_C_INCLUDES := \
frameworks/av/services/audioflinger \
frameworks/av/services/audiopolicy \
frameworks/av/services/audiopolicy/common/managerdefinitions/include \
frameworks/av/services/audiopolicy/common/include \
frameworks/av/services/audiopolicy/engine/interface \
frameworks/av/services/audiopolicy/service \
frameworks/av/services/medialog \
frameworks/av/services/oboeservice \
frameworks/av/services/radio \
frameworks/av/services/soundtrigger \
frameworks/av/media/libaaudio/include \
frameworks/av/media/libaaudio/src \
frameworks/av/media/libaaudio/src/binding \
frameworks/av/media/libmedia \
$(call include-path-for, audio-utils) \
external/sonic \
# If AUDIOSERVER_MULTILIB in device.mk is non-empty then it is used to control
# the LOCAL_MULTILIB for all audioserver exclusive libraries.
# This is relevant for 64 bit architectures where either or both
# 32 and 64 bit libraries may be built.
#
# AUDIOSERVER_MULTILIB may be set as follows:
# 32 to build 32 bit audioserver libraries and 32 bit audioserver.
# 64 to build 64 bit audioserver libraries and 64 bit audioserver.
# both to build both 32 bit and 64 bit libraries,
# and use primary target architecture (32 or 64) for audioserver.
# first to build libraries and audioserver for the primary target architecture only.
# <empty> to build both 32 and 64 bit libraries and primary target audioserver.
LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
LOCAL_MODULE := miniaudiopolicyserver
Resolved by:
This allows to use 64-bit audio policy and no extra libs are needed from /usr/libexec/droid-hybris. In addition, it has a side effect of triggering shutter sound as expected. As a result, #120 is not applicable to hybris-10 port.
After shooting a video, switch over to photo mode and camera app will freeze. In logcat
in journal