mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 12:49:48 +00:00
Cast AsyncTask.THREAD_POOL_EXECUTOR to ThreadPoolExecutor
This commit is contained in:
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.topjohnwu.magisk.core.BuildConfig;
|
||||
@@ -14,10 +15,13 @@ import com.topjohnwu.net.Networking;
|
||||
import com.topjohnwu.superuser.ContainerApp;
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
public class App extends ContainerApp {
|
||||
|
||||
public static App self;
|
||||
public boolean init = false;
|
||||
public static ThreadPoolExecutor THREAD_POOL;
|
||||
|
||||
// Global resources
|
||||
public SharedPreferences prefs;
|
||||
@@ -29,6 +33,7 @@ public class App extends ContainerApp {
|
||||
Shell.Config.verboseLogging(BuildConfig.DEBUG);
|
||||
Shell.Config.addInitializers(RootUtils.class);
|
||||
Shell.Config.setTimeout(2);
|
||||
THREAD_POOL = (ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.topjohnwu.magisk.tasks;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.topjohnwu.magisk.App;
|
||||
import com.topjohnwu.magisk.Const;
|
||||
@@ -70,7 +69,7 @@ public abstract class FlashZip {
|
||||
}
|
||||
|
||||
public void exec() {
|
||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
||||
App.THREAD_POOL.execute(() -> {
|
||||
boolean success = false;
|
||||
try {
|
||||
success = flash();
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.topjohnwu.magisk.tasks;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -308,7 +307,7 @@ public abstract class MagiskInstaller {
|
||||
protected abstract void onResult(boolean success);
|
||||
|
||||
public void exec() {
|
||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
||||
App.THREAD_POOL.execute(() -> {
|
||||
boolean b = operations();
|
||||
UiThreadHandler.run(() -> onResult(b));
|
||||
});
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.topjohnwu.magisk.tasks;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.topjohnwu.magisk.App;
|
||||
import com.topjohnwu.magisk.Config;
|
||||
@@ -142,7 +141,7 @@ public class UpdateRepos {
|
||||
|
||||
public void exec(boolean force) {
|
||||
Topic.reset(Topic.REPO_LOAD_DONE);
|
||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
||||
App.THREAD_POOL.execute(() -> {
|
||||
cached = Collections.synchronizedSet(app.repoDB.getRepoIDSet());
|
||||
threadPool = Executors.newFixedThreadPool(CORE_POOL_SIZE);
|
||||
|
||||
|
@@ -8,7 +8,6 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.widget.Toast;
|
||||
@@ -97,7 +96,7 @@ public class Utils {
|
||||
|
||||
public static void loadModules() {
|
||||
Topic.reset(Topic.MODULE_LOAD_DONE);
|
||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
||||
App.THREAD_POOL.execute(() -> {
|
||||
Map<String, Module> moduleMap = new ValueSortedMap<>();
|
||||
SuFile path = new SuFile(Const.MAGISK_PATH);
|
||||
SuFile[] modules = path.listFiles(
|
||||
|
Reference in New Issue
Block a user