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

Commit 35b30576 authored by Jan Althaus's avatar Jan Althaus
Browse files

Fixing broken logging of OTHER events

This bug means we never received logs for events like 'Web Search'

Bug: 77659305
Test: atest FrameworksCoreTests:SelectionEventTest
Change-Id: I6f79897f548d0d19710578e309e0b645bb78e1e3
parent 4d289593
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -362,6 +362,7 @@ public final class SelectionEvent implements Parcelable {
            case SelectionEvent.ACTION_ABANDON:  // fall through
            case SelectionEvent.ACTION_SELECT_ALL:  // fall through
            case SelectionEvent.ACTION_RESET:  // fall through
            case SelectionEvent.ACTION_OTHER:  // fall through
                return;
            default:
                throw new IllegalArgumentException(
+25 −0
Original line number Diff line number Diff line
@@ -30,6 +30,31 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class SelectionEventTest {

    @Test
    public void testCreateSelectionActionEvent_valid() {
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_OVERTYPE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_COPY);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_PASTE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_CUT);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SHARE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SMART_SHARE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_DRAG);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_ABANDON);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_OTHER);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SELECT_ALL);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_RESET);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreateSelectionActionEvent_badRange() {
        SelectionEvent.createSelectionActionEvent(0, -1, SelectionEvent.ACTION_OVERTYPE);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreateSelectionActionEvent_badAction() {
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.EVENT_SELECTION_STARTED);
    }

    @Test
    public void testParcel() {
        final SelectionEvent[] captured = new SelectionEvent[1];