Eliminate single-process mode.
Bug: 5010576

Change-Id: Id450dc83efed4897d1e4ff451530fed14457aace
diff --git a/api/current.txt b/api/current.txt
index 559672f..e90196e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -14392,7 +14392,7 @@
     method public static final void sendSignal(int, int);
     method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
     method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
-    method public static final boolean supportsProcesses();
+    method public static final deprecated boolean supportsProcesses();
     field public static final int BLUETOOTH_GID = 2000; // 0x7d0
     field public static final int FIRST_APPLICATION_UID = 10000; // 0x2710
     field public static final int LAST_APPLICATION_UID = 99999; // 0x1869f
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 152a7cb..f2be29f 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -82,35 +82,27 @@
     virtual void onStarted()
     {
         sp<ProcessState> proc = ProcessState::self();
-        if (proc->supportsProcesses()) {
-            LOGV("App process: starting thread pool.\n");
-            proc->startThreadPool();
-        }
+        LOGV("App process: starting thread pool.\n");
+        proc->startThreadPool();
 
         AndroidRuntime* ar = AndroidRuntime::getRuntime();
         ar->callMain(mClassName, mClass, mArgC, mArgV);
 
-        if (ProcessState::self()->supportsProcesses()) {
-            IPCThreadState::self()->stopProcess();
-        }
+        IPCThreadState::self()->stopProcess();
     }
 
     virtual void onZygoteInit()
     {
         sp<ProcessState> proc = ProcessState::self();
-        if (proc->supportsProcesses()) {
-            LOGV("App process: starting thread pool.\n");
-            proc->startThreadPool();
-        }
+        LOGV("App process: starting thread pool.\n");
+        proc->startThreadPool();
     }
 
     virtual void onExit(int code)
     {
         if (mClassName == NULL) {
             // if zygote
-            if (ProcessState::self()->supportsProcesses()) {
-                IPCThreadState::self()->stopProcess();
-            }
+            IPCThreadState::self()->stopProcess();
         }
 
         AndroidRuntime::onExit(code);
diff --git a/cmds/runtime/main_runtime.cpp b/cmds/runtime/main_runtime.cpp
index dbff095..e3b72c2 100644
--- a/cmds/runtime/main_runtime.cpp
+++ b/cmds/runtime/main_runtime.cpp
@@ -93,12 +93,11 @@
 static void usage(const char* argv0)
 {
     fprintf(stderr,
-        "Usage: runtime [-g gamma] [-l logfile] [-n] [-s]\n"
+        "Usage: runtime [-g gamma] [-l logfile] [-n]\n"
         "               [-j app-component] [-v app-verb] [-d app-data]\n"
         "\n"
         "-l: File to send log messages to\n"
         "-n: Don't print to stdout/stderr\n"
-        "-s: Force single-process mode\n"
         "-j: Custom home app component name\n"
         "-v: Custom home app intent verb\n"
         "-d: Custom home app intent data\n"
@@ -145,21 +144,14 @@
 LOGI("run() sending FIRST_CALL_TRANSACTION to activity manager");
     am->transact(IBinder::FIRST_CALL_TRANSACTION, data, &reply);
 
-    if (proc->supportsProcesses()) {
-        // Now we link to the Activity Manager waiting for it to die. If it does kill ourself.
-        // initd will restart this process and bring the system back up.
-        sp<GrimReaper> grim = new GrimReaper();
-        am->linkToDeath(grim, grim.get(), 0);
+    // Now we link to the Activity Manager waiting for it to die. If it does kill ourself.
+    // initd will restart this process and bring the system back up.
+    sp<GrimReaper> grim = new GrimReaper();
+    am->linkToDeath(grim, grim.get(), 0);
 
-        // Now join the thread pool. Note this is needed so that the message enqueued in the driver
-        // for the linkToDeath gets processed.
-        IPCThreadState::self()->joinThreadPool();
-    } else {
-        // Keep this thread running forever...
-        while (1) {
-            usleep(100000);
-        }
-    }
+    // Now join the thread pool. Note this is needed so that the message enqueued in the driver
+    // for the linkToDeath gets processed.
+    IPCThreadState::self()->joinThreadPool();
     return 1;
 }
 
@@ -179,14 +171,7 @@
  */
 static void finish_system_init(sp<ProcessState>& proc)
 {
-    // If we are running multiprocess, we now need to have the
-    // thread pool started here.  We don't do this in boot_init()
-    // because when running single process we need to start the
-    // thread pool after the Android runtime has been started (so
-    // the pool uses Dalvik threads).
-    if (proc->supportsProcesses()) {
-        proc->startThreadPool();
-    }
+    proc->startThreadPool();
 }
 
 
@@ -214,11 +199,7 @@
     LOGD("ProcessState: %p\n", proc.get());
     proc->becomeContextManager(contextChecker, NULL);
 
-    if (proc->supportsProcesses()) {
-        LOGI("Binder driver opened.  Multiprocess enabled.\n");
-    } else {
-        LOGI("Binder driver not found.  Processes not supported.\n");
-    }
+    LOGI("Binder driver opened.\n");
 
     sp<BServiceManager> sm = new BServiceManager;
     proc->setContextObject(sm);
@@ -340,7 +321,6 @@
 extern "C"
 int main(int argc, char* const argv[])
 {
-    bool singleProcess = false;
     const char* logFile = NULL;
     int ic;
     int result = 1;
@@ -359,7 +339,7 @@
 #endif
 
     while (1) {
-        ic = getopt(argc, argv, "g:j:v:d:l:ns");
+        ic = getopt(argc, argv, "g:j:v:d:l:n");
         if (ic < 0)
             break;
 
@@ -381,9 +361,6 @@
         case 'n':
             redirectStdFds();
             break;
-        case 's':
-            singleProcess = true;
-            break;
         case '?':
         default:
             LOGE("runtime: unrecognized flag -%c\n", ic);
@@ -396,10 +373,6 @@
         usage(argv[0]);
     }
 
-    if (singleProcess) {
-        ProcessState::setSingleProcess(true);
-    }
-
     if (logFile != NULL) {
         android_logToFile(NULL, logFile);
     }
@@ -475,33 +448,17 @@
 
     boot_init();
 
-    /* If we are in multiprocess mode, have zygote spawn the system
-     * server process and call system_init(). If we are running in
-     * single process mode just call system_init() directly.
-     */
-    if (proc->supportsProcesses()) {
-        // If stdio logging is on, system_server should not inherit our stdio
-        // The dalvikvm instance will copy stdio to the log on its own
-        char propBuf[PROPERTY_VALUE_MAX];
-        bool logStdio = false;
-        property_get("log.redirect-stdio", propBuf, "");
-        logStdio = (strcmp(propBuf, "true") == 0);
+    // Have zygote spawn the system server process and call system_init().
+    // If stdio logging is on, system_server should not inherit our stdio
+    // The dalvikvm instance will copy stdio to the log on its own
+    char propBuf[PROPERTY_VALUE_MAX];
+    bool logStdio = false;
+    property_get("log.redirect-stdio", propBuf, "");
+    logStdio = (strcmp(propBuf, "true") == 0);
 
-        zygote_run_oneshot((int)(!logStdio),
-                sizeof(ZYGOTE_ARGV) / sizeof(ZYGOTE_ARGV[0]),
-                ZYGOTE_ARGV);
-
-        //start_process("/system/bin/mediaserver");
-
-    } else {
-#ifndef HAVE_ANDROID_OS
-        QuickRuntime* runt = new QuickRuntime();
-        runt->start("com/android/server/SystemServer",
-                    "" /* spontaneously fork system server from zygote */);
-#endif
-    }
-
-    //printf("+++ post-zygote\n");
+    zygote_run_oneshot((int)(!logStdio),
+            sizeof(ZYGOTE_ARGV) / sizeof(ZYGOTE_ARGV[0]),
+            ZYGOTE_ARGV);
 
     finish_system_init(proc);
     run(proc);
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp
index a19711e..59360d3 100644
--- a/cmds/system_server/library/system_init.cpp
+++ b/cmds/system_server/library/system_init.cpp
@@ -76,23 +76,6 @@
         SensorService::instantiate();
     }
 
-    // On the simulator, audioflinger et al don't get started the
-    // same way as on the device, and we need to start them here
-    if (!proc->supportsProcesses()) {
-
-        // Start the AudioFlinger
-        AudioFlinger::instantiate();
-
-        // Start the media playback service
-        MediaPlayerService::instantiate();
-
-        // Start the camera service
-        CameraService::instantiate();
-
-        // Start the audio policy service
-        AudioPolicyService::instantiate();
-    }
-
     // And now start the Android runtime.  We have to do this bit
     // of nastiness because the Android runtime initialization requires
     // some of the core system services to already be started.
@@ -117,14 +100,10 @@
     }
     env->CallStaticVoidMethod(clazz, methodId);
 
-    // If running in our own process, just go into the thread
-    // pool.  Otherwise, call the initialization finished
-    // func to let this process continue its initilization.
-    if (proc->supportsProcesses()) {
-        LOGI("System server: entering thread pool.\n");
-        ProcessState::self()->startThreadPool();
-        IPCThreadState::self()->joinThreadPool();
-        LOGI("System server: exiting thread pool.\n");
-    }
+    LOGI("System server: entering thread pool.\n");
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+    LOGI("System server: exiting thread pool.\n");
+
     return NO_ERROR;
 }
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index eee14fb..ee04729 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4093,11 +4093,6 @@
         });
     }
 
