Could not load /vendor/lib/hw/android.hardware.drm@1.0-impl.so from sphal namespace: dlopen failed: library "android.hardware.drm@1.0.so" not found

Downloaded source code : Using Reference Boards  |  Android Open Source Project
Device: HiKey 960 board.

Trying to play a drm protected content and getting the following error.

07-02 09:39:26.985 2405 3762 E vndksupport: Could not load /vendor/lib/hw/android.hardware.drm@1.0-impl.so from sphal namespace: dlopen failed: library “android.hardware.drm@1.0.so” not found.
07-02 09:39:26.985 2405 3762 E ServiceManagement: Failed to dlopen android.hardware.drm@1.0-impl.so: unknown error
07-02 09:39:26.985 2405 3762 E DrmHal : Failed to find any drm factories

Any help??

Thanks in advance.

I think this is expected behaviour. AFAIK AOSP does not include any DRM decoders…

It seems to be a bug. Reproduce like this:

ADB shell: # setenforce 0

exec in java: “drm = new MediaDrm(UUID);”

01-10 16:19:42.211 2217 2230 E vndksupport: Could not load /vendor/lib/hw/android.hardware.drm@1.0-impl.so from sphal namespace: dlopen failed: library “android.hardware.drm@1.0.so” not found.
01-10 16:19:42.211 2217 2230 E ServiceManagement: Failed to dlopen android.hardware.drm@1.0-impl.so: unknown error
01-10 16:19:42.212 2217 2230 E DrmHal : Failed to find any drm factories
01-10 16:19:42.212 3617 3617 I DrmEngineTest: Failed to create MediaDrm

…now “workaround” to fix the issue

ADB shell: # mount -o remount,rw /vendor
ADB shell: # cp -r /system/lib/* /vendor/lib/

exec in java: “drm = new MediaDrm(UUID);”

01-11 15:33:55.299 2218 2218 I Binder:2218_1: type=1400 audit(0.0:97): avc: denied { read } for name=“android.hardware.drm@1.0-impl.so” dev=“sdd11” ino=407 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=1
01-11 15:33:55.299 2218 2218 I Binder:2218_1: type=1400 audit(0.0:98): avc: denied { open } for path="/vendor/lib/hw/android.hardware.drm@1.0-impl.so" dev=“sdd11” ino=407 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=1
01-11 15:33:55.299 2218 2218 I Binder:2218_1: type=1400 audit(0.0:99): avc: denied { getattr } for path="/vendor/lib/hw/android.hardware.drm@1.0-impl.so" dev=“sdd11” ino=407 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=1
01-11 15:33:55.303 2218 2218 I Binder:2218_1: type=1400 audit(0.0:100): avc: denied { execute } for path="/vendor/lib/android.hardware.drm@1.0.so" dev=“sdd11” ino=467 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=1
01-11 15:33:55.327 2218 2218 I Binder:2218_1: type=1400 audit(0.0:101): avc: denied { read } for name=“mediadrm” dev=“sdd11” ino=377 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=dir permissive=1
01-11 15:33:55.327 2218 2218 I Binder:2218_1: type=1400 audit(0.0:102): avc: denied { open } for path="/vendor/lib/mediadrm" dev=“sdd11” ino=377 scontext=u:r:mediadrmserver:s0 tcontext=u:object_r:vendor_file:s0 tclass=dir permissive=1
01-11 15:33:55.334 2218 2233 I DrmHal : makeDrmFactories: using default passthrough drm instance

Output is different.
I am new to this, but it looks like it has to do with vndk and namespaces in AOSP.

which android version did you have this problem with? aosp master or Pie code base?

AOSP master. Pulled a few days ago.

there was a change on drm hal just merged yesterday,
https://android-review.googlesource.com/c/device/linaro/hikey/+/860444

could you please repo sync your aosp and try again to see if the problem is still there?

Thanks for a quick response. I will try on Monday.

Thanks, and please let me know if it fixes the problem or if there is still any problem

It works! Problem solved.

@chain256, thanks for the information, that’s great.

I am facing the same problem while running android TV app and its showing me error

E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed