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 Music/Player components): Crash at first launch on old clients #2377

Closed
6 tasks done
kitadai31 opened this issue Sep 9, 2024 · 1 comment
Closed
6 tasks done
Labels
Bug report Something isn't working

Comments

@kitadai31
Copy link

Type

Error at runtime

Tools used

CLI

Application

YouTube Music v6.29.58, v6.20.51

Bug description

App crashes at first launch.
restoreOldPlayerLayout() is causing this problem.

Error logs

YT Music 6.29.58

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getMeasuredHeight()' on a null object reference
	at com.google.android.apps.youtube.music.watchpage.mpp.MppWatchWhileLayout.s(PG:3)
	at pqt.b(PG:4)
	at pqt.h(PG:5)
	at com.google.android.apps.youtube.music.watchpage.mpp.MppWatchWhileLayout.onMeasure(PG:16)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.support.v7.widget.ContentFrameLayout.onMeasure(PG:23)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7028)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:768)
	at android.view.View.measure(View.java:27866)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4486)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3012)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3333)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2718)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9937)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1406)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
	at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
	at android.view.Choreographer.doFrame(Choreographer.java:945)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
	at android.os.Handler.handleCallback(Handler.java:959)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8592)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

Solution

This is caused by Settings.SETTINGS_INITIALIZED being set to true too early.

In the InitializationPatch, increase the delay to at least 3000 ms.
https://github.com/inotia00/revanced-integrations/blob/3362fe5fc194f89be984e728e36d2b88081e1111/app/src/main/java/app/revanced/integrations/music/patches/utils/InitializationPatch.java#L27
2500 ms was crashed.

The delay of restart dialog is also have to be increased to same value.

Additional context

No response

Device Environment

Android 14, Pixel 3

Acknowledgements

  • This issue does not reproduce on unpatched YouTube or YT Music.
  • This issue is not a duplicate of an existing bug report.
  • I didn't use any settings marked as Experimental Flags.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
  • I have written the title and contents in English.
@kitadai31 kitadai31 added the Bug report Something isn't working label Sep 9, 2024
inotia00 added a commit to inotia00/revanced-integrations that referenced this issue Sep 14, 2024
@inotia00
Copy link
Owner

reflected in revanced-patches-4.14.1

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
Development

No branches or pull requests

2 participants