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

Commit fb62ecb2 authored by Jiaquan He's avatar Jiaquan He
Browse files

Fix broken CTS tests.

The default focus highlight should be necessary when the view is
attached to window.

Test: cts-tradefed run singleCommand cts --skip-device-info
--skip-preconditions --abi armeabi-v7a -m CtsViewTestCases -t
android.view.cts.ViewTest
Test: cts-tradefed run singleCommand cts --skip-device-info
--skip-preconditions --abi armeabi-v7a -m CtsWidgetTestCases -t
android.widget.cts.MediaControllerTest
Bug: 37082416

Change-Id: I5d6b0c00b5ba03c8f62e4f71be9336823a73134b
parent 8062949e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19712,13 +19712,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *     <li>This view is not in touch mode.</li>
     *     <li>This view doesn't opt out for a default focus highlight, via
     *         {@link #setDefaultFocusHighlightEnabled(boolean)}.</li>
     *     <li>This view is attached to window.</li>
     * </ul>
     * @return {@code true} if a default focus highlight is needed.
     */
    private boolean isDefaultFocusHighlightNeeded(Drawable background) {
        final boolean hasFocusStateSpecified = background == null || !background.isStateful()
                || !background.hasFocusStateSpecified();
        return !isInTouchMode() && getDefaultFocusHighlightEnabled() && hasFocusStateSpecified;
        return !isInTouchMode() && getDefaultFocusHighlightEnabled() && hasFocusStateSpecified
                && isAttachedToWindow();
    }
    /**