omni: add lato font overlay

add file fonts_customization.xml to allow using
fonts in /product/fonts

Change-Id: Icee8715f9960ac7b27daeebb393d4b28b1848df6
diff --git a/config/common.mk b/config/common.mk
index 71396c1..351fc52 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -102,6 +102,9 @@
 OMNI_PRODUCT_PROPERTIES += \
     ro.services.whitelist.packagelist=com.google.android.gms
 
+PRODUCT_COPY_FILES += \
+    vendor/omni/prebuilt/etc/fonts_customization.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/fonts_customization.xml
+
 # Additional packages
 -include vendor/omni/config/packages.mk
 
diff --git a/config/packages.mk b/config/packages.mk
index 13f7e21..f9f171d 100644
--- a/config/packages.mk
+++ b/config/packages.mk
@@ -74,3 +74,5 @@
 PRODUCT_PACKAGES_ENG += \
     bash \
     su
+
+$(call inherit-product-if-exists, external/google-fonts/lato/fonts.mk)
diff --git a/prebuilt/etc/fonts_customization.xml b/prebuilt/etc/fonts_customization.xml
new file mode 100644
index 0000000..5d1024b
--- /dev/null
+++ b/prebuilt/etc/fonts_customization.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<fonts-modification>
+    <family name="lato" customizationType="new-named-family">
+        <font weight="400" style="normal">Lato-Regular.ttf</font>
+        <font weight="400" style="italic">Lato-Italic.ttf</font>
+        <font weight="500" style="normal">Lato-Medium.ttf</font>
+        <font weight="500" style="italic">Lato-MediumItalic.ttf</font>
+        <font weight="700" style="normal">Lato-Bold.ttf</font>
+        <font weight="700" style="italic">Lato-BoldItalic.ttf</font>
+    </family>
+    <alias name="lato-semi-bold" to="lato" weight="500" />
+    <alias name="lato-bold" to="lato" weight="700" />
+</fonts-modification>
diff --git a/themes/overlays/Android.mk b/themes/overlays/Android.mk
index 4c9f0d4..80da163 100644
--- a/themes/overlays/Android.mk
+++ b/themes/overlays/Android.mk
@@ -24,7 +24,8 @@
 	PrimaryColorOmniBlackOverlay \
 	PrimaryColorDarkBlueOverlay \
 	PrimaryColorDeepBlueOverlay \
-	AccentColorRedDevilOverlay
+	AccentColorRedDevilOverlay \
+	FontLatoSourceOverlay
 
 include $(BUILD_PHONY_PACKAGE)
 include $(CLEAR_VARS)
diff --git a/themes/overlays/FontLatoSourceOverlay/Android.mk b/themes/overlays/FontLatoSourceOverlay/Android.mk
new file mode 100644
index 0000000..7e18d1a
--- /dev/null
+++ b/themes/overlays/FontLatoSourceOverlay/Android.mk
@@ -0,0 +1,31 @@
+#
+#  Copyright 2019, The Android Open Source 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := FontLatoSource
+
+LOCAL_PRODUCT_MODULE := true
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := FontLatoSourceOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/themes/overlays/FontLatoSourceOverlay/AndroidManifest.xml b/themes/overlays/FontLatoSourceOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..c2f7d24
--- /dev/null
+++ b/themes/overlays/FontLatoSourceOverlay/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<!--
+/**
+ * Copyright (c) 2019, The Android Open Source 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.theme.font.latosource"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android"
+        android:category="android.theme.customization.font"
+        android:priority="1"/>
+
+    <application android:label="@string/font_lato_source_overlay" android:hasCode="false">
+        <meta-data
+            android:name="android.theme.customization.REQUIRED_SYSTEM_FONTS"
+            android:value="lato,lato-semi-bold,lato-bold" />
+    </application>
+</manifest>
diff --git a/themes/overlays/FontLatoSourceOverlay/res/values/config.xml b/themes/overlays/FontLatoSourceOverlay/res/values/config.xml
new file mode 100644
index 0000000..9ec6a1c
--- /dev/null
+++ b/themes/overlays/FontLatoSourceOverlay/res/values/config.xml
@@ -0,0 +1,28 @@
+<!--
+/**
+ * Copyright (c) 2019, The Android Open Source 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+     <!-- Name of a font family to use for body text. -->
+    <string name="config_bodyFontFamily" translatable="false">lato</string>
+    <!-- Name of a font family to use for medium body text. -->
+    <string name="config_bodyFontFamilyMedium" translatable="false">lato-semi-bold</string>
+    <!-- Name of a font family to use for headlines. If empty, falls back to platform default -->
+    <string name="config_headlineFontFamily" translatable="false">lato-bold</string>
+    <!-- Name of the font family used for system surfaces where the font should use medium weight -->
+    <string name="config_headlineFontFamilyMedium" translatable="false">lato-semi-bold</string>
+</resources>
+
diff --git a/themes/overlays/FontLatoSourceOverlay/res/values/strings.xml b/themes/overlays/FontLatoSourceOverlay/res/values/strings.xml
new file mode 100644
index 0000000..3089d24
--- /dev/null
+++ b/themes/overlays/FontLatoSourceOverlay/res/values/strings.xml
@@ -0,0 +1,21 @@
+<!--
+/**
+ * Copyright (c) 2019, The Android Open Source 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Lato overlay -->
+    <string name="font_lato_source_overlay" translatable="false">Lato</string>
+</resources>