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

Commit 34730c43 authored by Adrian Roos's avatar Adrian Roos
Browse files

ZeroJankProxy: Fix system_server crash when on bad app calls.

Fixes an issue where system_server would crash if an exception
gets thrown, now that those no longer get thrown back
at the application.

Fixes: 327975111
Test: atest com.android.server.inputmethod.InputMethodManagerServiceWindowGainedFocusTest
Change-Id: I008198157424c544d4973eb94434b458e27f15fd
parent 67bf5285
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -101,7 +101,6 @@ public class ZeroJankProxy extends IInputMethodManager.Stub {
    }
    }


    private void offloadInner(Runnable r) {
    private void offloadInner(Runnable r) {
        boolean useThrowingRunnable = r instanceof ThrowingRunnable;
        final long identity = Binder.clearCallingIdentity();
        final long identity = Binder.clearCallingIdentity();
        try {
        try {
            mExecutor.execute(() -> {
            mExecutor.execute(() -> {
@@ -110,14 +109,9 @@ public class ZeroJankProxy extends IInputMethodManager.Stub {
                Binder.restoreCallingIdentity(identity);
                Binder.restoreCallingIdentity(identity);
                try {
                try {
                    try {
                    try {
                        if (useThrowingRunnable) {
                            ((ThrowingRunnable) r).runOrThrow();
                        } else {
                        r.run();
                        r.run();
                        }
                    } catch (Exception e) {
                    } catch (Exception e) {
                        Slog.e(TAG, "Error in async call", e);
                        Slog.e(TAG, "Error in async IMMS call", e);
                        throw ExceptionUtils.propagate(e);
                    }
                    }
                } finally {
                } finally {
                    Binder.restoreCallingIdentity(inner);
                    Binder.restoreCallingIdentity(inner);