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

bug(YouTube - SponsorBlock): Button initialize failure, buttons do not show on some devices with custom roms #3945

Closed
3 tasks done
acidcitrus opened this issue Nov 19, 2024 · 10 comments · Fixed by #3946 or #3909
Closed
3 tasks done
Labels
Bug report Something isn't working

Comments

@acidcitrus
Copy link

Bug description

Copied from thread I made in the official Discord:

I have a Blackview MEGA 1 tablet and get the toast error upon YT startup "SponsorBlockViewController: initialize failure", causing the "Skip button" option of SB to not function (no buttons shown) and SB to have no buttons at all when attempting to contribute. It seems to be specific to Blackview devices due to the OEM-customized ROM. My device is rooted with Magisk, but disabling all modules and app root access does not fix the problem. A search on 4PDA (Russian analogue of XDA-Developers) reveals others experiencing the issue on Blackview devices: https://4pda.to/forum/index.php?act=search&source=all&forums%5B%5D=all&query=sponsorblockviewcontroller&x=23&y=12&subforums=1

Here's the logcat: https://pastebin.com/ZrkxzH7d
I attempted to use ChatGPT to find a fix; I'm not yet experienced with building in java to test it. It blames a class mismatch with the drawable being called by SB RippleDrawable and the ROM only having StateListDrawable. acidcitrus@a2fc1bc

I'd appreciate if someone could look this over and see if it makes sense.

Error logs

initialize failure
android.view.InflateException: Binary XML file line #26 in app.revanced.android.youtube:layout/revanced_sb_inline_sponsor_overlay: Binary XML file line #26 in app.revanced.android.youtube:layout/revanced_sb_inline_sponsor_overlay: Error inflating class app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout
Caused by: android.view.InflateException: Binary XML file line #26 in app.revanced.android.youtube:layout/revanced_sb_inline_sponsor_overlay: Error inflating class app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
	at android.view.LayoutInflater.createView(LayoutInflater.java:858)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1014)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1144)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:660)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
	at app.revanced.extension.youtube.sponsorblock.ui.SponsorBlockViewController.initialize(SponsorBlockViewController.java:64)
	at kzd.aa(PG:102)
	at kzd.x(PG:1)
	at knr.<init>(PG:24)
	at fxc.c(PG:5)
	at fxc.a(PG:3040)
	at qsd.a(PG:79)
	at kol.y(PG:198)
	at koi.N(PG:34)
	at cg.im(PG:26)
	at alet.e(PG:242)
	at alet.g(PG:926)
	at de.aA(PG:130)
	at de.aC(PG:83)
	at de.I(PG:98)
	at bc.e(PG:7)
	at knq.b(PG:86)
	at knq.c(PG:1)
	at com.google.android.apps.youtube.app.watchwhile.MainActivity.onPostCreate(PG:42)
	at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1458)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3776)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2347)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7968)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)
Caused by: java.lang.ClassCastException: android.graphics.drawable.StateListDrawable cannot be cast to android.graphics.drawable.RippleDrawable
	at app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout.initializeButton(NewSegmentLayout.java:114)
	at app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout.<init>(NewSegmentLayout.java:54)
	at app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout.<init>(NewSegmentLayout.java:39)
	at app.revanced.extension.youtube.sponsorblock.ui.NewSegmentLayout.<init>(NewSegmentLayout.java:35)
	... 42 more

Solution

acidcitrus@a2fc1bc

Additional context

ReVanced official, DokeOS 4.0 - Android 13, YouTube 19.43.41, both GMSCore and root mount affected. Isolated to Blackview device, as my other 4+ Android devices from different OEMs have no issues running the same ReVanced patches (root & microG, A9-A15).

Acknowledgements

  • I have checked all open and closed bug reports and this is not a duplicate.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@acidcitrus acidcitrus added the Bug report Something isn't working label Nov 19, 2024
@oSumAtrIX
Copy link
Member

Either the patch is missing an offset, or some A/B test is in play, making the patch hook a different object than expected. This needs further investigation to confirm.

@LisoUseInAIKyrios
Copy link
Contributor

Is acidcitrus@a2fc1bc confirmed to fix the issue?

The issue appears to be some devices or situations do not use RippleDrawable (https://imgur.com/8oegLdR), or it's an A/B test where the effect is turned off. You can try turning on incognito mode, resetting the app data, or logging into a different account and see if this also fixes it (if it is fixed, then it's definitely an A/B test).

For the affected device, does the player settings button have this effect (gear icon beside the SB buttons)? If the effect is not present, then the SB buttons probably should not have the effect either.

@acidcitrus
Copy link
Author

acidcitrus commented Nov 20, 2024

acidcitrus@a2fc1bc is not a confirmed fix.

Incognito and different account don't help, so probably not A/B.

Is that button test app yours and available to share? There does seem to be a ripple effect displaying in the settings button, as well as in other apps like the calculator. If I press the SB button, I receive a toast error. Logcat shows "revanced: SponsorBlockViewController toggleNewSegmentLayoutVisibility failure".

Edit: Setting animations to 10x slower speed, I can definitely see ripple effects in YT player buttons.

@LisoUseInAIKyrios

This comment has been minimized.

@LisoUseInAIKyrios

This comment has been minimized.

@acidcitrus
Copy link
Author

Unfortunately I'm not able to set up a development environment to build, but I should be able to patch with the CLI if provided with the .jar file.

@oSumAtrIX
Copy link
Member

I'll try to add PR builds for patches so that we can test patches without having to clone and build locally

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title bug: SponsorBlock initialize failure, buttons don't show on Blackview devices running DokeOS 4.0 (A13) (likely device ROM/OEM-specific) bug(YouTube - SponsorBlock): Button initialize failure, buttons do not show on some devices with custom roms Nov 20, 2024
@LisoUseInAIKyrios

This comment has been minimized.

@LisoUseInAIKyrios

This comment has been minimized.

@acidcitrus
Copy link
Author

Thank you so much, SB buttons show properly and the toast errors are gone using these patches on the affected device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Something isn't working
Projects
None yet
3 participants