diff options
Diffstat (limited to 'core')
-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() { |