diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-08 16:34:48 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-08 16:34:48 -0800 |
commit | af9788a9d6c238dd97f40dc020e036739daf0811 (patch) | |
tree | 40ddce09a6e2112b1ff47f94a7abac7ce0755a57 /core/java/android | |
parent | 7614d3d819315b1ca15088e617f12d0f0ea41b06 (diff) | |
parent | 09c916bccbf236ccd0a2c80941e28cc55006e02a (diff) | |
download | frameworks_base-af9788a9d6c238dd97f40dc020e036739daf0811.zip frameworks_base-af9788a9d6c238dd97f40dc020e036739daf0811.tar.gz frameworks_base-af9788a9d6c238dd97f40dc020e036739daf0811.tar.bz2 |
Merge change Ia53c6725 into eclair-mr2
* changes:
Add bindService API to not bring ot foreground.
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/content/Context.java | 12 | ||||
-rw-r--r-- | core/java/android/content/SyncManager.java | 5 |
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() { |