From ae455a1bce0e0e068406fa2a0d4c3b4644a28919 Mon Sep 17 00:00:00 2001 From: TuxPaper <725353+TuxPaper@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:52:58 -0700 Subject: [PATCH] sync debugMinify flavor's code --- .../biglybt/android/client/DebugBiglyBTApp.java | 4 +--- .../com/biglybt/android/client/OffThread.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/debugMinify/java/com/biglybt/android/client/DebugBiglyBTApp.java b/app/src/debugMinify/java/com/biglybt/android/client/DebugBiglyBTApp.java index f760712d5..99c874c7f 100644 --- a/app/src/debugMinify/java/com/biglybt/android/client/DebugBiglyBTApp.java +++ b/app/src/debugMinify/java/com/biglybt/android/client/DebugBiglyBTApp.java @@ -55,9 +55,7 @@ public void onCreate() { builder.detectFileUriExposure(); } builder.detectLeakedClosableObjects(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - builder.detectLeakedRegistrationObjects(); - } + builder.detectLeakedRegistrationObjects(); builder.detectLeakedSqlLiteObjects(); StrictMode.setVmPolicy(builder.build()); diff --git a/app/src/debugMinify/java/com/biglybt/android/client/OffThread.java b/app/src/debugMinify/java/com/biglybt/android/client/OffThread.java index 7ac4dd776..519d9dd67 100644 --- a/app/src/debugMinify/java/com/biglybt/android/client/OffThread.java +++ b/app/src/debugMinify/java/com/biglybt/android/client/OffThread.java @@ -17,9 +17,7 @@ package com.biglybt.android.client; import android.app.Activity; -import android.os.Handler; -import android.os.Looper; -import android.os.SystemClock; +import android.os.*; import android.util.Log; import androidx.annotation.AnyThread; @@ -34,6 +32,19 @@ public class OffThread { private static final String TAG = "OffThread"; + private static HandlerThread workerThread = new HandlerThread("worker"); + + private static final Handler workerHandler; + + static { + workerThread.start(); + workerHandler = new Handler(workerThread.getLooper()); + } + + public static Handler getWorkerHandler() { + return workerHandler; + } + @AnyThread public static void runOnUIThread( @UiThread @NonNull RunnableUIThread runnable) {