kitsunyan / foxy-boot

Replace Android boot animation with the kernel ring buffer or Android log
Other
69 stars 9 forks source link

Black screen on Resurrection Remix OS 7.0.1 Beta 1 by OpenKirin.net #5

Open V10lator opened 5 years ago

V10lator commented 5 years ago

The phone shows just a black screen on boot (but it boots correctly). There are no linking errors. This is on a Honor 9 Lite (LLD-L21).

//EDIT: /system/bin/bootanimation test runs just fine.

kitsunyan commented 5 years ago

Can you give me logcat output? Which magisk version?

V10lator commented 5 years ago

This file was taken with adb logcat -d > logcat.txt, I hope that was correct?

logcat.txt

Magisk 19.2 (19200)

kitsunyan commented 5 years ago

Hmm..

V10lator commented 5 years ago
  • Can you also give me a Magisk log (available in Magisk Manager)?

For me it looks good but there you go: magisk_log_20190523_005120.log

  • Can you try to edit foxy.boot.background to check that bootanimation actually starts (read the readme)?

I tried resetprob 'foxy.boot.background' '#00ff00' but still just a black screen. The script setting this is v10-foxy.sh (see Magisk log above).

  • Can you also try to change foxy.boot.source to logd?

I did set that in the v10-foxy.sh sript, too, but no change.

  • What's your output for cat /proc/sys/kernel/dmesg_restrict?

1

Just a shoot into the blue but I found this in bootanimation from Resurrection Remix: https://github.com/ResurrectionRemix/android_frameworks_base/blob/pie/cmds/bootanimation/bootanimation_main.cpp#L156 https://github.com/ResurrectionRemix/android_frameworks_base/blob/pie/cmds/bootanimation/BootAnimationUtil.cpp#L39

Now I didn't look deep into your codes but maybe you need to wait for SurfaceFlinger, too?

kitsunyan commented 5 years ago

Just a shoot into the blue but I found this in bootanimation from Resurrection Remix

Interesting. So I added the same check, can you test it?

resetprob

Is there a typo? resetprop should be used instead.

1

Can you set foxy.boot.source back to kmsg (or just remove the resetprop call), but leave resetprop 'foxy.boot.background' '#00ff00'? Do you see any log messages? If not, can you add echo 0 > /proc/sys/kernel/dmesg_restrict to your v10-foxy.sh?

V10lator commented 5 years ago

There are a few things happening now:

I'm not sure what's happening here (testing fixing typo + setting dmesg_restrict to 0) so I'll install your test version now but then I won't have time to test so please be patient. :)

V10lator commented 5 years ago

Okay, so these are my findings:

echo 0 > /proc/sys/kernel/dmesg_restrict is needed. The test build waiting for SurfaceFlinger doesn't change a thing.

Anyway, there seems to be some race condition out of your control: Normally your bootscreen gets shown after the first reboot of a fresh install (of foxy-boot) but on the second boot and onwards sometimes foxy-boot shows up but most of the time the default boot screen comes up.

Why I think this is a race condition? Because a magisk module replacing /system/media/bootanimation.zip works reliably (I'm using https://github.com/V10lator/RR-O-boot to test this) but then again the zip should be loaded a few ms after the bootanimation binary (as the stock bootanimation loads the zip). I think this isn't fixable on your end but would need Magisk to be tweaked?

Please note that because of the race condition my testing is very limited (still not sure why sometimes no bootscreen comes up at all - maybe the race condition again? So android tries to load the binary while it gets replaced and for a time shorter than the blink of an eye there's no binary to load? I don't know Magisks internals good enough to confirm this so take it with a grain of salt) and I'll stop using foxy-boot now (not because it's not a great tool but because of the Magisk issue).

kitsunyan commented 5 years ago

0 > /proc/sys/kernel/dmesg_restrict is needed

Nice. That's easy to fix.

I think this isn't fixable on your end but would need Magisk to be tweaked?

There was a post-fs stage in Magisk a long time ago which used cache partition instead of data partition, but this stage was removed.

Please note that because of the race condition my testing is very limited

