FORUMS
Remove All Ads from XDA

Help Understanding Boot/Shutdown Animations

125 posts
Thanks Meter: 33
 
By djakrse, Senior Member on 2nd May 2014, 09:25 AM
Post Reply Email Thread
This is not a guide, a how-to, or help request thread, specifically. I am looking for any new info regarding how the stock boot animation is formatted and called by the system in my new HTC One M8. I am also familiar with creating boot animations, and am willing to share any information I can in exchange, so I encourage all discussion on the subject.

I've been doing animations for a few years for my old phone and those of others. I've never dealt with an HTC phone or KitKat, personally, so that is probably where I need the most help. I know the desc.txt basics and have familiarized myself with the addition of a few new details, with the newer versions of Android. My other sources for understanding boot animations and the desc.txt are here and here, along with my own knowledge from experimenting on my phones. Here's some observations that I've made with my new Verizon HTC M8, as well as questions regarding what I can't yet understand. My important questions are in red below, if you are anxious to help, but don't want to read all the crap. Answers are in green.


Installation - Boot Animation: Part 1
There are stock hTC_bootup_one.zip and hTC_downanimation.zip in /system/customize/resource. I am familiar with this location from dealing with others' phones. There is also a vzw_bootup.zip, which is basically Verizon's logo added to the HTC animation. When I made my first new boot animation for this phone, it was standard for me, except I was making it x1280 px, to scale up to the new 1080x1920 screen. I don't want to play along and rename my animations, so I first placed my bootanimation.zip in /system/media and it played just fine. My next step was to add sound, which required that I learn about the /system/customize/CID/default.xml. I moved the animation to /system/customize/resource, along with the sound (mp3|ogg works fine), and the /sys.../cus.../CID/default.xml was used to point to both files, without having to replace the stock animation. At this point, everything was working great, and despite new hurdles, I hadn't had any issues... yet!


Installation - Shutdown Animation: Part 1
I researched to understand the particulars about a shutdown animation, and made my first, about 7s in length, and named it downanimation.zip, and it played fine from /system/customize/resource, along with my boot animation and sound. I am really enjoying my phone at this point, and loving s-off, root, custom splash screen, etc., all within a couple of weeks of purchase. My last phone was the original Moto Droid, so unlocked bootloaders and root is all I know. I'm a spoiled brat, really. I have more on this subject coming up as well, so stick around.


Adding Sound to Shutdown Animation
I've made numerous boot animations for my old phone with sound. You know I'm itching to have audio on my shutdown animation, too. The first step is the desc.txt edit, obviously. Check. Then I placed it in the same location as the bootani+sound, but it wouldn't play the downani audio, whether I put them (downanimation+audio) in /system/media, /data/local, or placed just the audio in /system/media/audio/notifications or etc. With each move, I edited the default.xml to point to the audio file's location and each time I was met with a silent animation or even black screen. At this point, I conceded some research was in order. I knew I'd seen enough to know it was possible to have a shutdown animation with sound, but I didn't read the details until I had no other options. First question(s), is it true, as it has become apparent to me, that it is not possible to add sound to a shutdown animation without major modification (e.g., by merely adding a path to audio in the /system/customize/CID/default.xml, as works with the boot animation)? (nope, not true--see next Q) If it is possible, how? (answered by Pacattack, here) I have seen some sort of mods before, to add audio to shutdown animation, but I think it played .mp4, rather than being in a standard format.


Installation - Boot & Shutdown Animations: Part 2
There's a few simple steps I haven't tried yet, when it comes to installing a boot/shutdown animation, on this phone, that might clear up other issues.
Primarily, I haven't replaced the stock animations by name, hTC_bootup_one.zip and hTC_downanimation.zip. At first, I simply wanted to retain the stock animations in place, without renaming, plus I wanted to keep the "bootanimation.zip" I've used for years. Despite my stubbornness, I know this could help avoid issues. Foremost, this requires no editing of the /system/customize/CID/default.xml. Modifying this file from the phone can lead to easy errors, of which I've performed many, and many of which result in black screens, AOSP Android boot animation, or a simple "shutting down" text notification. If modifying this file, I recommend edits made next to a backup with a text comparison editor, like WinMerge, to be able to verify the only edits are the intended ones. Does anyone know an easy way to modify the default.xml file from a computer? I'm thinking Linux users probably use cli txt editors via adb session? Maybe busybox/vi after adb shell? What other proven benefits or limitations does this have over naming animations the standard bootanimation.zip and downanimation.zip?

