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