Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4dc3289c authored by Evan Rosky's avatar Evan Rosky
Browse files

Enable new initial-focus behavior for P

This means that, by default, nothing gets initial focus.

In order to have something focused at activity start, an
app must explicitly provide a <requestFocus /> tag. Since
this tag uses the "default" focus mechanism, it can be
placed in a parent and focus will go to whatever view is
the default focusable in that hierarchy.

This takes effect for targetApi >= P

Bug: 34520588
Test: Added CTS tests in View_FocusHandlingTest
Change-Id: I59fe2b9de2e0f7a21e3dd11e7a837b7c83f410f5
parent 8eb09860
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ public final class ViewRootImpl implements ViewParent,
        mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);

        if (!sCompatibilityDone) {
            sAlwaysAssignFocus = true;
            sAlwaysAssignFocus = mTargetSdkVersion < Build.VERSION_CODES.P;

            sCompatibilityDone = true;
        }