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

Commit 35481742 authored by Winson Chung's avatar Winson Chung
Browse files

Guard against assumption of display areas when offset is requested

- If there is no registered display area when OHM offset is requested
  then we should just ignore the tracing

Fixes: 347654461
Flag: EXEMPT bugfix
Test: atest OneHandedDisplayAreaOrganizerTest
Change-Id: I46bd668049ded3d59deec7be4624b8f8c522d9bb
parent 799e09d8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -335,6 +335,9 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer {
    }

    void beginCUJTracing(@CujType int cujType, @Nullable String tag) {
        if (getDisplayAreaTokenMap().isEmpty()) {
            return;
        }
        final Map.Entry<WindowContainerToken, SurfaceControl> firstEntry =
                getDisplayAreaTokenMap().entrySet().iterator().next();
        final InteractionJankMonitor.Configuration.Builder builder =
+10 −0
Original line number Diff line number Diff line
@@ -190,6 +190,16 @@ public class OneHandedDisplayAreaOrganizerTest extends OneHandedTestCase {
                any());
    }

    @Test
    public void testScheduleOffsetWithoutDisplayArea() {
        mDisplayAreaAppearedInfoList.forEach(
                (info) -> mSpiedDisplayAreaOrganizer.onDisplayAreaVanished(
                        info.getDisplayAreaInfo()));

        // Schedule offset and ensure this doesn't throw
        mSpiedDisplayAreaOrganizer.scheduleOffset(0, 0);
    }

    @Test
    public void testRotation_portrait_0_to_landscape_90() {
        when(mMockLeash.isValid()).thenReturn(false);