-    private final void detach()
-    {
-        sThreadLocal.set(null);
-    }
-
     public static final ActivityThread systemMain() {
         HardwareRenderer.disable();
         ActivityThread thread = new ActivityThread();
@@ -4105,10 +4100,9 @@
         return thread;
     }
 
-    public final void installSystemProviders(List providers) {
+    public final void installSystemProviders(List<ProviderInfo> providers) {
         if (providers != null) {
-            installContentProviders(mInitialApplication,
-                                    (List<ProviderInfo>)providers);
+            installContentProviders(mInitialApplication, providers);
         }
     }
 
@@ -4147,14 +4141,6 @@
 
         Looper.loop();
 
-        if (Process.supportsProcesses()) {
-            throw new RuntimeException("Main thread loop unexpectedly exited");
-        }
-
-        thread.detach();
-        String name = (thread.mInitialApplication != null)
-            ? thread.mInitialApplication.getPackageName()
-            : "<unknown>";
-        Slog.i(TAG, "Main thread of " + name + " is now exiting");
+        throw new RuntimeException("Main thread loop unexpectedly exited");
     }
 }
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 8749d3e..d2323e7 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1163,9 +1163,6 @@
             throw new IllegalArgumentException("permission is null");
         }
 
-        if (!Process.supportsProcesses()) {
-            return PackageManager.PERMISSION_GRANTED;
-        }
         try {
             return ActivityManagerNative.getDefault().checkPermission(
                     permission, pid, uid);
@@ -1180,9 +1177,6 @@
             throw new IllegalArgumentException("permission is null");
         }
 
