google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE #11202

Closed infernowadays closed 8 months ago

infernowadays commented 1 year ago

Bug

Hi!

DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE occurs when trying to play downloaded content offline using the ExoPlayer library version 2.18.2.

Log attached. If you need to provide additional information about the implementation or other logs, I will be happy to help resolve the issue.

The problem is compounded by the fact that the bug only reproduces on Samsung S23 / S23 Ultra devices, but does not reproduce on other real devices and on emulators.

Ideas, hypotheses, assumptions?

Thanks in advance for your reply.

Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE
============================== Beginning of DRM Plugin Log ==============================
  06-05 17:35:02.306 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:35:02.308 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:35:02.311 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid17
  06-05 17:35:02.311 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid17
  06-05 17:35:02.312 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid17, playback_id = eHNgqF5yFHXTlMPq
  06-05 17:35:02.315 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid17, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:02.345 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.345 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid17
  06-05 17:35:02.388 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.792 I [cdm_engine.cpp(353):AddKey] session_id = sid17, key_set_id = <empty>
  06-05 17:35:13.375 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid18
  06-05 17:35:13.375 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid18
  06-05 17:35:13.376 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid18, key_set_id = <empty>, license_type = Offline
  06-05 17:35:13.481 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid19
  06-05 17:35:13.481 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid19
  06-05 17:35:13.482 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid19, playback_id = OqJpprUlvFI7YWWb
  06-05 17:35:13.483 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid19, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:13.509 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.509 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid19
  06-05 17:35:13.553 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.586 I [cdm_engine.cpp(353):AddKey] session_id = sid18, key_set_id = <empty>
  06-05 17:35:13.625 I [cdm_engine.cpp(421):AddKey] key_set_id = ksidB78129D7
  06-05 17:35:13.626 I [cdm_engine.cpp(232):CloseSession] session_id = sid18
  06-05 17:35:13.876 I [cdm_engine.cpp(232):CloseSession] session_id = sid17
  06-05 17:35:14.337 I [cdm_engine.cpp(353):AddKey] session_id = sid19, key_set_id = <empty>
  06-05 17:35:39.761 I [cdm_engine.cpp(232):CloseSession] session_id = sid19
  06-05 17:35:39.764 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 17:35:39.764 I [(0):] L3 Terminate.
  06-05 17:36:01.524 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 17:36:01.525 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 17:36:01.527 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 17:36:01.608 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 17:36:01.609 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:36:01.612 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid20
  06-05 17:36:01.612 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid20
  06-05 17:36:01.613 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid20, playback_id = v8AcsXDUlZXd54CD
  06-05 17:36:01.614 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid20, key_set_id = <empty>, license_type = Streaming
  06-05 17:36:01.640 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.641 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid20
  06-05 17:36:01.679 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.947 I [cdm_engine.cpp(353):AddKey] session_id = sid20, key_set_id = <empty>
  06-05 17:38:14.449 I [cdm_engine.cpp(232):CloseSession] session_id = sid20
  06-05 17:48:28.436 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:48:28.480 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid21
  06-05 17:48:28.480 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid21
  06-05 17:48:28.481 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid21, playback_id = 5x6cqvJgBZQvfF-O
  06-05 17:48:28.482 I [cdm_engine.cpp(445):RestoreKey] session_id = sid21, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 17:48:28.482 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid21, status = 347
  06-05 17:48:28.482 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 17:48:28.490 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid21
  06-05 17:48:28.490 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:48:28.571 I [cdm_engine.cpp(232):CloseSession] session_id = sid21
  06-05 17:48:38.938 I [(0):] L3 Terminate.
  06-05 17:48:38.938 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 19:03:35.378 I No hidl drm factories found
  06-05 19:03:35.379 E Failed to find passthrough drm factories
  06-05 19:03:36.734 I No hidl drm factories found
  06-05 19:03:36.734 E Failed to find passthrough drm factories
  06-05 19:03:36.748 I No hidl drm factories found
  06-05 19:03:36.749 E Failed to find passthrough drm factories
  06-05 19:03:36.771 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 19:03:36.771 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 19:03:36.779 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 19:03:36.844 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 19:03:36.845 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 19:03:36.875 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid22
  06-05 19:03:36.875 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid22
  06-05 19:03:36.877 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:03:36.877 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid22, status = 347
  06-05 19:03:36.877 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:03:36.877 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:03:36.877 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid22, playback_id = HhuYp6Sb4AbuAM3t
  06-05 19:03:36.877 I [cdm_engine.cpp(445):RestoreKey] session_id = sid22, key_set_id = ksidB78129D7
  06-05 19:03:36.881 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 19:03:36.881 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid22
  06-05 19:03:36.952 I [cdm_engine.cpp(232):CloseSession] session_id = sid22
  06-05 19:04:03.055 I No hidl drm factories found
  06-05 19:04:03.056 E Failed to find passthrough drm factories
  06-05 19:04:03.062 E Failed to find passthrough drm factories
  06-05 19:04:03.062 I No hidl drm factories found
  06-05 19:04:03.073 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid23
  06-05 19:04:03.073 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid23
  06-05 19:04:03.074 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid23, playback_id = jBUp0cQ25vTbpd3T
  06-05 19:04:03.074 I [cdm_engine.cpp(445):RestoreKey] session_id = sid23, key_set_id = ksidB78129D7
  06-05 19:04:03.074 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:04:03.074 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:04:03.074 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:04:03.074 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid23, status = 347
