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

Commit 398e15e5 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove a dangerous exception swallowing

Apparently such a try/catch has never been safe, as we do not know
what operations will be skipped after the SecurityException with
message

  "Permission Denial: not allowed to send broadcast"

is thrown.

Bug: 352615651
Test: FrameworksInputMethodSystemServerTests
Flag: TEST_ONLY
Change-Id: I97458944dd1227331f89d6ca8e0da541cf23e74b
parent 1c303cdc
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -257,16 +257,9 @@ public class InputMethodManagerServiceTestBase {
        // Public local InputMethodManagerService.
        LocalServices.removeServiceForTest(InputMethodManagerInternal.class);
        lifecycle.onStart();
        try {

        // After this boot phase, services can broadcast Intents.
        lifecycle.onBootPhase(SystemService.PHASE_ACTIVITY_MANAGER_READY);
        } catch (SecurityException e) {
            // Security exception to permission denial is expected in test, mocking out to ensure
            // InputMethodManagerService as system ready state.
            if (!e.getMessage().contains("Permission Denial: not allowed to send broadcast")) {
                throw e;
            }
        }

        // Call InputMethodManagerService#addClient() as a preparation to start interacting with it.
        mInputMethodManagerService.addClient(mMockInputMethodClient, mMockRemoteInputConnection, 0);