OSDN Git Service

Clear/restore calling identity for ChooserTargetService
authorAdam Powell <adamp@google.com>
Fri, 29 Jan 2016 22:51:02 +0000 (14:51 -0800)
committerAdam Powell <adamp@google.com>
Fri, 29 Jan 2016 22:51:02 +0000 (14:51 -0800)
Bug 26604668

Change-Id: I60a8be72bf43cec802697af3b06579453af2d5dc

core/java/android/service/chooser/ChooserTargetService.java

index e054185..a1afa60 100644 (file)
@@ -139,6 +139,7 @@ public abstract class ChooserTargetService extends Service {
         public void getChooserTargets(ComponentName targetComponentName,
                 IntentFilter matchedFilter, IChooserTargetResult result) throws RemoteException {
             List<ChooserTarget> targets = null;
+            final long id = clearCallingIdentity();
             try {
                 if (DEBUG) {
                     Log.d(TAG, "getChooserTargets calling onGetChooserTargets; "
@@ -146,6 +147,7 @@ public abstract class ChooserTargetService extends Service {
                 }
                 targets = onGetChooserTargets(targetComponentName, matchedFilter);
             } finally {
+                restoreCallingIdentity(id);
                 result.sendResult(targets);
                 if (DEBUG) Log.d(TAG, "Sent results");
             }