On an emulated Pixel2 API 29, WhatTheCodec fails to open mp4s in Downloads.
Seems like the uri looks like "content://com.android.providers.downloads.documents/document/msf:24"
and the "msf:" is not needed.
So PathUtil.java needs something like:
38 } else if (id.startsWith("msf:")) {
39 final String[] split = id.split(":");
40 uri = ContentUris.withAppendedId(
41 Uri.parse("content://downloads/public_downloads"), Long.valueOf(split[1]));
com.javernaut.whatthecodec E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.javernaut.whatthecodec, PID: 13131
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=42, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/msf:24 flg=0x1 }} to activity {com.javernaut.whatthecodec/com.javernaut.whatthecodec.MainActivity}: java.lang.NumberFormatException: For input string: "msf:24"
at android.app.ActivityThread.deliverResults(ActivityThread.java:4845)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NumberFormatException: For input string: "msf:24"
at java.lang.Long.parseLong(Long.java:594)
at java.lang.Long.valueOf(Long.java:808)
at com.javernaut.whatthecodec.PathUtil.getPath(PathUtil.java:40)
at com.javernaut.whatthecodec.MainActivity.tryGetVideoConfig(MainActivity.kt:108)
at com.javernaut.whatthecodec.MainActivity.onActivityResult(MainActivity.kt:39)
at android.app.Activity.dispatchActivityResult(Activity.java:8110)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)