Add key character maps to layoutlib dist files

This makes key character map files from the framework part of the
layoutlib artifacts so that they can be used in Android Studio to
handle platform key events.

Bug: 255328531
Test: N/A
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1894ff5c78ca33be85d983d28be42870bac0bed0)
Merged-In: I147159912f85daafc97364468d6a6c2cfa3916b8
Change-Id: I147159912f85daafc97364468d6a6c2cfa3916b8

NOTE FOR REVIEWERS - errors occurred while applying the patch.
PLEASE REVIEW CAREFULLY.
Errors:
Error applying patch in core/Makefile, hunk HunkHeader[7006,8->7006,8]: Hunk cannot be applied

Original patch:
 From 1894ff5c78ca33be85d983d28be42870bac0bed0 Mon Sep 17 00:00:00 2001
From: Jerome Gaillard <jgaillard@google.com>
Date: Mon, 24 Oct 2022 16:30:25 +0100
Subject: [PATCH] Add key character maps to layoutlib dist files

This makes key character map files from the framework part of the
layoutlib artifacts so that they can be used in Android Studio to
handle platform key events.

Bug: 255328531
Test: N/A
Change-Id: I147159912f85daafc97364468d6a6c2cfa3916b8
---
This commit is contained in:
Jerome Gaillard 2023-10-25 00:05:12 +00:00 committed by Wei Li
parent 4c09638237
commit ea9dab478c
2 changed files with 18 additions and 6 deletions

View file

@ -7676,7 +7676,7 @@ $(call dist-for-goals,haiku-presubmit,$(SOONG_PRESUBMIT_FUZZ_PACKAGING_ARCH_MODU
# -----------------------------------------------------------------
# Extract platform fonts used in Layoutlib
include $(BUILD_SYSTEM)/layoutlib_fonts.mk
include $(BUILD_SYSTEM)/layoutlib_data.mk
# -----------------------------------------------------------------

View file

@ -1,4 +1,4 @@
# Fonts for layoutlib
# Data files for layoutlib
FONT_TEMP := $(call intermediates-dir-for,PACKAGING,fonts,HOST,COMMON)
@ -21,13 +21,25 @@ $(fonts_device): $(FONT_TEMP)/%: $(TARGET_OUT)/fonts/%
$(hide) mkdir -p $(dir $@)
$(hide) cp -vf $< $@
# List of all dependencies - all fonts and configuration files.
FONT_FILES := $(fonts_device) $(font_config)
KEYBOARD_TEMP := $(call intermediates-dir-for,PACKAGING,keyboards,HOST,COMMON)
# The key character map files needed for supporting KeyEvent
keyboards := $(sort $(wildcard frameworks/base/data/keyboards/*.kcm))
keyboards := $(addprefix $(KEYBOARD_TEMP)/, $(notdir $(keyboards)))
$(keyboards): $(KEYBOARD_TEMP)/%.kcm: frameworks/base/data/keyboards/%.kcm
$(hide) mkdir -p $(dir $@)
$(hide) cp -vf $< $@
# List of all data files - font files, font configuration files, key character map files
LAYOUTLIB_FILES := $(fonts_device) $(font_config) $(keyboards)
.PHONY: layoutlib layoutlib-tests
layoutlib layoutlib-tests: $(FONT_FILES)
layoutlib layoutlib-tests: $(LAYOUTLIB_FILES)
$(call dist-for-goals, layoutlib, $(foreach m,$(FONT_FILES), $(m):layoutlib_native/fonts/$(notdir $(m))))
$(call dist-for-goals, layoutlib, $(foreach m,$(fonts_device), $(m):layoutlib_native/fonts/$(notdir $(m))))
$(call dist-for-goals, layoutlib, $(foreach m,$(font_config), $(m):layoutlib_native/fonts/$(notdir $(m))))
$(call dist-for-goals, layoutlib, $(foreach m,$(keyboards), $(m):layoutlib_native/keyboards/$(notdir $(m))))
FONT_TEMP :=
font_config :=