Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace UniversalImageLoader with Picasso #5928

Merged
merged 7 commits into from
Aug 24, 2021
Merged

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Mar 27, 2021

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

This PR replaces the outdated Android-Universal-Image-Loader (which has not had any new release in the last 6 years) with the more stable and updated Picasso. This hopefully fixes a nasty unfixed issue in Android-Universal-Image-Loader that was causing #4638. Also, the loading seems smoother to me, and retrieving images from memory cache is now instant, instead of taking a couple of milliseconds (try scrolling fast up and down after all thumbnails have been loaded).
I also added a switch in the debug settings to enable indicators.

Fixes the following issue(s)

Fixes #4638

APK testing

@gulachev @k3a @Sekitan @UserX404 @nonremittal @arielshulman @dboydor @pauseee @astatine (taken from #4638)
Could you test this APK from the CI and see if it fixes the issue? Thank you ;-)

Due diligence

@AudricV AudricV added bug Issue is related to a bug feature request Issue is related to a feature in the app player notification Anything to do with the MediaStyle notification labels Mar 27, 2021
@TobiGr TobiGr added the codequality Improvements to the codebase to improve the code quality label Mar 27, 2021
@arielshulman
Copy link
Contributor

Hey @Stypox, thanks for your work 🙏
Just ran a first try with known videos which crashed the phone and unfortunetly the error still occurs.
How can I help?

@Stypox
Copy link
Member Author

Stypox commented Mar 28, 2021

Oh no... why does it still crash? Maybe the bitmap downloaded from the website itself is broken? Could you provide me the video url?

@arielshulman
Copy link
Contributor

This video is one of the rebellious videos.

@Stypox
Copy link
Member Author

Stypox commented Mar 28, 2021

Mmmh, this is really strange. I tried copying the thumbnail and returning the copy and I got this strange error... What does it mean?!?

W/e.debug.picass: Core platform API violation: Ljava/nio/Buffer;->address:J from Landroid/graphics/Bitmap; using JNI
    Core platform API violation: Ljava/nio/NIOAccess;->getBaseArrayOffset(Ljava/nio/Buffer;)I from Landroid/graphics/Bitmap; using JNI
    Core platform API violation: Ljava/nio/NIOAccess;->getBaseArray(Ljava/nio/Buffer;)Ljava/lang/Object; from Landroid/graphics/Bitmap; using JNI

@Stypox
Copy link
Member Author

Stypox commented Mar 28, 2021

@arielshulman could you test this APK? I implemented what you did in the issue, i.e. resizing to width - 1 to force the creation of a new thumbnail. For some reason calling .copy() would cause the attached completion listeners to not be called and the error above to appear... What's wrong with these Bitmaps?!?
app-debug.zip

