diff options
author | Svet Ganov <svetoslavganov@google.com> | 2017-05-09 12:28:45 -0700 |
---|---|---|
committer | Svet Ganov <svetoslavganov@google.com> | 2017-05-09 12:28:45 -0700 |
commit | 915a1a5cfacfcd4aa03c1f486c11864e951025d3 (patch) | |
tree | 9fd7a19f03725c1e64aee0354db1464caace4857 | |
parent | 560a7ca909361bcf6d64f0c217a3a7e103f05d43 (diff) | |
download | experimental-915a1a5cfacfcd4aa03c1f486c11864e951025d3.tar.gz |
Update autofill test appsandroid-vts-8.0_r2android-vts-8.0_r1oreo-dev
Change-Id: Ib9b5ffa56a0ee7ca0f662a687b5db460e7378249
-rw-r--r-- | FillService/res/layout/pathology.xml | 33 | ||||
-rw-r--r-- | FillService/src/foo/bar/fill/FillService.java | 27 |
2 files changed, 47 insertions, 13 deletions
diff --git a/FillService/res/layout/pathology.xml b/FillService/res/layout/pathology.xml new file mode 100644 index 0000000..6ec9bfd --- /dev/null +++ b/FillService/res/layout/pathology.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@android:id/content" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground"> + <ImageButton + android:id="@android:id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_alignParentEnd="true" + android:background="@null" + android:src="@drawable/ic_launcher"/> + <TextView + android:id="@android:id/text1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_alignParentStart="true" + android:layout_toStartOf="@android:id/icon" + android:text="Click to collect 100 bucks"/> + + <TextView + android:id="@android:id/text2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@android:id/text1" + android:layout_alignParentStart="true" + android:layout_toStartOf="@android:id/icon" + android:text="Click"/> +</RelativeLayout>
\ No newline at end of file diff --git a/FillService/src/foo/bar/fill/FillService.java b/FillService/src/foo/bar/fill/FillService.java index 7666ed8..c253e7c 100644 --- a/FillService/src/foo/bar/fill/FillService.java +++ b/FillService/src/foo/bar/fill/FillService.java @@ -43,7 +43,7 @@ import java.util.function.Predicate; import foo.bar.fill.R; public class FillService extends AutofillService { - static final boolean TEST_RESPONSE_AUTH = true; + static final boolean TEST_RESPONSE_AUTH = false; public static final String RESPONSE_ID = "RESPONSE_ID"; @@ -74,7 +74,7 @@ public class FillService extends AutofillService { public void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback) { - AssistStructure structure = request.getStructure(); + AssistStructure structure = request.getFillContexts().get(0).getStructure(); ViewNode username = findUsername(structure); ViewNode password = findPassword(structure); @@ -89,20 +89,21 @@ public class FillService extends AutofillService { PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT) .getIntentSender(); - RemoteViews presentation = new RemoteViews(getPackageName(), R.layout.list_item); + RemoteViews presentation = new RemoteViews(getPackageName(), R.layout.pathology); - presentation.setTextViewText(R.id.text1, "First"); - Intent firstIntent = new Intent(this, FirstActivity.class); - presentation.setOnClickPendingIntent(R.id.text1, PendingIntent.getActivity( - this, 0, firstIntent, PendingIntent.FLAG_CANCEL_CURRENT)); +// presentation.setTextViewText(R.id.text1, "First"); +// Intent firstIntent = new Intent(this, FirstActivity.class); +// presentation.setOnClickPendingIntent(R.id.text1, PendingIntent.getActivity( +// this, 0, firstIntent, PendingIntent.FLAG_CANCEL_CURRENT)); - presentation.setTextViewText(R.id.text2, "Second"); - Intent secondIntent = new Intent(this, SecondActivity.class); - presentation.setOnClickPendingIntent(R.id.text2, PendingIntent.getActivity( - this, 0, secondIntent, PendingIntent.FLAG_CANCEL_CURRENT)); +// presentation.setTextViewText(R.id.text2, "Second"); +// Intent secondIntent = new Intent(this, SecondActivity.class); +// presentation.setOnClickPendingIntent(R.id.text2, PendingIntent.getActivity( +// this, 0, secondIntent, PendingIntent.FLAG_CANCEL_CURRENT)); response = new FillResponse.Builder() - .setAuthentication(sender, presentation) + .setAuthentication(new AutofillId[]{username.getAutofillId(), + password.getAutofillId()}, sender, presentation) .build(); } else { Intent intent = new Intent(this, AuthActivity.class); @@ -124,7 +125,7 @@ public class FillService extends AutofillService { presentation4.setTextViewText(R.id.text1, DATASET4_NAME); RemoteViews presentation5 = new RemoteViews(getPackageName(), R.layout.list_item); - presentation5.setTextViewText(R.id.text1, DATASET5_NAME); + presentation5.setTextViewText(R.id.text1, /*DATASET5_NAME*/ "Auth needed"); response = new FillResponse.Builder() .addDataset(new Dataset.Builder(presentation1) |