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.