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

Commit 1bad3382 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add timeout to AbstractLauncherUiTest.getOnUiThread" into sc-v2-dev am: 953641e2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16321879

Change-Id: I763c42250a2793647122c3c12423457bc2a140c5
parents edb0527d 953641e2
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.system.OsConstants;
import android.util.Log;

import androidx.test.InstrumentationRegistry;
@@ -83,6 +84,7 @@ import java.lang.annotation.Target;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -327,7 +329,12 @@ public abstract class AbstractLauncherUiTest {
     */
    protected <T> T getOnUiThread(final Callable<T> callback) {
        try {
            return mMainThreadExecutor.submit(callback).get();
            return mMainThreadExecutor.submit(callback).get(DEFAULT_UI_TIMEOUT,
                    TimeUnit.MILLISECONDS);
        } catch (TimeoutException e) {
            Log.e(TAG, "Timeout in getOnUiThread, sending SIGABRT", e);
            Process.sendSignal(Process.myPid(), OsConstants.SIGABRT);
            throw new RuntimeException(e);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }