summaryrefslogtreecommitdiffstats
path: root/services/java/com
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-07-18 11:11:42 +0900
committersatok <satok@google.com>2011-07-19 04:59:48 +0900
commit91e88122cf28a48fd2e2260da7d3d87dd437227a (patch)
treeb448f50dfd296574e5dabc6a9393624ad4a39868 /services/java/com
parentbd029f64f2c695d49ea169f4c5c107e8172a1de5 (diff)
downloadframeworks_base-91e88122cf28a48fd2e2260da7d3d87dd437227a.zip
frameworks_base-91e88122cf28a48fd2e2260da7d3d87dd437227a.tar.gz
frameworks_base-91e88122cf28a48fd2e2260da7d3d87dd437227a.tar.bz2
Enable IMEs to set additional subtypes in background
Bug: 4591792 Change-Id: I7e61a576c56d1a3a56001bdf2fd51ad3801add01
Diffstat (limited to 'services/java/com')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 18d393f..1a2cecd 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -47,6 +47,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
@@ -1632,19 +1633,27 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
@Override
- public boolean setAdditionalInputMethodSubtypes(IBinder token, InputMethodSubtype[] subtypes) {
- if (token == null || mCurToken != token) {
- return false;
- }
- if (subtypes == null || subtypes.length == 0) return false;
+ public boolean setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
+ // By this IPC call, only a process which shares the same uid with the IME can add
+ // additional input method subtypes to the IME.
+ if (TextUtils.isEmpty(imiId) || subtypes == null || subtypes.length == 0) return false;
synchronized (mMethodMap) {
- final InputMethodInfo imi = mMethodMap.get(mCurMethodId);
+ final InputMethodInfo imi = mMethodMap.get(imiId);
if (imi == null) return false;
- final int N = subtypes.length;
- mFileManager.addInputMethodSubtypes(imi, subtypes);
- buildInputMethodListLocked(mMethodList, mMethodMap);
- return true;
+ final PackageManager pm = mContext.getPackageManager();
+ final String[] packageInfos = pm.getPackagesForUid(Binder.getCallingUid());
+ if (packageInfos != null) {
+ final int packageNum = packageInfos.length;
+ for (int i = 0; i < packageNum; ++i) {
+ if (packageInfos[i].equals(imi.getPackageName())) {
+ mFileManager.addInputMethodSubtypes(imi, subtypes);
+ buildInputMethodListLocked(mMethodList, mMethodMap);
+ return true;
+ }
+ }
+ }
}
+ return false;
}
private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) {