From 84e1e0adc2516afd35ebab029a52e764e0490559 Mon Sep 17 00:00:00 2001 From: Jason parks Date: Fri, 17 Jun 2011 09:33:57 -0500 Subject: Reset the SE when a package that accessed it is uninstalled. Bug: 4487211 Change-Id: Iad5c641926eb0e121d630d16f8ce02b8b9713cd3 --- src/com/android/nfc/NfcService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 667565b..6cb8dda 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -70,7 +70,6 @@ import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; -import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -79,6 +78,7 @@ import java.nio.charset.Charsets; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -256,7 +256,7 @@ public class NfcService extends Application { private final HashMap mObjectMap = new HashMap(); private final HashMap mSocketMap = new HashMap(); private boolean mScreenOn; - private String mSePackageName; + private HashSet mSePackages = new HashSet(); // fields below are final after onCreate() Context mContext; @@ -1821,6 +1821,12 @@ public class NfcService extends Application { } catch (RemoteException e) { mOpenEe.binderDied(); } + + // Add the calling package to the list of packages that have accessed + // the secure element. + for (String packageName : getPackageManager().getPackagesForUid(getCallingUid())) { + mSePackages.add(packageName); + } } } @@ -2964,8 +2970,9 @@ public class NfcService extends Application { String packageName = data.getSchemeSpecificPart(); synchronized (NfcService.this) { - if (packageName.equals(mSePackageName)) { + if (mSePackages.contains(packageName)) { executeSeReset(); + mSePackages.remove(packageName); } } } -- cgit v1.1