I also haven't tried using PNG files, as opposed to JPGs. I figured out JPGs worked just fine, when working on my first animation, weeks after I got my first Android phone. It provides for much smaller animations, which was crucial with my old phone, and I still don't want to let go of that. That said, is this the key to more stable boot or down animations? I ran into a key issue when working on my shutdown animation. On my first try, I used 720x1280 frames, and used the desc.txt to scale it up to 1080x1920, the same as my boot animation. However, it refused to scale it up, leaving a 720x1280 animation playing in the top left corner, with unused space (360 px on the right and 640 px on the botton.) surrounding. Perhaps, just on the down animation, scaling might work with PNG, which require less decoding than JPG? I'm guessing not. Even though the ShutdownConfiguration section of the default.xml requires image_png="/path/to/downanimation.zip," JPGs work just fine.

I have tried modifying the ShutdownConfiguration section to say "image_jpg=" and (to match BootConfiguration section) "animation=" (can't remember if I tried "downanimation=") without success. I also mentioned above, I tried to add "audio="/path/to/audio.mp3|ogg" without success. Other failures include removing the path, leaving only the filename, and removing the entire BootConfiguration and ShutdownConfiguration sections, which I thought I saw in use on a custom rom for another device.

If I remember right, I used to install my animations on my Droid, from recovery, mounting /system rw and using adb to move and set permissions, avoiding the failed shutdowns/restarts and having to clear dalvik/cache. I don't remember the reasons exactly, but I've encountered numerous black-screens and quick starts when modifying the default.xml or replacing the animations, despite setting permissions, and when using archives that I know are formatted properly and worked before testing my latest creation. This is followed by entries made to the /system/dirty_file_record, which I don't remember having to bear before. I think I've read mounting system and/or sdcard, while in recovery, and interfacing with adb is not yet possible? Anyone know differently?


What has changed with KitKat?

Click image for larger version

Name:	QAZRlVri.png
Views:	536
Size:	160.1 KB
ID:	2720999 Click image for larger version

Name:	UXRWJPTX.png
Views:	524
Size:	160.4 KB
ID:	2721000
What wizardry is this?

When looking inside the stock animations, with RE, you can see the android folder is listed twice, with different timestamps. The contents are identical, and only one folder is visible when viewed on my pc. Is this Linux-related? Is this a bug in RE? Is this something unique to HTC's modifications? Is this somehow a feature of KitKat enhancements? The vzw_bootup.zip does not have this. The desc.txt for the hTC_bootup_one.zip doesn't offer any clues with its familiar formatting:
Code:
1080 1920 20
c 1 60 android
Looking at the desc.txt inside vzw_bootup.zip animation shows possibly a new feature I'm not familiar with:
Code:
1080 1920 15
c 1 1 android
c 1 1 vzw
n 999 1 progress
My best source thus far to explain the desc.txt has indicated,
Quote:

Jelly Bean (4.1.*) did bring a few small changes. Up til now the first character of an animation section (ie. a "part") line had to be the "p" letter. From now on it can be any letter. If it's a "c", then the given part will be played (at least once) to it's end despite of the state of the boot process. If it's not a "c", then it'll behave like it did in earlier versions with the "p" letter ... i.e. it'll stop the animation when the boot process finishes.

That means the "n" should play like a "p" has in the past, but why use "n"? Obviously, stated to play only 999 times, they are scared of an infinite loop (0), but why not "p"? Does "n" utilize a new KitKat feature?

Another point I want to understand, with all of the stock animations, they've abandoned the use of "p" in favor of "c," I assume, because they don't want to risk your phone starting before you get to witness the beauty of their logos. Why do all parts pause/hold on at least one frame? Is this a design thing, to guarantee seemless play between parts, i.e., pause on last frame while the next part is found? I've never seen a black screen creep in-between parts, but then I've never use a white background on an animation.

I first wondered if this might also act to "kill" the part after a pause, as in pause for x number of frames, then move on or exit. Backstory: If you view your animation from your phone by opening Terminal Emulator and typing "bootanimation," your boot animation will play, in full, without rebooting your phone. Yay! I used to do this with my Droid. Oh wait, no, don't do that! The animation will pause on the final frame and not close, leaving you without a way to return to your desktop (unless you have USB debugging enabled, and can adb shell, top, then kill the process-- is there an easier way?) The safe way I know to do this is adb shell, then bootanimation, and ctrl+c when the animation is over and poof, it's gone. :TheEnd I haven't tried this with one of the stock animations or having a pause value in my animation to test if it would exit safely on its own. I assume this is dependant on the version of the bootanimation binary and Android.

Issues With Custom Animations
When I finalized my first shutdown animation, I sent it to a friend to test on his HTC One (M7). I helped him make the default.xml edit and it played fantastic. Of course, his first response was, how about sound? I spent the next 2 nights trying to get sound to play, not having done much research, but I ended with a lot of reading, which left me skeptical about my chances of getting it to work. Having tried numerous default.xml edits and downanimation.zip repacks, I also ended up skeptical about getting my shutdown animation to work cleanly, without inconsistencies. Bear with me, this will take some explaining.

The first boot animation for my M8 was quick and easy. It took me about 1-2 hours, from a 30s, 720p video to working on my phone. It was 720x1280px frames, scaled to 1080x1920 and playing at 24fps, with the desc.txt. When I first created the shutdown animation, I used the same desc.txt, and simply replaced the part folder. This played successfully, however as I mentioned earlier, it would not scale fullscreen. My second attempt used larger images, 1080x1920, and kept the 24fps, which, I thought, had just a tiny bit of lag. Next, I cut the frames in half, but I forgot to edit the desc.txt to play at 12fps, yet the animation played perfectly, I guess because I had also modified the default.xml to reflect 12fps. I've tried multiple times to get the animation working, with 12fps in both desc.txt and default.xml, without success. My only success, being the only animation I've tried so far, had the desc.txt formatted incorrectly. None of the files trip the dirty_file_record, and yet it refuses to play. Can anyone explain that?!?

As I've said, I have some more tests I can run, but it gets old after 20-30 attempts and several late nights without success. My first one was blind luck, but after work settles down, and maybe with the help of XDA, I'm going to get this process down.
The Following 3 Users Say Thank You to djakrse For This Useful Post: [ View ] Gift djakrse Ad-Free
 
 
2nd May 2014, 09:39 AM |#2  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
This post is to collect my questions, for easy replying by you tapatalkers.

1) First question(s), is it true, as it has become apparent to me, that it is not possible to add sound to a shutdown animation without major modification (e.g., by merely adding a path to audio in the /system/customize/CID/default.xml, as works with the boot animation)? If it is possible, how?

