summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-06-11 20:19:22 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-11 20:19:22 +0000
commit37fae4d72e98bcd639dbcb4319c9bd2b7c0a46fc (patch)
tree75f7d7077a9a997d1a13829940e58e468589ee0f
parente640bbf9192ad7550cb7aab7dcb36f53b0684893 (diff)
parent724c5bb8afaf4ea81f421c854117c30107225b96 (diff)
Merge "Allow the active IME to see the target app package" into rvc-dev
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index a498e3867c05..65a13016c9b6 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -2352,6 +2352,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mImeTargetWindowMap.put(startInputToken, mCurFocusedWindow);
mStartInputHistory.addEntry(info);
+ // Seems that PackageManagerInternal#grantImplicitAccess() doesn't handle cross-user
+ // implicit visibility (e.g. IME[user=10] -> App[user=0]) thus we do this only for the
+ // same-user scenarios.
+ // That said ignoring cross-user scenario will never affect IMEs that do not have
+ // INTERACT_ACROSS_USERS(_FULL) permissions, which is actually almost always the case.
+ if (mSettings.getCurrentUserId() == UserHandle.getUserId(mCurClient.uid)) {
+ mPackageManagerInternal.grantImplicitAccess(mSettings.getCurrentUserId(),
+ null /* intent */, UserHandle.getAppId(mCurMethodUid), mCurClient.uid, true);
+ }
+
final SessionState session = mCurClient.curSession;
executeOrSendMessage(session.method, mCaller.obtainMessageIIOOOO(
MSG_START_INPUT, mCurInputContextMissingMethods, initial ? 0 : 1 /* restarting */,