1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/syncadapter/SyncService.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.sync.syncadapter; 1.9 + 1.10 +import android.app.Service; 1.11 +import android.content.Intent; 1.12 +import android.os.IBinder; 1.13 + 1.14 +/** 1.15 + * Service to handle Account sync. This is invoked with an intent with action 1.16 + * ACTION_AUTHENTICATOR_INTENT. It instantiates the SyncAdaptor and returns its 1.17 + * IBinder. 1.18 + */ 1.19 +public class SyncService extends Service { 1.20 + 1.21 + private static final Object sSyncAdapterLock = new Object(); 1.22 + 1.23 + private static SyncAdapter sSyncAdapter = null; 1.24 + 1.25 + @Override 1.26 + public void onCreate() { 1.27 + synchronized (sSyncAdapterLock) { 1.28 + if (sSyncAdapter == null) { 1.29 + sSyncAdapter = new SyncAdapter(getApplicationContext(), true); 1.30 + } 1.31 + } 1.32 + } 1.33 + 1.34 + @Override 1.35 + public IBinder onBind(Intent intent) { 1.36 + return sSyncAdapter.getSyncAdapterBinder(); 1.37 + } 1.38 +}