mobile/android/base/fxa/sync/FxAccountSyncService.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/fxa/sync/FxAccountSyncService.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     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.fxa.sync;
     1.9 +
    1.10 +import android.app.Service;
    1.11 +import android.content.Intent;
    1.12 +import android.os.IBinder;
    1.13 +
    1.14 +public class FxAccountSyncService extends Service {
    1.15 +  private static final Object syncAdapterLock = new Object();
    1.16 +  private static FxAccountSyncAdapter syncAdapter = null;
    1.17 +
    1.18 +  @Override
    1.19 +  public void onCreate() {
    1.20 +    synchronized (syncAdapterLock) {
    1.21 +      if (syncAdapter == null) {
    1.22 +        syncAdapter = new FxAccountSyncAdapter(getApplicationContext(), true);
    1.23 +      }
    1.24 +    }
    1.25 +  }
    1.26 +
    1.27 +  @Override
    1.28 +  public IBinder onBind(Intent intent) {
    1.29 +    return syncAdapter.getSyncAdapterBinder();
    1.30 +  }
    1.31 +}

mercurial