Oh, btw, some way or another I was able to cause a native stacktrace even on my phone, but this is probably just caused by me recycling the wrong thing ( 'Error, cannot access an invalid/free'd bitmap here!'), and fortunately the phone didn't crash:

2021-03-28 22:11:40.097 16307-16307/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021-03-28 22:11:40.098 16307-16307/? A/DEBUG: Revision: '0'
2021-03-28 22:11:40.098 16307-16307/? A/DEBUG: ABI: 'arm64'
2021-03-28 22:11:40.101 16307-16307/? A/DEBUG: Timestamp: 2021-03-28 22:11:40+0200
2021-03-28 22:11:40.101 16307-16307/? A/DEBUG: pid: 16092, tid: 16185, name: 8/hqdefault.jpg  >>> org.schabi.newpipe.debug.picasso <<<
2021-03-28 22:11:40.101 16307-16307/? A/DEBUG: uid: 10257
2021-03-28 22:11:40.101 16307-16307/? A/DEBUG: signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2021-03-28 22:11:40.101 16307-16307/? A/DEBUG: Abort message: 'Error, cannot access an invalid/free'd bitmap here!'
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x0  0000000000000000  x1  0000000000003f39  x2  0000000000000006  x3  0000007c1b517750
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x4  0000800000000000  x5  0000800000000000  x6  0000800000000000  x7  0000000000800000
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x8  00000000000000f0  x9  0dc63cdfdf89df00  x10 0000000000000001  x11 0000000000000000
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x12 fffffff0fffffbdf  x13 0000000000000003  x14 0000000000000002  x15 000024f81cbd8448
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x16 0000007d2b49e8c0  x17 0000007d2b47c3b0  x18 0000007c1ab48000  x19 0000000000003edc
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x20 0000000000003f39  x21 00000000ffffffff  x22 0000007c1b51c020  x23 0000007ca0980b9c
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x24 000000000000000c  x25 0000007c1b51c020  x26 0000007c9a401cb0  x27 0000000000000003
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     x28 0000007c1b517e00  x29 0000007c1b5177f0
2021-03-28 22:11:40.102 16307-16307/? A/DEBUG:     sp  0000007c1b517730  lr  0000007d2b42ff48  pc  0000007d2b42ff74
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG: backtrace:
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #00 pc 0000000000081f74  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: bf14cf7a62d1f91755beddd4a937354d)
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #01 pc 00000000000089f8  /system/lib64/liblog.so (__android_log_assert+324) (BuildId: abc9e34f45037deab475aefb9194f1bd)
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #02 pc 0000000000153460  /system/lib64/libandroid_runtime.so (Bitmap_copyPixelsToBuffer(_JNIEnv*, _jobject*, long, _jobject*)+216) (BuildId: f56bc1fc11ff5978e2f1a57f7348acd4)
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #03 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #04 pc 00000000001365b8  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.842 16307-16307/? A/DEBUG:       #05 pc 000000000014508c  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #06 pc 00000000002df0d4  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #07 pc 00000000002da3b4  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #08 pc 00000000002e7910  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+14964) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #09 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #10 pc 00000000003679d4  /system/framework/framework.jar (android.graphics.Bitmap.copyPixelsToBuffer)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #11 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #12 pc 0000000000588e8c  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #13 pc 000000000013f468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.843 16307-16307/? A/DEBUG:       #14 pc 0000000000136334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #15 pc 000000000014506c  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #16 pc 00000000004a9110  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #17 pc 00000000004aa1a4  /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #18 pc 000000000039334c  /apex/com.android.runtime/lib64/libart.so (art::JNI::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue const*)+624) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #19 pc 00000000003693e0  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodA(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, jvalue const*, art::Primitive::Type, art::InvokeType)+2000) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #20 pc 000000000002eb50  /apex/com.android.runtime/lib64/libjdwp.so (invoker_doInvoke+2652) (BuildId: ab27d72150946bc52c7d9ee359e337b8)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #21 pc 000000000002b254  /apex/com.android.runtime/lib64/libjdwp.so (reportEvents+592) (BuildId: ab27d72150946bc52c7d9ee359e337b8)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #22 pc 000000000002acd0  /apex/com.android.runtime/lib64/libjdwp.so (event_callback+1000) (BuildId: ab27d72150946bc52c7d9ee359e337b8)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #23 pc 00000000000277f4  /apex/com.android.runtime/lib64/libjdwp.so (cbBreakpoint+360) (BuildId: ab27d72150946bc52c7d9ee359e337b8)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #24 pc 0000000000035ce8  /apex/com.android.runtime/lib64/libopenjdkjvmti.so (openjdkjvmti::JvmtiMethodTraceListener::DexPcMoved(art::Thread*, art::Handle<art::mirror::Object>, art::ArtMethod*, unsigned int)+4080) (BuildId: 8a8b387bc5b8fca176e32439a3d915ba)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #25 pc 00000000002a7fc8  /apex/com.android.runtime/lib64/libart.so (art::instrumentation::Instrumentation::DexPcMovedEventImpl(art::Thread*, art::ObjPtr<art::mirror::Object>, art::ArtMethod*, unsigned int) const+172) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #26 pc 00000000002ec1f8  /apex/com.android.runtime/lib64/libart.so (art::interpreter::InstructionHandler<true, true>::DoDexPcMoveEvent(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame const&, unsigned int, art::instrumentation::Instrumentation const*, art::JValue*)+236) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.844 16307-16307/? A/DEBUG:       #27 pc 00000000002e91ec  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+21328) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #28 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #29 pc 00000000000f38f8  [anon:dalvik-classes2.dex extracted in memory from /data/app/org.schabi.newpipe.debug.picasso-XWyCN2bUdEceLKvtxE2aBg==/base.apk!classes2.dex] (org.schabi.newpipe.player.Player$5.transform)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #30 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #31 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #32 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #33 pc 00000000002e8d38  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+20124) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #34 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #35 pc 0000000000139bd0  [anon:dalvik-classes3.dex extracted in memory from /data/app/org.schabi.newpipe.debug.picasso-XWyCN2bUdEceLKvtxE2aBg==/base.apk!classes3.dex] (com.squareup.picasso.BitmapHunter.applyCustomTransformations)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #36 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #37 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #38 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.845 16307-16307/? A/DEBUG:       #39 pc 00000000002e7910  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+14964) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #40 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #41 pc 0000000000139e20  [anon:dalvik-classes3.dex extracted in memory from /data/app/org.schabi.newpipe.debug.picasso-XWyCN2bUdEceLKvtxE2aBg==/base.apk!classes3.dex] (com.squareup.picasso.BitmapHunter.hunt)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #42 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #43 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #44 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #45 pc 00000000002e8bd4  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+19768) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #46 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #47 pc 000000000013ac08  [anon:dalvik-classes3.dex extracted in memory from /data/app/org.schabi.newpipe.debug.picasso-XWyCN2bUdEceLKvtxE2aBg==/base.apk!classes3.dex] (com.squareup.picasso.BitmapHunter.run)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #48 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #49 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #50 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #51 pc 00000000002e8d38  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+20124) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.846 16307-16307/? A/DEBUG:       #52 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #53 pc 00000000001dd19c  /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.Executors$RunnableAdapter.call)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #54 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #55 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #56 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #57 pc 00000000002e8d38  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+20124) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #58 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #59 pc 00000000001e2b10  /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.FutureTask.run)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #60 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #61 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #62 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #63 pc 00000000002e8d38  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+20124) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #64 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #65 pc 00000000001ed894  /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor.runWorker)
2021-03-28 22:11:40.847 16307-16307/? A/DEBUG:       #66 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #67 pc 00000000002b5b0c  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #68 pc 00000000002da398  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #69 pc 00000000002e8bd4  /apex/com.android.runtime/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+19768) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #70 pc 0000000000141bd8  /apex/com.android.runtime/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #71 pc 00000000001ec6c8  /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor$Worker.run)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #72 pc 00000000002afe1c  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1271440803783865717+492) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #73 pc 0000000000588e8c  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #74 pc 000000000013f468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #75 pc 000000000013f65c  /apex/com.android.runtime/lib64/libart.so (art_quick_instrumentation_entry+252) (BuildId: 77524e83b39d990eaaf7c2af505c5eae)
2021-03-28 22:11:40.848 16307-16307/? A/DEBUG:       #76 pc 0dc63cdfdf89df00  <unknown>

@arielshulman
Copy link
Contributor

Mmmh, this is really strange. I tried copying the thumbnail and returning the copy and I got this strange error... What does it mean?!?

W/e.debug.picass: Core platform API violation: Ljava/nio/Buffer;->address:J from Landroid/graphics/Bitmap; using JNI
    Core platform API violation: Ljava/nio/NIOAccess;->getBaseArrayOffset(Ljava/nio/Buffer;)I from Landroid/graphics/Bitmap; using JNI
    Core platform API violation: Ljava/nio/NIOAccess;->getBaseArray(Ljava/nio/Buffer;)Ljava/lang/Object; from Landroid/graphics/Bitmap; using JNI

This is really strange bitmap and those libraries seems not to like working with it, but this error seems to be lack of good info 🤷‍♂️

I've tried downloading the debug apk but for some reason youtube doesn't work with it.

@arielshulman
Copy link
Contributor

Tried to backtrace (without my laptop, here ) 'Error, cannot access an invalid/free'd bitmap here!', and it seems to come from trying to work with the bitmap after it was recycled as you suggested.

@Stypox
Copy link
Member Author

Stypox commented Mar 31, 2021

@arielshulman please test the APK that should be built by the CI within minutes from now (I have no idea why my apk does not work)

@TobiGr
Copy link
Member

TobiGr commented Mar 31, 2021

Please don't forget to attribute the new library in the about screen (and to remove the replaced one)

@arielshulman
Copy link
Contributor

@arielshulman please test the APK that should be built by the CI within minutes from now (I have no idea why my apk does not work)

It seems the apk build failed, or I'm missing something.
The APK you've attached seems to be a older version, maybe you've attached the wrong one?

Thanks!

@Stypox Stypox force-pushed the picasso branch 2 times, most recently from 3a6c14d to 0749e1e Compare March 31, 2021 13:20
@Stypox
Copy link
Member Author

Stypox commented Mar 31, 2021

@arielshulman for some reason checkstyle was crashing with a totally not understandable and unrelated error, but the real problem was a syntax error caused by rebasing. I don't know how that slipped through. Anyway, now everything should have been built correctly, the apk is here: https://github.com/TeamNewPipe/NewPipe/suites/2389524359/artifacts/50769605

@arielshulman
Copy link
Contributor

🤸 Yay!
Works great!
Thanks again for your dedication to solve this quirck.

@TacoTheDank
Copy link
Member

@Stypox Oh btw, you'll have to rebase or fix the build.gradle confliction from my library rearrangement PR, as a heads up

@Stypox
Copy link
Member Author

Stypox commented Apr 1, 2021

Please don't forget to attribute the new library in the about screen (and to remove the replaced one) @TobiGr

Done

@TacoTheDank
Copy link
Member

@Stypox By the way, I'm curious, why did you decide to go with Picasso over Glide? Nothing against Picasso - it's just that the two libraries' APIs are somewhat similar - but Picasso seems to get more sporadic / spotty maintenance while Glide is more regularly maintained, so I figured I'd ask.

@Stypox
Copy link
Member Author

Stypox commented Apr 3, 2021

I went with Picasso because it is more lightweight but still has all the features we need. Even if it has less maintenance it comes from the same organization as OkHttp, so I think we can use it safely

Copy link
Collaborator

@XiangRongLin XiangRongLin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a quick look. I have no idea about the library i didn't comment on the usage

@Stypox
Copy link
Member Author

Stypox commented May 4, 2021

@jimman2003 I would still switch, Picasso has a better behaviour imho

@opusforlife2
Copy link
Collaborator

Guys,the dev of UIL is back:

@jimman2003 Where do you see that? The last commit is over a year ago. And the message saying the dev will not work from November 27 (presumably 2020) is still there.

@jimman2003
Copy link
Contributor

jimman2003 commented May 7, 2021

Guys,the dev of UIL is back:

@jimman2003 Where do you see that? The last commit is over a year ago. And the message saying the dev will not work from November 27 (presumably 2020) is still there.

Oops well. Misread the commit log + README😭

@Stypox
Copy link
Member Author

Stypox commented Jun 18, 2021

Rebased and applied your first suggestion

@TobiGr
Copy link
Member

TobiGr commented Aug 9, 2021

Sorry, I forgot about this. I tested this thoroughly. The PR dhould be good to merge after a rebase

@Stypox
Copy link
Member Author

Stypox commented Aug 9, 2021

  • @TobiGr rebased
  • I enforced a 15s timeout for image loading (even though that's already the default in OkHttp3, but just wanted to make sure)
  • @litetex could you check if my changes in SeekbarPreviewThumbnailHolder are ok? I completely removed SyncImageLoadingListener since the timeout is now taken care of by OkHttp3 itself. I tested seekbar preview thumbnails and they work. Just for testing purposes I tried to set the timeout to 1ms, hence nothing could load, and the seekbar preview showed no thumbnail as expected.

@tsiflimagas
Copy link
Contributor

tsiflimagas commented Aug 10, 2021

One thing I wonder about is if it would be possible to remove that gray placeholder which appears till the image is loaded and just leave it blank, as it is currently. It's just my personal taste, but it doesn't look that great.

@Stypox
Copy link
Member Author

Stypox commented Aug 10, 2021

@tsiflimagas you are right, done.

@litetex
Copy link
Member

litetex commented Aug 11, 2021

@Stypox
Everything looks fine regarding the SeekbarPreviewThumbnails 😄
Also reviewed the code a bit and didn't find any problems.

@Stypox
Copy link
Member Author

Stypox commented Aug 13, 2021

@litetex thank you for confirming :-)
@TobiGr ready for review

TobiGr
TobiGr previously approved these changes Aug 13, 2021
@TobiGr
Copy link
Member

TobiGr commented Aug 22, 2021

nooooo....
I just wanted to merge this and there is a merge conflict again. sorry :(

@Stypox
Copy link
Member Author

Stypox commented Aug 24, 2021

@TobiGr rebased ;-)

@TobiGr TobiGr merged commit 793b88a into TeamNewPipe:dev Aug 24, 2021
@@ -117,6 +119,7 @@ public void onTerminate() {
disposable.dispose();
}
super.onTerminate();
PicassoHelper.terminate();
Copy link
Contributor

@evermind-zz evermind-zz Aug 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why are you calling PicassoHelper.terminate() after super.onTerminate() call and not before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it makes any difference, but I think I chose to do it this way because there could still be something doing image processing before super.onTerminate(), but surely there isn't after it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it seems it is totally irrelevant what is done in this method on a real device. It is never called according to:
https://developer.android.com/reference/android/app/Application#onTerminate()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmh... should we remove it? @TobiGr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. That's at least how I understand the docs

This was referenced Sep 5, 2021
@Poolitzer
Copy link
Member

@Stypox no idea if fitting or not but #908 is still open, one might want to close that? Or not?

@Stypox
Copy link
Member Author

Stypox commented Sep 18, 2021

@Poolitzer what? #908 is already closed and has nothing to do with this

@Stypox Stypox deleted the picasso branch August 4, 2022 09:48
@Stypox
Copy link
Member Author

Stypox commented Aug 4, 2022

One thing I wonder about is if it would be possible to remove that gray placeholder which appears till the image is loaded and just leave it blank, as it is currently. It's just my personal taste, but it doesn't look that great.

@tsiflimagas This has been reverted in #8530, see there for an explanation, sorry 😅

@Stypox Stypox mentioned this pull request Aug 4, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug codequality Improvements to the codebase to improve the code quality feature request Issue is related to a feature in the app player notification Anything to do with the MediaStyle notification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System UI keeps stopping [Image Loader issue]