Merge "hikey: Fix fstab.hikey-3.18 to not mount cache partition"
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 1fc7129..9193abc 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -13,9 +13,13 @@
     $(LOCAL_DIR)/hikey.mk \
     $(LOCAL_DIR)/hikey32.mk \
     $(LOCAL_DIR)/hikey64_only.mk \
-    $(LOCAL_DIR)/hikey960.mk
+    $(LOCAL_DIR)/hikey_tv.mk \
+    $(LOCAL_DIR)/hikey960.mk \
+    $(LOCAL_DIR)/hikey960_tv.mk
 
 COMMON_LUNCH_CHOICES := \
     hikey-userdebug \
     hikey64_only-userdebug \
-    hikey960-userdebug
+    hikey_tv-userdebug \
+    hikey960-userdebug \
+    hikey960_tv-userdebug
diff --git a/device-common.mk b/device-common.mk
index 4da1c08..b07047f 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -14,14 +14,27 @@
 # limitations under the License.
 #
 
+ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
+# Setup TV Build
+USE_OEM_TV_APP := true
+$(call inherit-product, device/google/atv/products/atv_base.mk)
+PRODUCT_CHARACTERISTICS := tv
+PRODUCT_AAPT_PREF_CONFIG := tvdpi
+PRODUCT_IS_ATV := true
+else
 # Adjust the dalvik heap to be appropriate for a tablet.
 $(call inherit-product-if-exists, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)
+endif
 
 # Set vendor kernel path
 PRODUCT_VENDOR_KERNEL_HEADERS := device/linaro/hikey/kernel-headers
 
 # Set custom settings
 DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
+ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
+# Set TV Custom Settings
+DEVICE_PACKAGE_OVERLAYS += device/google/atv/overlay
+endif
 
 #Force navkeys on
 PRODUCT_PROPERTY_OVERRIDES += qemu.hw.mainkeys=0
@@ -147,8 +160,28 @@
 
 endif
 
+
+ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
+# TV Specific Packages
+PRODUCT_PACKAGES += \
+    TvSettings \
+    LiveTv \
+    google-tv-pairing-protocol \
+    TvProvision \
+    LeanbackSampleApp \
+    TvSampleLeanbackLauncher \
+    TvProvider \
+    SettingsIntelligence \
+    tv_input.default \
+    com.android.media.tv.remoteprovider \
+    InputDevices
+PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=260
+else
+
 # Use Launcher3QuickStep
 PRODUCT_PACKAGES += Launcher3QuickStep
+PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=160
+endif
 
 # Copy hardware config file(s)
 PRODUCT_COPY_FILES +=  \
diff --git a/hikey.mk b/hikey.mk
index 14a2e92..c723f2d 100644
--- a/hikey.mk
+++ b/hikey.mk
@@ -8,6 +8,8 @@
 PRODUCT_SUPPORTS_BOOT_SIGNER := false
 PRODUCT_SUPPORTS_VERITY_FEC := false
 
+PRODUCT_PROPERTY_OVERRIDES += ro.opengles.version=131072
+
 PRODUCT_NAME := hikey
 PRODUCT_DEVICE := hikey
 PRODUCT_BRAND := Android
diff --git a/hikey960.mk b/hikey960.mk
index 57ef5a4..7847ff9 100644
--- a/hikey960.mk
+++ b/hikey960.mk
@@ -30,6 +30,8 @@
 PRODUCT_SUPPORTS_BOOT_SIGNER := false
 PRODUCT_SUPPORTS_VERITY_FEC := false
 
+PRODUCT_PROPERTY_OVERRIDES += ro.opengles.version=196608
+
 #
 # Overrides
 PRODUCT_NAME := hikey960
diff --git a/hikey960_tv.mk b/hikey960_tv.mk
new file mode 100644
index 0000000..7c9b8de
--- /dev/null
+++ b/hikey960_tv.mk
@@ -0,0 +1,10 @@
+#
+# Inherit the full_base and device configurations
+$(call inherit-product, device/linaro/hikey/hikey960.mk)
+
+#
+# Overrides
+PRODUCT_NAME := hikey960_tv
+PRODUCT_DEVICE := hikey960
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP TV on hikey960
diff --git a/hikey_tv.mk b/hikey_tv.mk
new file mode 100644
index 0000000..c55a4ea
--- /dev/null
+++ b/hikey_tv.mk
@@ -0,0 +1,10 @@
+#
+# Inherit the full_base and device configurations
+$(call inherit-product, device/linaro/hikey/hikey.mk)
+
+#
+# Overrides
+PRODUCT_NAME := hikey_tv
+PRODUCT_DEVICE := hikey
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP TV on hikey
diff --git a/init.common.rc b/init.common.rc
index 705a66e..6d66ca7 100644
--- a/init.common.rc
+++ b/init.common.rc
@@ -53,11 +53,7 @@
     setprop status.battery.level_raw  50
     setprop status.battery.level_scale 9
 
-# Set Display density
-    setprop ro.sf.lcd_density 160
-
 # Set supported opengles version
-    setprop ro.opengles.version 196608
     setprop ro.hardware.hwcomposer drm
 
 # If an app forces screen rotation, revert it once the apps closes