2) Does anyone know an easy way to modify the default.xml file from a computer? I'm thinking Linux users probably use cli txt editors via adb session? Maybe busybox/vi after adb shell? What other proven benefits or limitations does this have over naming animations the standard bootanimation.zip and downanimation.zip?

3) Perhaps, just on the down animation, scaling might work with PNG, which require less decoding than JPG? (I had noticed my shutdown animation would not scale up to fullscreen.)

4) When looking inside the stock animations, with Root Explorer, you can see the android folder is listed twice, with different timestamps. The contents are identical, and only one folder is visible when viewed on my pc. Is this Linux-related? Is this a bug in RE? Is this something unique to HTC's modifications? Is this somehow a feature of KitKat enhancements? The vzw_bootup.zip does not have this.

5) Regarding desc.txt in the (Verizon) HTC One M8's stock Verizon boot animation, the "n" should play like a "p" has in the past, but why use "n"? Obviously, stated to play only 999 times, they are scared of an infinite loop (0), but why not "p"? Does "n" utilize a new KitKat feature?

6) Another point I want to understand, with all of the stock animations, they've abandoned the use of "p" in favor of "c," I assume, because they don't want to risk your phone starting before you get to witness the beauty of their logos. Why do all parts pause/hold on at least one frame?
The Following User Says Thank You to djakrse For This Useful Post: [ View ] Gift djakrse Ad-Free
2nd May 2014, 12:46 PM |#3  
BerndM14's Avatar
Senior Member
Thanks Meter: 561
 
More
Some interesting stuff and questions, a bit out of my league though, I'm also trying to learn all these things. For editing I just run to Notepad++ for almost everything and .xml should be easy in it, I'm a noob what can I say lol

I'll subscribe to this thread, might get some interesting info
2nd May 2014, 04:24 PM |#4  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
Quote:
Originally Posted by BerndM14

Some interesting stuff and questions, a bit out of my league though, I'm also trying to learn all these things. For editing I just run to Notepad++ for almost everything and .xml should be easy in it, I'm a noob what can I say lol

I'll subscribe to this thread, might get some interesting info

