Merge "cm: Add Quincy targets to nightly builds" into jellybean
diff --git a/config/common.mk b/config/common.mk
index 289ee4b..fc32ec7 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -1,8 +1,49 @@
 PRODUCT_BRAND ?= cyanogenmod
 
+# To deal with CM9 specifications
+# TODO: remove once all devices have been switched
 ifneq ($(TARGET_BOOTANIMATION_NAME),)
-    PRODUCT_COPY_FILES += \
-        vendor/cm/prebuilt/common/bootanimation/$(TARGET_BOOTANIMATION_NAME).zip:system/media/bootanimation.zip
+TARGET_SCREEN_DIMENSIONS := $(subst -, $(space), $(subst x, $(space), $(TARGET_BOOTANIMATION_NAME)))
+ifeq ($(TARGET_SCREEN_WIDTH),)
+TARGET_SCREEN_WIDTH := $(word 2, $(TARGET_SCREEN_DIMENSIONS))
+endif
+ifeq ($(TARGET_SCREEN_HEIGHT),)
+TARGET_SCREEN_HEIGHT := $(word 3, $(TARGET_SCREEN_DIMENSIONS))
+endif
+endif
+
+ifneq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space))
+
+# clear TARGET_BOOTANIMATION_NAME in case it was set for CM9 purposes
+TARGET_BOOTANIMATION_NAME :=
+
+# determine the smaller dimension
+TARGET_BOOTANIMATION_SIZE := $(shell \
+  if [ $(TARGET_SCREEN_WIDTH) -lt $(TARGET_SCREEN_HEIGHT) ]; then \
+    echo $(TARGET_SCREEN_WIDTH); \
+  else \
+    echo $(TARGET_SCREEN_HEIGHT); \
+  fi )
+
+# get a sorted list of the sizes
+bootanimation_sizes := $(subst .zip,, $(shell ls vendor/cm/prebuilt/common/bootanimation))
+bootanimation_sizes := $(shell echo -e $(subst $(space),'\n',$(bootanimation_sizes)) | sort -rn)
+
+# find the appropriate size and set
+define check_and_set_bootanimation
+$(eval TARGET_BOOTANIMATION_NAME := $(shell \
+  if [ -z "$(TARGET_BOOTANIMATION_NAME)" ]; then
+    if [ $(1) -le $(TARGET_BOOTANIMATION_SIZE) ]; then \
+      echo $(1); \
+      exit 0; \
+    fi;
+  fi;
+  echo $(TARGET_BOOTANIMATION_NAME); ))
+endef
+$(foreach size,$(bootanimation_sizes), $(call check_and_set_bootanimation,$(size)))
+
+PRODUCT_COPY_FILES += \
+    vendor/cm/prebuilt/common/bootanimation/$(TARGET_BOOTANIMATION_NAME).zip:system/media/bootanimation.zip
 endif
 
 ifdef CM_NIGHTLY
diff --git a/config/common_full_phone.mk b/config/common_full_phone.mk
index 5ee0f7d..f764ce0 100644
--- a/config/common_full_phone.mk
+++ b/config/common_full_phone.mk
@@ -27,7 +27,7 @@
     system/bluetooth/data/main.conf:system/etc/bluetooth/main.conf
 
 
-ifeq ($(TARGET_BOOTANIMATION_NAME),)
+ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space))
     PRODUCT_COPY_FILES += \
-        vendor/cm/prebuilt/common/bootanimation/vertical-480x800.zip:system/media/bootanimation.zip
+        vendor/cm/prebuilt/common/bootanimation/480.zip:system/media/bootanimation.zip
 endif
diff --git a/config/common_full_tablet_wifionly.mk b/config/common_full_tablet_wifionly.mk
index 963dfd7..fd0ef2e 100644
--- a/config/common_full_tablet_wifionly.mk
+++ b/config/common_full_tablet_wifionly.mk
@@ -23,7 +23,7 @@
 PRODUCT_COPY_FILES += \
     system/bluetooth/data/main.nonsmartphone.conf:system/etc/bluetooth/main.conf
 
-ifeq ($(TARGET_BOOTANIMATION_NAME),)
+ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space))
     PRODUCT_COPY_FILES += \
-        vendor/cm/prebuilt/common/bootanimation/horizontal-1280x800.zip:system/media/bootanimation.zip
+        vendor/cm/prebuilt/common/bootanimation/800.zip:system/media/bootanimation.zip
 endif
diff --git a/config/common_mini_phone.mk b/config/common_mini_phone.mk
index 43bbe61..6c939da 100644
--- a/config/common_mini_phone.mk
+++ b/config/common_mini_phone.mk
@@ -16,7 +16,7 @@
 PRODUCT_PACKAGES += \
   Mms
 
-ifeq ($(TARGET_BOOTANIMATION_NAME),)
+ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space))
     PRODUCT_COPY_FILES += \
