bootanimation: Update bootanimation and Fix Glitches

- Big Thanks to Roger.T

Signed-off-by: Jackeagle <jackeagle102@gmail.com>
Change-Id: I3415c948651262b2c69f04537c9ef9fe1e312689
diff --git a/bootanimation/Android.mk b/bootanimation/Android.mk
deleted file mode 100644
index 2bc78ce..0000000
--- a/bootanimation/Android.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Copyright (C) 2016 The CyanogenMod Project
-#               2017-2019 The LineageOS Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifeq ($(TARGET_SCREEN_WIDTH),)
-    $(warning TARGET_SCREEN_WIDTH is not set, using default value: 1080)
-    TARGET_SCREEN_WIDTH := 1080
-endif
-ifeq ($(TARGET_SCREEN_HEIGHT),)
-    $(warning TARGET_SCREEN_HEIGHT is not set, using default value: 1920)
-    TARGET_SCREEN_HEIGHT := 1920
-endif
-
-TARGET_GENERATED_BOOTANIMATION := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION/bootanimation.zip
-$(TARGET_GENERATED_BOOTANIMATION): INTERMEDIATES := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION
-$(TARGET_GENERATED_BOOTANIMATION): $(SOONG_ZIP)
-	@echo "Building bootanimation.zip"
-	@rm -rf $(dir $@)
-	@mkdir -p $(dir $@)
-	$(hide) tar xfp vendor/lineage/bootanimation/bootanimation.tar -C $(INTERMEDIATES)
-	$(hide) if [ $(TARGET_SCREEN_HEIGHT) -lt $(TARGET_SCREEN_WIDTH) ]; then \
-	    IMAGEWIDTH=$(TARGET_SCREEN_HEIGHT); \
-	else \
-	    IMAGEWIDTH=$(TARGET_SCREEN_WIDTH); \
-	fi; \
-	IMAGESCALEWIDTH=$$IMAGEWIDTH; \
-	IMAGESCALEHEIGHT=$$(expr $$IMAGESCALEWIDTH / 3); \
-	if [ "$(TARGET_BOOTANIMATION_HALF_RES)" = "true" ]; then \
-	    IMAGEWIDTH="$$(expr "$$IMAGEWIDTH" / 2)"; \
-	fi; \
-	IMAGEHEIGHT=$$(expr $$IMAGEWIDTH / 3); \
-	RESOLUTION="$$IMAGEWIDTH"x"$$IMAGEHEIGHT"; \
-	for part_cnt in 0 1 2 3 4; do \
-	    mkdir -p $(INTERMEDIATES)/part$$part_cnt; \
-	done; \
-	prebuilts/tools-lineage/${HOST_OS}-x86/bin/mogrify -resize $$RESOLUTION -colors 250 $(INTERMEDIATES)/*/*.png; \
-	echo "$$IMAGESCALEWIDTH $$IMAGESCALEHEIGHT 60" > $(INTERMEDIATES)/desc.txt; \
-	cat vendor/lineage/bootanimation/desc.txt >> $(INTERMEDIATES)/desc.txt
-	$(hide) $(SOONG_ZIP) -L 0 -o $(TARGET_GENERATED_BOOTANIMATION) -C $(INTERMEDIATES) -D $(INTERMEDIATES)
-
-ifeq ($(TARGET_BOOTANIMATION),)
-    TARGET_BOOTANIMATION := $(TARGET_GENERATED_BOOTANIMATION)
-endif
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := bootanimation.zip
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT)/media
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(TARGET_BOOTANIMATION)
-	@cp $(TARGET_BOOTANIMATION) $@
diff --git a/bootanimation/CleanSpec.mk b/bootanimation/CleanSpec.mk
deleted file mode 100644
index a32a883..0000000
--- a/bootanimation/CleanSpec.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2017 The LineageOS Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/BOOTANIMATION)
diff --git a/bootanimation/bootanimation.tar b/bootanimation/bootanimation.tar
deleted file mode 100644
index 7e4b0dc..0000000
--- a/bootanimation/bootanimation.tar
+++ /dev/null
Binary files differ
diff --git a/bootanimation/desc.txt b/bootanimation/desc.txt
deleted file mode 100644
index 5ddacd6..0000000
--- a/bootanimation/desc.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-c 1 0 part0
-c 0 0 part1
-c 1 0 part2
-c 1 1 part3
-c 1 0 part4
diff --git a/config/bliss_packages.mk b/config/bliss_packages.mk
index 05000ea..db18d7c 100644
--- a/config/bliss_packages.mk
+++ b/config/bliss_packages.mk
@@ -21,10 +21,6 @@
     Profiles \
     WeatherProvider
 
-# Bootanimation
-PRODUCT_PACKAGES += \
-    bootanimation.zip
-
 # Dex preopt
 PRODUCT_DEXPREOPT_SPEED_APPS += \
     SystemUI \
diff --git a/config/bootanimation.mk b/config/bootanimation.mk
new file mode 100644
index 0000000..2a3931e
--- /dev/null
+++ b/config/bootanimation.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2014-2020 The BlissRoms Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#Bootanimation
+
+TARGET_BOOT_ANIMATION_RES ?= undefined
+
+ifeq ($(TARGET_BOOT_ANIMATION_RES),720)
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/720.zip:system/media/bootanimation.zip
+else ifeq ($(TARGET_BOOT_ANIMATION_RES),1080)
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/1080.zip:system/media/bootanimation.zip
+else ifeq ($(TARGET_BOOT_ANIMATION_RES),1200)
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/1200.zip:system/media/bootanimation.zip
+else ifeq ($(TARGET_BOOT_ANIMATION_RES),1440)
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/1440.zip:system/media/bootanimation.zip
+else ifeq ($(TARGET_BOOT_ANIMATION_RES),undefined)
+     $(warning Target bootanimation res is undefined, using generic 1440p bootanimation )
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/bootanimation.zip:system/media/bootanimation.zip
+else
+     $(warning Defined bootanimation res is wrong, using generic 1440p bootanimation )
+     PRODUCT_COPY_FILES += vendor/bliss/prebuilt/common/bootanimation/bootanimation.zip:system/media/bootanimation.zip
+endif
diff --git a/config/common.mk b/config/common.mk
index 5f4d70b..d803bc3 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -118,6 +118,9 @@
 PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS += vendor/bliss/overlay
 DEVICE_PACKAGE_OVERLAYS += vendor/bliss/overlay/common
 
+# Bliss Bootanimation
+-include vendor/bliss/config/bootanimation.mk
+
 # Bliss Versioning System
 -include vendor/bliss/config/versions.mk
 
diff --git a/prebuilt/common/bootanimation/1080.zip b/prebuilt/common/bootanimation/1080.zip
new file mode 100644
index 0000000..a237d17
--- /dev/null
+++ b/prebuilt/common/bootanimation/1080.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/1200.zip b/prebuilt/common/bootanimation/1200.zip
new file mode 100644
index 0000000..d198b49
--- /dev/null
+++ b/prebuilt/common/bootanimation/1200.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/1440.zip b/prebuilt/common/bootanimation/1440.zip
new file mode 100644
index 0000000..d88923e
--- /dev/null
+++ b/prebuilt/common/bootanimation/1440.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/720.zip b/prebuilt/common/bootanimation/720.zip
new file mode 100644
index 0000000..13f9e63
--- /dev/null
+++ b/prebuilt/common/bootanimation/720.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/800.zip b/prebuilt/common/bootanimation/800.zip
new file mode 100644
index 0000000..bd6ccdb
--- /dev/null
+++ b/prebuilt/common/bootanimation/800.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/bootanimation.zip b/prebuilt/common/bootanimation/bootanimation.zip
new file mode 100644
index 0000000..d88923e
--- /dev/null
+++ b/prebuilt/common/bootanimation/bootanimation.zip
Binary files differ