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

Commit 0faae9de authored by Parvathy Shanmugam's avatar Parvathy Shanmugam
Browse files

(IMS Threading refactoring) Telephony IMS classes to schedule IMS callback on the main thread

Modified to schedule callbacks on main thread or callback executor rather than on binder thread
Introducing utility api runWithCleanCallingIdentity to run the action in executor

Test: atest FrameworksTelephonyTests:ImsCallTest
Bug: 197989471
Change-Id: Icdb0750d63f242eb79351781a4b75ca745c30083
parent f16c37ac
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -101,6 +101,25 @@ public final class TelephonyUtils {
        }
    }

    /**
     * Convenience method for running the provided action in the provided
     * executor enclosed in
     * {@link Binder#clearCallingIdentity}/{@link Binder#restoreCallingIdentity}
     *
     * Any exception thrown by the given action will need to be handled by caller.
     *
     */
    public static void runWithCleanCallingIdentity(
            @NonNull Runnable action, @NonNull Executor executor) {
        if (action != null) {
            if (executor != null) {
                executor.execute(() -> runWithCleanCallingIdentity(action));
            } else {
                runWithCleanCallingIdentity(action);
            }
        }
    }


    /**
     * Convenience method for running the provided action enclosed in
+124 −58

File changed.

Preview size limit exceeded, changes collapsed.