NP++ is a fantastic app. I use it almost like a web browser, since I document everything for myself in txt files at home and work. I've actually made my xml edits a couple of times in np++ to get a better view of the file, but when the xml quits working, it's time to get some better comparison tools. Actually, I wouldn't be surprised if np++ has a plugin or similar feature actually built in. That app has endless features. Also, it's the best way to make desc.txt edits, if you are trying to maintain the unix line breaks on a windows box. I haven't actually had a boot animation not play because of windows/dos linebreaks, but most good tutorials tell you not to use them. Notepad doesn't acknowledge the unix linebreaks, hence the all-on-one-line appearance. If you want to revert a windows desc.txt to unix format, open in NP++ and go to Edit> EOL Conversion> UNIX/OSX Format. Unfortunately, this didn't help me in any of my animations for this phone. All of my boot/down animations with unix-formatted desc.txt files resulted in animations that black-screened (boot audio even played, but no pictures.)
2nd May 2014, 06:31 PM |#5  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
Something else I forgot to mention in my late night posting, the Verizon boot animation, vzw_bootup.zip, is called using some other method than the /system/customize/CID/default.xml, so does anyone know how? I've seen other threads where other carriers have customized the boot animation, and probably in the same way? By the way, having made so many modifications, I can no longer play the verizon stock animation, I think. When I restore the default.xml to before I modified the zip path, it simply plays the hTC_bootup_one.zip, if I remember correctly. I may have to double-check that.

To illustrate the xml edits I keep referring to, here's the stock default.xml sections for boot and shutdown animations,
Code:
  <BootConfiguration>
    <BootAnimation animation="/system/customize/resource/hTC_bootup_one.zip" />
  </BootConfiguration>
  <ShutdownConfiguration>
    <ShutdownAnimation image_png="/system/customize/resource/hTC_downanimation.zip" image="" fps="10" />
  </ShutdownConfiguration>
and here's my current config,
Code:
  <BootConfiguration>
    <BootAnimation animation="/system/customize/resource/bootanimation.zip" audio="/system/customize/resource/audio.mp3" />
  </BootConfiguration>
  <ShutdownConfiguration>
    <ShutdownAnimation image_png="/system/customize/resource/downanimation.zip" image="" fps="12" />
  </ShutdownConfiguration>
I haven't figured out the usage of "image=" in the shutdown section. I think I tried to somehow force scaling by image="1080 1920", image="1080x1920", or image="jpg" and I also tried removing that reference, all with black-screen results, using my only working animation. I haven't tried image="1080,1920" or another separator, not that I'd expect it to work. Muzso explains how to learn the inner workings of the bootanimation code and even provides the code to the different versions, up to Jelly Bean. See the attachments, here. I just wish I was a programmer so I could "read" it. Also, has no dev ever sought to provide a modded or working replacement for the /system/bin/bootanimation binary itself, so that we could have more options built in?!? Shutdown audio, maybe a direct apk interface, so that we could customize it from within a gui? It's open source, so get on it wanna-be-famous devs, immediately!
6th May 2014, 04:18 PM |#6  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
I had a small breakthrough last night that may explain some of the issues I've had testing shutdown animations. As I made adjustments to the quality (fps) and attempted to add sound, I somewhere along the way made my first working animation quit working. I've had it "installed" for a couple of weeks now, but it would not play. All I was getting was a "shutting down..." popup message.

I've been meaning to compare it to the stock file on a bigger screen and finally got around to it. Using Notepad++, the only difference, other than my edits, was that the document was encoded as "ANSI as UTF-8" or UTF-8 BOM, versus the stock UTF-8 (without BOM). From Wikipedia, "the Unicode Standard neither requires nor recommends the use of the BOM for UTF-8. The presence of the UTF-8 BOM may cause interoperability problems with existing software that could otherwise handle UTF-8." Some Windows programs, including notepad will add the byte order mark at the beginning of any UTF-8 document, which I assume happened with WinMerge. I've only edited the file with Root Explorer > text editor, Notepad++, and possibly WinMerge.

So, having converted in NP++, Encoding > Encode in UTF-8 without BOM > save, I copied over to phone, rebooted into TWRP, mounted /system/, then replaced /system/customize/CID/default.xml. I'm not exactly sure what is necessary, though I also went into terminal from TWRP, chown to root, chmod to 644, then wiped Dalvik and cache. I've done all of those steps in the past, trying to fix things, so I'm fairly certain the encoding is to blame. The next reboot confirmed it worked, and my shutdown animation is restored.
The Following User Says Thank You to djakrse For This Useful Post: [ View ] Gift djakrse Ad-Free
15th June 2014, 01:19 PM |#7  
Pacattack's Avatar
Senior Member
Thanks Meter: 7,549
 
More
This was mod I did on a ICS Sense 3.6 rom with no shutdown animation or sound ..

