Help Understanding Boot/Shutdown Animations

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    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?

    QAZRlVri.png UXRWJPTX.png
    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,
    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. :laugh:
    1
    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?
    1
    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.
    1

    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 :)
    1
    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