============================== End of DRM Plugin Log ==============================
    at com.google.android.exoplayer2.drm.DefaultDrmSession.onError(DefaultDrmSession.java:94)
    at com.google.android.exoplayer2.drm.DefaultDrmSession.doLicense(DefaultDrmSession.java:87)
    at com.google.android.exoplayer2.drm.DefaultDrmSession.acquire(DefaultDrmSession.java:148)
    at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.createAndAcquireSession(DefaultDrmSessionManager.java:54)
    at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.createAndAcquireSessionWithRetry(DefaultDrmSessionManager.java:1)
    at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.acquireSession(DefaultDrmSessionManager.java:35)
    at com.google.android.exoplayer2.drm.DefaultDrmSessionManager$PreacquiredSessionReference$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:24)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE
============================== Beginning of DRM Plugin Log ==============================
  06-05 17:35:02.306 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:35:02.308 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:35:02.311 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid17
  06-05 17:35:02.311 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid17
  06-05 17:35:02.312 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid17, playback_id = eHNgqF5yFHXTlMPq
  06-05 17:35:02.315 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid17, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:02.345 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.345 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid17
  06-05 17:35:02.388 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.792 I [cdm_engine.cpp(353):AddKey] session_id = sid17, key_set_id = <empty>
  06-05 17:35:13.375 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid18
  06-05 17:35:13.375 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid18
  06-05 17:35:13.376 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid18, key_set_id = <empty>, license_type = Offline
  06-05 17:35:13.481 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid19
  06-05 17:35:13.481 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid19
  06-05 17:35:13.482 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid19, playback_id = OqJpprUlvFI7YWWb
  06-05 17:35:13.483 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid19, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:13.509 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.509 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid19
  06-05 17:35:13.553 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.586 I [cdm_engine.cpp(353):AddKey] session_id = sid18, key_set_id = <empty>
  06-05 17:35:13.625 I [cdm_engine.cpp(421):AddKey] key_set_id = ksidB78129D7
  06-05 17:35:13.626 I [cdm_engine.cpp(232):CloseSession] session_id = sid18
  06-05 17:35:13.876 I [cdm_engine.cpp(232):CloseSession] session_id = sid17
  06-05 17:35:14.337 I [cdm_engine.cpp(353):AddKey] session_id = sid19, key_set_id = <empty>
  06-05 17:35:39.761 I [cdm_engine.cpp(232):CloseSession] session_id = sid19
  06-05 17:35:39.764 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 17:35:39.764 I [(0):] L3 Terminate.
  06-05 17:36:01.524 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 17:36:01.525 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 17:36:01.527 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 17:36:01.608 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 17:36:01.609 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:36:01.612 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid20
  06-05 17:36:01.612 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid20
  06-05 17:36:01.613 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid20, playback_id = v8AcsXDUlZXd54CD
  06-05 17:36:01.614 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid20, key_set_id = <empty>, license_type = Streaming
  06-05 17:36:01.640 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.641 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid20
  06-05 17:36:01.679 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.947 I [cdm_engine.cpp(353):AddKey] session_id = sid20, key_set_id = <empty>
  06-05 17:38:14.449 I [cdm_engine.cpp(232):CloseSession] session_id = sid20
  06-05 17:48:28.436 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:48:28.480 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid21
  06-05 17:48:28.480 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid21
  06-05 17:48:28.481 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid21, playback_id = 5x6cqvJgBZQvfF-O
  06-05 17:48:28.482 I [cdm_engine.cpp(445):RestoreKey] session_id = sid21, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 17:48:28.482 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid21, status = 347
  06-05 17:48:28.482 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 17:48:28.490 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid21
  06-05 17:48:28.490 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:48:28.571 I [cdm_engine.cpp(232):CloseSession] session_id = sid21
  06-05 17:48:38.938 I [(0):] L3 Terminate.
  06-05 17:48:38.938 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 19:03:35.378 I No hidl drm factories found
  06-05 19:03:35.379 E Failed to find passthrough drm factories
  06-05 19:03:36.734 I No hidl drm factories found
  06-05 19:03:36.734 E Failed to find passthrough drm factories
  06-05 19:03:36.748 I No hidl drm factories found
  06-05 19:03:36.749 E Failed to find passthrough drm factories
  06-05 19:03:36.771 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 19:03:36.771 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 19:03:36.779 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 19:03:36.844 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 19:03:36.845 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 19:03:36.875 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid22
  06-05 19:03:36.875 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid22
  06-05 19:03:36.877 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:03:36.877 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid22, status = 347
  06-05 19:03:36.877 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:03:36.877 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:03:36.877 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid22, playback_id = HhuYp6Sb4AbuAM3t
  06-05 19:03:36.877 I [cdm_engine.cpp(445):RestoreKey] session_id = sid22, key_set_id = ksidB78129D7
  06-05 19:03:36.881 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 19:03:36.881 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid22
  06-05 19:03:36.952 I [cdm_engine.cpp(232):CloseSession] session_id = sid22
  06-05 19:04:03.055 I No hidl drm factories found
  06-05 19:04:03.056 E Failed to find passthrough drm factories
  06-05 19:04:03.062 E Failed to find passthrough drm factories
  06-05 19:04:03.062 I No hidl drm factories found
  06-05 19:04:03.073 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid23
  06-05 19:04:03.073 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid23
  06-05 19:04:03.074 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid23, playback_id = jBUp0cQ25vTbpd3T
  06-05 19:04:03.074 I [cdm_engine.cpp(445):RestoreKey] session_id = sid23, key_set_id = ksidB78129D7
  06-05 19:04:03.074 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:04:03.074 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:04:03.074 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:04:03.074 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid23, status = 347
