From b10bbaeae261becb3439144af70048d3e7aced68 Mon Sep 17 00:00:00 2001 From: Mis012 Date: Mon, 9 Jan 2023 13:54:11 +0100 Subject: [PATCH] src/api-impl/android/os/Looper.java: avoid some crashes --- src/api-impl/android/os/Looper.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api-impl/android/os/Looper.java b/src/api-impl/android/os/Looper.java index 88bd9be5..979074eb 100644 --- a/src/api-impl/android/os/Looper.java +++ b/src/api-impl/android/os/Looper.java @@ -105,9 +105,10 @@ public final class Looper { /** Returns the application's main looper, which lives in the main thread of the application. */ public static Looper getMainLooper() { - synchronized (Looper.class) { + return new Looper(); +/* synchronized (Looper.class) { return sMainLooper; - } + }*/ } /** @@ -167,10 +168,11 @@ public final class Looper { * null if the calling thread is not associated with a Looper. */ public static Looper myLooper() { - if(sThreadLocal.get() == null) { + return new Looper(); +/* if(sThreadLocal.get() == null) { prepare(false); } - return sThreadLocal.get(); + return sThreadLocal.get();*/ } /** @@ -290,7 +292,8 @@ public final class Looper { * Return the Thread associated with this Looper. */ public Thread getThread() { - return mThread; + return Thread.currentThread(); // ugly hack +// return mThread; } /** @hide */