From 2e667f876029ebe0da709dcd116f15111bfacd07 Mon Sep 17 00:00:00 2001 From: "an.xi" Date: Fri, 29 Jan 2021 04:19:37 -0500 Subject: [PATCH] cec: fix Traditional Chinese issue for Playback [1/1] BUG:183071276 PD#SWPL-42449 Problem: The locale selected for Simplified Chinese "zho" is Taiwan, the language of which is Traditional Chinese. Solution: Use "bibliographic" code defined in CEC639-2 for traditional Chinese used in Taiwan/Hong Kong/Macau. Verify: newton Change-Id: I7466a924d64c00241b04b1b7eb6999174e3a5471 Signed-off-by: an.xi --- .../com/android/server/hdmi/HdmiCecLocalDevicePlayback.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java index 40718585c484f..17874a7cc84b3 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java @@ -274,7 +274,9 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource { try { String iso3Language = new String(message.getParams(), 0, 3, "US-ASCII"); Locale currentLocale = mService.getContext().getResources().getConfiguration().locale; - if (currentLocale.getISO3Language().equals(iso3Language)) { + String curIso3Language = mService.localeToMenuLanguage(currentLocale); + HdmiLogger.debug("handleSetMenuLanguage " + iso3Language + " cur:" + curIso3Language); + if (curIso3Language.equals(iso3Language)) { // Do not switch language if the new language is the same as the current one. // This helps avoid accidental country variant switching from en_US to en_AU // due to the limitation of CEC. See the warning below. @@ -286,7 +288,7 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource { final List localeInfos = LocalePicker.getAllAssetLocales( mService.getContext(), false); for (LocaleInfo localeInfo : localeInfos) { - if (localeInfo.getLocale().getISO3Language().equals(iso3Language)) { + if (mService.localeToMenuLanguage(localeInfo.getLocale()).equals(iso3Language)) { // WARNING: CEC adopts ISO/FDIS-2 for language code, while Android requires // additional country variant to pinpoint the locale. This keeps the right // locale from being chosen. 'eng' in the CEC command, for instance,