-        vendor/cm/prebuilt/common/bootanimation/vertical-320x480.zip:system/media/bootanimation.zip
+        vendor/cm/prebuilt/common/bootanimation/320.zip:system/media/bootanimation.zip
 endif
diff --git a/prebuilt/common/bootanimation/1200.zip b/prebuilt/common/bootanimation/1200.zip
new file mode 100644
index 0000000..4cb7c60
--- /dev/null
+++ b/prebuilt/common/bootanimation/1200.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/240.zip b/prebuilt/common/bootanimation/240.zip
new file mode 100644
index 0000000..072c9cb
--- /dev/null
+++ b/prebuilt/common/bootanimation/240.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/320.zip b/prebuilt/common/bootanimation/320.zip
new file mode 100644
index 0000000..17b8e9b
--- /dev/null
+++ b/prebuilt/common/bootanimation/320.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/360.zip b/prebuilt/common/bootanimation/360.zip
new file mode 100644
index 0000000..bfc64d7
--- /dev/null
+++ b/prebuilt/common/bootanimation/360.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/480.zip b/prebuilt/common/bootanimation/480.zip
new file mode 100644
index 0000000..66965ba
--- /dev/null
+++ b/prebuilt/common/bootanimation/480.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/540.zip b/prebuilt/common/bootanimation/540.zip
new file mode 100644
index 0000000..7c1cf17
--- /dev/null
+++ b/prebuilt/common/bootanimation/540.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/600.zip b/prebuilt/common/bootanimation/600.zip
new file mode 100644
index 0000000..813bbab
--- /dev/null
+++ b/prebuilt/common/bootanimation/600.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/720.zip b/prebuilt/common/bootanimation/720.zip
new file mode 100644
index 0000000..b0bb2f8
--- /dev/null
+++ b/prebuilt/common/bootanimation/720.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/768.zip b/prebuilt/common/bootanimation/768.zip
new file mode 100644
index 0000000..445af65
--- /dev/null
+++ b/prebuilt/common/bootanimation/768.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/800.zip b/prebuilt/common/bootanimation/800.zip
new file mode 100644
index 0000000..f2848f2
--- /dev/null
+++ b/prebuilt/common/bootanimation/800.zip
Binary files differ
diff --git a/prebuilt/common/bootanimation/horizontal-1024x600.zip b/prebuilt/common/bootanimation/horizontal-1024x600.zip
deleted file mode 100644
index 39719b9..0000000
--- a/prebuilt/common/bootanimation/horizontal-1024x600.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/horizontal-1024x768.zip b/prebuilt/common/bootanimation/horizontal-1024x768.zip
deleted file mode 100644
index 8acd579..0000000
--- a/prebuilt/common/bootanimation/horizontal-1024x768.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/horizontal-1280x800.zip b/prebuilt/common/bootanimation/horizontal-1280x800.zip
deleted file mode 100644
index df81101..0000000
--- a/prebuilt/common/bootanimation/horizontal-1280x800.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-240x320.zip b/prebuilt/common/bootanimation/vertical-240x320.zip
deleted file mode 100644
index ef71e63..0000000
--- a/prebuilt/common/bootanimation/vertical-240x320.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-320x480.zip b/prebuilt/common/bootanimation/vertical-320x480.zip
deleted file mode 100644
index 98af716..0000000
--- a/prebuilt/common/bootanimation/vertical-320x480.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-480x800.zip b/prebuilt/common/bootanimation/vertical-480x800.zip
deleted file mode 100644
index 982d300..0000000
--- a/prebuilt/common/bootanimation/vertical-480x800.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-480x854.zip b/prebuilt/common/bootanimation/vertical-480x854.zip
deleted file mode 100644
index ed55044..0000000
--- a/prebuilt/common/bootanimation/vertical-480x854.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-540x960.zip b/prebuilt/common/bootanimation/vertical-540x960.zip
deleted file mode 100644
index 8825cbc..0000000
--- a/prebuilt/common/bootanimation/vertical-540x960.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-600x1024.zip b/prebuilt/common/bootanimation/vertical-600x1024.zip
deleted file mode 100644
index 6494905..0000000
--- a/prebuilt/common/bootanimation/vertical-600x1024.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-720x1280.zip b/prebuilt/common/bootanimation/vertical-720x1280.zip
deleted file mode 100644
index f26da91..0000000
--- a/prebuilt/common/bootanimation/vertical-720x1280.zip
+++ /dev/null
Binary files differ
diff --git a/prebuilt/common/bootanimation/vertical-800x1280.zip b/prebuilt/common/bootanimation/vertical-800x1280.zip
deleted file mode 100644
index df56964..0000000
--- a/prebuilt/common/bootanimation/vertical-800x1280.zip
+++ /dev/null
Binary files differ