============================== End of DRM Plugin Log ==============================
icbaker commented 1 year ago

Please capture an adb bugreport immediately after reproducing the problem and send it to dev.exoplayer@gmail.com with the subject Issue #11202. Please also update this issue to indicate you’ve done this.

infernowadays commented 1 year ago

done

rrfrias commented 1 year ago

Thanks for this information. How often is this reproducible on Samsung S23 / S23 Ultra devices (10 of of 10 attempts)? We will follow up with Samsung. Might it be possible to give us the Android Build number and an app that reproduces the problem?

infernowadays commented 1 year ago

Hi, thanks for your answer! Yes, the bug reproduces 10 out of 10 times on Samsung S23 / S23 Ultra.

Android version 13.

Unfortunately, there is no way to provide a build due to the inability to run the app in a non-local market.

Do you have any related references or threads that could help resolve the issue for us now?

Looking forward to your reply, thanks!

dabbister commented 1 year ago

I can reiterate that this also happens in ExoPlayer 2.16.1 on Samsung S23/ S23 Ultra devices in an app that my team is managing. Any leads?

infernowadays commented 1 year ago

Hi! Any new information?

Could you confirm that this is a bug on the Samsung side?

rrfrias commented 1 year ago

Are you able to reproduce this locally? I can see that the license does not exist when trying to playback downloaded offline content. I cannot tell whether the license was downloaded correctly. It is possible to included a log that captures the download then offline playback failure? You can send the log to android-media-github@google.com . It is not clear why this would happen on Samsung S23 / S23 Ultra devices but not other devices.

infernowadays commented 1 year ago

Hi, I've just sent 2 full logs to your email.

Unfortunately, the device is with my colleague in another city and I have to work with this bug remotely with only logs. But I can note that the reproducibility is 100%. If you have the opportunity to test the bug on Samsung S23 / S23 Ultra, it would be very valuable for our team as it affects a large number of users.

radusalagean commented 1 year ago

Hi, I'm experiencing the same issue, here is a list of devices I see this most frequently on based on error reporting:

Frequency by OS version:

I'll get a used Galaxy A53 5G and attempt to reproduce the issue. If I'm successful, I'll capture an adb bugreport and send it over for investigation.

rrfrias commented 1 year ago

@infernowadays. Thanks for the logs. It looks like the license does not exist at the default (L1) security level. Since it is difficult for you to provide repro steps/build, can you capture a logcat of when the download happened and another one when the problem occurred. Offline licenses are stored by security level, so if the license was downloaded at one level and restored at another, it is expected that it will fail.

@dabbister, @radusalagean if you are able to reproduce and willing to share an app/repro steps can you share that information with android-media-github@google.com. Mention Issue 11202 in the subject line.

