Update libsu

This commit is contained in:
topjohnwu 2019-01-31 23:49:57 -05:00
parent da13b5dbf2
commit 28d7a7a6d2
9 changed files with 15 additions and 16 deletions

View File

@ -15,7 +15,7 @@ dependencies {
api project(':signing')
api 'org.kamranzafar:jtar:2.3'
def libsuVersion = '2.2.0'
def libsuVersion = 'd99f481563'
api "com.github.topjohnwu.libsu:core:${libsuVersion}"
api "com.github.topjohnwu.libsu:io:${libsuVersion}"
}

View File

@ -3,9 +3,6 @@ package com.topjohnwu.magisk;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Looper;
import android.preference.PreferenceManager;
import com.topjohnwu.magisk.core.BuildConfig;
@ -20,7 +17,6 @@ import com.topjohnwu.superuser.Shell;
public class App extends ContainerApp {
public static App self;
public static Handler mainHandler = new Handler(Looper.getMainLooper());
public boolean init = false;
// Global resources

View File

@ -5,10 +5,10 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.container.Repo;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import java.util.HashSet;
import java.util.Set;
@ -127,7 +127,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
private void notifyAdapter() {
if (adapterCb != null) {
App.mainHandler.post(adapterCb);
UiThreadHandler.run(adapterCb);
}
}
}

View File

@ -9,6 +9,7 @@ import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.magisk.utils.ZipUtils;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@ -76,7 +77,7 @@ public abstract class FlashZip {
} catch (IOException ignored) {}
Shell.su("cd /", "rm -rf " + tmpFile.getParent() + " " + Const.TMP_FOLDER_PATH).submit();
boolean finalSuccess = success;
App.mainHandler.post(() -> onResult(finalSuccess));
UiThreadHandler.run(() -> onResult(finalSuccess));
});
}

View File

@ -17,6 +17,7 @@ import com.topjohnwu.signing.SignBoot;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;
import com.topjohnwu.superuser.internal.NOPList;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import com.topjohnwu.superuser.io.SuFile;
import com.topjohnwu.superuser.io.SuFileInputStream;
import com.topjohnwu.superuser.io.SuFileOutputStream;
@ -309,7 +310,7 @@ public abstract class MagiskInstaller {
public void exec() {
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
boolean b = operations();
App.mainHandler.post(() -> onResult(b));
UiThreadHandler.run(() -> onResult(b));
});
}

View File

@ -1,6 +1,6 @@
package com.topjohnwu.magisk.utils;
import com.topjohnwu.magisk.App;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -64,7 +64,7 @@ public class Topic {
topicList[topic].published = true;
}
for (Subscriber sub : topicList[topic].subscribers) {
App.mainHandler.post(() -> sub.onPublish(topic, results));
UiThreadHandler.run(() -> sub.onPublish(topic, results));
}
}

View File

@ -20,6 +20,7 @@ import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.magisk.container.ValueSortedMap;
import com.topjohnwu.net.Networking;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import com.topjohnwu.superuser.io.SuFile;
import java.util.Locale;
@ -28,11 +29,11 @@ import java.util.Map;
public class Utils {
public static void toast(CharSequence msg, int duration) {
App.mainHandler.post(() -> Toast.makeText(App.self, msg, duration).show());
UiThreadHandler.run(() -> Toast.makeText(App.self, msg, duration).show());
}
public static void toast(int resId, int duration) {
App.mainHandler.post(() -> Toast.makeText(App.self, resId, duration).show());
UiThreadHandler.run(() -> Toast.makeText(App.self, resId, duration).show());
}
public static String dlString(String url) {

View File

@ -15,6 +15,7 @@ import com.topjohnwu.magisk.tasks.MagiskInstaller;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.CallbackList;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import java.io.File;
import java.io.FileWriter;
@ -180,7 +181,7 @@ public class FlashActivity extends BaseActivity {
@Override
public String set(int i, String s) {
String ret = super.set(i, s);
App.mainHandler.post(this::updateUI);
UiThreadHandler.run(this::updateUI);
return ret;
}
}
@ -212,7 +213,7 @@ public class FlashActivity extends BaseActivity {
@Override
protected void onResult(boolean success) {
if (success)
App.mainHandler.postDelayed(Shell.su("pm uninstall " + getPackageName())::exec, 3000);
UiThreadHandler.handler.postDelayed(Shell.su("pm uninstall " + getPackageName())::exec, 3000);
else
super.onResult(false);
}

View File

@ -4,7 +4,6 @@ import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.Toast;