Use top activity when determining foreground package.

If you have an activity stack where the base activity
belongs to a different package, NfcService would use
the wrong package for determining whether the current
foreground app is allowed to have an ndef message (callback) set.
This could cause Activity stacks like Settings -> Storage ->
Pictures & Videos -> Gallery to fail sending pictures.

Use the top activity instead.

Bug: 9072009
Change-Id: I32fbbea1423333117d2a0522eced98ecf9a758e7
diff --git a/src/com/android/nfc/P2pLinkManager.java b/src/com/android/nfc/P2pLinkManager.java
index 29afe95..fb83e18 100755
--- a/src/com/android/nfc/P2pLinkManager.java
+++ b/src/com/android/nfc/P2pLinkManager.java
@@ -400,7 +400,7 @@
             String runningPackage = null;
             List<RunningTaskInfo> tasks = mActivityManager.getRunningTasks(1);
             if (tasks.size() > 0) {
-                runningPackage = tasks.get(0).baseActivity.getPackageName();
+                runningPackage = tasks.get(0).topActivity.getPackageName();
             }
 
             if (runningPackage == null) {