blob: 054646572a588dcb3fc9f265a7ad61ac2c41e239 [file] [log] [blame]
Felipe Leme284ad1c2018-11-15 18:16:12 -08001/*
2 * Copyright (C) 2018 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 */
Felipe Leme749b8892018-12-03 16:30:30 -080016package android.service.autofill.augmented;
Felipe Leme284ad1c2018-11-15 18:16:12 -080017
Felipe Lemebf93cdc2018-12-03 12:05:58 -080018import android.annotation.NonNull;
Felipe Leme284ad1c2018-11-15 18:16:12 -080019import android.annotation.Nullable;
20import android.annotation.SystemApi;
Felipe Leme749b8892018-12-03 16:30:30 -080021import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy;
Felipe Leme284ad1c2018-11-15 18:16:12 -080022
23/**
24 * Callback used to indicate at {@link FillRequest} has been fulfilled.
25 *
26 * @hide
27 */
28@SystemApi
29public final class FillCallback {
Felipe Lemebf93cdc2018-12-03 12:05:58 -080030 private final AutofillProxy mProxy;
Felipe Leme284ad1c2018-11-15 18:16:12 -080031
Felipe Lemebf93cdc2018-12-03 12:05:58 -080032 FillCallback(@NonNull AutofillProxy proxy) {
33 mProxy = proxy;
34 }
Felipe Leme284ad1c2018-11-15 18:16:12 -080035
36 /**
37 * Sets the response associated with the request.
38 *
39 * @param response response associated with the request, or {@code null} if the service
40 * could not provide autofill for the request.
41 */
42 public void onSuccess(@Nullable FillResponse response) {
Felipe Lemebf93cdc2018-12-03 12:05:58 -080043 mProxy.report(AutofillProxy.REPORT_EVENT_ON_SUCCESS);
Felipe Leme284ad1c2018-11-15 18:16:12 -080044 final FillWindow fillWindow = response.getFillWindow();
45 if (fillWindow != null) {
46 fillWindow.show();
47 }
48 // TODO(b/111330312): properly implement on server-side by updating the Session state
49 // accordingly (and adding CTS tests)
50 }
51}