| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package android.service.autofill.augmented; |
| 17 |
|
| 18 |
import static android.service.autofill.augmented.AugmentedAutofillService.sDebug; |
| 19 |
|
| 20 |
import android.annotation.NonNull; |
| 21 |
import android.annotation.SystemApi; |
| 22 |
import android.os.RemoteException; |
| 23 |
import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy; |
| 24 |
import android.util.Log; |
| 25 |
import android.util.Pair; |
| 26 |
import android.view.autofill.AutofillId; |
| 27 |
import android.view.autofill.AutofillValue; |
| 28 |
|
| 29 |
import java.util.List; |
| 30 |
import java.util.Objects; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@SystemApi |
| 38 |
public final class FillController { |
| 39 |
private static final String TAG = FillController.class.getSimpleName(); |
| 40 |
|
| 41 |
private final AutofillProxy mProxy; |
| 42 |
|
| 43 |
FillController(@NonNull AutofillProxy proxy) { |
| 44 |
mProxy = proxy; |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public void autofill(@NonNull List<Pair<AutofillId, AutofillValue>> values) { |
| 54 |
Objects.requireNonNull(values); |
| 55 |
|
| 56 |
if (sDebug) { |
| 57 |
Log.d(TAG, "autofill() with " + values.size() + " values"); |
| 58 |
} |
| 59 |
|
| 60 |
try { |
| 61 |
mProxy.autofill(values); |
| 62 |
} catch (RemoteException e) { |
| 63 |
e.rethrowAsRuntimeException(); |
| 64 |
} |
| 65 |
|
| 66 |
final FillWindow fillWindow = mProxy.getFillWindow(); |
| 67 |
if (fillWindow != null) { |
| 68 |
fillWindow.destroy(); |
| 69 |
} |
| 70 |
} |
| 71 |
} |