-        if (!Process.supportsProcesses()) {
-            return PackageManager.PERMISSION_GRANTED;
-        }
         int pid = Binder.getCallingPid();
         if (pid != Process.myPid()) {
             return checkPermission(permission, pid,
@@ -1263,9 +1257,6 @@
 
     @Override
     public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) {
-        if (!Process.supportsProcesses()) {
-            return PackageManager.PERMISSION_GRANTED;
-        }
         try {
             return ActivityManagerNative.getDefault().checkUriPermission(
                     uri, pid, uid, modeFlags);
@@ -1276,9 +1267,6 @@
 
     @Override
     public int checkCallingUriPermission(Uri uri, int modeFlags) {
-        if (!Process.supportsProcesses()) {
-            return PackageManager.PERMISSION_GRANTED;
-        }
         int pid = Binder.getCallingPid();
         if (pid != Process.myPid()) {
             return checkUriPermission(uri, pid,
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index 3edd692..c0be664 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -86,9 +86,7 @@
     public static final void prepareMainLooper() {
         prepare();
         setMainLooper(myLooper());
-        if (Process.supportsProcesses()) {
-            myLooper().mQueue.mQuitAllowed = false;
-        }
+        myLooper().mQueue.mQuitAllowed = false;
     }
 
     private synchronized static void setMainLooper(Looper looper) {
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index dbefb1f..269e50e 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -280,72 +280,16 @@
                                   final String niceName,
                                   int uid, int gid, int[] gids,
                                   int debugFlags, int targetSdkVersion,
-                                  String[] zygoteArgs)
-    {
-        if (supportsProcesses()) {
-            try {
-                return startViaZygote(processClass, niceName, uid, gid, gids,
-                        debugFlags, targetSdkVersion, zygoteArgs);
-            } catch (ZygoteStartFailedEx ex) {
-                Log.e(LOG_TAG,
-                        "Starting VM process through Zygote failed");
-                throw new RuntimeException(
-                        "Starting VM process through Zygote failed", ex);
-            }
-        } else {
-            // Running in single-process mode
-            
-            Runnable runnable = new Runnable() {
-                        public void run() {
-                            Process.invokeStaticMain(processClass);
-                        }
-            };
-            
-            // Thread constructors must not be called with null names (see spec). 
-            if (niceName != null) {
-                new Thread(runnable, niceName).start();
-            } else {
-                new Thread(runnable).start();
-            }
-            
-            return 0;
-        }
-    }
-    
-    /**
-     * Start a new process.  Don't supply a custom nice name.
-     * {@hide}
-     */
-    public static final int start(String processClass, int uid, int gid,
-            int[] gids, int debugFlags, int targetSdkVersion,
-            String[] zygoteArgs) {
-        return start(processClass, "", uid, gid, gids, 
-                debugFlags, targetSdkVersion, zygoteArgs);
-    }
-
-    private static void invokeStaticMain(String className) {
-        Class cl;
-        Object args[] = new Object[1];
-
-        args[0] = new String[0];     //this is argv
-   
+                                  String[] zygoteArgs) {
         try {
-            cl = Class.forName(className);
-            cl.getMethod("main", new Class[] { String[].class })
-                    .invoke(null, args);            
-        } catch (Exception ex) {
-            // can be: ClassNotFoundException,
-            // NoSuchMethodException, SecurityException,
-            // IllegalAccessException, IllegalArgumentException
-            // InvocationTargetException
-            // or uncaught exception from main()
-
-            Log.e(LOG_TAG, "Exception invoking static main on " 
-                    + className, ex);
-
-            throw new RuntimeException(ex);
+            return startViaZygote(processClass, niceName, uid, gid, gids,
+                    debugFlags, targetSdkVersion, zygoteArgs);
+        } catch (ZygoteStartFailedEx ex) {
+            Log.e(LOG_TAG,
+                    "Starting VM process through Zygote failed");
+            throw new RuntimeException(
+                    "Starting VM process through Zygote failed", ex);
         }
-
     }
 
     /** retry interval for opening a zygote socket */
@@ -740,8 +684,13 @@
      * 
      * @return Returns true if the system can run in multiple processes, else
      * false if everything is running in a single process.
+     *
+     * @deprecated This method always returns true.  Do not use.
      */
-    public static final native boolean supportsProcesses();
+    @Deprecated
+    public static final boolean supportsProcesses() {
+        return true;
+    }
 
     /**
      * Set the out-of-memory badness adjustment for a process.
diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java
index b721665..1af24f4a 100644
--- a/core/java/android/os/ServiceManager.java
+++ b/core/java/android/os/ServiceManager.java
@@ -114,7 +114,7 @@
      * @hide
      */
     public static void initServiceCache(Map<String, IBinder> cache) {
-        if (sCache.size() != 0 && Process.supportsProcesses()) {
+        if (sCache.size() != 0) {
             throw new IllegalStateException("setServiceCache may only be called once");
         }
         sCache.putAll(cache);
diff --git a/core/java/android/view/ViewAncestor.java b/core/java/android/view/ViewAncestor.java
index c0619a5..b4f323c 100644
--- a/core/java/android/view/ViewAncestor.java
+++ b/core/java/android/view/ViewAncestor.java
@@ -3848,10 +3848,6 @@
         }
 
         private static int checkCallingPermission(String permission) {
-            if (!Process.supportsProcesses()) {
-                return PackageManager.PERMISSION_GRANTED;
-            }
-
             try {
                 return ActivityManagerNative.getDefault().checkPermission(
                         permission, Binder.getCallingPid(), Binder.getCallingUid());
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 0960b25..d1ba2d1 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -318,17 +318,15 @@
                                       jint pid, jint adj)
 {
 #ifdef HAVE_OOM_ADJ
-    if (ProcessState::self()->supportsProcesses()) {
-        char text[64];
-        sprintf(text, "/proc/%d/oom_adj", pid);
-        int fd = open(text, O_WRONLY);
-        if (fd >= 0) {
-            sprintf(text, "%d", adj);
-            write(fd, text, strlen(text));
-            close(fd);
-        }
-        return true;
+    char text[64];
+    sprintf(text, "/proc/%d/oom_adj", pid);
+    int fd = open(text, O_WRONLY);
+    if (fd >= 0) {
+        sprintf(text, "%d", adj);
+        write(fd, text, strlen(text));
+        close(fd);
     }
+    return true;
 #endif
     return false;
 }
@@ -370,11 +368,6 @@
     #endif
 }
 
-jboolean android_os_Process_supportsProcesses(JNIEnv* env, jobject clazz)
-{
-    return ProcessState::self()->supportsProcesses();
-}
-
 static int pid_compare(const void* v1, const void* v2)
 {
     //LOGI("Compare %d vs %d\n", *((const jint*)v1), *((const jint*)v2));
@@ -878,7 +871,6 @@
     {"setGid", "(I)I", (void*)android_os_Process_setGid},
     {"sendSignal", "(II)V", (void*)android_os_Process_sendSignal},
     {"sendSignalQuiet", "(II)V", (void*)android_os_Process_sendSignalQuiet},
-    {"supportsProcesses", "()Z", (void*)android_os_Process_supportsProcesses},
     {"getFreeMemory", "()J", (void*)android_os_Process_getFreeMemory},
     {"readProcLines", "(Ljava/lang/String;[Ljava/lang/String;[J)V", (void*)android_os_Process_readProcLines},
     {"getPids", "(Ljava/lang/String;[I)[I", (void*)android_os_Process_getPids},
diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h
index feeb3c3..9725822 100644
--- a/include/binder/ProcessState.h
+++ b/include/binder/ProcessState.h
@@ -39,8 +39,6 @@
 public:
     static  sp<ProcessState>    self();
 
-    static  void                setSingleProcess(bool singleProcess);
-
             void                setContextObject(const sp<IBinder>& object);
             sp<IBinder>         getContextObject(const sp<IBinder>& caller);
         
@@ -48,8 +46,6 @@
                                                  const String16& name);
             sp<IBinder>         getContextObject(const String16& name,
                                                  const sp<IBinder>& caller);
-                                                 
-            bool                supportsProcesses() const;
 
             void                startThreadPool();
                         
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 2d4e10d..7264ac4 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -43,8 +43,6 @@
 
 #define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2))
 
-static bool gSingleProcess = false;
-
 
 // ---------------------------------------------------------------------------
 
@@ -82,12 +80,6 @@
     return gProcess;
 }
 
-void ProcessState::setSingleProcess(bool singleProcess)
-{
-    gSingleProcess = singleProcess;
-}
-
-
 void ProcessState::setContextObject(const sp<IBinder>& object)
 {
     setContextObject(object, String16("default"));
@@ -95,11 +87,7 @@
 
 sp<IBinder> ProcessState::getContextObject(const sp<IBinder>& caller)
 {
-    if (supportsProcesses()) {
-        return getStrongProxyForHandle(0);
-    } else {
-        return getContextObject(String16("default"), caller);
-    }
+    return getStrongProxyForHandle(0);
 }
 
 void ProcessState::setContextObject(const sp<IBinder>& object, const String16& name)
@@ -144,11 +132,6 @@
     return object;
 }
 
-bool ProcessState::supportsProcesses() const
-{
-    return mDriverFD >= 0;
-}
-
 void ProcessState::startThreadPool()
 {
     AutoMutex _l(mLock);
@@ -169,24 +152,19 @@
         AutoMutex _l(mLock);
         mBinderContextCheckFunc = checkFunc;
         mBinderContextUserData = userData;
-        if (mDriverFD >= 0) {
-            int dummy = 0;
+
+        int dummy = 0;
 #if defined(HAVE_ANDROID_OS)
-            status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR, &dummy);
+        status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR, &dummy);
 #else
-            status_t result = INVALID_OPERATION;
+        status_t result = INVALID_OPERATION;
 #endif
-            if (result == 0) {
-                mManagesContexts = true;
-            } else if (result == -1) {
-                mBinderContextCheckFunc = NULL;
-                mBinderContextUserData = NULL;
-                LOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno));
-            }
-        } else {
-            // If there is no driver, our only world is the local
-            // process so we can always become the context manager there.
+        if (result == 0) {
             mManagesContexts = true;
+        } else if (result == -1) {
+            mBinderContextCheckFunc = NULL;
+            mBinderContextUserData = NULL;
+            LOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno));
         }
     }
     return mManagesContexts;
@@ -322,10 +300,6 @@
 
 static int open_driver()
 {
-    if (gSingleProcess) {
-        return -1;
-    }
-
     int fd = open("/dev/binder", O_RDWR);
     if (fd >= 0) {
         fcntl(fd, F_SETFD, FD_CLOEXEC);
@@ -386,9 +360,8 @@
         mDriverFD = -1;
 #endif
     }
-    if (mDriverFD < 0) {
-        // Need to run without the driver, starting our own thread pool.
-    }
+
+    LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver could not be opened.  Terminating.");
 }
 
 ProcessState::~ProcessState()
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index c55338a9..7935d82 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1152,10 +1152,6 @@
             mPlaylistsUri = Playlists.getContentUri(volumeName);
 
             mCaseInsensitivePaths = true;
-            if (!Process.supportsProcesses()) {
-                // Simulator uses host file system, so it should be case sensitive.
-                mCaseInsensitivePaths = false;
-            }
         }
     }
 
