Don't actually try to stop processes marked 'persistent'

A later CL will introduce an API for querying whether a given package
runs in a persistent process; UIs such as Settings will be able to use
that to determine whether to disable the 'force stop' action.

Change-Id: Iab47c2300fdce285da7d83e02263c9a5f69edd70
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3389f33..a07aa60 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -3369,6 +3369,10 @@
             final int NA = apps.size();
             for (int ia=0; ia<NA; ia++) {
                 ProcessRecord app = apps.valueAt(ia);
+                if (app.persistent) {
+                    // we don't kill persistent processes
+                    continue;
+                }
                 if (app.removed) {
                     if (doit) {
                         procs.add(app);
@@ -3423,7 +3427,8 @@
         
         for (i=mMainStack.mHistory.size()-1; i>=0; i--) {
             ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i);
-            if (r.packageName.equals(name)) {
+            if (r.packageName.equals(name)
+                    && (r.app == null || !r.app.persistent)) {
                 if (!doit) {
                     return true;
                 }
@@ -3439,7 +3444,8 @@
 
         ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
         for (ServiceRecord service : mServices.values()) {
-            if (service.packageName.equals(name)) {
+            if (service.packageName.equals(name)
+                    && (service.app == null || !service.app.persistent)) {
                 if (!doit) {
                     return true;
                 }