From bb8aa5a1e9513d27700c9ac9f81d263c7a9ceeb1 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 17 Sep 2014 13:20:38 -0700 Subject: [PATCH] Work on issue #17506095: Add ability to lock IME for specified apps Add a new configuration to speciify apps that partcipate in the feature. Change-Id: I8f5139b5ea09e758bff4472b2294df8becc74614 --- .../java/com/android/server/SystemConfig.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java index fdcb3b9029e53..cf2a49f922e2f 100644 --- a/services/core/java/com/android/server/SystemConfig.java +++ b/services/core/java/com/android/server/SystemConfig.java @@ -50,19 +50,16 @@ public class SystemConfig { // These are the built-in uid -> permission mappings that were read from the // system configuration files. - final SparseArray> mSystemPermissions = - new SparseArray>(); + final SparseArray> mSystemPermissions = new SparseArray<>(); // These are the built-in shared libraries that were read from the // system configuration files. Keys are the library names; strings are the // paths to the libraries. - final ArrayMap mSharedLibraries - = new ArrayMap(); + final ArrayMap mSharedLibraries = new ArrayMap<>(); // These are the features this devices supports that were read from the // system configuration files. - final HashMap mAvailableFeatures = - new HashMap(); + final HashMap mAvailableFeatures = new HashMap<>(); public static final class PermissionEntry { public final String name; @@ -75,12 +72,14 @@ public class SystemConfig { // These are the permission -> gid mappings that were read from the // system configuration files. - final ArrayMap mPermissions = - new ArrayMap(); + final ArrayMap mPermissions = new ArrayMap<>(); // These are the packages that are white-listed to be able to run in the // background while in power save mode, as read from the configuration files. - final ArraySet mAllowInPowerSave = new ArraySet(); + final ArraySet mAllowInPowerSave = new ArraySet<>(); + + // These are the app package names that should not allow IME switching. + final ArraySet mFixedImeApps = new ArraySet<>(); public static SystemConfig getInstance() { synchronized (SystemConfig.class) { @@ -115,6 +114,10 @@ public class SystemConfig { return mAllowInPowerSave; } + public ArraySet getFixedImeApps() { + return mFixedImeApps; + } + SystemConfig() { // Read configuration from system readPermissions(Environment.buildPath( @@ -298,6 +301,17 @@ public class SystemConfig { XmlUtils.skipCurrentTag(parser); continue; + } else if ("fixed-ime-app".equals(name)) { + String pkgname = parser.getAttributeValue(null, "package"); + if (pkgname == null) { + Slog.w(TAG, " without package at " + + parser.getPositionDescription()); + } else { + mFixedImeApps.add(pkgname); + } + XmlUtils.skipCurrentTag(parser); + continue; + } else { XmlUtils.skipCurrentTag(parser); continue;