mobile/android/base/fxa/authenticator/FxAccountAuthenticatorService.java

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6c21f4b64124
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 package org.mozilla.gecko.fxa.authenticator;
6
7 import org.mozilla.gecko.background.common.log.Logger;
8
9 import android.app.Service;
10 import android.content.Intent;
11 import android.os.IBinder;
12
13 public class FxAccountAuthenticatorService extends Service {
14 public static final String LOG_TAG = FxAccountAuthenticatorService.class.getSimpleName();
15
16 // Lazily initialized by <code>getAuthenticator</code>.
17 protected FxAccountAuthenticator accountAuthenticator = null;
18
19 protected FxAccountAuthenticator getAuthenticator() {
20 if (accountAuthenticator == null) {
21 accountAuthenticator = new FxAccountAuthenticator(this);
22 }
23
24 return accountAuthenticator;
25 }
26
27 @Override
28 public void onCreate() {
29 Logger.debug(LOG_TAG, "onCreate");
30
31 accountAuthenticator = getAuthenticator();
32 }
33
34 @Override
35 public IBinder onBind(Intent intent) {
36 Logger.debug(LOG_TAG, "onBind");
37
38 if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) {
39 return getAuthenticator().getIBinder();
40 }
41
42 return null;
43 }
44 }

mercurial