summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/inputmethod
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2015-06-03 15:58:59 -0700
committerYohei Yukawa <yukawa@google.com>2015-06-03 15:58:59 -0700
commit02df328f0cd12f2af87ca96ecf5819c8a3470dc8 (patch)
tree292b9158478e1cfde581d9ca7e31ac1f256bb245 /core/java/android/view/inputmethod
parentc52e0d900cc6f7ca60c7079ab50297b4a4b0c426 (diff)
downloadframeworks_base-02df328f0cd12f2af87ca96ecf5819c8a3470dc8.zip
frameworks_base-02df328f0cd12f2af87ca96ecf5819c8a3470dc8.tar.gz
frameworks_base-02df328f0cd12f2af87ca96ecf5819c8a3470dc8.tar.bz2
Report EditorInfo#packageName based on the actual uid.
This is a follow up CL for Ib871141e3381e45c2623c5f4d692da7a7e78fcc5, which introduced a verification mechanism between the applicaiton uid and EditorInfo#packageName reported from the application by using AppOpsManager#checkPackage. Regression Bug 21408239 caused by above change is really similar to the situation we saw in Bug 10688644. As well explained in the CL description of Ic04f77b3938585b02fccabbc12d2f0dc62b9ef25, the system has a special ability to run in the processes of other uids. Hence we need to use Context#getOpPackageName() instead of Context#getPackageName() in case components declared by the system is loaded into another process. Bug: 18931038 Bug: 21408239 Change-Id: I78510a2ea6ac06cfd5813a23c42f09f70c468493
Diffstat (limited to 'core/java/android/view/inputmethod')
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 053b35c..1c8a79b 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -1169,7 +1169,10 @@ public final class InputMethodManager {
// do its stuff.
// Life is good: let's hook everything up!
EditorInfo tba = new EditorInfo();
- tba.packageName = view.getContext().getPackageName();
+ // Note: Use Context#getOpPackageName() rather than Context#getPackageName() so that the
+ // system can verify the consistency between the uid of this process and package name passed
+ // from here. See comment of Context#getOpPackageName() for details.
+ tba.packageName = view.getContext().getOpPackageName();
tba.fieldId = view.getId();
InputConnection ic = view.onCreateInputConnection(tba);
if (DEBUG) Log.v(TAG, "Starting input: tba=" + tba + " ic=" + ic);