Skip to content
Commit 37df2dba authored by Evan Rosky's avatar Evan Rosky
Browse files

Changing initial and default focus behavior

This changes initial focus behavior such that by default,
nothing is focused; and, if nothing is focused, the first focus
navigation will send focus to the default focus rather than
whatever happens to be in the upper-left. This also slightly
tweaks the behavior of the <requestFocus /> tag to make it
easier to use.

This addresses a common problem where developers create dummy
focusable views or make viewgroups focusable(InTouchmode) to
prevent other views from gaining focus on activity start.

In order to have something focused at activity start, developers
now must explicitly provide a <requestFocus /> tag. However,
this tag now requests "default" focus so that, when used in
tandem with the focusedByDefault attribute(s), it can be placed
at the root of the hierarchy to mimic the initial focus behavior
before this CL.

This will only take effect when targetApi >= 26.

Bug: 34520588
Bug: 33016720
Test: Added/Updated CTS tests. Also built some test-apps to verify.

Change-Id: I3e7fb7289f6dd53023ec24087f84c41526eaab2e
parent fbad632f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment