1/*
2 * Copyright (C) 2016 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.view.autofill;
18
19import java.util.List;
20
21import android.content.Intent;
22import android.content.IntentSender;
23import android.graphics.Rect;
24import android.os.IBinder;
25import android.view.autofill.AutofillId;
26import android.view.autofill.AutofillValue;
27import android.view.autofill.IAutofillWindowPresenter;
28import android.view.KeyEvent;
29
30/**
31 * Object running in the application process and responsible for autofilling it.
32 *
33 * @hide
34 */
35oneway interface IAutoFillManagerClient {
36    /**
37     * Notifies the client when the autofill enabled state changed.
38     */
39    void setState(int flags);
40
41    /**
42      * Autofills the activity with the contents of a dataset.
43      */
44    void autofill(int sessionId, in List<AutofillId> ids, in List<AutofillValue> values);
45
46    /**
47      * Authenticates a fill response or a data set.
48      */
49    void authenticate(int sessionId, int authenticationId, in IntentSender intent,
50            in Intent fillInIntent);
51
52    /**
53      * Sets the views to track. If saveOnAllViewsInvisible is set and all these view are invisible
54      * the session is finished automatically.
55      */
56    void setTrackedViews(int sessionId, in @nullable AutofillId[] savableIds,
57            boolean saveOnAllViewsInvisible, boolean saveOnFinish,
58            in @nullable AutofillId[] fillableIds, in AutofillId saveTriggerId);
59
60    /**
61     * Requests showing the fill UI.
62     */
63    void requestShowFillUi(int sessionId, in AutofillId id, int width, int height,
64    in Rect anchorBounds, in IAutofillWindowPresenter presenter);
65
66    /**
67     * Requests hiding the fill UI.
68     */
69    void requestHideFillUi(int sessionId, in AutofillId id);
70
71    /**
72     * Notifies no fill UI will be shown, and also mark the state as finished if necessary (if
73     * sessionFinishedState != 0).
74     */
75    void notifyNoFillUi(int sessionId, in AutofillId id, int sessionFinishedState);
76
77    /**
78     * Dispatches unhandled keyevent from autofill ui. Autofill ui handles DPAD and ENTER events,
79     * other unhandled keyevents are dispatched to app's window to filter autofill result.
80     * Note this method is not called when autofill ui is in fullscreen mode (TV only).
81     */
82    void dispatchUnhandledKey(int sessionId, in AutofillId id, in KeyEvent keyEvent);
83
84    /**
85     * Starts the provided intent sender.
86     */
87    void startIntentSender(in IntentSender intentSender, in Intent intent);
88
89   /**
90     * Sets the state of the Autofill Save UI for a given session.
91     */
92   void setSaveUiState(int sessionId, boolean shown);
93
94   /**
95     * Marks the state of the session as finished.
96     * @param newState STATE_FINISHED (because the autofill service returned a null
97     * FillResponse) or STATE_UNKNOWN (because the session was removed).
98     */
99   void setSessionFinished(int newState);
100}
101