diff --git a/services/camera/libcameraservice/CameraHardwareStub.h b/services/camera/libcameraservice/CameraHardwareStub.h
index 9b66a76..c6d8756 100644
--- a/services/camera/libcameraservice/CameraHardwareStub.h
+++ b/services/camera/libcameraservice/CameraHardwareStub.h
@@ -73,14 +73,7 @@
         CameraHardwareStub* mHardware;
     public:
         PreviewThread(CameraHardwareStub* hw) :
-#ifdef SINGLE_PROCESS
-            // In single process mode this thread needs to be a java thread,
-            // since we won't be calling through the binder.
-            Thread(true),
-#else
-            Thread(false),
-#endif
-              mHardware(hw) { }
+                Thread(false), mHardware(hw) { }
         virtual void onFirstRef() {
             run("CameraPreviewThread", PRIORITY_URGENT_DISPLAY);
         }
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 158c778..0b15221 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -1072,7 +1072,7 @@
             throw new IllegalArgumentException("packageName and uid don't match packageName="
                     + packageName);
         }
-        if (callingUid != packageUid && Process.supportsProcesses()) {
+        if (callingUid != packageUid) {
             throw new IllegalArgumentException("packageName and uid don't match packageName="
                     + packageName);
         }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 62f0fea..d5e8730 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -502,15 +502,6 @@
             = new ArrayList<ProcessRecord>();
 
     /**
-     * List of records for processes that we have started and are waiting
-     * for them to call back.  This is really only needed when running in
-     * single processes mode, in which case we do not have a unique pid for
-     * each process.
-     */
-    final ArrayList<ProcessRecord> mStartingProcesses
-            = new ArrayList<ProcessRecord>();
-
-    /**
      * List of persistent applications that are in the process
      * of being started.
      */
@@ -2001,12 +1992,7 @@
             }
             buf.append("}");
             Slog.i(TAG, buf.toString());