radusalagean commented 1 year ago

@rrfrias I sent the output zip of the adb bugreport and a video showing the app, so you can see the timestamps where I start the download of the audiobook and where I try to play chapters that have been downloaded - hope this can aid you in finding the proper logs. I will try to reproduce it on the ExoPlayer sample app as well and get back with my results, but so far this is all the info I have.

Based on multiple tests I've done, I did not find a solid reproduction pattern yet, although I did notice that the issue has a tendency to appear whenever I download audiobooks with many chapters. Each chapter is an individual exo downlaod, and this particular audiobook in the video I sent you has 175 chapters.

ExoPlayer version: 2.18.7

Also, I can confirm that the app forces into L3 level for the DRM through setPropertyString("securityLevel", "L3") on the MediaDrm instance because:

  1. The content policy doesn't require L1 level
  2. To increase compatibility - Some devices have issues when they default to L1 (full reason here)

I wanted to specify this because I don't think the download happens in one level and tries to get played in another - at least in my case.

radusalagean commented 1 year ago

@rrfrias I sent a new batch of resources and observations via email.

In the Google Drive link from the email you'll find:

The exact logs that leave a clue to what's happening - found in the bugreport log file:

08-21 22:56:04.189 media   385   385 D WVCdm   : [crypto_session.cpp(860):Open] Opening crypto session: requested_security_level = Default
08-21 22:56:04.189 media   385   385 D WVCdm   : [usage_table_header.cpp(162):Init] security_level = L3
08-21 22:56:04.189 media   385   385 D WVCdm   : [usage_table_header.cpp(504):DetermineTableCapacity] capacity = unlimited, security_level = L3
08-21 22:56:04.189 media   385   385 I WVCdm   : [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 201
08-21 22:56:04.191 media   385   385 D WVCdm   : [crypto_session.cpp(860):Open] Opening crypto session: requested_security_level = L3
08-21 22:56:04.191 media   385   385 D WVCdm   : [usage_table_header.cpp(258):AddEntry] key_set_id = DummyKsid, type = OfflineLicense, current_size = 201
08-21 22:56:04.191 media   385   385 I WVCdm   : [usage_table_header.cpp(533):CreateEntry] usage_entry_number = 201
08-21 22:56:04.195 media   385   385 D WVCdm   : [usage_table_header.cpp(358):InvalidateEntry] usage_entry_number = 201
08-21 22:56:04.195 media   385   385 D WVCdm   : [usage_table_header.cpp(990):DefragTable] Removing all entries after the last valid entry: count = 1
08-21 22:56:04.195 media   385   385 D WVCdm   : [usage_table_header.cpp(876):Shrink] table_size = 202, number_to_delete = 1
08-21 22:56:04.195 media   385   385 D WVCdm   : [usage_table_header.cpp(393):InvalidateEntryInternal] Table was not stored during defrag, storing now
08-21 22:56:04.197 media   385   385 E WVCdm   : [usage_table_header.cpp(488):CapacityCheck] Failed to shrink table for capacity test
08-21 22:56:04.197 media   385   385 E WVCdm   : [usage_table_header.cpp(221):RestoreTable] Cannot restore table due to failing capacity check
08-21 22:56:04.197 media   385   385 D WVCdm   : [usage_table_header.cpp(229):CreateNewTable] Removing all usage table files

It's easier to see what's happening in real time if you gain root access to the emulator and then navigate to the directory where licenses are saved:

adb root
adb shell
cd /data/vendor/mediadrm/IDM1013/L3

You can use this command to query how many licenses are saved (assuming you are in the L3 directory):

ls -1 ksid* | wc -l

If you want to check the I/O activity in real time, use this command - this monitors operations on files that contain "ksid" in the name:

inotifyd - . | grep ksid

If you want to save the output and analyze it later, use this:

inotifyd - . | grep ksid > /sdcard/inotifyd_1.txt 2>&1

Then press the download button, wait for it to finish and then exit the process. Get the inotifyd_1.txt and check when files are deleted (unexpectedly). Here is the table from the help menu that maps letters to I/O operations:

Screenshot 2023-08-19 at 09 43 57

In video 1 at 2:27, exactly when the logs in the phone show Chapter 201, watch the top terminal from the background, it is filled with d (Delete) operations for all licenses.

Reproduced with Android Emulator (Pixel XL arm64-v8a API 33 on Mac M1 Pro host) - full build numbers shown in the videos.

According to error reports from users, the Failed to restore keys: BAD_VALUE error happens only on Android 12 and up, so this is congruent with the test results from above:

Screenshot 2023-08-21 at 21 39 28

Do you know why this is happening?

rrfrias commented 1 year ago

Thanks. This is really useful information. We will investigate and get back. Opened Internal tracker 297092425

rrfrias commented 1 year ago

We have identified the issue and are working on making the patch available to OEM partners. They will need to pick up the patch and include it in an upcoming update. We also let Samsung know about this and see if we can update this tracker with information about availability of an update.

radusalagean commented 1 year ago

Thanks for helping us on this @rrfrias Are you aware of any possible workaround that we could include in our apps, until users get an OS update with the proper fix from OEMs?

rrfrias commented 1 year ago

The failure occurs on startup if the user has 200+ offline licenses. You can use [MediaDrm#getOfflineLicenseKeySetIds()](https://developer.android.com/reference/android/media/MediaDrm#getOfflineLicenseKeySetIds()) to query and see how many exist on startup. Might it be possible until the fix is rolled out to keep this under 200?

Opened internal tracker 299296215 to follow up with Samsung.

radusalagean commented 1 year ago

I'll have a chat with the backend team to see if there is a way to share the same license for multiple (related) files, thus reducing the number of licenses that need to be stored.

Later edit: Unfortunately, this is not an option.

bin101 commented 1 year ago

@radusalagean @rrfrias Did you find a workaround beside lowering the amount of licenses?

radusalagean commented 1 year ago

@bin101 I didn't find a workaround. I was curious if the Netflix app is impacted by this, and it is. First I downloaded around ~28 episodes in Netflix, then I downloaded over 200 L3 Widevine licenses in another app. By the time that was done, the Netflix licenses were gone. I went back in offline mode in the Netflix app and got the 2.119 error when trying to play them. As soon as I go online again, the app fetches the missing licenses automatically and the videos are playable again. I saw this behavior by monitoring the write and delete operations in the /data/vendor/mediadrm/IDM1013/L3 directory.

https://github.com/google/ExoPlayer/assets/11408459/0f05fb37-3402-4b20-93fe-1a0c7ca96196

@rrfrias I tried to access the 299296215 and 297092425 on the issue tracker but they are not accessible to the public, so I am a bit out of the loop. Do you know if Samsung made any progress on adopting this fix in their OS updates. Unfortunately, the number of error reports from our users has not decreased.

rrfrias commented 1 year ago

There are two issues here. The first is the bug that occurs after around 200 titles are downloaded that we have mostly discussed in this tracker. We are working with Samsung and other OEMs to correct. No additional updates as of right now.

I didn't find a workaround. I was curious if the Netflix app is impacted by this, and it is. First I downloaded around

Devices do have limitations as resources are limited within the Trusted Execution Environment to securely handle offline licenses. We require that devices handle a minimum of 300 offline licenses. Different devices have different capabilities so if apps exceed this limit, an LRU algorithm will remove older licenses to make place for new ones. So even if this issue is addressed you still see the same problem described above, just at higher limits and dependent on the device.

rrfrias commented 1 year ago

Do you know if Samsung made any progress on adopting this fix in their OS updates.

I forgot to answer this part of the question. Samsung is working on integrating fixes. It might be in android 14 updates for some of these devices. We will check with them after they have completed integration, for dates for when users should expect to see updates.

rrfrias commented 11 months ago

I forgot to mention that the maximum number of offline licenses supported by the device can be queried. You will need to contact widevine support or your Widevine Partner Engineering contact for details. If you use the level 3 security, there is no limit to the number of offline licenses (other than storage space). It is good practice to release them after use.

rrfrias commented 9 months ago

Samsung confirmed that the fixes have been merged to their internal branches but we do not have dates for when devices will be updated. Waiting on more information.

rrfrias commented 9 months ago

Samsung has confirmed that these devices mentioned in this comment will be updated with the next release

radusalagean commented 9 months ago

That's great news! I informed the customer support team and the general advice for users who experience this issue will be to keep the system software up to date on their devices.

rrfrias commented 8 months ago

Samsung has informed us that the software update containing the fix mentioned in this comment for these devices should be available now

The Galaxy S23 Ultra (SM-S918B) will receive an update at the end of March. We will mark this as closed. Feel free to create a new ticket if your users still experience problems.

bartmejia18 commented 8 months ago

Hi, I am also experiencing this error on a Google Pixel device, Android 14

Bug

Hi!

DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE occurs when trying to play downloaded content offline using the ExoPlayer library version 2.18.2.

Log attached. If you need to provide additional information about the implementation or other logs, I will be happy to help resolve the issue.

The problem is compounded by the fact that the bug only reproduces on Samsung S23 / S23 Ultra devices, but does not reproduce on other real devices and on emulators.

Ideas, hypotheses, assumptions?

Thanks in advance for your reply.

Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE
============================== Beginning of DRM Plugin Log ==============================
  06-05 17:35:02.306 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:35:02.308 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:35:02.311 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid17
  06-05 17:35:02.311 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid17
  06-05 17:35:02.312 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid17, playback_id = eHNgqF5yFHXTlMPq
  06-05 17:35:02.315 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid17, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:02.345 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.345 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid17
  06-05 17:35:02.388 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.792 I [cdm_engine.cpp(353):AddKey] session_id = sid17, key_set_id = <empty>
  06-05 17:35:13.375 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid18
  06-05 17:35:13.375 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid18
  06-05 17:35:13.376 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid18, key_set_id = <empty>, license_type = Offline
  06-05 17:35:13.481 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid19
  06-05 17:35:13.481 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid19
  06-05 17:35:13.482 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid19, playback_id = OqJpprUlvFI7YWWb
  06-05 17:35:13.483 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid19, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:13.509 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.509 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid19
  06-05 17:35:13.553 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.586 I [cdm_engine.cpp(353):AddKey] session_id = sid18, key_set_id = <empty>
  06-05 17:35:13.625 I [cdm_engine.cpp(421):AddKey] key_set_id = ksidB78129D7
  06-05 17:35:13.626 I [cdm_engine.cpp(232):CloseSession] session_id = sid18
  06-05 17:35:13.876 I [cdm_engine.cpp(232):CloseSession] session_id = sid17
  06-05 17:35:14.337 I [cdm_engine.cpp(353):AddKey] session_id = sid19, key_set_id = <empty>
  06-05 17:35:39.761 I [cdm_engine.cpp(232):CloseSession] session_id = sid19
  06-05 17:35:39.764 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 17:35:39.764 I [(0):] L3 Terminate.
  06-05 17:36:01.524 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 17:36:01.525 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 17:36:01.527 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 17:36:01.608 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 17:36:01.609 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:36:01.612 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid20
  06-05 17:36:01.612 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid20
  06-05 17:36:01.613 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid20, playback_id = v8AcsXDUlZXd54CD
  06-05 17:36:01.614 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid20, key_set_id = <empty>, license_type = Streaming
  06-05 17:36:01.640 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.641 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid20
  06-05 17:36:01.679 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.947 I [cdm_engine.cpp(353):AddKey] session_id = sid20, key_set_id = <empty>
  06-05 17:38:14.449 I [cdm_engine.cpp(232):CloseSession] session_id = sid20
  06-05 17:48:28.436 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:48:28.480 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid21
  06-05 17:48:28.480 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid21
  06-05 17:48:28.481 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid21, playback_id = 5x6cqvJgBZQvfF-O
  06-05 17:48:28.482 I [cdm_engine.cpp(445):RestoreKey] session_id = sid21, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 17:48:28.482 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid21, status = 347
  06-05 17:48:28.482 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 17:48:28.490 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid21
  06-05 17:48:28.490 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:48:28.571 I [cdm_engine.cpp(232):CloseSession] session_id = sid21
  06-05 17:48:38.938 I [(0):] L3 Terminate.
  06-05 17:48:38.938 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 19:03:35.378 I No hidl drm factories found
  06-05 19:03:35.379 E Failed to find passthrough drm factories
  06-05 19:03:36.734 I No hidl drm factories found
  06-05 19:03:36.734 E Failed to find passthrough drm factories
  06-05 19:03:36.748 I No hidl drm factories found
  06-05 19:03:36.749 E Failed to find passthrough drm factories
  06-05 19:03:36.771 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 19:03:36.771 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 19:03:36.779 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 19:03:36.844 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 19:03:36.845 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 19:03:36.875 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid22
  06-05 19:03:36.875 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid22
  06-05 19:03:36.877 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:03:36.877 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid22, status = 347
  06-05 19:03:36.877 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:03:36.877 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:03:36.877 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid22, playback_id = HhuYp6Sb4AbuAM3t
  06-05 19:03:36.877 I [cdm_engine.cpp(445):RestoreKey] session_id = sid22, key_set_id = ksidB78129D7
  06-05 19:03:36.881 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 19:03:36.881 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid22
  06-05 19:03:36.952 I [cdm_engine.cpp(232):CloseSession] session_id = sid22
  06-05 19:04:03.055 I No hidl drm factories found
  06-05 19:04:03.056 E Failed to find passthrough drm factories
  06-05 19:04:03.062 E Failed to find passthrough drm factories
  06-05 19:04:03.062 I No hidl drm factories found
  06-05 19:04:03.073 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid23
  06-05 19:04:03.073 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid23
  06-05 19:04:03.074 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid23, playback_id = jBUp0cQ25vTbpd3T
  06-05 19:04:03.074 I [cdm_engine.cpp(445):RestoreKey] session_id = sid23, key_set_id = ksidB78129D7
  06-05 19:04:03.074 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:04:03.074 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:04:03.074 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:04:03.074 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid23, status = 347
============================== End of DRM Plugin Log ==============================
  at com.google.android.exoplayer2.drm.DefaultDrmSession.onError(DefaultDrmSession.java:94)
  at com.google.android.exoplayer2.drm.DefaultDrmSession.doLicense(DefaultDrmSession.java:87)
  at com.google.android.exoplayer2.drm.DefaultDrmSession.acquire(DefaultDrmSession.java:148)
  at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.createAndAcquireSession(DefaultDrmSessionManager.java:54)
  at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.createAndAcquireSessionWithRetry(DefaultDrmSessionManager.java:1)
  at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.acquireSession(DefaultDrmSessionManager.java:35)
  at com.google.android.exoplayer2.drm.DefaultDrmSessionManager$PreacquiredSessionReference$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:24)
  at android.os.Handler.handleCallback(Handler.java:942)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:226)
  at android.os.Looper.loop(Looper.java:313)
  at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE
