resolved conflicts for merge of 2ab72e1f to master

Change-Id: I752332dfb1a2f15bac22d3f1a457ae1ef20cf240
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index 6f414b4..f263ec0 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -823,29 +823,32 @@
             throw new SecurityException(msg);
         }
 
+        boolean abort = !mService.mIntentFirewall.checkStartActivity(intent,	2596
+                callerApp==null?null:callerApp.info, callingPackage, callingUid, callingPid,	2597
+                resolvedType, aInfo);
+
         if (mService.mController != null) {
-            boolean abort = false;
             try {
                 // The Intent we give to the watcher has the extra data
                 // stripped off, since it can contain private information.
                 Intent watchIntent = intent.cloneFilter();
-                abort = !mService.mController.activityStarting(watchIntent,
+                abort |= !mService.mController.activityStarting(watchIntent,
                         aInfo.applicationInfo.packageName);
             } catch (RemoteException e) {
                 mService.mController = null;
             }
+        }
 
-            if (abort) {
-                if (resultRecord != null) {
-                    resultStack.sendActivityResultLocked(-1, resultRecord, resultWho, requestCode,
+        if (abort) {
+            if (resultRecord != null) {
+                resultStack.sendActivityResultLocked(-1, resultRecord, resultWho, requestCode,
                         Activity.RESULT_CANCELED, null);
-                }
-                // We pretend to the caller that it was really started, but
-                // they will just get a cancel result.
-                setDismissKeyguard(false);
-                ActivityOptions.abort(options);
-                return ActivityManager.START_SUCCESS;
             }
+            // We pretend to the caller that it was really started, but
+            // they will just get a cancel result.
+            setDismissKeyguard(false);
+            ActivityOptions.abort(options);
+            return ActivityManager.START_SUCCESS;
         }
 
         ActivityRecord r = new ActivityRecord(mService, callerApp, callingUid, callingPackage,