summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/hdmi
diff options
context:
space:
mode:
authorJinsuk Kim <jinsukkim@google.com>2015-07-10 13:01:06 +0900
committerJinsuk Kim <jinsukkim@google.com>2015-07-10 13:06:20 +0900
commit8ea452e3f6e85ed847ef6461b3969c889017b277 (patch)
treef7e8a0ec19acdd4ec4ba02f6170f012dcb08f39b /services/core/java/com/android/server/hdmi
parente42441a232ae1a75cdd2541f974ed8da258b97cd (diff)
downloadframeworks_base-8ea452e3f6e85ed847ef6461b3969c889017b277.zip
frameworks_base-8ea452e3f6e85ed847ef6461b3969c889017b277.tar.gz
frameworks_base-8ea452e3f6e85ed847ef6461b3969c889017b277.tar.bz2
CEC: Do not switch language if the new one is same as the old one
Do not switch language if the new language is the same as the current one. This helps avoid accidental country variant switching such as from en_US to en_AU due to the limitation of CEC. Bug: 22373619 Change-Id: Ia98aff67e37b470b3f550a5c097e8140c1a51ecf
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
index 493471b..3c35f5e 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
@@ -33,6 +33,7 @@ import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly;
import java.io.UnsupportedEncodingException;
import java.util.List;
+import java.util.Locale;
/**
* Represent a logical device of type Playback residing in Android system.
@@ -317,6 +318,13 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice {
try {
String iso3Language = new String(message.getParams(), 0, 3, "US-ASCII");
+ Locale currentLocale = mService.getContext().getResources().getConfiguration().locale;
+ if (currentLocale.getISO3Language().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.
+ return true;
+ }
// Don't use Locale.getAvailableLocales() since it returns a locale
// which is not available on Settings.