Loading core/java/android/view/View.java +4 −0 Original line number Diff line number Diff line Loading @@ -30143,6 +30143,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setScrollCaptureHint(@ScrollCaptureHint int hint) { mPrivateFlags4 &= ~PFLAG4_SCROLL_CAPTURE_HINT_MASK; // Since include/exclude are mutually exclusive, exclude takes precedence. if ((hint & SCROLL_CAPTURE_HINT_EXCLUDE) != 0) { hint &= ~SCROLL_CAPTURE_HINT_INCLUDE; } mPrivateFlags4 |= ((hint << PFLAG4_SCROLL_CAPTURE_HINT_SHIFT) & PFLAG4_SCROLL_CAPTURE_HINT_MASK); } core/tests/coretests/src/android/view/ViewGroupScrollCaptureTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,18 @@ public class ViewGroupScrollCaptureTest { viewGroup.getScrollCaptureHint()); } /** Make sure the hint flags are saved and loaded correctly. */ @Test public void testSetScrollCaptureHint_mutuallyExclusiveFlags() throws Exception { final Context context = getInstrumentation().getContext(); final MockViewGroup viewGroup = new MockViewGroup(context); viewGroup.setScrollCaptureHint( View.SCROLL_CAPTURE_HINT_INCLUDE | View.SCROLL_CAPTURE_HINT_EXCLUDE); assertEquals("Mutually exclusive flags were not resolved correctly", ViewGroup.SCROLL_CAPTURE_HINT_EXCLUDE, viewGroup.getScrollCaptureHint()); } /** * Ensure a ViewGroup with 'scrollCaptureHint=auto', but no ScrollCaptureCallback set dispatches * correctly. Verifies that the framework helper is called. Verifies a that non-null callback Loading Loading
core/java/android/view/View.java +4 −0 Original line number Diff line number Diff line Loading @@ -30143,6 +30143,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setScrollCaptureHint(@ScrollCaptureHint int hint) { mPrivateFlags4 &= ~PFLAG4_SCROLL_CAPTURE_HINT_MASK; // Since include/exclude are mutually exclusive, exclude takes precedence. if ((hint & SCROLL_CAPTURE_HINT_EXCLUDE) != 0) { hint &= ~SCROLL_CAPTURE_HINT_INCLUDE; } mPrivateFlags4 |= ((hint << PFLAG4_SCROLL_CAPTURE_HINT_SHIFT) & PFLAG4_SCROLL_CAPTURE_HINT_MASK); }
core/tests/coretests/src/android/view/ViewGroupScrollCaptureTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,18 @@ public class ViewGroupScrollCaptureTest { viewGroup.getScrollCaptureHint()); } /** Make sure the hint flags are saved and loaded correctly. */ @Test public void testSetScrollCaptureHint_mutuallyExclusiveFlags() throws Exception { final Context context = getInstrumentation().getContext(); final MockViewGroup viewGroup = new MockViewGroup(context); viewGroup.setScrollCaptureHint( View.SCROLL_CAPTURE_HINT_INCLUDE | View.SCROLL_CAPTURE_HINT_EXCLUDE); assertEquals("Mutually exclusive flags were not resolved correctly", ViewGroup.SCROLL_CAPTURE_HINT_EXCLUDE, viewGroup.getScrollCaptureHint()); } /** * Ensure a ViewGroup with 'scrollCaptureHint=auto', but no ScrollCaptureCallback set dispatches * correctly. Verifies that the framework helper is called. Verifies a that non-null callback Loading