From 02af3ea1322683aaa894bbbf6a1a5c526aaa2063 Mon Sep 17 00:00:00 2001 From: Jesse Evans Date: Wed, 3 May 2017 09:57:16 -0700 Subject: [PATCH] Grant ephemeral app access during service bind Currently we only grant ephemeral access during sendServiceArgs, but since bindService does not actually send service arguments the code path to grant ephemeral access is not currently hit. This change grants ephemeral access during bindServiceLocked after the association between the calling app and the target service has been established. Test: existing tests. Bug: 37766185 Change-Id: I64847a2dcaf1255c0a7d663c4461cda62655a8d0 --- services/core/java/com/android/server/am/ActiveServices.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index e0fc531eb326a..43135334ba74f 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -1258,6 +1258,10 @@ public final class ActiveServices { mAm.startAssociationLocked(callerApp.uid, callerApp.processName, callerApp.curProcState, s.appInfo.uid, s.name, s.processName); + // Once the apps have become associated, if one of them is caller is ephemeral + // the target app should now be able to see the calling app + mAm.grantEphemeralAccessLocked(callerApp.userId, service, + s.appInfo.uid, UserHandle.getAppId(callerApp.uid)); AppBindRecord b = s.retrieveAppBindingLocked(service, callerApp); ConnectionRecord c = new ConnectionRecord(b, activity,