pa: Ship Google Sans font family as overlay

This adds support for custom fonts starting with Google Sans, making it an opt-in overlay

Change-Id: Id281d447d9d581c408196abd16b8fed60b6682f8
This commit is contained in:
Chris Crump 2019-10-28 21:21:46 -04:00
parent 3e3264a7aa
commit 8cafec331b
13 changed files with 126 additions and 1 deletions

View File

@ -78,6 +78,11 @@ PRODUCT_COPY_FILES += \
vendor/pa/config/permissions/privapp-permissions-pa-system.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-pa.xml \
vendor/pa/config/permissions/privapp-permissions-pa-product.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-pa.xml
# Fonts
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,vendor/pa/prebuilt/fonts,$(TARGET_COPY_OUT_PRODUCT)/fonts) \
vendor/pa/prebuilt/etc/fonts_customization.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/fonts_customization.xml
# Enforce privapp-permissions whitelist
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
ro.control_privapp_permissions=enforce

View File

@ -18,7 +18,8 @@ include $(CLEAR_VARS)
LOCAL_MODULE := pa-overlays
LOCAL_REQUIRED_MODULES := \
AccentColorPixelBlueOverlay \
AccentColorTealOverlay
AccentColorTealOverlay \
FontGoogleSansOverlay
include $(BUILD_PHONY_PACKAGE)
include $(call first-makefiles-under,$(LOCAL_PATH))

View File

@ -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 := FontGoogleSans
LOCAL_PRODUCT_MODULE := true
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := FontGoogleSansOverlay
LOCAL_SDK_VERSION := current
include $(BUILD_RRO_PACKAGE)

View File

@ -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.googlesans"
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_google_sans_overlay" android:hasCode="false">
<meta-data
android:name="android.theme.customization.REQUIRED_SYSTEM_FONTS"
android:value="google-sans,google-sans-medium" />
</application>
</manifest>

View File

@ -0,0 +1,25 @@
<!--
/**
* 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 headlines. If empty, falls back to platform default -->
<string name="config_headlineFontFamily">google-sans</string>
<!-- Name of the font family used for system surfaces where the font should use medium weight -->
<string name="config_headlineFontFamilyMedium">google-sans-medium</string>
<string name="config_headlineFontFeatureSettings">ss03</string>
</resources>

View File

@ -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">
<!-- Headline / Google Sans overlay -->
<string name="font_google_sans_overlay" translatable="false">Google Sans</string>
</resources>

View File

@ -0,0 +1,11 @@
<fonts-modification version="1">
<family customizationType="new-named-family" name="google-sans">
<font weight="400" style="normal">GoogleSans-Regular.ttf</font>
<font weight="400" style="italic">GoogleSans-Italic.ttf</font>
<font weight="500" style="normal">GoogleSans-Medium.ttf</font>
<font weight="500" style="italic">GoogleSans-MediumItalic.ttf</font>
<font weight="700" style="normal">GoogleSans-Bold.ttf</font>
<font weight="700" style="italic">GoogleSans-BoldItalic.ttf</font>
</family>
<alias name="google-sans-medium" to="google-sans" weight="500" />
</fonts-modification>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.