-            if (pid == 0 || pid == MY_PID) {
-                // Processes are being emulated with threads.
-                app.pid = MY_PID;
-                app.removed = false;
-                mStartingProcesses.add(app);
-            } else if (pid > 0) {
+            if (pid > 0) {
                 app.pid = pid;
                 app.removed = false;
                 synchronized (mPidsSelfLocked) {
@@ -3606,9 +3592,6 @@
             synchronized (mPidsSelfLocked) {
                 app = mPidsSelfLocked.get(pid);
             }
-        } else if (mStartingProcesses.size() > 0) {
-            app = mStartingProcesses.remove(0);
-            app.setPid(pid);
         } else {
             app = null;
         }
@@ -4042,8 +4025,7 @@
         synchronized(this) {
             int callingUid = Binder.getCallingUid();
             try {
-                if (callingUid != 0 && callingUid != Process.SYSTEM_UID &&
-                        Process.supportsProcesses()) {
+                if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
                     int uid = AppGlobals.getPackageManager()
                             .getPackageUid(packageName);
                     if (uid != Binder.getCallingUid()) {
@@ -4302,8 +4284,7 @@
         }
 
         // Root, system server and our own process get to do everything.
-        if (uid == 0 || uid == Process.SYSTEM_UID || pid == MY_PID ||
-            !Process.supportsProcesses()) {
+        if (uid == 0 || uid == Process.SYSTEM_UID || pid == MY_PID) {
             return PackageManager.PERMISSION_GRANTED;
         }
         // If there is a uid that owns whatever is being accessed, it has
@@ -4447,7 +4428,7 @@
     private final boolean checkUriPermissionLocked(Uri uri, int uid,
             int modeFlags) {
         // Root gets to do everything.
-        if (uid == 0 || !Process.supportsProcesses()) {
+        if (uid == 0) {
             return true;
         }
         HashMap<Uri, UriPermission> perms = mGrantedUriPermissions.get(uid);
@@ -5528,8 +5509,8 @@
     // CONTENT PROVIDERS
     // =========================================================
 
-    private final List generateApplicationProvidersLocked(ProcessRecord app) {
-        List providers = null;
+    private final List<ProviderInfo> generateApplicationProvidersLocked(ProcessRecord app) {
+        List<ProviderInfo> providers = null;
         try {
             providers = AppGlobals.getPackageManager().
                 queryContentProviders(app.processName, app.info.uid,
@@ -5967,7 +5948,7 @@
     }
 
     public static final void installSystemProviders() {
-        List providers;
+        List<ProviderInfo> providers;
         synchronized (mSelf) {
             ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID);
             providers = mSelf.generateApplicationProvidersLocked(app);
@@ -6585,13 +6566,6 @@
     }
     
     public void systemReady(final Runnable goingCallback) {
-        // In the simulator, startRunning will never have been called, which
-        // normally sets a few crucial variables. Do it here instead.
-        if (!Process.supportsProcesses()) {
-            mStartRunning = true;
-            mTopAction = Intent.ACTION_MAIN;
-        }
-
         synchronized(this) {
             if (mSystemReady) {
                 if (goingCallback != null) goingCallback.run();
@@ -7955,14 +7929,6 @@
                     "Starting Norm", "Restarting PERS");
         }
 
-        if (mStartingProcesses.size() > 0) {
-            if (needSep) pw.println(" ");
-            needSep = true;
-            pw.println("  Processes that are starting:");
-            dumpProcessList(pw, this, mStartingProcesses, "    ",
-                    "Starting Norm", "Starting PERS");
-        }
-
         if (mRemovedProcesses.size() > 0) {
             if (needSep) pw.println(" ");
             needSep = true;
@@ -13128,74 +13094,72 @@
 
         int adj = computeOomAdjLocked(app, hiddenAdj, TOP_APP, false);
 
-        if ((app.pid != 0 && app.pid != MY_PID) || Process.supportsProcesses()) {
-            if (app.curRawAdj != app.setRawAdj) {
-                if (app.curRawAdj > FOREGROUND_APP_ADJ
-                        && app.setRawAdj <= FOREGROUND_APP_ADJ) {
-                    // If this app is transitioning from foreground to
-                    // non-foreground, have it do a gc.
-                    scheduleAppGcLocked(app);
-                } else if (app.curRawAdj >= HIDDEN_APP_MIN_ADJ
-                        && app.setRawAdj < HIDDEN_APP_MIN_ADJ) {
-                    // Likewise do a gc when an app is moving in to the
-                    // background (such as a service stopping).
-                    scheduleAppGcLocked(app);
-                }
+        if (app.curRawAdj != app.setRawAdj) {
+            if (app.curRawAdj > FOREGROUND_APP_ADJ
+                    && app.setRawAdj <= FOREGROUND_APP_ADJ) {
+                // If this app is transitioning from foreground to
+                // non-foreground, have it do a gc.
+                scheduleAppGcLocked(app);
+            } else if (app.curRawAdj >= HIDDEN_APP_MIN_ADJ
+                    && app.setRawAdj < HIDDEN_APP_MIN_ADJ) {
+                // Likewise do a gc when an app is moving in to the
+                // background (such as a service stopping).
+                scheduleAppGcLocked(app);
+            }
 
-                if (wasKeeping && !app.keeping) {
-                    // This app is no longer something we want to keep.  Note
-                    // its current wake lock time to later know to kill it if
-                    // it is not behaving well.
-                    BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics();
-                    synchronized (stats) {
-                        app.lastWakeTime = stats.getProcessWakeTime(app.info.uid,
-                                app.pid, SystemClock.elapsedRealtime());
+            if (wasKeeping && !app.keeping) {
+                // This app is no longer something we want to keep.  Note
+                // its current wake lock time to later know to kill it if
+                // it is not behaving well.
+                BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics();
+                synchronized (stats) {
+                    app.lastWakeTime = stats.getProcessWakeTime(app.info.uid,
+                            app.pid, SystemClock.elapsedRealtime());
+                }
+                app.lastCpuTime = app.curCpuTime;
+            }
+
+            app.setRawAdj = app.curRawAdj;
+        }
+        if (adj != app.setAdj) {
+            if (Process.setOomAdj(app.pid, adj)) {
+                if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(
+                    TAG, "Set app " + app.processName +
+                    " oom adj to " + adj);
+                app.setAdj = adj;
+            } else {
+                success = false;
+            }
+        }
+        if (app.setSchedGroup != app.curSchedGroup) {
+            app.setSchedGroup = app.curSchedGroup;
+            if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(TAG,
+                    "Setting process group of " + app.processName
+                    + " to " + app.curSchedGroup);
+            if (app.waitingToKill != null &&
+                    app.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
+                Slog.i(TAG, "Killing " + app.toShortString() + ": " + app.waitingToKill);
+                EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
+                        app.processName, app.setAdj, app.waitingToKill);
+                Process.killProcessQuiet(app.pid);
+            } else {
+                if (true) {
+                    long oldId = Binder.clearCallingIdentity();
+                    try {
+                        Process.setProcessGroup(app.pid, app.curSchedGroup);
+                    } catch (Exception e) {
+                        Slog.w(TAG, "Failed setting process group of " + app.pid
+                                + " to " + app.curSchedGroup);
+                        e.printStackTrace();
+                    } finally {
+                        Binder.restoreCallingIdentity(oldId);
                     }
-                    app.lastCpuTime = app.curCpuTime;
                 }
-
-                app.setRawAdj = app.curRawAdj;
-            }
-            if (adj != app.setAdj) {
-                if (Process.setOomAdj(app.pid, adj)) {
-                    if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(
-                        TAG, "Set app " + app.processName +
-                        " oom adj to " + adj);
-                    app.setAdj = adj;
-                } else {
-                    success = false;
-                }
-            }
-            if (app.setSchedGroup != app.curSchedGroup) {
-                app.setSchedGroup = app.curSchedGroup;
-                if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(TAG,
-                        "Setting process group of " + app.processName
-                        + " to " + app.curSchedGroup);
-                if (app.waitingToKill != null &&
-                        app.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
-                    Slog.i(TAG, "Killing " + app.toShortString() + ": " + app.waitingToKill);
-                    EventLog.writeEvent(EventLogTags.AM_KILL, app.pid,
-                            app.processName, app.setAdj, app.waitingToKill);
-                    Process.killProcessQuiet(app.pid);
-                } else {
-                    if (true) {
-                        long oldId = Binder.clearCallingIdentity();
+                if (false) {
+                    if (app.thread != null) {
                         try {
-                            Process.setProcessGroup(app.pid, app.curSchedGroup);
-                        } catch (Exception e) {
-                            Slog.w(TAG, "Failed setting process group of " + app.pid
-                                    + " to " + app.curSchedGroup);
-                            e.printStackTrace();
-                        } finally {
-                            Binder.restoreCallingIdentity(oldId);
-                        }
-                    }
-                    if (false) {
-                        if (app.thread != null) {
-                            try {
-                                app.thread.setSchedulingGroup(app.curSchedGroup);
-                            } catch (RemoteException e) {
-                            }
+                            app.thread.setSchedulingGroup(app.curSchedGroup);
+                        } catch (RemoteException e) {
                         }
                     }
                 }
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index ea5d26b..668ba9b 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -783,7 +783,7 @@
         // whether we are running on the simulator and thus need to take
         // care of building the /data file structure ourself.
         // (apparently the sim now has a working installer)
-        if (installer.ping() && Process.supportsProcesses()) {
+        if (installer.ping()) {
             mInstaller = installer;
         } else {
             mInstaller = null;
@@ -3237,7 +3237,7 @@
 
                 // If we have mismatched owners for the data path, we have a
                 // problem (unless we're running in the simulator.)
-                if (mOutPermissions[1] != pkg.applicationInfo.uid && Process.supportsProcesses()) {
+                if (mOutPermissions[1] != pkg.applicationInfo.uid) {
                     boolean recovered = false;
                     if ((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
                         // If this is a system app, we can at least delete its