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

Commit c5a4885b authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov
Browse files

Make TestActivity.isInMultiWindowMode() safe

Override isInMultiWindowMode() in TestActivity to wrap the "super." call
in a try-catch block, since may cause NPEs on some platforms for some
OEMs when running DocumentsUIUnitTests.

Bug: 297710004
Test: atest DocumentsUIUnitTests
Change-Id: I5160cf54678eb8046f090b721557ae9d39527c65
parent 0cb8f4b4
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -263,6 +263,17 @@ public abstract class TestActivity extends AbstractBase {
    public final void finish() {
        finishedHandler.accept(null);
    }

    @Override
    public boolean isInMultiWindowMode() {
        // We are seeing this causing NPEs on older platform versions of some OEM, e.g. b/297710004.
        // Hence we'll wrap this in a try-catch.
        try {
            return super.isInMultiWindowMode();
        } catch (Exception e) {
            return false;
        }
    }
}

// Trick Mockito into finding our Addons methods correctly. W/o this