Fix issue #4466531: onServiceConnected() not called after...

...apk reinstall; affects user privacy

Disconnecting a ServiceConnection after an app is torn down could
impact the bookkeeping of the same service if it has been started
for the app.

Also address issue #5073927: GSF process can't be killed

A new flag allows the systems location manager service to tell
the activity manager to not pull bound services up forever into
the visible adj level.

Change-Id: I2557eca0e4bd48f3b10007c40ec878e769fd96a8
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index cdda910..2a02446 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -129,7 +129,7 @@
     /**
      * Flag for {@link #bindService}: don't allow this binding to raise
      * the target service's process to the foreground scheduling priority.
-     * It will still be raised to the at least the same memory priority
+     * It will still be raised to at least the same memory priority
      * as the client (so that its process will not be killable in any
      * situation where the client is not killable), but for CPU scheduling
      * purposes it may be left in the background.  This only has an impact
@@ -138,6 +138,16 @@
      */
     public static final int BIND_NOT_FOREGROUND = 0x0004;
 
+    /**
+     * Flag for {@link #bindService}: allow the process hosting the bound
+     * service to go through its normal memory management.  It will be
+     * treated more like a running service, allowing the system to
+     * (temporarily) expunge the process if low on memory or for some other
+     * whim it may have.
+     * @hide
+     */
+    public static final int BIND_ALLOW_OOM_MANAGEMENT = 0x0008;
+
     /** Return an AssetManager instance for your application's package. */
     public abstract AssetManager getAssets();