Debian Codegraph @

core/java/android/accounts/AccountAuthenticatorResponse.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2009 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
17 package android.accounts;
18
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.os.Bundle;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 import android.os.RemoteException;
24 import android.util.Log;
25
26 /**
27 * Object used to communicate responses back to the AccountManager
28 */
29 public class AccountAuthenticatorResponse implements Parcelable {
30 private static final String TAG = "AccountAuthenticator";
31
32 private IAccountAuthenticatorResponse mAccountAuthenticatorResponse;
33
34 /**
35 * @hide
36 */
37 @UnsupportedAppUsage
38 public AccountAuthenticatorResponse(IAccountAuthenticatorResponse response) {
39 mAccountAuthenticatorResponse = response;
40 }
41
42 public AccountAuthenticatorResponse(Parcel parcel) {
43 mAccountAuthenticatorResponse =
44 IAccountAuthenticatorResponse.Stub.asInterface(parcel.readStrongBinder());
45 }
46
47 public void onResult(Bundle result) {
48 if (Log.isLoggable(TAG, Log.VERBOSE)) {
49 result.keySet(); // force it to be unparcelled
50 Log.v(TAG, "AccountAuthenticatorResponse.onResult: "
51 + AccountManager.sanitizeResult(result));
52 }
53 try {
54 mAccountAuthenticatorResponse.onResult(result);
55 } catch (RemoteException e) {
56 // this should never happen
57 }
58 }
59
60 public void onRequestContinued() {
61 if (Log.isLoggable(TAG, Log.VERBOSE)) {
62 Log.v(TAG, "AccountAuthenticatorResponse.onRequestContinued");
63 }
64 try {
65 mAccountAuthenticatorResponse.onRequestContinued();
66 } catch (RemoteException e) {
67 // this should never happen
68 }
69 }
70
71 public void onError(int errorCode, String errorMessage) {
72 if (Log.isLoggable(TAG, Log.VERBOSE)) {
73 Log.v(TAG, "AccountAuthenticatorResponse.onError: " + errorCode + ", " + errorMessage);
74 }
75 try {
76 mAccountAuthenticatorResponse.onError(errorCode, errorMessage);
77 } catch (RemoteException e) {
78 // this should never happen
79 }
80 }
81
82 public int describeContents() {
83 return 0;
84 }
85
86 public void writeToParcel(Parcel dest, int flags) {
87 dest.writeStrongBinder(mAccountAuthenticatorResponse.asBinder());
88 }
89
90 public static final @android.annotation.NonNull Creator<AccountAuthenticatorResponse> CREATOR =
91 new Creator<AccountAuthenticatorResponse>() {
92 public AccountAuthenticatorResponse createFromParcel(Parcel source) {
93 return new AccountAuthenticatorResponse(source);
94 }
95
96 public AccountAuthenticatorResponse[] newArray(int size) {
97 return new AccountAuthenticatorResponse[size];
98 }
99 };
100 }