============================== Beginning of DRM Plugin Log ==============================
  06-05 17:35:02.306 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:35:02.308 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:35:02.311 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid17
  06-05 17:35:02.311 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid17
  06-05 17:35:02.312 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid17, playback_id = eHNgqF5yFHXTlMPq
  06-05 17:35:02.315 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid17, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:02.345 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.345 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid17
  06-05 17:35:02.388 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:02.792 I [cdm_engine.cpp(353):AddKey] session_id = sid17, key_set_id = <empty>
  06-05 17:35:13.375 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid18
  06-05 17:35:13.375 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid18
  06-05 17:35:13.376 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid18, key_set_id = <empty>, license_type = Offline
  06-05 17:35:13.481 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid19
  06-05 17:35:13.481 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid19
  06-05 17:35:13.482 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid19, playback_id = OqJpprUlvFI7YWWb
  06-05 17:35:13.483 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid19, key_set_id = <empty>, license_type = Streaming
  06-05 17:35:13.509 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.509 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid19
  06-05 17:35:13.553 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:35:13.586 I [cdm_engine.cpp(353):AddKey] session_id = sid18, key_set_id = <empty>
  06-05 17:35:13.625 I [cdm_engine.cpp(421):AddKey] key_set_id = ksidB78129D7
  06-05 17:35:13.626 I [cdm_engine.cpp(232):CloseSession] session_id = sid18
  06-05 17:35:13.876 I [cdm_engine.cpp(232):CloseSession] session_id = sid17
  06-05 17:35:14.337 I [cdm_engine.cpp(353):AddKey] session_id = sid19, key_set_id = <empty>
  06-05 17:35:39.761 I [cdm_engine.cpp(232):CloseSession] session_id = sid19
  06-05 17:35:39.764 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 17:35:39.764 I [(0):] L3 Terminate.
  06-05 17:36:01.524 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 17:36:01.525 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 17:36:01.527 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 17:36:01.608 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 17:36:01.608 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 17:36:01.609 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:36:01.612 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid20
  06-05 17:36:01.612 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid20
  06-05 17:36:01.613 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid20, playback_id = v8AcsXDUlZXd54CD
  06-05 17:36:01.614 I [cdm_engine.cpp(274):GenerateKeyRequest] session_id = sid20, key_set_id = <empty>, license_type = Streaming
  06-05 17:36:01.640 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.641 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid20
  06-05 17:36:01.679 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:36:01.947 I [cdm_engine.cpp(353):AddKey] session_id = sid20, key_set_id = <empty>
  06-05 17:38:14.449 I [cdm_engine.cpp(232):CloseSession] session_id = sid20
  06-05 17:48:28.436 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 17:48:28.480 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid21
  06-05 17:48:28.480 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid21
  06-05 17:48:28.481 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid21, playback_id = 5x6cqvJgBZQvfF-O
  06-05 17:48:28.482 I [cdm_engine.cpp(445):RestoreKey] session_id = sid21, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 17:48:28.482 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 17:48:28.482 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid21, status = 347
  06-05 17:48:28.482 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 17:48:28.490 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid21
  06-05 17:48:28.490 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 17:48:28.571 I [cdm_engine.cpp(232):CloseSession] session_id = sid21
  06-05 17:48:38.938 I [(0):] L3 Terminate.
  06-05 17:48:38.938 E [oemcrypto_adapter_dynamic.cpp(955):Level1Terminate] L1 Terminate
  06-05 19:03:35.378 I No hidl drm factories found
  06-05 19:03:35.379 E Failed to find passthrough drm factories
  06-05 19:03:36.734 I No hidl drm factories found
  06-05 19:03:36.734 E Failed to find passthrough drm factories
  06-05 19:03:36.748 I No hidl drm factories found
  06-05 19:03:36.749 E Failed to find passthrough drm factories
  06-05 19:03:36.771 I [oemcrypto_adapter_dynamic.cpp(900):Initialize] Level 3 Build Info (v17): OEMCrypto Level3 Code May 20 2022 21:36:54
  06-05 19:03:36.771 I [(0):] Level3 Library 22594 May 20 2022 21:36:54
  06-05 19:03:36.779 I [oemcrypto_adapter_dynamic.cpp(914):Initialize] L3 Initialized. Trying L1.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1134):LoadLevel1] Could not load L1 _oecc119.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1138):LoadLevel1] Could not load L1 _oecc114.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1140):LoadLevel1] Could not load L1 _oecc124.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1145):LoadLevel1] Could not load L1 _oecc129.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1068):LoadLevel1] Could not load L1 _oecc90.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1110):LoadLevel1] Could not load L1 _oecc23.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1131):LoadLevel1] Could not load L1 _oecc116.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1132):LoadLevel1] Could not load L1 _oecc117.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1139):LoadLevel1] Could not load L1 _oecc123.
  06-05 19:03:36.843 W [oemcrypto_adapter_dynamic.cpp(1137):LoadLevel1] Could not load L1 _oecc113.
  06-05 19:03:36.844 I [oemcrypto_adapter_dynamic.cpp(943):Initialize] Level 1 Build Info (v17): Build Information: API_Version: 17.0 LibOEMCrypto_Version: 1.63 TA_Version: 1.12
  06-05 19:03:36.845 I [usage_table_header.cpp(203):RestoreTable] Found usage table to restore: entry_count = 0
  06-05 19:03:36.875 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid22
  06-05 19:03:36.875 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid22
  06-05 19:03:36.877 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:03:36.877 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid22, status = 347
  06-05 19:03:36.877 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:03:36.877 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:03:36.877 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid22, playback_id = HhuYp6Sb4AbuAM3t
  06-05 19:03:36.877 I [cdm_engine.cpp(445):RestoreKey] session_id = sid22, key_set_id = ksidB78129D7
  06-05 19:03:36.881 I [cdm_engine.cpp(994):IsSecurityLevelSupported] level = L1
  06-05 19:03:36.881 I [cdm_engine.cpp(888):QuerySessionStatus] session_id = sid22
  06-05 19:03:36.952 I [cdm_engine.cpp(232):CloseSession] session_id = sid22
  06-05 19:04:03.055 I No hidl drm factories found
  06-05 19:04:03.056 E Failed to find passthrough drm factories
  06-05 19:04:03.062 E Failed to find passthrough drm factories
  06-05 19:04:03.062 I No hidl drm factories found
  06-05 19:04:03.073 I [cdm_engine.cpp(187):OpenSession] New session: session_id = sid23
  06-05 19:04:03.073 I [cdm_engine.cpp(983):QueryOemCryptoSessionId] session_id = sid23
  06-05 19:04:03.074 I [cdm_engine.cpp(2141):SetPlaybackId] session_id = sid23, playback_id = jBUp0cQ25vTbpd3T
  06-05 19:04:03.074 I [cdm_engine.cpp(445):RestoreKey] session_id = sid23, key_set_id = ksidB78129D7
  06-05 19:04:03.074 W [device_files.cpp(1989):RetrieveHashedFile] File does not exist: path = /data/vendor/mediadrm/IDM1013/L1/ksidB78129D7.lic
  06-05 19:04:03.074 E [device_files.cpp(876):RetrieveLicense] Unable to retrieve key set license file: result = NotFound
  06-05 19:04:03.074 E [cdm_session.cpp(236):RestoreOfflineSession] Failed to retrieve license: sub_error_code = NotFound, key_set_id = ksidB78129D7
  06-05 19:04:03.074 E [cdm_engine.cpp(464):RestoreKey] Restore offline session failed: session_id = sid23, status = 347
============================== End of DRM Plugin Log ==============================

I hope you can help me

rrfrias commented 8 months ago

@bartmejia18, can you open a new tracker and provide information about your app, device information, repro steps and a bugreport.?