mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Update libsu
This commit is contained in:
parent
da13b5dbf2
commit
28d7a7a6d2
@ -15,7 +15,7 @@ dependencies {
|
|||||||
api project(':signing')
|
api project(':signing')
|
||||||
api 'org.kamranzafar:jtar:2.3'
|
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:core:${libsuVersion}"
|
||||||
api "com.github.topjohnwu.libsu:io:${libsuVersion}"
|
api "com.github.topjohnwu.libsu:io:${libsuVersion}"
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,6 @@ package com.topjohnwu.magisk;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.core.BuildConfig;
|
import com.topjohnwu.magisk.core.BuildConfig;
|
||||||
@ -20,7 +17,6 @@ import com.topjohnwu.superuser.Shell;
|
|||||||
public class App extends ContainerApp {
|
public class App extends ContainerApp {
|
||||||
|
|
||||||
public static App self;
|
public static App self;
|
||||||
public static Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
||||||
public boolean init = false;
|
public boolean init = false;
|
||||||
|
|
||||||
// Global resources
|
// Global resources
|
||||||
|
@ -5,10 +5,10 @@ import android.database.Cursor;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.App;
|
|
||||||
import com.topjohnwu.magisk.Config;
|
import com.topjohnwu.magisk.Config;
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.container.Repo;
|
import com.topjohnwu.magisk.container.Repo;
|
||||||
|
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -127,7 +127,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
private void notifyAdapter() {
|
private void notifyAdapter() {
|
||||||
if (adapterCb != null) {
|
if (adapterCb != null) {
|
||||||
App.mainHandler.post(adapterCb);
|
UiThreadHandler.run(adapterCb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.topjohnwu.magisk.utils.Utils;
|
|||||||
import com.topjohnwu.magisk.utils.ZipUtils;
|
import com.topjohnwu.magisk.utils.ZipUtils;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.ShellUtils;
|
||||||
|
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
@ -76,7 +77,7 @@ public abstract class FlashZip {
|
|||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
Shell.su("cd /", "rm -rf " + tmpFile.getParent() + " " + Const.TMP_FOLDER_PATH).submit();
|
Shell.su("cd /", "rm -rf " + tmpFile.getParent() + " " + Const.TMP_FOLDER_PATH).submit();
|
||||||
boolean finalSuccess = success;
|
boolean finalSuccess = success;
|
||||||
App.mainHandler.post(() -> onResult(finalSuccess));
|
UiThreadHandler.run(() -> onResult(finalSuccess));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import com.topjohnwu.signing.SignBoot;
|
|||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.ShellUtils;
|
||||||
import com.topjohnwu.superuser.internal.NOPList;
|
import com.topjohnwu.superuser.internal.NOPList;
|
||||||
|
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
||||||
import com.topjohnwu.superuser.io.SuFile;
|
import com.topjohnwu.superuser.io.SuFile;
|
||||||
import com.topjohnwu.superuser.io.SuFileInputStream;
|
import com.topjohnwu.superuser.io.SuFileInputStream;
|
||||||
import com.topjohnwu.superuser.io.SuFileOutputStream;
|
import com.topjohnwu.superuser.io.SuFileOutputStream;
|
||||||
@ -309,7 +310,7 @@ public abstract class MagiskInstaller {
|
|||||||
public void exec() {
|
public void exec() {
|
||||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
||||||
boolean b = operations();
|
boolean b = operations();
|
||||||
App.mainHandler.post(() -> onResult(b));
|
UiThreadHandler.run(() -> onResult(b));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
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.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@ -64,7 +64,7 @@ public class Topic {
|
|||||||
topicList[topic].published = true;
|
topicList[topic].published = true;
|
||||||
}
|
}
|
||||||
for (Subscriber sub : topicList[topic].subscribers) {
|
for (Subscriber sub : topicList[topic].subscribers) {
|
||||||
App.mainHandler.post(() -> sub.onPublish(topic, results));
|
UiThreadHandler.run(() -> sub.onPublish(topic, results));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import com.topjohnwu.magisk.container.Module;
|
|||||||
import com.topjohnwu.magisk.container.ValueSortedMap;
|
import com.topjohnwu.magisk.container.ValueSortedMap;
|
||||||
import com.topjohnwu.net.Networking;
|
import com.topjohnwu.net.Networking;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
||||||
import com.topjohnwu.superuser.io.SuFile;
|
import com.topjohnwu.superuser.io.SuFile;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -28,11 +29,11 @@ import java.util.Map;
|
|||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
public static void toast(CharSequence msg, int duration) {
|
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) {
|
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) {
|
public static String dlString(String url) {
|
||||||
|
@ -15,6 +15,7 @@ import com.topjohnwu.magisk.tasks.MagiskInstaller;
|
|||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.superuser.CallbackList;
|
import com.topjohnwu.superuser.CallbackList;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
@ -180,7 +181,7 @@ public class FlashActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public String set(int i, String s) {
|
public String set(int i, String s) {
|
||||||
String ret = super.set(i, s);
|
String ret = super.set(i, s);
|
||||||
App.mainHandler.post(this::updateUI);
|
UiThreadHandler.run(this::updateUI);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +213,7 @@ public class FlashActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResult(boolean success) {
|
protected void onResult(boolean success) {
|
||||||
if (success)
|
if (success)
|
||||||
App.mainHandler.postDelayed(Shell.su("pm uninstall " + getPackageName())::exec, 3000);
|
UiThreadHandler.handler.postDelayed(Shell.su("pm uninstall " + getPackageName())::exec, 3000);
|
||||||
else
|
else
|
||||||
super.onResult(false);
|
super.onResult(false);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import android.Manifest;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
Loading…
Reference in New Issue
Block a user