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

Commit dadedeb5 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8195019 from 8e4f34e4 to sc-qpr3-release

Change-Id: Idecde96d61fff8b5234f48e4ecf6d1e28b024b51
parents 8a595e73 8e4f34e4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -297,12 +297,12 @@ public final class SelectionActionModeHelper {
        } else {
            mTextClassification = null;
        }
        if (mEditor.startActionModeInternal(actionMode)) {
            final SelectionModifierCursorController controller = mEditor.getSelectionController();
            if (controller != null
                    && (mTextView.isTextSelectable() || mTextView.isTextEditable())) {
                controller.show();
            }
        if (mEditor.startActionModeInternal(actionMode)) {
            if (result != null) {
                switch (actionMode) {
                    case Editor.TextActionMode.SELECTION:
+36 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.widget;

import static android.widget.espresso.CustomViewActions.longPressAtRelativeCoordinates;
import static android.widget.espresso.DragHandleUtils.assertNoSelectionHandles;
import static android.widget.espresso.DragHandleUtils.onHandleView;
import static android.widget.espresso.FloatingToolbarEspressoUtils.assertFloatingToolbarContainsItem;
import static android.widget.espresso.FloatingToolbarEspressoUtils.assertFloatingToolbarDoesNotContainItem;
@@ -425,6 +426,41 @@ public class TextViewActivityTest {
        assertEquals(latestItem[0], clickedItem[0]);
    }

    @Test
    public void testSelectionOnCreateActionModeReturnsFalse() throws Throwable {
        final String text = "hello world";
        mActivityRule.runOnUiThread(() -> {
            final TextView textView = mActivity.findViewById(R.id.textview);
            textView.setText(text);
            textView.setCustomSelectionActionModeCallback(
                    new ActionMode.Callback() {
                        @Override
                        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                            return false;
                        }

                        @Override
                        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                            return false;
                        }

                        @Override
                        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                            return false;
                        }


                        @Override
                        public void onDestroyActionMode(ActionMode mode) {
                        }
                    });
        });
        mInstrumentation.waitForIdleSync();
        onView(withId(R.id.textview)).perform(longPressOnTextAtIndex(text.indexOf("d")));
        mInstrumentation.waitForIdleSync();
        assertNoSelectionHandles();
    }

    @Test
    public void testSelectionRemovedWhenNonselectableTextLosesFocus() throws Throwable {
        final TextLinks.TextLink textLink = addLinkifiedTextToTextView(R.id.nonselectable_textview);
+3 −1
Original line number Diff line number Diff line
@@ -182,7 +182,9 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {

    /** */
    public void setListening(boolean listening, boolean expanded) {
        setListening(listening && expanded);
        // TODO(218268829): checking for split shade is workaround but when proper fix lands
        //  "|| mShouldUseSplitNotificationShade" should be removed
        setListening(listening && (expanded || mShouldUseSplitNotificationShade));
        if (mView.isListening()) {
            refreshAllTiles();
        }
+15 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ import android.os.PowerManager.WakeLock;
import android.os.Process;
import android.os.SystemClock;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.ArraySet;
import android.util.Slog;

@@ -162,6 +163,14 @@ import java.util.function.Consumer;
public class VcnGatewayConnection extends StateMachine {
    private static final String TAG = VcnGatewayConnection.class.getSimpleName();

    // Matches DataConnection.NETWORK_TYPE private constant, and magic string from
    // ConnectivityManager#getNetworkTypeName()
    @VisibleForTesting(visibility = Visibility.PRIVATE)
    static final String NETWORK_INFO_NETWORK_TYPE_STRING = "MOBILE";

    @VisibleForTesting(visibility = Visibility.PRIVATE)
    static final String NETWORK_INFO_EXTRA_INFO = "VCN";

    @VisibleForTesting(visibility = Visibility.PRIVATE)
    static final InetAddress DUMMY_ADDR = InetAddresses.parseNumericAddress("192.0.2.0");

@@ -1625,6 +1634,12 @@ public class VcnGatewayConnection extends StateMachine {
            final NetworkAgentConfig nac =
                    new NetworkAgentConfig.Builder()
                            .setLegacyType(ConnectivityManager.TYPE_MOBILE)
                            .setLegacyTypeName(NETWORK_INFO_NETWORK_TYPE_STRING)
                            .setLegacySubType(TelephonyManager.NETWORK_TYPE_UNKNOWN)
                            .setLegacySubTypeName(
                                    TelephonyManager.getNetworkTypeName(
                                            TelephonyManager.NETWORK_TYPE_UNKNOWN))
                            .setLegacyExtraInfo(NETWORK_INFO_EXTRA_INFO)
                            .build();

            final VcnNetworkAgent agent =
+4 −1
Original line number Diff line number Diff line
@@ -307,7 +307,10 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
                        ncCaptor.capture(),
                        lpCaptor.capture(),
                        any(),
                        argThat(nac -> nac.getLegacyType() == ConnectivityManager.TYPE_MOBILE),
                        // Subtype integer/name and extras do not have getters; cannot be tested.
                        argThat(nac -> nac.getLegacyType() == ConnectivityManager.TYPE_MOBILE
                                && nac.getLegacyTypeName().equals(
                                        VcnGatewayConnection.NETWORK_INFO_NETWORK_TYPE_STRING)),
                        any(),
                        any(),
                        any());