blob: 39717c3e0fc2bc15d2d74927ae18c6da53fde7a4 [file] [log] [blame]
Nancy Chen7c07dfa2015-02-12 09:44:41 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package android.telecom;
18import android.accounts.AbstractAccountAuthenticator;
19import android.accounts.Account;
20import android.accounts.AccountAuthenticatorResponse;
21import android.accounts.NetworkErrorException;
22import android.app.Service;
23import android.content.Context;
24import android.content.Intent;
25import android.os.Bundle;
26import android.os.IBinder;
27
28/**
29 * A generic stub account authenticator service often used for sync adapters that do not directly
30 * involve accounts.
31 */
32public class AuthenticatorService extends Service {
33 private static Authenticator mAuthenticator;
34
35 @Override
36 public void onCreate() {
37 mAuthenticator = new Authenticator(this);
38 }
39
40 @Override
41 public IBinder onBind(Intent intent) {
42 return mAuthenticator.getIBinder();
43 }
44
45 /**
46 * Stub account authenticator. All methods either return null or throw an exception.
47 */
48 public class Authenticator extends AbstractAccountAuthenticator {
49 public Authenticator(Context context) {
50 super(context);
51 }
52
53 @Override
54 public Bundle editProperties(AccountAuthenticatorResponse accountAuthenticatorResponse,
55 String s) {
56 throw new UnsupportedOperationException();
57 }
58
59 @Override
60 public Bundle addAccount(AccountAuthenticatorResponse accountAuthenticatorResponse,
61 String s, String s2, String[] strings, Bundle bundle)
62 throws NetworkErrorException {
63 return null;
64 }
65
66 @Override
67 public Bundle confirmCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
68 Account account, Bundle bundle)
69 throws NetworkErrorException {
70 return null;
71 }
72
73 @Override
74 public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse,
75 Account account, String s, Bundle bundle)
76 throws NetworkErrorException {
77 throw new UnsupportedOperationException();
78 }
79
80 @Override
81 public String getAuthTokenLabel(String s) {
82 throw new UnsupportedOperationException();
83 }
84
85 @Override
86 public Bundle updateCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
87 Account account, String s, Bundle bundle)
88 throws NetworkErrorException {
89 throw new UnsupportedOperationException();
90 }
91
92 @Override
93 public Bundle hasFeatures(AccountAuthenticatorResponse accountAuthenticatorResponse,
94 Account account, String[] strings)
95 throws NetworkErrorException {
96 throw new UnsupportedOperationException();
97 }
98 }
99}