michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.sync.syncadapter; michael@0: michael@0: import android.app.Service; michael@0: import android.content.Intent; michael@0: import android.os.IBinder; michael@0: michael@0: /** michael@0: * Service to handle Account sync. This is invoked with an intent with action michael@0: * ACTION_AUTHENTICATOR_INTENT. It instantiates the SyncAdaptor and returns its michael@0: * IBinder. michael@0: */ michael@0: public class SyncService extends Service { michael@0: michael@0: private static final Object sSyncAdapterLock = new Object(); michael@0: michael@0: private static SyncAdapter sSyncAdapter = null; michael@0: michael@0: @Override michael@0: public void onCreate() { michael@0: synchronized (sSyncAdapterLock) { michael@0: if (sSyncAdapter == null) { michael@0: sSyncAdapter = new SyncAdapter(getApplicationContext(), true); michael@0: } michael@0: } michael@0: } michael@0: michael@0: @Override michael@0: public IBinder onBind(Intent intent) { michael@0: return sSyncAdapter.getSyncAdapterBinder(); michael@0: } michael@0: }