Loading core/java/android/app/assist/AssistStructure.java +2 −2 Original line number Diff line number Diff line Loading @@ -620,7 +620,7 @@ public class AssistStructure implements Parcelable { String mIdType; String mIdEntry; // TODO: once we have more flags, it might be better to store the individual // TODO(b/37567426): once we have more flags, it might be better to store the individual // fields (viewId and childId) of the field. AutofillId mAutofillId; @View.AutofillType int mAutofillType = View.AUTOFILL_TYPE_NONE; Loading Loading @@ -664,7 +664,7 @@ public class AssistStructure implements Parcelable { static final int FLAGS_CONTEXT_CLICKABLE = 0x00004000; static final int FLAGS_OPAQUE = 0x00008000; // TODO: autofill data is made of many fields and ideally we should verify // TODO(b/37567426): autofill data is made of many fields and ideally we should verify // one-by-one to optimize what's sent over, but there isn't enough flag bits for that, we'd // need to create a 'flags2' or 'autoFillFlags' field and add these flags there. // So, to keep thinkg simpler for now, let's just use on flag for all of them... Loading core/tests/coretests/src/android/app/assist/AssistStructureTest.java +21 −5 Original line number Diff line number Diff line Loading @@ -80,6 +80,22 @@ public class AssistStructureTest { mActivity = mActivityTestRule.launchActivity(null); } @Test public void testParcelizationForAutofill_oneSmallView() { mActivity.addView(newSmallView()); waitUntilViewsAreLaidOff(); AssistStructure structure = new AssistStructure(mActivity, FOR_AUTOFILL, NO_FLAGS); // Check properties on "original" structure assertStructureWithManySmallViews(structure, 1); // Check properties on "cloned" structure AssistStructure clone = cloneThroughParcel(structure); assertStructureWithManySmallViews(clone, 1); } @Test public void testParcelizationForAutofill_manySmallViews() { Log.d(TAG, "Adding " + NUMBER_SMALL_VIEWS + " small views"); Loading @@ -93,14 +109,14 @@ public class AssistStructureTest { AssistStructure structure = new AssistStructure(mActivity, FOR_AUTOFILL, NO_FLAGS); // Check properties on "original" structure assertStructureWithManySmallViews(structure); assertStructureWithManySmallViews(structure, NUMBER_SMALL_VIEWS); // Check properties on "cloned" structure AssistStructure clone = cloneThroughParcel(structure); assertStructureWithManySmallViews(clone); assertStructureWithManySmallViews(clone, NUMBER_SMALL_VIEWS); } private void assertStructureWithManySmallViews(AssistStructure structure) { private void assertStructureWithManySmallViews(AssistStructure structure, int expectedSize) { int i = 0; try { assertPackageName(structure); Loading @@ -123,12 +139,12 @@ public class AssistStructureTest { // Parent ViewNode parent = rootView.getChildAt(1); assertThat(parent.getClassName()).isEqualTo(LinearLayout.class.getName()); assertThat(parent.getChildCount()).isEqualTo(NUMBER_SMALL_VIEWS); assertThat(parent.getChildCount()).isEqualTo(expectedSize); assertThat(parent.getIdEntry()).isEqualTo("parent"); assertThat(parent.getAutofillId()).isNotNull(); // Children for (i = 0; i < NUMBER_SMALL_VIEWS; i++) { for (i = 0; i < expectedSize; i++) { ViewNode smallView = parent.getChildAt(i); assertSmallView(smallView); } Loading Loading
core/java/android/app/assist/AssistStructure.java +2 −2 Original line number Diff line number Diff line Loading @@ -620,7 +620,7 @@ public class AssistStructure implements Parcelable { String mIdType; String mIdEntry; // TODO: once we have more flags, it might be better to store the individual // TODO(b/37567426): once we have more flags, it might be better to store the individual // fields (viewId and childId) of the field. AutofillId mAutofillId; @View.AutofillType int mAutofillType = View.AUTOFILL_TYPE_NONE; Loading Loading @@ -664,7 +664,7 @@ public class AssistStructure implements Parcelable { static final int FLAGS_CONTEXT_CLICKABLE = 0x00004000; static final int FLAGS_OPAQUE = 0x00008000; // TODO: autofill data is made of many fields and ideally we should verify // TODO(b/37567426): autofill data is made of many fields and ideally we should verify // one-by-one to optimize what's sent over, but there isn't enough flag bits for that, we'd // need to create a 'flags2' or 'autoFillFlags' field and add these flags there. // So, to keep thinkg simpler for now, let's just use on flag for all of them... Loading
core/tests/coretests/src/android/app/assist/AssistStructureTest.java +21 −5 Original line number Diff line number Diff line Loading @@ -80,6 +80,22 @@ public class AssistStructureTest { mActivity = mActivityTestRule.launchActivity(null); } @Test public void testParcelizationForAutofill_oneSmallView() { mActivity.addView(newSmallView()); waitUntilViewsAreLaidOff(); AssistStructure structure = new AssistStructure(mActivity, FOR_AUTOFILL, NO_FLAGS); // Check properties on "original" structure assertStructureWithManySmallViews(structure, 1); // Check properties on "cloned" structure AssistStructure clone = cloneThroughParcel(structure); assertStructureWithManySmallViews(clone, 1); } @Test public void testParcelizationForAutofill_manySmallViews() { Log.d(TAG, "Adding " + NUMBER_SMALL_VIEWS + " small views"); Loading @@ -93,14 +109,14 @@ public class AssistStructureTest { AssistStructure structure = new AssistStructure(mActivity, FOR_AUTOFILL, NO_FLAGS); // Check properties on "original" structure assertStructureWithManySmallViews(structure); assertStructureWithManySmallViews(structure, NUMBER_SMALL_VIEWS); // Check properties on "cloned" structure AssistStructure clone = cloneThroughParcel(structure); assertStructureWithManySmallViews(clone); assertStructureWithManySmallViews(clone, NUMBER_SMALL_VIEWS); } private void assertStructureWithManySmallViews(AssistStructure structure) { private void assertStructureWithManySmallViews(AssistStructure structure, int expectedSize) { int i = 0; try { assertPackageName(structure); Loading @@ -123,12 +139,12 @@ public class AssistStructureTest { // Parent ViewNode parent = rootView.getChildAt(1); assertThat(parent.getClassName()).isEqualTo(LinearLayout.class.getName()); assertThat(parent.getChildCount()).isEqualTo(NUMBER_SMALL_VIEWS); assertThat(parent.getChildCount()).isEqualTo(expectedSize); assertThat(parent.getIdEntry()).isEqualTo("parent"); assertThat(parent.getAutofillId()).isNotNull(); // Children for (i = 0; i < NUMBER_SMALL_VIEWS; i++) { for (i = 0; i < expectedSize; i++) { ViewNode smallView = parent.getChildAt(i); assertSmallView(smallView); } Loading