Yes, it seems like a race and some Android 8/9 devices are affected since bootanimation can be started before post-fs-data. The cases when you get just the blank screen seem strange to me.

Can you create a script in service.d with the following contents and test how well foxy-boot works with it?

#!/system/bin/sh
count=0
while [ ! "`getprop 'init.svc.bootanim'`" = 'running' ]; do
  sleep 0.1
  count=$(($count + 1))
  [ "$count" -lt 200 ] || break
done
if [ "`getprop 'init.svc.bootanim'`" = 'running' ]; then
  pid="`pgrep -fox '/system/bin/bootanimation'`"
  if [ -n "$pid" ] && [ ! "`readlink "/proc/$pid/exe"`" = '/system/bin/foxy-boot' ]; then
    setprop 'ctl.restart' 'bootanim'
  fi
fi
V10lator commented 5 years ago

That's a nice little script you wrote but I removed some other Magisk modules I don't really need and now foxy-boot works every time (and I have no more need for foxy-boot. Don't get me wrong: It's great but after seeing some boots I think I like an animated bootscreen more). Anyway, I might reinstall the modules and retest the next days as I love helping. :)

kitsunyan commented 5 years ago

Anyway, I might reinstall the modules and retest the next days as I love helping. :)

Thanks! I'll wait.

apnof commented 5 years ago

Can you create a script in service.d with the following contents and test how well foxy-boot works with it?

#!/system/bin/sh
count=0
while [ ! "`getprop 'init.svc.bootanim'`" = 'running' ]; do
  sleep 0.1
  count=$(($count + 1))
  [ "$count" -lt 200 ] || break
done
if [ "`getprop 'init.svc.bootanim'`" = 'running' ]; then
  pid="`pgrep -fox '/system/bin/bootanimation'`"
  if [ -n "$pid" ] && [ ! "`readlink "/proc/$pid/exe"`" = '/system/bin/foxy-boot' ]; then
    setprop 'ctl.restart' 'bootanim'
  fi
fi

Hi @kitsunyan

added file /sbin/.magisk/img/.core/service.d/50_foxy-workaround.sh with your script and it works for me with foxy-boot 1.4 from the regular Magisk module repository.

(Without modifications (just foxy-boot 1.4 installed), i could see the log when shutting down the phone via power button, but not at boot - instead of foxy-boot there was the stock bootanimation)

Do you need any logs?

Btw. I am running Magisk 19.2 (19200) on a BQ Aquaris X Pro with stock firmware 2.7.1 (Android 8.1.0 Oreo, Kernel 3.18.71)

edit: fixed typo

edit2 (26.05., 10.40UTC): hm, weird, had the default animation one time (out of approx. 5 or 6 boots)

kitsunyan commented 5 years ago

@apnof if the module works with the scripts, that's fine. I'm going to include the final script into the module when I get a reliable solution.

edit2 (26.05., 10.40UTC): hm, weird, had the default animation one time (out of approx. 5 or 6 boots)

Can you reproduce this problem?

apnof commented 5 years ago

Unfortunately, it is pretty random. Sometimes i got foxy-boot, sometimes the stock screen. At the moment, it feels like a worse ratio.

I don't have any knowledge about android debugging, but if you tell me how i can generate useful logs, maybe we can find the reason..

My phone does show the screen before the bootanimation pretty long, maybe the 2 seconds delay for restarting the bootanimation is to short?

mark9064 commented 5 years ago

This service script is working perfectly for me so far :smile: . Had no success at all without it.

camypaj commented 4 years ago

Hi all, same here - service script fixed my issue (stock animation instead of FoxyBoot) on Mako (Nexus 4) running LineageOS 15.1 (Android 8.1.0). I was about to create an issue, but then I've found this one. Thanks for the work done on writing the module, and reporting the issue :)

Side note: the same module works out-of-the-box on Lineageos 16.0 (Android 9) on Samsung Galaxy S4 VE (jfvelte) - no modification was needed. On both devices, Magisk installs the module without an error. If it helps to provide the logs, please let me know.