summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-12-08 14:50:51 -0800
committerDianne Hackborn <hackbod@google.com>2009-12-08 16:33:59 -0800
commit09c916bccbf236ccd0a2c80941e28cc55006e02a (patch)
treee745cc4daced8b3ede7c84b0134481c092d79a6b /core/java/android
parentea4823c1c7fdee093789850d0f76a3df22ca58d2 (diff)
downloadframeworks_base-09c916bccbf236ccd0a2c80941e28cc55006e02a.zip
frameworks_base-09c916bccbf236ccd0a2c80941e28cc55006e02a.tar.gz
frameworks_base-09c916bccbf236ccd0a2c80941e28cc55006e02a.tar.bz2
Add bindService API to not bring ot foreground.
Add a new flag for bindService that tells the system to not bring the target service's process in to the foreground scheduling class. This is used by the sync system to not cause the current sync adapter to come to the foreground as it is running. Also some small improvements to the debug output of the process list of oom adj and scheduling info.
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/Context.java12
-rw-r--r--core/java/android/content/SyncManager.java5
2 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 3344158..2ab5357 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -104,6 +104,18 @@ public abstract class Context {
*/
public static final int BIND_DEBUG_UNBIND = 0x0002;
+ /**
+ * 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
+ * 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
+ * in the situation where the binding client is a foreground process
+ * and the target service is in a background process.
+ */
+ public static final int BIND_NOT_FOREGROUND = 0x0004;
+
/** Return an AssetManager instance for your application's package. */
public abstract AssetManager getAssets();
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 0589ce6..d436365 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -557,7 +557,7 @@ class SyncManager implements OnAccountsUpdateListener {
intent.setAction("android.content.SyncAdapter");
intent.setComponent(syncAdapterInfo.componentName);
mContext.bindService(intent, new InitializerServiceConnection(account, authority),
- Context.BIND_AUTO_CREATE);
+ Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND);
}
private class InitializerServiceConnection implements ServiceConnection {
@@ -1145,7 +1145,8 @@ class SyncManager implements OnAccountsUpdateListener {
com.android.internal.R.string.sync_binding_label);
intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0));
- return mContext.bindService(intent, this, Context.BIND_AUTO_CREATE);
+ return mContext.bindService(intent, this,
+ Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND);
}
void unBindFromSyncAdapter() {