[LG K7 Guides, News, & Discussion] ObliviousEnigma:
Hello.

Presrequites:

Root permissions

USB cable for debugging

ADB (Android Debug-Bridge)

Preface - My overly dramatic story (feel free to skip; Unless you'd like a quick chuckle)

I couldn't help but notice that there are

no

tutorials explaining how to add audio to the bootanimation and shutdownanimation for the LG K7 (of any model)! I scoured the internet in search for it for myself. I had come back empty handed... Luckily though! Through perseverance and sweat and lots of coffee... I dug through the firmware ROM file and found a few gold nuggets.

During my journey, I stumbled upon a file (boot_resource.sh) located at: system/vendor/bin; This had me puzzled initially. It has multiple references (four, to be exact) to the same four attributes regarding the boot animation (and audio)! It clearly shows some directories that do not exist (on my rooted device at that)!!! I was intrigued. I was shocked. Could it be... This easy?! Jackpot! I found the gold pot at the end of the rainbow...!

I shuffled up to the... Latrine... In a sluggish manner: I asked my girlfriend to get me another cup of black liquid fuel (COFFEE)! I squinted and squirmed in excitement! I have finally located the holy grail of the sound.

USER_BOOTANIMATION_SOUND_FILE=/data/local/PowerOn.ogg

There was nothing there, except: /data/local/tmp! Nothing more than a plain, void directory with another empty folder (tmp). I hastily copied over the nearest locally stored *.ogg audio file I could find and pasted the default animation files into their and rebooted faster than one could run to the store for more milk!

Voila! I had done it...! I had my bootanimation with audio. A'lass...! Victory was mine! :cool:

The end.

To add a custom power-on animation and power-off animation (

with sound

):

Compile a *.zip file (compression: storage) with:

A text-file named "desc.txt" (EOF symbol at the end (preferably UNIX); Just press enter at the end)

A folder containing *.jpg or *.png images (my LG K7 does not load anything larger than 250KB); Sequentially numbered (000.png, 001.png, etc)

Name the *.zip file: "bootanimation.zip" for power-up animation ("shutdownanimation.zip" for power-down)

Name the power-on audio file "PowerOn.ogg"; It will only play once (the larger the file: The longer the load time)

Name the power-off audio file "PowerOff.ogg"; It also will only play once (synchronizing the image/sound is tough)

Copy the respective files to: /data/local/

Reboot your phone and laugh hysterically in amusement! :good:

Example of desc.txt:

480 854 30
p 0 0 SailorMoon

To further explain what these values are and why they are both necessary and important to understand:

480 = X resolution (width of the image)
854 = Y resolution (height of the image); 854 is the maximum I can load on my LG K7
30 = FPS (frames per second) that the images load at
p = A symbolic marker for Android to read; It signifies that this is the folder to load
0 = The quantity of loops of this particular folder of images (0 represents "infinitely")
0 = The delay of time before loading another folder of images

If you wished: You could download (or create your own!) five animations and load five folders and play them at 75FPS (5 folders of images * 30 frames (images) / 75FPS = '2 frames per second' (400ms an image)); It would flash by very fast, but it would also be a great way to sample large amounts of multiple boot animation sequences (with/without audio), without having to reboot and reload more animations a b'jillion times!

To elaborate on the suggestion above: We would create one desc.txt file for our 'bootanimation.zip' file.

480 854 75
p 1 0 SailorMoon
p 1 0 SailorMercury
p 1 0 SailorMars
p 1 0 SailorJupiter
p 1 0 SailorVenus
p 1 0 SailorNeptune

These examples are using 15-frame image sets (15 images per folder). Now all we have to do is place this desc.txt file and the respective folders/images into a (compression level: storage) *.zip file named: bootanimation.zip. Then we load it onto the phone and move it over to: /data/local/bootanimation.zip.

The alternative option is to over-write the carrier shipped bootanimation *.zip file located at: /system/media/bootanimation.zip; In the event of a 'factory reset': The default bootanimation should return. The gains in storage space are nominal by overwriting the prepackaged and shipped one (~2MB).

If you are running a Windows platform: Here are some easy and efficient batch file scripts to help speed everything up!

Insert your USB (ignore if you use an ADB root Wifi app on your phone)

Run the "newBootSequence.bat" file (copies files; Signs on ADB with su; Kills the server and reboots the phone after you exit the shell)

- newBootSequence.bat (lives at: C:\Android\)

adb devices

adb push C:\Android\bootanimation.zip /sdcard/
adb push C:\Android\shutdownanimation.zip /sdcard/
adb push C:\Android\PowerOn.ogg /sdcard/
adb push C:\Android\PowerOff.ogg /sdcard/

adb shell su

adb reboot

adb kill-server

adb wait-for-device

If you're like me and you despise repetitive tasks: I have yet another script file to ease development of testing out new animation sequences and audio files! This, however, is a bash script for your Android device.

- customBoot.sh (lives at: /sdcard/)

#!/sdcard/customBoot.sh

#
# Used for localized custom boot animation sequence *WITH* audio!
# Written by: ObliviousEnigma -- 2017/12/24 00:43
#

###############################################################################################
############# A little bit of extra information regarding boot animations / audio #############
###############################################################################################
# The LG K7 supports audio upon boot up; There are a few options for 'enabling' it.
# If the directory /data/local/ is populated (and has valid entries): It takes
# precedence over the default /system/media location (for loading images).
#
# If both entries are invalid or contain invalid data: Android pulls a default
# animated "Android" animation from some unknown location (I did not investigate).
#
# The only audio file format I've tested was: *.ogg (using a file converter).
# The file formats I've tested were: *.png and *.jpg;
#
# The internal format/filename/path do not matter (so long as they agree with: desc.txt).
# EG: Typically listed "part01" folder can be "Frozen Android"; It loads it just fine.
# Image names I did not play with /too/ much; I use IrfanView and name them: 000-999.
# bootanimation/shutdownanimation must be named respectively (stored-format *.zip).
#
# Format of: desc.txt within bootanimation/shutdownanimation should be:
# [X resolution] [Y resolution] [FPS]
# [1st folder of frames] [loop animation quantity] [delay in-between looping the next folder]
# [2nd folder of frames] [loop animation quantity] [delay in-between looping the next folder]
# [etc ...]
#
# EXAMPLE desc.txt:
# 480 854 30
# p 0 0 SailorNeptune0
# [EOF]
#
# Make sure you set the EOL (end of line) conversion to UNIX (safest bet)! Notepad++
#
# 480 = X (width) resolution in pixels
# 854 = Y (height) resolution in pixels
# 30 = FPS (frames per second) that the animation will play at
# p = "part" (symbol marker for the Android OS to read)
# 0 = Loop animation quantity (0 represents "infinite"; Useful if you only have 1 folder)
# 0 = Delay in-between loading folders of images (EG: SailorNeptune0, SailorNeptune1, etc)
# SailorNeptune0 = the folder name to load the images (*.png or *.jpg format) out of
#
# You could use a very high FPS (75FPS) to test multiple boot animations (5x = "15 FPS" per)
# The audio file (PowerOn.ogg) only appears to be played once; I am sure there's a setting
# To loop it multiple times; I do not know what it is for right now. Play at your own risk!
###############################################################################################

echo "\t**********\t**********\t**********\t**********\t**********\t**********"
echo "\t\tBash script by: ObliviousEnigma (XDA Developers)"
echo "\t\tINTENT: Customized boot-up/shut-down animations and audio for the LG K7 phones"
echo "\t**********\t**********\t**********\t**********\t**********\t**********"

# Prematurely terminate the script if the user is not currently logged in as: ROOT (0)
if [ "$USER" != "root" ]; then
echo "\t\tYou require ROOT permissions to execute this script!"
echo "\t\tScript location: $filePath"
echo "\t\tPlease re-run after you're logged in as root"
echo "\t\t\t***** Currently logged in as: \"$USER\" *****"
echo "\t**************************************************************"
echo ""

exit
fi

echo ""
echo ""

# I am not used to using BASH scripts; This is the best I could come up with.
# This will copy the output from the terminal (full filename; Relying on the wild-card ("glob")).

sPowerOn=$(ls PowerOn.*)
sPowerOff=$(ls PowerOff.*)

# Forcibly overwrite both animation files (power on and power off)
if [ -a "$filePath"/bootanimation.zip ]; then
mv -f -v "$filePath"/bootanimation.zip /data/local/bootanimation.zip
chown root:root /data/local/bootanimation.zip
chmod 775 /data/local/bootanimation.zip

else
echo "$filePath/bootanimation.zip\" -- NOT FOUND";
fi

if [ -a "$filePath"/shutdownanimation.zip ]; then
mv -f -v "$filePath"/shutdownanimation.zip /data/local/shutdownanimation.zip
chown root:root /data/local/shutdownanimation.zip
chmod 775 /data/local/shutdownanimation.zip

else
echo "$filePath/shutdownanimation.zip\" -- NOT FOUND";
fi

# Forcibly overwrite both audio files (KNOWN SUPPORTED FORMATS: ogg, mp3)
if [ -f "$filePath"/"$sPowerOn" ]; then
mv -f -v "$filePath"/"$sPowerOn" /data/local/"$sPowerOn"
chown root:root /data/local/"$sPowerOn"
chmod 775 /data/local/"$sPowerOn"

else
echo "$filePath/$sPowerOn\" -- NOT FOUND";
fi

if [ -f "$filePath/$sPowerOff" ]; then
mv -f -v "$filePath"/"$sPowerOff" /data/local/"$sPowerOff"
chown root:root /data/local/"$sPowerOff"
chmod 775 /data/local/"$sPowerOff"

else
echo "$filePath/$sPowerOff\" -- NOT FOUND";
fi

Fortunately: That is the end of everything for today.

I hope this helps someone! I know it surely made my day to FINALLY have audio for my LG K7!