As Down anmiation does not use the desc.txt
The size of the images(animi) had to match the screen res.( this is not the case with Boot anim.. )
The frame rate and any sound has to be added to Default.xml in CID folder.

<ShutdownConfiguration>
<ShutdownAnimation image_png="/system/customize/resource/downanimation.zip" audio="/system/customize/resource/shutdown.mp3" useAudio="1" image="" fps="14" />
</ShutdownConfiguration>

Hope this Helps
The Following User Says Thank You to Pacattack For This Useful Post: [ View ] Gift Pacattack Ad-Free
16th June 2014, 03:33 AM |#8  
dased14's Avatar
Senior Member
Flag cincy,ohio
Thanks Meter: 7,147
 
Donate to Me
More
mine is similar and I have been doing it this way since htc evo
Code:
<ShutdownConfiguration>
    <ShutdownAnimation image_png="/system/customize/resource/downanimation.zip" audio="/system/customize/resource/audio_out.mp3" image="" fps="10" />
  </ShutdownConfiguration>
and
Code:
 <BootConfiguration>
    <BootAnimation animation="/system/customize/resource/bootanimation.zip" audio="/system/customize/resource/android_audio.mp3" />
  </BootConfiguration>
and have never had a problem with sound on boot or shut down sound
The Following User Says Thank You to dased14 For This Useful Post: [ View ] Gift dased14 Ad-Free
16th June 2014, 09:05 PM |#9  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
Quote:
Originally Posted by Pacattack

This was mod I did on a ICS Sense 3.6 rom with no shutdown animation or sound ..

As Down anmiation does not use the desc.txt
The size of the images(animi) had to match the screen res.( this is not the case with Boot anim.. )
The frame rate and any sound has to be added to Default.xml in CID folder.

<ShutdownConfiguration>
<ShutdownAnimation image_png="/system/customize/resource/downanimation.zip" audio="/system/customize/resource/shutdown.mp3" useAudio="1" image="" fps="14" />
</ShutdownConfiguration>

Hope this Helps

Thanks so much for the info! I knew the desc.txt wasn't being used, and assumed there was some sort of default.xml edit (if available) but was unable to find that info in my searches. Obviously, this has been around for a while. I was able to find mention of this from over 3 years ago... so easy to find, NOW

I must have tried at least 20 different configurations trying to find the hidden switch to enable audio. I know I tried something similar to this, but I definitely did not have "useAudio" with cap in it.

Quote:
Originally Posted by dased14

mine is similar and I have been doing it this way since htc evo

Code:
<ShutdownConfiguration>
    <ShutdownAnimation image_png="/system/customize/resource/downanimation.zip" audio="/system/customize/resource/audio_out.mp3" image="" fps="10" />
  </ShutdownConfiguration>
and
Code:
 <BootConfiguration>
    <BootAnimation animation="/system/customize/resource/bootanimation.zip" audio="/system/customize/resource/android_audio.mp3" />
  </BootConfiguration>
and have never had a problem with sound on boot or shut down sound

This (shutdown audio) is working for you without the use of useAudio="1"? Yours was the first config edit I tried for my phone (HTC One M8) and did not work. Are you on an older HTC phone?
16th June 2014, 09:53 PM |#10  
dased14's Avatar
Senior Member
Flag cincy,ohio
Thanks Meter: 7,147
 
Donate to Me
More
Yep has worked flawless on every phone i have used (using a sprint m8,m7 at the moment)

Sent from somewhere
16th June 2014, 10:15 PM |#11  
djakrse's Avatar
OP Senior Member
Thanks Meter: 33
 
More
Quote:
Originally Posted by dased14

Yep has worked flawless on every phone i have used (using a sprint m8,m7 and lg g2 at the moment)

Sent from somewhere

I don't know why my verizon phone would be different (other than V likes to troll its customers.) Adding the path to audio, just as with the boot animation was the most obvious solution, but didn't work with the audio file located in the same directory. I also tried other locations, including /data/local/ and /system/media/, with no success.

I had a friend testing for me as well, and this didn't work on his Verizon M7.

I'll try again, without "useAudio=1" to be sure, as I was having some formatting issues from editing with Root Explorer > text editor. I figured out SwiftKey was at the root of those issues, due to auto-entry throwing random trash in the file when I tapped inside the txt file to choose where to edit. No telling how many of my blackscreen issues were due to trash characters in the file. I had to use Notepad++ twice to figure out where the unwanted characters had been thrown in there.

Edit: Ah, just saw your edit
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes